Integrated: 8341907: javac -Xlint should ignore /// on first line of source file

Pavel Rappo prappo at openjdk.org
Fri Nov 15 10:23:42 UTC 2024


On Wed, 6 Nov 2024 11:31:02 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

> Please review this PR to exempt the [trick that JBang uses][] from the "dangling comment" lint introduced in JDK 23. For more information see this PR's JBS issue and its comment section.
> 
> The fix makes sure that the warning is not issued if it relates to a leading `///` comment. For simplicity and similarity with the shebang construct, the comment should start from the first character of the file, and not a more permissive first non-whitespace character of the file.
> 
> Since I'm not an expert in `java.compiler`, I'm unsure if my code intercepts warning in the most appropriate layer. Please double-check that.
> 
> Skimming through the tests which I used for inspiration, `test/langtools/tools/javac/danglingDocComments`, I was unsure why they compile itself first without any `/ref=` construct. The test I introduced here does not do this; am I missing something?
> 
> [trick that JBang uses]: https://www.jbang.dev/documentation/guide/latest/usage.html

This pull request has now been integrated.

Changeset: 3eece6e9
Author:    Pavel Rappo <prappo at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/3eece6e941035e091e8ece7dd44a1837417c9b87
Stats:     115 lines in 8 files changed: 113 ins; 0 del; 2 mod

8341907: javac -Xlint should ignore /// on first line of source file

Reviewed-by: jjg

-------------

PR: https://git.openjdk.org/jdk/pull/21923


More information about the compiler-dev mailing list