Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Compiling for different Java versions with Maven

Hi Mickael,

When I started this task, I understood incorrectly that our plug-ins needed to be compiled by JDK 11 for JavaSE-11 target in order to run on the 2020-09 Eclipse platform.

I had updated the source code for that, e.g. replacing the use of methods deprecated in JavaSE-11.

Now I realize that it is not necessary, we can still release classes compiled for JavaSE-1.8 and they will run fine on Eclipse 2020-09.

So was there anything required at all then for projects to be ready for JavaSE-11 in 2020-09? Were the source code changes I did even required?

Then the remaining questions are 'for science', and/or for a future time when JavaSE-11 or later will become the required BREE:

1) Why do external null annotations not work for JavaSE-1.8 if and only if tycho-compiler-plugin <release> is set to 8?

2) What is wrong with our configuration regarding the packages accessible from <unnamed> and java.xml modules for JavaSE-11, and how to fix it?

Thank you,
Patrick


On Wed, Aug 5, 2020 at 11:59 AM Mickael Istria <mistria@xxxxxxxxxx> wrote:


On Wed, Aug 5, 2020 at 5:20 PM Patrick Tasse <patrick.tasse@xxxxxxxxx> wrote:
Hi Mickael,

This is all new and confusing to me so I'm learning as I go along. I'll describe what I observe, not knowing what is relevant...

What do you mean by "the build was compiled for JavaSE-11 ? Aren't the class files not using the Java 1.8 class version?

This was on the Jenkins build running a Docker image. I do not know how to tell if the class files are compiled for 1.8 or 11 from the tycho-compiler-plugin on the remote machine.

You'll need to find a way to get access to some jar or .class file and use javap locally.

I had based myself on the fact that the log showed the test running with java.version=11.0.2 and the exception stack traces show "at java.base/java.lang.*" instead of "at java.lang.*". But I guess the test can run with JavaSE-11 even if classes are compiled for JavaSE-1.8, right?
I tried it locally from the command-line mvn and using 'javap -verbose' I can see that the class files are indeed version 52 (JavaSE-1.8).

OK, so i think it's fine: the version of Java that's used at execution or during dependency resolution doesn't really matter at compilation: the tycho-compiler-plugin, which is more or less a proxy to JDT's ECJ compiler, will set the target level according to the BREE, and that doesn't depend on the running java version nor on the actual one that's used for dependency resolution.

However, a better and more portable approach (with PDE) is to override the source/target levels in build.properties.

I'm not sure what that means. Is it each plug-in's build.properties file (we have 125 plug-ins)? What property would we need to set and how would we dynamically set it from the Jenkins/mvn parameters?

It's OK, just ignore that comment at the moment, as the current approach works: BREE controls the java target version -unless it's overridden somewhere else., and that's probably all that matters to you so you don't need extra customization. You should just remove your configuration of tycho-compiler-plugin regarding source/target/release levels, default behavior is likely to give better results with less worries.

HTH
--
Mickael Istria
Eclipse IDE developer, for Red Hat Developers
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/tycho-user

Back to the top