aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-08 16:57:15 +0000
committeracolyer <acolyer>2005-09-08 16:57:15 +0000
commit2d21db05869efd4715e8a4a10810c18a89093bfb (patch)
treea6800bf2b7b21b433a69ce9dc4ec2b7d66d9295d /org.aspectj.ajdt.core
parent08d6a5d1e032d33b46afca2fd92d3700b06a6cc6 (diff)
downloadaspectj-2d21db05869efd4715e8a4a10810c18a89093bfb.tar.gz
aspectj-2d21db05869efd4715e8a4a10810c18a89093bfb.zip
tests and fix for pr108886, result of having no source location for resolved members representing methods in EclipseSourceTypes
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java4
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java7
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java13
3 files changed, 17 insertions, 7 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
index 32dd4c188..f157dbbda 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java
@@ -113,7 +113,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
for (int i = lastCompletedUnitIndex + 1; i <= lastUnitIndex; i++) {
SourceTypeBinding[] b = units[i].scope.topLevelTypes;
for (int j = 0; j < b.length; j++) {
- factory.addSourceTypeBinding(b[j]);
+ factory.addSourceTypeBinding(b[j],units[i]);
}
}
@@ -787,7 +787,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC
* @param aBinding
*/
public void anonymousTypeBindingCreated(LocalTypeBinding aBinding) {
- factory.addSourceTypeBinding(aBinding);
+ factory.addSourceTypeBinding(aBinding,null);
}
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
index 07dc47a95..de3f7b028 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
@@ -27,6 +27,7 @@ import org.aspectj.ajdt.internal.core.builder.AjBuildManager;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.bridge.IMessage.Kind;
import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
+import org.aspectj.org.eclipse.jdt.internal.compiler.CompilationResult;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
@@ -728,7 +729,7 @@ public class EclipseFactory {
return EclipseShadow.makeShadow(this, (ASTNode) context, context);
}
- public void addSourceTypeBinding(SourceTypeBinding binding) {
+ public void addSourceTypeBinding(SourceTypeBinding binding, CompilationUnitDeclaration unit) {
TypeDeclaration decl = binding.scope.referenceContext;
// Deal with the raw/basic type to give us an entry in the world type map
@@ -746,7 +747,7 @@ public class EclipseFactory {
simpleTx = UnresolvedType.forName(getName(binding));
}
ReferenceType name = getWorld().lookupOrCreateName(simpleTx);
- EclipseSourceType t = new EclipseSourceType(name, this, binding, decl);
+ EclipseSourceType t = new EclipseSourceType(name, this, binding, decl, unit);
// For generics, go a bit further - build a typex for the generic type
// give it the same delegate and link it to the raw type
@@ -766,7 +767,7 @@ public class EclipseFactory {
ReferenceBinding[] memberTypes = binding.memberTypes;
for (int i = 0, length = memberTypes.length; i < length; i++) {
- addSourceTypeBinding((SourceTypeBinding) memberTypes[i]);
+ addSourceTypeBinding((SourceTypeBinding) memberTypes[i], unit);
}
}
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
index 1d99c78fa..91174eef5 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
@@ -27,6 +27,7 @@ import org.aspectj.weaver.patterns.PerFromSuper;
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.ast.Annotation;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleMemberAnnotation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.StringLiteral;
@@ -52,6 +53,7 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
private SourceTypeBinding binding;
private TypeDeclaration declaration;
+ private CompilationUnitDeclaration unit;
private boolean annotationsResolved = false;
private ResolvedType[] resolvedAnnotations = null;
@@ -60,12 +62,14 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
}
public EclipseSourceType(ReferenceType resolvedTypeX, EclipseFactory factory,
- SourceTypeBinding binding, TypeDeclaration declaration)
+ SourceTypeBinding binding, TypeDeclaration declaration,
+ CompilationUnitDeclaration unit)
{
super(resolvedTypeX, true);
this.factory = factory;
this.binding = binding;
this.declaration = declaration;
+ this.unit = unit;
resolvedTypeX.setSourceContext(new EclipseSourceContext(declaration.compilationResult));
resolvedTypeX.setStartPos(declaration.sourceStart);
@@ -151,7 +155,12 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
declaredPointcuts.add(df);
} else {
if (amd.binding == null || !amd.binding.isValidBinding()) continue;
- declaredMethods.add(factory.makeResolvedMember(amd.binding));
+ ResolvedMember member = factory.makeResolvedMember(amd.binding);
+ if (unit != null) {
+ member.setSourceContext(new EclipseSourceContext(unit.compilationResult,amd.binding.sourceStart()));
+ member.setPosition(amd.binding.sourceStart(),amd.binding.sourceEnd());
+ }
+ declaredMethods.add(member);
}
}
}