Bug 839997

Summary: Classes are built for target 1.4
Product: [Fedora] Fedora Reporter: Mikolaj Izdebski <mizdebsk>
Component: eclipseAssignee: Krzysztof Daniel <kdaniel>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 17CC: akurtako, andjrobins, jerboaa, kdaniel, mbenitez, overholt, rgrunber, swagiaal
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-07-13 12:23:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 769260    

Description Mikolaj Izdebski 2012-07-13 12:06:10 UTC
Description of problem:
Eclipse has code incompatible with Java 1.4 (for example generics, which were added in 1.5), but produces classes in 1.4 format.

Format 1.4 doesn't have official support for generics, but some compilers (OpenJDK <= 6, ECJ) support generics in format 1.4. Eclipse upstream is abusing this fact and generating format 1.4 classes for "better backwards compatibility".

Since OpenJDK 7, support for generics in class format 1.4 was dropped. See:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7078419
Oracle closed this bug as "Not a Defect", so it will never be fixed.

As a result programs that use Eclipse libraries that have generics cannot be compiled using OpenJDK compiler (ECJ works fine in this case as it still supports generics in 1.4).

This is an important problem because it causes other Fedora packages fail to build from source. Instead of fixing "n" other packages to build with ECJ it is better to fix Eclipse to generate classes in format >= 1.5.

Version-Release number of selected component (if applicable):
eclipse-rcp-4.2.0-0.22.I201205031800.fc17.x86_64

Steps to Reproduce:
I have prepared a reproducer:

$ cat Hello.java
abstract class Hello implements org.osgi.framework.ServiceReference<Hello> {}

$ javac -classpath `build-classpath ../../../usr/lib64/eclipse/plugins` Hello.java
Hello.java:1: error: type ServiceReference does not take parameters
abstract class Hello implements org.osgi.framework.ServiceReference<Hello> {}
                                                                   ^
1 error

$ echo $?
1

$ ecj -classpath `build-classpath ../../../usr/lib64/eclipse/plugins` Hello.java

$ echo $?
0

Actual results:
OpenJDK fails to compile the program.

Expected results:
OpenJDK compiler is able to compile the program successfully.

Comment 1 Krzysztof Daniel 2012-07-13 12:13:47 UTC
Hi Mikolaj,
This issue should be fixed in a Juno release 4.2.0-3. It is in the update-testing now.

Comment 2 Krzysztof Daniel 2012-07-13 12:23:32 UTC
The fix is in updates-testing.