Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: openjdk/jdk
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ad7a8e86
Choose a base ref
...
head repository: openjdk/jdk
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5e537a86
Choose a head ref

Commits on Jun 10, 2022

  1. Copy the full SHA
    34c6057 View commit details

Commits on Jun 13, 2022

  1. fix of javadoc link

    asotona committed Jun 13, 2022
    Copy the full SHA
    6663f05 View commit details
  2. Copy the full SHA
    63d0e3b View commit details

Commits on Jun 14, 2022

  1. Update README.md

    asotona authored Jun 14, 2022
    Copy the full SHA
    02bf8b4 View commit details

Commits on Jun 21, 2022

  1. Copy the full SHA
    e1386df View commit details

Commits on Jun 24, 2022

  1. Tweak JEP link

    mcimadamore authored Jun 24, 2022
    Copy the full SHA
    0daac4a View commit details

Commits on Jun 27, 2022

  1. Copy the full SHA
    a5a2580 View commit details
  2. removal of jdk.classfile.jdktypes.AccessFlag and redirection to java.…

    …lang.reflect.AccesFlag in Classfile API and tests
    asotona committed Jun 27, 2022
    Copy the full SHA
    b5267ad View commit details
  3. Copy the full SHA
    941dfb0 View commit details

Commits on Jun 29, 2022

  1. fixed InvokeDynamicEntry::asSymbol and BytecodeHelpers::handleDescToH…

    …andleInfo
    
    implemented RebuildingTransformation and added to Transforms and CorpusTest
    reduced CorpusTestHelper output and adjusted TEST.properties
    asotona committed Jun 29, 2022
    Copy the full SHA
    0fe61c5 View commit details

Commits on Jun 30, 2022

  1. added ConstantValueAttribute::of(ConstantDesc)

    MethodParameterInfo name parameter changed to Optional
    added MethodParameterInfo::ofParameter(Optional<String>,int)
    implemented TemporaryConstantPool::stringEntry
    adjusted BoundAttribute and RebuildingTransformation test helper
    asotona committed Jun 30, 2022
    Copy the full SHA
    a89d822 View commit details
  2. added CompilationIDAttribute::of(String)

    EnclosingMethodAttribute factory method changed to accept Optionals
    added EnclosingMethodAttribute::of(ClassDesc,Optional<String>,Optional<MethodTypeDesc>)
    added EnclosingMethodAttribute accessor methods
    InnerClassInfo all factory methods changed to accept Optionals
    added NestHostAttribute::of(ClassDesc)
    added SourceIDAttribute::of(String)
    changes reflected in BoundAttribute and RebuildTransformation test helper
    asotona committed Jun 30, 2022
    Copy the full SHA
    7bf66b1 View commit details

