java-topology/test/langtools/tools/doclint/EmptyDescriptionTest.java
russell@unturf.com 0a580b313d undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com

Patches, unit tests, benchmarks, whitepaper, and outreach briefs.
Public domain — no copyright claimed. Use freely.
2026-03-26 17:11:57 -04:00

79 lines
1.6 KiB
Java

/*
* @test /nodynamiccopyright/
* @bug 8272374
* @summary doclint should report missing "body" comments
* @modules jdk.javadoc/jdk.javadoc.internal.doclint
* @build DocLintTester
* @run main DocLintTester -Xmsgs:-missing EmptyDescriptionTest.java
* @run main DocLintTester -Xmsgs:missing -ref EmptyDescriptionTest.out EmptyDescriptionTest.java
*/
/** . */
public class EmptyDescriptionTest {
// a default constructor triggers its own variant of "no comment"
// no comment
public int f1;
// empty comment
/** */
public int f2;
// empty description
/**
* @since 1.0
*/
public int f3;
// deprecated: no diagnostic
/**
* @deprecated do not use
*/
public int f4;
// no comment
public int m1() { return 0; }
// empty comment
/** */
public int m2() { return 0; }
// empty description
/**
* @return 0
*/
public int m3() { return 0; }
// deprecated: no diagnostic
/**
* @deprecated do not use
* @return 0
*/
public int m4() { return 0; };
/**
* A class containing overriding methods.
* Overriding methods with missing/empty comments do not generate messages
* since they are presumed to inherit descriptions as needed.
*/
public static class Nested extends EmptyDescriptionTest {
/** . */ Nested() { }
@Override
public int m1() { return 1; }
// empty comment
/** */
@Override
public int m2() { return 1; }
// empty description
/**
* @return 1
*/
@Override
public int m3() { return 1; }
}
}