-
Notifications
You must be signed in to change notification settings - Fork 320
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
compiler release option #2210
compiler release option #2210
Conversation
Added the missing option in the bundles that we publish
does this mean also test run just with j17? org.eclipse.xtext.xbase.ui.testing.AbstractXbaseContentAssistTest |
do we have a task for xtext and xtend maven plugin? |
@cdietrich xtext and xtend maven plugins are executed in standard builds. |
@LorenzoBettini i mean two things
which code are you referring to. with tests i mean all tests |
@cdietrich I meant something else: if you look at our Maven plugins, they choose the Java compatibility level by looking at the properties |
yes so do we need a follow up task to handle this better? |
I think it's absolutely important to still run the tests against Java11 if we claim that we are compatible to Java11. Otherwise some random 3rd party dep might sneak into our TP that is compiled to Java17 bytecode and that would go unnoticed. |
@szarnekow I see. However, this PR is unrelated to that. This PR only adds additional checks concerning the wrong use of API that is more recent than Java 11. Even in Eclipse, if you tried to use API from Java 17, you would immediately get a compilation error. Additionally, I'd want to start using Tycho 3 by default. We could still configure the build job using Java 11 to override the Tycho version to 2.7.5. |
This is right for 'plain' Maven project with packaging type So unless there are projects with maven packaging type
It is great that you already consider to move to Tycho 3, I wanted to suggest that too. :) For example for SWT this is set up (altough SWT is about to move to Java-17 too):
Something similar is probably also possible for a Jenkins workflow if you want that there too. |
@HannesWell thanks for the feedback! We also have pure jar projects, so the release configuration is required for those projects. Moreover, my PR was also meant to let jdt check that in Eclipse, not only during the build. I'll investigate also the toolchain, which I never had a chance to explore. My proposal for switching to an older Tycho when using java 11 was based on the fact that we also have a few checks in Jenkins depending on the job parameters. The GitHub actions jobs are already using java 17 only. |
Yes, then this setting is totally reasonable. 👍🏽
Yes, that is good either way :)
Understand. Yes, I noticed that already. |
@HannesWell I created a dedicated issue. If, in the meantime, could you please point me to the relevant parts needed for the toolchain? I saw the XML file and it's simple, but I don't see in the SWT repository how to activate a specific toolchain. Moreover, who provides the locations for the actual JDK installations? If you have time, please comment on the other issue. @szarnekow can we merge this one? As I said, it's just about additional checks that were missing in some projects to make sure we don't use Java API greater than 11. |
@cdietrich OK to merge? |
Quoting from https://maven.apache.org/plugins/maven-compiler-plugin/examples/set-compiler-release.html
This means that we can forget about compiling with Java 11 and safely compile with Java 17 always. If we tried to use API not present in Java 11 we would get a compilation error.
This would allow us to switch to Tycho 3 for good (xtext/xtext-monorepo#15)
I added the property in the parent POM. I did NOT remove the source and target options, which would be redundant, because as far as I know our Maven plugins read those properties and not the release property.
Most of our bundles already had
org.eclipse.jdt.core.compiler.release=enabled
inorg.eclipse.jdt.core.prefs
, so in Eclipse the option was already enabled. I add that option in the remaining bundles that we publish. I skipped the test bundles since I wouldn't worry about them concerning this issue.