8255013: implement Record Classes as a standard feature in Java, follow-up
Co-authored-by: Vicente Romero <vromero@openjdk.org> Co-authored-by: Harold Seigel <hseigel@openjdk.org> Co-authored-by: Chris Hegarty <chegar@openjdk.org> Reviewed-by: jlahoda
This commit is contained in:
parent
0425889885
commit
8bde2f4e3d
src
hotspot/share/classfile
java.base/share/classes
java/lang
sun/reflect/annotation
jdk.compiler/share/classes/com/sun
source/tree
tools/javac
test
hotspot/jtreg/runtime/records
RedefineRecord.javaabstractRecord.jcodbadRecordAttribute.jcodignoreRecordAttribute.javanotFinalRecord.jcodrecordAttributeTest.javarecordIgnoredVersion.jcodrecordReflectionTest.javashortRecordAttribute.jcodsuperNotJLRecord.jcodtwoRecordAttributes.jcod
jdk/java
io/Serializable/records
AbsentStreamValuesTest.javaBadCanonicalCtrTest.javaBasicRecordSer.javaConstructorAccessTest.javaConstructorPermissionTest.javaCycleTest.javaDifferentStreamFieldsTest.javaProhibitedMethods.javaReadResolveTest.javaRecordClassTest.javaSerialPersistentFieldsTest.javaSerialVersionUIDTest.javaStreamRefTest.javaThrowingConstructorTest.javaUnsharedTest.javaWriteReplaceTest.java
migration
lang
instrument
runtime
langtools
jdk
javadoc
doclet
tool/api/basic
jshell
tools/javac
IllegalAnnotation.javaIllegalAnnotation.outLocalInterface.javaLocalInterface.outLocalRecord.java
annotations
api
diags/examples
AccessorCantBeGeneric.javaAccessorCantThrowException.javaAccessorMethodCantBeStatic.javaAccessorReturnTypeDoesntMatch.javaCanonicalCantHaveStrongerAccessPrivileges.javaCanonicalCantInvokeOtherConstructor.javaCanonicalConstructorArgumentMismatch.javaCanonicalConstructorCantHaveReturn.javaCanonicalConstructorCantHaveThrowsClause.javaCanonicalMustNotDeclareTypeVariables.javaConstructorWithSameErasureAsCanonical.javaExpected3.javaFirstInvocationMustBeAnotherConstructor.javaIllegalRecordComponentName.javaIncorrectRecordDeclaration.javaInstanceInitializersNotAllowedInRecords.javaInterfaceNotAllowed.javaInvalidSuperTypeRecord.javaKindnameRecord.javaLocalEnum.javaMethodMustBePublic.javaRecords.javaRecordsCanNotDeclareInstanceFields.javaRecordsCantDeclareComponentModifiers.javaRecordsComponentsCanNotDeclareCStyleArrays.javaRecordsNotAllowedInInnerClasses.java
enum
launcher
parser
processing/model/element
records
@ -3645,12 +3645,6 @@ bool ClassFileParser::supports_sealed_types() {
|
||||
Arguments::enable_preview();
|
||||
}
|
||||
|
||||
bool ClassFileParser::supports_records() {
|
||||
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,
|
||||
@ -3898,9 +3892,28 @@ void ClassFileParser::parse_classfile_attributes(const ClassFileStream* const cf
|
||||
"Nest-host class_info_index %u has bad constant type in class file %s",
|
||||
class_info_index, CHECK);
|
||||
_nest_host = class_info_index;
|
||||
} else if (_major_version >= JAVA_14_VERSION) {
|
||||
if (tag == vmSymbols::tag_record()) {
|
||||
if (supports_records()) { // Skip over Record attribute if not supported.
|
||||
|
||||
} else if (_major_version >= JAVA_15_VERSION) {
|
||||
// Check for PermittedSubclasses tag
|
||||
if (tag == vmSymbols::tag_permitted_subclasses()) {
|
||||
if (supports_sealed_types()) {
|
||||
if (parsed_permitted_subclasses_attribute) {
|
||||
classfile_parse_error("Multiple PermittedSubclasses attributes in class file %s", CHECK);
|
||||
return;
|
||||
}
|
||||
// Classes marked ACC_FINAL cannot have a PermittedSubclasses attribute.
|
||||
if (_access_flags.is_final()) {
|
||||
classfile_parse_error("PermittedSubclasses attribute in final class file %s", CHECK);
|
||||
return;
|
||||
}
|
||||
parsed_permitted_subclasses_attribute = true;
|
||||
permitted_subclasses_attribute_start = cfs->current();
|
||||
permitted_subclasses_attribute_length = attribute_length;
|
||||
}
|
||||
cfs->skip_u1(attribute_length, CHECK);
|
||||
|
||||
} else if (_major_version >= JAVA_16_VERSION) {
|
||||
if (tag == vmSymbols::tag_record()) {
|
||||
if (parsed_record_attribute) {
|
||||
classfile_parse_error("Multiple Record attributes in class file %s", THREAD);
|
||||
return;
|
||||
@ -3908,39 +3921,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 (log_is_enabled(Info, class, record)) {
|
||||
// Log why the Record attribute was ignored. Note that if the
|
||||
// class file version is JVM_CLASSFILE_MAJOR_VERSION.65535 and
|
||||
// --enable-preview wasn't specified then a java.lang.UnsupportedClassVersionError
|
||||
// exception would have been thrown.
|
||||
ResourceMark rm(THREAD);
|
||||
log_info(class, record)(
|
||||
"Ignoring Record attribute in class %s because class file version is not %d.65535",
|
||||
_class_name->as_C_string(), JVM_CLASSFILE_MAJOR_VERSION);
|
||||
}
|
||||
cfs->skip_u1(attribute_length, CHECK);
|
||||
} else if (_major_version >= JAVA_15_VERSION) {
|
||||
// Check for PermittedSubclasses tag
|
||||
if (tag == vmSymbols::tag_permitted_subclasses()) {
|
||||
if (supports_sealed_types()) {
|
||||
if (parsed_permitted_subclasses_attribute) {
|
||||
classfile_parse_error("Multiple PermittedSubclasses attributes in class file %s", THREAD);
|
||||
return;
|
||||
}
|
||||
// Classes marked ACC_FINAL cannot have a PermittedSubclasses attribute.
|
||||
if (_access_flags.is_final()) {
|
||||
classfile_parse_error("PermittedSubclasses attribute in final class file %s", THREAD);
|
||||
return;
|
||||
}
|
||||
parsed_permitted_subclasses_attribute = true;
|
||||
permitted_subclasses_attribute_start = cfs->current();
|
||||
permitted_subclasses_attribute_length = attribute_length;
|
||||
}
|
||||
cfs->skip_u1(attribute_length, CHECK);
|
||||
} else {
|
||||
// Unknown attribute
|
||||
cfs->skip_u1(attribute_length, CHECK);
|
||||
}
|
||||
cfs->skip_u1(attribute_length, CHECK);
|
||||
} else {
|
||||
// Unknown attribute
|
||||
cfs->skip_u1(attribute_length, CHECK);
|
||||
|
@ -2338,13 +2338,6 @@ public final class Class<T> implements java.io.Serializable,
|
||||
}
|
||||
|
||||
/**
|
||||
* {@preview Associated with records, a preview feature of the Java language.
|
||||
*
|
||||
* This method is associated with <i>records</i>, a preview
|
||||
* feature of the Java language. Preview features
|
||||
* may be removed in a future release, or upgraded to permanent
|
||||
* features of the Java language.}
|
||||
*
|
||||
* Returns an array of {@code RecordComponent} objects representing all the
|
||||
* record components of this record class, or {@code null} if this class is
|
||||
* not a record class.
|
||||
@ -2381,11 +2374,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||
* </ul>
|
||||
*
|
||||
* @jls 8.10 Record Types
|
||||
* @since 14
|
||||
* @since 16
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
@SuppressWarnings("preview")
|
||||
@CallerSensitive
|
||||
public RecordComponent[] getRecordComponents() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
@ -3682,13 +3672,6 @@ public final class Class<T> implements java.io.Serializable,
|
||||
}
|
||||
|
||||
/**
|
||||
* {@preview Associated with records, a preview feature of the Java language.
|
||||
*
|
||||
* This method is associated with <i>records</i>, a preview
|
||||
* feature of the Java language. Preview features
|
||||
* may be removed in a future release, or upgraded to permanent
|
||||
* features of the Java language.}
|
||||
*
|
||||
* Returns {@code true} if and only if this class is a record class.
|
||||
*
|
||||
* <p> The {@linkplain #getSuperclass() direct superclass} of a record
|
||||
@ -3701,10 +3684,8 @@ public final class Class<T> implements java.io.Serializable,
|
||||
*
|
||||
* @return true if and only if this class is a record class, otherwise false
|
||||
* @jls 8.10 Record Types
|
||||
* @since 14
|
||||
* @since 16
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
public boolean isRecord() {
|
||||
return getSuperclass() == JAVA_LANG_RECORD_CLASS && isRecord0();
|
||||
}
|
||||
|
@ -25,14 +25,6 @@
|
||||
package java.lang;
|
||||
|
||||
/**
|
||||
* {@preview Associated with records, a preview feature of the Java language.
|
||||
*
|
||||
* This class is associated with <i>records</i>, a preview
|
||||
* feature of the Java language. Programs can only use this
|
||||
* class when preview features are enabled. Preview features
|
||||
* may be removed in a future release, or upgraded to permanent
|
||||
* features of the Java language.}
|
||||
*
|
||||
* This is the common base class of all Java language record classes.
|
||||
*
|
||||
* <p>More information about records, including descriptions of the
|
||||
@ -86,10 +78,8 @@ package java.lang;
|
||||
* <a href="{@docRoot}/java.base/java/io/ObjectInputStream.html#record-serialization">record serialization</a>.
|
||||
*
|
||||
* @jls 8.10 Record Types
|
||||
* @since 14
|
||||
* @since 16
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=true)
|
||||
public abstract class Record {
|
||||
/**
|
||||
* Constructor for record classes to call.
|
||||
|
@ -118,22 +118,12 @@ public enum ElementType {
|
||||
MODULE,
|
||||
|
||||
/**
|
||||
* {@preview Associated with records, a preview feature of the Java language.
|
||||
*
|
||||
* This constant is associated with <i>records</i>, a preview
|
||||
* feature of the Java language. Programs can only use this
|
||||
* constant when preview features are enabled. Preview features
|
||||
* may be removed in a future release, or upgraded to permanent
|
||||
* features of the Java language.}
|
||||
*
|
||||
* Record component
|
||||
*
|
||||
* @jls 8.10.3 Record Members
|
||||
* @jls 9.7.4 Where Annotations May Appear
|
||||
*
|
||||
* @since 14
|
||||
* @since 16
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=true)
|
||||
RECORD_COMPONENT;
|
||||
}
|
||||
|
@ -38,23 +38,14 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* {@preview Associated with records, a preview feature of the Java language.
|
||||
*
|
||||
* This class is associated with <i>records</i>, a preview
|
||||
* feature of the Java language. Preview features
|
||||
* may be removed in a future release, or upgraded to permanent
|
||||
* features of the Java language.}
|
||||
*
|
||||
* A {@code RecordComponent} provides information about, and dynamic access to, a
|
||||
* component of a record class.
|
||||
*
|
||||
* @see Class#getRecordComponents()
|
||||
* @see java.lang.Record
|
||||
* @jls 8.10 Record Types
|
||||
* @since 14
|
||||
* @since 16
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
public final class RecordComponent implements AnnotatedElement {
|
||||
// declaring class
|
||||
private Class<?> clazz;
|
||||
|
@ -38,23 +38,14 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* {@preview Associated with records, a preview feature of the Java language.
|
||||
*
|
||||
* This class is associated with <i>records</i>, a preview
|
||||
* feature of the Java language. Preview features
|
||||
* may be removed in a future release, or upgraded to permanent
|
||||
* features of the Java language.}
|
||||
*
|
||||
* Bootstrap methods for state-driven implementations of core methods,
|
||||
* including {@link Object#equals(Object)}, {@link Object#hashCode()}, and
|
||||
* {@link Object#toString()}. These methods may be used, for example, by
|
||||
* Java compiler implementations to implement the bodies of {@link Object}
|
||||
* methods for record classes.
|
||||
*
|
||||
* @since 14
|
||||
* @since 16
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
public class ObjectMethods {
|
||||
|
||||
private ObjectMethods() { }
|
||||
|
@ -92,16 +92,8 @@ public final class TypeAnnotation {
|
||||
METHOD_FORMAL_PARAMETER,
|
||||
THROWS,
|
||||
/**
|
||||
* {@preview Associated with records, a preview feature of the Java language.
|
||||
*
|
||||
* This enum constant is associated with <i>records</i>, a preview
|
||||
* feature of the Java language. Preview features
|
||||
* may be removed in a future release, or upgraded to permanent
|
||||
* features of the Java language.}
|
||||
* @since 14
|
||||
* @since 16
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
RECORD_COMPONENT;
|
||||
}
|
||||
|
||||
|
@ -649,19 +649,9 @@ public interface Tree {
|
||||
PROVIDES(ProvidesTree.class),
|
||||
|
||||
/**
|
||||
* {@preview Associated with records, a preview feature of the Java language.
|
||||
*
|
||||
* This enum constant is associated with <i>records</i>, a preview
|
||||
* feature of the Java language. Preview features
|
||||
* may be removed in a future release, or upgraded to permanent
|
||||
* features of the Java language.}
|
||||
*
|
||||
* Used for instances of {@link ClassTree} representing records.
|
||||
*
|
||||
* @since 14
|
||||
* @since 16
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
RECORD(ClassTree.class),
|
||||
|
||||
/**
|
||||
|
@ -167,7 +167,6 @@ public class Preview {
|
||||
public boolean isPreview(Feature feature) {
|
||||
if (feature == Feature.PATTERN_MATCHING_IN_INSTANCEOF ||
|
||||
feature == Feature.REIFIABLE_TYPES_INSTANCEOF ||
|
||||
feature == Feature.RECORDS ||
|
||||
feature == Feature.SEALED_CLASSES)
|
||||
return true;
|
||||
//Note: this is a backdoor which allows to optionally treat all features as 'preview' (for testing).
|
||||
|
@ -159,8 +159,7 @@ public class Check {
|
||||
|
||||
deferredLintHandler = DeferredLintHandler.instance(context);
|
||||
|
||||
allowRecords = (!preview.isPreview(Feature.RECORDS) || preview.isEnabled()) &&
|
||||
Feature.RECORDS.allowedInSource(source);
|
||||
allowRecords = Feature.RECORDS.allowedInSource(source);
|
||||
allowSealed = (!preview.isPreview(Feature.SEALED_CLASSES) || preview.isEnabled()) &&
|
||||
Feature.SEALED_CLASSES.allowedInSource(source);
|
||||
}
|
||||
|
@ -150,8 +150,7 @@ public class Resolve {
|
||||
Feature.POST_APPLICABILITY_VARARGS_ACCESS_CHECK.allowedInSource(source);
|
||||
polymorphicSignatureScope = WriteableScope.create(syms.noSymbol);
|
||||
allowModules = Feature.MODULES.allowedInSource(source);
|
||||
allowRecords = (!preview.isPreview(Feature.RECORDS) || preview.isEnabled()) &&
|
||||
Feature.RECORDS.allowedInSource(source);
|
||||
allowRecords = Feature.RECORDS.allowedInSource(source);
|
||||
}
|
||||
|
||||
/** error symbols, which are returned when resolution fails
|
||||
|
@ -272,8 +272,7 @@ public class ClassReader {
|
||||
Source source = Source.instance(context);
|
||||
preview = Preview.instance(context);
|
||||
allowModules = Feature.MODULES.allowedInSource(source);
|
||||
allowRecords = (!preview.isPreview(Feature.RECORDS) || preview.isEnabled()) &&
|
||||
Feature.RECORDS.allowedInSource(source);
|
||||
allowRecords = Feature.RECORDS.allowedInSource(source);
|
||||
allowSealedTypes = (!preview.isPreview(Feature.SEALED_CLASSES) || preview.isEnabled()) &&
|
||||
Feature.SEALED_CLASSES.allowedInSource(source);
|
||||
|
||||
|
@ -184,8 +184,7 @@ public class JavacParser implements Parser {
|
||||
endPosTable = newEndPosTable(keepEndPositions);
|
||||
this.allowYieldStatement = (!preview.isPreview(Feature.SWITCH_EXPRESSION) || preview.isEnabled()) &&
|
||||
Feature.SWITCH_EXPRESSION.allowedInSource(source);
|
||||
this.allowRecords = (!preview.isPreview(Feature.RECORDS) || preview.isEnabled()) &&
|
||||
Feature.RECORDS.allowedInSource(source);
|
||||
this.allowRecords = Feature.RECORDS.allowedInSource(source);
|
||||
this.allowSealedTypes = (!preview.isPreview(Feature.SEALED_CLASSES) || preview.isEnabled()) &&
|
||||
Feature.SEALED_CLASSES.allowedInSource(source);
|
||||
}
|
||||
@ -3717,7 +3716,7 @@ public class JavacParser implements Parser {
|
||||
} else {
|
||||
int pos = token.pos;
|
||||
List<JCTree> errs;
|
||||
if (token.kind == IDENTIFIER && token.name() == names.record && preview.isEnabled()) {
|
||||
if (token.kind == IDENTIFIER && token.name() == names.record) {
|
||||
checkSourceLevel(Feature.RECORDS);
|
||||
JCErroneous erroneousTree = syntaxError(token.pos, List.of(mods), Errors.RecordHeaderExpected);
|
||||
return toP(F.Exec(erroneousTree));
|
||||
@ -4214,7 +4213,7 @@ public class JavacParser implements Parser {
|
||||
(peekToken(TokenKind.IDENTIFIER, TokenKind.LPAREN) ||
|
||||
peekToken(TokenKind.IDENTIFIER, TokenKind.EOF) ||
|
||||
peekToken(TokenKind.IDENTIFIER, TokenKind.LT))) {
|
||||
checkSourceLevel(Feature.RECORDS);
|
||||
checkSourceLevel(Feature.RECORDS);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -23,15 +23,15 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @library /test/lib
|
||||
* @summary Test that a class that is a record can be redefined.
|
||||
* @modules java.base/jdk.internal.misc
|
||||
* @modules java.instrument
|
||||
* jdk.jartool/sun.tools.jar
|
||||
* @requires vm.jvmti
|
||||
* @compile --enable-preview -source ${jdk.version} RedefineRecord.java
|
||||
* @run main/othervm --enable-preview RedefineRecord buildagent
|
||||
* @run main/othervm/timeout=6000 --enable-preview RedefineRecord runtest
|
||||
* @run main RedefineRecord buildagent
|
||||
* @run main/othervm/timeout=6000 RedefineRecord runtest
|
||||
*/
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
@ -100,7 +100,6 @@ public class RedefineRecord {
|
||||
"-XX:MetaspaceSize=12m",
|
||||
"-XX:MaxMetaspaceSize=12m",
|
||||
"-javaagent:redefineagent.jar",
|
||||
"--enable-preview",
|
||||
"RedefineRecord");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldNotContain("processing of -javaagent failed");
|
||||
|
@ -28,7 +28,7 @@
|
||||
// not cause a ClassFormatError exception.
|
||||
class abstractRecord {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
60; // version
|
||||
[69] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -28,7 +28,7 @@
|
||||
// Utf8. It should result in a ClassFormatError exception.
|
||||
class badRecordAttribute {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
60; // version
|
||||
[69] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 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
|
||||
* @summary test logging of reasons for ignoring Record attribute
|
||||
* @library /test/lib
|
||||
* @compile recordIgnoredVersion.jcod
|
||||
* @run driver ignoreRecordAttribute
|
||||
*/
|
||||
|
||||
import jdk.test.lib.process.ProcessTools;
|
||||
import jdk.test.lib.process.OutputAnalyzer;
|
||||
|
||||
public class ignoreRecordAttribute {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String MAJOR_VERSION = Integer.toString(44 + Runtime.version().feature());
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--enable-preview",
|
||||
"-Xlog:class+record", "-Xshare:off", "recordIgnoredVersion");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Ignoring Record attribute");
|
||||
output.shouldContain("because class file version is not " + MAJOR_VERSION + ".65535");
|
||||
}
|
||||
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
// not cause a ClassFormatError exception.
|
||||
class notFinalRecord {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
60; // version
|
||||
[69] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @compile abstractRecord.jcod notFinalRecord.jcod oldRecordAttribute.jcod superNotJLRecord.jcod
|
||||
* @compile shortRecordAttribute.jcod twoRecordAttributes.jcod badRecordAttribute.jcod
|
||||
*
|
||||
* @run main/othervm --enable-preview recordAttributeTest
|
||||
* @run main recordAttributeTest
|
||||
*/
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ public class recordAttributeTest {
|
||||
public static void runTest(String className, String cfeMessage) {
|
||||
try {
|
||||
Class newClass = Class.forName(className);
|
||||
throw new RuntimeException("Expected ClasFormatError exception not thrown");
|
||||
throw new RuntimeException("Expected ClassFormatError exception not thrown");
|
||||
} catch (java.lang.ClassFormatError e) {
|
||||
String eMsg = e.getMessage();
|
||||
if (!eMsg.contains(cfeMessage)) {
|
||||
|
@ -1,256 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// Record attribute is ignored because class file minor version is 0.
|
||||
class recordIgnoredVersion {
|
||||
0xCAFEBABE;
|
||||
0; // minor version
|
||||
60; // version
|
||||
[52] { // Constant Pool
|
||||
; // first element is empty
|
||||
Method #2 #3; // #1 at 0x0A
|
||||
class #4; // #2 at 0x0F
|
||||
NameAndType #5 #6; // #3 at 0x12
|
||||
Utf8 "java/lang/Record"; // #4 at 0x17
|
||||
Utf8 "<init>"; // #5 at 0x2A
|
||||
Utf8 "()V"; // #6 at 0x33
|
||||
Field #8 #9; // #7 at 0x39
|
||||
class #10; // #8 at 0x3E
|
||||
NameAndType #11 #12; // #9 at 0x41
|
||||
Utf8 "recordIgnoredVersion"; // #10 at 0x46
|
||||
Utf8 "x"; // #11 at 0x56
|
||||
Utf8 "I"; // #12 at 0x5A
|
||||
Field #8 #9; // #13 at 0x5E
|
||||
InvokeDynamic 0s #15; // #14 at 0x63
|
||||
NameAndType #16 #17; // #15 at 0x68
|
||||
Utf8 "toString"; // #16 at 0x6D
|
||||
Utf8 "(LrecordIgnoredVersion;)Ljava/lang/String;"; // #17 at 0x78
|
||||
InvokeDynamic 0s #19; // #18 at 0x9E
|
||||
NameAndType #20 #21; // #19 at 0xA3
|
||||
Utf8 "hashCode"; // #20 at 0xA8
|
||||
Utf8 "(LrecordIgnoredVersion;)I"; // #21 at 0xB3
|
||||
InvokeDynamic 0s #23; // #22 at 0xC8
|
||||
NameAndType #24 #25; // #23 at 0xCD
|
||||
Utf8 "equals"; // #24 at 0xD2
|
||||
Utf8 "(LrecordIgnoredVersion;Ljava/lang/Object;)Z"; // #25 at 0xDB
|
||||
Utf8 "(I)V"; // #26 at 0x0102
|
||||
Utf8 "Code"; // #27 at 0x0109
|
||||
Utf8 "LineNumberTable"; // #28 at 0x0110
|
||||
Utf8 "MethodParameters"; // #29 at 0x0122
|
||||
Utf8 "()Ljava/lang/String;"; // #30 at 0x0135
|
||||
Utf8 "()I"; // #31 at 0x014C
|
||||
Utf8 "(Ljava/lang/Object;)Z"; // #32 at 0x0152
|
||||
Utf8 "SourceFile"; // #33 at 0x016A
|
||||
Utf8 "recordIgnoredVersion.java"; // #34 at 0x0177
|
||||
Utf8 "Record"; // #35 at 0x018C
|
||||
Utf8 "BootstrapMethods"; // #36 at 0x0195
|
||||
MethodHandle 6b #38; // #37 at 0x01A8
|
||||
Method #39 #40; // #38 at 0x01AC
|
||||
class #41; // #39 at 0x01B1
|
||||
NameAndType #42 #43; // #40 at 0x01B4
|
||||
Utf8 "java/lang/runtime/ObjectMethods"; // #41 at 0x01B9
|
||||
Utf8 "bootstrap"; // #42 at 0x01DB
|
||||
Utf8 "(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/TypeDescriptor;Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/invoke/MethodHandle;)Ljava/lang/Object;"; // #43 at 0x01E7
|
||||
String #11; // #44 at 0x029B
|
||||
MethodHandle 1b #7; // #45 at 0x029E
|
||||
Utf8 "InnerClasses"; // #46 at 0x02A2
|
||||
class #48; // #47 at 0x02B1
|
||||
Utf8 "java/lang/invoke/MethodHandles$Lookup"; // #48 at 0x02B4
|
||||
class #50; // #49 at 0x02DC
|
||||
Utf8 "java/lang/invoke/MethodHandles"; // #50 at 0x02DF
|
||||
Utf8 "Lookup"; // #51 at 0x0300
|
||||
} // Constant Pool
|
||||
|
||||
0x0030; // access [ ACC_SUPER ACC_FINAL ]
|
||||
#8;// this_cpx
|
||||
#2;// super_cpx
|
||||
|
||||
[0] { // Interfaces
|
||||
} // Interfaces
|
||||
|
||||
[1] { // fields
|
||||
{ // Member at 0x0313
|
||||
0x8012; // access
|
||||
#11; // name_cpx
|
||||
#12; // sig_cpx
|
||||
[0] { // Attributes
|
||||
} // Attributes
|
||||
} // Member
|
||||
} // fields
|
||||
|
||||
[5] { // methods
|
||||
{ // Member at 0x031D
|
||||
0x0001; // access
|
||||
#5; // name_cpx
|
||||
#26; // sig_cpx
|
||||
[2] { // Attributes
|
||||
Attr(#27, 34) { // Code at 0x0325
|
||||
2; // max_stack
|
||||
2; // max_locals
|
||||
Bytes[10]{
|
||||
0x2AB700012A1BB500;
|
||||
0x07B1;
|
||||
}
|
||||
[0] { // Traps
|
||||
} // end Traps
|
||||
[1] { // Attributes
|
||||
Attr(#28, 6) { // LineNumberTable at 0x0341
|
||||
[1] { // LineNumberTable
|
||||
0 1; // at 0x034D
|
||||
}
|
||||
} // end LineNumberTable
|
||||
} // Attributes
|
||||
} // end Code
|
||||
;
|
||||
Attr(#29, 5) { // MethodParameters at 0x034D
|
||||
0x01000B8000;
|
||||
} // end MethodParameters
|
||||
} // Attributes
|
||||
} // Member
|
||||
;
|
||||
{ // Member at 0x0358
|
||||
0x8001; // access
|
||||
#16; // name_cpx
|
||||
#30; // sig_cpx
|
||||
[1] { // Attributes
|
||||
Attr(#27, 31) { // Code at 0x0360
|
||||
1; // max_stack
|
||||
1; // max_locals
|
||||
Bytes[7]{
|
||||
0x2ABA000E0000B0;
|
||||
}
|
||||
[0] { // Traps
|
||||
} // end Traps
|
||||
[1] { // Attributes
|
||||
Attr(#28, 6) { // LineNumberTable at 0x0379
|
||||
[1] { // LineNumberTable
|
||||
0 1; // at 0x0385
|
||||
}
|
||||
} // end LineNumberTable
|
||||
} // Attributes
|
||||
} // end Code
|
||||
} // Attributes
|
||||
} // Member
|
||||
;
|
||||
{ // Member at 0x0385
|
||||
0x8011; // access
|
||||
#20; // name_cpx
|
||||
#31; // sig_cpx
|
||||
[1] { // Attributes
|
||||
Attr(#27, 31) { // Code at 0x038D
|
||||
1; // max_stack
|
||||
1; // max_locals
|
||||
Bytes[7]{
|
||||
0x2ABA00120000AC;
|
||||
}
|
||||
[0] { // Traps
|
||||
} // end Traps
|
||||
[1] { // Attributes
|
||||
Attr(#28, 6) { // LineNumberTable at 0x03A6
|
||||
[1] { // LineNumberTable
|
||||
0 1; // at 0x03B2
|
||||
}
|
||||
} // end LineNumberTable
|
||||
} // Attributes
|
||||
} // end Code
|
||||
} // Attributes
|
||||
} // Member
|
||||
;
|
||||
{ // Member at 0x03B2
|
||||
0x8011; // access
|
||||
#24; // name_cpx
|
||||
#32; // sig_cpx
|
||||
[1] { // Attributes
|
||||
Attr(#27, 32) { // Code at 0x03BA
|
||||
2; // max_stack
|
||||
2; // max_locals
|
||||
Bytes[8]{
|
||||
0x2A2BBA00160000AC;
|
||||
}
|
||||
[0] { // Traps
|
||||
} // end Traps
|
||||
[1] { // Attributes
|
||||
Attr(#28, 6) { // LineNumberTable at 0x03D4
|
||||
[1] { // LineNumberTable
|
||||
0 1; // at 0x03E0
|
||||
}
|
||||
} // end LineNumberTable
|
||||
} // Attributes
|
||||
} // end Code
|
||||
} // Attributes
|
||||
} // Member
|
||||
;
|
||||
{ // Member at 0x03E0
|
||||
0x8001; // access
|
||||
#11; // name_cpx
|
||||
#31; // sig_cpx
|
||||
[1] { // Attributes
|
||||
Attr(#27, 29) { // Code at 0x03E8
|
||||
1; // max_stack
|
||||
1; // max_locals
|
||||
Bytes[5]{
|
||||
0x2AB4000DAC;
|
||||
}
|
||||
[0] { // Traps
|
||||
} // end Traps
|
||||
[1] { // Attributes
|
||||
Attr(#28, 6) { // LineNumberTable at 0x03FF
|
||||
[1] { // LineNumberTable
|
||||
0 1; // at 0x040B
|
||||
}
|
||||
} // end LineNumberTable
|
||||
} // Attributes
|
||||
} // end Code
|
||||
} // Attributes
|
||||
} // Member
|
||||
} // methods
|
||||
|
||||
[4] { // Attributes
|
||||
Attr(#33, 2) { // SourceFile at 0x040D
|
||||
#34;
|
||||
} // end SourceFile
|
||||
;
|
||||
Attr(#35, 8) { // Record at 0x0415
|
||||
0x0001000B000C0000;
|
||||
} // end Record
|
||||
;
|
||||
Attr(#36, 12) { // BootstrapMethods at 0x0423
|
||||
[1] { // bootstrap_methods
|
||||
{ // bootstrap_method
|
||||
#37; // bootstrap_method_ref
|
||||
[3] { // bootstrap_arguments
|
||||
#8; // at 0x0431
|
||||
#44; // at 0x0433
|
||||
#45; // at 0x0435
|
||||
} // bootstrap_arguments
|
||||
} // bootstrap_method
|
||||
}
|
||||
} // end BootstrapMethods
|
||||
;
|
||||
Attr(#46, 10) { // InnerClasses at 0x0435
|
||||
[1] { // InnerClasses
|
||||
#47 #49 #51 25; // at 0x0445
|
||||
}
|
||||
} // end InnerClasses
|
||||
} // Attributes
|
||||
} // end class recordIgnoredVersion
|
@ -23,8 +23,8 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @compile --enable-preview --source ${jdk.version} recordReflectionTest.java
|
||||
* @run main/othervm --enable-preview recordReflectionTest
|
||||
* @bug 8246774
|
||||
* @summary testing reflection APIs for record classes
|
||||
*/
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
// attribute_count field. It should result in a ClassFormatError exception.
|
||||
class shortRecordAttribute {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
60; // version
|
||||
[69] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -29,7 +29,7 @@
|
||||
// causing a ClassFormatError exception.
|
||||
class superNotJLRecord {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
60; // version
|
||||
[69] { // Constant Pool
|
||||
; // first element is empty
|
||||
@ -355,7 +355,7 @@ class superNotJLRecord {
|
||||
// ClassFormatError exception.
|
||||
class superNotJLRecordOK {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
60; // version
|
||||
[69] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -28,7 +28,7 @@
|
||||
// a ClassFormatError exception.
|
||||
class twoRecordAttributes {
|
||||
0xCAFEBABE;
|
||||
65535; // minor version
|
||||
0; // minor version
|
||||
60; // version
|
||||
[69] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Checks that the appropriate default value is given to the canonical ctr
|
||||
* @compile --enable-preview -source ${jdk.version} AbsentStreamValuesTest.java
|
||||
* @run testng/othervm --enable-preview AbsentStreamValuesTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy --enable-preview AbsentStreamValuesTest
|
||||
* @run testng AbsentStreamValuesTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy AbsentStreamValuesTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -23,12 +23,12 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary InvalidClassException is thrown when the canonical constructor
|
||||
* cannot be found during deserialization.
|
||||
* @library /test/lib
|
||||
* @modules java.base/jdk.internal.org.objectweb.asm
|
||||
* @compile --enable-preview -source ${jdk.version} BadCanonicalCtrTest.java
|
||||
* @run testng/othervm --enable-preview BadCanonicalCtrTest
|
||||
* @run testng BadCanonicalCtrTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@ -59,7 +59,6 @@ import static org.testng.Assert.expectThrows;
|
||||
* constructor cannot be found during deserialization.
|
||||
*/
|
||||
public class BadCanonicalCtrTest {
|
||||
private static final String VERSION = Integer.toString(Runtime.version().feature());
|
||||
|
||||
// ClassLoader for creating instances of the records to test with.
|
||||
ClassLoader goodRecordClassLoader;
|
||||
@ -79,8 +78,7 @@ public class BadCanonicalCtrTest {
|
||||
public void setup() {
|
||||
{
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("R1",
|
||||
"public record R1 () implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
"public record R1 () implements java.io.Serializable { }");
|
||||
goodRecordClassLoader = new ByteCodeLoader("R1", byteCode, BadCanonicalCtrTest.class.getClassLoader());
|
||||
byte[] bc1 = removeConstructor(byteCode);
|
||||
missingCtrClassLoader = new ByteCodeLoader("R1", bc1, BadCanonicalCtrTest.class.getClassLoader());
|
||||
@ -89,8 +87,7 @@ public class BadCanonicalCtrTest {
|
||||
}
|
||||
{
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("R2",
|
||||
"public record R2 (int x, int y) implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
"public record R2 (int x, int y) implements java.io.Serializable { }");
|
||||
goodRecordClassLoader = new ByteCodeLoader("R2", byteCode, goodRecordClassLoader);
|
||||
byte[] bc1 = removeConstructor(byteCode);
|
||||
missingCtrClassLoader = new ByteCodeLoader("R2", bc1, missingCtrClassLoader);
|
||||
@ -101,8 +98,7 @@ public class BadCanonicalCtrTest {
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("R3",
|
||||
"public record R3 (long l) implements java.io.Externalizable {" +
|
||||
" public void writeExternal(java.io.ObjectOutput out) { }" +
|
||||
" public void readExternal(java.io.ObjectInput in) { } }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
" public void readExternal(java.io.ObjectInput in) { } }");
|
||||
goodRecordClassLoader = new ByteCodeLoader("R3", byteCode, goodRecordClassLoader);
|
||||
byte[] bc1 = removeConstructor(byteCode);
|
||||
missingCtrClassLoader = new ByteCodeLoader("R3", bc1, missingCtrClassLoader);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic test that serializes and deserializes a number of records
|
||||
* @compile --enable-preview -source ${jdk.version} BasicRecordSer.java
|
||||
* @run testng/othervm --enable-preview BasicRecordSer
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy --enable-preview BasicRecordSer
|
||||
* @run testng BasicRecordSer
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy BasicRecordSer
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,11 +23,11 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Ensures that the serialization implementation can *always* access
|
||||
* the record constructor
|
||||
* @compile --enable-preview -source ${jdk.version} ConstructorAccessTest.java
|
||||
* @run testng/othervm --enable-preview ConstructorAccessTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy --enable-preview ConstructorAccessTest
|
||||
* @run testng ConstructorAccessTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy ConstructorAccessTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Verifies that privileged operations performed in the record
|
||||
* constructor throw, when run without the required permissions
|
||||
* @compile --enable-preview -source ${jdk.version} ConstructorPermissionTest.java
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy --enable-preview ConstructorPermissionTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy ConstructorPermissionTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Ensures basic behavior of cycles from record components
|
||||
* @compile --enable-preview -source ${jdk.version} CycleTest.java
|
||||
* @run testng/othervm --enable-preview CycleTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy --enable-preview CycleTest
|
||||
* @run testng CycleTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy CycleTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -23,11 +23,11 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Checks that the appropriate value is given to the canonical ctr
|
||||
* @library /test/lib
|
||||
* @compile --enable-preview -source ${jdk.version} DifferentStreamFieldsTest.java
|
||||
* @run testng/othervm --enable-preview DifferentStreamFieldsTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy --enable-preview DifferentStreamFieldsTest
|
||||
* @run testng DifferentStreamFieldsTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy DifferentStreamFieldsTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -23,11 +23,11 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic tests for prohibited magic serialization methods
|
||||
* @library /test/lib
|
||||
* @modules java.base/jdk.internal.org.objectweb.asm
|
||||
* @compile --enable-preview -source ${jdk.version} ProhibitedMethods.java
|
||||
* @run testng/othervm --enable-preview ProhibitedMethods
|
||||
* @run testng ProhibitedMethods
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@ -69,7 +69,6 @@ import static org.testng.Assert.fail;
|
||||
* record objects.
|
||||
*/
|
||||
public class ProhibitedMethods {
|
||||
private static final String VERSION = Integer.toString(Runtime.version().feature());
|
||||
|
||||
public interface ThrowingExternalizable extends Externalizable {
|
||||
default void writeExternal(ObjectOutput out) {
|
||||
@ -106,8 +105,7 @@ public class ProhibitedMethods {
|
||||
public void setup() {
|
||||
{
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("Foo",
|
||||
"public record Foo () implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
"public record Foo () implements java.io.Serializable { }");
|
||||
byteCode = addWriteObject(byteCode);
|
||||
byteCode = addReadObject(byteCode);
|
||||
byteCode = addReadObjectNoData(byteCode);
|
||||
@ -115,8 +113,7 @@ public class ProhibitedMethods {
|
||||
}
|
||||
{
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("Bar",
|
||||
"public record Bar (int x, int y) implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
"public record Bar (int x, int y) implements java.io.Serializable { }");
|
||||
byteCode = addWriteObject(byteCode);
|
||||
byteCode = addReadObject(byteCode);
|
||||
byteCode = addReadObjectNoData(byteCode);
|
||||
@ -125,8 +122,7 @@ public class ProhibitedMethods {
|
||||
{
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("Baz",
|
||||
"import java.io.Serializable;" +
|
||||
"public record Baz<U extends Serializable,V extends Serializable>(U u, V v) implements Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
"public record Baz<U extends Serializable,V extends Serializable>(U u, V v) implements Serializable { }");
|
||||
byteCode = addWriteObject(byteCode);
|
||||
byteCode = addReadObject(byteCode);
|
||||
byteCode = addReadObjectNoData(byteCode);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic tests for readResolve
|
||||
* @compile --enable-preview -source ${jdk.version} ReadResolveTest.java
|
||||
* @run testng/othervm --enable-preview ReadResolveTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy --enable-preview ReadResolveTest
|
||||
* @run testng ReadResolveTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy ReadResolveTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic tests for serializing and deserializing record classes
|
||||
* @compile --enable-preview -source ${jdk.version} RecordClassTest.java
|
||||
* @run testng/othervm --enable-preview RecordClassTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy --enable-preview RecordClassTest
|
||||
* @run testng RecordClassTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy RecordClassTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -23,11 +23,11 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic tests for prohibited magic serialPersistentFields
|
||||
* @library /test/lib
|
||||
* @modules java.base/jdk.internal.org.objectweb.asm
|
||||
* @compile --enable-preview -source ${jdk.version} SerialPersistentFieldsTest.java
|
||||
* @run testng/othervm --enable-preview SerialPersistentFieldsTest
|
||||
* @run testng SerialPersistentFieldsTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@ -62,7 +62,6 @@ import static org.testng.Assert.assertTrue;
|
||||
* Checks that the serialPersistentFields declaration is effectively ignored.
|
||||
*/
|
||||
public class SerialPersistentFieldsTest {
|
||||
private static final String VERSION = Integer.toString(Runtime.version().feature());
|
||||
|
||||
ClassLoader serializableRecordLoader;
|
||||
|
||||
@ -83,8 +82,7 @@ public class SerialPersistentFieldsTest {
|
||||
public void setup() {
|
||||
{ // R1
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("R1",
|
||||
"public record R1 () implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
"public record R1 () implements java.io.Serializable { }");
|
||||
ObjectStreamField[] serialPersistentFields = {
|
||||
new ObjectStreamField("s", String.class),
|
||||
new ObjectStreamField("i", int.class),
|
||||
@ -96,8 +94,7 @@ public class SerialPersistentFieldsTest {
|
||||
}
|
||||
{ // R2
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("R2",
|
||||
"public record R2 (int x) implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
"public record R2 (int x) implements java.io.Serializable { }");
|
||||
ObjectStreamField[] serialPersistentFields = {
|
||||
new ObjectStreamField("s", String.class)
|
||||
};
|
||||
@ -106,8 +103,7 @@ public class SerialPersistentFieldsTest {
|
||||
}
|
||||
{ // R3
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("R3",
|
||||
"public record R3 (int x, int y) implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
"public record R3 (int x, int y) implements java.io.Serializable { }");
|
||||
ObjectStreamField[] serialPersistentFields = new ObjectStreamField[0];
|
||||
byteCode = addSerialPersistentFields(byteCode, serialPersistentFields);
|
||||
serializableRecordLoader = new ByteCodeLoader("R3", byteCode, serializableRecordLoader);
|
||||
@ -115,8 +111,7 @@ public class SerialPersistentFieldsTest {
|
||||
{ // R4
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("R4",
|
||||
"import java.io.Serializable;" +
|
||||
"public record R4<U extends Serializable,V extends Serializable>(U u, V v) implements Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
"public record R4<U extends Serializable,V extends Serializable>(U u, V v) implements Serializable { }");
|
||||
ObjectStreamField[] serialPersistentFields = {
|
||||
new ObjectStreamField("v", String.class)
|
||||
};
|
||||
@ -132,8 +127,7 @@ public class SerialPersistentFieldsTest {
|
||||
" }\n" +
|
||||
" @Override public void readExternal(ObjectInput in) {\n" +
|
||||
" throw new AssertionError(\"should not reach here\");\n" +
|
||||
" } }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
" } }");
|
||||
ObjectStreamField[] serialPersistentFields = {
|
||||
new ObjectStreamField("v", String.class)
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic tests for SUID in the serial stream
|
||||
* @compile --enable-preview -source ${jdk.version} SerialVersionUIDTest.java
|
||||
* @run testng/othervm --enable-preview SerialVersionUIDTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy --enable-preview SerialVersionUIDTest
|
||||
* @run testng SerialVersionUIDTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy SerialVersionUIDTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,9 +23,9 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Tests for stream references
|
||||
* @compile --enable-preview -source ${jdk.version} StreamRefTest.java
|
||||
* @run testng/othervm --enable-preview StreamRefTest
|
||||
* @run testng StreamRefTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Tests constructor invocation exceptions are handled appropriately
|
||||
* @compile --enable-preview -source ${jdk.version} ThrowingConstructorTest.java
|
||||
* @run testng/othervm --enable-preview ThrowingConstructorTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy --enable-preview ThrowingConstructorTest
|
||||
* @run testng ThrowingConstructorTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy ThrowingConstructorTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -23,10 +23,9 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8238763
|
||||
* @bug 8238763 8246774
|
||||
* @summary ObjectInputStream readUnshared method handling of Records
|
||||
* @compile --enable-preview -source ${jdk.version} UnsharedTest.java
|
||||
* @run testng/othervm --enable-preview UnsharedTest
|
||||
* @run testng UnsharedTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic tests for writeReplace
|
||||
* @compile --enable-preview -source ${jdk.version} WriteReplaceTest.java
|
||||
* @run testng/othervm --enable-preview WriteReplaceTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy --enable-preview WriteReplaceTest
|
||||
* @run testng WriteReplaceTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy WriteReplaceTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -44,8 +44,6 @@ import static org.testng.Assert.*;
|
||||
*/
|
||||
public class AbstractTest {
|
||||
|
||||
private static final String VERSION = Integer.toString(Runtime.version().feature());
|
||||
|
||||
static final String TEST_SRC = System.getProperty("test.src", ".");
|
||||
static final String TEST_CLASSES = System.getProperty("test.classes", ".");
|
||||
static final Path TEST_CLASSES_DIR = Path.of(TEST_CLASSES);
|
||||
@ -59,11 +57,9 @@ public class AbstractTest {
|
||||
@BeforeTest
|
||||
public void setup() throws IOException {
|
||||
assertTrue(CompilerUtils.compile(PLAIN_SRC_DIR, PLAIN_DEST_DIR,
|
||||
"--enable-preview", "-source", VERSION,
|
||||
"--class-path", TEST_CLASSES_DIR.toString()));
|
||||
|
||||
assertTrue(CompilerUtils.compile(RECORD_SRC_DIR, RECORD_DEST_DIR,
|
||||
"--enable-preview", "-source", VERSION,
|
||||
"--class-path", TEST_CLASSES_DIR.toString()));
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,12 +23,13 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Test for subtype stream field value assign-ability
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @compile --enable-preview -source ${jdk.version} AssignableFrom.java Point.java
|
||||
* DefaultValues.java SuperStreamFields.java AssignableFromTest.java
|
||||
* @run testng/othervm --enable-preview AssignableFromTest
|
||||
* @compile AssignableFrom.java Point.java
|
||||
* DefaultValues.java SuperStreamFields.java
|
||||
* @run testng AssignableFromTest
|
||||
*/
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,12 +23,12 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Checks that the appropriate default value is given to the canonical ctr
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @compile --enable-preview -source ${jdk.version} AssignableFrom.java Point.java
|
||||
* DefaultValues.java SuperStreamFields.java DefaultValuesTest.java
|
||||
* @run testng/othervm --enable-preview DefaultValuesTest
|
||||
* @compile AssignableFrom.java Point.java DefaultValues.java SuperStreamFields.java
|
||||
* @run testng DefaultValuesTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,12 +23,12 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary superclass fields in the stream should be discarded
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @compile --enable-preview -source ${jdk.version} AssignableFrom.java Point.java
|
||||
* DefaultValues.java SuperStreamFields.java SuperStreamFieldsTest.java
|
||||
* @run testng/othervm --enable-preview SuperStreamFieldsTest
|
||||
* @compile AssignableFrom.java Point.java DefaultValues.java SuperStreamFields.java
|
||||
* @run testng SuperStreamFieldsTest
|
||||
*/
|
||||
|
||||
import org.testng.annotations.DataProvider;
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Class redefinition must preclude changes to Record attributes
|
||||
* @comment This is a copy of test/jdk/java/lang/instrument/RedefineNestmateAttr/
|
||||
* @comment modified for records and the Record attribute.
|
||||
@ -33,15 +34,14 @@
|
||||
* java.instrument
|
||||
* @compile ../NamedBuffer.java
|
||||
* @run main RedefineClassHelper
|
||||
* @compile --enable-preview -source ${jdk.version} Host/Host.java
|
||||
* @compile --enable-preview -source ${jdk.version} TestRecordAttr.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar --enable-preview -Xlog:redefine+class+record=trace TestRecordAttr Host
|
||||
* @compile --enable-preview -source ${jdk.version} HostA/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar --enable-preview -Xlog:redefine+class+record=trace TestRecordAttr HostA
|
||||
* @compile --enable-preview -source ${jdk.version} HostAB/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar --enable-preview -Xlog:redefine+class+record=trace TestRecordAttr HostAB
|
||||
* @compile --enable-preview -source ${jdk.version} HostABC/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar --enable-preview -Xlog:redefine+class+record=trace TestRecordAttr HostABC
|
||||
* @compile Host/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+record=trace TestRecordAttr Host
|
||||
* @compile HostA/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+record=trace TestRecordAttr HostA
|
||||
* @compile HostAB/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+record=trace TestRecordAttr HostAB
|
||||
* @compile HostABC/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+record=trace TestRecordAttr HostABC
|
||||
*/
|
||||
|
||||
/* Test Description
|
||||
@ -269,8 +269,6 @@ public class TestRecordAttr {
|
||||
" to: " + dst);
|
||||
CompilerUtils.compile(src.toPath(),
|
||||
dst.toPath(),
|
||||
false /* don't recurse */,
|
||||
"--enable-preview",
|
||||
"--source", VERSION);
|
||||
false /* don't recurse */);
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Class redefinition must preclude changes to Record attributes
|
||||
* @comment This is a copy of test/jdk/java/lang/instrument/RedefineNestmateAttr/
|
||||
* @comment modified for records and the Record attribute.
|
||||
@ -33,11 +34,10 @@
|
||||
* java.instrument
|
||||
* @compile ../NamedBuffer.java
|
||||
* @run main RedefineClassHelper
|
||||
* @compile --enable-preview --source ${jdk.version} Host/Host.java
|
||||
* @compile --enable-preview --source ${jdk.version} TestRecordAttrGenericSig.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+record=trace --enable-preview TestRecordAttrGenericSig Host
|
||||
* @compile --enable-preview --source ${jdk.version} HostA/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+record=trace --enable-preview TestRecordAttrGenericSig HostA
|
||||
* @compile Host/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+record=trace TestRecordAttrGenericSig Host
|
||||
* @compile HostA/Host.java
|
||||
* @run main/othervm -javaagent:redefineagent.jar -Xlog:redefine+class+record=trace TestRecordAttrGenericSig HostA
|
||||
*/
|
||||
|
||||
/* Test Description
|
||||
@ -207,8 +207,6 @@ public class TestRecordAttrGenericSig {
|
||||
" to: " + dst);
|
||||
CompilerUtils.compile(src.toPath(),
|
||||
dst.toPath(),
|
||||
false /* don't recurse */,
|
||||
"--enable-preview",
|
||||
"--source", VERSION);
|
||||
false /* don't recurse */);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic tests for ObjectMethods
|
||||
* @compile --enable-preview -source ${jdk.version} ObjectMethodsTest.java
|
||||
* @run testng/othervm --enable-preview ObjectMethodsTest
|
||||
* @run testng/othervm/java.security.policy=empty.policy --enable-preview ObjectMethodsTest
|
||||
* @run testng ObjectMethodsTest
|
||||
* @run testng/othervm/java.security.policy=empty.policy ObjectMethodsTest
|
||||
*/
|
||||
|
||||
import java.lang.invoke.CallSite;
|
||||
|
@ -23,12 +23,11 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8236539
|
||||
* @bug 8236539 8246774
|
||||
* @summary Relative link tags in record javadoc don't resolve
|
||||
* @library /tools/lib ../../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build toolbox.ToolBox javadoc.tester.*
|
||||
* @compile TestRecordLinks.java
|
||||
* @run main TestRecordLinks
|
||||
*/
|
||||
|
||||
@ -74,7 +73,6 @@ public class TestRecordLinks extends JavadocTester {
|
||||
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"example");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
|
@ -23,13 +23,12 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8225055 8239804
|
||||
* @bug 8225055 8239804 8246774
|
||||
* @summary Record types
|
||||
* @library /tools/lib ../../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build toolbox.ToolBox javadoc.tester.*
|
||||
* @compile --enable-preview --source ${jdk.version} TestRecordTypes.java
|
||||
* @run main/othervm --enable-preview TestRecordTypes
|
||||
* @run main TestRecordTypes
|
||||
*/
|
||||
|
||||
|
||||
@ -69,7 +68,6 @@ public class TestRecordTypes extends JavadocTester {
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
src.resolve("R.java").toString());
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -91,7 +89,6 @@ public class TestRecordTypes extends JavadocTester {
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -113,7 +110,6 @@ public class TestRecordTypes extends JavadocTester {
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -139,7 +135,6 @@ public class TestRecordTypes extends JavadocTester {
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -171,7 +166,6 @@ public class TestRecordTypes extends JavadocTester {
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -204,7 +198,6 @@ public class TestRecordTypes extends JavadocTester {
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -268,7 +261,6 @@ public class TestRecordTypes extends JavadocTester {
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"-linkoffline", externalDocs, localDocs,
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -349,7 +341,6 @@ public class TestRecordTypes extends JavadocTester {
|
||||
"-quiet", "-noindex",
|
||||
"--no-platform-links",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -375,7 +366,6 @@ public class TestRecordTypes extends JavadocTester {
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -406,7 +396,6 @@ public class TestRecordTypes extends JavadocTester {
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", testSrc.toString(),
|
||||
"-linksource",
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"examples");
|
||||
|
||||
checkExit(Exit.OK);
|
||||
@ -415,13 +404,11 @@ public class TestRecordTypes extends JavadocTester {
|
||||
"-sourcepath", testSrc.toString(),
|
||||
"-linksource",
|
||||
"-linkoffline", externalDocs, localDocs,
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"examples");
|
||||
checkExit(Exit.OK);
|
||||
}
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("preview")
|
||||
public void testAnnotations(Path base) throws IOException {
|
||||
ElementType[] types = {
|
||||
ElementType.FIELD,
|
||||
@ -468,7 +455,6 @@ public class TestRecordTypes extends JavadocTester {
|
||||
"--no-platform-links",
|
||||
"-sourcepath", src.toString(),
|
||||
"-private",
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6493690
|
||||
* @bug 6493690 8246774
|
||||
* @summary javadoc should have a javax.tools.Tool service provider
|
||||
* @modules java.compiler
|
||||
* jdk.compiler
|
||||
@ -78,7 +78,7 @@ public class GetTask_DiagListenerTest extends APITest {
|
||||
}
|
||||
List<String> expect = Arrays.asList(
|
||||
"javadoc.note.msg", // Loading source file
|
||||
"compiler.err.expected3", // class, interface, enum, or __datum expected
|
||||
"compiler.err.expected4", // class, interface, enum, or record expected
|
||||
"javadoc.note.msg"); // 1 error
|
||||
if (!diagCodes.equals(expect))
|
||||
throw new Exception("unexpected diagnostics occurred");
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8149524 8131024 8165211 8080071 8130454 8167343 8129559 8114842 8182268 8223782 8235474
|
||||
* @bug 8149524 8131024 8165211 8080071 8130454 8167343 8129559 8114842 8182268 8223782 8235474 8246774
|
||||
* @summary Test SourceCodeAnalysis
|
||||
* @build KullaTesting TestingInputStream
|
||||
* @run testng CompletenessTest
|
||||
@ -379,10 +379,4 @@ public class CompletenessTest extends KullaTesting {
|
||||
assertStatus("int[] m = {1, 2}, n = new int[0]; int i;", COMPLETE,
|
||||
"int[] m = {1, 2}, n = new int[0];");
|
||||
}
|
||||
|
||||
@BeforeMethod
|
||||
public void setUp() {
|
||||
setUp(b -> b.compilerOptions("--enable-preview", "-source", String.valueOf(SourceVersion.latest().ordinal())));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8235474 8236715
|
||||
* @bug 8235474 8236715 8246774
|
||||
* @summary Tests for evalution of records
|
||||
* @modules jdk.jshell
|
||||
* @build KullaTesting TestingInputStream ExpectedDiagnostic
|
||||
@ -76,10 +76,4 @@ public class RecordsTest extends KullaTesting {
|
||||
assertEval("record(\"r\")", "\"rr\"");
|
||||
assertEval("record(\"r\").length()", "2");
|
||||
}
|
||||
|
||||
@BeforeMethod
|
||||
public void setUp() {
|
||||
setUp(b -> b.compilerOptions("--enable-preview", "-source", String.valueOf(SourceVersion.latest().ordinal()))
|
||||
.remoteVMOptions("--enable-preview"));
|
||||
}
|
||||
}
|
||||
|
@ -23,14 +23,14 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103 8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466 8172154 8192979 8191842 8198573 8198801 8210596 8210959 8215099 8199623 8236715 8239536 8247456
|
||||
* @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103 8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466 8172154 8192979 8191842 8198573 8198801 8210596 8210959 8215099 8199623 8236715 8239536 8247456 8246774
|
||||
* @summary Simple jshell tool tests
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.main
|
||||
* jdk.jdeps/com.sun.tools.javap
|
||||
* jdk.jshell/jdk.internal.jshell.tool
|
||||
* @build KullaTesting TestingInputStream
|
||||
* @run testng/othervm ToolSimpleTest
|
||||
* @run testng ToolSimpleTest
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -917,7 +917,7 @@ public class ToolSimpleTest extends ReplToolTesting {
|
||||
|
||||
@Test
|
||||
public void testRecords() {
|
||||
test(new String[] {"--enable-preview"},
|
||||
test(new String[] {},
|
||||
(a) -> assertCommandOutputContains(a, "record R(int i) { public int g() { return j; } }",
|
||||
"| created record R, however, it cannot be instantiated or its methods invoked until variable j is declared"),
|
||||
(a) -> assertCommandOutputContains(a, "new R(0)",
|
||||
|
@ -1,10 +1,9 @@
|
||||
/**
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 5012028 6384539 8074364 8250741
|
||||
* @bug 5012028 6384539 8074364 8250741 8246774
|
||||
* @summary javac crash when declare an annotation type illegally
|
||||
*
|
||||
* @compile/fail/ref=IllegalAnnotation.out -XDrawDiagnostics IllegalAnnotation.java
|
||||
* @compile/fail/ref=IllegalAnnotation.out -XDrawDiagnostics --enable-preview -source ${jdk.version} IllegalAnnotation.java
|
||||
*/
|
||||
class IllegalAnnotation {
|
||||
{
|
||||
|
@ -1,2 +1,2 @@
|
||||
IllegalAnnotation.java:11:10: compiler.err.annotation.decl.not.allowed.here
|
||||
IllegalAnnotation.java:10:10: compiler.err.annotation.decl.not.allowed.here
|
||||
1 error
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8242478
|
||||
* @bug 8242478 8246774
|
||||
* @summary test for local interfaces
|
||||
* @compile/fail/ref=LocalInterface.out -XDrawDiagnostics LocalInterface.java
|
||||
* @compile --enable-preview -source ${jdk.version} LocalInterface.java
|
||||
* @compile/fail/ref=LocalInterface.out -XDrawDiagnostics -source 15 LocalInterface.java
|
||||
* @compile LocalInterface.java
|
||||
*/
|
||||
class LocalInterface {
|
||||
void m() {
|
||||
|
@ -1,2 +1,4 @@
|
||||
- compiler.warn.source.no.system.modules.path: 15
|
||||
LocalInterface.java:10:9: compiler.err.intf.not.allowed.here
|
||||
1 error
|
||||
1 warning
|
||||
|
@ -23,9 +23,9 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8242478
|
||||
* @bug 8242478 8246774
|
||||
* @summary test local records
|
||||
* @compile --enable-preview -source ${jdk.version} LocalRecord.java
|
||||
* @compile LocalRecord.java
|
||||
*/
|
||||
class LocalRecord {
|
||||
void m() {
|
||||
|
@ -24,12 +24,11 @@
|
||||
/*
|
||||
* @test
|
||||
* @summary test for com.sun.tools.javac.comp.Check::validateAnnotation, com.sun.tools.javac.code.SymbolMetadata::removeDeclarationMetadata and ::removeFromCompoundList
|
||||
* @bug 8241312
|
||||
* @bug 8241312 8246774
|
||||
* @library /tools/lib
|
||||
* @modules jdk.compiler/com.sun.tools.javac.util
|
||||
* jdk.jdeps/com.sun.tools.classfile
|
||||
* @compile --enable-preview -source ${jdk.version} ApplicableAnnotationsOnRecords.java
|
||||
* @run main/othervm --enable-preview ApplicableAnnotationsOnRecords
|
||||
* @run main ApplicableAnnotationsOnRecords
|
||||
*/
|
||||
import com.sun.tools.classfile.*;
|
||||
import com.sun.tools.javac.util.Assert;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 7151010 8006547 8007766 8029017
|
||||
* @bug 7151010 8006547 8007766 8029017 8246774
|
||||
* @summary Default test cases for running combinations for Target values
|
||||
* @modules jdk.compiler
|
||||
* @build Helper
|
||||
@ -204,25 +204,22 @@ public class TargetAnnoCombo {
|
||||
}
|
||||
}
|
||||
|
||||
// options to be passed if all targets, including RECORD_COMPONENTS, are to be considered
|
||||
List<String> previewOptions = List.of(
|
||||
"--enable-preview",
|
||||
"-source", Integer.toString(Runtime.version().feature())
|
||||
);
|
||||
// options to be passed if target RECORD_COMPONENT can't be considered
|
||||
List<String> source8 = List.of("-source", "8");
|
||||
|
||||
private void generate() {
|
||||
// Adding test cases to run.
|
||||
testCases.addAll(Arrays.asList(
|
||||
// No base target against no container target.
|
||||
new TestCase(noSet, noSet),
|
||||
/* 0*/ new TestCase(noSet, noSet),
|
||||
// No base target against empty container target.
|
||||
new TestCase(noSet, empty),
|
||||
/* 1*/ new TestCase(noSet, empty),
|
||||
// No base target against TYPE_USE only container target.
|
||||
new TestCase(noSet, less(jdk8, TYPE_PARAMETER)),
|
||||
new TestCase(noSet, less(jdk8, TYPE_PARAMETER), source8),
|
||||
// No base target against TYPE_PARAMETER only container target.
|
||||
new TestCase(noSet, less(jdk8, TYPE_USE)),
|
||||
new TestCase(noSet, less(jdk8, TYPE_USE), source8),
|
||||
// No base target against TYPE_USE + TYPE_PARAMETER only container target.
|
||||
new TestCase(noSet, jdk8),
|
||||
new TestCase(noSet, jdk8, source8),
|
||||
// No base target against TYPE_USE + some selection of jdk7 targets.
|
||||
new TestCase(noSet,
|
||||
plus(EnumSet.range(TYPE, LOCAL_VARIABLE), TYPE_USE)),
|
||||
@ -233,7 +230,7 @@ public class TargetAnnoCombo {
|
||||
new TestCase(noSet, plus(empty, TYPE)),
|
||||
new TestCase(noSet, plus(empty, PARAMETER)),
|
||||
new TestCase(noSet, plus(empty, PACKAGE)),
|
||||
new TestCase(noSet, plus(empty, METHOD)),
|
||||
/* 10*/ new TestCase(noSet, plus(empty, METHOD)),
|
||||
new TestCase(noSet, plus(empty, LOCAL_VARIABLE)),
|
||||
new TestCase(noSet, plus(empty, FIELD)),
|
||||
new TestCase(noSet, plus(empty, CONSTRUCTOR)),
|
||||
@ -246,32 +243,32 @@ public class TargetAnnoCombo {
|
||||
new TestCase(empty, plus(empty, TYPE)),
|
||||
new TestCase(empty, plus(empty, PARAMETER)),
|
||||
new TestCase(empty, plus(empty, PACKAGE)),
|
||||
new TestCase(empty, plus(empty, METHOD)),
|
||||
/* 20*/ new TestCase(empty, plus(empty, METHOD)),
|
||||
new TestCase(empty, plus(empty, LOCAL_VARIABLE)),
|
||||
new TestCase(empty, plus(empty, FIELD)),
|
||||
new TestCase(empty, plus(empty, CONSTRUCTOR)),
|
||||
new TestCase(empty, plus(empty, ANNOTATION_TYPE)),
|
||||
new TestCase(empty, less(jdk8, TYPE_USE)),
|
||||
new TestCase(empty, less(jdk8, TYPE_PARAMETER)),
|
||||
new TestCase(empty, less(jdk8, TYPE_USE), source8),
|
||||
new TestCase(empty, less(jdk8, TYPE_PARAMETER), source8),
|
||||
// No container target against all all-but one jdk7 targets.
|
||||
new TestCase(less(jdk7, TYPE), noSet),
|
||||
new TestCase(less(jdk7, PARAMETER), noSet),
|
||||
new TestCase(less(jdk7, PACKAGE), noSet),
|
||||
new TestCase(less(jdk7, METHOD), noSet),
|
||||
new TestCase(less(jdk7, LOCAL_VARIABLE), noSet),
|
||||
new TestCase(less(jdk7, FIELD), noSet),
|
||||
new TestCase(less(jdk7, CONSTRUCTOR), noSet),
|
||||
new TestCase(less(jdk7, ANNOTATION_TYPE), noSet),
|
||||
new TestCase(less(jdk7, TYPE), noSet, source8),
|
||||
new TestCase(less(jdk7, PARAMETER), noSet, source8),
|
||||
new TestCase(less(jdk7, PACKAGE), noSet, source8),
|
||||
/* 30*/ new TestCase(less(jdk7, METHOD), noSet, source8),
|
||||
new TestCase(less(jdk7, LOCAL_VARIABLE), noSet, source8),
|
||||
new TestCase(less(jdk7, FIELD), noSet, source8),
|
||||
new TestCase(less(jdk7, CONSTRUCTOR), noSet, source8),
|
||||
new TestCase(less(jdk7, ANNOTATION_TYPE), noSet, source8),
|
||||
// No container against all but TYPE and ANNOTATION_TYPE
|
||||
new TestCase(less(jdk7, TYPE, ANNOTATION_TYPE), noSet),
|
||||
// No container against jdk7 targets.
|
||||
new TestCase(jdk7, noSet),
|
||||
new TestCase(jdk7, noSet, source8),
|
||||
// No container against jdk7 targets plus one or both of TYPE_USE, TYPE_PARAMETER
|
||||
new TestCase(plus(jdk7, TYPE_USE), noSet),
|
||||
new TestCase(plus(jdk7, TYPE_PARAMETER), noSet),
|
||||
new TestCase(allTargets, noSet, previewOptions),
|
||||
new TestCase(plus(jdk7, TYPE_USE), noSet, source8),
|
||||
new TestCase(plus(jdk7, TYPE_PARAMETER), noSet, source8),
|
||||
new TestCase(allTargets, noSet, null),
|
||||
// Empty container target against any lone target.
|
||||
new TestCase(plus(empty, TYPE), empty),
|
||||
/* 40*/ new TestCase(plus(empty, TYPE), empty),
|
||||
new TestCase(plus(empty, PARAMETER), empty),
|
||||
new TestCase(plus(empty, PACKAGE), empty),
|
||||
new TestCase(plus(empty, METHOD), empty),
|
||||
@ -282,34 +279,34 @@ public class TargetAnnoCombo {
|
||||
new TestCase(plus(empty, TYPE_USE), empty),
|
||||
new TestCase(plus(empty, TYPE_PARAMETER), empty),
|
||||
// All base targets against all container targets.
|
||||
new TestCase(allTargets, allTargets, previewOptions),
|
||||
/* 50*/ new TestCase(allTargets, allTargets),
|
||||
// All base targets against all but one container targets.
|
||||
new TestCase(allTargets, less(allTargets, TYPE), previewOptions),
|
||||
new TestCase(allTargets, less(allTargets, PARAMETER), previewOptions),
|
||||
new TestCase(allTargets, less(allTargets, PACKAGE), previewOptions),
|
||||
new TestCase(allTargets, less(allTargets, METHOD), previewOptions),
|
||||
new TestCase(allTargets, less(allTargets, LOCAL_VARIABLE), previewOptions),
|
||||
new TestCase(allTargets, less(allTargets, FIELD), previewOptions),
|
||||
new TestCase(allTargets, less(allTargets, CONSTRUCTOR), previewOptions),
|
||||
new TestCase(allTargets, less(allTargets, ANNOTATION_TYPE), previewOptions),
|
||||
new TestCase(allTargets, less(allTargets, TYPE_USE), previewOptions),
|
||||
new TestCase(allTargets, less(allTargets, TYPE_PARAMETER), previewOptions),
|
||||
new TestCase(allTargets, less(allTargets, TYPE)),
|
||||
new TestCase(allTargets, less(allTargets, PARAMETER)),
|
||||
new TestCase(allTargets, less(allTargets, PACKAGE)),
|
||||
new TestCase(allTargets, less(allTargets, METHOD)),
|
||||
new TestCase(allTargets, less(allTargets, LOCAL_VARIABLE)),
|
||||
new TestCase(allTargets, less(allTargets, FIELD)),
|
||||
new TestCase(allTargets, less(allTargets, CONSTRUCTOR)),
|
||||
new TestCase(allTargets, less(allTargets, ANNOTATION_TYPE)),
|
||||
new TestCase(allTargets, less(allTargets, TYPE_USE)),
|
||||
/* 60*/ new TestCase(allTargets, less(allTargets, TYPE_PARAMETER)),
|
||||
// All container targets against all but one base targets.
|
||||
new TestCase(less(allTargets, TYPE), allTargets, previewOptions),
|
||||
new TestCase(less(allTargets, PARAMETER), allTargets, previewOptions),
|
||||
new TestCase(less(allTargets, PACKAGE), allTargets, previewOptions),
|
||||
new TestCase(less(allTargets, METHOD), allTargets, previewOptions),
|
||||
new TestCase(less(allTargets, LOCAL_VARIABLE), allTargets, previewOptions),
|
||||
new TestCase(less(allTargets, FIELD), allTargets, previewOptions),
|
||||
new TestCase(less(allTargets, CONSTRUCTOR), allTargets, previewOptions),
|
||||
new TestCase(less(allTargets, ANNOTATION_TYPE), allTargets, previewOptions),
|
||||
new TestCase(less(allTargets, TYPE_USE), allTargets, previewOptions),
|
||||
new TestCase(less(allTargets, TYPE_PARAMETER), allTargets, previewOptions)));
|
||||
new TestCase(less(allTargets, TYPE), allTargets),
|
||||
new TestCase(less(allTargets, PARAMETER), allTargets),
|
||||
new TestCase(less(allTargets, PACKAGE), allTargets),
|
||||
new TestCase(less(allTargets, METHOD), allTargets),
|
||||
new TestCase(less(allTargets, LOCAL_VARIABLE), allTargets),
|
||||
new TestCase(less(allTargets, FIELD), allTargets),
|
||||
new TestCase(less(allTargets, CONSTRUCTOR), allTargets),
|
||||
new TestCase(less(allTargets, ANNOTATION_TYPE), allTargets),
|
||||
new TestCase(less(allTargets, TYPE_USE), allTargets),
|
||||
/* 70*/ new TestCase(less(allTargets, TYPE_PARAMETER), allTargets)));
|
||||
// Generates 100 test cases for any lone base target contained in Set
|
||||
// allTargets against any lone container target.
|
||||
for (ElementType b : allTargets) {
|
||||
for (ElementType c : allTargets) {
|
||||
testCases.add(new TestCase(plus(empty, b), plus(empty, c), previewOptions));
|
||||
testCases.add(new TestCase(plus(empty, b), plus(empty, c)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -456,7 +453,7 @@ public class TargetAnnoCombo {
|
||||
if (allDiagnostics.stream().noneMatch(d -> d.getKind() == javax.tools.Diagnostic.Kind.ERROR)) {
|
||||
ok = true;
|
||||
} else {
|
||||
errMesg = "Test failed, compiled unexpectedly.";
|
||||
errMesg = "Test failed, should have compiled successfully.";
|
||||
ok = false;
|
||||
}
|
||||
} else {
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Verify location of type annotations on records
|
||||
* @library /tools/lib
|
||||
* @modules
|
||||
@ -32,8 +33,7 @@
|
||||
* jdk.compiler/com.sun.tools.javac.code
|
||||
* jdk.compiler/com.sun.tools.javac.util
|
||||
* @build toolbox.ToolBox toolbox.JavacTask
|
||||
* @compile --enable-preview -source ${jdk.version} TypeAnnotationsPositionsOnRecords.java
|
||||
* @run main/othervm --enable-preview TypeAnnotationsPositionsOnRecords
|
||||
* @run main TypeAnnotationsPositionsOnRecords
|
||||
*/
|
||||
|
||||
import java.util.List;
|
||||
@ -105,7 +105,6 @@ public class TypeAnnotationsPositionsOnRecords {
|
||||
void compileTestClass() throws Exception {
|
||||
new JavacTask(tb)
|
||||
.sources(src)
|
||||
.options("--enable-preview", "-source", Integer.toString(Runtime.version().feature()))
|
||||
.run();
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
AnnotatedImport.java:10:13: compiler.err.expected: token.identifier
|
||||
AnnotatedImport.java:10:16: compiler.err.expected3: class, interface, enum
|
||||
AnnotatedImport.java:10:16: compiler.err.expected4: class, interface, enum, record
|
||||
AnnotatedImport.java:11:7: compiler.err.expected: token.identifier
|
||||
AnnotatedImport.java:11:11: compiler.err.expected3: class, interface, enum
|
||||
AnnotatedImport.java:11:11: compiler.err.expected4: class, interface, enum, record
|
||||
AnnotatedImport.java:12:18: compiler.err.expected: token.identifier
|
||||
AnnotatedImport.java:12:21: compiler.err.expected3: class, interface, enum
|
||||
AnnotatedImport.java:12:21: compiler.err.expected4: class, interface, enum, record
|
||||
6 errors
|
||||
|
@ -1,3 +1,3 @@
|
||||
AnnotatedPackage1.java:9:14: compiler.err.expected: token.identifier
|
||||
AnnotatedPackage1.java:9:17: compiler.err.expected3: class, interface, enum
|
||||
AnnotatedPackage1.java:9:17: compiler.err.expected4: class, interface, enum, record
|
||||
2 errors
|
||||
|
@ -1,3 +1,3 @@
|
||||
AnnotatedPackage2.java:9:8: compiler.err.expected: token.identifier
|
||||
AnnotatedPackage2.java:9:12: compiler.err.expected3: class, interface, enum
|
||||
AnnotatedPackage2.java:9:12: compiler.err.expected4: class, interface, enum, record
|
||||
2 errors
|
||||
|
@ -23,13 +23,12 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8205418 8207229 8207230 8230847 8245786 8247334 8248641 8240658
|
||||
* @bug 8205418 8207229 8207230 8230847 8245786 8247334 8248641 8240658 8246774
|
||||
* @summary Test the outcomes from Trees.getScope
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.comp
|
||||
* jdk.compiler/com.sun.tools.javac.tree
|
||||
* jdk.compiler/com.sun.tools.javac.util
|
||||
* @compile TestGetScopeResult.java
|
||||
*/
|
||||
|
||||
import java.io.IOException;
|
||||
@ -559,9 +558,7 @@ public class TestGetScopeResult {
|
||||
}
|
||||
Context ctx = new Context();
|
||||
TestAnalyzer.preRegister(ctx);
|
||||
List<String> options = List.of("--enable-preview",
|
||||
"-source", System.getProperty("java.specification.version"));
|
||||
JavacTask t = (JavacTask) c.getTask(null, fm, null, options, null,
|
||||
JavacTask t = (JavacTask) c.getTask(null, fm, null, null, null,
|
||||
List.of(new MyFileObject()), ctx);
|
||||
CompilationUnitTree cut = t.parse().iterator().next();
|
||||
t.analyze();
|
||||
@ -636,9 +633,7 @@ public class TestGetScopeResult {
|
||||
}
|
||||
Context ctx = new Context();
|
||||
TestAnalyzer.preRegister(ctx);
|
||||
List<String> options = List.of("--enable-preview",
|
||||
"-source", System.getProperty("java.specification.version"));
|
||||
JavacTask t = (JavacTask) c.getTask(null, fm, null, options, null,
|
||||
JavacTask t = (JavacTask) c.getTask(null, fm, null, null, null,
|
||||
List.of(new MyFileObject()), ctx);
|
||||
CompilationUnitTree cut = t.parse().iterator().next();
|
||||
t.analyze();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,9 +23,6 @@
|
||||
|
||||
// key: compiler.err.invalid.accessor.method.in.record
|
||||
// key: compiler.misc.accessor.method.must.not.be.generic
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int i) {
|
||||
public <T> int i() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, 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
|
||||
@ -23,9 +23,6 @@
|
||||
|
||||
// key: compiler.err.invalid.accessor.method.in.record
|
||||
// key: compiler.misc.accessor.method.cant.throw.exception
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int i) {
|
||||
public int i() throws ArithmeticException {
|
||||
|
@ -23,9 +23,6 @@
|
||||
|
||||
// key: compiler.err.invalid.accessor.method.in.record
|
||||
// key: compiler.misc.accessor.method.must.not.be.static
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int x) {
|
||||
static final int j = 0;
|
||||
|
@ -23,9 +23,6 @@
|
||||
|
||||
// key: compiler.err.invalid.accessor.method.in.record
|
||||
// key: compiler.misc.accessor.return.type.doesnt.match
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
import java.util.List;
|
||||
record R(List<String> x) {
|
||||
|
@ -23,10 +23,7 @@
|
||||
|
||||
// key: compiler.err.invalid.canonical.constructor.in.record
|
||||
// key: compiler.misc.canonical.must.not.have.stronger.access
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// key: compiler.misc.canonical
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
public record CanonicalCantHaveStrongerAccessPrivileges() {
|
||||
private CanonicalCantHaveStrongerAccessPrivileges {}
|
||||
|
@ -23,10 +23,7 @@
|
||||
|
||||
// key: compiler.err.invalid.canonical.constructor.in.record
|
||||
// key: compiler.misc.canonical.must.not.contain.explicit.constructor.invocation
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// key: compiler.misc.canonical
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int x) {
|
||||
public R(int x) { super(); this.x = x; }
|
||||
|
@ -23,10 +23,7 @@
|
||||
|
||||
// key: compiler.err.invalid.canonical.constructor.in.record
|
||||
// key: compiler.misc.canonical.with.name.mismatch
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// key: compiler.misc.canonical
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int x) {
|
||||
public R(int _x) { this.x = _x; }
|
||||
|
@ -23,10 +23,7 @@
|
||||
|
||||
// key: compiler.err.invalid.canonical.constructor.in.record
|
||||
// key: compiler.misc.canonical.cant.have.return.statement
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// key: compiler.misc.compact
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R() {
|
||||
public R {
|
||||
|
@ -23,10 +23,7 @@
|
||||
|
||||
// key: compiler.err.invalid.canonical.constructor.in.record
|
||||
// key: compiler.misc.throws.clause.not.allowed.for.canonical.constructor
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// key: compiler.misc.canonical
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int i) {
|
||||
public R(int i) throws Exception {
|
||||
|
@ -23,10 +23,7 @@
|
||||
|
||||
// key: compiler.err.invalid.canonical.constructor.in.record
|
||||
// key: compiler.misc.canonical.must.not.declare.type.variables
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// key: compiler.misc.canonical
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int i) {
|
||||
public <T> R(int i) {
|
||||
|
@ -23,10 +23,7 @@
|
||||
|
||||
// key: compiler.err.invalid.canonical.constructor.in.record
|
||||
// key: compiler.misc.type.must.be.identical.to.corresponding.record.component.type
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// key: compiler.misc.canonical
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -22,5 +22,7 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.expected3
|
||||
// key: compiler.warn.source.no.system.modules.path
|
||||
// options: -source 15
|
||||
|
||||
int Expected3;
|
||||
|
@ -22,9 +22,6 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.first.statement.must.be.call.to.another.constructor
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int x) {
|
||||
public R(int x, int y) { this.x = x; }
|
||||
|
@ -22,8 +22,5 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.illegal.record.component.name
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int hashCode) {}
|
||||
|
@ -22,8 +22,5 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.record.header.expected
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R {}
|
||||
|
@ -22,9 +22,6 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.instance.initializer.not.allowed.in.records
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int x) {
|
||||
{}
|
||||
|
@ -22,6 +22,8 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.intf.not.allowed.here
|
||||
// key: compiler.warn.source.no.system.modules.path
|
||||
// options: -source 15
|
||||
|
||||
class InterfaceNotAllowed {
|
||||
void m() {
|
||||
|
@ -22,7 +22,6 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.invalid.supertype.record
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
@SuppressWarnings("preview")
|
||||
class R extends Record {}
|
||||
|
@ -27,10 +27,6 @@
|
||||
// key: compiler.misc.kindname.method
|
||||
// key: compiler.err.already.defined
|
||||
// key: compiler.err.error
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// key: compiler.note.note
|
||||
// run: backdoor
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int i, int i) {}
|
||||
|
@ -22,6 +22,8 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.local.enum
|
||||
// key: compiler.warn.source.no.system.modules.path
|
||||
// options: -source 15
|
||||
|
||||
class LocalEnum {
|
||||
void m() {
|
||||
|
@ -23,9 +23,6 @@
|
||||
|
||||
// key: compiler.err.invalid.accessor.method.in.record
|
||||
// key: compiler.misc.method.must.be.public
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int x) {
|
||||
private int x() { return x; }
|
||||
|
@ -22,7 +22,8 @@
|
||||
*/
|
||||
|
||||
// key: compiler.misc.feature.records
|
||||
// key: compiler.warn.preview.feature.use.plural
|
||||
// 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 15
|
||||
|
||||
record R() {}
|
||||
|
@ -22,9 +22,6 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.record.cannot.declare.instance.fields
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int i) {
|
||||
private final int y = 0;
|
||||
|
@ -22,8 +22,5 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.record.cant.declare.field.modifiers
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(final int x) {}
|
||||
|
@ -22,8 +22,5 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.record.component.and.old.array.syntax
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
record R(int i[]) {}
|
||||
|
@ -22,9 +22,6 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.static.declaration.not.allowed.in.inner.classes
|
||||
// key: compiler.note.preview.filename
|
||||
// key: compiler.note.preview.recompile
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
class Outer {
|
||||
class Inner {
|
||||
|
@ -5,7 +5,6 @@
|
||||
* @author Joseph D. Darcy
|
||||
*
|
||||
* @compile/fail/ref=FauxEnum3.out -XDrawDiagnostics FauxEnum3.java
|
||||
* @compile/fail/ref=FauxEnum3.out -XDrawDiagnostics --enable-preview -source ${jdk.version} FauxEnum3.java
|
||||
*/
|
||||
|
||||
public final class FauxEnum3 extends SpecializedEnum {}
|
||||
|
@ -1,2 +1,2 @@
|
||||
FauxEnum3.java:11:14: compiler.err.enum.types.not.extensible
|
||||
1 error
|
||||
FauxEnum3.java:10:14: compiler.err.enum.types.not.extensible
|
||||
1 error
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 5019609
|
||||
* @bug 5019609 8246774
|
||||
* @summary javac fails to reject local enums
|
||||
* @author gafter
|
||||
* @compile/fail/ref=LocalEnum.out -XDrawDiagnostics LocalEnum.java
|
||||
* @compile --enable-preview -source ${jdk.version} LocalEnum.java
|
||||
* @compile/fail/ref=LocalEnum.out -XDrawDiagnostics -source 15 LocalEnum.java
|
||||
* @compile LocalEnum.java
|
||||
*/
|
||||
|
||||
public class LocalEnum {
|
||||
|
@ -1,2 +1,4 @@
|
||||
- compiler.warn.source.no.system.modules.path: 15
|
||||
LocalEnum.java:12:9: compiler.err.local.enum
|
||||
1 error
|
||||
1 warning
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8192920 8204588
|
||||
* @bug 8192920 8204588 8246774
|
||||
* @summary Test source launcher
|
||||
* @library /tools/lib
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
@ -299,7 +299,7 @@ public class SourceLauncherTest extends TestRunner {
|
||||
file + ":1: error: illegal character: '#'\n" +
|
||||
"#!/usr/bin/java --source " + thisVersion + "\n" +
|
||||
"^\n" +
|
||||
file + ":1: error: class, interface, or enum expected\n" +
|
||||
file + ":1: error: class, interface, enum, or record expected\n" +
|
||||
"#!/usr/bin/java --source " + thisVersion + "\n" +
|
||||
" ^\n" +
|
||||
"2 errors\n",
|
||||
@ -505,7 +505,7 @@ public class SourceLauncherTest extends TestRunner {
|
||||
file + ":1: error: illegal character: '#'\n" +
|
||||
"#/usr/bin/java --source " + thisVersion + "\n" +
|
||||
"^\n" +
|
||||
file + ":1: error: class, interface, or enum expected\n" +
|
||||
file + ":1: error: class, interface, enum, or record expected\n" +
|
||||
"#/usr/bin/java --source " + thisVersion + "\n" +
|
||||
" ^\n" +
|
||||
"2 errors\n",
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 7073631 7159445 7156633 8028235 8065753 8205418 8205913 8228451 8237041 8253584
|
||||
* @bug 7073631 7159445 7156633 8028235 8065753 8205418 8205913 8228451 8237041 8253584 8246774
|
||||
* @summary tests error and diagnostics positions
|
||||
* @author Jan Lahoda
|
||||
* @modules jdk.compiler/com.sun.tools.javac.api
|
||||
@ -999,7 +999,7 @@ public class JavacParserTest extends TestCase {
|
||||
@Test //JDK-8065753
|
||||
void testWrongFirstToken() throws IOException {
|
||||
String code = "<";
|
||||
String expectedErrors = "Test.java:1:1: compiler.err.expected3: class, interface, enum\n" +
|
||||
String expectedErrors = "Test.java:1:1: compiler.err.expected4: class, interface, enum, record\n" +
|
||||
"1 error\n";
|
||||
StringWriter out = new StringWriter();
|
||||
JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(out, fm, null,
|
||||
|
@ -1,3 +1,3 @@
|
||||
SingleCommaAnnotationValueFail.java:34:12: compiler.err.expected: '}'
|
||||
SingleCommaAnnotationValueFail.java:34:14: compiler.err.expected3: class, interface, enum
|
||||
SingleCommaAnnotationValueFail.java:34:14: compiler.err.expected4: class, interface, enum, record
|
||||
2 errors
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Verify that annotation processing works for records
|
||||
* @library /tools/lib /tools/javac/lib
|
||||
* @modules
|
||||
@ -67,7 +68,6 @@ public class JavaxLangModelForRecords extends TestRunner {
|
||||
}
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
System.out.println(System.getProperties());
|
||||
new JavaxLangModelForRecords().runTests();
|
||||
}
|
||||
|
||||
@ -105,17 +105,13 @@ public class JavaxLangModelForRecords extends TestRunner {
|
||||
tb.writeJavaFiles(r,
|
||||
"record R(int i) {}");
|
||||
|
||||
List<String> expected = List.of("Note: field: i",
|
||||
"Note: record component: i",
|
||||
"Note: testQualifiedClassForProcessing" + File.separator + "src" + File.separator
|
||||
+ "R" + File.separator + "R.java uses preview language features.",
|
||||
"Note: Recompile with -Xlint:preview for details.");
|
||||
List<String> expected = List.of(
|
||||
"Note: field: i",
|
||||
"Note: record component: i");
|
||||
|
||||
for (Mode mode : new Mode[] {Mode.API}) {
|
||||
List<String> log = new JavacTask(tb, mode)
|
||||
.options("-processor", QualifiedClassForProcessing.class.getName(),
|
||||
"--enable-preview",
|
||||
"-source", Integer.toString(Runtime.version().feature()))
|
||||
.options("-processor", QualifiedClassForProcessing.class.getName())
|
||||
.files(findJavaFiles(src))
|
||||
.outdir(classes)
|
||||
.run()
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8241312
|
||||
* @bug 8241312 8246774
|
||||
* @summary test for javax.lang.model.util.ElementFilter::recordComponentsIn
|
||||
* @modules jdk.compiler/com.sun.tools.javac.util
|
||||
*/
|
||||
@ -47,8 +47,7 @@ import javax.tools.JavaFileObject;
|
||||
public class ElementFilterRecordComponentTest {
|
||||
public static void main(String... args) throws IOException {
|
||||
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
||||
JavacTask t = (JavacTask) c.getTask(null, null, null,
|
||||
List.of("--enable-preview", "-source", Integer.toString(Runtime.version().feature())), null,
|
||||
JavacTask t = (JavacTask) c.getTask(null, null, null, null, null,
|
||||
List.of(new SimpleJavaFileObject(URI.create("TestClass.java"), JavaFileObject.Kind.SOURCE) {
|
||||
@Override
|
||||
public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user