Bug 56283 - Add support for Java 8 to Jasper
Add support for Java 8 to Jasper
Status: RESOLVED FIXED
Product: Tomcat 8
Classification: Unclassified
Component: Jasper
8.0.3
PC All
: P2 enhancement (vote)
: ----
Assigned To: Tomcat Developers Mailing List
:
: 56613 (view as bug list)
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2014-03-19 12:30 UTC by Konstantin Kolinko
Modified: 2014-06-12 09:33 UTC (History)
1 user (show)



Attachments
2014-04-04_56283_tc6_v2.patch (2.66 KB, patch)
2014-04-04 19:51 UTC, Konstantin Kolinko
Details | Diff
Failing JSP (doesn't compile with a Java 8 JDK and source/target version 1.6) (10.00 KB, application/x-tar)
2014-05-15 08:55 UTC, Robbie Gibson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Konstantin Kolinko 2014-03-19 12:30:55 UTC
(Filing an already fixed issue, for better tracking).

Add support for Java 8 for JSP compilation in Tomcat. Allow to use "1.8" as the value for compilerSourceVM, compilerTargetVM options of JspServlet.

Implementing this feature means that Eclipse JDT compiler bundled with Tomcat have to be updated to a later version (beyond the 4.3.1 that we are using today).

From [1]:
[quote]
Eclipse support for Java™ 8: Starting with I20140318-0830 all our Luna (4.4) builds contain the Eclipse support for Java™ 8. For Kepler SR2 (4.3.2) a feature patch is available (P20140317-1600).
[/quote]

As of now, the latest builds of Eclipse are [1]:
1) 4.3.2  - 21 Feb 2014
2) 4.4M6  - 6 March 2014
3) I20140318-0830 - 18 Mar 2014  ("I": an integration build)
4) N20140318-2000 - 18 Mar 2014  ("N": a nightly build)
5) P20140317-1600 - 17 Mar 2014  (Patch build for 4.3.2) -> [2]

[2] "Eclipse 4.3.2 Patch Build: P20140317-1600"
Explains what this patch build is, and provides download links.

[3] JDT/Eclipse Java 8 Support For Kepler
(A wiki page).

I think it s bit unfortunate that the build number is "P20140317-1600", without any explicit mention of "4.3" branch in the number, but that is how they did it.


[1] http://download.eclipse.org/eclipse/downloads/
[2] http://download.eclipse.org/eclipse/downloads/drops4/P20140317-1600/
[3] https://wiki.eclipse.org/JDT/Eclipse_Java_8_Support_For_Kepler
Comment 1 Konstantin Kolinko 2014-03-19 12:35:01 UTC
This was implemented in Tomcat 8 by r1579174 and Tomcat 7 by r1579176 and will be in 8.0.4, 7.0.53. Proposed for Tomcat 6.
Comment 2 Konstantin Kolinko 2014-04-04 18:29:03 UTC
Note 1.

Technically CompilerOptions.VERSION_1_8 is a String constant "1.8", so it will be inlined at compile time.

At runtime Tomcat/Jasper will be compatible with any other version of ECJ 4.3.x, e.g. 4.3.1.

Note 2.

All 547 classes in ecj-P20140317-1600.jar have format version 50.0 (Java 1.6).
As such, this jar cannot be used to build Tomcat 6.

For historical record, I applied the change to Tomcat 6 in r1584800 but had to revert it right away in r1584806.
Comment 3 Konstantin Kolinko 2014-04-04 19:51:25 UTC
Created attachment 31476 [details]
2014-04-04_56283_tc6_v2.patch

Patch for Tomcat 6:
Add support for running Tomcat 6 with ecj-P20140317-1600.jar (as drop-in replacement for ecj-4.3.1.jar). Add support for value "1.8" for the compilerSourceVM and compilerTargetVM options.

Note that, per previous comments, ecj-P20140317-1600.jar can only be used when running with Java 6 or later. The "1.8" options make sense only when running with Java 8 (or later).
Comment 4 Mark Thomas 2014-04-09 15:50:41 UTC
Patch applied to 6.0.x for 6.0.40 onwards.
Comment 5 Robbie Gibson 2014-05-15 08:55:35 UTC
Created attachment 31624 [details]
Failing JSP (doesn't compile with a Java 8 JDK and source/target version 1.6)

The version of ECJ supplied with 7.0.53 fails to compile JSP files that reference class files containing default methods under the following conditions:
- compilerSourceVersion/compilerTargetVersion < 1.8
- JRE_HOME >= jdk1.8.0
Attachment has a minimal test case

It looks like it might be Eclipse bug 390889 which is fixed in 4.4M7
https://bugs.eclipse.org/bugs/show_bug.cgi?id=390889
Comment 6 Robbie Gibson 2014-05-19 10:00:55 UTC
Verified fixed when replacing ecj-P20140317-1600.jar with ecj-4.4M7.jar from http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/S-4.4M7-201405010200/ecj-4.4M7.jar
Comment 7 Mark Thomas 2014-05-19 10:02:46 UTC
(In reply to Robbie Gibson from comment #6)
> Verified fixed when replacing ecj-P20140317-1600.jar with ecj-4.4M7.jar from
> http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/
> S-4.4M7-201405010200/ecj-4.4M7.jar

This is a separate issue and should be in a separate bugzilla entry.
Comment 8 Robbie Gibson 2014-05-19 10:26:46 UTC
Done, sorry for the confusion.
Comment 9 Violeta Georgieva 2014-05-19 10:29:30 UTC
for reference bug 56543
Comment 10 Konstantin Kolinko 2014-06-12 09:33:19 UTC
*** Bug 56613 has been marked as a duplicate of this bug. ***