From: jhugunin Date: Tue, 11 Mar 2003 23:46:51 +0000 (+0000) Subject: fixing Bug 31724 X-Git-Tag: v1_1_0_RC1~32 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fd1560a8a1c91d1b65c738d4e9163d93700d1f00;p=aspectj.git fixing Bug 31724 declare warning/error emitted without context and generally providing better error context information --- diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java index 01ed6dcc2..2e0630f6c 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseShadow.java @@ -18,6 +18,7 @@ import org.aspectj.ajdt.internal.compiler.ast.InterTypeConstructorDeclaration; import org.aspectj.ajdt.internal.compiler.ast.InterTypeDeclaration; import org.aspectj.ajdt.internal.compiler.ast.InterTypeFieldDeclaration; import org.aspectj.ajdt.internal.compiler.ast.InterTypeMethodDeclaration; +import org.aspectj.bridge.ISourceLocation; import org.aspectj.bridge.SourceLocation; import org.aspectj.weaver.Member; import org.aspectj.weaver.Shadow; @@ -65,7 +66,7 @@ public class EclipseShadow extends Shadow { return world.fromBinding(enclosingMethod.binding.declaringClass); } - public SourceLocation getSourceLocation() { + public ISourceLocation getSourceLocation() { //XXX need to fill this in ASAP return null; } 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 dbb985ab0..abee60abf 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 @@ -16,6 +16,7 @@ package org.aspectj.ajdt.internal.compiler.lookup; import java.util.*; import org.aspectj.ajdt.internal.compiler.ast.*; +import org.aspectj.ajdt.internal.core.builder.EclipseSourceContext; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.ISourceLocation; import org.aspectj.weaver.*; @@ -54,6 +55,10 @@ public class EclipseSourceType extends ResolvedTypeX.ConcreteName { this.factory = factory; this.binding = binding; this.declaration = declaration; + + resolvedTypeX.setSourceContext(new EclipseSourceContext(declaration.compilationResult)); + resolvedTypeX.setStartPos(declaration.sourceStart); + resolvedTypeX.setEndPos(declaration.sourceEnd); } @@ -195,10 +200,10 @@ public class EclipseSourceType extends ResolvedTypeX.ConcreteName { // return crosscuttingMembers; // } - public ISourceLocation getSourceLocation() { - TypeDeclaration dec = binding.scope.referenceContext; - return new EclipseSourceLocation(dec.compilationResult, dec.sourceStart, dec.sourceEnd); - } +// public ISourceLocation getSourceLocation() { +// TypeDeclaration dec = binding.scope.referenceContext; +// return new EclipseSourceLocation(dec.compilationResult, dec.sourceStart, dec.sourceEnd); +// } public boolean isInterface() { return binding.isInterface(); diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseSourceContext.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseSourceContext.java index f54ebc1a1..fd107e77a 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseSourceContext.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/EclipseSourceContext.java @@ -13,8 +13,11 @@ package org.aspectj.ajdt.internal.core.builder; +import java.io.File; + import org.aspectj.ajdt.internal.compiler.lookup.EclipseSourceLocation; import org.aspectj.bridge.ISourceLocation; +import org.aspectj.bridge.SourceLocation; import org.aspectj.weaver.IHasPosition; import org.aspectj.weaver.ISourceContext; import org.eclipse.jdt.internal.compiler.CompilationResult; @@ -29,9 +32,16 @@ public class EclipseSourceContext implements ISourceContext { this.result = result; } + private File getSourceFile() { + return new File(new String(result.fileName)); + } public ISourceLocation makeSourceLocation(IHasPosition position) { return new EclipseSourceLocation(result, position.getStart(), position.getEnd()); } + public ISourceLocation makeSourceLocation(int line) { + return new SourceLocation(getSourceFile(), line); + } + } diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 321afe3d9..a2e0b3c6e 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -5630,4 +5630,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/ajcTestsFailing.xml b/tests/ajcTestsFailing.xml index 051196a60..b7fadc146 100644 --- a/tests/ajcTestsFailing.xml +++ b/tests/ajcTestsFailing.xml @@ -30,28 +30,6 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/tests/jimTests.xml b/tests/jimTests.xml index 17db88e59..53a3a9ef1 100644 --- a/tests/jimTests.xml +++ b/tests/jimTests.xml @@ -1,26 +1,6 @@ - - - - - - - - - - - - - - - - - - - +