changeset 58662:e2f1c4d5f39e lworld

8237955: [lworld] Identity types that have no declaration sites fail to be IdentityObjects
author sadayapalam
date Tue, 28 Jan 2020 17:12:01 +0530
parents 57fcdeb4a5b2
children 8cbd40791397
files src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java test/langtools/tools/javac/T8187978/FilterOutCandidatesForDiagnosticsTest.out test/langtools/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out test/langtools/tools/javac/valhalla/lworld-values/InstanceOfTopTypeTest.java test/langtools/tools/javac/valhalla/lworld-values/UndeclaredIdentityObjectsTest.java test/langtools/tools/javac/valhalla/lworld-values/UndeclaredIdentityObjectsTest.out
diffstat 8 files changed, 126 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Tue Jan 28 14:44:22 2020 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symtab.java	Tue Jan 28 17:12:01 2020 +0530
@@ -54,6 +54,7 @@
 import com.sun.tools.javac.code.Type.UnknownType;
 import com.sun.tools.javac.code.Types.UniqueType;
 import com.sun.tools.javac.comp.Modules;
+import com.sun.tools.javac.jvm.Target;
 import com.sun.tools.javac.util.Assert;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.Convert;
@@ -64,6 +65,7 @@
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Names;
+import com.sun.tools.javac.util.Options;
 
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
@@ -220,6 +222,8 @@
     public final Type inlineObjectType;
     public final Type identityObjectType;
 
+    public final boolean injectTopInterfaceTypes;
+
     /** The symbol representing the length field of an array.
      */
     public final VarSymbol lengthVar;
@@ -604,12 +608,19 @@
         MethodSymbol m = new MethodSymbol(PUBLIC | ABSTRACT, names.value, intType, profileType.tsym);
         profileType.tsym.members().enter(m);
 
+        injectTopInterfaceTypes = Options.instance(context).isUnset("noTopInterfaceInjection") &&
+                Feature.INLINE_TYPES.allowedInSource(source) &&
+                Target.instance(context).hasTopInterfaces();
+
         // Enter a class for arrays.
         // The class implements java.lang.Cloneable and java.io.Serializable.
         // It has a final length field and a clone method.
         ClassType arrayClassType = (ClassType)arrayClass.type;
         arrayClassType.supertype_field = objectType;
-        arrayClassType.interfaces_field = List.of(cloneableType, serializableType);
+        arrayClassType.interfaces_field = injectTopInterfaceTypes ?
+                List.of(cloneableType, serializableType, identityObjectType):
+                List.of(cloneableType, serializableType);
+
         arrayClass.members_field = WriteableScope.create(arrayClass);
         lengthVar = new VarSymbol(
             PUBLIC | FINAL,
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Tue Jan 28 14:44:22 2020 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Tue Jan 28 17:12:01 2020 +0530
@@ -50,6 +50,7 @@
 import com.sun.tools.javac.comp.Env;
 import com.sun.tools.javac.comp.LambdaToMethod;
 import com.sun.tools.javac.jvm.ClassFile;
+import com.sun.tools.javac.jvm.Target;
 import com.sun.tools.javac.util.*;
 
 import static com.sun.tools.javac.code.BoundKind.*;
@@ -95,6 +96,7 @@
     final boolean mapCapturesToBounds;
     final boolean allowValueBasedClasses;
     final boolean nonCovariantValueArrays;
+    final boolean injectTopInterfaceTypes;
     final Check chk;
     final Enter enter;
     JCDiagnostic.Factory diags;
@@ -127,6 +129,9 @@
         Options options = Options.instance(context);
         allowValueBasedClasses = options.isSet("allowValueBasedClasses");
         nonCovariantValueArrays = options.isSet("nonCovariantValueArrays");
+        injectTopInterfaceTypes = Options.instance(context).isUnset("noTopInterfaceInjection") &&
+                Feature.INLINE_TYPES.allowedInSource(source) &&
+                Target.instance(context).hasTopInterfaces();
     }
     // </editor-fold>
 
@@ -1263,7 +1268,8 @@
                     Name sname = s.tsym.getQualifiedName();
                     return sname == names.java_lang_Object
                         || sname == names.java_lang_Cloneable
-                        || sname == names.java_io_Serializable;
+                        || sname == names.java_io_Serializable
+                        || (injectTopInterfaceTypes && sname == names.java_lang_IdentityObject);
                 }
 
                 return false;
