Skip to content

Commit 383cf46

Browse files
SirCotareclaude
andcommitted
use markdown javadoc
Converts every documentation comment to the /// form of JEP 467: 54 javadoc comments plus two block comments that already sat in documentation positions. Markdown idiom throughout - `code` for {@code}, [Type#member] for {@link}, blank /// lines for <p>, and backticked annotation names for the &#64; entities. The five comments inside method bodies stay /* */, since /// is a documentation comment form and those document statements rather than declarations. No behaviour change. Verified with javadoc -Xdoclint:all: no warnings, the [#member] references resolve, and the generated HTML shows code spans, paragraphs and links rather than literal markdown. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent e9af6da commit 383cf46

42 files changed

Lines changed: 145 additions & 231 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/it/aboutbits/archunit/toolbox/config/ArchRuleConfig.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ public final class ArchRuleConfig {
1010
private ArchRuleConfig() {
1111
}
1212

13-
/**
14-
* List of supported test class name suffixes.
15-
* <p>
16-
* When introducing a new test type (e.g. IntegrationTest), add its suffix here
17-
* instead of directly modifying the regex pattern.
18-
**/
13+
/// List of supported test class name suffixes.
14+
///
15+
/// When introducing a new test type (e.g. IntegrationTest), add its suffix here
16+
/// instead of directly modifying the regex pattern.
1917
public static final Set<String> TEST_CLASS_SUFFIXES = new HashSet<>(
2018
Set.of(
2119
"Test",

src/main/java/it/aboutbits/archunit/toolbox/rule/base/AnalyzedPackagesMustContainClassesArchRule.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,13 @@
44
import com.tngtech.archunit.junit.ArchTest;
55
import org.jspecify.annotations.NullMarked;
66

7-
/**
8-
* Checks that the analyzed packages contain any classes at all.
9-
* <p>
10-
* Every other rule tolerates an empty selection, because whether a project has records, controllers
11-
* or @Nested test classes is the project's business and not something this library gets to require.
12-
* That leaves exactly one dangerous case: a mistyped or moved package in @AnalyzeClasses imports
13-
* nothing, and every rule then passes without looking at a single class. This rule is what turns that
14-
* into a failure, once, with a message that names the actual problem.
15-
* </p>
16-
*/
7+
/// Checks that the analyzed packages contain any classes at all.
8+
///
9+
/// Every other rule tolerates an empty selection, because whether a project has records, controllers
10+
/// or `@Nested` test classes is the project's business and not something this library gets to require.
11+
/// That leaves exactly one dangerous case: a mistyped or moved package in `@AnalyzeClasses` imports
12+
/// nothing, and every rule then passes without looking at a single class. This rule is what turns that
13+
/// into a failure, once, with a message that names the actual problem.
1714
@SuppressWarnings({"checkstyle:InterfaceIsType", "java:S1214"})
1815
@NullMarked
1916
public interface AnalyzedPackagesMustContainClassesArchRule {

src/main/java/it/aboutbits/archunit/toolbox/rule/common/ControllerRequestMappingsMustBeSecurityTested.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,9 @@ public void check(JavaMethod method, ConditionEvents events) {
109109
}
110110
}
111111

112-
/*
113-
* The @Nested class named after the controller method, or a @Nested class grouped inside it
114-
* (GetAll$WhenAdmin). Matching on a bare prefix would also accept an unrelated longer
115-
* sibling, so getAll() would count as covered by a @Nested class named GetAllArchived.
116-
*/
112+
/// The `@Nested` class named after the controller method, or a `@Nested` class grouped inside it
113+
/// (GetAll$WhenAdmin). Matching on a bare prefix would also accept an unrelated longer
114+
/// sibling, so getAll() would count as covered by a `@Nested` class named GetAllArchived.
117115
private static boolean isExpectedNestedClass(String candidateName, String expectedName) {
118116
return candidateName.equals(expectedName)
119117
|| candidateName.startsWith(expectedName + "$");

src/main/java/it/aboutbits/archunit/toolbox/rule/common/SortMappingsExhaustiveArchRule.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,11 @@ default void sort_mappings_cover_all_sort_enum_values(JavaClasses classes) {
3535
.check(classes);
3636
}
3737

38-
/**
39-
* Checks that every value of a Sort enum has a mapping.
40-
* <p>
41-
* Every case this cannot verify is reported as a violation rather than skipped. Reading a
42-
* mapping requires reflection, and a mapping that cannot be read is indistinguishable from one
43-
* that is exhaustive - so silence here means the rule quietly stops covering that field.
44-
* </p>
45-
*/
38+
/// Checks that every value of a Sort enum has a mapping.
39+
///
40+
/// Every case this cannot verify is reported as a violation rather than skipped. Reading a
41+
/// mapping requires reflection, and a mapping that cannot be read is indistinguishable from one
42+
/// that is exhaustive - so silence here means the rule quietly stops covering that field.
4643
class HaveExhaustiveSortMappingsIfPresent extends ArchCondition<JavaClass> {
4744
public HaveExhaustiveSortMappingsIfPresent() {
4845
super("have SortMappings that map all values of the associated Sort enum");

src/main/java/it/aboutbits/archunit/toolbox/support/ArchIgnoreGroupName.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
import java.lang.annotation.RetentionPolicy;
66
import java.lang.annotation.Target;
77

8-
/**
9-
* Marks a &#64;Nested test class that only groups tests logically and therefore has no matching
10-
* nested class in the production code.
11-
* <p>
12-
* Must not be meta-annotated with ArchUnit's &#64;ArchIgnore: the ArchUnit JUnit engine resolves
13-
* meta-annotations, so that would skip every &#64;ArchTest on the annotated class instead of
14-
* exempting it from a single rule. The rules read this annotation by its own type.
15-
* </p>
16-
*/
8+
/// Marks a `@Nested` test class that only groups tests logically and therefore has no matching
9+
/// nested class in the production code.
10+
///
11+
/// Must not be meta-annotated with ArchUnit's `@ArchIgnore`: the ArchUnit JUnit engine resolves
12+
/// meta-annotations, so that would skip every `@ArchTest` on the annotated class instead of
13+
/// exempting it from a single rule. The rules read this annotation by its own type.
1714
@Target({ElementType.TYPE})
1815
@Retention(RetentionPolicy.RUNTIME)
1916
public @interface ArchIgnoreGroupName {

src/main/java/it/aboutbits/archunit/toolbox/support/ArchIgnoreNoProductionCounterpart.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
import java.lang.annotation.RetentionPolicy;
66
import java.lang.annotation.Target;
77

8-
/**
9-
* Marks a test class that has no matching counterpart in the production code, for example a
10-
* scenario test named after the behaviour it describes.
11-
* <p>
12-
* Must not be meta-annotated with ArchUnit's &#64;ArchIgnore: the ArchUnit JUnit engine resolves
13-
* meta-annotations, so that would skip every &#64;ArchTest on the annotated class instead of
14-
* exempting it from a single rule. The rules read this annotation by its own type.
15-
* </p>
16-
*/
8+
/// Marks a test class that has no matching counterpart in the production code, for example a
9+
/// scenario test named after the behaviour it describes.
10+
///
11+
/// Must not be meta-annotated with ArchUnit's `@ArchIgnore`: the ArchUnit JUnit engine resolves
12+
/// meta-annotations, so that would skip every `@ArchTest` on the annotated class instead of
13+
/// exempting it from a single rule. The rules read this annotation by its own type.
1714
@Target({ElementType.TYPE})
1815
@Retention(RetentionPolicy.RUNTIME)
1916
public @interface ArchIgnoreNoProductionCounterpart {

src/main/java/it/aboutbits/archunit/toolbox/util/CodeUnitUtil.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,11 @@ public final class CodeUnitUtil {
1111
private CodeUnitUtil() {
1212
}
1313

14-
/**
15-
* Human readable kind of a code unit, for violation messages.
16-
* <p>
17-
* Rules that inspect bodies must iterate {@code getCodeUnits()} rather than {@code getMethods()}:
18-
* the latter excludes constructors, and an instance field initializer is compiled into the
19-
* constructor, so both are invisible to a rule that only looks at methods.
20-
* </p>
21-
*/
14+
/// Human readable kind of a code unit, for violation messages.
15+
///
16+
/// Rules that inspect bodies must iterate `getCodeUnits()` rather than `getMethods()`:
17+
/// the latter excludes constructors, and an instance field initializer is compiled into the
18+
/// constructor, so both are invisible to a rule that only looks at methods.
2219
public static String describeKind(JavaCodeUnit codeUnit) {
2320
return switch (codeUnit) {
2421
case JavaMethod _ -> "Method";

src/main/java/it/aboutbits/archunit/toolbox/util/TestClassNames.java

Lines changed: 29 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -9,69 +9,54 @@
99

1010
import static it.aboutbits.archunit.toolbox.config.ArchRuleConfig.TEST_CLASS_SUFFIXES;
1111

12-
/**
13-
* Single source of truth for recognising a test class by its name suffix.
14-
* <p>
15-
* Every rule that selects test classes must go through {@link #testClasses()}, and every rule that
16-
* derives a production class name must go through {@link #productionClassSimpleName(String)}.
17-
* Hand-building the suffix regex per rule is what allowed a condition to be anchored differently
18-
* from the selection that fed it, silently disabling the rule.
19-
* </p>
20-
*/
12+
/// Single source of truth for recognising a test class by its name suffix.
13+
///
14+
/// Every rule that selects test classes must go through [#testClasses()], and every rule that
15+
/// derives a production class name must go through [#productionClassSimpleName(String)].
16+
/// Hand-building the suffix regex per rule is what allowed a condition to be anchored differently
17+
/// from the selection that fed it, silently disabling the rule.
2118
@NullMarked
2219
public final class TestClassNames {
2320
private TestClassNames() {
2421
}
2522

26-
/**
27-
* Matches the name of a test class: at least one character, then one of the configured suffixes.
28-
* <p>
29-
* The leading {@code .+} is load-bearing. {@link String#matches(String)} and ArchUnit's
30-
* {@code haveNameMatching} both anchor at each end, so without it the pattern only matches a
31-
* class named exactly {@code Test}. It is also what keeps such a class out of the selection,
32-
* since it has no name left once the suffix is stripped.
33-
* </p>
34-
*/
23+
/// Matches the name of a test class: at least one character, then one of the configured suffixes.
24+
///
25+
/// The leading `.+` is load-bearing. [String#matches(String)] and ArchUnit's
26+
/// `haveNameMatching` both anchor at each end, so without it the pattern only matches a
27+
/// class named exactly `Test`. It is also what keeps such a class out of the selection,
28+
/// since it has no name left once the suffix is stripped.
3529
public static String testClassNameRegex() {
3630
return ".+(" + suffixAlternation() + ")$";
3731
}
3832

39-
/**
40-
* Matches only the trailing suffix, for stripping it off a test class name. Deliberately not
41-
* anchored at the start - this is used with {@link String#replaceAll(String, String)}, never
42-
* with {@link String#matches(String)}.
43-
*/
33+
/// Matches only the trailing suffix, for stripping it off a test class name. Deliberately not
34+
/// anchored at the start - this is used with [String#replaceAll(String, String)], never
35+
/// with [String#matches(String)].
4436
public static String suffixRegex() {
4537
return "(" + suffixAlternation() + ")$";
4638
}
4739

48-
/**
49-
* Whether a simple name is the name of a test class.
50-
* <p>
51-
* Requires a production class name to be left over once the suffix is stripped, so that the
52-
* selection cannot disagree with {@link #productionClassSimpleName(String)}. "CacheTest" matches
53-
* the pattern with "Cache" as the leading {@code .+}, yet stripping removes "CacheTest" whole and
54-
* leaves nothing to look for.
55-
* </p>
56-
*/
40+
/// Whether a simple name is the name of a test class.
41+
///
42+
/// Requires a production class name to be left over once the suffix is stripped, so that the
43+
/// selection cannot disagree with [#productionClassSimpleName(String)]. "CacheTest" matches
44+
/// the pattern with "Cache" as the leading `.+`, yet stripping removes "CacheTest" whole and
45+
/// leaves nothing to look for.
5746
public static boolean isTestClassName(String simpleName) {
5847
return simpleName.matches(testClassNameRegex())
5948
&& !productionClassSimpleName(simpleName).isEmpty();
6049
}
6150

62-
/**
63-
* The simple name of the production class a test class belongs to, e.g. {@code WidgetCacheTest}
64-
* to {@code Widget}.
65-
*/
51+
/// The simple name of the production class a test class belongs to, e.g. `WidgetCacheTest`
52+
/// to `Widget`.
6653
public static String productionClassSimpleName(String testClassSimpleName) {
6754
return testClassSimpleName.replaceAll(suffixRegex(), "");
6855
}
6956

70-
/**
71-
* Selects test classes by their <em>simple</em> name. Matching the simple name rather than the
72-
* fully qualified name keeps the selection and the conditions that follow it in agreement:
73-
* {@code some.pkg.Test} matches the fully qualified name but is not a test class.
74-
*/
57+
/// Selects test classes by their *simple* name. Matching the simple name rather than the
58+
/// fully qualified name keeps the selection and the conditions that follow it in agreement:
59+
/// `some.pkg.Test` matches the fully qualified name but is not a test class.
7560
public static DescribedPredicate<JavaClass> testClasses() {
7661
return new DescribedPredicate<>("have a simple name matching '%s'".formatted(testClassNameRegex())) {
7762
@Override
@@ -81,11 +66,9 @@ public boolean test(JavaClass javaClass) {
8166
};
8267
}
8368

84-
/*
85-
* Longest suffix first, then alphabetically. TEST_CLASS_SUFFIXES is a mutable HashSet, so
86-
* without an explicit order the generated regex - and every rule description built from it -
87-
* varies between JVM runs.
88-
*/
69+
/// Longest suffix first, then alphabetically. TEST_CLASS_SUFFIXES is a mutable HashSet, so
70+
/// without an explicit order the generated regex - and every rule description built from it -
71+
/// varies between JVM runs.
8972
private static String suffixAlternation() {
9073
var longestFirst = Comparator.<String>comparingInt(String::length)
9174
.reversed()

src/test/java/it/aboutbits/archunit/fixture/barren/PlainClass.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,8 @@
22

33
import org.jspecify.annotations.NullMarked;
44

5-
/**
6-
* A codebase with no test classes, no records, no controllers and no stores. Used to pin that a rule
7-
* whose selection comes up empty fails instead of reporting success.
8-
*/
5+
/// A codebase with no test classes, no records, no controllers and no stores. Used to pin that a rule
6+
/// whose selection comes up empty fails instead of reporting success.
97
@NullMarked
108
public class PlainClass {
119
public String value() {

src/test/java/it/aboutbits/archunit/fixture/blacklistannotations/badctorparam/AnnotatedConstructorParameter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package it.aboutbits.archunit.fixture.blacklistannotations.badctorparam;
22

3-
/** The canonical Lombok position, and the one a rule iterating only getMethods() cannot see. */
3+
/// The canonical Lombok position, and the one a rule iterating only getMethods() cannot see.
44
public class AnnotatedConstructorParameter {
55
private final String value;
66

0 commit comments

Comments
 (0)