[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] declare parents problem with non-public classes?

I'm running into problems using declare parents on non-public classes. When the code below is compiled, it runs fine (as expected). If, however, the package declaration is uncommented, and the declares parent is changed to the currently commented out line, then AJC reports the following:

RunnableAspect.aj:2 warning no match for this type name: mypackage$MyClass$MyInnerClass [Xlint:invalidAbsoluteTypeName]
[ajc] declare parents: mypackage.MyClass$MyInnerClass implements Runnable;
[ajc] ^^^^^^^^^^^^^^^^^^^^^^^^^^^



If the inner-class is defined as "public", then there is no problem with the compilation.


If the inner-class is moved outside of "MyClass", but defined in the same java file, the compilation fails as well.

This suggests that there is a problem with declare parents and non-public classes. Is this known/expected? If not, I'll be happy to file a bug report. I'm using the AspectJ 1.2.

Thanks!

<MyClass.java>

// package mypackage;

public class MyClass {
 public MyClass() {
   MyInnerClass mic = new MyClass.MyInnerClass();
   if (mic instanceof Runnable)
     mic.run();
 }

 class MyInnerClass {
   public void run() {
     System.out.println("In MyInnerClass.run()!!");
   }
 }

 public static void main(String args[]) {
   new MyClass();
 }
}

</MyClass.java>

<RunnableAspect.aj>
public aspect RunnableAspect {
 declare parents: MyClass$MyInnerClass implements Runnable;
 // declare parents: mypackage.MyClass$MyInnerClass implements Runnable;
}
</RunnableAspect.aj>

--
Keven Ring               | "Oh no,  Not Again..."
The MITRE Corporation    |   Bowl of Petunias -
7515 Colshire Drive      |   The Hitchhikers Guide to the Galaxy
McLean VA 22102-7508     |
PH: (703)883-7026        |