diff options
author | Andy Clement <andrew.clement@gmail.com> | 2012-09-19 10:19:17 -0700 |
---|---|---|
committer | Andy Clement <andrew.clement@gmail.com> | 2012-09-19 10:19:17 -0700 |
commit | b9c7a190f452cf888854e4fa6599269a5a2c0212 (patch) | |
tree | b68bf4923bfd122c2933f2f0502d9119647d9de1 /org.aspectj.ajdt.core | |
parent | 6cae3ed57c66d0659492ab1d12bc42cc10ad6f71 (diff) | |
download | aspectj-b9c7a190f452cf888854e4fa6599269a5a2c0212.tar.gz aspectj-b9c7a190f452cf888854e4fa6599269a5a2c0212.zip |
389750: fix for ITDs that use generics made on generic types
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java | 37 | ||||
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java | 14 |
2 files changed, 51 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java index 23c874795..369e84c51 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/AstUtil.java @@ -30,6 +30,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ReturnStatement; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleNameReference; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Statement; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; +import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeParameter; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference; import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.CodeStream; @@ -43,6 +44,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Scope; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeIds; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; import org.aspectj.weaver.AjAttribute; import org.aspectj.weaver.patterns.WildTypePattern; @@ -251,6 +253,41 @@ public class AstUtil { System.arraycopy(rest, 0, ret, 1, len); return ret; } + + public static TypeParameter[] insert(TypeParameter first, TypeParameter[] rest) { + if (rest == null) { + return new TypeParameter[]{first}; + } + int len = rest.length; + TypeParameter[] ret = new TypeParameter[len + 1]; + ret[0] = first; + System.arraycopy(rest, 0, ret, 1, len); + return ret; + } + + public static TypeVariableBinding[] insert(TypeVariableBinding first, TypeVariableBinding[] rest) { + if (rest == null) { + return new TypeVariableBinding[]{first}; + } + int len = rest.length; + TypeVariableBinding[] ret = new TypeVariableBinding[len + 1]; + ret[0] = first; + System.arraycopy(rest, 0, ret, 1, len); + return ret; + } + + public static TypeVariableBinding[] insert(TypeVariableBinding[] first, TypeVariableBinding[] rest) { + if (rest == null) { + TypeVariableBinding[] ret = new TypeVariableBinding[first.length]; + System.arraycopy(first, 0, ret, 0, first.length); + return ret; + } + int len = rest.length; + TypeVariableBinding[] ret = new TypeVariableBinding[first.length+len]; + System.arraycopy(first,0,ret,0,first.length); + System.arraycopy(rest,0,ret,first.length,len); + return ret; + } public static Expression[] insert(Expression first, Expression[] rest) { if (rest == null) { diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java index aabcc19c0..a5632e498 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java @@ -22,6 +22,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Argument; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; +import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeParameter; import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference; import org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.aspectj.org.eclipse.jdt.internal.compiler.codegen.CodeStream; @@ -36,6 +37,7 @@ import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TagBits; import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; import org.aspectj.org.eclipse.jdt.internal.compiler.parser.Parser; import org.aspectj.org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit; import org.aspectj.weaver.AjAttribute; @@ -93,6 +95,18 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration { if (!Modifier.isStatic(declaredModifiers)) { this.arguments = AstUtil.insert(AstUtil.makeFinalArgument("ajc$this_".toCharArray(), onTypeBinding), this.arguments); binding.parameters = AstUtil.insert(onTypeBinding, binding.parameters); + + // If the inserted argument is a generic type, we should include the associated type variables to ensure + // the generated signature is correct (it will be checked by eclipse when this type is consumed in binary form). + TypeVariableBinding onTypeTVBs[] = onTypeBinding.typeVariables(); + if (onTypeTVBs!=null && onTypeTVBs.length!=0) { + // The type parameters don't seem to need to be correct + // TypeParameter tp = new TypeParameter(); + // tp.binding = tvb[0]; + // tp.name = tvb[0].sourceName; + // this.typeParameters = AstUtil.insert(tp,this.typeParameters); + binding.typeVariables = AstUtil.insert(onTypeBinding.typeVariables(), binding.typeVariables); + } } super.resolve(upperScope); |