diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java index be311bb3ab8..3f7e27ca267 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/DocCommentParser.java @@ -1147,7 +1147,6 @@ public class DocCommentParser { ListBuffer attrs = new ListBuffer<>(); skipWhitespace(); - loop: while (bp < buflen && isIdentifierStart(ch)) { int namePos = bp; Name name = readAttributeName(); @@ -1165,14 +1164,6 @@ public class DocCommentParser { nextChar(); textStart = bp; while (bp < buflen && ch != quote) { - if (newline && ch == '@') { - attrs.add(erroneous("dc.unterminated.string", namePos)); - // No point trying to read more. - // In fact, all attrs get discarded by the caller - // and superseded by a malformed.html node because - // the html tag itself is not terminated correctly. - break loop; - } attrValueChar(v); } addPendingText(v, bp - 1, DocTree.Kind.TEXT); diff --git a/test/langtools/tools/javac/doctree/AttrTest.java b/test/langtools/tools/javac/doctree/AttrTest.java index 6f17849c13f..ea5761d33ee 100644 --- a/test/langtools/tools/javac/doctree/AttrTest.java +++ b/test/langtools/tools/javac/doctree/AttrTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, 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 8076026 8273244 + * @bug 7021614 8076026 8273244 8321500 * @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 @@ -345,4 +345,70 @@ DocComment[DOC_COMMENT, pos:1 block tags: empty ] */ + + /** + * + */ + void tags_in_attr() { } +/* +DocComment[DOC_COMMENT, pos:1 + firstSentence: 1 + StartElement[START_ELEMENT, pos:1 + name:a + attributes: 3 + Attribute[ATTRIBUTE, pos:4 + name: name1 + vkind: DOUBLE + value: 1 + Literal[LITERAL, pos:11, value] + ] + Attribute[ATTRIBUTE, pos:29 + name: name2 + vkind: SINGLE + value: 1 + Text[TEXT, pos:36, @foo] + ] + Attribute[ATTRIBUTE, pos:42 + name: name3 + vkind: DOUBLE + value: 6 + Text[TEXT, pos:49, abc|@notag_] + Entity[ENTITY, pos:60, lt] + Text[TEXT, pos:64, Noref] + Entity[ENTITY, pos:69, gt] + Text[TEXT, pos:73, _] + Literal[LITERAL, pos:74, xyz] + ] + ] + body: empty + block tags: empty +] +*/ + + /** + *