Skip to content
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

Jakarta inject API jar classes are not Java 8 byte code. #18

Closed
jhanders34 opened this issue Jan 28, 2021 · 15 comments
Closed

Jakarta inject API jar classes are not Java 8 byte code. #18

jhanders34 opened this issue Jan 28, 2021 · 15 comments
Assignees

Comments

@jhanders34
Copy link
Member

Describe the bug
The classes in the jakarta.inject api JAR have Java 5 byte code instead of Java 8 byte code.

To Reproduce
javap -v -classpath jakarta.inject-api-2.0.0.jar jakarta.inject.Inject | grep "major version"
major version: 49
javap -v -classpath jakarta.inject-api-2.0.0.jar jakarta.inject.Named | grep "major version"
major version: 49
javap -v -classpath jakarta.inject-api-2.0.0.jar jakarta.inject.Provider | grep "major version"
major version: 49
javap -v -classpath jakarta.inject-api-2.0.0.jar jakarta.inject.Qualifier | grep "major version"
major version: 49
javap -v -classpath jakarta.inject-api-2.0.0.jar jakarta.inject.Scope | grep "major version"
major version: 49
javap -v -classpath jakarta.inject-api-2.0.0.jar jakarta.inject.Singleton | grep "major version"
major version: 49

Expected behavior
Jakarta EE 9's minimum Java level is Java 8. As such all API jars should have Java 8 byte code. All other API JARs for the Jakarta EE 9 features have classes with Java 8 byte code. As you see above the major version is 49. It should be 52 for Java 8 byte code.

Additional context
From looking at other projects, the following needs to configured in the pom.xml

        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
@kwsutter
Copy link

Could we get this updated in a 2.0.1 release of the API?

@pzygielo
Copy link

@jhanders34 could you elaborate on the bug a bit?
I don't understand what the problem is. AFAIU having earlier byte code version is fine, and Jakarta EE9 shall be AT MOST at level of 8.

@jhanders34
Copy link
Member Author

@pzygielo last year I attended a Jakarta 9 meeting and I asked about the statement that Java 8 would be the minimum level that would be supported. This was at the time when there was debate on whether the minimum Java level would be 8 or 11. At the time it was decided to be Java 8. The question I asked was whether with that decision would the byte code of the API jars also be Java 8 byte code. I was told yes that was what should be done. For some additional context, in the past Java / Jakarta EE API jars had a mix of different Java byte levels. Newer Java versions have optimizations depending on the byte code level of the classes that are loaded. Also as I said in the description the injection API jar is the odd API jar out; it is the only one that isn't using Java 8 byte code. A change to use Java 8 byte code would create consistency. I hope that helps give reason why I wrote this issue.

@jhanders34
Copy link
Member Author

@pzygielo Any additional thoughts on this?

@starksm64
Copy link
Contributor

Classes that are usable on Java 8 is the minimum requirement, meaning that Java 9 or later are not supported. There was no requirement to have API jars compiled at the Java 8 level byte code, major.version=52.

I'll update the pom to use Java 8 source and target levels. It will be a question to the spec committee as to whether this is a sufficient reason for a 2.0.1 service release.

@rbygrave
Copy link
Contributor

rbygrave commented Oct 4, 2021

Just to note that this issue is resolved by commit - 749c66a

@jhanders34
Copy link
Member Author

Will there be a 2.0.1 version of the injection-api created?

@Ladicek
Copy link
Contributor

Ladicek commented Oct 5, 2021

Yea I think we should do a 2.0.1 with recent changes (module-info.class). Not sure if there is any specific "bureaucracy" involved in producing a final release... but with recent changes to the release jobs, we should probably do an RC first anyway :-)

@starksm64
Copy link
Contributor

This needs to be verified by running the injection TCK against weld before the release is pushed out. For service releases like this, there is no requirement for approval by the spec committee.

@Ladicek
Copy link
Contributor

Ladicek commented Oct 5, 2021

OK cool. That said, I think the best way to test this with Weld would be to do an RC release :-)

@starksm64
Copy link
Contributor

True, so I'll do that as I believe there has to be a release of the TCK to match any updates to the API jar as per the TCK process guide, but I have to look that up. An RC can be put out independently.

@Ladicek
Copy link
Contributor

Ladicek commented Oct 5, 2021

We can discuss that on the call in 20 minutes, I'd be interested to know the requirements around a final release.

@starksm64
Copy link
Contributor

It has been staged and released to maven central. It is available from staging repo here, central will be available soon:
https://jakarta.oss.sonatype.org/content/repositories/staging/jakarta/inject/jakarta.inject-api/2.0.1.RC1/

@rbygrave
Copy link
Contributor

rbygrave commented Oct 5, 2021

Awesome, thanks Scott. I note the tag "release notes" at https://github.com/eclipse-ee4j/injection-api/releases/tag/2.0.1.RC1 haven't been updated yet but maybe that happens at a later point. FYI: My tests all passing with 2.0.1.RC1 as expected and looks good.

@starksm64
Copy link
Contributor

Releases on GitHub are not automatic, so I created it now.
https://github.com/eclipse-ee4j/injection-api/releases/tag/2.0.1.RC1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants