< prev index next >
langtools/test/tools/javac/valhalla/minimalvalues/CheckFinal.java
Print this page
*** 1,18 ****
/*
* @test /nodynamiccopyright/
* @summary Value types and their instance fields must be final
! * @modules java.base/jvm.internal.value
! * @compile/fail/ref=CheckFinal.out -XDrawDiagnostics -Werror -Xlint:values CheckFinal.java
*/
! @jvm.internal.value.ValueCapableClass
class CheckFinal { // <- error
int x; // <- error
void f(int x) { // <- ok
int y; // <- ok
! @jvm.internal.value.ValueCapableClass
final class CheckLocalFinal {
int x; // <- error.
}
}
final Object o = new Object() { int i; }; // <- ok
--- 1,18 ----
/*
* @test /nodynamiccopyright/
* @summary Value types and their instance fields must be final
! * @modules jdk.incubator.mvt
! * @compile/fail/ref=CheckFinal.out --should-stop:ifError=PARSE -XDrawDiagnostics -Werror -Xlint:values CheckFinal.java
*/
! @jdk.incubator.mvt.ValueCapableClass
class CheckFinal { // <- error
int x; // <- error
void f(int x) { // <- ok
int y; // <- ok
! @jdk.incubator.mvt.ValueCapableClass
final class CheckLocalFinal {
int x; // <- error.
}
}
final Object o = new Object() { int i; }; // <- ok
< prev index next >