mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8028544: Add SourceVersion.RELEASE_10
8028546: Add -source 10 and -target 10 to javac Reviewed-by: jjg, smarks
This commit is contained in:
parent
a4ed1aefb8
commit
874b8cdc74
19 changed files with 100 additions and 75 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -56,6 +56,7 @@ public enum SourceVersion {
|
||||||
* 1.7: diamond syntax, try-with-resources, etc.
|
* 1.7: diamond syntax, try-with-resources, etc.
|
||||||
* 1.8: lambda expressions and default methods
|
* 1.8: lambda expressions and default methods
|
||||||
* 9: modules, small cleanups to 1.7 and 1.8 changes
|
* 9: modules, small cleanups to 1.7 and 1.8 changes
|
||||||
|
* 10: to-be-determined changes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,7 +151,15 @@ public enum SourceVersion {
|
||||||
*
|
*
|
||||||
* @since 9
|
* @since 9
|
||||||
*/
|
*/
|
||||||
RELEASE_9;
|
RELEASE_9,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The version recognized by the Java Platform, Standard Edition
|
||||||
|
* 10.
|
||||||
|
*
|
||||||
|
* @since 10
|
||||||
|
*/
|
||||||
|
RELEASE_10;
|
||||||
|
|
||||||
// Note that when adding constants for newer releases, the
|
// Note that when adding constants for newer releases, the
|
||||||
// behavior of latest() and latestSupported() must be updated too.
|
// behavior of latest() and latestSupported() must be updated too.
|
||||||
|
@ -161,7 +170,7 @@ public enum SourceVersion {
|
||||||
* @return the latest source version that can be modeled
|
* @return the latest source version that can be modeled
|
||||||
*/
|
*/
|
||||||
public static SourceVersion latest() {
|
public static SourceVersion latest() {
|
||||||
return RELEASE_9;
|
return RELEASE_10;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final SourceVersion latestSupported = getLatestSupported();
|
private static final SourceVersion latestSupported = getLatestSupported();
|
||||||
|
@ -171,6 +180,8 @@ public enum SourceVersion {
|
||||||
String specVersion = System.getProperty("java.specification.version");
|
String specVersion = System.getProperty("java.specification.version");
|
||||||
|
|
||||||
switch (specVersion) {
|
switch (specVersion) {
|
||||||
|
case "10":
|
||||||
|
return RELEASE_10;
|
||||||
case "9":
|
case "9":
|
||||||
case "1.9":
|
case "1.9":
|
||||||
return RELEASE_9;
|
return RELEASE_9;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -70,8 +70,11 @@ public enum Source {
|
||||||
/** 1.8 lambda expressions and default methods. */
|
/** 1.8 lambda expressions and default methods. */
|
||||||
JDK1_8("1.8"),
|
JDK1_8("1.8"),
|
||||||
|
|
||||||
/** 1.9 covers the to be determined language features that will be added in JDK 9. */
|
/** 1.9 modularity. */
|
||||||
JDK1_9("1.9");
|
JDK1_9("1.9"),
|
||||||
|
|
||||||
|
/** 1.10 covers the to be determined language features that will be added in JDK 10. */
|
||||||
|
JDK1_10("1.10");
|
||||||
|
|
||||||
private static final Context.Key<Source> sourceKey = new Context.Key<>();
|
private static final Context.Key<Source> sourceKey = new Context.Key<>();
|
||||||
|
|
||||||
|
@ -99,6 +102,7 @@ public enum Source {
|
||||||
tab.put("7", JDK1_7); // Make 7 an alias for 1.7
|
tab.put("7", JDK1_7); // Make 7 an alias for 1.7
|
||||||
tab.put("8", JDK1_8); // Make 8 an alias for 1.8
|
tab.put("8", JDK1_8); // Make 8 an alias for 1.8
|
||||||
tab.put("9", JDK1_9); // Make 9 an alias for 1.9
|
tab.put("9", JDK1_9); // Make 9 an alias for 1.9
|
||||||
|
tab.put("10", JDK1_10); // Make 10 an alias for 1.10
|
||||||
}
|
}
|
||||||
|
|
||||||
private Source(String name) {
|
private Source(String name) {
|
||||||
|
@ -116,6 +120,7 @@ public enum Source {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Target requiredTarget() {
|
public Target requiredTarget() {
|
||||||
|
if (this.compareTo(JDK1_10) >= 0) return Target.JDK1_10;
|
||||||
if (this.compareTo(JDK1_9) >= 0) return Target.JDK1_9;
|
if (this.compareTo(JDK1_9) >= 0) return Target.JDK1_9;
|
||||||
if (this.compareTo(JDK1_8) >= 0) return Target.JDK1_8;
|
if (this.compareTo(JDK1_8) >= 0) return Target.JDK1_8;
|
||||||
if (this.compareTo(JDK1_7) >= 0) return Target.JDK1_7;
|
if (this.compareTo(JDK1_7) >= 0) return Target.JDK1_7;
|
||||||
|
@ -240,6 +245,8 @@ public enum Source {
|
||||||
return RELEASE_8;
|
return RELEASE_8;
|
||||||
case JDK1_9:
|
case JDK1_9:
|
||||||
return RELEASE_9;
|
return RELEASE_9;
|
||||||
|
case JDK1_10:
|
||||||
|
return RELEASE_10;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -40,9 +40,9 @@ import static com.sun.tools.javac.main.Option.PROFILE;
|
||||||
* deletion without notice.</b>
|
* deletion without notice.</b>
|
||||||
*/
|
*/
|
||||||
public enum Profile {
|
public enum Profile {
|
||||||
COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9),
|
COMPACT1("compact1", 1, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
|
||||||
COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9),
|
COMPACT2("compact2", 2, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
|
||||||
COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9),
|
COMPACT3("compact3", 3, Target.JDK1_8, Target.JDK1_9, Target.JDK1_10),
|
||||||
|
|
||||||
DEFAULT {
|
DEFAULT {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -61,7 +61,10 @@ public enum Target {
|
||||||
JDK1_8("1.8", 52, 0),
|
JDK1_8("1.8", 52, 0),
|
||||||
|
|
||||||
/** JDK 9. */
|
/** JDK 9. */
|
||||||
JDK1_9("1.9", 53, 0);
|
JDK1_9("1.9", 53, 0),
|
||||||
|
|
||||||
|
/** JDK 10, initially an alias for 9 */
|
||||||
|
JDK1_10("1.10", 53, 0);
|
||||||
|
|
||||||
private static final Context.Key<Target> targetKey = new Context.Key<>();
|
private static final Context.Key<Target> targetKey = new Context.Key<>();
|
||||||
|
|
||||||
|
@ -91,6 +94,7 @@ public enum Target {
|
||||||
tab.put("7", JDK1_7);
|
tab.put("7", JDK1_7);
|
||||||
tab.put("8", JDK1_8);
|
tab.put("8", JDK1_8);
|
||||||
tab.put("9", JDK1_9);
|
tab.put("9", JDK1_9);
|
||||||
|
tab.put("10", JDK1_10);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final String name;
|
public final String name;
|
||||||
|
@ -102,7 +106,7 @@ public enum Target {
|
||||||
this.minorVersion = minorVersion;
|
this.minorVersion = minorVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final Target DEFAULT = JDK1_9;
|
public static final Target DEFAULT = values()[values().length - 1];
|
||||||
|
|
||||||
public static Target lookup(String name) {
|
public static Target lookup(String name) {
|
||||||
return tab.get(name);
|
return tab.get(name);
|
||||||
|
@ -146,5 +150,4 @@ public enum Target {
|
||||||
public String multiReleaseValue() {
|
public String multiReleaseValue() {
|
||||||
return Integer.toString(this.ordinal() - Target.JDK1_1.ordinal() + 1);
|
return Integer.toString(this.ordinal() - Target.JDK1_1.ordinal() + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -90,6 +90,8 @@ public class JDKPlatformProvider implements PlatformProvider {
|
||||||
} catch (IOException | ProviderNotFoundException ex) {
|
} catch (IOException | ProviderNotFoundException ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Workaround until full support for --release 9 distinct from --release 10
|
||||||
|
SUPPORTED_JAVA_PLATFORM_VERSIONS.add(targetNumericVersion(Target.JDK1_9));
|
||||||
SUPPORTED_JAVA_PLATFORM_VERSIONS.add(targetNumericVersion(Target.DEFAULT));
|
SUPPORTED_JAVA_PLATFORM_VERSIONS.add(targetNumericVersion(Target.DEFAULT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +110,9 @@ public class JDKPlatformProvider implements PlatformProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<Path> getPlatformPath() {
|
public Collection<Path> getPlatformPath() {
|
||||||
if (Target.lookup(version) == Target.DEFAULT) {
|
// Comparison should be == Target.DEFAULT once --release 9
|
||||||
|
// is distinct from 10
|
||||||
|
if (Target.lookup(version).compareTo(Target.JDK1_9) >= 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -52,7 +52,7 @@ import com.sun.tools.javac.util.StringUtils;
|
||||||
* deletion without notice.</b>
|
* deletion without notice.</b>
|
||||||
*/
|
*/
|
||||||
@SupportedAnnotationTypes("*")
|
@SupportedAnnotationTypes("*")
|
||||||
@SupportedSourceVersion(SourceVersion.RELEASE_9)
|
@SupportedSourceVersion(SourceVersion.RELEASE_10)
|
||||||
public class PrintingProcessor extends AbstractProcessor {
|
public class PrintingProcessor extends AbstractProcessor {
|
||||||
PrintWriter writer;
|
PrintWriter writer;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -50,7 +50,7 @@ import javax.lang.model.util.Elements;
|
||||||
|
|
||||||
import javax.tools.Diagnostic;
|
import javax.tools.Diagnostic;
|
||||||
|
|
||||||
import static javax.lang.model.SourceVersion.RELEASE_9;
|
import static javax.lang.model.SourceVersion.RELEASE_10;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Annotation processor for the Deprecation Scanner tool.
|
* Annotation processor for the Deprecation Scanner tool.
|
||||||
|
@ -58,7 +58,7 @@ import static javax.lang.model.SourceVersion.RELEASE_9;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@SupportedAnnotationTypes("java.lang.Deprecated")
|
@SupportedAnnotationTypes("java.lang.Deprecated")
|
||||||
@SupportedSourceVersion(RELEASE_9)
|
@SupportedSourceVersion(RELEASE_10)
|
||||||
public class LoadProc extends AbstractProcessor {
|
public class LoadProc extends AbstractProcessor {
|
||||||
Elements elements;
|
Elements elements;
|
||||||
Messager messager;
|
Messager messager;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -101,7 +101,7 @@ public class Main implements DiagnosticListener<JavaFileObject> {
|
||||||
// Keep these updated manually until there's a compiler API
|
// Keep these updated manually until there's a compiler API
|
||||||
// that allows querying of supported releases.
|
// that allows querying of supported releases.
|
||||||
final Set<String> releasesWithoutForRemoval = Set.of("6", "7", "8");
|
final Set<String> releasesWithoutForRemoval = Set.of("6", "7", "8");
|
||||||
final Set<String> releasesWithForRemoval = Set.of("9");
|
final Set<String> releasesWithForRemoval = Set.of("9", "10");
|
||||||
|
|
||||||
final Set<String> validReleases;
|
final Set<String> validReleases;
|
||||||
{
|
{
|
||||||
|
@ -353,14 +353,14 @@ public class Main implements DiagnosticListener<JavaFileObject> {
|
||||||
* Process classes from a particular JDK release, using only information
|
* Process classes from a particular JDK release, using only information
|
||||||
* in this JDK.
|
* in this JDK.
|
||||||
*
|
*
|
||||||
* @param release "6", "7", "8", or "9"
|
* @param release "6", "7", "8", "9", or "10"
|
||||||
* @param classes collection of classes to process, may be empty
|
* @param classes collection of classes to process, may be empty
|
||||||
* @return success value
|
* @return success value
|
||||||
*/
|
*/
|
||||||
boolean processRelease(String release, Collection<String> classes) throws IOException {
|
boolean processRelease(String release, Collection<String> classes) throws IOException {
|
||||||
options.addAll(List.of("--release", release));
|
options.addAll(List.of("--release", release));
|
||||||
|
|
||||||
if (release.equals("9")) {
|
if (release.equals("9") || release.equals("10")) {
|
||||||
List<String> rootMods = List.of("java.se", "java.se.ee");
|
List<String> rootMods = List.of("java.se", "java.se.ee");
|
||||||
TraverseProc proc = new TraverseProc(rootMods);
|
TraverseProc proc = new TraverseProc(rootMods);
|
||||||
JavaCompiler.CompilationTask task =
|
JavaCompiler.CompilationTask task =
|
||||||
|
@ -484,7 +484,7 @@ public class Main implements DiagnosticListener<JavaFileObject> {
|
||||||
String dir = null;
|
String dir = null;
|
||||||
String jar = null;
|
String jar = null;
|
||||||
String jdkHome = null;
|
String jdkHome = null;
|
||||||
String release = "9";
|
String release = "10";
|
||||||
List<String> loadClasses = new ArrayList<>();
|
List<String> loadClasses = new ArrayList<>();
|
||||||
String csvFile = null;
|
String csvFile = null;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -52,7 +52,7 @@ public class T6265137 {
|
||||||
String srcdir = System.getProperty("test.src");
|
String srcdir = System.getProperty("test.src");
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcdir, "T6265137a.java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcdir, "T6265137a.java")));
|
||||||
javac.getTask(null, fm, dl, Arrays.asList("-target","9"), null, files).call();
|
javac.getTask(null, fm, dl, Arrays.asList("-target","10"), null, files).call();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 6395981 6458819 7025784 8028543
|
* @bug 6395981 6458819 7025784 8028543 8028544
|
||||||
* @summary JavaCompilerTool and Tool must specify version of JLS and JVMS
|
* @summary JavaCompilerTool and Tool must specify version of JLS and JVMS
|
||||||
* @author Peter von der Ah\u00e9
|
* @author Peter von der Ah\u00e9
|
||||||
* @modules java.compiler
|
* @modules java.compiler
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
* @run main/fail T6395981
|
* @run main/fail T6395981
|
||||||
* @run main/fail T6395981 RELEASE_3 RELEASE_5 RELEASE_6
|
* @run main/fail T6395981 RELEASE_3 RELEASE_5 RELEASE_6
|
||||||
* @run main/fail T6395981 RELEASE_0 RELEASE_1 RELEASE_2 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6
|
* @run main/fail T6395981 RELEASE_0 RELEASE_1 RELEASE_2 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6
|
||||||
* @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9
|
* @run main T6395981 RELEASE_3 RELEASE_4 RELEASE_5 RELEASE_6 RELEASE_7 RELEASE_8 RELEASE_9 RELEASE_10
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -27,7 +27,8 @@
|
||||||
* @summary If an error is produced by an annotation processor, the code should not be Attred, \
|
* @summary If an error is produced by an annotation processor, the code should not be Attred, \
|
||||||
* unless requested
|
* unless requested
|
||||||
* @modules jdk.compiler
|
* @modules jdk.compiler
|
||||||
* @compile StopAfterError.java
|
* @library /tools/javac/lib
|
||||||
|
* @build StopAfterError JavacTestingAbstractProcessor
|
||||||
* @compile/fail/ref=StopAfterError.out -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
|
* @compile/fail/ref=StopAfterError.out -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
|
||||||
* @compile/fail/ref=StopAfterError.out -XDshould-stop.ifError=PROCESS -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
|
* @compile/fail/ref=StopAfterError.out -XDshould-stop.ifError=PROCESS -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
|
||||||
* @compile/fail/ref=StopAfterErrorContinue.out -XDshould-stop.ifError=ATTR -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
|
* @compile/fail/ref=StopAfterErrorContinue.out -XDshould-stop.ifError=ATTR -XDrawDiagnostics -processor StopAfterError StopAfterErrorAux.java
|
||||||
|
@ -42,8 +43,7 @@ import javax.lang.model.SourceVersion;
|
||||||
import javax.lang.model.element.TypeElement;
|
import javax.lang.model.element.TypeElement;
|
||||||
import javax.tools.Diagnostic.Kind;
|
import javax.tools.Diagnostic.Kind;
|
||||||
|
|
||||||
@SupportedAnnotationTypes("*")
|
public class StopAfterError extends JavacTestingAbstractProcessor {
|
||||||
public class StopAfterError extends AbstractProcessor {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
||||||
|
@ -52,10 +52,4 @@ public class StopAfterError extends AbstractProcessor {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SourceVersion getSupportedSourceVersion() {
|
|
||||||
return SourceVersion.latestSupported();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -26,7 +26,8 @@
|
||||||
* @bug 8166700
|
* @bug 8166700
|
||||||
* @summary Check that local classes originating in static initializer can be loaded properly.
|
* @summary Check that local classes originating in static initializer can be loaded properly.
|
||||||
* @modules jdk.compiler
|
* @modules jdk.compiler
|
||||||
* @build LocalTest$1Local LocalTest$2Local LocalTest$3Local LocalTest$4Local LocalTest$5Local LocalTest
|
* @library /tools/javac/lib
|
||||||
|
* @build LocalTest$1Local LocalTest$2Local LocalTest$3Local LocalTest$4Local LocalTest$5Local LocalTest JavacTestingAbstractProcessor
|
||||||
* @compile LocalClassesModel.java
|
* @compile LocalClassesModel.java
|
||||||
* @compile/process/ref=LocalClassesModel.out -processor LocalClassesModel LocalTest$1Local LocalTest$2Local LocalTest$3Local LocalTest$4Local LocalTest$5Local LocalTest
|
* @compile/process/ref=LocalClassesModel.out -processor LocalClassesModel LocalTest$1Local LocalTest$2Local LocalTest$3Local LocalTest$4Local LocalTest$5Local LocalTest
|
||||||
*/
|
*/
|
||||||
|
@ -42,8 +43,7 @@ import javax.lang.model.element.TypeElement;
|
||||||
import javax.lang.model.element.VariableElement;
|
import javax.lang.model.element.VariableElement;
|
||||||
import javax.lang.model.util.ElementFilter;
|
import javax.lang.model.util.ElementFilter;
|
||||||
|
|
||||||
@SupportedAnnotationTypes("*")
|
public class LocalClassesModel extends JavacTestingAbstractProcessor {
|
||||||
public class LocalClassesModel extends AbstractProcessor {
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
||||||
|
@ -65,9 +65,4 @@ public class LocalClassesModel extends AbstractProcessor {
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public SourceVersion getSupportedSourceVersion() {
|
|
||||||
return SourceVersion.latestSupported();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 7025809 8028543 6415644
|
* @bug 7025809 8028543 6415644 8028544
|
||||||
* @summary Test latest, latestSupported, underscore as keyword, etc.
|
* @summary Test latest, latestSupported, underscore as keyword, etc.
|
||||||
* @author Joseph D. Darcy
|
* @author Joseph D. Darcy
|
||||||
* @modules java.compiler
|
* @modules java.compiler
|
||||||
|
@ -44,7 +44,7 @@ public class TestSourceVersion {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void testLatestSupported() {
|
private static void testLatestSupported() {
|
||||||
if (SourceVersion.latest() != RELEASE_9 ||
|
if (SourceVersion.latest() != RELEASE_10 ||
|
||||||
SourceVersion.latestSupported() != RELEASE_9)
|
SourceVersion.latestSupported() != RELEASE_9)
|
||||||
throw new RuntimeException("Unexpected release value(s) found:\n" +
|
throw new RuntimeException("Unexpected release value(s) found:\n" +
|
||||||
"latest:\t" + SourceVersion.latest() + "\n" +
|
"latest:\t" + SourceVersion.latest() + "\n" +
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -24,7 +24,8 @@
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @modules jdk.compiler
|
* @modules jdk.compiler
|
||||||
* @build NestedTypeVars
|
* @library /tools/javac/lib
|
||||||
|
* @build NestedTypeVars JavacTestingAbstractProcessor
|
||||||
* @compile/process/ref=NestedTypeVars.out -processor NestedTypeVars Test$1L1$L2$1L3$L4$L5 Test$1L1$CCheck Test$1L1 Test$1CCheck Test$CCheck Test
|
* @compile/process/ref=NestedTypeVars.out -processor NestedTypeVars Test$1L1$L2$1L3$L4$L5 Test$1L1$CCheck Test$1L1 Test$1CCheck Test$CCheck Test
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -44,8 +45,7 @@ import javax.lang.model.type.TypeMirror;
|
||||||
import javax.lang.model.type.TypeVariable;
|
import javax.lang.model.type.TypeVariable;
|
||||||
import javax.lang.model.util.ElementFilter;
|
import javax.lang.model.util.ElementFilter;
|
||||||
|
|
||||||
@SupportedAnnotationTypes("*")
|
public class NestedTypeVars extends JavacTestingAbstractProcessor {
|
||||||
public class NestedTypeVars extends AbstractProcessor{
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
||||||
|
@ -102,12 +102,6 @@ public class NestedTypeVars extends AbstractProcessor{
|
||||||
throw new IllegalStateException("Unexpected element: " + el + "(" + el.getKind() + ")");
|
throw new IllegalStateException("Unexpected element: " + el + "(" + el.getKind() + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
|
||||||
public SourceVersion getSupportedSourceVersion() {
|
|
||||||
return SourceVersion.latestSupported();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class Test<T1, C> {
|
class Test<T1, C> {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -35,6 +35,7 @@
|
||||||
* @compile/ref=gold_unsp_warn.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Xlint:-options -Aunsupported HelloWorld.java
|
* @compile/ref=gold_unsp_warn.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_6 -source 1.6 -Xlint:-options -Aunsupported HelloWorld.java
|
||||||
* @compile/ref=gold_sv_none.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_7 -source 1.7 -Xlint:-options HelloWorld.java
|
* @compile/ref=gold_sv_none.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_7 -source 1.7 -Xlint:-options HelloWorld.java
|
||||||
* @compile/ref=gold_sv_none.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_8 -source 1.8 -Xlint:-options HelloWorld.java
|
* @compile/ref=gold_sv_none.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_8 -source 1.8 -Xlint:-options HelloWorld.java
|
||||||
|
* @compile/ref=gold_sv_none.out -XDrawDiagnostics -processor TestSourceVersionWarnings -proc:only -ASourceVersion=RELEASE_9 -source 1.9 -Xlint:-options HelloWorld.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -148,6 +148,7 @@ public class ProfileOptionTest {
|
||||||
error("unexpected exception from compiler: " + ise);
|
error("unexpected exception from compiler: " + ise);
|
||||||
break;
|
break;
|
||||||
case JDK1_9:
|
case JDK1_9:
|
||||||
|
case JDK1_10:
|
||||||
if (p == Profile.DEFAULT)
|
if (p == Profile.DEFAULT)
|
||||||
break;
|
break;
|
||||||
if (ise == null)
|
if (ise == null)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -26,7 +26,8 @@
|
||||||
* @bug 8068737
|
* @bug 8068737
|
||||||
* @summary Tests ArrayType.toString with type annotations present
|
* @summary Tests ArrayType.toString with type annotations present
|
||||||
* @modules jdk.compiler/com.sun.tools.javac.code
|
* @modules jdk.compiler/com.sun.tools.javac.code
|
||||||
* @build ArrayTypeToString
|
* @library /tools/javac/lib
|
||||||
|
* @build ArrayTypeToString JavacTestingAbstractProcessor
|
||||||
* @compile/ref=ArrayTypeToString.out -XDaccessInternalAPI -XDrawDiagnostics -processor ArrayTypeToString -proc:only ArrayTypeToString.java
|
* @compile/ref=ArrayTypeToString.out -XDaccessInternalAPI -XDrawDiagnostics -processor ArrayTypeToString -proc:only ArrayTypeToString.java
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -54,8 +55,7 @@ import com.sun.tools.javac.code.Symbol.VarSymbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SupportedAnnotationTypes("Foo")
|
@SupportedAnnotationTypes("Foo")
|
||||||
@SupportedSourceVersion(SourceVersion.RELEASE_9)
|
public class ArrayTypeToString extends JavacTestingAbstractProcessor {
|
||||||
public class ArrayTypeToString extends AbstractProcessor {
|
|
||||||
@Foo(0) String @Foo(1)[] @Foo(2)[] @Foo(3)[] field;
|
@Foo(0) String @Foo(1)[] @Foo(2)[] @Foo(3)[] field;
|
||||||
|
|
||||||
public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv) {
|
public boolean process(Set<? extends TypeElement> tes, RoundEnvironment renv) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610
|
* @bug 4981566 5028634 5094412 6304984 7025786 7025789 8001112 8028545 8000961 8030610 8028546
|
||||||
* @summary Check interpretation of -target and -source options
|
* @summary Check interpretation of -target and -source options
|
||||||
* @modules java.compiler
|
* @modules java.compiler
|
||||||
* jdk.compiler
|
* jdk.compiler
|
||||||
|
@ -69,6 +69,7 @@ public class Versions {
|
||||||
check("53.0", "-source 1.7");
|
check("53.0", "-source 1.7");
|
||||||
check("53.0", "-source 1.8");
|
check("53.0", "-source 1.8");
|
||||||
check("53.0", "-source 1.9");
|
check("53.0", "-source 1.9");
|
||||||
|
check("53.0", "-source 1.10");
|
||||||
|
|
||||||
check_source_target("50.0", "6", "6");
|
check_source_target("50.0", "6", "6");
|
||||||
check_source_target("51.0", "6", "7");
|
check_source_target("51.0", "6", "7");
|
||||||
|
@ -80,6 +81,7 @@ public class Versions {
|
||||||
check_source_target("53.0", "7", "9");
|
check_source_target("53.0", "7", "9");
|
||||||
check_source_target("53.0", "8", "9");
|
check_source_target("53.0", "8", "9");
|
||||||
check_source_target("53.0", "9", "9");
|
check_source_target("53.0", "9", "9");
|
||||||
|
check_source_target("53.0", "10", "10");
|
||||||
|
|
||||||
checksrc16("-source 1.6");
|
checksrc16("-source 1.6");
|
||||||
checksrc16("-source 6");
|
checksrc16("-source 6");
|
||||||
|
@ -93,19 +95,26 @@ public class Versions {
|
||||||
checksrc18("-source 8");
|
checksrc18("-source 8");
|
||||||
checksrc18("-source 1.8", "-target 1.8");
|
checksrc18("-source 1.8", "-target 1.8");
|
||||||
checksrc18("-source 8", "-target 8");
|
checksrc18("-source 8", "-target 8");
|
||||||
checksrc19();
|
|
||||||
checksrc19("-source 1.9");
|
checksrc19("-source 1.9");
|
||||||
checksrc19("-source 9");
|
checksrc19("-source 9");
|
||||||
checksrc19("-source 1.9", "-target 1.9");
|
checksrc19("-source 1.9", "-target 1.9");
|
||||||
checksrc19("-source 9", "-target 9");
|
checksrc19("-source 9", "-target 9");
|
||||||
checksrc19("-target 1.9");
|
|
||||||
checksrc19("-target 9");
|
checksrc110();
|
||||||
|
checksrc110("-source 1.10");
|
||||||
|
checksrc110("-source 10");
|
||||||
|
checksrc110("-source 1.10", "-target 1.10");
|
||||||
|
checksrc110("-source 10", "-target 10");
|
||||||
|
checksrc110("-target 1.10");
|
||||||
|
checksrc110("-target 10");
|
||||||
|
|
||||||
fail("-source 7", "-target 1.6", "Base.java");
|
fail("-source 7", "-target 1.6", "Base.java");
|
||||||
fail("-source 8", "-target 1.6", "Base.java");
|
fail("-source 8", "-target 1.6", "Base.java");
|
||||||
fail("-source 8", "-target 1.7", "Base.java");
|
fail("-source 8", "-target 1.7", "Base.java");
|
||||||
fail("-source 9", "-target 1.7", "Base.java");
|
fail("-source 9", "-target 1.7", "Base.java");
|
||||||
fail("-source 9", "-target 1.8", "Base.java");
|
fail("-source 9", "-target 1.8", "Base.java");
|
||||||
|
fail("-source 10", "-target 1.7", "Base.java");
|
||||||
|
fail("-source 10", "-target 1.8", "Base.java");
|
||||||
|
|
||||||
fail("-source 1.5", "-target 1.5", "Base.java");
|
fail("-source 1.5", "-target 1.5", "Base.java");
|
||||||
fail("-source 1.4", "-target 1.4", "Base.java");
|
fail("-source 1.4", "-target 1.4", "Base.java");
|
||||||
|
@ -202,6 +211,11 @@ public class Versions {
|
||||||
checksrc18(args);
|
checksrc18(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void checksrc110(String... args) {
|
||||||
|
printargs("checksrc110", args);
|
||||||
|
checksrc19(args);
|
||||||
|
}
|
||||||
|
|
||||||
protected void pass(String... args) {
|
protected void pass(String... args) {
|
||||||
printargs("pass", args);
|
printargs("pass", args);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -49,6 +49,7 @@ public class TestRelease {
|
||||||
assertTrue(invoke("7"));
|
assertTrue(invoke("7"));
|
||||||
assertTrue(invoke("8"));
|
assertTrue(invoke("8"));
|
||||||
assertTrue(invoke("9"));
|
assertTrue(invoke("9"));
|
||||||
|
assertTrue(invoke("10"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue