Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 79768 - [Plan Item] Java SE 5.0 Support
Summary: [Plan Item] Java SE 5.0 Support
Status: VERIFIED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 enhancement with 3 votes (vote)
Target Milestone: Future   Edit
Assignee: Marcelo Paternostro CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 166833
Blocks:
  Show dependency tree
 
Reported: 2004-11-30 07:43 EST by Ed Merks CLA
Modified: 2008-01-28 16:55 EST (History)
12 users (show)

See Also:


Attachments
Java 5 changes for common (176.99 KB, patch)
2006-06-05 18:16 EDT, Marcelo Paternostro CLA
no flags Details | Diff
Some simple tests using Java 5 (9.52 KB, application/octet-stream)
2006-06-05 18:18 EDT, Marcelo Paternostro CLA
no flags Details
A full seemingly working templatization of org.eclipse.emf.common (252.29 KB, patch)
2006-10-06 14:00 EDT, Ed Merks CLA
no flags Details | Diff
Further changes in org.eclipse.emf.ecore (550.78 KB, patch)
2006-10-08 12:37 EDT, Ed Merks CLA
no flags Details | Diff
Updated patches against the lastest version of HEAD (557.38 KB, patch)
2006-10-20 12:41 EDT, Ed Merks CLA
no flags Details | Diff
Updates for org.eclipse.emf.common and org.eclipse.emf.ecore (981.42 KB, patch)
2006-10-28 16:12 EDT, Ed Merks CLA
no flags Details | Diff
More Updates (1.91 MB, patch)
2006-11-15 15:42 EST, Ed Merks CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Merks CLA 2004-11-30 07:43:14 EST
 
Comment 1 Ed Merks CLA 2005-02-18 07:38:21 EST
[plan pri=3 est=4w/]
Comment 2 Ian Bull CLA 2005-06-20 11:46:18 EDT
I have been looking into 1.5 support for EMF.  As a first step I just compiled
EMF with Java 1.5 and there are 3 compile errors.  It seems that:
compareTo no longer takes Object as its type, but rather the type of itself. 
(i.e. Double.compareTo is now compareTo(Double o) instead of compareTo(Object o)).

This breaks EMF (actually org.eclipse.xsd) in three spots:
org.eclipse.xsd.impl.type.XSDFloatType
org.eclipse.xsd.impl.type.XSDDoubleType
org.eclipse.xsd.impl.type.XSDDecimalType

The compareValues in each of these requires a cast:
return ((Float)value1).compareTo((Float)value2);  // Line 36
return ((Double)value1).compareTo((Double)value2); // Line 36
return ((BigDecimal)value1).compareTo((BigDecimal)value2);  // Line 42

I am wondering if we can get these changes in CVS.  This *should* not break
backwards compatibility since Objects should only be compared to other objects
with the same type.

Cheers,
Ian
Comment 3 Elena Litani CLA 2005-08-22 10:59:07 EDT
Current assesment suggests that introducing Java 5 features in EMF runtime will 
create backwards compatibility issues for some components in the Eclise 3.2 
timeframe. Therefore, EMF team has no plans to introduce new Java 5 features in 
EMF for Eclipse 3.2. This bugzilla will be reconsidered in the next Eclipse 
version.
Comment 4 Bryan Hunt CLA 2005-09-28 09:15:40 EDT
Does this mean that if we use EMF, we won't be able to run Eclipse 3.2 under the Java 5 runtime?
Comment 5 Ed Merks CLA 2005-09-28 09:20:54 EDT
No.  I know that people are definitely already using EMF with a Java 5 runtime
already so there's no concern there.  This just means that we won't be
generating 5 targeted code and won't be templatizing things like EList and
BasicEList until a subsequent release. If we templatized EList, we'd no longer
be able to run in a 1.4 environment, so we need to take the step forward when
most clients are prepared to leave 1.4 behind.
Comment 6 Gunnar Wagenknecht CLA 2006-02-07 04:09:12 EST
Another option is to make the target environment configurable in the .genmodel, i.e. keep support for generating 1.4 compatible code.
Comment 7 Ed Merks CLA 2006-02-07 06:27:29 EST
Gunnar,

That's certainly possible, but this isn't nearly as straight forward as it is for the JDT to target a different JDK.  The reason for the difference is that the JDT is not providing a runtime that will prop up the byte code it generates and the JDT is not necessarily itself using the same runtime as it targets.  EMF, on the other hand, provides a runtime in addition to the JDT and that runtime will either be a 1.4 runtime or a 5.0 runtime but cannot be both.  So while we could start using 5.0 to support a new runtime and we could add flags that would allow us to generate without exploiting 5.0, we'd be stuck somehow having to support multiple runtimes.  Perhaps such a flag is useful anyway, and simply means that the generated code can be compiled against either the old or the new runtime.  One way or the other, this will be a heck of a lot of work...

