Community
Participate
Working Groups
If private members are introduced via an interface to classes, the introduced members are visible inside the classes themselves, although the visibility is supposed to be relative to the aspect. Here's a sample: public class Sample { public static void main(String[] args) { Sample s = new Sample(); s.aMethod(); } public void aMethod() { // x is introduced by the following aspect as private // so it should not be accessible here System.out.println("I have " + x); } } aspect SampleAspect { private interface Tag {}; private int Tag.x = 0; declare parents: Sample implements Tag; }
I've confirmed this bug but don't have a fix yet. I'm setting the target milestone to 1.2 to see if we can get it fixed before that release. I'm assigning to Adrian as this is a bug in the compiler front-end.
The problem was a missed case in Scope.findField() [in the shadows). Whenever we find a field, we in addition check to see that it is actually visible via a call to field.getVisibleBinding(). I'm guessing 30 M6 added a new route for field finding that wasn't in 2.1.1, and so we didn't pick up the new case during the 3-way merge. Simple fix is to add the call field = field.getVisibleBinding(.....) after finding the field. Will commit fix once all tests are passing etc....
Tests clear. Fix committed to tree.