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

Bug 370040

Summary: [otre] NoSuchFieldError when mixing class file versions within one type hierarchy
Product: [Tools] Objectteams Reporter: Stephan Herrmann <stephan.herrmann>
Component: OTJAssignee: Stephan Herrmann <stephan.herrmann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M5   
Hardware: Other   
OS: Linux   
Whiteboard:

Description Stephan Herrmann CLA 2012-01-28 07:13:10 EST
In Juno M5 plugin org.eclipse.jdt.junit.launcher has moved to a BREE of J2SE-1.5 while org.eclipse.pde.launching remains at 1.4. 

Both plugins have a class called JUnitLaunchCOnfigurationDelegate where the pde version inherits from the junit.launcher version.

When trying to weave into both classes the OTRE produces a
   java.lang.NoSuchFieldError: _OT$self_class$

This happens because the field is only generated for 1.4- so the super class doesn't need it, however, when weaving the sub-class we wrongly assume that the field has been woven into the super class.
Comment 1 Stephan Herrmann CLA 2012-01-28 11:32:30 EST
Fixed by keeping all class literal access local: instead of accessing ThatClass._OT$self_class$ use one more field: ThisClass._OT$class_literal$ThatClass, This avoids the inconsistencies if class files have different format (1.4 vs. 1.5+).

Test and fix have been released via commit 8574731a0f2dc482cebc92613334e05b97ad83d0
Comment 2 Stephan Herrmann CLA 2012-09-22 16:02:19 EDT
Works OK in the OTDT, considering as fixed indeed.