-
-
Notifications
You must be signed in to change notification settings - Fork 260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support ErrorProne by using javax.annotation.processing.Generated
or javax.annotation.Generated
#2726
Comments
BackgroundWe started with Ultimately that was problematic (I think I remember this correctly) because if we target compiling Java 8 byte code but have say Java 11 as the JDK then. In this case the annotation processor would use Now at the time, I felt that a lot of annotation processors hit this issue and hence started using their own TodayHowever today, Ebean has a minimum Java 11 requirement. That means, we can't possibly hit that issue that we could in the past as target version and JDK must both be 11+ now. That means, we should be back to a simple world where we could just go back to using That is, we should just use |
Ah, I forgot another problem.
That is, back in the day I ended up having this conversation at jigsaw-dev on the topic - https://www.mail-archive.com/[email protected]/msg11191.html TLDR of that is that using See also: google/error-prone@4d6a0cc and discussion at google/error-prone#1863 and discussion at mapstruct/mapstruct#1528 |
So I think this comes back to:
|
Interesting, but when ErrorProne supports all annotations named "Generated" then why does it trigger for ModuleInfo? Seems like something is off here. I thought it might be because your Luckily ErrorProne also has the possibility to exclude source paths, so I excluded the generated source root in my project. But I see this solution as workaround for something that should have already worked out of the box. |
I think this refers to
Er, it really should be |
Hmmm, just to note that I think Maybe, |
Just found: google/error-prone#3108 I guess that is the reason why it did not work.
There are a couple of other annotations in that package that use |
Yeah, wasn't there a discussion somewhere about that name? Personally I never really liked it because the name doesn't give a clue what it is used for. Not sure about "generated" in the name just because the file is generated. I would prefer having "ebean" in the name, so I know where this file is coming from. Maybe |
Note related: #2731 Change ebean-querybean annotations from Retention RUNTIME to CLASS |
Note related: #2733 - Rename ModuleInfoLoader to EntityClassRegister and _Ebean$ModuleInfo to EbeanEntityRegister |
Ok, I think we can close this one now. @jnehlmeier re-open if need be. |
Ebean uses its own annotation to mark generated code. However the standard annotations for generated code are
javax.annotation.processing.Generated
orjavax.annotation.Generated
.When using Google ErrorProne to check code for bug patterns (similar to FindBugs/SpotBugs) the
UnusedMethod
checker (https://errorprone.info/bugpattern/UnusedMethod) is triggered for_Ebean$ModuleInfo.otherClasses()
. This happens when you do not have anyAttributeConverter
or similar. In that caseotherClasses()
returns an empty list and the method itself is never called.Regardless of the above (which could be fixed by always calling
otherClasses
or not generating the method), I generally do not want to execute code checks on generated code. ErrorProne has an option to skip any code that is annotated withjavax.annotation.processing.Generated
orjavax.annotation.Generated
. However this does not work with Ebean because of non-standard annotation being used.Expected behavior
Use standard annotations for generated code so that code analysis tools can detect it
Actual behavior
io.ebean.typequery.Generated
is used.The text was updated successfully, but these errors were encountered: