Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtend Maven issues after upgrading to Java 9
Xtend Maven issues after upgrading to Java 9 [message #1830829] Wed, 05 August 2020 01:06 Go to next message
Mirko Raner is currently offline Mirko RanerFriend
Messages: 98
Registered: July 2009
Location: New York City, NY
Member
I recently upgraded an Xtend project from Java 8 to Java 9, i.e. in the parent POM I replaced
  <maven.compiler.source>1.8</maven.compiler.source>
  <maven.compiler.target>1.8</maven.compiler.target>

with
  <maven.compiler.release>9</maven.compiler.release>

This project previously built like a charm with Maven, but after upgrading to Java 9 I'm seeing a whole bunch of strange errors, both in the Xtend-to-Java compilation step, as well as during the translation of the generated Java code. I've tried coming up with a smaller project to demonstrate the issue, but this turned out to be non-straightforward, so I'm hoping maybe someone will recognize some of the problems I'm seeing and can point out what I'm missing.
The project is built on a CI system running Java 11 for a while; the problems were introduced when changing the target Java release from 8 to 9.
The project itself is not yet open-sourced, but there are a few self-contained source files that I can share, which hopefully shines a light on what's going here.
For example, consider the following Xtend class:
package fxxx.runtime

import fxxx.lang.Function
import java.lang.reflect.ParameterizedType
import java.util.NoSuchElementException
import java.util.stream.Stream

class Dispatcher<T>
{
  Stream.Builder<Function<?, ?, T>> cases

  new()
  {
    this(Stream.builder)
  }

  private new(Stream.Builder<Function<?, ?, T>> cases)
  {
    this.cases = cases
  }

  def Dispatcher<T> with(Function<?, ?, T> ^case)
  {
    new Dispatcher(cases.add(^case))
  }

  def T ^dispatch(Object dispatchObject)
  {
    cases.build
      .filter[parameterType.isAssignableFrom(dispatchObject.class)]
      .findFirst()
      .map[(it as Function<?, Object, T>).apply(dispatchObject)]
      .orElseThrow[new NoSuchElementException]
  }

  private def Class<?> parameterType(extension Function<?, ?, ?> function)
  {
    val ParameterizedType type = function.class.genericInterfaces.get(0) as ParameterizedType
    type.actualTypeArguments.get(1) as Class<?>
  }
}

After the Java 9 upgrade this class now fails with the following errors:
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.7.0:compile (default-compile) on project fxxx.runtime: Compilation failure: Compilation failure: 
[ERROR] /Users/mirko/git/fxxx/fxxx.runtime/xtend-gen/fxxx/runtime/Dispatcher.java:[89] 
[ERROR] 	Type _get = function.getClass().getGenericInterfaces()[0];
[ERROR] 	            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Type mismatch: cannot convert from Type to Type
[ERROR] /Users/mirko/git/fxxx/fxxx.runtime/xtend-gen/faxx/runtime/Dispatcher.java:[92] 
[ERROR] 	_xblockexpression = ((Class<?>) _get_1);
[ERROR] 	                    ^^^^^^^^^^^^^^^^^^^
[ERROR] Cannot cast from Type to Class<?>
[ERROR] 2 problems (2 errors)

The generated Java code, looks perfectly fine in Eclipse:
  ...
  import java.lang.reflect.Type;
  ...
  private Class<?> parameterType(@Extension final Function<?, ?, ?> function) {
    Class<?> _xblockexpression = null;
    {
      Type _get = function.getClass().getGenericInterfaces()[0];
      final ParameterizedType type = ((ParameterizedType) _get);
      Type _get_1 = type.getActualTypeArguments()[1];
      _xblockexpression = ((Class<?>) _get_1);
    }
    return _xblockexpression;
  }

The only way to work around this issue is to set
<maven.compiler.release>8</maven.compiler.release>

for the affected sub-project.
Other sub-projects even fail already during the Xtend translation step, somehow the upgrade to Java 9 interfered with the handling of default methods:
package fxxx.generator

import java.util.function.Function

interface State<S, A> extends Function<S, Pair<S, A>>
{
  def <B> State<S, B> map(Function<A, B> function)
  {
  	val State<S, A> that = this
    return
    [
      val Pair<S, A> value = that.apply(it)
      value.key -> function.apply(value.value)
    ]
  }

  def <B> State<S, B> flatMap(Function<A, State<S, B>> function)
  {
  	val State<S, A> that = this
    return
    [
      val Pair<S, A> value = that.apply(it)
      function.apply(value.value).apply(value.key)
    ]
  }
}

The default methods now cause an error:
[INFO] --- xtend-maven-plugin:2.22.0:compile (default) @ fxxx ---
[ERROR] 
ERROR: 	State.xtend - /Users/mirko/git/fxxx/fxxx/src/fxxx/generator/State.xtend
7: Abstract methods do not specify a body
[ERROR] 
ERROR: 	State.xtend - /Users/mirko/git/fxxx/fxxx/src/fxxx/generator/State.xtend
17: Abstract methods do not specify a body

These two different issue are pretty representative of the other problems I'm seeing. Is there anything that I'm missing for upgrading an Xtend project to Java 9?
Re: Xtend Maven issues after upgrading to Java 9 [message #1830836 is a reply to message #1830829] Wed, 05 August 2020 05:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
Why don't you set Compiler source and target to 11 ?
See https://github.com/eclipse/xtext-xtend/blob/d68caa0c1a224e63059050c11c272b6cea111782/org.eclipse.xtend.maven.plugin/src/main/java/org/eclipse/xtend/maven/AbstractXtendCompilerMojo.java#L60

Which Xtext version do you use ?


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Wed, 05 August 2020 05:47]

Report message to a moderator

Re: Xtend Maven issues after upgrading to Java 9 [message #1830986 is a reply to message #1830836] Fri, 07 August 2020 21:47 Go to previous messageGo to next message
Mirko Raner is currently offline Mirko RanerFriend
Messages: 98
Registered: July 2009
Location: New York City, NY
Member
Thanks for your prompt response, Christian! I had to put this task on the back burner for a couple of days, but I'm now back on it.
To be clear, the build system is running Java 11 but this code needs to compile and run on Java 9. Thanks to the link that you posted, I realized that whereas the Maven compiler plugin no longer needs the maven.compiler.source when maven.compiler.release is specified, the Xtend compiler plugin still is looking for maven.compiler.source. So, I adjusted the root POM to:
 <properties>
  <maven.compiler.source>9</maven.compiler.source>
  <maven.compiler.target>9</maven.compiler.target>
  <maven.compiler.release>9</maven.compiler.release>
  ...

This got me one sub-project farther, but then the next sub-project failed with similar issues. By running mvn -X I then realized that the plugin was not using javac, but the JDT compiler, and, among other things, it passed -properties .settings/org.eclipse.jdt.core.prefs to the compiler and also appeared to analyze OSGi manifests. It turned out that I had forgotten to change the Bundle-RequiredExecutionEnvironment in the manifests and that the settings files also still pointed to Java 8. So, I fixed all those issues as well, and now the next sub-project fails in a similar way:
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.7.0:compile (default-compile) on project fxxx: Compilation failure: Compilation failure: 
[ERROR] /Users/mirko/git/fxxx/fxxx/xtend-gen/fxxx/generator/TypeInferrer.java:[235] 
[ERROR] 	boolean _isEmpty = functionalInterfaceMethod.isEmpty();
[ERROR] 	                                             ^^^^^^^
[ERROR] The method isEmpty() is undefined for the type Optional<MethodDeclaration>
[ERROR] /Users/mirko/git/fxxx/fxxx/xtend-gen/fxxx/conversions/FxxxValueConverters.java:[31] 
[ERROR] 	return string.replace("@", "");
[ERROR] 	              ^^^^^^^
[ERROR] The method replace(char, char) in the type String is not applicable for the arguments (String, String)

I don't know exactly how Xtend and Tycho relate, but I wanted to point out that these errors are coming from the tycho-compiler-plugin, not from the Maven compiler plugin or from the Xtend Maven plugin.
The first error tells me that the compiler is not compiling against a Java 9 release profile: Optional.isEmpty() was introduced in Java 9 and should be readily available. The second error is even stranger: the String.replace(CharSequence, CharSequence) method was introduced in Java 5, so this suggests that the compiler is using a JDK 1.4 (or earlier?) profile.
The command line that Maven passes to the JDT compiler is a million miles long, but I do see
..., -target, 9, -source, 9, --release, 9, -encoding, UTF-8]

at the very end, which leads me to believe that all the options get passed along properly.
Other errors that I'm seeing are still along the line of the strange type mismatches I had seen earlier, e.g.:
[ERROR] /Users/mirko/git/fxxx/fxxx/xtend-gen/fxxx/generator/Translator.java:[1305] 
[ERROR] 	final Method valueMethod = customizer.getClass().getDeclaredMethod(this._hardCodedNames.valueMethod());
[ERROR] 	                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Type mismatch: cannot convert from Method to Method
[ERROR] /Users/mirko/git/fxxx/fxxx/src-gen/fxxx/parser/antlr/FxxxAntlrTokenFileProvider.java:[13] 
[ERROR] 	ClassLoader classLoader = getClass().getClassLoader();
[ERROR] 	                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Type mismatch: cannot convert from ClassLoader to ClassLoader

Another strange error seems to suggest that the compiler is aware of the Collectors class (introduced in Java 8), but does not seem to understand that String implements CharSequence:
[ERROR] /Users/mirko/git/fxxx/fxxx/xtend-gen/fxxx/utilities/TypePrinter.java:[73] 
[ERROR] 	_xifexpression = types.stream().<String>map(_function).collect(Collectors.joining(", ", "<", ">"));
[ERROR] 	                                                                          ^^^^^^^
[ERROR] The method joining(CharSequence, CharSequence, CharSequence) in the type Collectors is not applicable for the arguments (String, String, String)

What other things can I check to track down these strange problems?
Re: Xtend Maven issues after upgrading to Java 9 [message #1830989 is a reply to message #1830986] Sat, 08 August 2020 04:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
Can you please provide a reproducer

P.s. as Java 9 and 10 are dead: why considering them


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sat, 08 August 2020 04:57]

Report message to a moderator

Re: Xtend Maven issues after upgrading to Java 9 [message #1830990 is a reply to message #1830989] Sat, 08 August 2020 07:15 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31546
Registered: July 2009
Senior Member
This sounds a like like recent threads in the tycho-user mailing list, e.g., this one:

https://www.eclipse.org/lists/tycho-user/msg08590.html


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Xtend Maven issues after upgrading to Java 9 [message #1830997 is a reply to message #1830990] Sat, 08 August 2020 14:08 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1770
Registered: July 2009
Location: Firenze, Italy
Senior Member
I think I hit the same problem when compiling with JDK 14, https://www.eclipse.org/forums/index.php/t/1104581/
The link suggested by Ed did not help in my case...


Re: Xtend Maven issues after upgrading to Java 9 [message #1831001 is a reply to message #1830997] Sat, 08 August 2020 16:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
@lorenzo? did you try the 2.23 snapshot (or M2) as suggested?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtend Maven issues after upgrading to Java 9 [message #1831002 is a reply to message #1831001] Sat, 08 August 2020 17:06 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1770
Registered: July 2009
Location: Firenze, Italy
Senior Member
Sorry, not yet.
But have you tried to use jdk 14 yourself?
By the way, IIRC, jdk 14 seems to work fine with the domain model example, so it might be some specific configuration of my project


Re: Xtend Maven issues after upgrading to Java 9 [message #1831004 is a reply to message #1831002] Sat, 08 August 2020 17:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
i had no problems with java 14 so far

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtend Maven issues after upgrading to Java 9 [message #1831008 is a reply to message #1831004] Sat, 08 August 2020 22:30 Go to previous messageGo to next message
Mirko Raner is currently offline Mirko RanerFriend
Messages: 98
Registered: July 2009
Location: New York City, NY
Member
@lorenzo, adding the <executionEnvironment> configuration did not make any difference in my case either, but my issues look very similar to yours (method signature mix-ups, class hierarchy confusion, etc.). Did you find a solution that fixed the problems you were seeing?
Re: Xtend Maven issues after upgrading to Java 9 [message #1831012 is a reply to message #1831008] Sun, 09 August 2020 02:51 Go to previous messageGo to next message
Mirko Raner is currently offline Mirko RanerFriend
Messages: 98
Registered: July 2009
Location: New York City, NY
Member
@christian, I finally managed to put up a reproducer on GitHub. I was unable to reproduce the String.replace problems, and the other problems related to CharSequence vs String. However, I was able to reproduce the "cannot convert from ClassLoader to ClassLoader" problem, as well as another strange problem that I'm not actually seeing in my original project:
mirko@Mirkos-MacBook-Pro Downloads % git clone https://github.com/raner/bugs.git 
Cloning into 'bugs'...
remote: Enumerating objects: 31, done.
remote: Counting objects: 100% (31/31), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 31 (delta 5), reused 26 (delta 0), pack-reused 0
Unpacking objects: 100% (31/31), done.
mirko@Mirkos-MacBook-Pro Downloads % cd bugs
mirko@Mirkos-MacBook-Pro bugs % mvn clean install
[INFO] Scanning for projects...
[INFO] Computing target platform for MavenProject: top.java:bugs:1.0.0-SNAPSHOT @ /Users/mirko/Downloads/bugs/bugs/pom.xml
[INFO] Fetching p2.index from https://download.eclipse.org/releases/2020-06/
[INFO] Adding repository https://download.eclipse.org/releases/2020-06
[INFO] Fetching p2.index from https://download.eclipse.org/technology/epp/packages/2020-06/
[INFO] Fetching p2.index from https://download.eclipse.org/releases/2020-06/202006171000/
Aug 08, 2020 7:26:36 PM org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (org.apache.http.NoHttpResponseException) caught when processing request to {s}->https://download.eclipse.org:443: The target server failed to respond
Aug 08, 2020 7:26:36 PM org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to {s}->https://download.eclipse.org:443
[INFO] Fetching p2.index from https://download.eclipse.org/modeling/tmf/xtext/updates/releases/2.22.0/
[INFO] Adding repository https://download.eclipse.org/modeling/tmf/xtext/updates/releases/2.22.0
[INFO] Resolving dependencies of MavenProject: top.java:bugs:1.0.0-SNAPSHOT @ /Users/mirko/Downloads/bugs/bugs/pom.xml
[INFO] Resolving class path of MavenProject: top.java:bugs:1.0.0-SNAPSHOT @ /Users/mirko/Downloads/bugs/bugs/pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] bugs-parent                                                        [pom]
[INFO] bugs                                                    [eclipse-plugin]
[INFO] 
[INFO] ------------------------< top.java:bugs-parent >------------------------
[INFO] Building bugs-parent 1.0.0-SNAPSHOT                                [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ bugs-parent ---
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ bugs-parent ---
[INFO] Installing /Users/mirko/Downloads/bugs/pom.xml to /Users/mirko/.m2/repository/top/java/bugs-parent/1.0.0-SNAPSHOT/bugs-parent-1.0.0-SNAPSHOT.pom
[INFO] 
[INFO] ---------------------------< top.java:bugs >----------------------------
[INFO] Building bugs 1.0.0-SNAPSHOT                                       [2/2]
[INFO] ---------------------------[ eclipse-plugin ]---------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ bugs ---
[INFO] 
[INFO] --- tycho-packaging-plugin:1.7.0:build-qualifier (default-build-qualifier) @ bugs ---
[INFO] The project's OSGi version is 1.0.0.202008090226
[INFO] 
[INFO] --- tycho-packaging-plugin:1.7.0:validate-id (default-validate-id) @ bugs ---
[INFO] 
[INFO] --- tycho-packaging-plugin:1.7.0:validate-version (default-validate-version) @ bugs ---
[INFO] 
[INFO] --- xtend-maven-plugin:2.22.0:compile (default) @ bugs ---
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$2 (file:/Users/mirko/.m2/repository/com/google/inject/guice/3.0/guice-3.0.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$2
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ bugs ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/mirko/Downloads/bugs/bugs/src/main/resources
[INFO] 
[INFO] --- tycho-compiler-plugin:1.7.0:compile (default-compile) @ bugs ---
[INFO] Compiling 1 source file to /Users/mirko/Downloads/bugs/bugs/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for bugs-parent 1.0.0-SNAPSHOT:
[INFO] 
[INFO] bugs-parent ........................................ SUCCESS [  0.097 s]
[INFO] bugs ............................................... FAILURE [  3.541 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  11.010 s
[INFO] Finished at: 2020-08-08T19:26:41-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.tycho:tycho-compiler-plugin:1.7.0:compile (default-compile) on project bugs: Compilation failure: Compilation failure: 
[ERROR] /Users/mirko/Downloads/bugs/bugs/xtend-gen/top/java/BrokenCode.java:[8] 
[ERROR] 	return type.getClassLoader();
[ERROR] 	       ^^^^
[ERROR] The type Class<capture#1-of ?> is not visible
[ERROR] /Users/mirko/Downloads/bugs/bugs/xtend-gen/top/java/BrokenCode.java:[14] 
[ERROR] 	final ClassLoader classLoader = this.getClass().getClassLoader();
[ERROR] 	                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[ERROR] Type mismatch: cannot convert from ClassLoader to ClassLoader
[ERROR] 2 problems (2 errors)
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <args> -rf :bugs
mirko@Mirkos-MacBook-Pro bugs % java -version
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02)
OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing)
mirko@Mirkos-MacBook-Pro bugs % mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /usr/local/Cellar/maven/3.6.3_1/libexec
Java version: 14.0.1, vendor: N/A, runtime: /usr/local/Cellar/openjdk/14.0.1/libexec/openjdk.jdk/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.5", arch: "x86_64", family: "mac"
mirko@Mirkos-MacBook-Pro bugs % 

Unbeknownst to me, my local Maven apparently brought its own installation of Java 14 along, but I don't think that's related to my problems.
Re: Xtend Maven issues after upgrading to Java 9 [message #1831015 is a reply to message #1831012] Sun, 09 August 2020 09:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
Problem also happens with no xtend involved at all.
(delete xtend file. replace it with generated java)

and also happens when calling the ECJ main (used by tycho) directly with java 14

package a;

public class Main {

public static void main(String[] args) {
org.eclipse.jdt.internal.compiler.batch.Main.main(new String[] { "-properties",
"/Users/cdietrich/eclipse-workspaces/jvmModelInferrer/bugs/bugs/.settings/org.eclipse.jdt.core.prefs",
"-s",
"/Users/cdietrich/eclipse-workspaces/jvmModelInferrer/bugs/bugs/target/generated-sources/annotations",
"-d", "/Users/cdietrich/eclipse-workspaces/jvmModelInferrer/bugs/bugs/target/classes", "-classpath",
"/Users/cdietrich/eclipse-workspaces/jvmModelInferrer/bugs/bugs/target/classes",
"/Users/cdietrich/eclipse-workspaces/jvmModelInferrer/bugs/bugs/src/top/java/BrokenCode.java", "-g",
"-nowarn", "-target", "11", "-source", "11", "--release", "11", "-encoding", "UTF-8" });
}

}

(also when called with Java 13)

when i leave out the

-release

it works fine.

thus i think we have a JDT bug here.

specifying <maven.compiler.release>11</maven.compiler.release>
only also does not work.

(here we also would have do adapt the xtend-maven-plugin to deal with this)

=> i assume the first thing would be to file a JDT bug



Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtend Maven issues after upgrading to Java 9 [message #1831016 is a reply to message #1831015] Sun, 09 August 2020 14:57 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1770
Registered: July 2009
Location: Firenze, Italy
Senior Member
I confirm, it's really the "release" argument that breaks everything: if I remove it everything works in my example. I also tried to specify only the "release", without "target" and "source", but it doesn't work anyway.

However, in my case, the problem takes place only in a specific Maven/Tycho module: the other ones compile fine. The first module that does not compile is the one that uses Xtend.

Probably it might be the case to file an issue for JDT, but first the above project should also be tested without Xtend in the dependencies?


Re: Xtend Maven issues after upgrading to Java 9 [message #1831018 is a reply to message #1831016] Sun, 09 August 2020 15:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13637
Registered: July 2009
Senior Member
do you have the problems with xtend also when you specify source and target only?
as stated before: xtend maven does not read release and so if you DO NOT specify source and target will fall back for Java 1.6
also as stated before: did you test with the latest xtend snapshot (or milestone) as this is the only one that uses the latest jdt internally
see https://github.com/eclipse/xtext/issues/1802


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtend Maven issues after upgrading to Java 9 [message #1831023 is a reply to message #1831018] Mon, 10 August 2020 05:12 Go to previous messageGo to next message
Mirko Raner is currently offline Mirko RanerFriend
Messages: 98
Registered: July 2009
Location: New York City, NY
Member
Thanks, @christian and @lorenzo for the input on this! I also can confirm that it's apparently the --release option that causes the trouble. For my particular project, I was able to work around the issue by explicitly specifying an empty maven.compiler.release property while still keeping the .source and .target properties for Java 9:
  <maven.compiler.source>9</maven.compiler.source>
  <maven.compiler.target>9</maven.compiler.target>
  <maven.compiler.release/>

I'm also no longer seeing issues during the Xtend-to-Java translation step, so I agree with Christian that this problem is actually unrelated to Xtend and most likely a JDT bug. I'll adjust my reproducer project to remove Xtend from the picture. So, in my mind, testing against a newer snapshot of Xtend won't make sense, but I'm wondering if there is an updated snapshot of the Tycho compiler plugin available.

@christian, regarding your earlier question as to why use Java 9 and not a newer version, that decision is pretty much driven by a desire to find the lowest common denominator. Many companies are moving slowly and often lag several Java versions behind. The project at hand requires some JVM features that are only available from Java 9 onward, so Java 9 was identified as the minimum requirement, though the code should also run on Java 11 or 14 without problems.
Re: Xtend Maven issues after upgrading to Java 9 [message #1831024 is a reply to message #1831023] Mon, 10 August 2020 06:31 Go to previous message
Mirko Raner is currently offline Mirko RanerFriend
Messages: 98
Registered: July 2009
Location: New York City, NY
Member
FYI, I filed https://bugs.eclipse.org/565930 against JDT Core; please add further comments there. Thanks again for the help in tracking this down!
Previous Topic:Standalone XBase DSl with Compile Time Java Source (.java) and Jar (.class file) Dependencies
Next Topic:Filter the terminals list proposed in content assistant
Goto Forum:
  


Current Time: Sat Oct 24 21:32:50 GMT 2020

Powered by FUDForum. Page generated in 0.02668 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top