annotations = null;
annotationTypes = null;
newSuperclass = null;
+ bits = 0; // clears the hierarchy complete tag (amongst other things)
newInterfaces = null;
typeVariables = null;
parameterizedInterfaces.clear();
if (getDelegate() != null) {
delegate.ensureConsistent();
}
- if (isRawType()) {
+ if (isParameterizedOrRawType()) {
ReferenceType genericType = getGenericType();
if (genericType != null) {
genericType.ensureConsistent();
protected World world;
- private int bits;
+ protected int bits;
private static int AnnotationBitsInitialized = 0x0001;
private static int AnnotationMarkedInherited = 0x0002;
}
public void tagAsTypeHierarchyComplete() {
+ if (isParameterizedOrRawType()) {
+ ReferenceType genericType = this.getGenericType();
+ genericType.tagAsTypeHierarchyComplete();
+ return;
+ }
bits |= TypeHierarchyCompleteBit;
}
public boolean isTypeHierarchyComplete() {
+ if (isParameterizedOrRawType()) {
+ ReferenceType genericType = this.getGenericType();
+ return genericType.isTypeHierarchyComplete();
+ }
return (bits & TypeHierarchyCompleteBit) != 0;
}
--- /dev/null
+package test;
+
+public abstract class ClassProj1<T> implements InterfaceProj1<String> {
+
+ public int aMethod() {
+ return 1;
+ }
+}
--- /dev/null
+package test.extender;
+
+public abstract class ClassProj2<T> implements InterfaceProj2<T> {
+
+ public int bMethod() {
+ return 2;
+ }
+
+}
--- /dev/null
+package test.extender;
+import test.*;
+
+public aspect Extender2 {
+
+ declare parents: InterfaceProj1 extends java.io.Serializable;
+
+// declare parents: test.ClassProj1 extends ClassProj2;
+
+}
--- /dev/null
+package test.extender;
+import test.*;
+
+public aspect Extender3 {
+
+ declare parents: InterfaceProj1 extends InterfaceProj2;
+
+ declare parents: test.ClassProj1 extends ClassProj2;
+
+}
*/
public class Ajc181Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+ public void testJarWeaving_433351_4() {
+ runTest("jar weaving 4");
+ }
+
+ public void testJarWeaving_433351_3() {
+ runTest("jar weaving 3");
+ }
+
+ public void testJarWeaving_433351_2() {
+ runTest("jar weaving 2");
+ }
+
public void testJarWeaving_433351() {
runTest("jar weaving");
}
<suite>
<ajc-test dir="bugs181/433351" title="jar weaving">
- <compile options="-1.5" files="InterfaceProj1.java" outjar="code.jar"/>
+ <compile options="-1.5" files="InterfaceProj1.java" outjar="code.jar"/>
<compile options="-1.5 -showWeaveInfo" inpath="code.jar" files="Extender.aj InterfaceProj2.java">
<message kind="weave" text="Extending interface set for type 'test.InterfaceProj1' (InterfaceProj1.java) to include 'test.extender.InterfaceProj2' (Extender.aj)"/>
</compile>
</ajc-test>
+ <ajc-test dir="bugs181/433351" title="jar weaving 2">
+ <compile options="-1.5" files="InterfaceProj1.java ClassProj1.java" outjar="code.jar"/>
+ <compile options="-1.5 -showWeaveInfo" inpath="code.jar" files="Extender2.aj" outjar="code2.jar">
+ <message kind="weave" text="Extending interface set for type 'test.InterfaceProj1' (InterfaceProj1.java) to include 'java.io.Serializable' (Extender2.aj)"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs181/433351" title="jar weaving 3">
+ <compile options="-1.5" files="InterfaceProj1.java ClassProj1.java" outjar="code.jar"/>
+ <compile options="-1.5 -showWeaveInfo" inpath="code.jar" files="Extender3.aj InterfaceProj2.java ClassProj2.java" outjar="code2.jar">
+ <message kind="weave" text="Setting superclass of type 'test.ClassProj1' (ClassProj1.java) to 'test.extender.ClassProj2' (Extender3.aj)"/>
+ <message kind="weave" text="Extending interface set for type 'test.InterfaceProj1' (InterfaceProj1.java) to include 'test.extender.InterfaceProj2' (Extender3.aj)"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs181/433351" title="jar weaving 4">
+ <compile options="-1.5" files="ClassProj1.java InterfaceProj1.java" outjar="code.jar"/>
+ <compile options="-1.5 -showWeaveInfo" inpath="code.jar" files="Extender2.aj" outjar="code2.jar">
+ <message kind="weave" text="Extending interface set for type 'test.InterfaceProj1' (InterfaceProj1.java) to include 'java.io.Serializable' (Extender2.aj)"/>
+ </compile>
+ </ajc-test>
+
<ajc-test dir="bugs181/436531" title="parameter names attribute">
<compile options="-1.8" files="Azpect.java" inpath="code.jar"/>
</ajc-test>
// resolve it if the caller could not pass in the resolved type
resolvedTypeToWeave = world.resolve(typeToWeave);
}
+// if (resolvedTypeToWeave.isTypeHierarchyComplete()) {
+// typesForWeaving.remove(typeToWeave);
+// return;
+// }
ResolvedType superclassType = resolvedTypeToWeave.getSuperclass();
String superclassTypename = (superclassType == null ? null : superclassType.getName());
}
ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_DECLARE_PARENTS,
resolvedTypeToWeave.getName());
- weaveParentTypeMungers(resolvedTypeToWeave);
+ // If A was processed before B (and was declared 'class A implements B') then there is no need to complete B again, it
+ // will have been done whilst processing A.
+ if (!resolvedTypeToWeave.isTypeHierarchyComplete()) {
+ weaveParentTypeMungers(resolvedTypeToWeave);
+ }
CompilationAndWeavingContext.leavingPhase(tok);
typesForWeaving.remove(typeToWeave);
resolvedTypeToWeave.tagAsTypeHierarchyComplete();