Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] AspectJ M3a: compile error but donot know what's wrong

The following is the AspectJ code that use Inter-type declarations:
 
public abstract aspect ObserverProtocol{
  private Collection Subject.observers=new ArrayList();
 .....
  public Collection Subject.getObservers()
  { 
   return observers;    //line 39
  }
}
 
The following is the output of the compiler.
     [iajc] D:\workdir\DPsample\main\src\com\designpattern\observer\ObserverProt
ocol.aj:39 [error] Type mismatch: cannot convert from Collection to Collection
     [iajc] return observers;
     [iajc]        ^^^^^
 
What is wrong with the above code?
 
In AJDT1.3.0.20050905154239, this line is also marked as x in red. I change this line to 
       return null ;
the marker disappear, then I change it to 
     return observers;
again. AJDT still shows that this line is correct, and the program run correctly.
 
I think maybe this is a bug in M3a.
 
thanks
 
guofeng
 


Back to the top