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

Bug 336395

Summary: [compiler] enum inside team class may cause NPE
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTJAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 0.8   
Target Milestone: 0.8 M6   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
test
none
fix under test none

Description Stephan Herrmann CLA 2011-02-04 16:15:37 EST
If a team class containing an enum declaration is sub-classed 
the compiler throws: 

java.lang.NullPointerException
	at org.eclipse.objectteams.otdt.internal.core.compiler.util.AstConverter.createNestedType(AstConverter.java:356)
	at org.eclipse.objectteams.otdt.internal.core.compiler.statemachine.copyinheritance.CopyInheritance._OT$copyRole$orig(CopyInheritance.java:598)
...

Workaround: declare all enums outside teams for now.
Comment 1 Stephan Herrmann CLA 2011-02-04 16:31:58 EST
Created attachment 188370 [details]
test

Here's a minimal witness.
Comment 2 Stephan Herrmann CLA 2011-02-04 17:46:40 EST
Created attachment 188379 [details]
fix under test

Here's a minimal fix. Need more testing before calling this resolved.
Comment 3 Stephan Herrmann CLA 2011-02-05 09:20:56 EST
the patch caused a regression in test1517_nestedRoleFile5() which is
fixed in r1294, r1295.

Also in a more complex example (SOM tracer) the enum no longer causes problems.
Closing as fixed.
Comment 4 Stephan Herrmann CLA 2011-06-07 10:12:25 EDT
A FUP has been filed as bug 348570.

Still the core issue has been verified using build 201106070730.