Bug 839997 - Classes are built for target 1.4
Summary: Classes are built for target 1.4
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: eclipse
Version: 17
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Krzysztof Daniel
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 769260
TreeView+ depends on / blocked
 
Reported: 2012-07-13 12:06 UTC by Mikolaj Izdebski
Modified: 2014-01-13 00:27 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-07-13 12:23:32 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Eclipse Project 369145 0 None None None 2012-07-13 12:06:10 UTC

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.


Note You need to log in before you can comment on or make changes to this bug.