@@ -4116,8 +4122,10 @@
                 synchronized (this) {
                     if (arraySuperType == null) {
                         // JLS 10.8: all arrays implement Cloneable and Serializable.
-                        arraySuperType = makeIntersectionType(List.of(syms.serializableType,
-                                syms.cloneableType), true);
+                        List<Type> ifaces = injectTopInterfaceTypes ?
+                                List.of(syms.serializableType, syms.cloneableType, syms.identityObjectType):
+                                List.of(syms.serializableType, syms.cloneableType);
+                        arraySuperType = makeIntersectionType(ifaces, true);
                     }
                 }
             }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Tue Jan 28 14:44:22 2020 +0530
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java	Tue Jan 28 17:12:01 2020 +0530
@@ -114,6 +114,8 @@
     public final Name java_lang_System;
     public final Name __inline__;
     public final Name java_lang___inline__;
+    public final Name java_lang_IdentityObject;
+    public final Name java_lang_InlineObject;
 
     // names of builtin classes
     public final Name Array;
@@ -275,6 +277,8 @@
         java_lang_System = fromString("java.lang.System");
         __inline__ = fromString("__inline__");
         java_lang___inline__ = fromString("java.lang.__inline__");
+        java_lang_IdentityObject = fromString("java.lang.IdentityObject");
+        java_lang_InlineObject = fromString("java.lang.InlineObject");
 
         // names of builtin classes
         Array = fromString("Array");
--- a/test/langtools/tools/javac/T8187978/FilterOutCandidatesForDiagnosticsTest.out	Tue Jan 28 14:44:22 2020 +0530
+++ b/test/langtools/tools/javac/T8187978/FilterOutCandidatesForDiagnosticsTest.out	Tue Jan 28 17:12:01 2020 +0530
@@ -1,2 +1,2 @@
-FilterOutCandidatesForDiagnosticsTest.java:12:64: compiler.err.cant.apply.symbols: kindname.method, add, java.lang.String,{(compiler.misc.inapplicable.method: kindname.method, java.util.ArrayList, add(compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc,java.lang.Object[],int), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, java.util.ArrayList, add(compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc))),(compiler.misc.inapplicable.method: kindname.method, java.util.ArrayList, add(int,compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc), (compiler.misc.arg.length.mismatch))}
+FilterOutCandidatesForDiagnosticsTest.java:12:64: compiler.err.cant.apply.symbols: kindname.method, add, java.lang.String,{(compiler.misc.inapplicable.method: kindname.method, java.util.ArrayList, add(compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<?>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.constant.Constable&java.lang.constant.ConstantDesc,java.lang.Object[],int), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, java.util.ArrayList, add(compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<?>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.constant.Constable&java.lang.constant.ConstantDesc), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: java.lang.String, compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<?>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.constant.Constable&java.lang.constant.ConstantDesc))),(compiler.misc.inapplicable.method: kindname.method, java.util.ArrayList, add(int,compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<?>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.constant.Constable&java.lang.constant.ConstantDesc), (compiler.misc.arg.length.mismatch))}
 1 error
--- a/test/langtools/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out	Tue Jan 28 14:44:22 2020 +0530
+++ b/test/langtools/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out	Tue Jan 28 17:12:01 2020 +0530
@@ -4,10 +4,10 @@
 EagerReturnTypeResolutionTestb.java:45:26: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
 EagerReturnTypeResolutionTestb.java:74:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
 EagerReturnTypeResolutionTestb.java:75:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
-EagerReturnTypeResolutionTestb.java:77:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
+EagerReturnTypeResolutionTestb.java:77:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<?>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<?>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
 EagerReturnTypeResolutionTestb.java:78:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
 EagerReturnTypeResolutionTestb.java:79:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
-EagerReturnTypeResolutionTestb.java:81:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:81:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<?>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
 EagerReturnTypeResolutionTestb.java:82:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
 EagerReturnTypeResolutionTestb.java:83:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
 EagerReturnTypeResolutionTestb.java:85:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
@@ -17,10 +17,10 @@
 EagerReturnTypeResolutionTestb.java:90:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>)
 EagerReturnTypeResolutionTestb.java:91:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>)
 EagerReturnTypeResolutionTestb.java:92:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object)
-EagerReturnTypeResolutionTestb.java:94:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.J<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
+EagerReturnTypeResolutionTestb.java:94:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.J<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<?>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<?>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
 EagerReturnTypeResolutionTestb.java:95:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>)
 EagerReturnTypeResolutionTestb.java:96:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object)
