[lworld] RFR: JDK 8251107 [lworld] test lworld-values/TopInterfaceNegativeTest.java needs scrubbing

Srikanth Adayapalam sadayapalam at openjdk.java.net
Wed Aug 5 05:10:45 UTC 2020


On Tue, 4 Aug 2020 17:49:18 GMT, Jim Laskey <jlaskey at openjdk.org> wrote:

> Test was somewhat out of date and still using InlineObject.

I think the test still using the withdrawn InlineObject is a red herring. The golden files account for this already and
capture suitable errors for those uses of the non-existent interface.

The real trouble is due to an error NOT being emitted in line 33 of the TopInterfaceNegativeTest.java:

Given:

static inline class V2 implements InlineObject {}

void foo(V2 v) {
        if (v instanceof IdentityObject)  // line 33
            throw new AssertionError("Expected inline object but found identity object");
    }

v instanceof IdentityObject is patently false and can be ascertained at compile time to be patently false thereby
resulting an error message:

TopInterfaceNegativeTest.java:33:13: compiler.err.prob.found.req: (compiler.misc.inconvertible.types:
TopInterfaceNegativeTest.V2, java.lang.IdentityObject)

Given 'v' is type V2 and that is a final class, we known all the interfaces implemented by v and so can evaluate at
compile time whether the instanceof is patently bogus -

Now with the change for sealing of projections, this error is not emitted anymore and that is the reason for the
failure.

The error is valid and should be restored.

-------------

PR: https://git.openjdk.java.net/valhalla/pull/135



More information about the valhalla-dev mailing list