8217405: rmic should reject class files with preview features enabled
Reviewed-by: lancea, alanb
This commit is contained in:
parent
a8e94de188
commit
528c411de7
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -122,6 +122,13 @@ class BinaryClass extends ClassDefinition implements Constants {
|
||||
sun.tools.javac.Main.getText(
|
||||
"javac.err.version.too.old",
|
||||
String.valueOf(version)));
|
||||
} else if ((version >= JAVA_MIN_PREVIEW_MAJOR_VERSION)
|
||||
&& (minor_version == JAVA_PREVIEW_MINOR_VERSION)) {
|
||||
// reject all class files that have preview features enabled
|
||||
throw new ClassFormatError(
|
||||
sun.tools.javac.Main.getText(
|
||||
"javac.err.version.preview",
|
||||
version+"."+minor_version));
|
||||
} else if ((version > JAVA_MAX_SUPPORTED_VERSION)
|
||||
|| (version == JAVA_MAX_SUPPORTED_VERSION
|
||||
&& minor_version > JAVA_MAX_SUPPORTED_MINOR_VERSION)) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -69,6 +69,8 @@ public interface RuntimeConstants {
|
||||
int JAVA_MIN_SUPPORTED_VERSION = 45;
|
||||
int JAVA_MAX_SUPPORTED_VERSION = 57;
|
||||
int JAVA_MAX_SUPPORTED_MINOR_VERSION = 0;
|
||||
int JAVA_MIN_PREVIEW_MAJOR_VERSION = 55; // preview intro'd in JDK 11
|
||||
int JAVA_PREVIEW_MINOR_VERSION = 0xffff;
|
||||
|
||||
/* Generate class file version for 1.1 by default */
|
||||
int JAVA_DEFAULT_VERSION = 45;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
#
|
||||
# This code is free software; you can redistribute it and/or modify it
|
||||
@ -579,6 +579,9 @@ javac.err.version.too.old=\
|
||||
javac.err.version.too.recent=\
|
||||
The major.minor version ''{0}'' is too recent for this tool \
|
||||
to understand.
|
||||
javac.err.version.preview=\
|
||||
The major.minor version ''{0}'' indicates the class was compiled with \
|
||||
preview features enabled, which this tool does not support.
|
||||
#
|
||||
benv.parsed_in=[parsed {0} in {1} ms]
|
||||
benv.loaded_in=[loaded {0} in {1} ms]
|
||||
|
Loading…
Reference in New Issue
Block a user