Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366597 - [compiler] NPE with role ifc wrongly interpreted as a team
Summary: [compiler] NPE with role ifc wrongly interpreted as a team
Status: VERIFIED FIXED
Alias: None
Product: Objectteams
Classification: Tools
Component: OTJ (show other bugs)
Version: 2.0.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Stephan Herrmann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-13 13:38 EST by Stephan Herrmann CLA
Modified: 2013-01-15 16:42 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephan Herrmann CLA 2011-12-13 13:38:08 EST
The following snippet:

package t;

import base b.Base;
public team class T1 extends T0 {
	protected interface IR 
	@Override
	protected class R2 playedBy Base {
		void bar() {
			this.foo();
		}
	}
}

triggers this exception:

java.lang.NullPointerException
	at org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies.ensureTeamState(Dependencies.java:506)
	at org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies.ensureRoleState(Dependencies.java:844)
	at org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies.ensureTeamState(Dependencies.java:655)
	at org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies.ensureAstState(Dependencies.java:447)
	at org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies.ensureState(Dependencies.java:276)
	at org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies.ensureState(Dependencies.java:253)
	at org.eclipse.objectteams.otdt.internal.core.compiler.control.Dependencies.ensureState(Dependencies.java:216)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:820)

I can see in the debugger that the syntax error causes IR to be 
interpreted as a team, then the teamModel is looked up in the class part
which naturally doesn't exist (interface!).
Comment 1 Stephan Herrmann CLA 2011-12-13 14:49:44 EST
Fixed for 2.1 M4 via
http://git.eclipse.org/c/objectteams/org.eclipse.objectteams.git/commit/?id=0f8bfbbc9ae90550f9f4eb049f43a7c1d0dc568f

Along two paths we now explicitly avoid the combination of AccInterface
and AccTeam.
Comment 2 Stephan Herrmann CLA 2011-12-16 15:24:47 EST
Main issue (NPE) verified for 2.1 M4 using build 201112131519,

however, a fup was detected: Bug 366976
Comment 3 Stephan Herrmann CLA 2012-01-17 13:20:56 EST
The fix has been backported to 2.0.2 via commit dd71e720db99a23d6becdc5132298085870747e9