Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 360554 - NPE when changing a class to an enum (or enum to class)
Summary: NPE when changing a class to an enum (or enum to class)
Status: VERIFIED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: General (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: 3.0.2   Edit
Assignee: Karen Butzke CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-11 11:35 EDT by Paul Fullbright CLA
Modified: 2011-11-07 13:34 EST (History)
3 users (show)

See Also:
neil.hauge: review+


Attachments
proposed patch against maintenance (2.86 KB, patch)
2011-10-11 16:36 EDT, Karen Butzke CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Fullbright CLA 2011-10-11 11:35:01 EDT
Create *any* class in a JPA or JAXB project.  Change (via text editor) to enum.  Get the following NPE:

java.lang.NullPointerException
	at org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotatedElement.syncAnnotations(SourceAnnotatedElement.java:252)
	at org.eclipse.jpt.common.core.internal.resource.java.source.SourceAnnotatedElement.synchronizeWith(SourceAnnotatedElement.java:104)
	at org.eclipse.jpt.common.core.internal.resource.java.source.SourceMember.synchronizeWith(SourceMember.java:58)
	at org.eclipse.jpt.common.core.internal.resource.java.source.SourceAbstractType.synchronizeWith(SourceAbstractType.java:64)
	at org.eclipse.jpt.common.core.internal.resource.java.source.SourceType.synchronizeWith(SourceType.java:130)
	at org.eclipse.jpt.common.core.internal.resource.java.source.SourceTypeCompilationUnit.syncPrimaryType(SourceTypeCompilationUnit.java:120)
	at org.eclipse.jpt.common.core.internal.resource.java.source.SourceTypeCompilationUnit.synchronizeWith(SourceTypeCompilationUnit.java:68)
	at org.eclipse.jpt.common.core.internal.resource.java.source.SourceCompilationUnit.synchronizeWithJavaSource(SourceCompilationUnit.java:157)
	at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.processJavaCompilationUnitDelta(AbstractJpaProject.java:1348)
	at org.eclipse.jpt.jpa.core.internal.AbstractJpaProject.processJavaDelta(AbstractJpaProject.java:1193)

...
Comment 1 Paul Fullbright CLA 2011-10-11 11:35:58 EDT
The NPE will continue happening for the life of the class/workbench session.
Comment 2 Karen Butzke CLA 2011-10-11 14:48:07 EDT
This is only an issue in JPA in the 3.1 stream. This problem exists in JAXB in 3.0 and 3.1 where we had separate java resource models for JPA and JAXB.

Paul, did you actually test this in 2.3.4?
Comment 3 Paul Fullbright CLA 2011-10-11 14:51:02 EDT
No, 2.3.4 was the automatic entry, which is weird.  It exists in current code.
Comment 4 Karen Butzke CLA 2011-10-11 16:36:11 EDT
Created attachment 204977 [details]
proposed patch against maintenance
Comment 5 Karen Butzke CLA 2011-10-11 16:46:14 EDT
fixed in head, attached a patch for maintenance
Comment 6 Karen Butzke CLA 2011-10-12 08:24:08 EDT
fixed in 3.0 maintenance
Comment 7 Jolene Moffitt CLA 2011-11-07 13:34:10 EST
Verified in Build M-3.3.2-20111107105838 

Verified you can change class to enum in java class editor without error.  See the link to view test steps for verification. http://wiki.eclipse.org/Dali_3.0.2