RFR: 8341907: javac -Xlint should ignore /// on first line of source file [v4]

Pavel Rappo prappo at openjdk.org
Wed Nov 13 13:20:00 UTC 2024


> 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

Pavel Rappo has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:

 - Merge branch 'master' into 8341907
 - Fix a pre-existing doc typo
 - Make the check more specific
 - Address copyright issues
 - Initial commit

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/21923/files
  - new: https://git.openjdk.org/jdk/pull/21923/files/65ba8dca..e57eb6e7

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=21923&range=03
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=21923&range=02-03

  Stats: 98358 lines in 2729 files changed: 22126 ins; 68748 del; 7484 mod
  Patch: https://git.openjdk.org/jdk/pull/21923.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/21923/head:pull/21923

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


More information about the compiler-dev mailing list