Commits on Jul 1, 2022

  1. TypeAnnotation and AnnotationValue API improvements

    * added TypeAnnotation factory methods accepting ClassDesc and AnnotationElement...
    AnnotationValue.OfConstant sub-classed to allow switch pattern matching
    RebuildingTransformation test helper adjusted
    
    * added TypeAnnotation.TargetInfo factory methods with validity checking for multi-target types
    adjusted RebuildTransformation test helper
    asotona authored Jul 1, 2022
    Copy the full SHA
    bb7e294 View commit details
  2. refactored to FieldModel::fieldTypeSymbol and MethodModel::methodType…

    …Symbol (#13)
    
    refactored to FieldModel::fieldTypeSymbol and MethodModel::methodTypeSymbol (#13)
    added round testing of signatures in RebuildTransformation test helper
    asotona authored Jul 1, 2022
    Copy the full SHA
    d8f30a7 View commit details

Commits on Jul 4, 2022

  1. Model stack map frames in a type hierarchy where each type represents…

    … a frame type.
    
     Doing so, make the chop size available to consumers of frames.
    raphw authored and asotona committed Jul 4, 2022
    Copy the full SHA
    59479ff View commit details
  2. Copy the full SHA
    28f560e View commit details
  3. Copy the full SHA
    99a17b3 View commit details
  4. Copy the full SHA
    f2ac770 View commit details
  5. Copy the full SHA
    8480163 View commit details

Commits on Jul 7, 2022

  1. Copy the full SHA
    ace0f43 View commit details
  2. Update README.md

    asotona authored Jul 7, 2022
    Copy the full SHA
    a98f860 View commit details

Commits on Jul 8, 2022

  1. Copy the full SHA
    4b69c9c View commit details

Commits on Jul 11, 2022

  1. Copy the full SHA
    0631349 View commit details
  2. Copy the full SHA
    1950b1f View commit details

Commits on Jul 12, 2022

  1. Copy the full SHA
    e14f3a5 View commit details

Commits on Jul 13, 2022

  1. Copy the full SHA
    5cbe442 View commit details

Commits on Jul 15, 2022

  1. Copy the full SHA
    a1502e3 View commit details
  2. Copy the full SHA
    4b5620e View commit details

Commits on Jul 19, 2022

  1. Copy the full SHA
    0c80bff View commit details
  2. Classfile try catch

    PaulSandoz authored Jul 19, 2022
    Copy the full SHA
    4c730ed View commit details
  3. Copy the full SHA
    28cb754 View commit details
  4. Copy the full SHA
    3369fbb View commit details

Commits on Jul 20, 2022

  1. Copy the full SHA
    e76ed5f View commit details
  2. Copy the full SHA
    b5e9ac3 View commit details

Commits on Jul 21, 2022

  1. Ifthenelse (#28)

    * Enhance ifThenElse.
    
    * Expose block builder with break label.
    
    * Docs and tests.
    
    * Doc.
    
    * Review feedback.
    
    * Unused import.
    PaulSandoz authored Jul 21, 2022
    Copy the full SHA
    482add7 View commit details

Commits on Jul 22, 2022

  1. ClassRemapper implemenation handling RecordAttribute, InnerClassesAtt…

    …ribute, EnclosingMethodAttribute, Annotations, TypeAnnotations, ParameterAnnotations and LoadableConstants
    asotona committed Jul 22, 2022
    Copy the full SHA
    34e72c5 View commit details
  2. Copy the full SHA
    946a382 View commit details

Commits on Aug 3, 2022

  1. Copy the full SHA
    269e529 View commit details
  2. Copy the full SHA
    2b471fc View commit details
  3. StackMapGenerator appends detailed debug info about corrupted bytecod…

    …e in case of an error
    
    - previous debug logging and TRACE and DEBUG switches have been removed
    asotona committed Aug 3, 2022
    Copy the full SHA
    2c988df View commit details
  4. Opcode.ISHR and LSHR fix

    asotona committed Aug 3, 2022
    Copy the full SHA
    3902fd2 View commit details

Commits on Aug 4, 2022

  1. Copy the full SHA
    b83633c View commit details
  2. Copy the full SHA
    6c8f57a View commit details

Commits on Aug 18, 2022

  1. Classfile API stack map manual processing (#32)

    * removed FrameKind from StackMapTableAttribute and offsets replaced with labels in StackMapFrames
    
    * simplification of StackMapFrame, removal of compressed sub-types
    
    * Implemented UnboundStackMapTableAttribute and added related factory methods
    dropped VerificationType
    SimpleVerificationTypeInfo refactored to enum
    
    * implemented StackMapTableAttribute compression and writing
    
    * StackMapTableAttribute extends CodeElement
    
    * added Classfile.Option.processStackMaps
    enable stack maps processing in RebuildingTransformation test helper
    fixed UninitializedVerificationTypeInfo labels resolution
    
    * fixed Opcode
    
    * enable unordered StackMapTableAttribute entries
    
    * removal of PROCESS_STACK_MAPS option
    generated stack maps override user content
    adjusted labels inflation from stack maps
    
    * minor patch in RebuildingTransformation test helper
    asotona authored Aug 18, 2022
    Copy the full SHA
    76b09c5 View commit details
  2. removed obsolete toString

    asotona committed Aug 18, 2022
    Copy the full SHA
    ced8ffa View commit details
  3. Copy the full SHA
    b547682 View commit details
  4. Copy the full SHA
    de17a3b View commit details

Commits on Aug 19, 2022

  1. Classfile api label resolver branch (#33)

    * removed impl.LabelResolver
    * labelToBci moved to CodeAttribute and impl.LabelContext
    * removed labelToBci from CodeBuilder
    asotona authored Aug 19, 2022
    Copy the full SHA
    cb17b0f View commit details

Commits on Aug 30, 2022

  1. fixed LabelsRemapper

    asotona committed Aug 30, 2022
    Copy the full SHA
    15ba3cd View commit details
  2. Copy the full SHA
    674791a View commit details
Showing 657 changed files with 7,356 additions and 6,300 deletions.
Original file line number Diff line number Diff line change
@@ -473,6 +473,11 @@ private void process(Parser parser, boolean extraFile) throws IOException {
if (parser.peekToken() != null) { // must be EOF
throw parser.newError("is malformed");
}
} else if (token.equals("import")) {
nextIdentifier(parser);
skipTokenOrThrow(parser, ";", "missing semicolon");
} else if (token.startsWith("@")) {
continue;
} else {
throw parser.newError("missing keyword");
}
4 changes: 2 additions & 2 deletions make/modules/java.base/Java.gmk
Original file line number Diff line number Diff line change
@@ -36,8 +36,8 @@ EXCLUDE_FILES += \
$(TOPDIR)/src/java.base/share/classes/jdk/internal/module/ModuleLoaderMap.java

EXCLUDES += java/lang/doc-files \
jdk/internal/classfile/snippet-files \
jdk/internal/classfile/components/snippet-files
java/lang/classfile/snippet-files \
java/lang/classfile/components/snippet-files

# Exclude BreakIterator classes that are just used in compile process to generate
# data files and shouldn't go in the product
16 changes: 8 additions & 8 deletions src/java.base/share/classes/java/lang/Module.java
Original file line number Diff line number Diff line change
@@ -52,13 +52,13 @@
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import jdk.internal.classfile.AccessFlags;
import jdk.internal.classfile.Attribute;
import jdk.internal.classfile.ClassModel;
import jdk.internal.classfile.ClassTransform;
import jdk.internal.classfile.Classfile;
import jdk.internal.classfile.attribute.ModuleAttribute;
import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
import java.lang.classfile.AccessFlags;
import java.lang.classfile.Attribute;
import java.lang.classfile.ClassModel;
import java.lang.classfile.ClassTransform;
import java.lang.classfile.ClassFile;
import java.lang.classfile.attribute.ModuleAttribute;
import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute;

import jdk.internal.javac.PreviewFeature;
import jdk.internal.loader.BuiltinClassLoader;
@@ -1590,7 +1590,7 @@ private Class<?> loadModuleInfoClass() {
*/
private Class<?> loadModuleInfoClass(InputStream in) throws IOException {
final String MODULE_INFO = "module-info";
var cc = Classfile.of(Classfile.ConstantPoolSharingOption.NEW_POOL);
var cc = ClassFile.of(ClassFile.ConstantPoolSharingOption.NEW_POOL);
byte[] bytes = cc.transform(cc.parse(in.readAllBytes()), (clb, cle) -> {
switch (cle) {
case AccessFlags af -> clb.withFlags(AccessFlag.INTERFACE,
Original file line number Diff line number Diff line change
@@ -22,17 +22,21 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.internal.classfile;
package java.lang.classfile;

import java.util.Set;
import jdk.internal.classfile.impl.AccessFlagsImpl;
import java.lang.reflect.AccessFlag;
import jdk.internal.javac.PreviewFeature;

/**
* Models the access flags for a class, method, or field. Delivered as a
* {@link ClassElement}, {@link FieldElement}, or {@link MethodElement}
* when traversing the corresponding model type.
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface AccessFlags
extends ClassElement, MethodElement, FieldElement
permits AccessFlagsImpl {
Original file line number Diff line number Diff line change
@@ -22,18 +22,19 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.internal.classfile;
package java.lang.classfile;

import jdk.internal.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
import jdk.internal.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
import jdk.internal.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
import jdk.internal.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute;
import jdk.internal.classfile.constantpool.Utf8Entry;
import java.lang.classfile.attribute.RuntimeInvisibleAnnotationsAttribute;
import java.lang.classfile.attribute.RuntimeInvisibleParameterAnnotationsAttribute;
import java.lang.classfile.attribute.RuntimeVisibleAnnotationsAttribute;
import java.lang.classfile.attribute.RuntimeVisibleParameterAnnotationsAttribute;
import java.lang.classfile.constantpool.Utf8Entry;
import jdk.internal.classfile.impl.AnnotationImpl;
import jdk.internal.classfile.impl.TemporaryConstantPool;

import java.lang.constant.ClassDesc;
import java.util.List;
import jdk.internal.javac.PreviewFeature;

/**
* Models an annotation on a declaration.
@@ -44,7 +45,11 @@
* @see RuntimeInvisibleAnnotationsAttribute
* @see RuntimeVisibleParameterAnnotationsAttribute
* @see RuntimeInvisibleParameterAnnotationsAttribute
*
* @sealedGraph
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface Annotation
extends WritableElement<Annotation>
permits TypeAnnotation, AnnotationImpl {
Original file line number Diff line number Diff line change
@@ -22,20 +22,24 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.internal.classfile;
package java.lang.classfile;

import java.lang.constant.ClassDesc;

import jdk.internal.classfile.constantpool.Utf8Entry;
import java.lang.classfile.constantpool.Utf8Entry;
import jdk.internal.classfile.impl.AnnotationImpl;
import jdk.internal.classfile.impl.TemporaryConstantPool;
import jdk.internal.javac.PreviewFeature;

/**
* Models a key-value pair of an annotation.
*
* @see Annotation
* @see AnnotationValue
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface AnnotationElement
extends WritableElement<AnnotationElement>
permits AnnotationImpl.AnnotationElementImpl {
Original file line number Diff line number Diff line change
@@ -22,49 +22,69 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package jdk.internal.classfile;

import jdk.internal.classfile.constantpool.AnnotationConstantValueEntry;
import jdk.internal.classfile.constantpool.DoubleEntry;
import jdk.internal.classfile.constantpool.FloatEntry;
import jdk.internal.classfile.constantpool.IntegerEntry;
import jdk.internal.classfile.constantpool.LongEntry;
import jdk.internal.classfile.constantpool.Utf8Entry;
package java.lang.classfile;

import java.lang.classfile.constantpool.AnnotationConstantValueEntry;
import java.lang.classfile.constantpool.DoubleEntry;
import java.lang.classfile.constantpool.FloatEntry;
import java.lang.classfile.constantpool.IntegerEntry;
import java.lang.classfile.constantpool.LongEntry;
import java.lang.classfile.constantpool.Utf8Entry;
import jdk.internal.classfile.impl.AnnotationImpl;
import jdk.internal.classfile.impl.TemporaryConstantPool;

import java.lang.constant.ClassDesc;
import java.lang.constant.ConstantDesc;
import java.util.ArrayList;
import java.util.List;
import jdk.internal.javac.PreviewFeature;

/**
* Models the value of a key-value pair of an annotation.
*
* @see Annotation
* @see AnnotationElement
*
* @sealedGraph
* @since 22
*/

@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
public sealed interface AnnotationValue extends WritableElement<AnnotationValue>
permits AnnotationValue.OfAnnotation, AnnotationValue.OfArray,
AnnotationValue.OfConstant, AnnotationValue.OfClass,
AnnotationValue.OfEnum {

/** Models an annotation-valued element */
/**
* Models an annotation-valued element
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfAnnotation extends AnnotationValue
permits AnnotationImpl.OfAnnotationImpl {
/** {@return the annotation} */
Annotation annotation();
}

/** Models an array-valued element */
/**
* Models an array-valued element
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfArray extends AnnotationValue
permits AnnotationImpl.OfArrayImpl {
/** {@return the values} */
List<AnnotationValue> values();
}

/** Models a constant-valued element */
/**
* Models a constant-valued element
*
* @sealedGraph
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfConstant extends AnnotationValue
permits AnnotationValue.OfString, AnnotationValue.OfDouble,
AnnotationValue.OfFloat, AnnotationValue.OfLong,
@@ -77,70 +97,120 @@ sealed interface OfConstant extends AnnotationValue
ConstantDesc constantValue();
}

/** Models a constant-valued element */
/**
* Models a constant-valued element
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfString extends AnnotationValue.OfConstant
permits AnnotationImpl.OfStringImpl {
/** {@return the constant} */
String stringValue();
}

/** Models a constant-valued element */
/**
* Models a constant-valued element
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfDouble extends AnnotationValue.OfConstant
permits AnnotationImpl.OfDoubleImpl {
/** {@return the constant} */
double doubleValue();
}

/** Models a constant-valued element */
/**
* Models a constant-valued element
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfFloat extends AnnotationValue.OfConstant
permits AnnotationImpl.OfFloatImpl {
/** {@return the constant} */
float floatValue();
}

/** Models a constant-valued element */
/**
* Models a constant-valued element
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfLong extends AnnotationValue.OfConstant
permits AnnotationImpl.OfLongImpl {
/** {@return the constant} */
long longValue();
}

/** Models a constant-valued element */
/**
* Models a constant-valued element
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfInteger extends AnnotationValue.OfConstant
permits AnnotationImpl.OfIntegerImpl {
/** {@return the constant} */
int intValue();
}

/** Models a constant-valued element */
/**
* Models a constant-valued element
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfShort extends AnnotationValue.OfConstant
permits AnnotationImpl.OfShortImpl {
/** {@return the constant} */
short shortValue();
}

/** Models a constant-valued element */
/**
* Models a constant-valued element
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfCharacter extends AnnotationValue.OfConstant
permits AnnotationImpl.OfCharacterImpl {
/** {@return the constant} */
char charValue();
}

/** Models a constant-valued element */
/**
* Models a constant-valued element
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfByte extends AnnotationValue.OfConstant
permits AnnotationImpl.OfByteImpl {
/** {@return the constant} */
byte byteValue();
}

/** Models a constant-valued element */
/**
* Models a constant-valued element
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfBoolean extends AnnotationValue.OfConstant
permits AnnotationImpl.OfBooleanImpl {
/** {@return the constant} */
boolean booleanValue();
}

/** Models a class-valued element */
/**
* Models a class-valued element
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfClass extends AnnotationValue
permits AnnotationImpl.OfClassImpl {
/** {@return the class name} */
@@ -152,7 +222,12 @@ default ClassDesc classSymbol() {
}
}

/** Models an enum-valued element */
/**
* Models an enum-valued element
*
* @since 22
*/
@PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API)
sealed interface OfEnum extends AnnotationValue
permits AnnotationImpl.OfEnumImpl {
/** {@return the enum class name} */
@@ -168,7 +243,7 @@ default ClassDesc classSymbol() {
}

/**
* @return the tag character for this type as per {@jvms 4.7.16.1}
* {@return the tag character for this type as per {@jvms 4.7.16.1}}
*/
char tag();

@@ -379,10 +454,13 @@ static OfArray ofArray(AnnotationValue... values) {

/**
* {@return an annotation element} The {@code value} parameter must be
* a primitive, a String, a ClassDesc, an enum constant, or an array of
* one of these.
* a primitive, a wrapper of primitive, a String, a ClassDesc, an enum
* constant, or an array of one of these.
*
* @param value the annotation value
* @throws IllegalArgumentException when the {@code value} parameter is not
* a primitive, a wrapper of primitive, a String, a ClassDesc,
* an enum constant, or an array of one of these.
*/
static AnnotationValue of(Object value) {
if (value instanceof String s) {
Loading