You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Currently the AndHowCompileProcessor does not generate code using the @Generated annotation. The template used for that is here - Its noted but commented out.
AndHow also generates warnings in IntelliJ that it has source files in target directories - perhaps the lack of the @Generated annotation is why?
A complication is the JDK8 uses javax.annotation.Generated while JDK9 and newer uses javax.annotation.processing.Generated. JDK9 & 10 seem to still include javax.annotation.Generated in the java.xml.ws.annotation module, but it disappears in JDK11.
To Reproduce
The annotation is not used, so its clearly not as generated code was intended to be.
If you compile a project in IntelliJ using AndHow, it will complain.
Additional context
To fix, I think the annotation processor needs to detect the target JVM version: ProcessingEnv.getSourceVersion()
and out put the correct annotation based on that.
One key detail here: Both Generated annotations have Retention on `SOURCE' meaning that the annotation is only present in the source file and is removed by the compiler - It is not present at all at run time. So, as long as the generated class can compile, it will be OK at runtime.
It seems likely that the Generated annotation must be on the class path at compile time, even if it is ignored, however. Thus, it makes sense to determine which annotation to use based on the actual runtime version (which determines which Generated implementation is present), rather than the target version.
The text was updated successfully, but these errors were encountered:
'Fixed' this with merge request #494.
The fix adds the Generated annotation, but IntelliJ still generates warnings about the Output directory.
There is discussion of the IntelliJ issue here: https://youtrack.jetbrains.com/issue/IDEA-159676
I asked for help - Perhaps someone will reply.
Describe the bug
Currently the
AndHowCompileProcessor
does not generate code using the@Generated
annotation. The template used for that is here - Its noted but commented out.AndHow also generates warnings in IntelliJ that it has source files in target directories - perhaps the lack of the
@Generated
annotation is why?A complication is the JDK8 uses
javax.annotation.Generated
while JDK9 and newer usesjavax.annotation.processing.Generated
. JDK9 & 10 seem to still includejavax.annotation.Generated
in the java.xml.ws.annotation module, but it disappears in JDK11.To Reproduce
The annotation is not used, so its clearly not as generated code was intended to be.
If you compile a project in IntelliJ using AndHow, it will complain.
Additional context
To fix, I think the annotation processor needs to detect the target JVM version:
ProcessingEnv.getSourceVersion()
and out put the correct annotation based on that.
One key detail here: Both
Generated
annotations have Retention on `SOURCE' meaning that the annotation is only present in the source file and is removed by the compiler - It is not present at all at run time. So, as long as the generated class can compile, it will be OK at runtime.It seems likely that the
Generated
annotation must be on the class path at compile time, even if it is ignored, however. Thus, it makes sense to determine which annotation to use based on the actual runtime version (which determines which Generated implementation is present), rather than the target version.The text was updated successfully, but these errors were encountered: