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

Bug 355255

Summary: [assist] NPE during completion if team contains an enum
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTDTAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.1 M2   
Hardware: Other   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
test & fix none

Description Stephan Herrmann CLA 2011-08-19 14:58:58 EDT
I had about this much in the editor:

public team class TeamClass {
	enum Aufzaehlung {
		EINS, ZWEI;
	}
	prote
}

Then pressing Ctrl-space after "prote" caused this NPE:

java.lang.NullPointerException
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.findOverridableRoles(CompletionEngine.java:10727)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.completionOnFieldType(CompletionEngine.java:2284)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine._OT$complete$orig(CompletionEngine.java:1701)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine._OT$complete$chain(CompletionEngine.java)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine._OT$complete$chain(CompletionEngine.java)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java)
	at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:1967)
Comment 1 Stephan Herrmann CLA 2011-08-19 15:18:19 EDT
Issue seems to be related to the enum rather than the incomplete keyword,
after manually completing the role class invoking completion after
"main" again triggered the same NPE.
Comment 2 Stephan Herrmann CLA 2011-08-27 10:05:19 EDT
Created attachment 202267 [details]
test & fix

Fixed by a simple null-check, documenting why this can happen (enum).
Comment 3 Stephan Herrmann CLA 2011-08-27 10:07:20 EDT
Patch has been released for 2.1 M2 (r1980/81).
Comment 4 Stephan Herrmann CLA 2012-09-20 17:05:10 EDT
Verified using build 2.2.1.201209182002