import java.util.List;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
+import org.aspectj.org.eclipse.jdt.core.compiler.IProblem;
+import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.Binding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.FieldBinding;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.IMemberFinder;
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.problem.ProblemReporter;
+import org.aspectj.org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
/**
* The member finder looks after intertype declared members on a type, there is
if (!retField.canBeSeenBy(sourceTypeBinding, site, scope)) return field;
}
//XXX need dominates check on aspects
- return new ProblemFieldBinding(retField.declaringClass, retField.name, ProblemReporter.Ambiguous);
+ return new ProblemFieldBinding(retField.declaringClass, retField.name, IProblem.AmbiguousField);//ProblemReporter.Ambiguous);
}
}
}
- if (ret.isEmpty()) return SourceTypeBinding.NoMethods;
+ if (ret.isEmpty()) return Binding.NO_METHODS;
return (MethodBinding[])ret.toArray(new MethodBinding[ret.size()]);
}
}
}
- if (ret.isEmpty()) return SourceTypeBinding.NoMethods;
+ if (ret.isEmpty()) return Binding.NO_METHODS;
// System.err.println("method: " + ret);
package org.aspectj.ajdt.internal.compiler.lookup;
+import org.aspectj.ajdt.internal.compiler.ast.InterTypeDeclaration;
import org.aspectj.ajdt.internal.compiler.ast.InterTypeMethodDeclaration;
+import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.InvocationSite;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
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.TypeVariableBinding;
import org.aspectj.weaver.AjcMemberMaker;
import org.aspectj.weaver.Member;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedTypeMunger;
+import org.aspectj.weaver.TypeVariable;
import org.aspectj.weaver.UnresolvedType;
/**
public AbstractMethodDeclaration sourceMethod;
public InterTypeMethodBinding(EclipseFactory world, ResolvedTypeMunger munger, UnresolvedType withinType,
- AbstractMethodDeclaration sourceMethod)
+ AbstractMethodDeclaration sourceMethod)
{
super();
ResolvedMember signature = munger.getSignature();
this.sourceMethod = sourceMethod;
this.targetType = (ReferenceBinding)world.makeTypeBinding(signature.getDeclaringType());
this.declaringClass = (ReferenceBinding)world.makeTypeBinding(withinType);
-
+
+ // Ok, we need to set the typevariable declaring elements
+ // 1st set:
+ // If the typevariable is one declared on the source method, then we know we are the declaring element
+ for (int i = 0; i < typeVariables.length; i++) {
+ TypeVariableBinding tv = typeVariables[i];
+ String name = new String(tv.sourceName);
+ TypeVariableBinding[] tv2 = sourceMethod.binding.typeVariables;
+ for (int j = 0; j < tv2.length; j++) {
+ TypeVariableBinding typeVariable = tv2[j];
+ if (new String(tv2[j].sourceName).equals(name)) typeVariables[i].declaringElement = this;
+ }
+ }
+ for (int i = 0; i < typeVariables.length; i++) {
+ if (typeVariables[i].declaringElement==null) throw new RuntimeException("Declaring element not set");
+
+ }
+// typeVariables[0].declaringElement=this;
+// if (tVar.getDeclaringElement() instanceof Member) {
+// declaringElement = makeMethodBinding((ResolvedMember)tVar.getDeclaringElement());
+// } else {
+// declaringElement = makeTypeBinding((UnresolvedType)tVar.getDeclaringElement());
+// }
if (signature.getKind() == Member.METHOD) {
syntheticMethod =
world.makeMethodBinding(AjcMemberMaker.interMethodDispatcher(signature, withinType));
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.PackageBinding;
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;
if (aliased!=-1) {
if (aliased>sourceType.typeVariables.length || sourceType.typeVariables.length==0) {
TypeVariableBinding tvb = new TypeVariableBinding("fake".toCharArray(),null,0);
+ tvb.fPackage = new PackageBinding(environment());
return tvb;
// error is going to be reported by someone else!
}
TypeVariableBinding tvb = sourceType.typeVariables()[aliased];
+ tvb.fPackage = sourceType.fPackage;
if (usedAliases==null) usedAliases = new HashMap();
usedAliases.put(tvb,variableName);
return tvb;
} else {
- return sourceType.getTypeVariable(name);
+ TypeVariableBinding variableBinding = sourceType.getTypeVariable(name);
+ if (variableBinding == null) { // GENERICITDFIX
+ // Inside generic aspect, might want the type var attached to us
+ variableBinding = parent.findTypeVariable(name,((ClassScope) parent).referenceContext.binding);
+ }
+ return variableBinding;
}
}