-
Notifications
You must be signed in to change notification settings - Fork 44
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
GitHub Issue #59: JakartaEE9 source and target level #68
Open
markus183
wants to merge
1
commit into
eclipse-ee4j:master
Choose a base branch
from
markus183:maven_compiler_plugin_properties
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't setting up release flag be better option? How is this going to guarantee that no SE 9+ APIs are used in the code to compiled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it wouldn't for following reasons combined:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this useful for those who did then? What are those having default compile with
release 11
and additional compile step withrelease 8
supposed to do to adopt this change?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point @lukasj . The release flag seems to be the better option if all children are building with jdk11. But I wonder if they do and/or are going to migrate?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I think it's better to 'force' those relying on JDK 8 to move forward than those on JDK 11 already to move backward
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no impact on them in such case. But using
m*.c*.release
would impact those that are not build-with-JDK9+ ready.Nothing, as they already configured compiler plugin in its configuration section or with properties (which override the ones from parent should some be defined).
Adding
m*.c*.source/target
will mainly serve informational role as I see it. Because - I guess, children already configure compiler plugin which by default uses source/target=1.6 if not commanded otherwise.Using--release
is not enough to guarantee that no SE 9+ APIs are used in the code, because Cross-Compilation Options for javac says so, and some other steps have to be done, beside setting that property.So, having
<maven.compiler.target>1.8</maven.compiler.target>
could be JakartaEE declaration of class level, but I do not like idea of
<maven.compiler.release>1.8</maven.compiler.release>
now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is false. On the same page, the description of
--release
reads:There are 2 possibilities:
-source
+-target
+-bootclasspath
+-extdirs
--release
As @lukasj already pointed out, just setting
-source
and-target
is not sufficient to prevent usage of Java SE 9+ APIs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, now I see. I was wrong. Thanks.
I agree -
release
is better 😄 then (once all children are prepared or it's agreed to force them to migrate to newer JDK).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://openjdk.java.net/jeps/247
I think we have the following options for the parent pom.xml:
For example:
3.1 profile for jdk9+ includes property release=8.
3.2 profile for jdk8 includes source=8, target=8.
I don't understand why -bootclasspath and -extdirs is needed in case 3.2. There is no cross compilation happening. (I am curious btw if option 3 was envisioned like this for the ecosystem.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because if you don't set these options, compiler may introduce a reference to a class that does not exist in the target JDK: this is one key thing that
--release
does = enforce classes from target JDKone option often used to avoid setting -bootclasspath and -extdirs, but detect if something wrong happens is to use AnimalSniffer: https://www.mojohaus.org/animal-sniffer/