Community
Participate
Working Groups
Created attachment 86642 [details] Aspect J program in which I got bug Hi, I got ArrayOutOfBoundException for my aspectJ program that is attached with this email. Just before the compilation, I added a generic element <E> while declaring an inter-type variable. Initially the successfully compiled code was : public List < Observer< LinkedList<E>> > LinkedList.observersList = new Vector< Observer<LinkedList<E>> >(); I changed to public List < Observer< LinkedList<E>> > LinkedList<E>.observersList = new Vector< Observer<LinkedList<E>> >(); and I got below exception message: java.lang.ArrayIndexOutOfBoundsException at org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.internalMakeMethodBinding(EclipseFactory.java:824) at org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.internalMakeMethodBinding(EclipseFactory.java:793) at org.aspectj.ajdt.internal.compiler.lookup.EclipseFactory.makeMethodBinding(EclipseFactory.java:773) at org.aspectj.ajdt.internal.compiler.ast.InterTypeFieldDeclaration.resolve ... ob.run(AutoBuildJob.java:235) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) Compile error: ArrayIndexOutOfBoundsException thrown: 0 Thanks, Kunal Pathak.
Hi, I've got the same exception on the same line while compiling a generic aspect. The problem seems to be caused by trying to access a field declared on a generic type via an inter-type declaration. public abstract aspect Composite<Item, Container> { private C CompositeItem<C>.container; public List<I> CompositeContainer<I>.itemList = new ArrayList<I>(); public CompositeContainer<I> CompositeContainer<I>.addItem(I i) { itemList.add(i); // Commenting out this line results in the described Exception // i.container = this; return this; } // interface/parents declaration and further methods left out } Replacing the field access with a setter method doesn't help... The Bug is still present in AJDT 1.5.1.
test and fix committed for AspectJ1.6.0rc1. Will be in AJDT shortly.