diff options
author | aclement <aclement> | 2009-04-06 19:24:20 +0000 |
---|---|---|
committer | aclement <aclement> | 2009-04-06 19:24:20 +0000 |
commit | cf67756f0203084d1e7ccbf9d0291c90a7802f46 (patch) | |
tree | 7adbac11b49587d5b8c5b80f3e9ba8d01d75cd26 | |
parent | 0b1653b40cf31befcb001dc1d9156d2de4634328 (diff) | |
download | aspectj-cf67756f0203084d1e7ccbf9d0291c90a7802f46.tar.gz aspectj-cf67756f0203084d1e7ccbf9d0291c90a7802f46.zip |
271201: inpath handles
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java | 17 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java | 14 |
2 files changed, 26 insertions, 5 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java index 1d285acc3..b92d0e236 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java @@ -371,7 +371,12 @@ public class BcelWeaver { UnwovenClassFile classFile = new UnwovenClassFile(new File(outDir, filename).getAbsolutePath(), bytes); if (filename.endsWith(".class")) { - this.addClassFile(classFile,false); + ReferenceType type = this.addClassFile(classFile,false); +// StringBuffer sb = new StringBuffer(); +// sb.append(inFile.getAbsolutePath()); +// sb.append("!"); +// sb.append(entry.getName()); +// type.setBinaryPath(sb.toString()); addedClassFiles.add(classFile); } // else if (!entry.isDirectory()) { @@ -436,7 +441,7 @@ public class BcelWeaver { /** * Should be addOrReplace */ - public void addClassFile(UnwovenClassFile classFile, boolean fromInpath) { + public ReferenceType addClassFile(UnwovenClassFile classFile, boolean fromInpath) { addedClasses.add(classFile); // if (null != sourceJavaClasses.put(classFile.getClassName(), // classFile)) { @@ -446,6 +451,7 @@ public class BcelWeaver { if (fromInpath) { type.setBinaryPath(classFile.getFilename()); } + return type; } public UnwovenClassFile addClassFile(File classFile, File inPathDir, File outDir) throws IOException { @@ -461,7 +467,12 @@ public class BcelWeaver { if (filename.endsWith(".class")) { // System.err.println( // "BCELWeaver: processing class from input directory "+classFile); - this.addClassFile(ucf,true); + StringBuffer sb = new StringBuffer(); + sb.append(inPathDir.getAbsolutePath()); + sb.append("!"); + sb.append(filename); + ReferenceType type = this.addClassFile(ucf,false); + type.setBinaryPath(sb.toString()); } fis.close(); return ucf; diff --git a/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java b/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java index e2aefd855..7abede6eb 100644 --- a/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java +++ b/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java @@ -195,10 +195,20 @@ public class AsmRelationshipProvider { // /; - the semicolon is a 'well defined char' that means inpath phantomHandle.append(HandleProviderDelimiter.PACKAGEFRAGMENTROOT.getDelimiter()).append(';'); + int pos = bpath.indexOf('!'); + if (pos != -1) { + // jar or dir + String jarPath = bpath.substring(0,pos); + String element = model.getHandleElementForInpath(jarPath); + if (element!=null) { + phantomHandle.append(element); + } + } + // <g String packageName = onType.getPackageName(); phantomHandle.append(HandleProviderDelimiter.PACKAGEFRAGMENT.getDelimiter()).append(packageName); - + // (G.class // could fix the binary path to only be blah.class bit int dotClassPosition = bpath.lastIndexOf(".class");// what to do if -1 @@ -207,7 +217,7 @@ public class AsmRelationshipProvider { } else { int startPosition = dotClassPosition; char ch; - while (startPosition>0 && ((ch=bpath.charAt(startPosition))!='/' && ch!='\\')) { + while (startPosition>0 && ((ch=bpath.charAt(startPosition))!='/' && ch!='\\' && ch!='!')) { startPosition--; } String classFile = bpath.substring(startPosition+1,dotClassPosition+6); |