8288619: Unexpected parsing for @see

Reviewed-by: jjg
This commit is contained in:
Guoxiong Li 2023-05-25 03:25:50 +00:00
parent 89b99143ac
commit a291f002cd
3 changed files with 46 additions and 3 deletions

View File

@ -284,6 +284,7 @@ public class DocCommentParser {
* Non-standard tags are represented by {@link UnknownBlockTagTree}.
*/
protected DCTree blockTag() {
newline = false;
int p = bp;
try {
nextChar();
@ -520,6 +521,7 @@ public class DocCommentParser {
* It is an error if the beginning of the next tag is detected.
*/
protected DCText quotedString() {
newline = false;
int pos = bp;
nextChar();

View File

@ -907,7 +907,10 @@ public class DocCommentTester {
var annos = (path.getLeaf() instanceof MethodTree m)
? m.getModifiers().getAnnotations().toString()
: "";
boolean normalizeTags = !annos.equals("@NormalizeTags(false)");
if (annos.contains("@PrettyCheck(false)")) {
return;
}
boolean normalizeTags = !annos.contains("@NormalizeTags(false)");
String raw = trees.getDocComment(path);
String normRaw = normalize(raw, normalizeTags);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/*
* @test
* @bug 7021614 8031212 8273244 8284908 8200337
* @bug 7021614 8031212 8273244 8284908 8200337 8288619
* @summary extend com.sun.source API to support parsing javadoc comments
* @modules jdk.compiler/com.sun.tools.javac.api
* jdk.compiler/com.sun.tools.javac.file
@ -50,6 +50,44 @@ DocComment[DOC_COMMENT, pos:1
Text[TEXT, pos:12, "String"]
]
]
*/
/**
* Test '@' in quoted string.
* @see "{@code}"
*/
void at_sign_in_quoted_string() { }
/*
DocComment[DOC_COMMENT, pos:1
firstSentence: 1
Text[TEXT, pos:1, Test_'@'_in_quoted_string.]
body: empty
block tags: 1
See[SEE, pos:29
reference: 1
Text[TEXT, pos:34, "{@code}"]
]
]
*/
/**
* Test new line before quoted string.
* @see
* "{@code}"
*/
@PrettyCheck(false)
void new_line_before_quoted_string() { }
/*
DocComment[DOC_COMMENT, pos:1
firstSentence: 1
Text[TEXT, pos:1, Test_new_line_before_quoted_string.]
body: empty
block tags: 1
See[SEE, pos:38
reference: 1
Text[TEXT, pos:47, "{@code}"]
]
]
*/
/**