aboutsummaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
authoraclement <aclement>2009-02-24 19:17:28 +0000
committeraclement <aclement>2009-02-24 19:17:28 +0000
commitbb02acd6e5cd0677e8fb9f3ef524b075a0152427 (patch)
tree2d9ee2cbca6030e245dc7d997d5072db272e09b8 /asm
parent57d21ed5c724ff0b123aeef34875f8786cb21d36 (diff)
downloadaspectj-bb02acd6e5cd0677e8fb9f3ef524b075a0152427.tar.gz
aspectj-bb02acd6e5cd0677e8fb9f3ef524b075a0152427.zip
265729: fault in binary aspects for itds/decps and search for them correctly
Diffstat (limited to 'asm')
-rw-r--r--asm/src/org/aspectj/asm/IHierarchy.java10
-rw-r--r--asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java28
-rw-r--r--asm/src/org/aspectj/asm/internal/HandleProviderDelimiter.java2
3 files changed, 34 insertions, 6 deletions
diff --git a/asm/src/org/aspectj/asm/IHierarchy.java b/asm/src/org/aspectj/asm/IHierarchy.java
index e1f3dded9..d4351d17b 100644
--- a/asm/src/org/aspectj/asm/IHierarchy.java
+++ b/asm/src/org/aspectj/asm/IHierarchy.java
@@ -13,6 +13,7 @@ package org.aspectj.asm;
import java.io.Serializable;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Set;
import org.aspectj.asm.internal.ProgramElement;
@@ -102,4 +103,13 @@ public interface IHierarchy extends Serializable {
public void flushHandleMap();
public void updateHandleMap(Set deletedFiles);
+
+ /**
+ * For a specified node, check if any of the children more accurately represent the specified line.
+ *
+ * @param node where to start looking
+ * @param lineno the line number
+ * @return any closer match below 'node' or null if nothing is a more accurate match
+ */
+ public IProgramElement findCloserMatchForLineNumber(IProgramElement node, int lineno);
} \ No newline at end of file
diff --git a/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java b/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
index 63066ba38..adee792fd 100644
--- a/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
+++ b/asm/src/org/aspectj/asm/internal/AspectJElementHierarchy.java
@@ -224,6 +224,7 @@ public class AspectJElementHierarchy implements IHierarchy {
}
}
}
+ // 'binaries' will be checked automatically by the code above as it is represented as a SOURCE_FOLDER
return matchingPackageNodes;
} else {
// dealing directly with packages below the root, no source folders. Therefore at most one
@@ -243,6 +244,20 @@ public class AspectJElementHierarchy implements IHierarchy {
return result;
}
}
+ if (possiblePackage.getKind() == IProgramElement.Kind.SOURCE_FOLDER) { // might be 'binaries'
+ if (possiblePackage.getName().equals("binaries")) {
+ for (Iterator iter2 = possiblePackage.getChildren().iterator(); iter2.hasNext();) {
+ IProgramElement possiblePackage2 = (IProgramElement) iter2.next();
+ if (possiblePackage2.getKind() == IProgramElement.Kind.PACKAGE) {
+ if (possiblePackage2.getName().equals(packagename)) {
+ List result = new ArrayList();
+ result.add(possiblePackage2);
+ return result;
+ }
+ }
+ }
+ }
+ }
}
}
return Collections.EMPTY_LIST;
@@ -325,8 +340,8 @@ public class AspectJElementHierarchy implements IHierarchy {
public IProgramElement findElementForSourceLine(String sourceFilePath, int lineNumber) {
String canonicalSFP = asm.getCanonicalFilePath(new File(sourceFilePath));
// Used to do this:
-// IProgramElement node2 = findNodeForSourceLineHelper(root, canonicalSFP, lineNumber, -1);
-
+ // IProgramElement node2 = findNodeForSourceLineHelper(root, canonicalSFP, lineNumber, -1);
+
// Find the relevant source file node first
IProgramElement node = findNodeForSourceFile(root, canonicalSFP);
if (node == null) {
@@ -358,7 +373,7 @@ public class AspectJElementHierarchy implements IHierarchy {
return node;
}
return null; // no need to search children of a source file node
- } else {
+ } else {
// check the children
for (Iterator iterator = node.getChildren().iterator(); iterator.hasNext();) {
IProgramElement foundit = findNodeForSourceFile((IProgramElement) iterator.next(), sourcefilePath);
@@ -408,7 +423,7 @@ public class AspectJElementHierarchy implements IHierarchy {
* @param lineno the line number
* @return any closer match below 'node' or null if nothing is a more accurate match
*/
- private IProgramElement findCloserMatchForLineNumber(IProgramElement node, int lineno) {
+ public IProgramElement findCloserMatchForLineNumber(IProgramElement node, int lineno) {
for (Iterator childrenIter = node.getChildren().iterator(); childrenIter.hasNext();) {
IProgramElement child = (IProgramElement) childrenIter.next();
ISourceLocation childLoc = child.getSourceLocation();
@@ -421,11 +436,12 @@ public class AspectJElementHierarchy implements IHierarchy {
} else {
return evenCloserMatch;
}
- } else if (child.getKind().isType()) { // types are a bit clueless about where they are... do other nodes have similar problems??
+ } else if (child.getKind().isType()) { // types are a bit clueless about where they are... do other nodes have
+ // similar problems??
IProgramElement evenCloserMatch = findCloserMatchForLineNumber(child, lineno);
if (evenCloserMatch != null) {
return evenCloserMatch;
- }
+ }
}
}
}
diff --git a/asm/src/org/aspectj/asm/internal/HandleProviderDelimiter.java b/asm/src/org/aspectj/asm/internal/HandleProviderDelimiter.java
index 396cba3a8..fb3221a5e 100644
--- a/asm/src/org/aspectj/asm/internal/HandleProviderDelimiter.java
+++ b/asm/src/org/aspectj/asm/internal/HandleProviderDelimiter.java
@@ -111,6 +111,8 @@ public class HandleProviderDelimiter {
} else if (kind == IProgramElement.Kind.FILE) {
if (ipe.getName().endsWith(".class")) {
return CLASSFILE.getDelimiter();
+ } else if (ipe.getName().endsWith(".aj")) {
+ return ASPECT_CU.getDelimiter();
} else {
return empty;
}