Browse Source

Fix 433351: Declare parents fails on interfaces on the inpath depending on directory structure

tags/V1_8_9
Andy Clement 8 years ago
parent
commit
f4c8433cb0

+ 2
- 1
org.aspectj.matcher/src/org/aspectj/weaver/ReferenceType.java View File

annotations = null; annotations = null;
annotationTypes = null; annotationTypes = null;
newSuperclass = null; newSuperclass = null;
bits = 0; // clears the hierarchy complete tag (amongst other things)
newInterfaces = null; newInterfaces = null;
typeVariables = null; typeVariables = null;
parameterizedInterfaces.clear(); parameterizedInterfaces.clear();
if (getDelegate() != null) { if (getDelegate() != null) {
delegate.ensureConsistent(); delegate.ensureConsistent();
} }
if (isRawType()) {
if (isParameterizedOrRawType()) {
ReferenceType genericType = getGenericType(); ReferenceType genericType = getGenericType();
if (genericType != null) { if (genericType != null) {
genericType.ensureConsistent(); genericType.ensureConsistent();

+ 9
- 1
org.aspectj.matcher/src/org/aspectj/weaver/ResolvedType.java View File



protected World world; protected World world;


private int bits;
protected int bits;


private static int AnnotationBitsInitialized = 0x0001; private static int AnnotationBitsInitialized = 0x0001;
private static int AnnotationMarkedInherited = 0x0002; private static int AnnotationMarkedInherited = 0x0002;
} }


public void tagAsTypeHierarchyComplete() { public void tagAsTypeHierarchyComplete() {
if (isParameterizedOrRawType()) {
ReferenceType genericType = this.getGenericType();
genericType.tagAsTypeHierarchyComplete();
return;
}
bits |= TypeHierarchyCompleteBit; bits |= TypeHierarchyCompleteBit;
} }


public boolean isTypeHierarchyComplete() { public boolean isTypeHierarchyComplete() {
if (isParameterizedOrRawType()) {
return this.getGenericType().isTypeHierarchyComplete();
}
return (bits & TypeHierarchyCompleteBit) != 0; return (bits & TypeHierarchyCompleteBit) != 0;
} }



+ 8
- 0
tests/bugs189/433351/ClassProj1.java View File

package test;

public abstract class ClassProj1<T> implements InterfaceProj1<String> {

public int aMethod() {
return 1;
}
}

+ 9
- 0
tests/bugs189/433351/ClassProj2.java View File

package test.extender;

public abstract class ClassProj2<T> implements InterfaceProj2<T> {

public int bMethod() {
return 2;
}
}

tests/bugs181/433351/Extender.aj → tests/bugs189/433351/Extender.aj View File


+ 10
- 0
tests/bugs189/433351/Extender2.aj View File

package test.extender;
import test.*;

public aspect Extender2 {

declare parents: InterfaceProj1 extends java.io.Serializable;

// declare parents: test.ClassProj1 extends ClassProj2;

}

+ 10
- 0
tests/bugs189/433351/Extender3.aj View File

package test.extender;
import test.*;

public aspect Extender3 {

declare parents: InterfaceProj1 extends InterfaceProj2;

declare parents: test.ClassProj1 extends ClassProj2;

}

tests/bugs181/433351/InterfaceProj1.java → tests/bugs189/433351/InterfaceProj1.java View File


tests/bugs181/433351/InterfaceProj2.java → tests/bugs189/433351/InterfaceProj2.java View File


+ 0
- 4
tests/src/org/aspectj/systemtest/ajc181/Ajc181Tests.java View File

* @author Andy Clement * @author Andy Clement
*/ */
public class Ajc181Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public class Ajc181Tests extends org.aspectj.testing.XMLBasedAjcTestCase {

public void testJarWeaving_433351() {
runTest("jar weaving");
}
public void testParameterNamesAttribute_436531() { public void testParameterNamesAttribute_436531() {
runTest("parameter names attribute"); runTest("parameter names attribute");

+ 0
- 7
tests/src/org/aspectj/systemtest/ajc181/ajc181.xml View File



<suite> <suite>


<ajc-test dir="bugs181/433351" title="jar weaving">
<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/436531" title="parameter names attribute"> <ajc-test dir="bugs181/436531" title="parameter names attribute">
<compile options="-1.8" files="Azpect.java" inpath="code.jar"/> <compile options="-1.8" files="Azpect.java" inpath="code.jar"/>
</ajc-test> </ajc-test>

+ 16
- 0
tests/src/org/aspectj/systemtest/ajc189/Ajc189Tests.java View File

*/ */
public class Ajc189Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public class Ajc189Tests extends org.aspectj.testing.XMLBasedAjcTestCase {


public void testJarWeaving_433351() {
runTest("jar weaving");
}
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 testNPEAtAspectJ() throws Exception { public void testNPEAtAspectJ() throws Exception {
runTest("NPE at aspectj"); runTest("NPE at aspectj");
} }

+ 0
- 1
tests/src/org/aspectj/systemtest/ajc189/AllTestsAspectJ189.java View File



import junit.framework.Test; import junit.framework.Test;
import junit.framework.TestSuite; import junit.framework.TestSuite;
import org.aspectj.systemtest.apt.AptTests;


public class AllTestsAspectJ189 { public class AllTestsAspectJ189 {



+ 29
- 0
tests/src/org/aspectj/systemtest/ajc189/ajc189.xml View File



<suite> <suite>


<ajc-test dir="bugs189/433351" title="jar weaving">
<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="bugs189/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="bugs189/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="bugs189/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="bugs189/485583" title="NPE at aspectj"> <ajc-test dir="bugs189/485583" title="NPE at aspectj">
<compile files="Foo.aj Bar.aj" options="-1.8"> <compile files="Foo.aj Bar.aj" options="-1.8">
<message kind="error" text="The abstract pointcut deprecatedCode can only be defined in an aspect"/> <message kind="error" text="The abstract pointcut deprecatedCode can only be defined in an aspect"/>

+ 5
- 1
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java View File

} }
ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_DECLARE_PARENTS, ContextToken tok = CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.PROCESSING_DECLARE_PARENTS,
resolvedTypeToWeave.getName()); 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); CompilationAndWeavingContext.leavingPhase(tok);
typesForWeaving.remove(typeToWeave); typesForWeaving.remove(typeToWeave);
resolvedTypeToWeave.tagAsTypeHierarchyComplete(); resolvedTypeToWeave.tagAsTypeHierarchyComplete();

Loading…
Cancel
Save