Bug 104303 - Can't load Gen Model when an assert keyword is used or an enum class is nested
Summary: Can't load Gen Model when an assert keyword is used or an enum class is nested
Status: RESOLVED DUPLICATE of bug 124372
Alias: None
Product: EMF
Classification: Modeling
Component: Edit (show other bugs)
Version: 1.0   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Marcelo Paternostro CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-07-18 21:49 EDT by Jesse Eichar CLA
Modified: 2006-01-18 15:17 EST (History)
2 users (show)

See Also:


Attachments
Example of the bug. See the first entry of my report to make the bug manifest (3.09 KB, application/zip)
2005-07-18 21:50 EDT, Jesse Eichar CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Eichar CLA 2005-07-18 21:49:23 EDT
I'm attaching a project with three java files.  one is an interface with the
@model tag.  As the project stands right clicking on the Example.genmodel and
selecting reload locates the file (It is called Example).  

However, move either one of the two java files that are in the main project (not
part of the build path) into the test package and the reload will no longer
work.  This is the case for files like the anywhere within the project.

If the enum is defined as its own class in its own file that is fine.  It only
breaks things when it is within another class.  The assert also breaks things. 
This is not new.  I've been fighting this since version 2.0.1.  I filed a bad
bug report earlier but didn't have time to provide a good one.

Let me know if this is enough information for you.
Comment 1 Jesse Eichar CLA 2005-07-18 21:50:54 EDT
Created attachment 24964 [details]
Example of the bug.  See the first entry of my report to make the bug manifest

move either of the java files into the test package and reloading the genmodel
will not work.
Comment 2 Ed Merks CLA 2005-07-19 11:23:16 EDT
Jesse,

EMF is using JDOM and JDOM doesn't support Java 5.0 syntax.
We will migrate EMF to use AST as part of EMF 2.2 development:
   https://bugs.eclipse.org/bugs/show_bug.cgi?id=78076

The assert problem appears to be purely a JDOM problem:

java.lang.ClassCastException: org/eclipse/jdt/internal/core/jdom/DOMMethod
incompatible with org/eclipse/jdt/core/jdom/IDOMType
	at java.lang.Throwable.<init>(Throwable.java)
	at java.lang.Throwable.<init>(Throwable.java)
	at java.lang.ClassCastException.<init>(ClassCastException.java:54)
	at org.eclipse.jdt.internal.core.jdom.DOMBuilder.createType(DOMBuilder.java:271)
	at org.eclipse.jdt.core.jdom.DOMFactory.createType(DOMFactory.java:158)
	at org.eclipse.jdt.internal.core.jdom.DOMType.getDetailedNode(DOMType.java:392)
	at org.eclipse.jdt.internal.core.jdom.DOMNode.becomeDetailed(DOMNode.java:390)
	at org.eclipse.jdt.internal.core.jdom.DOMMember.getComment(DOMMember.java:218)
	at
org.eclipse.emf.importer.java.builder.JavaEcoreBuilder.analyzeType(JavaEcoreBuilder.java:692)

It may be something the JDT folks are still willing to fix (even though JDOM is
deprecated).  I'll transfer this bugzilla to them for consideration.
Comment 3 Olivier Thomann CLA 2005-07-19 12:19:49 EDT
For the assert problem, there is nothing we can do.
The JDOM parser is using the workspace preferences. So the workaround is to
change the workspace compiler options to compliance 1.4 and source 1.4. We
cannot change this without adding a new API.

I will investigate the enum case.
Comment 4 Olivier Thomann CLA 2005-07-19 12:36:15 EDT
The problem comes from the fact that the JDOM API doesn't know anything about
1.5 constructs. The API is deprecated and therefore has not been moved to 1.5
for the 3.1 delivery.
DOM/AST has been provided to replace JDOM with a complete support for 1.5.
EMF should move to DOM/AST in order to resolve this issue.
Moving back to EMF
Comment 5 Olivier Thomann CLA 2005-07-19 12:38:25 EDT
The best we can do is to return null.
Comment 6 Ed Merks CLA 2005-07-19 12:42:06 EDT
Olivier,

Thanks for the prompt assessment!  I'll return this as a duplicate of the
existing bugzilla for migrating from JDOM to AST.

*** This bug has been marked as a duplicate of 78076 ***
Comment 7 Olivier Thomann CLA 2005-07-19 12:47:31 EDT
No problem.
I will add a new bug report against JDT/Core to improve thw actual behavior on
1.5 code. See bug 104371.
Comment 8 Marcelo Paternostro CLA 2006-01-18 15:16:39 EST
The bugzilla 78076, as a plan item, was broken in 2 steps.  This bugzilla should be marked as a duplicate of 124372 which refers to enabling JMerge to work with Java5 code.
Comment 9 Marcelo Paternostro CLA 2006-01-18 15:17:42 EST

*** This bug has been marked as a duplicate of 124372 ***