--- old/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java 2018-07-07 20:00:19.205001000 -0700 +++ new/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java 2018-07-07 20:00:19.073001000 -0700 @@ -89,7 +89,6 @@ final Symtab syms; final JavacMessages messages; final Names names; - final boolean allowObjectToPrimitiveCast; final boolean allowDefaultMethods; final boolean mapCapturesToBounds; final Check chk; @@ -113,7 +112,6 @@ syms = Symtab.instance(context); names = Names.instance(context); Source source = Source.instance(context); - allowObjectToPrimitiveCast = Feature.OBJECT_TO_PRIMITIVE_CAST.allowedInSource(source); allowDefaultMethods = Feature.DEFAULT_METHODS.allowedInSource(source); mapCapturesToBounds = Feature.MAP_CAPTURES_TO_BOUNDS.allowedInSource(source); chk = Check.instance(context); @@ -1639,8 +1637,7 @@ if (t.isPrimitive() != s.isPrimitive()) { t = skipTypeVars(t, false); return (isConvertible(t, s, warn) - || (allowObjectToPrimitiveCast && - s.isPrimitive() && + || (s.isPrimitive() && isSubtype(boxedClass(s).type, t))); } if (warn != warnStack.head) {