-EagerReturnTypeResolutionTestb.java:98:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:98:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<?>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
 EagerReturnTypeResolutionTestb.java:99:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>)
 EagerReturnTypeResolutionTestb.java:100:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object)
 EagerReturnTypeResolutionTestb.java:102:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>)
@@ -28,10 +28,10 @@
 EagerReturnTypeResolutionTestb.java:104:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>)
 EagerReturnTypeResolutionTestb.java:105:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>)
 EagerReturnTypeResolutionTestb.java:106:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object)
-EagerReturnTypeResolutionTestb.java:108:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
+EagerReturnTypeResolutionTestb.java:108:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<?>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<?>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object))
 EagerReturnTypeResolutionTestb.java:109:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>)
 EagerReturnTypeResolutionTestb.java:110:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object)
-EagerReturnTypeResolutionTestb.java:112:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.IdentityObject&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
+EagerReturnTypeResolutionTestb.java:112:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.IdentityObject&java.lang.Comparable<?>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>&java.lang.constant.Constable&java.lang.constant.ConstantDesc>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)
 EagerReturnTypeResolutionTestb.java:113:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.eq.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>)
 EagerReturnTypeResolutionTestb.java:114:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.incompatible.upper.bounds: T, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object)
 EagerReturnTypeResolutionTestb.java:174:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Double, java.lang.Long,java.lang.Object))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/valhalla/lworld-values/InstanceOfTopTypeTest.java	Tue Jan 28 17:12:01 2020 +0530
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8237955
+ * @summary Identity types that have no declaration sites fail to be IdentityObjects
+ * @run main/othervm InstanceOfTopTypeTest
+ */
+
+public class InstanceOfTopTypeTest {
+    static inline class V {
+        int x = 42;
+    }
+    public static void main(String [] args) {
+        int points = 0;
+        Object o = new InstanceOfTopTypeTest();
+        if (o instanceof IdentityObject)
+            points++;     // 1
+        if (o instanceof InlineObject)
+            throw new AssertionError("Broken");
+        o = new V();
+        if (o instanceof IdentityObject)
+            throw new AssertionError("Broken");
+        if (o instanceof InlineObject)
+            points++; // 2
+        Object [] oa = new InstanceOfTopTypeTest[] { new InstanceOfTopTypeTest() };
+        if (oa instanceof IdentityObject)
+            points++; // 3
+        if (oa[0] instanceof IdentityObject)
+            points++; // 4
+        if (oa[0] instanceof InlineObject)
+            throw new AssertionError("Broken");
+        oa = new V[] { new V() };
+        if (oa instanceof IdentityObject)
+            points++; // 5
+        if (oa[0] instanceof IdentityObject)
+            throw new AssertionError("Broken");
+        if (oa[0] instanceof InlineObject)
+            points++;
+        if (points != 4) // Change to != 6 after JDK-8237958 is fixed
+            throw new AssertionError("Broken top type set up" + points);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/valhalla/lworld-values/UndeclaredIdentityObjectsTest.java	Tue Jan 28 17:12:01 2020 +0530
@@ -0,0 +1,26 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8237955
+ * @summary Identity types that have no declaration sites fail to be IdentityObjects
+ * @compile/fail/ref=UndeclaredIdentityObjectsTest.out -XDrawDiagnostics UndeclaredIdentityObjectsTest.java
+ */
+
+public class UndeclaredIdentityObjectsTest {
+    static class G<T> {}
+    public static void main(String [] args) {
+        Object [] oa = new UndeclaredIdentityObjectsTest[] {
+                                new UndeclaredIdentityObjectsTest()
+                       };
+        if (!(oa instanceof IdentityObject))
+            throw new AssertionError("Arrays are broken");
+        Object o = new G<String>();
+        if (!(o instanceof IdentityObject))
+            throw new AssertionError("Parameterized type are broken");
+        if (!(oa[0] instanceof IdentityObject)) // can only be determined at runtime
+            System.out.println("Arrays are broken!");
+        if (oa[0] instanceof InlineObject) // can only be determined at runtime
+            System.out.println("Arrays are broken!");
+        if (oa instanceof InlineObject) // compile error.
+            throw new AssertionError("Arrays are broken");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/valhalla/lworld-values/UndeclaredIdentityObjectsTest.out	Tue Jan 28 17:12:01 2020 +0530
@@ -0,0 +1,2 @@
+UndeclaredIdentityObjectsTest.java:23:13: compiler.err.prob.found.req: (compiler.misc.inconvertible.types: java.lang.Object[], java.lang.InlineObject)
+1 error