Skip to content

Commit

Permalink
8205626: Start of release updates for JDK 13
Browse files Browse the repository at this point in the history
8205393: Add SourceVersion.RELEASE_13
8205394: Add source 13 and target 13 to javac
8205645: Bump maximum recognized class file version to 57 for JDK 13
8214825: Update preview language features for start of JDK 13
Reviewed-by: erikj, alanb, mchung, mcimadamore, dholmes, smarks, jjg
  • Loading branch information
darcy committed Dec 13, 2018
1 parent 811dd2d commit 21e36b2
Show file tree
Hide file tree
Showing 106 changed files with 183 additions and 140 deletions.
8 changes: 4 additions & 4 deletions make/autoconf/version-numbers
Expand Up @@ -25,17 +25,17 @@

# Default version numbers to use unless overridden by configure

DEFAULT_VERSION_FEATURE=12
DEFAULT_VERSION_FEATURE=13
DEFAULT_VERSION_INTERIM=0
DEFAULT_VERSION_UPDATE=0
DEFAULT_VERSION_PATCH=0
DEFAULT_VERSION_EXTRA1=0
DEFAULT_VERSION_EXTRA2=0
DEFAULT_VERSION_EXTRA3=0
DEFAULT_VERSION_DATE=2019-03-19
DEFAULT_VERSION_CLASSFILE_MAJOR=56 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_DATE=2019-09-17
DEFAULT_VERSION_CLASSFILE_MAJOR=57 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="11 12"
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="11 12 13"

