-
Bug
-
Resolution: Fixed
-
P3
-
18
-
None
-
b18
Consider the following example source:
```
package pkg1;
/**
* {@link
* Object!equals
* equals
* }
*/
public class A { }
```
The above source features the `@link` tag which is unusually but legitimately formatted to span multiple lines. The reference `Object!equals` is malformed since it contains `!`, which the user is likely mistyped for the correct `#`.
When presented with that source, javadoc (tool) reports the following error:
```
src/pkg1/A.java:4: error: unexpected text
* {@link
^
```
As you can see, the diagnostic output positioned the caret quite far away from the actual error position. This could be improved. Here are some suggestions for the diagnostic output.
Good:
```
src/pkg1/A.java:5: error: unexpected text
* Object!
^
```
Very good:
```
src/pkg1/A.java:5: error: unexpected text
* Object!equals
^
```
Extremely chatty:
```
src/pkg1/A.java:4-7 error: unexpected text
04 * {@link
05 * Object!equals
^
06 * equals
07 * }
```
The latter suggestion might require quite a lot of surgery in javac reporting facilities.
---------
To implement this, we need to better translate DocCommentParser.ParseException to DCErroneousTree (think JCDiagnostic.DiagnosticPosition, DCEndPosTree) and then properly log errors related to those error trees.
```
package pkg1;
/**
* {@link
* Object!equals
* equals
* }
*/
public class A { }
```
The above source features the `@link` tag which is unusually but legitimately formatted to span multiple lines. The reference `Object!equals` is malformed since it contains `!`, which the user is likely mistyped for the correct `#`.
When presented with that source, javadoc (tool) reports the following error:
```
src/pkg1/A.java:4: error: unexpected text
* {@link
^
```
As you can see, the diagnostic output positioned the caret quite far away from the actual error position. This could be improved. Here are some suggestions for the diagnostic output.
Good:
```
src/pkg1/A.java:5: error: unexpected text
* Object!
^
```
Very good:
```
src/pkg1/A.java:5: error: unexpected text
* Object!equals
^
```
Extremely chatty:
```
src/pkg1/A.java:4-7 error: unexpected text
04 * {@link
05 * Object!equals
^
06 * equals
07 * }
```
The latter suggestion might require quite a lot of surgery in javac reporting facilities.
---------
To implement this, we need to better translate DocCommentParser.ParseException to DCErroneousTree (think JCDiagnostic.DiagnosticPosition, DCEndPosTree) and then properly log errors related to those error trees.
- relates to
-
JDK-8274744 TestSnippetTag test fails after recent integration
-
- Resolved
-
-
JDK-8266666 Implementation for snippets
-
- Resolved
-