]> source.dussan.org Git - aspectj.git/commitdiff
271201: inpath handles
authoraclement <aclement>
Mon, 6 Apr 2009 19:24:20 +0000 (19:24 +0000)
committeraclement <aclement>
Mon, 6 Apr 2009 19:24:20 +0000 (19:24 +0000)
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java

index 1d285acc32de4253cb2dd64105fa13498f6009ce..b92d0e236dd74d82012f491b0f8e0041e226e906 100644 (file)
@@ -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;
index e2aefd855ff8991626be615226f5887611739690..7abede6ebae79b86e04067e206e11e9948bcf85f 100644 (file)
@@ -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);