|
|
Re: Method not accessible [message #759279 is a reply to message #758605] |
Mon, 28 November 2011 09:04 |
Ivan Larionov Messages: 37 Registered: July 2009 |
Member |
|
|
Hi Jakob,
I cannot provide a solution. I can just suggest a workaround.
You may try to export "internal.test" this way:
Export-Package: internal.test; x-internal:=true,
test
Then, while importing dependencies via Require-Bundle, you will be able
to use that method, though getting a warning in place of its invocation
instead of the error.
I am pretty sure someone can suggest a better way. I am looking forward
to it as well.
Regards,
Ivan
On 23.11.2011 22:37, Jakob Braeuchi wrote:
> hi,
>
> i do have a problem with the visibility of inherited methods.
>
> bundle1
> - package internal.test is NOT exported. it contains an abstract class with methodA()
> - package test is exported, this package contains the concrete class inherited from the class in internal.test. this class has a method methodB()
>
> bundle2 requires bundle1
> - i create an instance of the concrete class and call methodA() and methodB()
> - methodB() is ok but the compiler complains about methodA() being not accessible.
>
> exporting internal.test is not an option, setting the errors/warnings for forbidden access to warning is also not an option. i could implement methodA() in the concrete class as well but i think this is not the way to go.
>
> things get even worse when i add an interface to the public package and have the abstract class implement this interface. with this scenarion methodA() of the concrete class still produces an error, but when i cast this instance to the interface it works:
>
>
> TheClass cls = new TheClass();
>
> // ok
> cls.methodB();
>
> // method not visible because the package internal.test of bundle test.bundle1
> // is not exported
> cls.methodA();
>
> // ok
> ((TheInterface)cls).methodA();
>
>
> i have attached a zip with the two bundles to demonstrate this problem.
>
> thanks jakob
>
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04270 seconds