CommandHelper

CommandHelper

46.5k Downloads

OpenJDK 14 & `@javax.annotation.Generated`

Ecconia opened this issue ยท 6 comments

commented

Issue: Cannot compile freshly cloned CommandHelper. Because Annotation javax.annotation.Generated does not exist in my JDK version (OpenJDK 14).

Java version:
openjdk version "14.0.2" 2020-07-14
OpenJDK Runtime Environment (build 14.0.2+12)
enJDK 64-Bit Server VM (build 14.0.2+12, mixed mode)
OS:
Linux (Manjaro)

There are about 10 files in the package io.swagger.client which contain following annotation a bunch of times:
@javax.annotation.Generated(value = "io.swagger.codegen.v3.generators.java.JavaClientCodegen", date = "2020-05-03T21:27:33.613+02:00[Europe/Berlin]")

Workaround:
I commented all occurrences of this Annotation out. Since they seem to be useless for runtime anyway. And then it compiles without issues.

Suggestion:
(The worst: Require a non-common non-friendly non-commercial JDK version)
Either remove the Annotations or replace them with comments?
Add a dependency which adds support for this annotation again.

Edit: I assume they are runtime-useless - I have not confirmed that - in fact idk what these annotations are good for while runtime.

commented

After a full system re-install, I ran into the same problem using maven -> install through Java Eclipse. For me, adding AdoptOpenJDK's jdk-8.0.282.8-hotspot to the known installed JREs in Eclipse resolved the problem. The project settings remain unchanged, but by doing this, Eclipse will no longer use a later JRE version where the project demands Java 8.

commented

The other day I got CH building on Java 11 to see what might be needed. For this particular case I think I just added this dependency:

		<dependency>
			<groupId>javax.annotation</groupId>
			<artifactId>javax.annotation-api</artifactId>
			<version>1.3.2</version>
			<scope>compile</scope>
		</dependency>
		

Other changes I made unrelated to this issue:

  • Updated mockito-core from 2.15.0 to 2.28.2
  • Updated asm-all 6.0_BETA to asm 9.0
  • Updated maven-compiler-plugin from 3.7.0 to 3.8.1
  • Updated maven-shade-plugin from 3.1.0 to 3.2.1
commented

I had to also add javax.annotation-api (and the other dependencies) to get things working, as @PseudoKnight mentioned above.

commented

I am not building CommandHelper that often, if however I run into this issue again. I will add the dependency.
-> If it fixes the issue, maybe consider adding it to the pom file.

commented

I think @PseudoKnight was considering implementing it.

commented

This is being worked on in the #1281 branch (java-next), and this is fixed at least. There are still other issues with running on java 11 though, but it compiles at least.