Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8235368: Update BCEL to Version 6.4.1 #227

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,8 +25,8 @@
/**
* Constants for the project, mostly defined in the JVM specification.
*
* @version $Id$
* @since 6.0 (intended to replace the Constants interface)
* @LastModified: Jan 2020
*/
public final class Const {

@@ -180,6 +180,18 @@
* */
public static final short MINOR_13 = 0;

/** Major version number of class files for Java 14.
* @see #MINOR_14
* @since 6.4.0
* */
public static final short MAJOR_14 = 58;

/** Minor version number of class files for Java 14.
* @see #MAJOR_14
* @since 6.4.0
* */
public static final short MINOR_14 = 0;

/** Default major version number. Class file is for Java 1.1.
* @see #MAJOR_1_1
* */
@@ -199,12 +211,14 @@
public static final int MAX_BYTE = 255; // 2^8 - 1

/** One of the access flags for fields, methods, or classes.
* @see <a href='http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.5'>
* Flag definitions for Fields in the Java Virtual Machine Specification (Java SE 8 Edition).</a>
* @see <a href='http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.6'>
* Flag definitions for Methods in the Java Virtual Machine Specification (Java SE 8 Edition).</a>
* @see <a href='http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.6-300-D.1-D.1'>
* Flag definitions for Classes in the Java Virtual Machine Specification (Java SE 8 Edition).</a>
* @see <a href='http://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.1-200-E.1'>
* Flag definitions for Classes in the Java Virtual Machine Specification (Java SE 9 Edition).</a>
* @see <a href='http://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.5'>
* Flag definitions for Fields in the Java Virtual Machine Specification (Java SE 9 Edition).</a>
* @see <a href='http://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.6'>
* Flag definitions for Methods in the Java Virtual Machine Specification (Java SE 9 Edition).</a>
* @see <a href='http://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.7.6-300-D.1-D.1'>
* Flag definitions for Inner Classes in the Java Virtual Machine Specification (Java SE 9 Edition).</a>
*/
public static final short ACC_PUBLIC = 0x0001;

@@ -228,89 +242,123 @@
*/
public static final short ACC_FINAL = 0x0010;

/** One of the access flags for fields, methods, or classes.
/** One of the access flags for the Module attribute.
* @see #ACC_PUBLIC
*/
public static final short ACC_OPEN = 0x0020;

/** One of the access flags for classes.
* @see #ACC_PUBLIC
*/
public static final short ACC_SUPER = 0x0020;

/** One of the access flags for methods.
* @see #ACC_PUBLIC
*/
public static final short ACC_SYNCHRONIZED = 0x0020;

/** One of the access flags for fields, methods, or classes.
/** One of the access flags for the Module attribute.
* @see #ACC_PUBLIC
*/
public static final short ACC_VOLATILE = 0x0040;
public static final short ACC_TRANSITIVE = 0x0020;

/** One of the access flags for fields, methods, or classes.
/** One of the access flags for methods.
* @see #ACC_PUBLIC
*/
public static final short ACC_BRIDGE = 0x0040;

/** One of the access flags for fields, methods, or classes.
/** One of the access flags for the Module attribute.
* @see #ACC_PUBLIC
*/
public static final short ACC_STATIC_PHASE = 0x0040;

/** One of the access flags for fields.
* @see #ACC_PUBLIC
*/
public static final short ACC_VOLATILE = 0x0040;

/** One of the access flags for fields.
* @see #ACC_PUBLIC
*/
public static final short ACC_TRANSIENT = 0x0080;

/** One of the access flags for fields, methods, or classes.
/** One of the access flags for methods.
* @see #ACC_PUBLIC
*/
public static final short ACC_VARARGS = 0x0080;

/** One of the access flags for fields, methods, or classes.
/** One of the access flags for methods.
* @see #ACC_PUBLIC
*/
public static final short ACC_NATIVE = 0x0100;

/** One of the access flags for fields, methods, or classes.
/** One of the access flags for classes.
* @see #ACC_PUBLIC
*/
public static final short ACC_INTERFACE = 0x0200;

/** One of the access flags for fields, methods, or classes.
/** One of the access flags for methods or classes.
* @see #ACC_PUBLIC
*/
public static final short ACC_ABSTRACT = 0x0400;

/** One of the access flags for fields, methods, or classes.
/** One of the access flags for methods.
* @see #ACC_PUBLIC
*/
public static final short ACC_STRICT = 0x0800;

/** One of the access flags for fields, methods, or classes.
/** One of the access flags for fields, methods, classes, MethodParameter attribute, or Module attribute.
* @see #ACC_PUBLIC
*/
public static final short ACC_SYNTHETIC = 0x1000;

/** One of the access flags for fields, methods, or classes.
/** One of the access flags for classes.
* @see #ACC_PUBLIC
*/
public static final short ACC_ANNOTATION = 0x2000;

/** One of the access flags for fields, methods, or classes.
/** One of the access flags for fields or classes.
* @see #ACC_PUBLIC
*/
public static final short ACC_ENUM = 0x4000;

/** One of the access flags for fields, methods, or classes.
// Applies to classes compiled by new compilers only
/** One of the access flags for MethodParameter or Module attributes.
* @see #ACC_PUBLIC
*/
public static final short ACC_MANDATED = (short) 0x8000;

// Applies to classes compiled by new compilers only
/** One of the access flags for fields, methods, or classes.
/** One of the access flags for classes.
* @see #ACC_PUBLIC
*/
public static final short ACC_SUPER = 0x0020;
public static final short ACC_MODULE = (short) 0x8000;

/** One of the access flags for fields, methods, or classes.
* @see #ACC_PUBLIC
* @deprecated Use {@link #MAX_ACC_FLAG_I}
*/
@Deprecated
public static final short MAX_ACC_FLAG = ACC_ENUM;

/** One of the access flags for fields, methods, or classes.
* ACC_MODULE is negative as a short.
* @see #ACC_PUBLIC
* @since 6.4.0
*/
public static final int MAX_ACC_FLAG_I = 0x8000; // ACC_MODULE is negative as a short

// Note that do to overloading:
// 'synchronized' is for methods, might be 'open' (if Module), 'super' (if class), or 'transitive' (if Module).
// 'volatile' is for fields, might be 'bridge' (if method) or 'static_phase' (if Module)
// 'transient' is for fields, might be 'varargs' (if method)
// 'module' is for classes, might be 'mandated' (if Module or MethodParameters)
/**
* The names of the access flags.
*/
private static final String[] ACCESS_NAMES = {
"public", "private", "protected", "static", "final", "synchronized",
"volatile", "transient", "native", "interface", "abstract", "strictfp",
"synthetic", "annotation", "enum"
"synthetic", "annotation", "enum", "module"
};

/** @since 6.0 */
@@ -2279,8 +2327,13 @@ public static int getProduceStack(final int index) {
public static final byte ATTR_STACK_MAP_TABLE = 19;
public static final byte ATTR_BOOTSTRAP_METHODS = 20;
public static final byte ATTR_METHOD_PARAMETERS = 21;
public static final byte ATTR_MODULE = 22;
public static final byte ATTR_MODULE_PACKAGES = 23;
public static final byte ATTR_MODULE_MAIN_CLASS = 24;
public static final byte ATTR_NEST_HOST = 25;
public static final byte ATTR_NEST_MEMBERS = 26;

public static final short KNOWN_ATTRIBUTES = 22; // count of attributes
public static final short KNOWN_ATTRIBUTES = 27; // count of attributes

private static final String[] ATTRIBUTE_NAMES = {
"SourceFile", "ConstantValue", "Code", "Exceptions",
@@ -2290,7 +2343,8 @@ public static int getProduceStack(final int index) {
"RuntimeVisibleAnnotations", "RuntimeInvisibleAnnotations",
"RuntimeVisibleParameterAnnotations", "RuntimeInvisibleParameterAnnotations",
"AnnotationDefault", "LocalVariableTypeTable", "EnclosingMethod", "StackMapTable",
"BootstrapMethods", "MethodParameters"
"BootstrapMethods", "MethodParameters", "Module", "ModulePackages",
"ModuleMainClass", "NestHost", "NestMembers"
};

/**
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020 Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -23,7 +23,7 @@
/**
* Exception constants.
* @since 6.0 (intended to replace the InstructionConstant interface)
* @LastModified: Oct 2017
* @LastModified: Jan 2020
*/
public final class ExceptionConst {

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -31,30 +31,32 @@
* @see com.sun.org.apache.bcel.internal.util.Repository
* @see SyntheticRepository
*
* @version $Id$
* @LastModified: Jun 2019
* @LastModified: Jan 2020
*/
public abstract class Repository {

private static com.sun.org.apache.bcel.internal.util.Repository repository
= SyntheticRepository.getInstance();


/** @return currently used repository instance
/**
* @return currently used repository instance
*/
public static com.sun.org.apache.bcel.internal.util.Repository getRepository() {
return repository;
}


/** Set repository instance to be used for class loading
/**
* Sets repository instance to be used for class loading
*/
public static void setRepository( final com.sun.org.apache.bcel.internal.util.Repository rep ) {
repository = rep;
}


/** Lookup class somewhere found on your CLASSPATH, or whereever the
/**
* Lookups class somewhere found on your CLASSPATH, or whereever the
* repository instance looks for it.
*
* @return class object for given fully qualified class name
@@ -67,7 +69,8 @@ public static JavaClass lookupClass( final String class_name ) throws ClassNotFo


/**
* Try to find class source using the internal repository instance.
* Tries to find class source using the internal repository instance.
*
* @see Class
* @return JavaClass object for given runtime class
* @throws ClassNotFoundException if the class could not be found or
@@ -87,7 +90,7 @@ public static void clearCache() {


/**
* Add clazz to repository if there isn't an equally named class already in there.
* Adds clazz to repository if there isn't an equally named class already in there.
*
* @return old entry in repository
*/
@@ -99,15 +102,15 @@ public static JavaClass addClass( final JavaClass clazz ) {


/**
* Remove class with given (fully qualified) name from repository.
* Removes class with given (fully qualified) name from repository.
*/
public static void removeClass( final String clazz ) {
repository.removeClass(repository.findClass(clazz));
}


/**
* Remove given class from repository.
* Removes given class from repository.
*/
public static void removeClass( final JavaClass clazz ) {
repository.removeClass(clazz);
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,8 +25,7 @@
* Super class for all objects that have modifiers like private, final, ... I.e.
* classes, fields, and methods.
*
* @version $Id$
* @LastModified: Jun 2019
* @LastModified: Jan 2020
*/
public abstract class AccessFlags {

@@ -30,7 +30,6 @@
/**
* Represents the default value of a annotation for a method info
*
* @version $Id: AnnotationDefault 1 2005-02-13 03:15:08Z dbrosius $
* @since 6.0
*/
public class AnnotationDefault extends Attribute {
@@ -33,7 +33,6 @@
/**
* represents one annotation in the annotation table
*
* @version $Id: AnnotationEntry
* @since 6.0
*/
public class AnnotationEntry implements Node {
@@ -28,7 +28,6 @@
/**
* base class for annotations
*
* @version $Id: Annotations
* @since 6.0
*/
public abstract class Annotations extends Attribute {