4040import com .sun .tools .javac .code .Source .Feature ;
4141import com .sun .tools .javac .file .PathFileObject ;
4242import com .sun .tools .javac .parser .Tokens .*;
43- import com .sun .tools .javac .parser .Tokens .Comment .CommentStyle ;
4443import com .sun .tools .javac .resources .CompilerProperties .Errors ;
4544import com .sun .tools .javac .resources .CompilerProperties .Fragments ;
4645import com .sun .tools .javac .resources .CompilerProperties .Warnings ;
@@ -2819,7 +2818,7 @@ List<JCStatement> blockStatement() {
28192818 return List .of (parseSimpleStatement ());
28202819 case MONKEYS_AT :
28212820 case FINAL : {
2822- dc = token .comment ( CommentStyle . JAVADOC );
2821+ dc = token .docComment ( );
28232822 JCModifiers mods = modifiersOpt ();
28242823 if (isDeclaration ()) {
28252824 return List .of (classOrRecordOrInterfaceOrEnumDeclaration (mods , dc ));
@@ -2829,19 +2828,19 @@ List<JCStatement> blockStatement() {
28292828 }
28302829 }
28312830 case ABSTRACT : case STRICTFP : {
2832- dc = token .comment ( CommentStyle . JAVADOC );
2831+ dc = token .docComment ( );
28332832 JCModifiers mods = modifiersOpt ();
28342833 return List .of (classOrRecordOrInterfaceOrEnumDeclaration (mods , dc ));
28352834 }
28362835 case INTERFACE :
28372836 case CLASS :
2838- dc = token .comment ( CommentStyle . JAVADOC );
2837+ dc = token .docComment ( );
28392838 return List .of (classOrRecordOrInterfaceOrEnumDeclaration (modifiersOpt (), dc ));
28402839 case ENUM :
28412840 if (!allowRecords ) {
28422841 log .error (DiagnosticFlag .SYNTAX , token .pos , Errors .LocalEnum );
28432842 }
2844- dc = token .comment ( CommentStyle . JAVADOC );
2843+ dc = token .docComment ( );
28452844 return List .of (classOrRecordOrInterfaceOrEnumDeclaration (modifiersOpt (), dc ));
28462845 case IDENTIFIER :
28472846 if (token .name () == names .yield && allowYieldStatement ) {
@@ -2898,17 +2897,17 @@ List<JCStatement> blockStatement() {
28982897 nextToken ();
28992898 nextToken ();
29002899 nextToken ();
2901- return List .of (classOrRecordOrInterfaceOrEnumDeclaration (modifiersOpt (), token .comment ( CommentStyle . JAVADOC )));
2900+ return List .of (classOrRecordOrInterfaceOrEnumDeclaration (modifiersOpt (), token .docComment ( )));
29022901 } else if (isSealedClassStart (true )) {
29032902 checkSourceLevel (Feature .SEALED_CLASSES );
29042903 log .error (token .pos , Errors .SealedOrNonSealedLocalClassesNotAllowed );
29052904 nextToken ();
2906- return List .of (classOrRecordOrInterfaceOrEnumDeclaration (modifiersOpt (), token .comment ( CommentStyle . JAVADOC )));
2905+ return List .of (classOrRecordOrInterfaceOrEnumDeclaration (modifiersOpt (), token .docComment ( )));
29072906 }
29082907 }
29092908 }
29102909 if (isRecordStart () && allowRecords ) {
2911- dc = token .comment ( CommentStyle . JAVADOC );
2910+ dc = token .docComment ( );
29122911 return List .of (recordDeclaration (F .at (pos ).Modifiers (0 ), dc ));
29132912 } else {
29142913 Token prevToken = token ;
@@ -3911,7 +3910,7 @@ public JCTree.JCCompilationUnit parseCompilationUnit() {
39113910 JCExpression pid = qualident (false );
39123911 accept (SEMI );
39133912 JCPackageDecl pd = toP (F .at (packagePos ).PackageDecl (annotations , pid ));
3914- attach (pd , firstToken .comment ( CommentStyle . JAVADOC ));
3913+ attach (pd , firstToken .docComment ( ));
39153914 consumedToplevelDoc = true ;
39163915 defs .append (pd );
39173916 }
@@ -3946,9 +3945,9 @@ public JCTree.JCCompilationUnit parseCompilationUnit() {
39463945 seenImport = true ;
39473946 defs .append (importDeclaration ());
39483947 } else {
3949- Comment docComment = token .comment ( CommentStyle . JAVADOC );
3948+ Comment docComment = token .docComment ( );
39503949 if (firstTypeDecl && !seenImport && !seenPackage ) {
3951- docComment = firstToken .comment ( CommentStyle . JAVADOC );
3950+ docComment = firstToken .docComment ( );
39523951 consumedToplevelDoc = true ;
39533952 }
39543953 if (mods != null || token .kind != SEMI )
@@ -4015,7 +4014,7 @@ public JCTree.JCCompilationUnit parseCompilationUnit() {
40154014 List <JCTree > topLevelDefs = isUnnamedClass ? constructUnnamedClass (defs .toList ()) : defs .toList ();
40164015 JCTree .JCCompilationUnit toplevel = F .at (firstToken .pos ).TopLevel (topLevelDefs );
40174016 if (!consumedToplevelDoc )
4018- attach (toplevel , firstToken .comment ( CommentStyle . JAVADOC ));
4017+ attach (toplevel , firstToken .docComment ( ));
40194018 if (defs .isEmpty ())
40204019 storeEnd (toplevel , S .prevToken ().endPos );
40214020 if (keepDocComments )
@@ -4500,7 +4499,7 @@ private enum EnumeratorEstimate {
45004499 /** EnumeratorDeclaration = AnnotationsOpt [TypeArguments] IDENTIFIER [ Arguments ] [ "{" ClassBody "}" ]
45014500 */
45024501 JCTree enumeratorDeclaration (Name enumName ) {
4503- Comment dc = token .comment ( CommentStyle . JAVADOC );
4502+ Comment dc = token .docComment ( );
45044503 int flags = Flags .PUBLIC |Flags .STATIC |Flags .FINAL |Flags .ENUM ;
45054504 if (token .deprecatedFlag ()) {
45064505 flags |= Flags .DEPRECATED ;
@@ -4605,7 +4604,7 @@ protected List<JCTree> classOrInterfaceOrRecordBodyDeclaration(JCModifiers mods,
46054604 nextToken ();
46064605 return List .nil ();
46074606 } else {
4608- Comment dc = token .comment ( CommentStyle . JAVADOC );
4607+ Comment dc = token .docComment ( );
46094608 int pos = token .pos ;
46104609 mods = modifiersOpt (mods );
46114610 if (isDeclaration ()) {
@@ -4738,7 +4737,7 @@ private List<JCTree> constructorOrMethodOrFieldDeclaration(JCModifiers mods, Nam
47384737 private List <JCTree > topLevelMethodOrFieldDeclaration (JCModifiers mods ) throws AssertionError {
47394738 int topPos = token .pos ;
47404739 int pos = token .pos ;
4741- Comment dc = token .comment ( CommentStyle . JAVADOC );
4740+ Comment dc = token .docComment ( );
47424741 List <JCTypeParameter > typarams = typeParametersOpt ();
47434742
47444743 // if there are type parameters but no modifiers, save the start
0 commit comments