]> source.dussan.org Git - aspectj.git/commitdiff
271201: inpath handles for jars
authoraclement <aclement>
Tue, 7 Apr 2009 22:20:18 +0000 (22:20 +0000)
committeraclement <aclement>
Tue, 7 Apr 2009 22:20:18 +0000 (22:20 +0000)
tests/model/expected/pr141730_4.txt
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java
tests/src/org/aspectj/systemtest/incremental/tools/MoreOutputLocationManagerTests.java
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

index 714d1fba001b19bddc0b0112c2a725b95c6bed4d..805c0fc29b88b573bccd7ae24a99b1cccb53f061 100644 (file)
       NewClass  [class] TEST_SANDBOX\NewClass.java:3:
 === END OF MODEL REPORT =========
 === RELATIONSHIPS REPORT ========= After a batch build
-(targets=1) <bar*MyBar.aj}MyBar`declare \@type!3 (annotates) {MyFoo.java
-(targets=1) <bar*MyBar.aj}MyBar`declare parents!2 (declared on) {MyFoo.java
 (targets=1) {MyFoo.java (annotated by) <bar*MyBar.aj}MyBar`declare \@type!3
-(targets=1) {MyFoo.java (aspect declarations) <bar*MyBar.aj}MyBar`declare parents!2
+(targets=1) <bar*MyBar.aj}MyBar`declare parents!2 (declared on) /,<foo(MyFoo.class[MyFoo
+(targets=1) <bar*MyBar.aj}MyBar`declare \@type!3 (annotates) {MyFoo.java
+(targets=1) /,<foo(MyFoo.class[MyFoo (aspect declarations) <bar*MyBar.aj}MyBar`declare parents!2
 === END OF RELATIONSHIPS REPORT ==
 === Properties of the model and relationships map =====
 import reference=4
@@ -39,7 +39,7 @@ declare @constructor=1
 advice=1
 annotation=1
 class=1
-RelationshipMapSize=3
+RelationshipMapSize=4
 package declaration=3
 FileMapSize=3
 package=1
index 9d04205c83f329f9c716badfd9079da409fc4b72..37a04d362f727655a6a945e0154c278ccb22b730 100644 (file)
           </compile>
        <compile files="A2.aj" inpath="code.jar" options="-1.5,-showWeaveInfo">
          <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A1' (A1.aj:'java.util.List&lt;java.lang.String&gt; BaseClass.list1')"/>
-            <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (A1.aj:7)"/>
+            <message kind="weave" text="Type 'BaseClass' (BaseClass.java:12) advised by after advice from 'A1' (code.jar!A1.class:7(from A1.aj))"/>
             <message kind="weave" text="Type 'BaseClass' (BaseClass.java) has intertyped field from 'A2' (A2.aj:'java.util.List&lt;N&gt; BaseClass.list2')"/>
          <message kind="weave" text="Type 'BaseClass' (BaseClass.java:13) advised by after advice from 'A2' (A2.aj:8)"/>
        </compile>
index b528c36c3851e763a795e34a4ee58e07ec7dec39..101ad030218451e0c93f0d01a5a9b5c914312b6a 100644 (file)
@@ -121,6 +121,13 @@ public class AjdeInteractionTestbed extends TestCase {
                ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setInpath(inpath);
        }
 
+       public static void configureInPath(String projectName, File inpath) {
+               Set s = new HashSet();
+               s.add(inpath);
+               AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
+               ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setInpath(s);
+       }
+
        public static void configureOutputLocationManager(String projectName, IOutputLocationManager mgr) {
                AjCompiler compiler = CompilerFactory.getCompilerForProjectWithDir(sandboxDir + File.separator + projectName);
                ((MultiProjTestCompilerConfiguration) compiler.getCompilerConfiguration()).setOutputLocationManager(mgr);
index 610e6ba81a07ffc65533c0a394edab36637fa94d..3299ee833be3f45a6304e5a8d7cec863486fee39 100644 (file)
@@ -308,7 +308,7 @@ public class MoreOutputLocationManagerTests extends AbstractMultiProjectIncremen
 
        private void addInpathEntry(String entry) {
                if (entry == null) {
-                       configureInPath("inpathTesting", null);
+                       configureInPath("inpathTesting", (Set)null);
                        return;
                }
                File f = new File(entry);
index f88dc7ebc8987d749cfb876a2bf24c3ae9af27e6..4900c7194edcd551fd3376067739f91ba866d2ed 100644 (file)
@@ -2898,42 +2898,76 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                assertNotNull(l);
        }
        
+       private void printModelAndRelationships(String p) {
+               IProgramElement root = getModelFor(p).getHierarchy().getRoot();
+               
+               dumptree(root, 0);
+               PrintWriter pw = new PrintWriter(System.out);
+               try {
+                 getModelFor(p).dumprels(pw);
+                 pw.flush();
+               } catch (Exception e) {
+               }
+       }
+       
+       public void testInpathHandles_IncrementalCompilation_RemovingInpathEntries_271201() throws Exception {
+               AjdeInteractionTestbed.VERBOSE=true;
+               String p = "inpathHandles2";
+               initialiseProject(p);
+
+               String inpathDir = getWorkingDir() + File.separator + "inpathHandles2" + File.separator + "binpath";
+
+               // set up the inpath to have the directory on it's path
+               File f = new File(inpathDir);
+               configureInPath(p, f);
+               
+               // This build will weave a declare parents into the inpath class codep.A and codep.B
+               build(p);
+               assertNotNull(getModelFor(p).getRelationshipMap().get("=inpathHandles2/,<codep(A.class[A"));
+               
+               // Not let us delete one of the inpath .class files
+               assertTrue(new File(inpathDir,"codep"+File.separator+"A.class").delete());
+               setNextChangeResponse(p, ICompilerConfiguration.EVERYTHING);
+               build(p);
+//             printModelAndRelationships(p);
+       }
+       
        // warning about cant change parents of Object is fine
-//     public void testInpathJars_271201() throws Exception {
-//             AjdeInteractionTestbed.VERBOSE=true;
-//             String p = "inpathJars";
-//             initialiseProject(p);
-//
-//             String inpathTestingDir = getWorkingDir() + File.separator + "inpathJars";
-//             String inpathDir = inpathTestingDir + File.separator + "code.jar";
-//             // String expectedOutputDir = inpathTestingDir + File.separator + "bin";
-//
-//             // set up the inpath to have the directory on it's path
-//             System.out.println(inpathDir);
-//             File f = new File(inpathDir);
-//             Set s = new HashSet();
-//             s.add(f);
-//             Map m = new HashMap();
-//             m.put(f,"Gibble");              
-//             configureOutputLocationManager(p,new TestOutputLocationManager(getProjectRelativePath(p, ".").toString(),m));
-//             configureInPath(p, s);
+       public void testInpathJars_271201() throws Exception {
+               AjdeInteractionTestbed.VERBOSE=true;
+               String p = "inpathJars";
+               initialiseProject(p);
+
+               String inpathTestingDir = getWorkingDir() + File.separator + "inpathJars";
+               String inpathDir = inpathTestingDir + File.separator + "code.jar";
+               // String expectedOutputDir = inpathTestingDir + File.separator + "bin";
+
+               // set up the inpath to have the directory on it's path
+               System.out.println(inpathDir);
+               File f = new File(inpathDir);
+               Set s = new HashSet();
+               s.add(f);
+               Map m = new HashMap();
+               m.put(f,"Gibble");              
+               configureOutputLocationManager(p,new TestOutputLocationManager(getProjectRelativePath(p, ".").toString(),m));
+               configureInPath(p, s);
+               build(p);
+
+               IProgramElement root = getModelFor(p).getHierarchy().getRoot();
+               
+//             alter(p,"inc1");
 //             build(p);
-//
-//             IProgramElement root = getModelFor(p).getHierarchy().getRoot();
-//             
-////           alter(p,"inc1");
-////           build(p);
-//             dumptree(root, 0);
-//             PrintWriter pw = new PrintWriter(System.out);
-//             try {
-//               getModelFor(p).dumprels(pw);
-//               pw.flush();
-//             } catch (Exception e) {
-//             }
-//             List l = getModelFor(p).getRelationshipMap().get("=inpathJars/;Gibble<codep(Code.class[Code");
-//             assertNotNull(l);
-//             System.out.println(l.get(0));
-//     }
+               dumptree(root, 0);
+               PrintWriter pw = new PrintWriter(System.out);
+               try {
+                 getModelFor(p).dumprels(pw);
+                 pw.flush();
+               } catch (Exception e) {
+               }
+               List l = getModelFor(p).getRelationshipMap().get("=inpathJars/,Gibble<codep(Code.class[Code");
+               assertNotNull(l);
+               System.out.println(l.get(0));
+       }
 
        // --- helper code ---