Bug 247024

Summary: Compiler must not allow unboxing conversion from Cloneable to char
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: VERIFIED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, philippe_mulet
Version: 3.5   
Target Milestone: 3.5 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2008-09-11 10:51:14 EDT
N20080910-2000

Compiler must not allow unboxing conversion from Cloneable to char.

public class Try {
	public static void main(String[] args) {
		char c;
		Cloneable cloneable= new ArrayList();
		c= cloneable;
		System.out.println(c);
	}
}

JDT/Core from HEAD compiles this without an error, but I20080903-1200 and javac (1.6.0_07) both correctly say "Type mismatch: cannot convert from Cloneable to char".
Same problem with boolean, long, double.
Same problem when assigning a Serializable to a byte.


This causes a test failure in JDT/UI:

bool= cloneable c= cloneable l= cloneable d= cloneable b= serializable

junit.framework.AssertionFailedError: bool= cloneable
c= cloneable
l= cloneable
d= cloneable
b= serializable

at org.eclipse.jdt.ui.tests.core.TypeRulesTest.testIsAssignmentCompatible(TypeRulesTest.java:211)
Comment 1 Markus Keller CLA 2008-09-11 10:57:44 EDT
Oh, sorry. It's actually fixed in HEAD.
Comment 2 Philipe Mulet CLA 2008-09-11 15:02:58 EDT
Being curious. Why are you saying it got fixed in HEAD ? To my knowledge it was never broken. I checked all the releases back until 3.3.0, and it was always fine.

Is this INVALID ?
Comment 3 Markus Keller CLA 2008-09-12 04:29:33 EDT
It was broken in N20080910-2000:
http://download.eclipse.org/eclipse/downloads/drops/N20080910-2000/testresults/html/org.eclipse.jdt.ui.tests_win32.win32.x86.html

I tried to reproduce the test failure in that build (without jdt.core from HEAD), and it really failed. But when I went and ran the test in HEAD, it was green again.
Comment 4 Jerome Lanneluc CLA 2008-09-12 04:53:24 EDT
I think that WORKSFORME is the correct resolution whether it didn't work at one point in time or it always worked. WORKSFORME just tells that no action was taken to fix the problem by JDT/Core.
Comment 5 Frederic Fusier CLA 2008-09-15 09:45:42 EDT
Verified for 3.5M2 using I20080914-2000.