Browse Source

Fix for Bugzilla Bug 71076

	  	Missing Javadoc comments that aren't missing
tags/V1_2_1
aclement 20 years ago
parent
commit
5b902242b0

+ 84
- 0
org.aspectj.ajdt.core/testdata/javadoc/World.java View File

@@ -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 {}

+ 1
- 0
org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/AjdtBatchTests.java View 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$

+ 74
- 0
org.aspectj.ajdt.core/testsrc/org/aspectj/ajdt/internal/compiler/batch/JavadocTest.java View File

@@ -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);
}
}
}

BIN
org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip View File


BIN
org.eclipse.jdt.core/jdtcore-for-aspectj.jar View File


Loading…
Cancel
Save