From: aclement Date: Mon, 6 Apr 2009 19:24:20 +0000 (+0000) Subject: 271201: inpath handles X-Git-Tag: V1_6_5~82 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=cf67756f0203084d1e7ccbf9d0291c90a7802f46;p=aspectj.git 271201: inpath handles --- 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); + } + } + // 0 && ((ch=bpath.charAt(startPosition))!='/' && ch!='\\')) { + while (startPosition>0 && ((ch=bpath.charAt(startPosition))!='/' && ch!='\\' && ch!='!')) { startPosition--; } String classFile = bpath.substring(startPosition+1,dotClassPosition+6);