ValueBootstrapMethods.isSubstitutable() with a mix of value and object

Mandy Chung mandy.chung at oracle.com
Wed Dec 19 15:56:55 UTC 2018


Yes, I also caught that bug and I have a patch in my repo.  I will push 
it today.

Mandy

On 12/19/18 2:01 AM, Roland Westrelin wrote:
> With this patch to the test:
>
> diff --git a/test/jdk/valhalla/valuetypes/SubstitutabilityTest.java b/test/jdk/valhalla/valuetypes/SubstitutabilityTest.java
> --- a/test/jdk/valhalla/valuetypes/SubstitutabilityTest.java
> +++ b/test/jdk/valhalla/valuetypes/SubstitutabilityTest.java
> @@ -95,6 +95,7 @@
>                              valueBuilder().setNumber(new Value.IntNumber(99)).build() },
>               new Object[] { valueBuilder().setReference(List.of("list")).build(),
>                              valueBuilder().setReference(List.of("list")).build() },
> +            new Object[] { Point.makePoint(10, 10), mpath},
>           };
>       }
>       @Test(dataProvider="notSubstitutable")
>
> I get this:
>
> java.lang.InternalError: java.lang.ClassCastException: Cannot cast MutablePath to Point
>          at java.base/java.lang.invoke.ValueBootstrapMethods.isSubstitutable(ValueBootstrapMethods.java:469)
>          at SubstitutabilityTest.notSubstitutableTest(SubstitutabilityTest.java:103)
>          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>          at java.base/java.lang.reflect.Method.invoke(Method.java:569)
>          at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
>          at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
>          at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:821)
>          at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1131)
>          at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
>          at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
>          at org.testng.TestRunner.privateRun(TestRunner.java:773)
>          at org.testng.TestRunner.run(TestRunner.java:623)
>          at org.testng.SuiteRunner.runTest(SuiteRunner.java:357)
>          at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:352)
>          at org.testng.SuiteRunner.privateRun(SuiteRunner.java:310)
>          at org.testng.SuiteRunner.run(SuiteRunner.java:259)
>          at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
>          at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
>          at org.testng.TestNG.runSuitesSequentially(TestNG.java:1185)
>          at org.testng.TestNG.runSuitesLocally(TestNG.java:1110)
>          at org.testng.TestNG.run(TestNG.java:1018)
>          at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:94)
>          at com.sun.javatest.regtest.agent.TestNGRunner.main(TestNGRunner.java:54)
>          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>          at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>          at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>          at java.base/java.lang.reflect.Method.invoke(Method.java:569)
>          at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
>          at java.base/java.lang.Thread.run(Thread.java:835)
> Caused by: java.lang.ClassCastException: Cannot cast MutablePath to Point
>          at java.base/java.lang.Class.cast(Class.java:3712)
>          at java.base/java.lang.invoke.ValueBootstrapMethods.isSubstitutable(ValueBootstrapMethods.java:466)
>          ... 30 more
>
> Shouldn't ValueBootstrapMethods.isSubstitutable() simply return false in
> this case?
>
> Roland.



More information about the valhalla-dev mailing list