plexus-compiler icon indicating copy to clipboard operation
plexus-compiler copied to clipboard

Parse and forward JavaC 'Note:' level messages

Open gnodet opened this issue 2 years ago • 3 comments

  • #313
  • #314
  • Parse and forward JavaC Note messages (supersedes #288)
  • Allow -log argument for Eclipse compiler (supersedes #57)
  • Fixes #183 and #55

Theses messages can be generated by annotation processors using printMessage(Diagnostic.Kind.NOTE, "...").

gnodet avatar Oct 27 '23 06:10 gnodet

This PR should also integrate https://github.com/codehaus-plexus/plexus-compiler/pull/57 I'll remove the draft status when that's done.

gnodet avatar Oct 27 '23 18:10 gnodet

Actually, I'm not sure about including the -log eclipse compiler option the way it is. I think it should be rather implemented as https://github.com/codehaus-plexus/plexus-compiler/pull/296 or with a global option in the CompilerConfig to give a path to a directory or file to store the compiler output for later inspection. However, passing the argument directly to the compiler and have plexus-compiler parse the file after the compilation could definitely lead to problems in case the give log is an absolute path and use concurrently. I'd rather have direct compiler output not accessible and the mentioned option to write/move/copy the output after the compilation has been done and the output has been parsed.

gnodet avatar Oct 28 '23 10:10 gnodet

For info, in Java 21, a note was added that span multiple lines (see https://inside.java/2023/07/29/quality-heads-up/). This produce the following output from javac:

Note: Annotation processing is enabled because one or more processors were found
  on the class path. A future release of javac may disable annotation processing
  unless at least one processor is specified by name (-processor), or a search
  path is specified (--processor-path, --processor-module-path), or annotation
  processing is enabled explicitly (-proc:only, -proc:full).
  Use -Xlint:-options to suppress this message.
  Use -proc:none to disable annotation processing.

This should probably be handled in this PR when note level messages are parsed.

Not sure what is the plan to merge this, but it would be really useful to have at least the note parsing, to handle this case when compiling with Java 21. Currently note messages are skipped, but this also only handle single line messages, so only the first line is skipped and the remaining lines are prepended with the next warning which is not a good output.

spadou avatar Nov 27 '23 12:11 spadou