Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cross-project-issues-dev] How to identify Java 11 usages for bundles with JavaSE-1.8 BREE?

In Workspace preferences > Installed JREs add a Java 8 JRE.
In Workspace preferences > Installed JREs > Execution Environments make sure that your wanted Java 8 JRE is mapped to Java 8 execution environment.
 
Then in the project properties of each Java 8 project, use
Java Compiler > Enable project specific settings => true
Java Compiler > Use compliance from execution environment 'Java-SE 8' on the Java Build Path => Checked
 
Commit the resulting ./settings/*.prefs (eventually you want to remove all other lines than the 3 referring to the compiler level). Side note: Don't ever use the global workspace preferences to set the wanted Java level. That way your bundles will compile differently when someone else checks out your project in his/her local workspace. You may even want to configure your workspace preferences to be Java 1.3, so you immediately get warnings/errors for any bundle that doesn't have the "project specific settings" checkbox checked.
 
This way you can have an arbitrary mix of Java 5 to 15 bundles in the same workspace and each of them compiles only with the selected level, and the editor only suggests the available methods and types. Finally, you can remove all unused (i.e. probably all different than 8 and 11) JREs from Preferences > Installed JREs to reduce the number of duplicate types in the "Open type" dialog (where you have one occurrence per bound execution environment).
 
To my knowledge, PDE doesn't need to be configured in any way to cope with the different Java levels, if the above settings have been done for JDT.
 
Ciao, Michael
 
PS: In the case of _all_ bundles of a project requiring Java 8, you could also configure your project Oomph setup to set Java 8 in the workspace preferences. However, you would then rely on every contributor actually using Oomph, and my experience shows that's not the case (even though that simple solution would be completely sufficient then, without modifying the project settings).
 
Gesendet: Sonntag, 23. August 2020 um 10:48 Uhr
Von: "Alexander Fedorov" <alexander.fedorov@xxxxxxxxxx>
An: cross-project-issues-dev@xxxxxxxxxxx
Betreff: [cross-project-issues-dev] How to identify Java 11 usages for bundles with JavaSE-1.8 BREE?
Hello,

Currently Eclipse Platform requires Java 11 while a lot of downstream
bundles would prefer to stay on Java 8 for a while.
This leads to a situation when workspace has Java 11 classpath and Java
11 methods are visible for Java 8 bundles.

What is the right way to configure JDT and PDE to not accept Java 11
usages for Java 8 projects?

Thanks,
AF
_______________________________________________
cross-project-issues-dev mailing list
cross-project-issues-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/cross-project-issues-dev

Back to the top