File tree Expand file tree Collapse file tree
org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/formatter
org.eclipse.jdt.core/formatter/org/eclipse/jdt/internal/formatter Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16554,4 +16554,21 @@ record X<T>(T value) {
1655416554 """;
1655516555 formatSource(input, expected);
1655616556 }
16557+
16558+ public void testEnumJavaDocBreak() throws JavaModelException {
16559+ setComplianceLevel(CompilerOptions.VERSION_23);
16560+ String input = """
16561+ public enum TestEnum {
16562+ /// A
16563+ A;
16564+ }
16565+ """;
16566+ String expected = """
16567+ public enum TestEnum {
16568+ /// A
16569+ A;
16570+ }
16571+ """;
16572+ formatSource(input, expected);
16573+ }
1655716574}
Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ public boolean visit(EnumDeclaration node) {
164164 for (int i = 0 ; i < enumConstants .size (); i ++) {
165165 EnumConstantDeclaration declaration = enumConstants .get (i );
166166 if (declaration .getJavadoc () != null )
167- this .tm .firstTokenIn (declaration , TokenNameCOMMENT_JAVADOC ).breakBefore ();
167+ this .tm .firstTokenIn (declaration . getJavadoc (), ANY ).breakBefore ();
168168 if (declaration .getAnonymousClassDeclaration () != null && i < enumConstants .size () - 1 )
169169 this .tm .firstTokenAfter (declaration , TokenNameCOMMA ).breakAfter ();
170170 }
You can’t perform that action at this time.
0 commit comments