antlr4 icon indicating copy to clipboard operation
antlr4 copied to clipboard

Annotate Java files as being generated

Open magicwerk opened this issue 3 years ago • 0 comments

Signed-off-by: magicwerk [email protected]

magicwerk avatar May 30 '22 23:05 magicwerk

hi. I don't think it's a good idea to add an option to the entire tool just to get this tiny feature for one out of 10 targets. What problem are you solving here may I ask?

parrt avatar Aug 26 '22 21:08 parrt

The problem I try to solve is referenced:

  • Add @SuppressWarnings and @Generated annotations to all generated classes and interfaces #2568 There is also another related issue:
  • javax.annotation.processing.Generated #2512 In both issues, feedback was positive that a PR would be welcomed and reviewed. So this PR tries to solve theses issues.

magicwerk avatar Aug 27 '22 09:08 magicwerk

Thanks very much for the detailed response. Could you modify this so all it does is add @generated("ANTLR") in Java.stg? Can I don't think I'm ready for options or any other warning suppression at this time. thanks!

parrt avatar Aug 28 '22 17:08 parrt

Unfortunately things are not that easy... The original annotation @javax.annotation.Generated is not longer part of Java 11. You can use @javax.annotation.processing.Generated instead or bring back the old javax stuff with the artifact javax.annotation:javax.annotation-api. As Antlr targets a wide ranch of Java versions, a command line option would definitely make more sense.

magicwerk avatar Aug 31 '22 21:08 magicwerk

hm...ok, yeah, I don't want to add an option just for this. As it doesn't make sense to add something that will only work with certain versions then I guess I'll close. sorry!

parrt avatar Aug 31 '22 21:08 parrt