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

Bug 311885

Summary: [compiler] toggling CCE in incremental compilation of nested phantom role
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTJAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3    
Version: 0.7   
Target Milestone: 0.7 M3   
Hardware: Other   
OS: All   
Whiteboard:
Attachments:
Description Flags
test & fix none

Description Stephan Herrmann CLA 2010-05-06 09:59:19 EDT
Given the following teams:

public team class T1 {

	public team class T11 {

		protected class R1 {
			void m() {}
		}
		protected class R3 extends R1 {
		}
	}
	public team class T12 extends T11 {
	}
}

and

public team class T2 extends T1 {
	public team class T12 {
		protected class R3 {
			void m() {} 
		}
	}
}

recompiling T2 toggles between success and the following CCE:

java.lang.ClassCastException: org.eclipse.objectteams.otdt.internal.core.compiler.lookup.RoleTypeBinding cannot be cast to org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding
	at org.eclipse.objectteams.otdt.internal.core.compiler.model.TeamModel.strengthenRoleType(TeamModel.java:688)
	at org.eclipse.objectteams.otdt.internal.core.compiler.model.TeamModel.strengthenRoleType(TeamModel.java:652)
	at org.eclipse.objectteams.otdt.internal.core.compiler.lookup.TeamAnchor.getRoleTypeBinding(TeamAnchor.java:742)
	at org.eclipse.objectteams.otdt.internal.core.compiler.lookup.TeamAnchor.getRoleTypeBinding(TeamAnchor.java:710)
	at org.eclipse.objectteams.otdt.internal.core.compiler.lookup.RoleTypeBinding.forAnchor(RoleTypeBinding.java:234)
	at org.eclipse.objectteams.otdt.internal.core.compiler.lookup.DependentTypeBinding.maybeInstantiate(DependentTypeBinding.java:230)
	at org.eclipse.objectteams.otdt.internal.core.compiler.util.RoleTypeCreator.wrapTypesInMethodBindingSignature(RoleTypeCreator.java:794)
	at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.resolveTypesFor(BinaryTypeBinding.java:1469)
...
Comment 1 Stephan Herrmann CLA 2010-05-18 16:06:40 EDT
Created attachment 169010 [details]
test & fix

This patch contains test and fix:
 - non-binary role type may still be RTB not STB, avoid the CCE by unwrapping
 - do report MissingCopiedRole even for purely copied
 - add severity AbortType to missingCopiedRole() to avoid continueing with
   unstrengthened/weakened role type (which caused bridge methods for creators)
Comment 2 Stephan Herrmann CLA 2010-05-18 16:08:51 EDT
Patch has been committed as r341.
Comment 3 Stephan Herrmann CLA 2010-05-29 17:38:56 EDT
verified for M3 using 201005282024