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.
This commit is contained in:
commit
0a580b313d
70422 changed files with 17213626 additions and 0 deletions
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @compile -Xlint:dangling-doc-comments DanglingDocCommentsClass.java
|
||||
* @compile/ref=empty.out -XDrawDiagnostics DanglingDocCommentsClass.java
|
||||
* @compile/ref=DanglingDocCommentsClass.enabled.out -XDrawDiagnostics -Xlint:dangling-doc-comments DanglingDocCommentsClass.java
|
||||
*/
|
||||
|
||||
// This is a test of duplicate and misplaced doc comments in a class, using traditional comments
|
||||
|
||||
/** Bad/Extra Class Comment. */
|
||||
/** Good Class Comment. */
|
||||
@Deprecated
|
||||
/** Misplaced: after anno. */
|
||||
public /** Misplaced: after mods. */ class DanglingDocCommentsClass /** Misplaced: after ident */ {
|
||||
/** Bad/Extra Field Comment. */
|
||||
/** Good Field Comment. */
|
||||
public int i;
|
||||
|
||||
/** Bad/Extra Method Comment. */
|
||||
/** Good Method Comment. */
|
||||
public void m1() { }
|
||||
|
||||
@SuppressWarnings("dangling-doc-comments")
|
||||
/** Bad/misplaced/suppressed comment. */
|
||||
public void m2() { }
|
||||
|
||||
public void m3(boolean b) {
|
||||
/****************
|
||||
* Box comment *
|
||||
***************/
|
||||
if (b) return;
|
||||
}
|
||||
|
||||
public void m4a() {
|
||||
/** Not a doc comment. */
|
||||
System.out.println();
|
||||
/** Not a doc comment; not dangling for m4b */
|
||||
}
|
||||
|
||||
/** Good comment for m4b; no dangling comments. */
|
||||
public void m4b() { }
|
||||
|
||||
/** Comment ignored here: does not affect decls in block */
|
||||
static {
|
||||
/** Good comment. */
|
||||
int i = 0;
|
||||
}
|
||||
|
||||
/** Dangling comment X */
|
||||
|
||||
/**
|
||||
* The {@code @SuppressWarnings} annotation below retroactively
|
||||
* silences the warning about "Dangling comment X".
|
||||
*/
|
||||
@SuppressWarnings("dangling-doc-comments")
|
||||
public void m5() { }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue