Bug 522750 - Java Version 1.9 of project facet java does not exist
Summary: Java Version 1.9 of project facet java does not exist
Status: RESOLVED FIXED
Alias: None
Product: WTP Common Tools
Classification: WebTools
Component: Faceted Project Framework (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Carl Anderson CLA
QA Contact: Konstantin Komissarchik CLA
URL:
Whiteboard:
Keywords:
: 525673 (view as bug list)
Depends on: 426884
Blocks: 430637 532353
  Show dependency tree
 
Reported: 2017-09-25 11:11 EDT by Carl Anderson CLA
Modified: 2018-03-20 11:18 EDT (History)
23 users (show)

See Also:
ccc: review+


Attachments
Add in Java 9 support (7.38 KB, patch)
2017-09-25 11:13 EDT, Carl Anderson CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carl Anderson CLA 2017-09-25 11:11:15 EDT
+++ This bug was initially created as a clone of Bug #426884 +++

The same changes that were necessary for Java 1.8 support are necessary for Java 1.9 support.
Comment 1 Carl Anderson CLA 2017-09-25 11:13:29 EDT
Created attachment 270345 [details]
Add in Java 9 support
Comment 2 Carl Anderson CLA 2017-09-25 11:15:43 EDT
Rob, any bug in a maintenance stream should have project lead review.  

This change will go into WTP 3.9.1a and WTP 3.10.
Comment 3 Fred Bricon CLA 2017-09-25 11:16:55 EDT
Why 3.9.1a? why not 3.9.2?
Comment 4 Dani Megert CLA 2017-09-25 11:40:14 EDT
(In reply to Fred Bricon from comment #3)
> Why 3.9.1a? why not 3.9.2?

Because 3.9.1a is the release that should provide good support for Java 9.
Comment 5 Fred Bricon CLA 2017-09-25 11:48:33 EDT
(In reply to Dani Megert from comment #4)
> Because 3.9.1a is the release that should provide good support for Java 9.

Yes I get that, I'm questioning the versioning scheme. You can still release 3.9.3 for Oxygen.2, 3.9.4 for Oxygen.3, and so forth.
Comment 6 Carl Anderson CLA 2017-09-25 12:40:18 EDT
Fred, a bug is not the best place to discuss the WTP versioning (a vote was called for on the PMC mailing list).  Simply put, the Eclipse Planning Council decided to call the quick update to Oxygen.1 that provides Java 9 and JUnit 5 support Oxygen.1a.  The Eclipse Platform is calling their release 4.7.1a.  As such, it makes sense for WTP to follow suit and call its minimal release with Java 9 support WTP 3.9.1a.
Comment 7 Nick Boldt CLA 2017-09-27 14:22:42 EDT
Patch looks good from my perspective, but I have one question.

Do we want JDK 9 to be the default fallback version on line 96?

https://bugs.eclipse.org/bugs/attachment.cgi?id=270345&action=diff#src/org/eclipse/jst/common/project/facet/core/StandardJreRuntimeComponent.java_sec4

-             rcv = StandardJreRuntimeComponent.VERSION_1_8;
+             rcv = StandardJreRuntimeComponent.VERSION_1_9;
Comment 8 Carl Anderson CLA 2017-09-27 14:41:05 EDT
(In reply to Nick Boldt from comment #7)
> Patch looks good from my perspective, but I have one question.
> 
> Do we want JDK 9 to be the default fallback version on line 96?
> 
> https://bugs.eclipse.org/bugs/attachment.cgi?id=270345&action=diff#src/org/
> eclipse/jst/common/project/facet/core/StandardJreRuntimeComponent.java_sec4
> 
> -             rcv = StandardJreRuntimeComponent.VERSION_1_8;
> +             rcv = StandardJreRuntimeComponent.VERSION_1_9;

Nick,

It has always been the case that, when the exact JRE level cannot be determined, the latest version is the default.  I am just continuing that practice.
Comment 9 Nitin Dahyabhai CLA 2017-09-27 16:49:58 EDT
Where *does* it try to determine the right level?
Comment 10 Rob Stryker CLA 2017-09-27 19:19:52 EDT
Few things:

1) The patch looks clean and good. I don't see anything too objectionable there. 

2) While I recognize that upping the default to the next java version is past practice, it does seem that java 9 is likely to cause a lot of issues to a lot of application servers, eclipse, osgi containers, and a good number of other frameworks. If someone insisted we don't bump the default, or could provide a good reason not to, I wouldn't object. But, in the absence of such a request, I also won't insist we keep the default j8 either. 

3) Is this seriously all that's necessary to add j9 support? Does the j9 facet only do things like configure the classpath container? While I of course trust you, it'd be nice to get a written confirmation on this. 


Assuming nobody makes a formal request re: 2), and Carl confirms 3) is all that's required, then I +1 this. 

