1.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Wed May 11 13:10:57 2011 +0200 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Wed May 11 13:12:11 2011 +0200 1.3 @@ -955,7 +955,9 @@ 1.4 if (t.isPrimitive() != s.isPrimitive()) 1.5 return allowBoxing && ( 1.6 isConvertible(t, s, warn) 1.7 - || (allowObjectToPrimitiveCast && isConvertible(s, t, warn))); 1.8 + || (allowObjectToPrimitiveCast && 1.9 + s.isPrimitive() && 1.10 + isSubtype(boxedClass(s).type, t))); 1.11 if (warn != warnStack.head) { 1.12 try { 1.13 warnStack = warnStack.prepend(warn);