mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-01 14:08:24 +00:00
8225056: VM support for sealed classes 8227044: javax.lang.model for sealed classes 8227045: Preview APIs support for sealed classes 8227047: Javadoc for sealed types 8245854: JVM TI Specification for sealed classes Co-authored-by: Harold Seigel <harold.seigel@oracle.com> Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com> Reviewed-by: mcimadamore, forax, darcy, dholmes, jlahoda, lfoltan, mchung, sspitsyn, vromero
22 lines
524 B
Java
22 lines
524 B
Java
/*
|
|
* @test /nodynamiccopyright/
|
|
* @bug 5009574
|
|
* @summary verify an enum type can't be directly subclassed
|
|
* @author Joseph D. Darcy
|
|
*
|
|
* @compile/fail/ref=FauxEnum3.out -XDrawDiagnostics FauxEnum3.java
|
|
* @compile/fail/ref=FauxEnum3.preview.out -XDrawDiagnostics --enable-preview -source ${jdk.version} FauxEnum3.java
|
|
*/
|
|
|
|
public class FauxEnum3 extends SpecializedEnum {
|
|
}
|
|
|
|
enum SpecializedEnum {
|
|
RED {
|
|
boolean special() {return true;}
|
|
},
|
|
GREEN,
|
|
BLUE;
|
|
boolean special() {return false;}
|
|
}
|