< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java

Print this page

        

@@ -87,11 +87,10 @@
     protected static final Context.Key<Types> typesKey = new Context.Key<>();
 
     final Symtab syms;
     final JavacMessages messages;
     final Names names;
-    final boolean allowObjectToPrimitiveCast;
     final boolean allowDefaultMethods;
     final boolean mapCapturesToBounds;
     final Check chk;
     final Enter enter;
     JCDiagnostic.Factory diags;

@@ -111,11 +110,10 @@
     protected Types(Context context) {
         context.put(typesKey, this);
         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);
         enter = Enter.instance(context);
         capturedName = names.fromString("<captured wildcard>");

@@ -1637,12 +1635,11 @@
         if (t == s)
             return true;
         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) {
             try {
                 warnStack = warnStack.prepend(warn);
< prev index next >