fragmentargs icon indicating copy to clipboard operation
fragmentargs copied to clipboard

Inheritance of package-private args with classes in different packages

Open pamalyshev opened this issue 8 years ago • 0 comments

For example if we have two classes in different packages:

@FragmentWithArgs
public class ClassInPackageA extends android.app.Fragment {
    @Arg
    String argA;
}

and

@FragmentWithArgs
public class ClassInPackageB extends ClassInPackageA {
    @com.hannesdorfmann.fragmentargs.annotation.Arg
    String argB;
}

Then we'll get compilation error:

Error:(36, 13) error: argA is not public in ClassInPackageA; cannot be accessed from outside package

This is because ClassInPackageBBuilder#injectArguments is trying to access argA by itself. One solution to this could be is to delegate to ClassInPackageABuilder#injectArguments. I've created test for this in https://github.com/pamalyshev/fragmentargs/commit/dde8b1db38a03b3b161f6651a4f2dcfa36a07de1

pamalyshev avatar Jun 11 '16 16:06 pamalyshev