8260517: implement Sealed Classes as a standard feature in Java
Co-authored-by: Harold Seigel <hseigel@openjdk.org> Co-authored-by: Vicente Romero <vromero@openjdk.org> Reviewed-by: dholmes, mcimadamore, jlahoda
This commit is contained in:
parent
31b98e129e
commit
0fa9223f34
@ -132,6 +132,7 @@ import com.sun.tools.classfile.Module_attribute.ProvidesEntry;
|
||||
import com.sun.tools.classfile.Module_attribute.RequiresEntry;
|
||||
import com.sun.tools.classfile.NestHost_attribute;
|
||||
import com.sun.tools.classfile.NestMembers_attribute;
|
||||
import com.sun.tools.classfile.PermittedSubclasses_attribute;
|
||||
import com.sun.tools.classfile.Record_attribute;
|
||||
import com.sun.tools.classfile.Record_attribute.ComponentInfo;
|
||||
import com.sun.tools.classfile.RuntimeAnnotations_attribute;
|
||||
@ -978,6 +979,16 @@ public class CreateSymbols {
|
||||
attributes.put(Attribute.Record,
|
||||
new Record_attribute(attributeString, recordComponents));
|
||||
}
|
||||
if (header.isSealed) {
|
||||
int attributeString = addString(constantPool, Attribute.PermittedSubclasses);
|
||||
int[] subclasses = new int[header.permittedSubclasses.size()];
|
||||
int i = 0;
|
||||
for (String intf : header.permittedSubclasses) {
|
||||
subclasses[i++] = addClass(constantPool, intf);
|
||||
}
|
||||
attributes.put(Attribute.PermittedSubclasses,
|
||||
new PermittedSubclasses_attribute(attributeString, subclasses));
|
||||
}
|
||||
addInnerClassesAttribute(header, constantPool, attributes);
|
||||
}
|
||||
|
||||
@ -2229,6 +2240,16 @@ public class CreateSymbols {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Attribute.PermittedSubclasses: {
|
||||
assert feature instanceof ClassHeaderDescription;
|
||||
PermittedSubclasses_attribute permittedSubclasses = (PermittedSubclasses_attribute) attr;
|
||||
ClassHeaderDescription chd = (ClassHeaderDescription) feature;
|
||||
chd.permittedSubclasses = Arrays.stream(permittedSubclasses.subtypes)
|
||||
.mapToObj(i -> getClassName(cf, i))
|
||||
.collect(Collectors.toList());
|
||||
chd.isSealed = true;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new IllegalStateException("Unhandled attribute: " +
|
||||
attrName);
|
||||
@ -3077,6 +3098,8 @@ public class CreateSymbols {
|
||||
List<String> nestMembers;
|
||||
boolean isRecord;
|
||||
List<RecordComponentDescription> recordComponents;
|
||||
boolean isSealed;
|
||||
List<String> permittedSubclasses;
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
@ -3087,6 +3110,8 @@ public class CreateSymbols {
|
||||
hash = 17 * hash + Objects.hashCode(this.nestMembers);
|
||||
hash = 17 * hash + Objects.hashCode(this.isRecord);
|
||||
hash = 17 * hash + Objects.hashCode(this.recordComponents);
|
||||
hash = 17 * hash + Objects.hashCode(this.isSealed);
|
||||
hash = 17 * hash + Objects.hashCode(this.permittedSubclasses);
|
||||
return hash;
|
||||
}
|
||||
|
||||
@ -3117,6 +3142,12 @@ public class CreateSymbols {
|
||||
if (!listEquals(this.recordComponents, other.recordComponents)) {
|
||||
return false;
|
||||
}
|
||||
if (this.isSealed != other.isSealed) {
|
||||
return false;
|
||||
}
|
||||
if (!listEquals(this.permittedSubclasses, other.permittedSubclasses)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3137,6 +3168,9 @@ public class CreateSymbols {
|
||||
if (isRecord) {
|
||||
output.append(" record true");
|
||||
}
|
||||
if (isSealed) {
|
||||
output.append(" sealed true");
|
||||
}
|
||||
writeAttributes(output);
|
||||
output.append("\n");
|
||||
writeRecordComponents(output, baselineVersion, version);
|
||||
@ -3163,6 +3197,11 @@ public class CreateSymbols {
|
||||
readRecordComponents(reader);
|
||||
}
|
||||
readInnerClasses(reader);
|
||||
isSealed = reader.attributes.containsKey("permittedSubclasses");
|
||||
if (isSealed) {
|
||||
String subclassesList = reader.attributes.get("permittedSubclasses");
|
||||
permittedSubclasses = deserializeList(subclassesList);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -3532,12 +3532,6 @@ void ClassFileParser::parse_classfile_bootstrap_methods_attribute(const ClassFil
|
||||
CHECK);
|
||||
}
|
||||
|
||||
bool ClassFileParser::supports_sealed_types() {
|
||||
return _major_version == JVM_CLASSFILE_MAJOR_VERSION &&
|
||||
_minor_version == JAVA_PREVIEW_MINOR_VERSION &&
|
||||
Arguments::enable_preview();
|
||||
}
|
||||
|
||||
void ClassFileParser::parse_classfile_attributes(const ClassFileStream* const cfs,
|
||||
ConstantPool* cp,
|
||||
ClassFileParser::ClassAnnotationCollector* parsed_annotations,
|
||||
@ -3794,8 +3788,8 @@ void ClassFileParser::parse_classfile_attributes(const ClassFileStream* const cf
|
||||
parsed_record_attribute = true;
|
||||
record_attribute_start = cfs->current();
|
||||
record_attribute_length = attribute_length;
|
||||
} else if (tag == vmSymbols::tag_permitted_subclasses()) {
|
||||
if (supports_sealed_types()) {
|
||||
} else if (_major_version >= JAVA_17_VERSION) {
|
||||
if (tag == vmSymbols::tag_permitted_subclasses()) {
|
||||
if (parsed_permitted_subclasses_attribute) {
|
||||
classfile_parse_error("Multiple PermittedSubclasses attributes in class file %s", CHECK);
|
||||
return;
|
||||
@ -3810,7 +3804,7 @@ void ClassFileParser::parse_classfile_attributes(const ClassFileStream* const cf
|
||||
permitted_subclasses_attribute_length = attribute_length;
|
||||
}
|
||||
}
|
||||
// Skip attribute_length for any attribute where major_verson >= JAVA_16_VERSION
|
||||
// Skip attribute_length for any attribute where major_verson >= JAVA_17_VERSION
|
||||
cfs->skip_u1(attribute_length, CHECK);
|
||||
} else {
|
||||
// Unknown attribute
|
||||
|
@ -333,9 +333,6 @@ class ClassFileParser {
|
||||
const u1* const record_attribute_start,
|
||||
TRAPS);
|
||||
|
||||
bool supports_sealed_types();
|
||||
bool supports_records();
|
||||
|
||||
void parse_classfile_attributes(const ClassFileStream* const cfs,
|
||||
ConstantPool* cp,
|
||||
ClassAnnotationCollector* parsed_annotations,
|
||||
|
@ -606,7 +606,7 @@ JVM_GetNestHost(JNIEnv *env, jclass current);
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
JVM_GetNestMembers(JNIEnv *env, jclass current);
|
||||
|
||||
/* Records - since JDK 14 */
|
||||
/* Records - since JDK 16 */
|
||||
|
||||
JNIEXPORT jboolean JNICALL
|
||||
JVM_IsRecord(JNIEnv *env, jclass cls);
|
||||
@ -614,7 +614,7 @@ JVM_IsRecord(JNIEnv *env, jclass cls);
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
JVM_GetRecordComponents(JNIEnv *env, jclass ofClass);
|
||||
|
||||
/* Sealed types - since JDK 15 */
|
||||
/* Sealed classes - since JDK 17 */
|
||||
|
||||
JNIEXPORT jobjectArray JNICALL
|
||||
JVM_GetPermittedSubclasses(JNIEnv *env, jclass current);
|
||||
|
@ -4475,9 +4475,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||
*
|
||||
* @jls 8.1 Class Declarations
|
||||
* @jls 9.1 Interface Declarations
|
||||
* @since 15
|
||||
* @since 17
|
||||
*/
|
||||
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES, reflective=true)
|
||||
@CallerSensitive
|
||||
public Class<?>[] getPermittedSubclasses() {
|
||||
Class<?>[] subClasses;
|
||||
@ -4524,14 +4523,13 @@ public final class Class<T> implements java.io.Serializable,
|
||||
* subclasses; {@link #getPermittedSubclasses()} returns a non-null but
|
||||
* possibly empty value for a sealed class or interface.
|
||||
*
|
||||
* @return {@code true} if and only if this {@code Class} object represents a sealed class or interface.
|
||||
* @return {@code true} if and only if this {@code Class} object represents
|
||||
* a sealed class or interface.
|
||||
*
|
||||
* @jls 8.1 Class Declarations
|
||||
* @jls 9.1 Interface Declarations
|
||||
* @since 15
|
||||
* @since 17
|
||||
*/
|
||||
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES, reflective=true)
|
||||
@SuppressWarnings("preview")
|
||||
public boolean isSealed() {
|
||||
if (isArray() || isPrimitive()) {
|
||||
return false;
|
||||
|
@ -54,6 +54,9 @@ public @interface PreviewFeature {
|
||||
public boolean reflective() default false;
|
||||
|
||||
public enum Feature {
|
||||
/*
|
||||
* This one can only be removed after JDK 17
|
||||
*/
|
||||
SEALED_CLASSES,
|
||||
/**
|
||||
* A key for testing.
|
||||
|
@ -93,10 +93,8 @@ public interface ClassTree extends StatementTree {
|
||||
*
|
||||
* @return the subclasses
|
||||
*
|
||||
* @since 15
|
||||
* @since 17
|
||||
*/
|
||||
@jdk.internal.javac.PreviewFeature(feature=jdk.internal.javac.PreviewFeature.Feature.SEALED_CLASSES,
|
||||
reflective=true)
|
||||
default List<? extends Tree> getPermitsClause() {
|
||||
return List.of();
|
||||
}
|
||||
|
@ -183,8 +183,6 @@ public class Preview {
|
||||
*/
|
||||
public boolean isPreview(Feature feature) {
|
||||
return switch (feature) {
|
||||
case SEALED_CLASSES -> true;
|
||||
|
||||
//Note: this is a backdoor which allows to optionally treat all features as 'preview' (for testing).
|
||||
//When real preview features will be added, this method can be implemented to return 'true'
|
||||
//for those selected features, and 'false' for all the others.
|
||||
@ -224,9 +222,7 @@ public class Preview {
|
||||
* @return true iff sym has been declared using a preview language feature
|
||||
*/
|
||||
public boolean declaredUsingPreviewFeature(Symbol sym) {
|
||||
return ((sym.flags() & RECORD) != 0 && isPreview(Feature.RECORDS)) ||
|
||||
((sym.flags() & SEALED) != 0 && isPreview(Feature.SEALED_CLASSES)) ||
|
||||
((sym.flags() & NON_SEALED) != 0 && isPreview(Feature.SEALED_CLASSES));
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -161,8 +161,7 @@ public class Check {
|
||||
deferredLintHandler = DeferredLintHandler.instance(context);
|
||||
|
||||
allowRecords = Feature.RECORDS.allowedInSource(source);
|
||||
allowSealed = (!preview.isPreview(Feature.SEALED_CLASSES) || preview.isEnabled()) &&
|
||||
Feature.SEALED_CLASSES.allowedInSource(source);
|
||||
allowSealed = Feature.SEALED_CLASSES.allowedInSource(source);
|
||||
}
|
||||
|
||||
/** Character for synthetic names
|
||||
|
@ -278,8 +278,7 @@ public class ClassReader {
|
||||
preview = Preview.instance(context);
|
||||
allowModules = Feature.MODULES.allowedInSource(source);
|
||||
allowRecords = Feature.RECORDS.allowedInSource(source);
|
||||
allowSealedTypes = (!preview.isPreview(Feature.SEALED_CLASSES) || preview.isEnabled()) &&
|
||||
Feature.SEALED_CLASSES.allowedInSource(source);
|
||||
allowSealedTypes = Feature.SEALED_CLASSES.allowedInSource(source);
|
||||
|
||||
saveParameterNames = options.isSet(PARAMETERS);
|
||||
|
||||
|
@ -186,8 +186,7 @@ public class JavacParser implements Parser {
|
||||
this.allowYieldStatement = (!preview.isPreview(Feature.SWITCH_EXPRESSION) || preview.isEnabled()) &&
|
||||
Feature.SWITCH_EXPRESSION.allowedInSource(source);
|
||||
this.allowRecords = Feature.RECORDS.allowedInSource(source);
|
||||
this.allowSealedTypes = (!preview.isPreview(Feature.SEALED_CLASSES) || preview.isEnabled()) &&
|
||||
Feature.SEALED_CLASSES.allowedInSource(source);
|
||||
this.allowSealedTypes = Feature.SEALED_CLASSES.allowedInSource(source);
|
||||
}
|
||||
|
||||
protected AbstractEndPosTable newEndPosTable(boolean keepEndPositions) {
|
||||
|
@ -27,11 +27,11 @@
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /test/lib ..
|
||||
* @compile sealedP1/SuperInterface.jcod
|
||||
* @compile --enable-preview --source ${jdk.version} sealedP1/C1.java sealedP2/C2.java sealedP3/C3.java
|
||||
* @compile sealedP1/C1.java sealedP2/C2.java sealedP3/C3.java
|
||||
* @build sun.hotspot.WhiteBox
|
||||
* @compile/module=java.base java/lang/ModuleHelper.java
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm -Xbootclasspath/a:. --enable-preview -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SealedInterfaceModuleTest
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SealedInterfaceModuleTest
|
||||
*/
|
||||
|
||||
public class SealedInterfaceModuleTest {
|
||||
|
@ -27,11 +27,11 @@
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @library /test/lib ..
|
||||
* @compile sealedP1/SuperClass.jcod
|
||||
* @compile --enable-preview --source ${jdk.version} sealedP1/C1.java sealedP2/C2.java sealedP3/C3.java
|
||||
* @compile sealedP1/C1.java sealedP2/C2.java sealedP3/C3.java
|
||||
* @build sun.hotspot.WhiteBox
|
||||
* @compile/module=java.base java/lang/ModuleHelper.java
|
||||
* @run driver jdk.test.lib.helpers.ClassFileInstaller sun.hotspot.WhiteBox
|
||||
* @run main/othervm -Xbootclasspath/a:. --enable-preview -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SealedModuleTest
|
||||
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI SealedModuleTest
|
||||
*/
|
||||
|
||||
public class SealedModuleTest {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -32,7 +32,7 @@
|
||||
|
||||
class sealedP1/SuperClass {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
61; // version
|
||||
[20] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -32,7 +32,7 @@
|
||||
//
|
||||
class sealedP1/SuperInterface {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
61; // version
|
||||
[14] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -1,45 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8225056
|
||||
* @compile --enable-preview -source ${jdk.version} AbstractSealedTest.java
|
||||
* @run main/othervm --enable-preview AbstractSealedTest
|
||||
*/
|
||||
|
||||
// Test that a sealed class can be abstract
|
||||
public class AbstractSealedTest {
|
||||
|
||||
abstract sealed class AbstractShape permits Circle {
|
||||
abstract void draw();
|
||||
}
|
||||
|
||||
final class Circle extends AbstractShape {
|
||||
void draw() {}
|
||||
}
|
||||
|
||||
Circle circle = new Circle();
|
||||
|
||||
public static void main(String... args) { }
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -28,7 +28,7 @@
|
||||
//
|
||||
class NoLoadSubclasses {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
61; // version
|
||||
[18] { // Constant Pool
|
||||
; // first element is empty
|
||||
@ -167,7 +167,7 @@ class ExistingClassFile {
|
||||
// this does not cause an exception to get thrown.
|
||||
class NoSubclasses {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
61; // version
|
||||
[14] { // Constant Pool
|
||||
; // first element is empty
|
||||
@ -238,7 +238,7 @@ class NoSubclasses {
|
||||
// PermittedSubtypes attribute cannot be subclass-ed.
|
||||
class SubClass {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
61; // version
|
||||
[13] { // Constant Pool
|
||||
; // first element is empty
|
||||
@ -384,7 +384,7 @@ class OldClassFile {
|
||||
// should throw ClassFormatError.
|
||||
class BadPermittedAttr {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
61; // version
|
||||
[18] { // Constant Pool
|
||||
; // first element is empty
|
||||
@ -462,7 +462,7 @@ class BadPermittedAttr {
|
||||
//
|
||||
class SealedButFinal {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
61; // version
|
||||
[18] { // Constant Pool
|
||||
; // first element is empty
|
||||
@ -540,7 +540,7 @@ class SealedButFinal {
|
||||
//
|
||||
class BadPermittedSubclassEntry {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
61; // version
|
||||
[18] { // Constant Pool
|
||||
; // first element is empty
|
||||
@ -617,7 +617,7 @@ class BadPermittedSubclassEntry {
|
||||
//
|
||||
class EmptyPermittedSubclassEntry {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
61; // version
|
||||
[18] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -25,10 +25,9 @@
|
||||
* @test
|
||||
* @bug 8225056
|
||||
* @compile GetPermittedSubclasses.jcod
|
||||
* @compile --enable-preview -source ${jdk.version} noSubclass/BaseC.java noSubclass/BaseI.java noSubclass/Impl1.java
|
||||
* @compile --enable-preview -source ${jdk.version} noSubclass/Impl2.java
|
||||
* @compile --enable-preview -source ${jdk.version} GetPermittedSubclassesTest.java
|
||||
* @run main/othervm --enable-preview GetPermittedSubclassesTest
|
||||
* @compile noSubclass/BaseC.java noSubclass/BaseI.java noSubclass/Impl1.java
|
||||
* @compile noSubclass/Impl2.java
|
||||
* @run main GetPermittedSubclassesTest
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -24,8 +24,6 @@
|
||||
/*
|
||||
* @test
|
||||
* @bug 8225056
|
||||
* @compile --enable-preview -source ${jdk.version} OverrideSealedTest.java
|
||||
* @run main/othervm --enable-preview OverrideSealedTest
|
||||
*/
|
||||
|
||||
// Test that a method in a sealed class or interface can be overridden.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -30,7 +30,7 @@
|
||||
|
||||
class Pkg/SealedInterface {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
61; // version
|
||||
[14] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -30,9 +30,9 @@
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @modules java.instrument
|
||||
* @requires vm.jvmti
|
||||
* @compile --enable-preview -source ${jdk.version} RedefinePermittedSubclass.java
|
||||
* @run main/othervm --enable-preview RedefinePermittedSubclass buildagent
|
||||
* @run main/othervm/timeout=6000 --enable-preview RedefinePermittedSubclass runtest
|
||||
* @compile RedefinePermittedSubclass.java
|
||||
* @run main/othervm RedefinePermittedSubclass buildagent
|
||||
* @run main/othervm/timeout=6000 RedefinePermittedSubclass runtest
|
||||
*/
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
@ -124,8 +124,7 @@ public class RedefinePermittedSubclass {
|
||||
}
|
||||
if (argv.length == 1 && argv[0].equals("runtest")) {
|
||||
String[] javaArgs1 = { "-XX:MetaspaceSize=12m", "-XX:MaxMetaspaceSize=12m",
|
||||
"-javaagent:redefineagent.jar", "--enable-preview",
|
||||
"RedefinePermittedSubclass"};
|
||||
"-javaagent:redefineagent.jar", "RedefinePermittedSubclass"};
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(javaArgs1);
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldNotContain("processing of -javaagent failed");
|
||||
|
@ -29,9 +29,9 @@
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @modules java.instrument
|
||||
* @requires vm.jvmti
|
||||
* @compile --enable-preview -source ${jdk.version} RedefineSealedClass.java
|
||||
* @run main/othervm --enable-preview RedefineSealedClass buildagent
|
||||
* @run main/othervm/timeout=6000 --enable-preview RedefineSealedClass runtest
|
||||
* @compile RedefineSealedClass.java
|
||||
* @run main/othervm RedefineSealedClass buildagent
|
||||
* @run main/othervm/timeout=6000 RedefineSealedClass runtest
|
||||
*/
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
@ -106,8 +106,7 @@ public class RedefineSealedClass {
|
||||
}
|
||||
if (argv.length == 1 && argv[0].equals("runtest")) {
|
||||
String[] javaArgs1 = { "-XX:MetaspaceSize=12m", "-XX:MaxMetaspaceSize=12m",
|
||||
"-javaagent:redefineagent.jar", "--enable-preview",
|
||||
"RedefineSealedClass"};
|
||||
"-javaagent:redefineagent.jar", "RedefineSealedClass"};
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(javaArgs1);
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldNotContain("processing of -javaagent failed");
|
||||
|
@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 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
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8225056
|
||||
* @compile --enable-preview -source ${jdk.version} SealedTest.java
|
||||
* @run main/othervm --enable-preview SealedTest
|
||||
*/
|
||||
|
||||
public class SealedTest {
|
||||
|
||||
sealed class Sealed1 permits Sub1 {}
|
||||
|
||||
final class Sub1 extends Sealed1 {}
|
||||
|
||||
sealed interface SealedI1 permits Sub2 {}
|
||||
|
||||
final class Sub2 extends Sealed2 implements SealedI1 {}
|
||||
|
||||
sealed class Sealed2 permits Sub2 {}
|
||||
|
||||
Sub1 sub1 = new Sub1();
|
||||
Sub2 sub2 = new Sub2();
|
||||
|
||||
public static void main(String... args) {
|
||||
System.out.println("Basic testing of sealed types");
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -25,8 +25,8 @@
|
||||
* @test
|
||||
* @bug 8225056
|
||||
* @compile Pkg/SealedInterface.jcod Pkg/NotPermitted.jcod
|
||||
* @compile --enable-preview -source ${jdk.version} Pkg/Permitted.java otherPkg/WrongPackage.java otherPkg/WrongPackageNotPublic.java
|
||||
* @run main/othervm --enable-preview SealedUnnamedModuleIntfTest
|
||||
* @compile Pkg/Permitted.java otherPkg/WrongPackage.java otherPkg/WrongPackageNotPublic.java
|
||||
* @run main SealedUnnamedModuleIntfTest
|
||||
*/
|
||||
|
||||
public class SealedUnnamedModuleIntfTest {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -25,8 +25,8 @@
|
||||
* @test
|
||||
* @bug 8225056
|
||||
* @compile planets/OuterPlanets.jcod planets/Mars.jcod
|
||||
* @compile --enable-preview -source ${jdk.version} planets/Neptune.java asteroids/Pluto.java asteroids/Charon.java
|
||||
* @run main/othervm --enable-preview SealedUnnamedModuleTest
|
||||
* @compile planets/Neptune.java asteroids/Pluto.java asteroids/Charon.java
|
||||
* @run main SealedUnnamedModuleTest
|
||||
*/
|
||||
|
||||
public class SealedUnnamedModuleTest {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 2021, 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
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
class planets/OuterPlanets {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
61; // version
|
||||
[20] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -34,15 +34,15 @@
|
||||
* java.instrument
|
||||
* @compile ../NamedBuffer.java
|
||||
* @run main RedefineClassHelper
|
||||
* @compile --enable-preview --source ${jdk.version} Host/Host.java ClassOne.java ClassTwo.java ClassThree.java ClassFour.java
|
||||
* @compile --enable-preview --source ${jdk.version} TestPermittedSubclassesAttr.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar --enable-preview -Xlog:redefine+class+sealed=trace TestPermittedSubclassesAttr Host
|
||||
* @compile --enable-preview --source ${jdk.version} HostA/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar --enable-preview -Xlog:redefine+class+sealed=trace TestPermittedSubclassesAttr HostA
|
||||
* @compile --enable-preview --source ${jdk.version} HostAB/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar --enable-preview -Xlog:redefine+class+sealed=trace TestPermittedSubclassesAttr HostAB
|
||||
* @compile --enable-preview --source ${jdk.version} HostABC/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar --enable-preview -Xlog:redefine+class+sealed=trace TestPermittedSubclassesAttr HostABC
|
||||
* @compile Host/Host.java ClassOne.java ClassTwo.java ClassThree.java ClassFour.java
|
||||
* @compile TestPermittedSubclassesAttr.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+sealed=trace TestPermittedSubclassesAttr Host
|
||||
* @compile HostA/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+sealed=trace TestPermittedSubclassesAttr HostA
|
||||
* @compile HostAB/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+sealed=trace TestPermittedSubclassesAttr HostAB
|
||||
* @compile HostABC/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+sealed=trace TestPermittedSubclassesAttr HostABC
|
||||
*/
|
||||
|
||||
/* Test Description
|
||||
@ -139,7 +139,6 @@ public class TestPermittedSubclassesAttr {
|
||||
static final String SRC = System.getProperty("test.src");
|
||||
static final String DEST = System.getProperty("test.classes");
|
||||
static final boolean VERBOSE = Boolean.getBoolean("verbose");
|
||||
private static final String VERSION = Integer.toString(Runtime.version().feature());
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
String origin = args[0];
|
||||
@ -266,8 +265,6 @@ public class TestPermittedSubclassesAttr {
|
||||
CompilerUtils.compile(src.toPath(),
|
||||
dst.toPath(),
|
||||
false /* don't recurse */,
|
||||
"-classpath", DEST,
|
||||
"--enable-preview",
|
||||
"--source", VERSION);
|
||||
"-classpath", DEST);
|
||||
}
|
||||
}
|
||||
|
@ -141,6 +141,9 @@ compiler.warn.preview.feature.use.classfile # preview feature suppor
|
||||
compiler.note.preview.plural.additional # preview feature support: diag test causes intermittent failures (see JDK-8201498)
|
||||
compiler.misc.bad.intersection.target.for.functional.expr # currently not generated, should be removed?
|
||||
compiler.misc.not.an.intf.component
|
||||
compiler.warn.declared.using.preview # after making sealed classes a final feature there is no other
|
||||
# preview feature but we should keep this key for future use just
|
||||
# in case
|
||||
|
||||
# The following module-related messages will have to stay on the not-yet list for various reasons:
|
||||
compiler.warn.locn.unknown.file.on.module.path # Never issued ATM (short circuited with an if (false))
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -23,10 +23,7 @@
|
||||
|
||||
// key: compiler.err.local.classes.cant.extend.sealed
|
||||
// key: compiler.err.sealed.class.must.have.subclasses
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// key: compiler.misc.anonymous
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
class Main {
|
||||
void m() {
|
||||
|
@ -22,6 +22,4 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.class.in.module.cant.extend.sealed.in.diff.module
|
||||
// key: compiler.note.preview.plural
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --add-reads mSealed=mSub --enable-preview -source ${jdk.version}
|
||||
// options: --add-reads mSealed=mSub
|
||||
|
@ -22,6 +22,3 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.class.in.unnamed.module.cant.extend.sealed.in.diff.package
|
||||
// key: compiler.note.preview.plural
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, 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
|
||||
@ -23,9 +23,6 @@
|
||||
|
||||
// key: compiler.err.cant.inherit.from.sealed
|
||||
// key: compiler.err.non.sealed.sealed.or.final.expected
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
sealed interface SealedInterface permits Sub1 {
|
||||
void m();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, 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
|
||||
@ -22,9 +22,6 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.non.sealed.or.sealed.expected
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
sealed interface SealedInterface permits Sub1 {
|
||||
void m();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, 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
|
||||
@ -23,9 +23,6 @@
|
||||
|
||||
// key: compiler.err.invalid.permits.clause
|
||||
// key: compiler.misc.is.duplicated
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
sealed class Sealed permits Sub, Sub {}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, 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
|
||||
@ -23,10 +23,7 @@
|
||||
|
||||
// key: compiler.err.local.classes.cant.extend.sealed
|
||||
// key: compiler.err.sealed.class.must.have.subclasses
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// key: compiler.misc.local
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
sealed class C {
|
||||
void m() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, 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
|
||||
@ -22,9 +22,6 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.non.sealed.with.no.sealed.supertype
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
class C {}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -23,8 +23,5 @@
|
||||
|
||||
// key: compiler.err.invalid.permits.clause
|
||||
// key: compiler.misc.must.not.be.same.class
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
sealed class C permits C {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2021, 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
|
||||
@ -23,9 +23,6 @@
|
||||
|
||||
// key: compiler.err.invalid.permits.clause
|
||||
// key: compiler.misc.must.not.be.supertype
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
interface I {}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, 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
|
||||
@ -23,9 +23,6 @@
|
||||
|
||||
// key: compiler.err.invalid.permits.clause
|
||||
// key: compiler.misc.class.is.not.sealed
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
class C permits Sub {}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, 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
|
||||
@ -22,8 +22,5 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.sealed.class.must.have.subclasses
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
sealed class Sealed {}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, 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
|
||||
@ -22,9 +22,6 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.sealed.or.non.sealed.local.classes.not.allowed
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
class Outer {
|
||||
void m() {
|
||||
|
@ -22,9 +22,9 @@
|
||||
*/
|
||||
|
||||
// key: compiler.misc.feature.sealed.classes
|
||||
// key: compiler.warn.preview.feature.use.plural
|
||||
// key: compiler.warn.declared.using.preview
|
||||
// options: --enable-preview -source ${jdk.version} -Xlint:preview
|
||||
// key: compiler.err.feature.not.supported.in.source.plural
|
||||
// key: compiler.warn.source.no.system.modules.path
|
||||
// options: -source 16
|
||||
|
||||
sealed class Sealed {}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, 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
|
||||
@ -23,9 +23,6 @@
|
||||
|
||||
// key: compiler.err.invalid.permits.clause
|
||||
// key: compiler.misc.doesnt.extend.sealed
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
sealed class Sealed permits Sub {}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2021, 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
|
||||
@ -23,9 +23,6 @@
|
||||
|
||||
// key: compiler.err.invalid.permits.clause
|
||||
// key: compiler.misc.is.a.type.variable
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
class Outer<T> {
|
||||
sealed class Sealed permits T {}
|
||||
|
@ -1,5 +0,0 @@
|
||||
- compiler.warn.preview.feature.use.classfile: DeclaredUsingPreviewDeclarations.class, 17
|
||||
- compiler.warn.preview.feature.use.classfile: DeclaredUsingPreviewDeclarations$C.class, 17
|
||||
- compiler.warn.preview.feature.use.classfile: DeclaredUsingPreviewDeclarations$C2.class, 17
|
||||
DeclaredUsingPreview.java:9:37: compiler.warn.declared.using.preview: kindname.class, DeclaredUsingPreviewDeclarations.C
|
||||
4 warnings
|
@ -1,7 +0,0 @@
|
||||
DeclaredUsingPreviewDeclarations.java:3:5: compiler.warn.preview.feature.use.plural: (compiler.misc.feature.sealed.classes)
|
||||
DeclaredUsingPreviewDeclarations.java:3:5: compiler.warn.preview.feature.use.plural: (compiler.misc.feature.sealed.classes)
|
||||
DeclaredUsingPreviewDeclarations.java:4:5: compiler.warn.preview.feature.use.plural: (compiler.misc.feature.sealed.classes)
|
||||
DeclaredUsingPreview.java:9:37: compiler.warn.declared.using.preview: kindname.class, DeclaredUsingPreviewDeclarations.C
|
||||
DeclaredUsingPreview.java:10:37: compiler.warn.declared.using.preview: kindname.class, DeclaredUsingPreviewDeclarations.C2
|
||||
DeclaredUsingPreviewDeclarations.java:4:33: compiler.warn.declared.using.preview: kindname.class, DeclaredUsingPreviewDeclarations.C
|
||||
6 warnings
|
@ -1,11 +0,0 @@
|
||||
/**
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8250768
|
||||
* @summary Verify javac correctly reports errors for uses of classes declared using preview features.
|
||||
* @compile/ref=DeclaredUsingPreview-source.out -XDrawDiagnostics --enable-preview -source ${jdk.version} -Xlint:preview DeclaredUsingPreview.java DeclaredUsingPreviewDeclarations.java
|
||||
* @compile/ref=DeclaredUsingPreview-class.out -XDrawDiagnostics --enable-preview -source ${jdk.version} -Xlint:preview DeclaredUsingPreview.java
|
||||
*/
|
||||
public class DeclaredUsingPreview {
|
||||
DeclaredUsingPreviewDeclarations.C c;
|
||||
DeclaredUsingPreviewDeclarations.C2 c2; //TODO: should cause warning?
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
///nodynamiccopyright/
|
||||
public class DeclaredUsingPreviewDeclarations {
|
||||
sealed class C {}
|
||||
non-sealed class C2 extends C {}
|
||||
}
|
@ -96,17 +96,12 @@ public class PreviewAutoSuppress extends TestRunner {
|
||||
List<String> expected =
|
||||
List.of("Outer.java:3:5: compiler.warn.preview.feature.use.plural: (compiler.misc.feature.records)",
|
||||
"Outer.java:3:5: compiler.warn.preview.feature.use.plural: (compiler.misc.feature.records)",
|
||||
"Outer.java:4:5: compiler.warn.declared.using.preview: kindname.record, test.Outer.R",
|
||||
"Use.java:3:8: compiler.warn.declared.using.preview: kindname.record, test.Outer.R",
|
||||
"4 warnings");
|
||||
"2 warnings");
|
||||
if (!log.equals(expected))
|
||||
throw new Exception("expected output not found" + log);
|
||||
checkPreviewClassfile(classes.resolve("test").resolve("Outer.class"),
|
||||
true); //TODO: correct?
|
||||
checkPreviewClassfile(classes.resolve("test").resolve("Outer$R.class"),
|
||||
true);
|
||||
checkPreviewClassfile(classes.resolve("test").resolve("Use.class"),
|
||||
true);
|
||||
checkPreviewClassfile(classes.resolve("test").resolve("Outer.class"), true); //TODO: correct?
|
||||
checkPreviewClassfile(classes.resolve("test").resolve("Outer$R.class"),true);
|
||||
checkPreviewClassfile(classes.resolve("test").resolve("Use.class"),false);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -234,9 +234,7 @@ public class PreviewErrors extends ComboInstance<PreviewErrors> {
|
||||
|
||||
new JavacTask(tb)
|
||||
.outdir(classesJavaBase)
|
||||
.options("--patch-module", "java.base=" + srcJavaBase.toString(),
|
||||
"--enable-preview",
|
||||
"-source", String.valueOf(Runtime.version().feature()))
|
||||
.options("--patch-module", "java.base=" + srcJavaBase.toString())
|
||||
.files(tb.findJavaFiles(srcJavaBase))
|
||||
.run()
|
||||
.writeAll();
|
||||
@ -244,7 +242,8 @@ public class PreviewErrors extends ComboInstance<PreviewErrors> {
|
||||
task.withOption("--patch-module")
|
||||
.withOption("java.base=" + classesJavaBase.toString())
|
||||
.withOption("--add-exports")
|
||||
.withOption("java.base/user=ALL-UNNAMED");
|
||||
.withOption("java.base/user=ALL-UNNAMED")
|
||||
.withOption("-XDforcePreview=true");
|
||||
}
|
||||
case REFER_TO_DECLARATION_SOURCE -> {
|
||||
tb.writeJavaFiles(srcJavaBase, SEALED_DECLARATION);
|
||||
@ -252,7 +251,8 @@ public class PreviewErrors extends ComboInstance<PreviewErrors> {
|
||||
task.withOption("--patch-module")
|
||||
.withOption("java.base=" + srcJavaBase.toString())
|
||||
.withOption("--add-exports")
|
||||
.withOption("java.base/user=ALL-UNNAMED");
|
||||
.withOption("java.base/user=ALL-UNNAMED")
|
||||
.withOption("-XDforcePreview=true");
|
||||
}
|
||||
}
|
||||
|
||||
@ -289,11 +289,13 @@ public class PreviewErrors extends ComboInstance<PreviewErrors> {
|
||||
expected = Set.of("5:41:compiler.err.preview.feature.disabled");
|
||||
}
|
||||
case REFER_TO_DECLARATION_CLASS -> {
|
||||
ok = false;
|
||||
expected = Set.of("-1:-1:compiler.err.preview.feature.disabled.classfile");
|
||||
ok = true;
|
||||
previewClass = false;
|
||||
expected = Set.of();
|
||||
}
|
||||
case REFER_TO_DECLARATION_SOURCE -> {
|
||||
ok = false;
|
||||
previewClass = false;
|
||||
expected = Set.of("2:8:compiler.err.preview.feature.disabled.plural");
|
||||
}
|
||||
case API_CLASS, API_SOURCE -> {
|
||||
@ -330,41 +332,16 @@ public class PreviewErrors extends ComboInstance<PreviewErrors> {
|
||||
}
|
||||
}
|
||||
case REFER_TO_DECLARATION_CLASS -> {
|
||||
if (suppress == Suppress.YES) {
|
||||
if (lint == Lint.ENABLE_PREVIEW) {
|
||||
expected = Set.of("-1:-1:compiler.warn.preview.feature.use.classfile");
|
||||
} else {
|
||||
expected = Set.of(/*"-1:-1:compiler.note.preview.filename",
|
||||
"-1:-1:compiler.note.preview.recompile"*/);
|
||||
}
|
||||
} else if (lint == Lint.ENABLE_PREVIEW) {
|
||||
expected = Set.of("5:13:compiler.warn.declared.using.preview",
|
||||
"5:24:compiler.warn.declared.using.preview",
|
||||
"-1:-1:compiler.warn.preview.feature.use.classfile");
|
||||
} else {
|
||||
expected = Set.of("-1:-1:compiler.note.preview.filename",
|
||||
"-1:-1:compiler.note.preview.recompile");
|
||||
}
|
||||
previewClass = false;
|
||||
expected = Set.of();
|
||||
}
|
||||
case REFER_TO_DECLARATION_SOURCE -> {
|
||||
previewClass = false;
|
||||
if (lint == Lint.ENABLE_PREVIEW) {
|
||||
if (suppress == Suppress.YES) {
|
||||
expected = Set.of("2:8:compiler.warn.preview.feature.use.plural",
|
||||
"3:26:compiler.warn.declared.using.preview");
|
||||
expected = Set.of("2:8:compiler.warn.preview.feature.use.plural");
|
||||
} else {
|
||||
expected = Set.of("5:13:compiler.warn.declared.using.preview",
|
||||
"5:24:compiler.warn.declared.using.preview",
|
||||
"2:8:compiler.warn.preview.feature.use.plural",
|
||||
"3:26:compiler.warn.declared.using.preview");
|
||||
}
|
||||
} else {
|
||||
if (suppress == Suppress.YES) {
|
||||
expected = Set.of("-1:-1:compiler.note.preview.filename",
|
||||
"-1:-1:compiler.note.preview.recompile");
|
||||
} else {
|
||||
expected = Set.of("-1:-1:compiler.note.preview.plural",
|
||||
"-1:-1:compiler.note.preview.recompile");
|
||||
}
|
||||
}
|
||||
}
|
||||
case API_CLASS, API_SOURCE -> {
|
||||
|
@ -30,8 +30,7 @@
|
||||
* jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.main
|
||||
* @build toolbox.ToolBox toolbox.JavacTask JavacTestingAbstractProcessor
|
||||
* @compile --enable-preview -source ${jdk.version} TestSealed.java
|
||||
* @run main/othervm --enable-preview TestSealed
|
||||
* @run main TestSealed
|
||||
*/
|
||||
|
||||
import java.io.*;
|
||||
@ -130,16 +129,12 @@ public class TestSealed extends TestRunner {
|
||||
"- compiler.note.proc.messager: visiting: NonSealedClass2 Modifiers: [non-sealed]",
|
||||
"- compiler.note.proc.messager: this class has: 0, permitted subclasses",
|
||||
"- compiler.note.proc.messager: visiting: ClassOutOfSealedHierarchy Modifiers: []",
|
||||
"- compiler.note.proc.messager: this class has: 0, permitted subclasses",
|
||||
"- compiler.note.preview.filename: SealedInterface.java, DEFAULT",
|
||||
"- compiler.note.preview.recompile"
|
||||
"- compiler.note.proc.messager: this class has: 0, permitted subclasses"
|
||||
);
|
||||
|
||||
for (Mode mode : new Mode[] {Mode.API}) {
|
||||
List<String> log = new JavacTask(tb, mode)
|
||||
.options("-processor", SealedClassesProcessor.class.getName(),
|
||||
"--enable-preview",
|
||||
"-source", Integer.toString(Runtime.version().feature()),
|
||||
"-XDrawDiagnostics")
|
||||
.files(findJavaFiles(src))
|
||||
.outdir(classes)
|
||||
|
@ -33,9 +33,8 @@
|
||||
* jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.main
|
||||
* @build toolbox.ToolBox toolbox.JavacTask
|
||||
* @compile --enable-preview -source ${jdk.version} SealedCompilationTests.java
|
||||
* @run testng/othervm -DuseAP=false --enable-preview SealedCompilationTests
|
||||
* @run testng/othervm -DuseAP=true --enable-preview SealedCompilationTests
|
||||
* @run testng/othervm -DuseAP=false SealedCompilationTests
|
||||
* @run testng/othervm -DuseAP=true SealedCompilationTests
|
||||
*/
|
||||
|
||||
import java.lang.constant.ClassDesc;
|
||||
@ -77,17 +76,7 @@ public class SealedCompilationTests extends CompilationTestCase {
|
||||
|
||||
ToolBox tb = new ToolBox();
|
||||
|
||||
// When sealed classes become a permanent feature, we don't need these any more
|
||||
private static String[] PREVIEW_OPTIONS = {
|
||||
"--enable-preview",
|
||||
"-source", Integer.toString(Runtime.version().feature())
|
||||
};
|
||||
|
||||
private static String[] PREVIEW_OPTIONS_WITH_AP = {
|
||||
"--enable-preview",
|
||||
"-source", Integer.toString(Runtime.version().feature()),
|
||||
"-processor", SimplestAP.class.getName()
|
||||
};
|
||||
private static String[] OPTIONS_WITH_AP = { "-processor", SimplestAP.class.getName() };
|
||||
|
||||
/* simplest annotation processor just to force a round of annotation processing for all tests
|
||||
*/
|
||||
@ -108,7 +97,7 @@ public class SealedCompilationTests extends CompilationTestCase {
|
||||
public SealedCompilationTests() {
|
||||
boolean useAP = System.getProperty("useAP") == null ? false : System.getProperty("useAP").equals("true");
|
||||
setDefaultFilename("SealedTest.java");
|
||||
setCompileOptions(useAP ? PREVIEW_OPTIONS_WITH_AP : PREVIEW_OPTIONS);
|
||||
setCompileOptions(useAP ? OPTIONS_WITH_AP : new String[]{});
|
||||
System.out.println(useAP ? "running all tests using an annotation processor" : "running all tests without annotation processor");
|
||||
}
|
||||
|
||||
@ -298,22 +287,6 @@ public class SealedCompilationTests extends CompilationTestCase {
|
||||
)) {
|
||||
assertFail("compiler.err.restricted.type.not.allowed.here", s);
|
||||
}
|
||||
|
||||
String[] testOptions = {/* no options */};
|
||||
String[] previousCompOptions = getCompileOptions();
|
||||
setCompileOptions(testOptions);
|
||||
// now testing with preview disabled
|
||||
for (String s : List.of(
|
||||
"sealed class S {}",
|
||||
"class Outer { sealed class S {} }",
|
||||
"class Outer { void m() { sealed class S {} } }",
|
||||
"non-sealed class S {}",
|
||||
"class Outer { non-sealed class S {} }",
|
||||
"class Outer { void m() { non-sealed class S {} } }"
|
||||
)) {
|
||||
assertFail("compiler.err.preview.feature.disabled.plural", s);
|
||||
}
|
||||
setCompileOptions(previousCompOptions);
|
||||
}
|
||||
|
||||
public void testRejectPermitsInNonSealedClass() {
|
||||
|
@ -92,7 +92,6 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
|
||||
new JavacTask(tb)
|
||||
.outdir(out)
|
||||
.options("--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.files(findJavaFiles(test))
|
||||
.run()
|
||||
.writeAll();
|
||||
@ -121,7 +120,6 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
new JavacTask(tb)
|
||||
.outdir(out)
|
||||
.files(findJavaFiles(test))
|
||||
.options("--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.run()
|
||||
.writeAll();
|
||||
|
||||
@ -188,7 +186,6 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
new JavacTask(tb)
|
||||
.outdir(out)
|
||||
.files(findJavaFiles(pkg))
|
||||
.options("--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.run()
|
||||
.writeAll();
|
||||
|
||||
@ -210,7 +207,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
"}");
|
||||
|
||||
List<String> error = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.options("-XDrawDiagnostics")
|
||||
.files(findJavaFiles(test))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
@ -236,7 +233,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
"}");
|
||||
|
||||
List<String> error = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.options("-XDrawDiagnostics")
|
||||
.files(findJavaFiles(test))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
@ -275,7 +272,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
"}");
|
||||
|
||||
List<String> error = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.options("-XDrawDiagnostics")
|
||||
.files(findJavaFiles(pkg))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
@ -309,7 +306,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
"}");
|
||||
|
||||
List<String> error = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.options("-XDrawDiagnostics")
|
||||
.files(findJavaFiles(pkg))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
@ -342,7 +339,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
"}");
|
||||
|
||||
List<String> error = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.options("-XDrawDiagnostics")
|
||||
.files(findJavaFiles(pkg))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
@ -377,7 +374,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
"}");
|
||||
|
||||
List<String> error = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.options("-XDrawDiagnostics")
|
||||
.files(findJavaFiles(pkg1, pkg2))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
@ -413,7 +410,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
"}");
|
||||
|
||||
List<String> error = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.options("-XDrawDiagnostics")
|
||||
.files(findJavaFiles(pkg1, pkg2))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
@ -453,7 +450,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
Files.createDirectories(out);
|
||||
|
||||
List<String> error = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.options("-XDrawDiagnostics")
|
||||
.files(findJavaFiles(pkg1, pkg2))
|
||||
.run(Task.Expect.FAIL)
|
||||
.writeAll()
|
||||
@ -479,7 +476,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
tb.createDirectories(classes);
|
||||
|
||||
new JavacTask(tb)
|
||||
.options("--module-source-path", src.toString(), "--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.options("--module-source-path", src.toString())
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run()
|
||||
@ -498,7 +495,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
tb.createDirectories(classes);
|
||||
|
||||
new JavacTask(tb)
|
||||
.options("--module-source-path", src.toString(), "--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.options("--module-source-path", src.toString())
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run()
|
||||
@ -519,8 +516,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
|
||||
List<String> error = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--module-source-path",
|
||||
src.toString(), "--enable-preview",
|
||||
"-source", Integer.toString(Runtime.version().feature()))
|
||||
src.toString())
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run(Task.Expect.FAIL)
|
||||
@ -550,8 +546,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
|
||||
List<String> error = new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--module-source-path",
|
||||
src.toString(), "--enable-preview",
|
||||
"-source", Integer.toString(Runtime.version().feature()))
|
||||
src.toString())
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run(Task.Expect.FAIL)
|
||||
@ -590,9 +585,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics",
|
||||
"--module-source-path", src.toString(),
|
||||
"--add-reads", "mSealed=mSub",
|
||||
"--enable-preview",
|
||||
"-source", Integer.toString(Runtime.version().feature()))
|
||||
"--add-reads", "mSealed=mSub")
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src))
|
||||
.run(Task.Expect.FAIL)
|
||||
@ -601,8 +594,6 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
|
||||
List<String> expected = List.of(
|
||||
"Base.java:1:46: compiler.err.class.in.module.cant.extend.sealed.in.diff.module: a.Base, mSealed",
|
||||
"- compiler.note.preview.plural: DEFAULT",
|
||||
"- compiler.note.preview.recompile",
|
||||
"1 error"
|
||||
);
|
||||
if (!error.containsAll(expected)) {
|
||||
@ -623,8 +614,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
|
||||
new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--module-source-path",
|
||||
src.toString(), "--enable-preview",
|
||||
"-source", Integer.toString(Runtime.version().feature()))
|
||||
src.toString())
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src_m))
|
||||
.run()
|
||||
@ -633,8 +623,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
|
||||
new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--module-source-path",
|
||||
src.toString(), "--enable-preview", "-doe",
|
||||
"-source", Integer.toString(Runtime.version().feature()))
|
||||
src.toString(), "-doe")
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src_m.resolve("pkg").resolve("a")))
|
||||
.run()
|
||||
@ -643,8 +632,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
|
||||
new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--module-source-path",
|
||||
src.toString(), "--enable-preview", "-doe",
|
||||
"-source", Integer.toString(Runtime.version().feature()))
|
||||
src.toString(), "-doe")
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src_m.resolve("pkg").resolve("b")))
|
||||
.run()
|
||||
@ -656,8 +644,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
//implicit compilations:
|
||||
new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--module-source-path",
|
||||
src.toString(), "--enable-preview", "-doe",
|
||||
"-source", Integer.toString(Runtime.version().feature()))
|
||||
src.toString(), "-doe")
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src_m.resolve("pkg").resolve("a")))
|
||||
.run()
|
||||
@ -668,8 +655,7 @@ public class SealedDiffConfigurationsTest extends TestRunner {
|
||||
|
||||
new JavacTask(tb)
|
||||
.options("-XDrawDiagnostics", "--module-source-path",
|
||||
src.toString(), "--enable-preview", "-doe",
|
||||
"-source", Integer.toString(Runtime.version().feature()))
|
||||
src.toString(), "-doe")
|
||||
.outdir(classes)
|
||||
.files(findJavaFiles(src_m.resolve("pkg").resolve("b")))
|
||||
.run()
|
||||
|
@ -92,7 +92,6 @@ public class ListModuleDeps {
|
||||
public Object[][] jdkModules() {
|
||||
return new Object[][]{
|
||||
{"jdk.compiler", new String[]{
|
||||
"java.base/jdk.internal.javac",
|
||||
"java.base/jdk.internal.jmod",
|
||||
"java.base/jdk.internal.misc",
|
||||
"java.base/sun.reflect.annotation",
|
||||
|
Loading…
Reference in New Issue
Block a user