From 4dea3ad2411d5ea80b6f49ed342e96e52a39a91a Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 22 May 2006 10:27:30 +0000 Subject: test and fix for pr132349: itds on inner type of generic type --- .../compiler/ast/InterTypeDeclaration.java | 33 +++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'org.aspectj.ajdt.core') 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, -- cgit v1.2.3