aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoracolyer <acolyer>2003-02-27 19:40:00 +0000
committeracolyer <acolyer>2003-02-27 19:40:00 +0000
commit62ac77ecb955f9eba81bb50997bd94715cdbc8d4 (patch)
tree2795dc1341abbd0d1d744dddeb4bd342d25a5c49 /weaver
parentac384e79157c35d12fed7b68b67567cae13dafc0 (diff)
downloadaspectj-62ac77ecb955f9eba81bb50997bd94715cdbc8d4.tar.gz
aspectj-62ac77ecb955f9eba81bb50997bd94715cdbc8d4.zip
Fudge for getSourceLocation to give as much of a
clue as possible about the real identity of the file.
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelShadow.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
index 0483a826e..cff8c4fa9 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
@@ -1868,7 +1868,23 @@ public class BcelShadow extends Shadow {
}
public SourceLocation getSourceLocation() {
- return new SourceLocation(new File(getEnclosingClass().getFileName()), getSourceLine());
+ // AMC - a temporary "fudge" to give as much information as possible about the identity of the
+ // source file this source location points to.
+ String internalClassName = getEnclosingClass().getInternalClassName();
+ String fileName = getEnclosingClass().getFileName();
+ String extension = fileName.substring( fileName.lastIndexOf("."), fileName.length());
+ String filePrefix = fileName.substring( 0, fileName.lastIndexOf("."));
+ // internal class name is e.g. figures/Point, we don't know whether the file was
+ // .aj or .java so we put it together with the file extension of the enclosing class
+ // BUT... sometimes internalClassName is a different class (an aspect), so we only use it if it
+ // matches the file name.
+ String mostAccurateFileNameGuess;
+ if ( internalClassName.endsWith(filePrefix)) {
+ mostAccurateFileNameGuess = internalClassName + extension;
+ } else {
+ mostAccurateFileNameGuess = fileName;
+ }
+ return new SourceLocation(new File(mostAccurateFileNameGuess), getSourceLine());
}
public Shadow getEnclosingShadow() {