Comment 8 Doug B. CLA 2006-02-22 23:15:21 EST
Besides support for Generics, are there any thoughts on how/if EMF could make use of the Java 5 annotation/metadata facilities?  Perhaps this is better discussed in a different bugzilla report?
Comment 9 Ed Merks CLA 2006-02-23 06:27:13 EST
Doug,

I've only thought briefly about that but we've really not had time to experiment with much of anything Java 5.0 related, so I'm not even in a great position to speculate.  For example, I don't know how the annotation on the method in the interface relates to the annotation (if any) on the override in the implementation class?
Comment 10 Ed Merks CLA 2006-05-19 10:08:46 EDT
There's an interesting thread in https://bugs.eclipse.org/bugs/show_bug.cgi?id=107783
Comment 11 Marcelo Paternostro CLA 2006-06-05 18:16:16 EDT
Created attachment 43544 [details]
Java 5 changes for common

This is some initial experiments with Java 5.  Don't assume that the final code will be similar to this one.
Comment 12 Marcelo Paternostro CLA 2006-06-05 18:18:05 EDT
Created attachment 43545 [details]
Some simple tests using Java 5

As before, don't assume it will be close to the final code.
Comment 13 Ian Bull CLA 2006-07-24 16:34:18 EDT
What about other Java 1.5 support, things like Enums? 
I am currently working with the notification system and the types of notifications seem like the perfect spot for an enum (instead of an static integer list).  Of course this will break backwards compatibility.

Are these types of things worth investigating, or are we only concerned with supporting generics in our models?  Or does it make sense to start creating separate bug reports for these topics?

- ian

Comment 14 Ed Merks CLA 2006-07-25 07:59:46 EDT
Ian,

We'd like to achieve our end goal with a binary compatible runtime capable of running EMF code compiled with a runtime <= 2.2.  This would give our clients maximum flexibility with the least amount of effort required on their part to move forward.  We certainly want to give folks the option of generating a Java 5.0 enum verses a type-safe enum pattern.

So for a notification's event type, the current design allows the API to be reused for other types of events, whereas a bounded enum would not allow such flexibility.  I.e., such a change could leave clients in a bad state...
Comment 15 Ed Merks CLA 2006-10-06 14:00:31 EDT
Created attachment 51566 [details]
A full seemingly working templatization of org.eclipse.emf.common

These changes to org.eclipse.emf.common are fully tested and everything downstream appears to continue working well with no source changes.  The patch includes local compiler settings to help highlight any problems, such us uses of raw types.  At this point, only unavoidable unchecked cast warnings remain.  We could of course suppress these warnings, but one approach we might consider is the use of the "proposed" new utility class org.eclipse.emf.common.Cast with an 
"uncheckedCast" method that could be used everywhere an unchecked cast is currently needed. The benefit being that we'd know if we ever introduced an unchecked cast accidentally to some method that already contained another one and we could use Eclipse to easily find all unchecked casts by looking for calls to this method.  Anyone have opinions on this approach?
Comment 16 Ed Merks CLA 2006-10-08 12:37:41 EDT
Created attachment 51611 [details]
Further changes in org.eclipse.emf.ecore

I've started making changes in org.eclipse.emf.ecore.  Some of those changes made me go back and revisit a few of the changes in org.eclipse.emf.common...
Comment 17 Ed Merks CLA 2006-10-20 12:41:51 EDT
Created attachment 52409 [details]
Updated patches against the lastest version of HEAD

These are all the changes in org.eclipse.emf.common and org.eclipse.emf.ecore (in progress; not all done) as well as the changes to downstream plugins in EMF, XSD, UML2, and GMF needed to make these compile.
Comment 18 Ed Merks CLA 2006-10-28 16:12:40 EDT
Created attachment 52910 [details]
Updates for org.eclipse.emf.common and org.eclipse.emf.ecore

Both org.eclipse.emf.common and org.eclipse.emf.ecore are effectively all done.  Needs lots of review still, but the tests are passing...
Comment 19 Ed Merks CLA 2006-11-15 15:42:29 EST
Created attachment 53935 [details]
More Updates

The XMI plugin is done and the generator has a new "Compliance Level" option that will set to 5.0 or higher will generate 5.0 compliant code.  The generator support is quite complete, i.e., not raw type warnings and enums are supported. It's not necessarily done in the prettiest way yet. It appears that the new real enum pattern is binary compatible with the old type safe pattern.
Comment 20 Ed Merks CLA 2007-06-25 10:52:14 EDT
The changes for this are completed now.
Comment 21 Nick Boldt CLA 2008-01-28 16:55:13 EST
Move to verified as per bug 206558.