]> source.dussan.org Git - aspectj.git/commitdiff
Fix for Bugzilla Bug 71076
authoraclement <aclement>
Wed, 18 Aug 2004 10:33:07 +0000 (10:33 +0000)
committeraclement <aclement>
Wed, 18 Aug 2004 10:33:07 +0000 (10:33 +0000)
   Missing Javadoc comments that aren't missing

org.aspectj.ajdt.core/testdata/javadoc/World.java [new file with mode: 0644]
org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/AjdtBatchTests.java
org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java [new file with mode: 0644]
org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip
org.eclipse.jdt.core/jdtcore-for-aspectj.jar

diff --git a/org.aspectj.ajdt.core/testdata/javadoc/World.java b/org.aspectj.ajdt.core/testdata/javadoc/World.java
new file mode 100644 (file)
index 0000000..28591bb
--- /dev/null
@@ -0,0 +1,84 @@
+// In this class we use all the constructs and attach javadoc to them all - checking
+// that the compiler doesnt complain that any javadoc is missing.
+
+/**
+ * A comment
+ * @see AspectJavadocComment
+ */
+public aspect World {
+    
+    public void test0() {}
+    
+    /**
+     * A comment
+     * @see PointcutJavadocComment1
+     */
+       pointcut firstPC() : execution(* *.sayHello(..));
+       
+    public void test1() {}
+    
+       /**
+        * A comment
+     * @see AfterReturningJavadocComment
+        */
+       after() returning : firstPC() {
+               System.out.println("world");
+       }
+
+    public void test2(){}
+    
+    /**
+     * comment2
+     * @see PointcutJavadocComment2
+     */   
+    public pointcut secondPC(): execution(* *(..));
+    
+    public void test3(){}
+    
+    /**
+     * I am a comment attached to a warning
+     * @see declarewarningJavadocComment
+     */
+    declare warning: call(* *elephant*(..)) : "I am a warning";
+    
+    public void test4() {}
+    
+    /**
+     * comment attached to around advice
+     * @see AroundAdviceJavadocComment
+     */
+    void around(): call(* *abc*(..)) {
+    }
+
+    public void test5() {}
+   
+    /**
+     * ITD method attached comment
+     * @see IntertypeMethodComment
+     */
+    public void X.method() {       }
+    
+    public void test6() {}
+    
+    /**
+     * ITD field attached comment
+     * @see IntertypeFieldComment
+     */
+    public int X.i;
+    
+    public int test7;
+    
+    static class X {
+        
+    }
+   
+}
+
+// to keep the javadoc processor happy ...
+class AspectJavadocComment {}
+class PointcutJavadocComment1 {}
+class PointcutJavadocComment2 {}
+class AfterReturningJavadocComment {}
+class AroundAdviceJavadocComment {}
+class IntertypeMethodComment {}
+class IntertypeFieldComment {}
\ No newline at end of file
index 80710268c8e218d1f8f7088917c275a328f653c0..5f9d266a959336c1011f2376a7b4098a12b5edec 100644 (file)
@@ -29,6 +29,7 @@ public class AjdtBatchTests extends TestCase {
                suite.addTestSuite(PerformanceTestCase.class); 
         suite.addTestSuite(ImageTestCase.class); 
         suite.addTestSuite(MultipleCompileTestCase.class); 
+        suite.addTestSuite(JavadocTest.class);
         // XXX suite.addTestSuite(VerifyWeaveTestCase.class); 
         //suite.addTestSuite(WorkingCommandTestCase.class); 
         //$JUnit-END$
diff --git a/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java b/org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java
new file mode 100644 (file)
index 0000000..957e045
--- /dev/null
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     Andy Clement - initial implementation
+ *******************************************************************************/
+package org.aspectj.ajdt.internal.compiler.batch;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.aspectj.bridge.IMessage;
+import org.aspectj.tools.ajc.AjcTestCase;
+import org.aspectj.tools.ajc.CompilationResult;
+
+
+public class JavadocTest extends AjcTestCase {
+    public static final String PROJECT_DIR = "javadoc";
+
+    private File baseDir;
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        baseDir = new File("../org.aspectj.ajdt.core/testdata",PROJECT_DIR);
+    }
+    
+    /**
+     * Aim: Check javadoc warning that appear are appropriate
+     * 
+     *   ajc -warn:allJavadoc World.java
+     * 
+     */
+    public void testMissingJavadoc () {
+        String[] args = new String[] {"World.java","-warn:allJavadoc"};
+        
+        List warningMessages = new ArrayList();
+        // These warnings are against public textX() methods declared in the World.java
+        // type.  These test methods are spread between AJ constructuts, meaning
+        // if someone messes up and the javadoc is not associated with the aspectj
+        // construct then it will associated by accident with one of the testX() methods.
+        // By checking we get a warning against every testX() method, we are verifying
+        // that the javadoc is being attached to the aspectj constructs.
+        warningMessages.add(new Message(10,"Missing comment for public declaration"));
+        warningMessages.add(new Message(18,"Missing comment for public declaration"));
+        warningMessages.add(new Message(28,"Missing comment for public declaration"));
+        warningMessages.add(new Message(36,"Missing comment for public declaration"));
+        warningMessages.add(new Message(44,"Missing comment for public declaration"));
+        warningMessages.add(new Message(53,"Missing comment for public declaration"));
+        warningMessages.add(new Message(61,"Missing comment for public declaration"));
+        warningMessages.add(new Message(69,"Missing comment for public declaration"));
+        MessageSpec spec = new MessageSpec(warningMessages,null);
+        
+        CompilationResult result = ajc(baseDir,args);
+        assertMessages(result,spec);
+        
+//        dump(result.getWarningMessages());
+//        System.err.println("-----------\n"+ajc.getLastCompilationResult().getStandardError());
+//        List l = result.getWarningMessages();
+//        IMessage m = ((IMessage)l.get(0));
+    }
+    
+    private void dump(List l) {
+         for (Iterator iter = l.iterator(); iter.hasNext();) {
+                       IMessage element = (IMessage) iter.next();
+                       System.err.println("Warning: "+element);
+               }
+    }
+}
index 3e7018819d534291d81201054a3e2c8f7076cc0f..f41d84e60bdb6b266e4f77c0fb453370cffac66b 100644 (file)
Binary files a/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip and b/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip differ
index 004291532169db11273296eceb6a574f2312e1ad..4c486ebb952ec7c0690242385cc20977c0e7ca42 100644 (file)
Binary files a/org.eclipse.jdt.core/jdtcore-for-aspectj.jar and b/org.eclipse.jdt.core/jdtcore-for-aspectj.jar differ