-
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
Update to Java 11 as minimal Java version #1972
Comments
Yes. One day. But Java 8 is a LTS version that remains valid until 2030, so I see no imperative to lose support for Java 8 users. Since Xtext is useable in a standalone context, the rush to Java 11 by the platform does not need to be emulated by the Xtext runtime. I see no reason why an Xtext-based parser/serializer should not run on Java 8. |
the problem is here platform and lsp4j rushing. |
There are two separate issues. a) The minimum Java version that you must use to develop. The platform pretty much mandates Java 11. b) The minimum Java version that a standalone user must use to run. For EMF its still Java 5. For much of modeling it has crept to Java 8. Provided you continue to specify a Java 8 BREE in plugins useable standalone , the Java compiler will ensure that Java 8 class files are produced. For OCL builds Java 8 tooling was used for many years only recently changing to Java 11, but no BREEs were changed so the Classic OCL builds are successfully tested every week against a Java 5 installation, and the Pivot/Xtext-based OCL builds are successfully compatibility tested against Java 8/11 as appropriate for the Eclipse platform under test. My understanding is that you may use source Java >=N language constructs and still have target Java N class files. You may not however use Java > N APIs. cf the bugs raised against EMF / QVTo for using the Java 6 String.length() method while claiming a Java 5 BREE. |
the problem is: i have nobody to help me with that tooling stuff. |
You don't need to do anything. Just don't change the existing BREEs and so don't break the existing users. Just install and use a newer Java JVM if that's what you need. Take no notice of the new inadequate BREE warning; a Bugzilla is pending to tame its enthusiasm. (I can't see how to subscribe to this thread.) |
we use gradle, maven and tycho. it needs to hild true for all of these. |
I have a simplistic view. Xtext is currently not broken. If you have time to make Xtext 'better' then it should not result in Xtext being broken for existing usage. |
so you will never update to Java 17 then? |
Java moves so fast that I certainly no longer chase it. From what I see Java > 8 gives my code nothing that I need and through modules gives me endless things that break. While some of the new constructs are tantalizing, as soon as you see them in a debugger they just don't work. cf Xtend which has nice enhancements that are hard to support in debugger / refactor / ... tooling. NB Java 8 is LTS till 2030. However I will check that OCL releases are useable with Java 17 by selecting Java 17 occasionally for a Jenkins build, and perhaps permanently if e.g. Eclipse 4.23 / Tycho 3.5 mandates it. |
I think there are any technical reasons to start compiling against Java > 8. What I could imagine is that we need to switch to a library that uses newer Java Types in there public API (that are not part of Java8). |
yes. the question is how do you avoid
|
@cdietrich You said
JDT is important for Xbase/Xtend and LSP4J, well for LSP. Both are not related to Xtext core at least not at compile time (afaik) Maybe we should wait until we have a concrete problem and then look for a solution? |
Of course lsp4j is a core dependency so are other platform dependencies |
Really? Than we need to get rid of it |
Well then we would ditch the lsp feature completely |
After installing a Java 5 JVM in Window->Java->Installed JREs , I find that plugins that claim BREE 5 report a compile-time error when the Java 6 String.length() is used. At compile-time I am confident that, despite using Java 11 as the tooling JVM, plugins are checked for Java 5/8 compliance as required. At build time I find that Tycho uses the BREE to determine the class file version so again my Java 5/6/8 BREE plugins have Java 5/6/8 class versions even though the Tycho tooling is using Java 11. |
Again our code is gradle and maven. Not Tycho. These no nothing about BREEs |
Xtext jars are hopefully still osgi budles? If so I think it would be wrong to set gradle/maven compile source/target level to something higher than the BREE entry. So I think it also about BREE here. |
Yes they are but there is zero validation at compile time |
And if you set compile version different from Bree it would be useless as you then will get class’s version errors at runtime if you use older java to execute |
wrt LSP, i'm not fussed since I don't use that feature. I think there is confusion wrt waht standalone means becuase you probably don't use uit. The following plugins are used to support an Xtext-based standalone parser/serializer.
They need to stay at Java <=8 BREE to avoid losing standalone support for the LTS Java 8. Since I know almost nothing about LSP, I cannot be sure but I suspect it has platform dependencies and so can happily got to Java 11. |
yes but how to ensure that.
|
There is no problem using Java 11 for build. Build is not standalone. The JDT tooling warns you about non-BREE API at edit time. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=572771 When EMF classes access platform facilities you will find that they are all carefully coded to catch class load exceptions so class versions are already handled. See EMFPlugin.IS_ECLIPSE_RUNNING. Most of the standalone conditionalization comes from testing for a null singleton for e.g. the workspace/platform. There is a small corner of JDT that provides version defaults for genmodel that needed regression fixing recently when the JDT developers overlooked the need to support standalone. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=540122 |
again: gradle does not know anything about BREE |
And I know nothing about gradle which AFAIAA is not a recommended tool for production of Eclipse project releases. So long as gradle has a bug in failing to produce Java classes that comply with the manifest BREE you should consider another standard tool. |
then we are agan at: redo the whole build a a ton of work :( |
Reverting to Tycho might be good, but I really doubt that gradle is so inflexible. In so far as gradle is like Maven then it should be possible to specify a specific class binary version in the pom.xml equivalent for the two Xtext plugins that are used standalone. |
actually many other plugins are used standalone too e.g. the xbase and xtend ones which are used by xtend-maven-plugin and transitively use jdt. |
see also #1976 |
We use Xtext in an application which still uses Java8 (yes, the JavaEE world moves slowly). Xtext is used at runtime as we interpret a DSL. The BOM the Xtext project provides helps us to ensure that all the libraries are Java8 compatible, although there are horrible version ranges in the Eclipse (e.g. JDT) pom files which might break your build over night. Just to let you know how people use Xtext... |
The transitive dependencies of existing xtext versions already lead to Java 11 need, if you don't care manually:
where
|
|
see also #1804 |
see also #1996 (comment) / eclipse-tycho/tycho#313 |
Java 17 Supported moved to 2.28 |
Done via #1982 |
As Platform / JDT and other Dependencies like LSP4J move to Java 11+ only we will have to follow one day.
Questions to the community:
The text was updated successfully, but these errors were encountered: