Community
Participate
Working Groups
This bug will track all problems found with ITD Aware reconciling errors. With the new style of ITD Aware eager parsing and reconciling, I need to address and remove all spurious problems caused by inserting ITDs into existing classes.
This code breaks the reconciler. Try it out. public interface DeleteAction<T>{ public void delete(); public T getSelected(); } public aspect DeleteActionAspect { public void DeleteAction<T>.delete() { T selected = getSelected(); if(selected == null) throw new NullPointerException("Selected object is null"); if(selected instanceof Permanent){ Permanent permanent = (Permanent)selected; permanent.toggleActive(); } H2Lookup.em().remove(selected); } }
The problem is that when creating the mock methods needed for reconciling, the delete() method is inserted into the DeleteAction interface even though it already exists. This causes a duplicate method error. What should be happening is that if the Type is an interface, then ignore ITD methods when doing ITD insertions. The assumption is that when this occurs, the inserted method is an implementation of an existing method. If this is not the case, then the compiler will pick up the error. But, I still need to check on ITD fields and constructors (are these even possible?) on interfaces.
Whoops the comment I just placed on bug 257438 was actually meant for this one. The markers error is not causing me too much grief right now, but this is making editing the affected files a bit difficult. Let me know if you want me to test any potential fixes.
Fix for this will be available in next dev build. I did a lot to ensure that ITDs with generics are properly reconciled. There are a few corner cases that I didn't do because I believe they are rare, and they are also costly to look for. The reconciling is essentially a compilation. The way the AJ reconciling works is that: 1. I add ITD awareness whereever necessary 2. perform a regular reconcile 3. back out the ITD awareness 4. go through the resulting problems to remove problems related to advice declarations and declare declarations, etc. Step 4 can potentially add a lot of time to the reconciling operation, so I have to be careful that I don't do too much computation during this step.
Dave, can you please try this latest dev build. Let me know if there you are still seeing any spurious errors. Please include some code if you can.
I've opened a bunch of aspects containing ITDs and interfaces that ITDs are applied to. As far as I can tell they all look good.
That's great news. Glad it's working for you now. Keeping this bug open in case anything else is found before the release of 1.6.2.
Here is a message I just got. More problems with ITD Aware reconciling. --------------------------- there are a number of errors still flagged in the Java Editor related to fields and methods introduced by an aspect that I use. A snippet of the aspect is: public aspect LifecycleImpl { private boolean Lifecycle.autoStart = true; private int Lifecycle.killTimeout; private volatile boolean Lifecycle.running; public boolean Lifecycle.isRunning() { return running; } public void Lifecycle.setRunning(boolean running) { this.running = running; } ... } Then there is the interface Lifecycle: public interface Lifecycle { void isRunning (); void setRunning(boolean running); ... { A sub-interface of Lifecycle, Sender is: public interface Sender extends Configurable, Lifecycle { void send(MessageContext msgContext) throws Fault; } In the Java Editor for Lifecycle I get an error in the left hand gutter of: Multiple markers at this line - Illegal modifier for the interface field Lifecycle.running; only public, static & final are permitted - Illegal modifier for the interface field Lifecycle.killTimeout; only public, static & final are permitted - Illegal modifier for the interface field Lifecycle.autoStart; only public, static & final are permitted In the Java Editor for Sender I get an error in the left hand gutter of: "The type Lifecycle cannot be a superinterface of Sender; a superinterface must be an interface" Finally an implementor of the Sender interface, CommunityManagerUploadSender is: public class CommunityManagerUploadSender extends AbstractConfigurable implements Sender { .. } Here the error is: Multiple markers at this line - The hierarchy of the type CommunityManagerUploadSender is inconsistent - 15 AspectJ markers at this line This behavior is definitely different than pre AJDT 1.6.2, but it appears that ITD support is still having problems with my paticular situation. Are these errors expected??? ---------------------------
About to commit a fix that will address the problems from comment 7. There are more corner cases that I need to deal with. I am going to go through the attached projects of bug 242797 to make sure that they all work.
More ITD issues. From the newsgroup: ============================ Hello, i have some problems using itd with ajdt 1.6.3. environment: - clean install of eclipse-SDK-3.4.1-win32 - using http://download.eclipse.org/tools/ajdt/34/dev/update installing 1.6.3.20090110234235 AJDT (JT Weaving) installing 1.0.0.200901090822 Equinox Aspects Feature simple test implementation: // package test; public enum MyEnum { C1, C2; } // package test.mi; public aspect MixIn1 { public interface IMixIn1 {}; declare parents : test.mo.* implements Object; public String IMixIn1.f11; public void IMixIn1.m11() { System.out.println("called m11"); }; public void IMixIn1.m12() { System.out.println("called m12"); }; } // package test.mi; public aspect MixIn2 { public interface IMixIn2 {}; declare parents : test.mo.* implements IMixIn2; public void IMixIn2.m21() { System.out.println("called m21"); }; } // package test.mi; import test.*; import static test.MyEnum.*; public aspect MixIn3 { private static MyEnum me1 = MyEnum.C1; private static MyEnum me2 = C2; public interface IMixIn3 {}; declare parents : test.mo.* implements IMixIn3; public void IMixIn3.m31() { System.out.println(me1 + " " + me2); }; } // package test.mo; import test.mi.MixIn1.IMixIn1; import test.mi.MixIn2.IMixIn2; import test.mi.MixIn3.IMixIn3; public class MixedObject implements IMixIn1, IMixIn2, IMixIn3 { } // package test.mo; public class Test { public static void main(String[] args) { MixedObject mo = new MixedObject(); mo.m11(); mo.m12(); mo.m31(); mo.f11 = "value"; System.out.println(mo.f11); } } // package test.mo; public class Test1 { public static void main(String[] args) { new Test1().m21(); new Test1().m31(); } } problem descriptions: - MixIn1 with "wrong" 'implements Objects' works "fine" with weaving method and field only into MixedObject - MixIn2 with correct 'implements IMixIn2' weaves into all classes of package test.mo - MixIn3 has marker "MyEnum$C1 cannot be resolved", but works fine - MixedObject code assist doesn't work for IMixIn* in implements clause, List shows them but selection doesn't work - context menu "Declared On" at "declare parents : test.mo.* implements IMixIn2;" in MinIn2 shows Test, Test1 - no aspectj marker at "declare parents : test.mo.* implements Object;" in MinIn1 - code works but should not, Test1 and Test2 are executable question: bug or my mistake ? Thanks, Max
Actually, the only problem left to fix in this is the reference to the Enum: public aspect MixIn3 { private static MyEnum me1 = MyEnum.C1; private static MyEnum me2 = C2; } The AspectsConvertingParser sees MyEnum.C1 and thinks it is an ITD. So, replaces '.' with '$'. Wrong and bad.
Comment #11 has been fixed and is currently available in the latest dev release.
Currently looking at all the attached projects in bug 242797: h2-test.zip bug.zip whoa.zip
These projects are uncovering lots of little errors. Just found out that type parameters are not passed onto type declarations when building the structure for AJCompilationUnits. Now, for type declarations, we are converting type parameters from an AspectJ type param to a JDT type param. See AJCompilationUnitStructureRequestor.convertTypeParameters
All comments in this bug have been addressed. Closing this bug for 1.6.4. Open a new bug if any more errors with ITD Aware reconciling are found.