8255009: delta apply fixes for JDK-8246774 and JDK-8253455, pushed too soon
Reviewed-by: jlahoda
This commit is contained in:
parent
a0382cd17c
commit
1da28de82f
src
hotspot/share/classfile
java.base/share/classes
java/lang
jdk/internal
sun/reflect/annotation
java.compiler/share/classes/javax/lang/model
element
util
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.java
@ -3567,6 +3567,12 @@ 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,
|
||||
@ -3814,28 +3820,12 @@ 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_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);
|
||||
}
|
||||
// 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);
|
||||
}
|
||||
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) {
|
||||
} else if (_major_version >= JAVA_14_VERSION) {
|
||||
if (tag == vmSymbols::tag_record()) {
|
||||
// Skip over Record attribute if super class is not java.lang.Record.
|
||||
if (cp->klass_name_at(_super_class_index) == vmSymbols::java_lang_Record()) {
|
||||
// Skip over Record attribute if not supported or if super class is
|
||||
// not java.lang.Record.
|
||||
if (supports_records() &&
|
||||
cp->klass_name_at(_super_class_index) == vmSymbols::java_lang_Record()) {
|
||||
if (parsed_record_attribute) {
|
||||
classfile_parse_error("Multiple Record attributes in class file %s", THREAD);
|
||||
return;
|
||||
@ -3849,13 +3839,44 @@ void ClassFileParser::parse_classfile_attributes(const ClassFileStream* const cf
|
||||
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);
|
||||
if (supports_records()) {
|
||||
log_info(class, record)(
|
||||
"Ignoring Record attribute in class %s because super type is not java.lang.Record",
|
||||
_class_name->as_C_string());
|
||||
} else {
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
// Unknown attribute
|
||||
cfs->skip_u1(attribute_length, CHECK);
|
||||
|
@ -2342,6 +2342,13 @@ 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.
|
||||
@ -2378,8 +2385,11 @@ public final class Class<T> implements java.io.Serializable,
|
||||
* </ul>
|
||||
*
|
||||
* @jls 8.10 Record Types
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
@SuppressWarnings("preview")
|
||||
@CallerSensitive
|
||||
public RecordComponent[] getRecordComponents() {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
@ -3678,6 +3688,13 @@ 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
|
||||
@ -3690,8 +3707,10 @@ 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 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
public boolean isRecord() {
|
||||
return getSuperclass() == JAVA_LANG_RECORD_CLASS && isRecord0();
|
||||
}
|
||||
|
@ -25,6 +25,14 @@
|
||||
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
|
||||
@ -78,8 +86,10 @@ package java.lang;
|
||||
* <a href="{@docRoot}/java.base/java/io/ObjectInputStream.html#record-serialization">record serialization</a>.
|
||||
*
|
||||
* @jls 8.10 Record Types
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=true)
|
||||
public abstract class Record {
|
||||
/**
|
||||
* Constructor for record classes to call.
|
||||
|
@ -118,12 +118,22 @@ 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 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=true)
|
||||
RECORD_COMPONENT;
|
||||
}
|
||||
|
@ -38,14 +38,23 @@ 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 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
public final class RecordComponent implements AnnotatedElement {
|
||||
// declaring class
|
||||
private Class<?> clazz;
|
||||
|
@ -38,14 +38,23 @@ 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 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
public class ObjectMethods {
|
||||
|
||||
private ObjectMethods() { }
|
||||
|
@ -62,11 +62,6 @@ public @interface PreviewFeature {
|
||||
// JDK 15. Since the JDK 14 codebase uses the enum constant, it is
|
||||
// necessary for PreviewFeature in JDK 15 to declare the enum constant.
|
||||
TEXT_BLOCKS,
|
||||
// The RECORDS enum constant is not used in the JDK 16 codebase, but
|
||||
// exists to support the bootcycle build of JDK 16. The bootcycle build
|
||||
// of JDK 16 is performed with JDK 15 and the PreviewFeature type from
|
||||
// JDK 16. Since the JDK 15 codebase uses the enum constant, it is
|
||||
// necessary for PreviewFeature in JDK 16 to declare the enum constant.
|
||||
RECORDS,
|
||||
SEALED_CLASSES,
|
||||
;
|
||||
|
@ -92,8 +92,16 @@ public final class TypeAnnotation {
|
||||
METHOD_FORMAL_PARAMETER,
|
||||
THROWS,
|
||||
/**
|
||||
* @since 16
|
||||
* {@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
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
RECORD_COMPONENT;
|
||||
}
|
||||
|
||||
|
@ -110,15 +110,33 @@ public enum ElementKind {
|
||||
MODULE,
|
||||
|
||||
/**
|
||||
* {@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.}
|
||||
*
|
||||
* A record type.
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
RECORD,
|
||||
|
||||
/**
|
||||
* {@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.}
|
||||
*
|
||||
* A record component of a {@code record}.
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
RECORD_COMPONENT,
|
||||
|
||||
/**
|
||||
|
@ -212,6 +212,13 @@ public interface ElementVisitor<R, P> {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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.}
|
||||
*
|
||||
* Visits a record component element.
|
||||
*
|
||||
* @implSpec The default implementation visits a {@code
|
||||
@ -220,8 +227,11 @@ public interface ElementVisitor<R, P> {
|
||||
* @param e the element to visit
|
||||
* @param p a visitor-specified parameter
|
||||
* @return a visitor-specified result
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
@SuppressWarnings("preview")
|
||||
default R visitRecordComponent(RecordComponentElement e, P p) {
|
||||
return visitUnknown(e, p);
|
||||
}
|
||||
|
@ -26,10 +26,19 @@
|
||||
package javax.lang.model.element;
|
||||
|
||||
/**
|
||||
* {@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.}
|
||||
*
|
||||
* Represents a record component.
|
||||
*
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
public interface RecordComponentElement extends Element {
|
||||
/**
|
||||
* Returns the enclosing element of this record component.
|
||||
|
@ -180,6 +180,13 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable
|
||||
List<? extends TypeParameterElement> getTypeParameters();
|
||||
|
||||
/**
|
||||
* {@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 the record components of this type element in
|
||||
* declaration order.
|
||||
*
|
||||
@ -189,8 +196,11 @@ public interface TypeElement extends Element, Parameterizable, QualifiedNameable
|
||||
* @return the record components, or an empty list if there are
|
||||
* none
|
||||
*
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
@SuppressWarnings("preview")
|
||||
default List<? extends RecordComponentElement> getRecordComponents() {
|
||||
return List.of();
|
||||
}
|
||||
|
@ -31,6 +31,13 @@ import javax.lang.model.element.RecordComponentElement;
|
||||
import static javax.lang.model.SourceVersion.*;
|
||||
|
||||
/**
|
||||
* {@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 skeletal visitor of program elements with default behavior
|
||||
* appropriate for the {@link SourceVersion#RELEASE_14 RELEASE_14}
|
||||
* source version.
|
||||
@ -47,8 +54,10 @@ import static javax.lang.model.SourceVersion.*;
|
||||
* @see AbstractElementVisitor7
|
||||
* @see AbstractElementVisitor8
|
||||
* @see AbstractElementVisitor9
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
@SupportedSourceVersion(RELEASE_16)
|
||||
public abstract class AbstractElementVisitor14<R, P> extends AbstractElementVisitor9<R, P> {
|
||||
/**
|
||||
@ -68,6 +77,7 @@ public abstract class AbstractElementVisitor14<R, P> extends AbstractElementVisi
|
||||
* @param p {@inheritDoc}
|
||||
* @return {@inheritDoc}
|
||||
*/
|
||||
@SuppressWarnings("preview")
|
||||
@Override
|
||||
public abstract R visitRecordComponent(RecordComponentElement t, P p);
|
||||
}
|
||||
|
@ -112,22 +112,42 @@ public class ElementFilter {
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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 a list of record components in {@code elements}.
|
||||
* @return a list of record components in {@code elements}
|
||||
* @param elements the elements to filter
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
@SuppressWarnings("preview")
|
||||
public static List<RecordComponentElement>
|
||||
recordComponentsIn(Iterable<? extends Element> elements) {
|
||||
return listFilter(elements, RECORD_COMPONENT_KIND, RecordComponentElement.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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 a set of record components in {@code elements}.
|
||||
* @return a set of record components in {@code elements}
|
||||
* @param elements the elements to filter
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
@SuppressWarnings("preview")
|
||||
public static Set<RecordComponentElement>
|
||||
recordComponentsIn(Set<? extends Element> elements) {
|
||||
return setFilter(elements, RECORD_COMPONENT_KIND, RecordComponentElement.class);
|
||||
|
@ -31,6 +31,13 @@ import static javax.lang.model.SourceVersion.*;
|
||||
import javax.lang.model.SourceVersion;
|
||||
|
||||
/**
|
||||
* {@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 visitor of program elements based on their {@linkplain
|
||||
* ElementKind kind} with default behavior appropriate for the {@link
|
||||
* SourceVersion#RELEASE_14 RELEASE_14} source version.
|
||||
@ -59,8 +66,10 @@ import javax.lang.model.SourceVersion;
|
||||
* @see ElementKindVisitor7
|
||||
* @see ElementKindVisitor8
|
||||
* @see ElementKindVisitor9
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
@SupportedSourceVersion(RELEASE_16)
|
||||
public class ElementKindVisitor14<R, P> extends ElementKindVisitor9<R, P> {
|
||||
/**
|
||||
@ -90,6 +99,7 @@ public class ElementKindVisitor14<R, P> extends ElementKindVisitor9<R, P> {
|
||||
* @param p a visitor-specified parameter
|
||||
* @return the result of {@code defaultAction}
|
||||
*/
|
||||
@SuppressWarnings("preview")
|
||||
@Override
|
||||
public R visitRecordComponent(RecordComponentElement e, P p) {
|
||||
return defaultAction(e, p);
|
||||
|
@ -217,6 +217,13 @@ public class ElementKindVisitor6<R, P>
|
||||
}
|
||||
|
||||
/**
|
||||
* {@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.}
|
||||
*
|
||||
* Visits a {@code RECORD} type element.
|
||||
*
|
||||
* @implSpec This implementation calls {@code visitUnknown}.
|
||||
@ -225,8 +232,10 @@ public class ElementKindVisitor6<R, P>
|
||||
* @param p a visitor-specified parameter
|
||||
* @return the result of {@code visitUnknown}
|
||||
*
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
public R visitTypeAsRecord(TypeElement e, P p) {
|
||||
return visitUnknown(e, p);
|
||||
}
|
||||
|
@ -33,6 +33,13 @@ import javax.lang.model.SourceVersion;
|
||||
import static javax.lang.model.SourceVersion.*;
|
||||
|
||||
/**
|
||||
* {@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 scanning visitor of program elements with default behavior
|
||||
* appropriate for the {@link SourceVersion#RELEASE_14 RELEASE_14}
|
||||
* source version.
|
||||
@ -74,8 +81,10 @@ import static javax.lang.model.SourceVersion.*;
|
||||
* @see ElementScanner7
|
||||
* @see ElementScanner8
|
||||
* @see ElementScanner9
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
@SupportedSourceVersion(RELEASE_16)
|
||||
public class ElementScanner14<R, P> extends ElementScanner9<R, P> {
|
||||
/**
|
||||
@ -147,6 +156,7 @@ public class ElementScanner14<R, P> extends ElementScanner9<R, P> {
|
||||
* @param p a visitor-specified parameter
|
||||
* @return the result of the scan
|
||||
*/
|
||||
@SuppressWarnings("preview")
|
||||
@Override
|
||||
public R visitRecordComponent(RecordComponentElement e, P p) {
|
||||
return scan(e.getEnclosedElements(), p);
|
||||
|
@ -634,6 +634,13 @@ public interface Elements {
|
||||
boolean isFunctionalInterface(TypeElement type);
|
||||
|
||||
/**
|
||||
* {@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 the record component for the given accessor. Returns null if the
|
||||
* given method is not a record component accessor.
|
||||
*
|
||||
@ -648,8 +655,11 @@ public interface Elements {
|
||||
* @param accessor the method for which the record component should be found.
|
||||
* @return the record component, or null if the given method is not an record
|
||||
* component accessor
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
@SuppressWarnings("preview")
|
||||
default RecordComponentElement recordComponentFor(ExecutableElement accessor) {
|
||||
if (accessor.getEnclosingElement().getKind() == ElementKind.RECORD) {
|
||||
for (RecordComponentElement rec : ElementFilter.recordComponentsIn(accessor.getEnclosingElement().getEnclosedElements())) {
|
||||
|
@ -31,6 +31,13 @@ import javax.lang.model.element.RecordComponentElement;
|
||||
import static javax.lang.model.SourceVersion.*;
|
||||
|
||||
/**
|
||||
* {@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 simple visitor of program elements with default behavior
|
||||
* appropriate for the {@link SourceVersion#RELEASE_14 RELEASE_14}
|
||||
* source version.
|
||||
@ -55,8 +62,10 @@ import static javax.lang.model.SourceVersion.*;
|
||||
* @see SimpleElementVisitor7
|
||||
* @see SimpleElementVisitor8
|
||||
* @see SimpleElementVisitor9
|
||||
* @since 16
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
@SupportedSourceVersion(RELEASE_16)
|
||||
public class SimpleElementVisitor14<R, P> extends SimpleElementVisitor9<R, P> {
|
||||
/**
|
||||
@ -87,6 +96,7 @@ public class SimpleElementVisitor14<R, P> extends SimpleElementVisitor9<R, P> {
|
||||
* @param p a visitor-specified parameter
|
||||
* @return {@inheritDoc}
|
||||
*/
|
||||
@SuppressWarnings("preview")
|
||||
@Override
|
||||
public R visitRecordComponent(RecordComponentElement e, P p) {
|
||||
return defaultAction(e, p);
|
||||
|
@ -649,9 +649,19 @@ 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 16
|
||||
*
|
||||
* @since 14
|
||||
*/
|
||||
@jdk.internal.PreviewFeature(feature=jdk.internal.PreviewFeature.Feature.RECORDS,
|
||||
essentialAPI=false)
|
||||
RECORD(ClassTree.class),
|
||||
|
||||
/**
|
||||
|
@ -167,6 +167,7 @@ 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,7 +159,8 @@ public class Check {
|
||||
|
||||
deferredLintHandler = DeferredLintHandler.instance(context);
|
||||
|
||||
allowRecords = Feature.RECORDS.allowedInSource(source);
|
||||
allowRecords = (!preview.isPreview(Feature.RECORDS) || preview.isEnabled()) &&
|
||||
Feature.RECORDS.allowedInSource(source);
|
||||
allowSealed = (!preview.isPreview(Feature.SEALED_CLASSES) || preview.isEnabled()) &&
|
||||
Feature.SEALED_CLASSES.allowedInSource(source);
|
||||
}
|
||||
|
@ -150,7 +150,8 @@ public class Resolve {
|
||||
Feature.POST_APPLICABILITY_VARARGS_ACCESS_CHECK.allowedInSource(source);
|
||||
polymorphicSignatureScope = WriteableScope.create(syms.noSymbol);
|
||||
allowModules = Feature.MODULES.allowedInSource(source);
|
||||
allowRecords = Feature.RECORDS.allowedInSource(source);
|
||||
allowRecords = (!preview.isPreview(Feature.RECORDS) || preview.isEnabled()) &&
|
||||
Feature.RECORDS.allowedInSource(source);
|
||||
}
|
||||
|
||||
/** error symbols, which are returned when resolution fails
|
||||
|
@ -272,7 +272,8 @@ public class ClassReader {
|
||||
Source source = Source.instance(context);
|
||||
preview = Preview.instance(context);
|
||||
allowModules = Feature.MODULES.allowedInSource(source);
|
||||
allowRecords = Feature.RECORDS.allowedInSource(source);
|
||||
allowRecords = (!preview.isPreview(Feature.RECORDS) || preview.isEnabled()) &&
|
||||
Feature.RECORDS.allowedInSource(source);
|
||||
allowSealedTypes = (!preview.isPreview(Feature.SEALED_CLASSES) || preview.isEnabled()) &&
|
||||
Feature.SEALED_CLASSES.allowedInSource(source);
|
||||
|
||||
|
@ -184,7 +184,8 @@ public class JavacParser implements Parser {
|
||||
endPosTable = newEndPosTable(keepEndPositions);
|
||||
this.allowYieldStatement = (!preview.isPreview(Feature.SWITCH_EXPRESSION) || preview.isEnabled()) &&
|
||||
Feature.SWITCH_EXPRESSION.allowedInSource(source);
|
||||
this.allowRecords = Feature.RECORDS.allowedInSource(source);
|
||||
this.allowRecords = (!preview.isPreview(Feature.RECORDS) || preview.isEnabled()) &&
|
||||
Feature.RECORDS.allowedInSource(source);
|
||||
this.allowSealedTypes = (!preview.isPreview(Feature.SEALED_CLASSES) || preview.isEnabled()) &&
|
||||
Feature.SEALED_CLASSES.allowedInSource(source);
|
||||
}
|
||||
@ -3716,7 +3717,7 @@ public class JavacParser implements Parser {
|
||||
} else {
|
||||
int pos = token.pos;
|
||||
List<JCTree> errs;
|
||||
if (token.kind == IDENTIFIER && token.name() == names.record) {
|
||||
if (token.kind == IDENTIFIER && token.name() == names.record && preview.isEnabled()) {
|
||||
checkSourceLevel(Feature.RECORDS);
|
||||
JCErroneous erroneousTree = syntaxError(token.pos, List.of(mods), Errors.RecordHeaderExpected);
|
||||
return toP(F.Exec(erroneousTree));
|
||||
@ -4213,7 +4214,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
|
||||
* @run main RedefineRecord buildagent
|
||||
* @run main/othervm/timeout=6000 RedefineRecord runtest
|
||||
* @compile --enable-preview -source ${jdk.version} RedefineRecord.java
|
||||
* @run main/othervm --enable-preview RedefineRecord buildagent
|
||||
* @run main/othervm/timeout=6000 --enable-preview RedefineRecord runtest
|
||||
*/
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
@ -100,6 +100,7 @@ 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 @@
|
||||
// ClassFormatError exception.
|
||||
class abstractRecord {
|
||||
0xCAFEBABE;
|
||||
0; // minor version
|
||||
65535; // 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;
|
||||
0; // minor version
|
||||
65535; // minor version
|
||||
60; // version
|
||||
[69] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -23,10 +23,9 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary test logging of reasons for ignoring Record attribute
|
||||
* @library /test/lib
|
||||
* @compile superNotJLRecord.jcod
|
||||
* @compile superNotJLRecord.jcod recordIgnoredVersion.jcod
|
||||
* @run driver ignoreRecordAttribute
|
||||
*/
|
||||
|
||||
@ -37,11 +36,17 @@ public class ignoreRecordAttribute {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String MAJOR_VERSION = Integer.toString(44 + Runtime.version().feature());
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
|
||||
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("--enable-preview",
|
||||
"-Xlog:class+record", "-Xshare:off", "superNotJLRecord");
|
||||
OutputAnalyzer output = new OutputAnalyzer(pb.start());
|
||||
output.shouldContain("Ignoring Record attribute");
|
||||
output.shouldContain("because super type is not java.lang.Record");
|
||||
|
||||
pb = ProcessTools.createJavaProcessBuilder("--enable-preview",
|
||||
"-Xlog:class+record", "-Xshare:off", "recordIgnoredVersion");
|
||||
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 @@
|
||||
// ClassFormatError exception.
|
||||
class notFinalRecord {
|
||||
0xCAFEBABE;
|
||||
0; // minor version
|
||||
65535; // 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 recordAttributeTest
|
||||
*
|
||||
* @run main/othervm --enable-preview 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 ClassFormatError exception not thrown");
|
||||
throw new RuntimeException("Expected ClasFormatError exception not thrown");
|
||||
} catch (java.lang.ClassFormatError e) {
|
||||
String eMsg = e.getMessage();
|
||||
if (!eMsg.contains(cfeMessage)) {
|
||||
|
256
test/hotspot/jtreg/runtime/records/recordIgnoredVersion.jcod
Normal file
256
test/hotspot/jtreg/runtime/records/recordIgnoredVersion.jcod
Normal file
@ -0,0 +1,256 @@
|
||||
/*
|
||||
* 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
|
||||
* @bug 8246774
|
||||
* @summary testing reflection APIs for record classes
|
||||
* @compile --enable-preview --source ${jdk.version} recordReflectionTest.java
|
||||
* @run main/othervm --enable-preview recordReflectionTest
|
||||
*/
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
// attribute_count field. It should result in a ClassFormatError exception.
|
||||
class shortRecordAttribute {
|
||||
0xCAFEBABE;
|
||||
0; // minor version
|
||||
65535; // minor version
|
||||
60; // version
|
||||
[69] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -28,7 +28,7 @@
|
||||
// not java.lang.Record. So, the bogus Record attribute should be ignored.
|
||||
class superNotJLRecord {
|
||||
0xCAFEBABE;
|
||||
0; // minor version
|
||||
65535; // minor version
|
||||
60; // version
|
||||
[69] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -28,7 +28,7 @@
|
||||
// a ClassFormatError exception.
|
||||
class twoRecordAttributes {
|
||||
0xCAFEBABE;
|
||||
0; // minor version
|
||||
65535; // minor version
|
||||
60; // version
|
||||
[69] { // Constant Pool
|
||||
; // first element is empty
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Checks that the appropriate default value is given to the canonical ctr
|
||||
* @run testng AbsentStreamValuesTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy AbsentStreamValuesTest
|
||||
* @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
|
||||
*/
|
||||
|
||||
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
|
||||
* @run testng BadCanonicalCtrTest
|
||||
* @compile --enable-preview -source ${jdk.version} BadCanonicalCtrTest.java
|
||||
* @run testng/othervm --enable-preview BadCanonicalCtrTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@ -59,6 +59,7 @@ 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;
|
||||
@ -78,7 +79,8 @@ public class BadCanonicalCtrTest {
|
||||
public void setup() {
|
||||
{
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("R1",
|
||||
"public record R1 () implements java.io.Serializable { }");
|
||||
"public record R1 () implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
goodRecordClassLoader = new ByteCodeLoader("R1", byteCode, BadCanonicalCtrTest.class.getClassLoader());
|
||||
byte[] bc1 = removeConstructor(byteCode);
|
||||
missingCtrClassLoader = new ByteCodeLoader("R1", bc1, BadCanonicalCtrTest.class.getClassLoader());
|
||||
@ -87,7 +89,8 @@ public class BadCanonicalCtrTest {
|
||||
}
|
||||
{
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("R2",
|
||||
"public record R2 (int x, int y) implements java.io.Serializable { }");
|
||||
"public record R2 (int x, int y) implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
goodRecordClassLoader = new ByteCodeLoader("R2", byteCode, goodRecordClassLoader);
|
||||
byte[] bc1 = removeConstructor(byteCode);
|
||||
missingCtrClassLoader = new ByteCodeLoader("R2", bc1, missingCtrClassLoader);
|
||||
@ -98,7 +101,8 @@ 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) { } }");
|
||||
" public void readExternal(java.io.ObjectInput in) { } }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
goodRecordClassLoader = new ByteCodeLoader("R3", byteCode, goodRecordClassLoader);
|
||||
byte[] bc1 = removeConstructor(byteCode);
|
||||
missingCtrClassLoader = new ByteCodeLoader("R3", bc1, missingCtrClassLoader);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic test that serializes and deserializes a number of records
|
||||
* @run testng BasicRecordSer
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy BasicRecordSer
|
||||
* @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
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,11 +23,11 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Ensures that the serialization implementation can *always* access
|
||||
* the record constructor
|
||||
* @run testng ConstructorAccessTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy ConstructorAccessTest
|
||||
* @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
|
||||
*/
|
||||
|
||||
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
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy ConstructorPermissionTest
|
||||
* @compile --enable-preview -source ${jdk.version} ConstructorPermissionTest.java
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy --enable-preview ConstructorPermissionTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Ensures basic behavior of cycles from record components
|
||||
* @run testng CycleTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy CycleTest
|
||||
* @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
|
||||
*/
|
||||
|
||||
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
|
||||
* @run testng DifferentStreamFieldsTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy DifferentStreamFieldsTest
|
||||
* @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
|
||||
*/
|
||||
|
||||
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
|
||||
* @run testng ProhibitedMethods
|
||||
* @compile --enable-preview -source ${jdk.version} ProhibitedMethods.java
|
||||
* @run testng/othervm --enable-preview ProhibitedMethods
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@ -69,6 +69,7 @@ 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) {
|
||||
@ -105,7 +106,8 @@ public class ProhibitedMethods {
|
||||
public void setup() {
|
||||
{
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("Foo",
|
||||
"public record Foo () implements java.io.Serializable { }");
|
||||
"public record Foo () implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
byteCode = addWriteObject(byteCode);
|
||||
byteCode = addReadObject(byteCode);
|
||||
byteCode = addReadObjectNoData(byteCode);
|
||||
@ -113,7 +115,8 @@ public class ProhibitedMethods {
|
||||
}
|
||||
{
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("Bar",
|
||||
"public record Bar (int x, int y) implements java.io.Serializable { }");
|
||||
"public record Bar (int x, int y) implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
byteCode = addWriteObject(byteCode);
|
||||
byteCode = addReadObject(byteCode);
|
||||
byteCode = addReadObjectNoData(byteCode);
|
||||
@ -122,7 +125,8 @@ 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 { }");
|
||||
"public record Baz<U extends Serializable,V extends Serializable>(U u, V v) implements Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
byteCode = addWriteObject(byteCode);
|
||||
byteCode = addReadObject(byteCode);
|
||||
byteCode = addReadObjectNoData(byteCode);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic tests for readResolve
|
||||
* @run testng ReadResolveTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy ReadResolveTest
|
||||
* @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
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic tests for serializing and deserializing record classes
|
||||
* @run testng RecordClassTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy RecordClassTest
|
||||
* @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
|
||||
*/
|
||||
|
||||
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
|
||||
* @run testng SerialPersistentFieldsTest
|
||||
* @compile --enable-preview -source ${jdk.version} SerialPersistentFieldsTest.java
|
||||
* @run testng/othervm --enable-preview SerialPersistentFieldsTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@ -62,6 +62,7 @@ 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;
|
||||
|
||||
@ -82,7 +83,8 @@ public class SerialPersistentFieldsTest {
|
||||
public void setup() {
|
||||
{ // R1
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("R1",
|
||||
"public record R1 () implements java.io.Serializable { }");
|
||||
"public record R1 () implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
ObjectStreamField[] serialPersistentFields = {
|
||||
new ObjectStreamField("s", String.class),
|
||||
new ObjectStreamField("i", int.class),
|
||||
@ -94,7 +96,8 @@ public class SerialPersistentFieldsTest {
|
||||
}
|
||||
{ // R2
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("R2",
|
||||
"public record R2 (int x) implements java.io.Serializable { }");
|
||||
"public record R2 (int x) implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
ObjectStreamField[] serialPersistentFields = {
|
||||
new ObjectStreamField("s", String.class)
|
||||
};
|
||||
@ -103,7 +106,8 @@ public class SerialPersistentFieldsTest {
|
||||
}
|
||||
{ // R3
|
||||
byte[] byteCode = InMemoryJavaCompiler.compile("R3",
|
||||
"public record R3 (int x, int y) implements java.io.Serializable { }");
|
||||
"public record R3 (int x, int y) implements java.io.Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
ObjectStreamField[] serialPersistentFields = new ObjectStreamField[0];
|
||||
byteCode = addSerialPersistentFields(byteCode, serialPersistentFields);
|
||||
serializableRecordLoader = new ByteCodeLoader("R3", byteCode, serializableRecordLoader);
|
||||
@ -111,7 +115,8 @@ 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 { }");
|
||||
"public record R4<U extends Serializable,V extends Serializable>(U u, V v) implements Serializable { }",
|
||||
"--enable-preview", "-source", VERSION);
|
||||
ObjectStreamField[] serialPersistentFields = {
|
||||
new ObjectStreamField("v", String.class)
|
||||
};
|
||||
@ -127,7 +132,8 @@ 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, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic tests for SUID in the serial stream
|
||||
* @run testng SerialVersionUIDTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy SerialVersionUIDTest
|
||||
* @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
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,9 +23,9 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Tests for stream references
|
||||
* @run testng StreamRefTest
|
||||
* @compile --enable-preview -source ${jdk.version} StreamRefTest.java
|
||||
* @run testng/othervm --enable-preview StreamRefTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Tests constructor invocation exceptions are handled appropriately
|
||||
* @run testng ThrowingConstructorTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy ThrowingConstructorTest
|
||||
* @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
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -23,9 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8238763 8246774
|
||||
* @bug 8238763
|
||||
* @summary ObjectInputStream readUnshared method handling of Records
|
||||
* @run testng UnsharedTest
|
||||
* @compile --enable-preview -source ${jdk.version} UnsharedTest.java
|
||||
* @run testng/othervm --enable-preview UnsharedTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic tests for writeReplace
|
||||
* @run testng WriteReplaceTest
|
||||
* @run testng/othervm/java.security.policy=empty_security.policy WriteReplaceTest
|
||||
* @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
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -44,6 +44,8 @@ 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);
|
||||
@ -57,9 +59,11 @@ 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, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,13 +23,12 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Test for subtype stream field value assign-ability
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @compile AssignableFrom.java Point.java
|
||||
* DefaultValues.java SuperStreamFields.java
|
||||
* @run testng AssignableFromTest
|
||||
* @compile --enable-preview -source ${jdk.version} AssignableFrom.java Point.java
|
||||
* DefaultValues.java SuperStreamFields.java AssignableFromTest.java
|
||||
* @run testng/othervm --enable-preview AssignableFromTest
|
||||
*/
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -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 AssignableFrom.java Point.java DefaultValues.java SuperStreamFields.java
|
||||
* @run testng DefaultValuesTest
|
||||
* @compile --enable-preview -source ${jdk.version} AssignableFrom.java Point.java
|
||||
* DefaultValues.java SuperStreamFields.java DefaultValuesTest.java
|
||||
* @run testng/othervm --enable-preview DefaultValuesTest
|
||||
*/
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,12 +23,12 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary superclass fields in the stream should be discarded
|
||||
* @library /test/lib
|
||||
* @modules jdk.compiler
|
||||
* @compile AssignableFrom.java Point.java DefaultValues.java SuperStreamFields.java
|
||||
* @run testng SuperStreamFieldsTest
|
||||
* @compile --enable-preview -source ${jdk.version} AssignableFrom.java Point.java
|
||||
* DefaultValues.java SuperStreamFields.java SuperStreamFieldsTest.java
|
||||
* @run testng/othervm --enable-preview SuperStreamFieldsTest
|
||||
*/
|
||||
|
||||
import org.testng.annotations.DataProvider;
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
/*
|
||||
* @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.
|
||||
@ -34,14 +33,15 @@
|
||||
* java.instrument
|
||||
* @compile ../NamedBuffer.java
|
||||
* @run main RedefineClassHelper
|
||||
* @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
|
||||
* @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
|
||||
*/
|
||||
|
||||
/* Test Description
|
||||
@ -269,6 +269,8 @@ public class TestRecordAttr {
|
||||
" to: " + dst);
|
||||
CompilerUtils.compile(src.toPath(),
|
||||
dst.toPath(),
|
||||
false /* don't recurse */);
|
||||
false /* don't recurse */,
|
||||
"--enable-preview",
|
||||
"--source", VERSION);
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
/*
|
||||
* @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.
|
||||
@ -34,10 +33,11 @@
|
||||
* java.instrument
|
||||
* @compile ../NamedBuffer.java
|
||||
* @run main RedefineClassHelper
|
||||
* @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
|
||||
* @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
|
||||
*/
|
||||
|
||||
/* Test Description
|
||||
@ -207,6 +207,8 @@ public class TestRecordAttrGenericSig {
|
||||
" to: " + dst);
|
||||
CompilerUtils.compile(src.toPath(),
|
||||
dst.toPath(),
|
||||
false /* don't recurse */);
|
||||
false /* don't recurse */,
|
||||
"--enable-preview",
|
||||
"--source", VERSION);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,10 +23,10 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Basic tests for ObjectMethods
|
||||
* @run testng ObjectMethodsTest
|
||||
* @run testng/othervm/java.security.policy=empty.policy ObjectMethodsTest
|
||||
* @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
|
||||
*/
|
||||
|
||||
import java.lang.invoke.CallSite;
|
||||
|
@ -23,11 +23,12 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8236539 8246774
|
||||
* @bug 8236539
|
||||
* @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
|
||||
*/
|
||||
|
||||
@ -73,6 +74,7 @@ public class TestRecordLinks extends JavadocTester {
|
||||
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"example");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
|
@ -23,12 +23,13 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8225055 8239804 8246774
|
||||
* @bug 8225055 8239804
|
||||
* @summary Record types
|
||||
* @library /tools/lib ../../lib
|
||||
* @modules jdk.javadoc/jdk.javadoc.internal.tool
|
||||
* @build toolbox.ToolBox javadoc.tester.*
|
||||
* @run main TestRecordTypes
|
||||
* @compile --enable-preview --source ${jdk.version} TestRecordTypes.java
|
||||
* @run main/othervm --enable-preview TestRecordTypes
|
||||
*/
|
||||
|
||||
|
||||
@ -68,6 +69,7 @@ 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);
|
||||
|
||||
@ -89,6 +91,7 @@ public class TestRecordTypes extends JavadocTester {
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -110,6 +113,7 @@ public class TestRecordTypes extends JavadocTester {
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -135,6 +139,7 @@ public class TestRecordTypes extends JavadocTester {
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -166,6 +171,7 @@ public class TestRecordTypes extends JavadocTester {
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -198,6 +204,7 @@ public class TestRecordTypes extends JavadocTester {
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -261,6 +268,7 @@ public class TestRecordTypes extends JavadocTester {
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"-linkoffline", externalDocs, localDocs,
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -341,6 +349,7 @@ public class TestRecordTypes extends JavadocTester {
|
||||
"-quiet", "-noindex",
|
||||
"--no-platform-links",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -366,6 +375,7 @@ public class TestRecordTypes extends JavadocTester {
|
||||
javadoc("-d", base.resolve("out").toString(),
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", src.toString(),
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"p");
|
||||
checkExit(Exit.OK);
|
||||
|
||||
@ -396,6 +406,7 @@ public class TestRecordTypes extends JavadocTester {
|
||||
"-quiet", "-noindex",
|
||||
"-sourcepath", testSrc.toString(),
|
||||
"-linksource",
|
||||
"--enable-preview", "--source", thisRelease,
|
||||
"examples");
|
||||
|
||||
checkExit(Exit.OK);
|
||||
@ -404,11 +415,13 @@ 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,
|
||||
@ -455,6 +468,7 @@ 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 8246774
|
||||
* @bug 6493690
|
||||
* @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.expected4", // class, interface, enum, or record expected
|
||||
"compiler.err.expected3", // class, interface, enum, or __datum 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 8246774
|
||||
* @bug 8149524 8131024 8165211 8080071 8130454 8167343 8129559 8114842 8182268 8223782 8235474
|
||||
* @summary Test SourceCodeAnalysis
|
||||
* @build KullaTesting TestingInputStream
|
||||
* @run testng CompletenessTest
|
||||
@ -379,4 +379,10 @@ 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 8246774
|
||||
* @bug 8235474 8236715
|
||||
* @summary Tests for evalution of records
|
||||
* @modules jdk.jshell
|
||||
* @build KullaTesting TestingInputStream ExpectedDiagnostic
|
||||
@ -76,4 +76,10 @@ 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 8246774
|
||||
* @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
|
||||
* @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 ToolSimpleTest
|
||||
* @run testng/othervm ToolSimpleTest
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -917,7 +917,7 @@ public class ToolSimpleTest extends ReplToolTesting {
|
||||
|
||||
@Test
|
||||
public void testRecords() {
|
||||
test(new String[] {},
|
||||
test(new String[] {"--enable-preview"},
|
||||
(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,9 +1,10 @@
|
||||
/**
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 5012028 6384539 8074364 8250741 8246774
|
||||
* @bug 5012028 6384539 8074364 8250741
|
||||
* @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:10:10: compiler.err.annotation.decl.not.allowed.here
|
||||
IllegalAnnotation.java:11:10: compiler.err.annotation.decl.not.allowed.here
|
||||
1 error
|
||||
|
@ -1,9 +1,9 @@
|
||||
/**
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8242478 8246774
|
||||
* @bug 8242478
|
||||
* @summary test for local interfaces
|
||||
* @compile/fail/ref=LocalInterface.out -XDrawDiagnostics -source 15 LocalInterface.java
|
||||
* @compile LocalInterface.java
|
||||
* @compile/fail/ref=LocalInterface.out -XDrawDiagnostics LocalInterface.java
|
||||
* @compile --enable-preview -source ${jdk.version} LocalInterface.java
|
||||
*/
|
||||
class LocalInterface {
|
||||
void m() {
|
||||
|
@ -1,4 +1,2 @@
|
||||
- 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 8246774
|
||||
* @bug 8242478
|
||||
* @summary test local records
|
||||
* @compile LocalRecord.java
|
||||
* @compile --enable-preview -source ${jdk.version} LocalRecord.java
|
||||
*/
|
||||
class LocalRecord {
|
||||
void m() {
|
||||
|
@ -24,11 +24,12 @@
|
||||
/*
|
||||
* @test
|
||||
* @summary test for com.sun.tools.javac.comp.Check::validateAnnotation, com.sun.tools.javac.code.SymbolMetadata::removeDeclarationMetadata and ::removeFromCompoundList
|
||||
* @bug 8241312 8246774
|
||||
* @bug 8241312
|
||||
* @library /tools/lib
|
||||
* @modules jdk.compiler/com.sun.tools.javac.util
|
||||
* jdk.jdeps/com.sun.tools.classfile
|
||||
* @run main ApplicableAnnotationsOnRecords
|
||||
* @compile --enable-preview -source ${jdk.version} ApplicableAnnotationsOnRecords.java
|
||||
* @run main/othervm --enable-preview ApplicableAnnotationsOnRecords
|
||||
*/
|
||||
import com.sun.tools.classfile.*;
|
||||
import com.sun.tools.javac.util.Assert;
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 7151010 8006547 8007766 8029017 8246774
|
||||
* @bug 7151010 8006547 8007766 8029017
|
||||
* @summary Default test cases for running combinations for Target values
|
||||
* @modules jdk.compiler
|
||||
* @build Helper
|
||||
@ -204,22 +204,25 @@ public class TargetAnnoCombo {
|
||||
}
|
||||
}
|
||||
|
||||
// options to be passed if target RECORD_COMPONENT can't be considered
|
||||
List<String> source8 = List.of("-source", "8");
|
||||
// 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())
|
||||
);
|
||||
|
||||
private void generate() {
|
||||
// Adding test cases to run.
|
||||
testCases.addAll(Arrays.asList(
|
||||
// No base target against no container target.
|
||||
/* 0*/ new TestCase(noSet, noSet),
|
||||
new TestCase(noSet, noSet),
|
||||
// No base target against empty container target.
|
||||
/* 1*/ new TestCase(noSet, empty),
|
||||
new TestCase(noSet, empty),
|
||||
// No base target against TYPE_USE only container target.
|
||||
new TestCase(noSet, less(jdk8, TYPE_PARAMETER), source8),
|
||||
new TestCase(noSet, less(jdk8, TYPE_PARAMETER)),
|
||||
// No base target against TYPE_PARAMETER only container target.
|
||||
new TestCase(noSet, less(jdk8, TYPE_USE), source8),
|
||||
new TestCase(noSet, less(jdk8, TYPE_USE)),
|
||||
// No base target against TYPE_USE + TYPE_PARAMETER only container target.
|
||||
new TestCase(noSet, jdk8, source8),
|
||||
new TestCase(noSet, jdk8),
|
||||
// No base target against TYPE_USE + some selection of jdk7 targets.
|
||||
new TestCase(noSet,
|
||||
plus(EnumSet.range(TYPE, LOCAL_VARIABLE), TYPE_USE)),
|
||||
@ -230,7 +233,7 @@ public class TargetAnnoCombo {
|
||||
new TestCase(noSet, plus(empty, TYPE)),
|
||||
new TestCase(noSet, plus(empty, PARAMETER)),
|
||||
new TestCase(noSet, plus(empty, PACKAGE)),
|
||||
/* 10*/ new TestCase(noSet, plus(empty, METHOD)),
|
||||
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)),
|
||||
@ -243,32 +246,32 @@ public class TargetAnnoCombo {
|
||||
new TestCase(empty, plus(empty, TYPE)),
|
||||
new TestCase(empty, plus(empty, PARAMETER)),
|
||||
new TestCase(empty, plus(empty, PACKAGE)),
|
||||
/* 20*/ new TestCase(empty, plus(empty, METHOD)),
|
||||
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), source8),
|
||||
new TestCase(empty, less(jdk8, TYPE_PARAMETER), source8),
|
||||
new TestCase(empty, less(jdk8, TYPE_USE)),
|
||||
new TestCase(empty, less(jdk8, TYPE_PARAMETER)),
|
||||
// No container target against all all-but one jdk7 targets.
|
||||
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),
|
||||
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),
|
||||
// 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, source8),
|
||||
new TestCase(jdk7, noSet),
|
||||
// No container against jdk7 targets plus one or both of TYPE_USE, TYPE_PARAMETER
|
||||
new TestCase(plus(jdk7, TYPE_USE), noSet, source8),
|
||||
new TestCase(plus(jdk7, TYPE_PARAMETER), noSet, source8),
|
||||
new TestCase(allTargets, noSet, null),
|
||||
new TestCase(plus(jdk7, TYPE_USE), noSet),
|
||||
new TestCase(plus(jdk7, TYPE_PARAMETER), noSet),
|
||||
new TestCase(allTargets, noSet, previewOptions),
|
||||
// Empty container target against any lone target.
|
||||
/* 40*/ new TestCase(plus(empty, TYPE), empty),
|
||||
new TestCase(plus(empty, TYPE), empty),
|
||||
new TestCase(plus(empty, PARAMETER), empty),
|
||||
new TestCase(plus(empty, PACKAGE), empty),
|
||||
new TestCase(plus(empty, METHOD), empty),
|
||||
@ -279,34 +282,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.
|
||||
/* 50*/ new TestCase(allTargets, allTargets),
|
||||
new TestCase(allTargets, allTargets, previewOptions),
|
||||
// All base targets against all but one container targets.
|
||||
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)),
|
||||
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),
|
||||
// All container targets against all but one base targets.
|
||||
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)));
|
||||
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)));
|
||||
// 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)));
|
||||
testCases.add(new TestCase(plus(empty, b), plus(empty, c), previewOptions));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -453,7 +456,7 @@ public class TargetAnnoCombo {
|
||||
if (allDiagnostics.stream().noneMatch(d -> d.getKind() == javax.tools.Diagnostic.Kind.ERROR)) {
|
||||
ok = true;
|
||||
} else {
|
||||
errMesg = "Test failed, should have compiled successfully.";
|
||||
errMesg = "Test failed, compiled unexpectedly.";
|
||||
ok = false;
|
||||
}
|
||||
} else {
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8246774
|
||||
* @summary Verify location of type annotations on records
|
||||
* @library /tools/lib
|
||||
* @modules
|
||||
@ -33,7 +32,8 @@
|
||||
* jdk.compiler/com.sun.tools.javac.code
|
||||
* jdk.compiler/com.sun.tools.javac.util
|
||||
* @build toolbox.ToolBox toolbox.JavacTask
|
||||
* @run main TypeAnnotationsPositionsOnRecords
|
||||
* @compile --enable-preview -source ${jdk.version} TypeAnnotationsPositionsOnRecords.java
|
||||
* @run main/othervm --enable-preview TypeAnnotationsPositionsOnRecords
|
||||
*/
|
||||
|
||||
import java.util.List;
|
||||
@ -105,6 +105,7 @@ 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.expected4: class, interface, enum, record
|
||||
AnnotatedImport.java:10:16: compiler.err.expected3: class, interface, enum
|
||||
AnnotatedImport.java:11:7: compiler.err.expected: token.identifier
|
||||
AnnotatedImport.java:11:11: compiler.err.expected4: class, interface, enum, record
|
||||
AnnotatedImport.java:11:11: compiler.err.expected3: class, interface, enum
|
||||
AnnotatedImport.java:12:18: compiler.err.expected: token.identifier
|
||||
AnnotatedImport.java:12:21: compiler.err.expected4: class, interface, enum, record
|
||||
AnnotatedImport.java:12:21: compiler.err.expected3: class, interface, enum
|
||||
6 errors
|
||||
|
@ -1,3 +1,3 @@
|
||||
AnnotatedPackage1.java:9:14: compiler.err.expected: token.identifier
|
||||
AnnotatedPackage1.java:9:17: compiler.err.expected4: class, interface, enum, record
|
||||
AnnotatedPackage1.java:9:17: compiler.err.expected3: class, interface, enum
|
||||
2 errors
|
||||
|
@ -1,3 +1,3 @@
|
||||
AnnotatedPackage2.java:9:8: compiler.err.expected: token.identifier
|
||||
AnnotatedPackage2.java:9:12: compiler.err.expected4: class, interface, enum, record
|
||||
AnnotatedPackage2.java:9:12: compiler.err.expected3: class, interface, enum
|
||||
2 errors
|
||||
|
@ -23,12 +23,13 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 8205418 8207229 8207230 8230847 8245786 8247334 8248641 8240658 8246774
|
||||
* @bug 8205418 8207229 8207230 8230847 8245786 8247334 8248641 8240658
|
||||
* @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;
|
||||
@ -558,7 +559,9 @@ public class TestGetScopeResult {
|
||||
}
|
||||
Context ctx = new Context();
|
||||
TestAnalyzer.preRegister(ctx);
|
||||
JavacTask t = (JavacTask) c.getTask(null, fm, null, null, null,
|
||||
List<String> options = List.of("--enable-preview",
|
||||
"-source", System.getProperty("java.specification.version"));
|
||||
JavacTask t = (JavacTask) c.getTask(null, fm, null, options, null,
|
||||
List.of(new MyFileObject()), ctx);
|
||||
CompilationUnitTree cut = t.parse().iterator().next();
|
||||
t.analyze();
|
||||
@ -633,7 +636,9 @@ public class TestGetScopeResult {
|
||||
}
|
||||
Context ctx = new Context();
|
||||
TestAnalyzer.preRegister(ctx);
|
||||
JavacTask t = (JavacTask) c.getTask(null, fm, null, null, null,
|
||||
List<String> options = List.of("--enable-preview",
|
||||
"-source", System.getProperty("java.specification.version"));
|
||||
JavacTask t = (JavacTask) c.getTask(null, fm, null, options, null,
|
||||
List.of(new MyFileObject()), ctx);
|
||||
CompilationUnitTree cut = t.parse().iterator().next();
|
||||
t.analyze();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,6 +23,9 @@
|
||||
|
||||
// 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, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -23,6 +23,9 @@
|
||||
|
||||
// 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,6 +23,9 @@
|
||||
|
||||
// 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,6 +23,9 @@
|
||||
|
||||
// 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,7 +23,10 @@
|
||||
|
||||
// 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,7 +23,10 @@
|
||||
|
||||
// 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,7 +23,10 @@
|
||||
|
||||
// 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,7 +23,10 @@
|
||||
|
||||
// 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,7 +23,10 @@
|
||||
|
||||
// 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,7 +23,10 @@
|
||||
|
||||
// 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,7 +23,10 @@
|
||||
|
||||
// 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,7 +22,5 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.expected3
|
||||
// key: compiler.warn.source.no.system.modules.path
|
||||
// options: -source 15
|
||||
|
||||
int Expected3;
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
|
||||
// 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,5 +22,8 @@
|
||||
*/
|
||||
|
||||
// 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,5 +22,8 @@
|
||||
*/
|
||||
|
||||
// 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,6 +22,9 @@
|
||||
*/
|
||||
|
||||
// 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,8 +22,6 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.intf.not.allowed.here
|
||||
// key: compiler.warn.source.no.system.modules.path
|
||||
// options: -source 15
|
||||
|
||||
class InterfaceNotAllowed {
|
||||
void m() {
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.invalid.supertype.record
|
||||
// options: --enable-preview -source ${jdk.version}
|
||||
|
||||
@SuppressWarnings("preview")
|
||||
class R extends Record {}
|
||||
|
@ -27,6 +27,10 @@
|
||||
// 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,8 +22,6 @@
|
||||
*/
|
||||
|
||||
// key: compiler.err.local.enum
|
||||
// key: compiler.warn.source.no.system.modules.path
|
||||
// options: -source 15
|
||||
|
||||
class LocalEnum {
|
||||
void m() {
|
||||
|
@ -23,6 +23,9 @@
|
||||
|
||||
// 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,8 +22,7 @@
|
||||
*/
|
||||
|
||||
// key: compiler.misc.feature.records
|
||||
// key: compiler.err.feature.not.supported.in.source.plural
|
||||
// key: compiler.warn.source.no.system.modules.path
|
||||
// options: -source 15
|
||||
// key: compiler.warn.preview.feature.use.plural
|
||||
// options: --enable-preview -source ${jdk.version} -Xlint:preview
|
||||
|
||||
record R() {}
|
||||
|
@ -22,6 +22,9 @@
|
||||
*/
|
||||
|
||||
// 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;
|
||||
|
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