aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2006-05-22 10:27:30 +0000
committeraclement <aclement>2006-05-22 10:27:30 +0000
commit4dea3ad2411d5ea80b6f49ed342e96e52a39a91a (patch)
tree02d2414065a8a07ab49cd1ff7ecb5b4f50416626
parent0e6530f173f186e1668043abeb08df51b593c9de (diff)
downloadaspectj-4dea3ad2411d5ea80b6f49ed342e96e52a39a91a.tar.gz
aspectj-4dea3ad2411d5ea80b6f49ed342e96e52a39a91a.zip
test and fix for pr132349: itds on inner type of generic type
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java33
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java4
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/ajc152.xml22
3 files changed, 58 insertions, 1 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java
index 4c93be6ec..2d1c411dd 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeDeclaration.java
@@ -27,11 +27,13 @@ import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ClassFile;
import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ParameterizedQualifiedTypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ParameterizedSingleTypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodScope;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
@@ -177,6 +179,9 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
protected void resolveOnType(ClassScope classScope) {
checkSpec();
+
+ if (onType==null) return; // error reported elsewhere.
+
// If they did supply a parameterized single type reference, we need to do
// some extra checks...
if (onType instanceof ParameterizedSingleTypeReference) {
@@ -187,6 +192,15 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
classScope.problemReporter().invalidType(onType, onTypeBinding);
ignoreFurtherInvestigation = true;
}
+ if (onTypeBinding.isParameterizedType()) {
+ // might be OK... pr132349
+ ParameterizedTypeBinding ptb = (ParameterizedTypeBinding)onTypeBinding;
+ if (ptb.isNestedType()) {
+ if (ptb.typeVariables()==null || ptb.typeVariables().length==0) {
+ if (ptb.enclosingType().isRawType()) onTypeBinding = ptb.type;
+ }
+ }
+ }
}
}
@@ -350,9 +364,26 @@ public abstract class InterTypeDeclaration extends AjMethodDeclaration {
long pos = (((long)pref.sourceStart) << 32) | pref.sourceEnd;
ot = new SingleTypeReference(pref.token,pos);
}
-
+
// resolve it
ReferenceBinding rb = (ReferenceBinding)ot.getTypeBindingPublic(scope.parent);
+
+ if (ot instanceof ParameterizedQualifiedTypeReference) { // pr132349
+ ParameterizedQualifiedTypeReference pref = (ParameterizedQualifiedTypeReference) ot;
+ if (pref.typeArguments!=null && pref.typeArguments.length!=0) {
+ scope.problemReporter().signalError(sourceStart,sourceEnd,
+ "Cannot make inter-type declarations on parameterized types");
+ // to prevent disgusting cascading errors after this problem - lets null out what leads to them (pr105038)
+ this.arguments=null;
+ this.returnType=new SingleTypeReference(TypeReference.VOID,0L);
+
+ this.ignoreFurtherInvestigation=true;
+ ReferenceBinding closestMatch = null;
+ rb = new ProblemReferenceBinding(ot.getParameterizedTypeName(),closestMatch,0);
+ onType=null;
+ }
+ }
+
if (rb instanceof TypeVariableBinding) {
scope.problemReporter().signalError(sourceStart,sourceEnd,
diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
index 9140b5418..16819a7fb 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
@@ -17,6 +17,10 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
+ public void testItdOnInnerTypeOfGenericType_pr132349() { runTest("ITD on inner type of generic type");}
+ public void testItdOnInnerTypeOfGenericType_pr132349_2() { runTest("ITD on inner type of generic type - 2");}
+ public void testItdOnInnerTypeOfGenericType_pr132349_3() { runTest("ITD on inner type of generic type - 3");}
+// public void testCovarianceAndDecp_pr128443_1() { runTest("covariance and decp - 1"); }
public void testLTWGeneratedAspectAbstractMethod_pr125480() { runTest("aop.xml aspect inheriting abstract method ");}
public void testLTWGeneratedAspectAbstractMethod_pr125480_2() { runTest("aop.xml aspect inheriting abstract method - code style");}
//public void testSuperITDExplosion_pr134425() { runTest("super ITDs");}
diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
index fea570ff0..aaa4a7c07 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
+++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
@@ -14,6 +14,24 @@
</stderr>
</run>
</ajc-test>
+
+ <ajc-test dir="bugs152/pr132349" title="ITD on inner type of generic type">
+ <compile files="TopLevelType.java" options="-1.5"/>
+ <run class="TopLevelType"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs152/pr132349" title="ITD on inner type of generic type - 2">
+ <compile files="TopLevelType2.java" options="-1.5">
+ <message kind="error" line="12"/> <!-- error message is currently crap - its a parser message -->
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs152/pr132349" title="ITD on inner type of generic type - 3">
+ <compile files="TopLevelType3.java" options="-1.5">
+ <message kind="error" line="12" text="Cannot make inter-type declarations on parameterized types"/>
+ <message kind="error" line="7" text="The method someMethod() is undefined for the type TopLevelType3.NestedType"/>
+ </compile>
+ </ajc-test>
<ajc-test dir="bugs152/pr135865" title="misbehaving declare annotation">
<compile files="B.java,A.java" options="-1.5 -Xlint:ignore">
@@ -404,6 +422,10 @@
<run class="Derived"/>
</ajc-test>
+ <ajc-test dir="bugs152/pr128443" title="covariance and decp - 1">
+ <compile files="Covariance.java" options="-1.5"/>
+ </ajc-test>
+
<!-- wont work whilst the compiler BuildArgParser.setDebugOptions is always switching debug on -->
<ajc-test dir="bugs152/pr129408" title="long winded ataj messages">
<compile files="AtAj.java" options="-XterminateAfterCompilation -g:none -1.5"/>