1 /* 2 * @test /nodynamiccopyright/ 3 * @summary Value types do not support identityHashCode 4 * @modules java.base/jvm.internal.value 5 * @compile/fail/ref=CheckIdentityHash01.out -XDrawDiagnostics -Werror -Xlint:values CheckIdentityHash01.java 6 */ 7 8 import static java.lang.System.*; 9 @jvm.internal.value.ValueCapableClass 10 final class CheckIdentityHash01 { 11 void test(CheckIdentityHash01 v) { 12 13 identityHashCode(v); // <- error 14 identityHashCode(this); // <- error 15 16 System system = null; 17 system.identityHashCode(v); // <- error 18 system.identityHashCode(this); // <- error 19 20 System.identityHashCode(v); // <- error 21 System.identityHashCode(this); // <- error 22 23 java.lang.System.identityHashCode(v); // <- error 24 java.lang.System.identityHashCode(this); // <- error 25 } 26 } | 1 /* 2 * @test /nodynamiccopyright/ 3 * @summary Value types do not support identityHashCode 4 * @modules jdk.incubator.mvt 5 * @compile/fail/ref=CheckIdentityHash01.out --should-stop:ifError=PARSE -XDrawDiagnostics -Werror -Xlint:values CheckIdentityHash01.java 6 */ 7 8 import static java.lang.System.*; 9 @jdk.incubator.mvt.ValueCapableClass 10 final class CheckIdentityHash01 { 11 void test(CheckIdentityHash01 v) { 12 13 identityHashCode(v); // <- error 14 identityHashCode(this); // <- error 15 16 System system = null; 17 system.identityHashCode(v); // <- error 18 system.identityHashCode(this); // <- error 19 20 System.identityHashCode(v); // <- error 21 System.identityHashCode(this); // <- error 22 23 java.lang.System.identityHashCode(v); // <- error 24 java.lang.System.identityHashCode(this); // <- error 25 } 26 } |