Summary: | Problem with declare parents when using non-public classes | ||
---|---|---|---|
Product: | [Tools] AspectJ | Reporter: | Keven Ring <keven> |
Component: | Compiler | Assignee: | Adrian Colyer <adrian.colyer> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | ||
Version: | 1.2 | ||
Target Milestone: | 1.5.0 M4 | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
Keven Ring
2004-10-15 13:23:09 EDT
There is a bug here, but its not what I expected it to be. When referring to inner classes in type patterns like this, you should use the '.' notation rather than the $ notation. So to refer to MyInnerClass, either: // this works if you import mypackage.* declare parents: MyClass.MyInnerClass implements Runnable; // this just works //declare parents: mypackage.MyClass.MyInnerClass implements Runnable; What actually causes the confusion is that this works: declare parents: MyClass$MyInnerClass implements Runnable; when MyClass is not in a package. It makes you think that: declare parents: mypackage.MyClass$MyInnerClass implements Runnable; should work when you put MyClass into a package. Actually 'MyClass$MyInnerClass' doesn't refer to an inner class, it refers to a class called 'MyClass$MyInnerClass' as $ is valid in a class name. So the bug is that we should have put out an error indicating no type match for: declare parents: MyClass$MyInnerClass implements Runnable; which would have led you to try MyClass.MyInnerClass which is correct. scheduled for aj5m4 Correctly produces xlint message "no type match for: blah blah" with the latest compiler builds. |