Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 360554

Summary: NPE when changing a class to an enum (or enum to class)
Product: [WebTools] Dali JPA Tools Reporter: Paul Fullbright <paul.fullbright>
Component: GeneralAssignee: Karen Butzke <karenfbutzke>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: jolene.moffitt, karenfbutzke, neil.hauge
Version: 3.0Flags: neil.hauge: review+
Target Milestone: 3.0.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
proposed patch against maintenance none

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