summaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoraclement <aclement>2005-08-22 16:55:51 +0000
committeraclement <aclement>2005-08-22 16:55:51 +0000
commitb03b2426fc26455aa7af2077a6b12146175fdd88 (patch)
tree1196a7536d2e190706703995513300ca89137de2 /org.aspectj.ajdt.core
parentc9bc31e6c46dfeff27a51bf65d8f8982764d448d (diff)
downloadaspectj-b03b2426fc26455aa7af2077a6b12146175fdd88.tar.gz
aspectj-b03b2426fc26455aa7af2077a6b12146175fdd88.zip
genericitds: scope can now lookup type variables when referenced via the alias used in the ITD
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java
index 82a4d7595..6ebf5dd36 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/InterTypeScope.java
@@ -13,16 +13,21 @@
package org.aspectj.ajdt.internal.compiler.lookup;
+import java.util.List;
+
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
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.Scope;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
import org.aspectj.weaver.BCException;
public class InterTypeScope extends ClassScope {
ReferenceBinding onType;
+ List aliases;
public InterTypeScope(Scope parent, ReferenceBinding onType) {
super(parent, null);
@@ -31,6 +36,11 @@ public class InterTypeScope extends ClassScope {
this.onType = onType;
}
+ public InterTypeScope(Scope parent, ReferenceBinding rb, List list) {
+ this(parent,rb);
+ this.aliases = list;
+ }
+
// this method depends on the fact that BinaryTypeBinding extends SourceTypeBinding
private SourceTypeBinding makeSourceTypeBinding(ReferenceBinding onType) {
if (onType instanceof SourceTypeBinding) return (SourceTypeBinding)onType;
@@ -38,7 +48,10 @@ public class InterTypeScope extends ClassScope {
ReferenceBinding rb = ((ParameterizedTypeBinding)onType).type;
if (rb instanceof SourceTypeBinding) return (SourceTypeBinding)rb;
else throw new BCException("In parameterized type "+onType+", can't handle reference binding "+rb);
+ } else if (onType instanceof ProblemReferenceBinding) {
+ return null;
}
+
throw new BCException("can't handle: " + onType);
}
@@ -49,7 +62,21 @@ public class InterTypeScope extends ClassScope {
public int addDepth() {
return 0;
}
+
+ public TypeVariableBinding findTypeVariable(char[] name, SourceTypeBinding sourceType) {
+ int aliased = (aliases==null?-1:aliases.indexOf(new String(name)));
+ if (aliased!=-1) {
+ if (aliased>sourceType.typeVariables.length || sourceType.typeVariables.length==0) {
+ TypeVariableBinding tvb = new TypeVariableBinding("fake".toCharArray(),null,0);
+ return tvb;
+ // error is going to be reported by someone else!
+ }
+ return sourceType.typeVariables()[aliased];
+ } else {
+ return sourceType.getTypeVariable(name);
+ }
+ }
}