Final note: I'm a bit dismayed to see that the patch is provided as an attachment instead of a gerrit request ;) Didn't we recently set up gerrit for wtp-common? =P
Comment 11 Carl Anderson CLA 2017-09-28 10:48:30 EDT
(In reply to Rob Stryker from comment #10)
> Few things:
> 
> 1) The patch looks clean and good. I don't see anything too objectionable
> there. 
> 
> 2) While I recognize that upping the default to the next java version is
> past practice, it does seem that java 9 is likely to cause a lot of issues
> to a lot of application servers, eclipse, osgi containers, and a good number
> of other frameworks. If someone insisted we don't bump the default, or could
> provide a good reason not to, I wouldn't object. But, in the absence of such
> a request, I also won't insist we keep the default j8 either. 
> 
> 3) Is this seriously all that's necessary to add j9 support? Does the j9
> facet only do things like configure the classpath container? While I of
> course trust you, it'd be nice to get a written confirmation on this. 
> 
> 
> Assuming nobody makes a formal request re: 2), and Carl confirms 3) is all
> that's required, then I +1 this. 
> 
> Final note: I'm a bit dismayed to see that the patch is provided as an
> attachment instead of a gerrit request ;) Didn't we recently set up gerrit
> for wtp-common? =P

1) Good, I will mark it as reviewed

2) To answer Nitin's question and explain here, the code right above the default attempts to match the JVM version string with the appropriate level.  Note that setting the latest version as a default is a good practice, since Java is supposed to be backwards-compatible, so we are better off setting the highest Java version as an assumption, instead of a lower, more stable one that may cause compilation errors due to use of API in a higher java version.  (Java EE does the same with its defaults.)

3) This adds in the Java 9 facet.  Yes, there isn't much code to add in a new Java facet.

As to this being a patch instead of a gerrit request, well, old dog, new tricks.
Comment 12 Carl Anderson CLA 2017-09-28 14:40:38 EDT
Committed to master for WTP 3.9.1a and WTP 3.10.0 M3
Comment 13 Eclipse Genie CLA 2017-09-29 11:38:54 EDT
New Gerrit change created: https://git.eclipse.org/r/106021
Comment 15 Michael Suhr CLA 2017-09-30 04:43:03 EDT
Sorry, I have maybe a stupid question but: Why is the facet number 1.9

Would it not be nicely to use the nes Java version scheme: facet 9

So you have a similar value like for the javac source/target properties 

see: https://docs.oracle.com/javase/9/tools/javac.htm
1.8    The compiler accepts code with features introduced in Java SE 8.
8    Synonym for 1.8.
9    The default value. The compiler accepts code with features introduced in Java SE 9.
Comment 16 Fred Bricon CLA 2017-09-30 10:34:11 EDT
Agreed with Michael, this should be Java Facet 9. If we start introducing 1.9 now, we'll never be able to fix it later.
Comment 17 Fred Bricon CLA 2017-09-30 11:05:09 EDT
The patch is wrong anyway. Creating a Java 1.9 web project results in:
- Java compiler level does not match the version of the installed Java project facet.
- Unbound classpath container: 'JRE System Library [JavaSE-1.9]' in project 'xdfg'

I'll submit a gerrit changeset which fixes it once I finish my tests
Comment 18 Eclipse Genie CLA 2017-09-30 11:28:45 EDT
New Gerrit change created: https://git.eclipse.org/r/106050
Comment 19 Fred Bricon CLA 2017-09-30 11:32:59 EDT
https://git.eclipse.org/r/#/c/106050/ changes Facet from 1.9 to 9

Creating a web project targeting Facet 9 now works without errors.
m2e-wtp can convert a simple jar project compiled with Java-SE9 into an EJB or WAR project, the proper facet being applied automatically. No changes required in m2e-wtp.

I thought about going 9.0 to stay consistent with other facets, but there's no such thing as Java 9.0, nor will there be 9.x.
Comment 20 Michael Suhr CLA 2017-09-30 11:41:01 EDT
thanks fred I have a look at it
Comment 21 Eclipse Genie CLA 2017-09-30 23:09:00 EDT
New Gerrit change created: https://git.eclipse.org/r/106058
Comment 23 Eclipse Genie CLA 2017-10-02 12:33:25 EDT
New Gerrit change created: https://git.eclipse.org/r/106109
Comment 25 Carl Anderson CLA 2017-10-03 11:10:01 EDT
(In reply to Eclipse Genie from comment #21)
> New Gerrit change created: https://git.eclipse.org/r/106058

Fred, you asked why I had to leave the one 1_9 variable in there- Web Services had already committed code that referenced that variable, and the build would have been broken until they changed their reference- that's why I marked it as @Deprecated and added a comment that that would be removed before we shipped 3.9.1a.

All of the changes that I made have been committed, and this issue seems to be resolved.
Comment 26 Fred Bricon CLA 2017-10-03 11:17:58 EDT
Thanks for the explanation Carl
Comment 27 Nitin Dahyabhai CLA 2017-10-06 11:54:06 EDT
Can we set the target milestone for this? We're starting to get duplicate reports opened.
Comment 28 Nitin Dahyabhai CLA 2017-10-06 11:54:16 EDT
*** Bug 525673 has been marked as a duplicate of this bug. ***