LAUNCHER_NAME=openjdk
PRODUCT_NAME=OpenJDK
Expand Down
4 changes: 2 additions & 2 deletions make/common/SetupJavaCompilers.gmk
Expand Up @@ -72,7 +72,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
JVM := $(JAVA_JAVAC), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -source 12 -target 12 --doclint-format html5 \
FLAGS := -source 13 -target 13 --doclint-format html5 \
-encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
Expand All @@ -82,7 +82,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
$(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
JVM := $(JAVA_JAVAC), \
JAVAC := $(NEW_JAVAC), \
FLAGS := -source 12 -target 12 \
FLAGS := -source 13 -target 13 \
-encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/classfile/classFileParser.cpp
Expand Up @@ -119,6 +119,8 @@

#define JAVA_12_VERSION 56

#define JAVA_13_VERSION 57

void ClassFileParser::set_class_bad_constant_seen(short bad_constant) {
assert((bad_constant == 19 || bad_constant == 20) && _major_version >= JAVA_9_VERSION,
"Unexpected bad constant pool entry");
Expand Down
Expand Up @@ -50,6 +50,7 @@ private Constants(){}
1.10 to 1.10.X 54,0
1.11 to 1.11.X 55,0
1.12 to 1.12.X 56,0
1.13 to 1.13.X 57,0
*/

public static final Package.Version JAVA_MIN_CLASS_VERSION =
Expand Down Expand Up @@ -79,6 +80,9 @@ private Constants(){}
public static final Package.Version JAVA12_MAX_CLASS_VERSION =
Package.Version.of(56, 00);

public static final Package.Version JAVA13_MAX_CLASS_VERSION =
Package.Version.of(57, 00);

public static final int JAVA_PACKAGE_MAGIC = 0xCAFED00D;

public static final Package.Version JAVA5_PACKAGE_VERSION =
Expand All @@ -95,7 +99,7 @@ private Constants(){}

// upper limit, should point to the latest class version
public static final Package.Version JAVA_MAX_CLASS_VERSION =
JAVA12_MAX_CLASS_VERSION;
JAVA13_MAX_CLASS_VERSION;

// upper limit should point to the latest package version, for version info!.
public static final Package.Version MAX_PACKAGE_VERSION =
Expand Down
Expand Up @@ -63,7 +63,7 @@
public final class ModuleInfo {

private final int JAVA_MIN_SUPPORTED_VERSION = 53;
private final int JAVA_MAX_SUPPORTED_VERSION = 56;
private final int JAVA_MAX_SUPPORTED_VERSION = 57;

private static final JavaLangModuleAccess JLMA
= SharedSecrets.getJavaLangModuleAccess();
Expand Down
Expand Up @@ -210,7 +210,7 @@ public ClassReader(
b = classFileBuffer;
// Check the class' major_version. This field is after the magic and minor_version fields, which
// use 4 and 2 bytes respectively.
if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V12) {
if (checkClassVersion && readShort(classFileOffset + 6) > Opcodes.V13) {
throw new IllegalArgumentException(
"Unsupported class file major version " + readShort(classFileOffset + 6));
}
Expand Down
Expand Up @@ -95,6 +95,7 @@ public interface Opcodes {
int V10 = 0 << 16 | 54;
int V11 = 0 << 16 | 55;
int V12 = 0 << 16 | 56;
int V13 = 0 << 16 | 57;

/**
* Version flag indicating that the class is using 'preview' features.
Expand Down
Expand Up @@ -59,6 +59,7 @@ public enum SourceVersion {
* 10: local-variable type inference (var)
* 11: local-variable syntax for lambda parameters
* 12: TBD
* 13: TBD
*/

/**
Expand Down Expand Up @@ -183,7 +184,15 @@ public enum SourceVersion {
*
* @since 12
*/
RELEASE_12;
RELEASE_12,

/**
* The version recognized by the Java Platform, Standard Edition
* 13.
*
* @since 13
*/
RELEASE_13;

// Note that when adding constants for newer releases, the
// behavior of latest() and latestSupported() must be updated too.
Expand All @@ -194,7 +203,7 @@ public enum SourceVersion {
* @return the latest source version that can be modeled
*/
public static SourceVersion latest() {
return RELEASE_12;
return RELEASE_13;
}

private static final SourceVersion latestSupported = getLatestSupported();
Expand All @@ -204,6 +213,8 @@ private static SourceVersion getLatestSupported() {
String specVersion = System.getProperty("java.specification.version");

switch (specVersion) {
case "13":
return RELEASE_13;
case "12":
return RELEASE_12;
case "11":
Expand Down
Expand Up @@ -32,7 +32,7 @@
/**
* A skeletal visitor for annotation values with default behavior
* appropriate for source versions {@link SourceVersion#RELEASE_9
* RELEASE_9} through {@link SourceVersion#RELEASE_12 RELEASE_12}.
* RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* <p> <b>WARNING:</b> The {@code AnnotationValueVisitor} interface
* implemented by this class may have methods added to it in the
Expand All @@ -59,7 +59,7 @@
* @see AbstractAnnotationValueVisitor8
* @since 9
*/
@SupportedSourceVersion(RELEASE_12)
@SupportedSourceVersion(RELEASE_13)
public abstract class AbstractAnnotationValueVisitor9<R, P> extends AbstractAnnotationValueVisitor8<R, P> {

/**
Expand Down
Expand Up @@ -34,7 +34,7 @@
/**
* A skeletal visitor of program elements with default behavior
* appropriate for source versions {@link SourceVersion#RELEASE_9
* RELEASE_9} through {@link SourceVersion#RELEASE_12 RELEASE_12}.
* RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* <p> <b>WARNING:</b> The {@code ElementVisitor} interface
* implemented by this class may have methods added to it in the
Expand Down Expand Up @@ -65,7 +65,7 @@
* @since 9
* @spec JPMS
*/
@SupportedSourceVersion(RELEASE_12)
@SupportedSourceVersion(RELEASE_13)
public abstract class AbstractElementVisitor9<R, P> extends AbstractElementVisitor8<R, P> {
/**
* Constructor for concrete subclasses to call.
Expand Down
Expand Up @@ -33,7 +33,7 @@
/**
* A skeletal visitor of types with default behavior appropriate for
* source versions {@link SourceVersion#RELEASE_9 RELEASE_9} through
* {@link SourceVersion#RELEASE_12 RELEASE_12}.
* {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* <p> <b>WARNING:</b> The {@code TypeVisitor} interface implemented
* by this class may have methods added to it in the future to
Expand Down Expand Up @@ -63,7 +63,7 @@
* @see AbstractTypeVisitor8
* @since 9
*/
@SupportedSourceVersion(RELEASE_12)
@SupportedSourceVersion(RELEASE_13)
public abstract class AbstractTypeVisitor9<R, P> extends AbstractTypeVisitor8<R, P> {
/**
* Constructor for concrete subclasses to call.
Expand Down
Expand Up @@ -34,7 +34,7 @@
* A visitor of program elements based on their {@linkplain
* ElementKind kind} with default behavior appropriate for source
* versions {@link SourceVersion#RELEASE_9 RELEASE_9} through {@link
* SourceVersion#RELEASE_12 RELEASE_12}.
* SourceVersion#RELEASE_13 RELEASE_13}.
*
* For {@linkplain
* Element elements} <code><i>Xyz</i></code> that may have more than one
Expand Down Expand Up @@ -80,7 +80,7 @@
* @since 9
* @spec JPMS
*/
@SupportedSourceVersion(RELEASE_12)
@SupportedSourceVersion(RELEASE_13)
public class ElementKindVisitor9<R, P> extends ElementKindVisitor8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
Expand Down
Expand Up @@ -34,7 +34,7 @@
/**
* A scanning visitor of program elements with default behavior
* appropriate for source versions {@link SourceVersion#RELEASE_9
* RELEASE_9} through {@link SourceVersion#RELEASE_12 RELEASE_12}.
* RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* The <code>visit<i>Xyz</i></code> methods in this
* class scan their component elements by calling {@code scan} on
Expand Down Expand Up @@ -92,7 +92,7 @@
* @since 9
* @spec JPMS
*/
@SupportedSourceVersion(RELEASE_12)
@SupportedSourceVersion(RELEASE_13)
public class ElementScanner9<R, P> extends ElementScanner8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
Expand Down
Expand Up @@ -32,7 +32,7 @@
/**
* A simple visitor for annotation values with default behavior
* appropriate for source versions {@link SourceVersion#RELEASE_9
* RELEASE_9} through {@link SourceVersion#RELEASE_12 RELEASE_12}.
* RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* Visit methods call {@link #defaultAction
* defaultAction} passing their arguments to {@code defaultAction}'s
Expand Down Expand Up @@ -68,7 +68,7 @@
* @see SimpleAnnotationValueVisitor8
* @since 9
*/
@SupportedSourceVersion(RELEASE_12)
@SupportedSourceVersion(RELEASE_13)
public class SimpleAnnotationValueVisitor9<R, P> extends SimpleAnnotationValueVisitor8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
Expand Down
Expand Up @@ -33,7 +33,7 @@
/**
* A simple visitor of program elements with default behavior
* appropriate for source versions {@link SourceVersion#RELEASE_9
* RELEASE_9} through {@link SourceVersion#RELEASE_12 RELEASE_12}.
* RELEASE_9} through {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* Visit methods corresponding to {@code RELEASE_9} and earlier
* language constructs call {@link #defaultAction defaultAction},
Expand Down Expand Up @@ -73,7 +73,7 @@
* @since 9
* @spec JPMS
*/
@SupportedSourceVersion(RELEASE_12)
@SupportedSourceVersion(RELEASE_13)
public class SimpleElementVisitor9<R, P> extends SimpleElementVisitor8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
Expand Down
Expand Up @@ -33,7 +33,7 @@
/**
* A simple visitor of types with default behavior appropriate for
* source versions {@link SourceVersion#RELEASE_9 RELEASE_9} through
* {@link SourceVersion#RELEASE_12 RELEASE_12}.
* {@link SourceVersion#RELEASE_13 RELEASE_13}.
*
* Visit methods corresponding to {@code RELEASE_9} and earlier
* language constructs call {@link #defaultAction defaultAction},
Expand Down Expand Up @@ -73,7 +73,7 @@
* @see SimpleTypeVisitor8
* @since 9
*/
@SupportedSourceVersion(RELEASE_12)
@SupportedSourceVersion(RELEASE_13)
public class SimpleTypeVisitor9<R, P> extends SimpleTypeVisitor8<R, P> {
/**
* Constructor for concrete subclasses; uses {@code null} for the
Expand Down
Expand Up @@ -34,7 +34,7 @@
* A visitor of types based on their {@linkplain TypeKind kind} with
* default behavior appropriate for source versions {@link
* SourceVersion#RELEASE_9 RELEASE_9} through {@link
* SourceVersion#RELEASE_12 RELEASE_12}.
* SourceVersion#RELEASE_13 RELEASE_13}.
*
* For {@linkplain
* TypeMirror types} <code><i>Xyz</i></code> that may have more than one
Expand Down Expand Up @@ -77,7 +77,7 @@
* @see TypeKindVisitor8
* @since 9
*/
@SupportedSourceVersion(RELEASE_12)
@SupportedSourceVersion(RELEASE_13)
public class TypeKindVisitor9<R, P> extends TypeKindVisitor8<R, P> {
/**
* Constructor for concrete subclasses to call; uses {@code null}
Expand Down
Expand Up @@ -85,7 +85,10 @@ public enum Source {
JDK11("11"),

/** 12 covers the to be determined language features that will be added in JDK 12. */
JDK12("12");
JDK12("12"),

/** 13 covers the to be determined language features that will be added in JDK 13. */
JDK13("13");

private static final Context.Key<Source> sourceKey = new Context.Key<>();

Expand Down Expand Up @@ -136,6 +139,7 @@ public boolean isSupported() {
}

public Target requiredTarget() {
if (this.compareTo(JDK13) >= 0) return Target.JDK1_13;
if (this.compareTo(JDK12) >= 0) return Target.JDK1_12;
if (this.compareTo(JDK11) >= 0) return Target.JDK1_11;
if (this.compareTo(JDK10) >= 0) return Target.JDK1_10;
Expand Down Expand Up @@ -182,10 +186,10 @@ public enum Feature {
LOCAL_VARIABLE_TYPE_INFERENCE(JDK10),
VAR_SYNTAX_IMPLICIT_LAMBDAS(JDK11, Fragments.FeatureVarSyntaxInImplicitLambda, DiagKind.PLURAL),
IMPORT_ON_DEMAND_OBSERVABLE_PACKAGES(JDK1_2, JDK8),
SWITCH_MULTIPLE_CASE_LABELS(JDK12, Fragments.FeatureMultipleCaseLabels, DiagKind.PLURAL),
SWITCH_RULE(JDK12, Fragments.FeatureSwitchRules, DiagKind.PLURAL),
SWITCH_EXPRESSION(JDK12, Fragments.FeatureSwitchExpressions, DiagKind.PLURAL),
RAW_STRING_LITERALS(JDK12, Fragments.FeatureRawStringLiterals, DiagKind.PLURAL);
SWITCH_MULTIPLE_CASE_LABELS(JDK13, Fragments.FeatureMultipleCaseLabels, DiagKind.PLURAL),
SWITCH_RULE(JDK13, Fragments.FeatureSwitchRules, DiagKind.PLURAL),
SWITCH_EXPRESSION(JDK13, Fragments.FeatureSwitchExpressions, DiagKind.PLURAL),
RAW_STRING_LITERALS(JDK13, Fragments.FeatureRawStringLiterals, DiagKind.PLURAL);

enum DiagKind {
NORMAL,
Expand Down Expand Up @@ -270,6 +274,8 @@ public static SourceVersion toSourceVersion(Source source) {
return RELEASE_11;
case JDK12:
return RELEASE_12;
case JDK13:
return RELEASE_13;
default:
return null;
}
Expand Down
Expand Up @@ -116,7 +116,8 @@ public enum Version {
V53(53, 0), // JDK 1.9: modules, indy string concat
V54(54, 0), // JDK 10
V55(55, 0), // JDK 11: constant dynamic, nest mates
V56(56, 0); // JDK 12
V56(56, 0), // JDK 12
V57(57, 0); // JDK 13
Version(int major, int minor) {
this.major = major;
this.minor = minor;
Expand Down
Expand Up @@ -40,9 +40,9 @@
* deletion without notice.</b>
*/
public enum Profile {
COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12),
COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12),
COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12),
COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13),
COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13),
COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10, Target.JDK1_11, Target.JDK1_12, Target.JDK1_13),

DEFAULT {
@Override
Expand Down
Expand Up @@ -70,7 +70,10 @@ public enum Target {
JDK1_11("11", 55, 0),

/** JDK 12. */
JDK1_12("12", 56, 0);
JDK1_12("12", 56, 0),

/** JDK 13. */
JDK1_13("13", 57, 0);

private static final Context.Key<Target> targetKey = new Context.Key<>();

Expand Down
Expand Up @@ -55,7 +55,7 @@
* deletion without notice.</b>
*/
@SupportedAnnotationTypes("*")
@SupportedSourceVersion(SourceVersion.RELEASE_12)
@SupportedSourceVersion(SourceVersion.RELEASE_13)
public class PrintingProcessor extends AbstractProcessor {
PrintWriter writer;

Expand Down

0 comments on commit 21e36b2

Please sign in to comment.