]> source.dussan.org Git - aspectj.git/commitdiff
Updated to support running on JDK 1.5, and fixed related bug#82218
authormkersten <mkersten>
Thu, 13 Jan 2005 04:22:51 +0000 (04:22 +0000)
committermkersten <mkersten>
Thu, 13 Jan 2005 04:22:51 +0000 (04:22 +0000)
ajdoc/src/org/aspectj/tools/ajdoc/HtmlDecorator.java
ajdoc/src/org/aspectj/tools/ajdoc/Util.java [new file with mode: 0644]
ajdoc/testdata/coverage/foo/ModelCoverage.java
ajdoc/testdata/coverage/foo/NoMembers.java [new file with mode: 0644]
ajdoc/testsrc/org/aspectj/tools/ajdoc/CoverageTestCase.java
ajdoc/testsrc/org/aspectj/tools/ajdoc/JDKVersionTest.java [new file with mode: 0644]

index f189b6c6120e8af34415ad672c20b5ea09d1d02b..43d7b1851fd9dcbea1b74cab35f5c0d3fe1e7746 100644 (file)
@@ -401,11 +401,12 @@ class HtmlDecorator {
         String MARKER_2 = "<!-- ======== CONSTRUCTOR SUMMARY ======== -->";
         int index1 = fbs.indexOf(MARKER_1, index);
         int index2 = fbs.indexOf(MARKER_2, index);
-        if (index1 < index2) {
+        if (index1 < index2 && index1 != -1) {
             return index1;
-        }
-        else {
+        } else if (index2 != -1){
             return index2;
+        } else {
+            return index;
         }
     }
 
@@ -416,15 +417,15 @@ class HtmlDecorator {
         String MARKER_3 = "<!-- ============ METHOD DETAIL ========== -->";
         int index1 = fbs.indexOf(MARKER_1, index);
         int index2 = fbs.indexOf(MARKER_2, index);
-        int index3 = fbs.indexOf(MARKER_3, index);
-        if (index1 < index2 && index1 < index3) {
+        int index3 = fbs.indexOf(MARKER_3, index); 
+        if (index1 != -1 && index1 < index2 && index1 < index3) {
             return index1;
-        }
-        else if (index2 < index1 && index2 < index3) {
+        } else if (index2 != -1 && index2 < index1 && index2 < index3) {
             return index2;
-        }
-        else {
+        } else if (index3 != -1) {
             return index3;
+        } else {
+            return index;
         }
     }
 
diff --git a/ajdoc/src/org/aspectj/tools/ajdoc/Util.java b/ajdoc/src/org/aspectj/tools/ajdoc/Util.java
new file mode 100644 (file)
index 0000000..e3c53f3
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Created on Jan 12, 2005
+  */
+package org.aspectj.tools.ajdoc;
+
+/**
+ * @author Mik Kersten
+ */
+public class Util {
+
+    public static boolean isExecutingOnJava5() {
+        String version = System.getProperty("java.class.version","44.0");
+        return version.equals("49.0");
+    }
+    
+}
index 5c14055c6a621220b9f15994e902b3add59a8617..b05d7bc72a5e9cfe1073f47ae312dc127351afcd 100644 (file)
@@ -119,7 +119,7 @@ aspect DeclareCoverage {
     declare warning: call(* Point.setX(..)): "Illegal call.";
 
     declare parents: Point extends java.io.Serializable;
-    declare parents: Point+ implements java.util.Observable;
+//    declare parents: Point+ implements java.util.Observable;
        declare parents: Point && Line implements java.util.Observable;
     declare soft: SizeException : call(* Point.getX());
        declare precedence: AdviceCoverage, InterTypeDecCoverage, *;
diff --git a/ajdoc/testdata/coverage/foo/NoMembers.java b/ajdoc/testdata/coverage/foo/NoMembers.java
new file mode 100644 (file)
index 0000000..d8dfcb3
--- /dev/null
@@ -0,0 +1,10 @@
+/*
+ * Created on Jan 12, 2005
+ */
+
+/**
+ * @author Mik Kersten
+ */
+public class NoMembers {
+
+}
index 25182eaf7dd0ba022add11065a5bd50114a85e65..34f22a03d5d7e60034c734ffb132f86b9b75a4c3 100644 (file)
@@ -33,7 +33,8 @@ public class CoverageTestCase extends TestCase {
        File file7 = new File("testdata/coverage/fluffy/bunny/rocks/Rocks.java");
        File file8 = new File("testdata/coverage/fluffy/bunny/rocks/UseThisAspectForLinkCheckToo.java");
        File file9 = new File("testdata/coverage/foo/PkgVisibleClass.java");
-        
+       File file10 = new File("testdata/coverage/foo/NoMembers.java");
+    
        File outdir = new File("testdata/coverage/doc");
        
        public void testOptions() {
@@ -54,6 +55,20 @@ public class CoverageTestCase extends TestCase {
            assertTrue(true);
        }
        
+    public void testCoveragePublicMode() {
+        outdir.delete();
+        String[] args = { 
+            "-public",
+            "-source", 
+            "1.4",
+            "-d", 
+            outdir.getAbsolutePath(),
+            file3.getAbsolutePath(),
+            file9.getAbsolutePath() 
+        };
+        org.aspectj.tools.ajdoc.Main.main(args);
+    }
+    
        public void testCoverage() {
                outdir.delete();
                String[] args = { 
@@ -73,21 +88,8 @@ public class CoverageTestCase extends TestCase {
                        file6.getAbsolutePath(),
                        file7.getAbsolutePath(),
                        file8.getAbsolutePath(),
-                       file9.getAbsolutePath()
-               };
-               org.aspectj.tools.ajdoc.Main.main(args);
-       }
-       
-       public void testCoveragePublicMode() {
-               outdir.delete();
-               String[] args = { 
-                       "-public",
-                       "-source", 
-                       "1.4",
-                       "-d", 
-                       outdir.getAbsolutePath(),
-                       file3.getAbsolutePath(),
-                       file9.getAbsolutePath() 
+                       file9.getAbsolutePath(),
+            file10.getAbsolutePath()
                };
                org.aspectj.tools.ajdoc.Main.main(args);
        }
diff --git a/ajdoc/testsrc/org/aspectj/tools/ajdoc/JDKVersionTest.java b/ajdoc/testsrc/org/aspectj/tools/ajdoc/JDKVersionTest.java
new file mode 100644 (file)
index 0000000..9e8b06b
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Created on Jan 12, 2005
+  */
+package org.aspectj.tools.ajdoc;
+
+import junit.framework.TestCase;
+
+/**
+ * @author Mik Kersten
+ */
+public class JDKVersionTest extends TestCase {
+
+//    public void testIsUsing1point4() {
+//        String v = System.getProperty("java.class.version","44.0");
+//        assertTrue(("49.0".compareTo(v) > 0) && ("48.0".compareTo(v) <= 0));
+//        assertFalse(Util.isExecutingOnJava5());
+//    }
+
+    public void testIsUsing1point5() {
+        assertTrue(Util.isExecutingOnJava5());
+    }
+    
+}