Skip to content

Commit 14614f5

Browse files
committed
8301269: Update Commons BCEL to Version 6.7.0
Reviewed-by: mdoerr Backport-of: 6a44120a16d0f06b4ed9f0ebf6b0919da7070287
1 parent 2cbf01c commit 14614f5

File tree

334 files changed

+19683
-21195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

334 files changed

+19683
-21195
lines changed

src/java.xml/share/classes/com/sun/org/apache/bcel/internal/Const.java

+3,211-2,409
Large diffs are not rendered by default.

src/java.xml/share/classes/com/sun/org/apache/bcel/internal/ExceptionConst.java

+33-39
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
33
*/
44
/*
55
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,13 +20,24 @@
2020

2121
package com.sun.org.apache.bcel.internal;
2222

23+
import jdk.xml.internal.Utils;
24+
2325
/**
2426
* Exception constants.
27+
*
2528
* @since 6.0 (intended to replace the InstructionConstant interface)
26-
* @LastModified: May 2021
29+
* @LastModified: Feb 2023
2730
*/
2831
public final class ExceptionConst {
2932

33+
/**
34+
* Enum corresponding to the various Exception Class arrays, used by
35+
* {@link ExceptionConst#createExceptions(EXCS, Class...)}
36+
*/
37+
public enum EXCS {
38+
EXCS_CLASS_AND_INTERFACE_RESOLUTION, EXCS_FIELD_AND_METHOD_RESOLUTION, EXCS_INTERFACE_METHOD_RESOLUTION, EXCS_STRING_RESOLUTION, EXCS_ARRAY_EXCEPTION,
39+
}
40+
3041
/**
3142
* The mother of all exceptions
3243
*/
@@ -64,61 +75,41 @@ public final class ExceptionConst {
6475
* Run-Time Exceptions
6576
*/
6677
public static final Class<NullPointerException> NULL_POINTER_EXCEPTION = NullPointerException.class;
67-
public static final Class<ArrayIndexOutOfBoundsException> ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION
68-
= ArrayIndexOutOfBoundsException.class;
78+
public static final Class<ArrayIndexOutOfBoundsException> ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION = ArrayIndexOutOfBoundsException.class;
6979
public static final Class<ArithmeticException> ARITHMETIC_EXCEPTION = ArithmeticException.class;
7080
public static final Class<NegativeArraySizeException> NEGATIVE_ARRAY_SIZE_EXCEPTION = NegativeArraySizeException.class;
7181
public static final Class<ClassCastException> CLASS_CAST_EXCEPTION = ClassCastException.class;
82+
7283
public static final Class<IllegalMonitorStateException> ILLEGAL_MONITOR_STATE = IllegalMonitorStateException.class;
84+
/**
85+
* Pre-defined exception arrays according to chapters 5.1-5.4 of the Java Virtual Machine Specification
86+
*/
87+
private static final Class<?>[] EXCS_CLASS_AND_INTERFACE_RESOLUTION = {NO_CLASS_DEF_FOUND_ERROR, CLASS_FORMAT_ERROR, VERIFY_ERROR, ABSTRACT_METHOD_ERROR,
88+
EXCEPTION_IN_INITIALIZER_ERROR, ILLEGAL_ACCESS_ERROR}; // Chapter 5.1
89+
90+
private static final Class<?>[] EXCS_FIELD_AND_METHOD_RESOLUTION = {NO_SUCH_FIELD_ERROR, ILLEGAL_ACCESS_ERROR, NO_SUCH_METHOD_ERROR}; // Chapter 5.2
7391

7492
/**
75-
* Pre-defined exception arrays according to chapters 5.1-5.4 of the Java Virtual
76-
* Machine Specification
93+
* Empty array.
7794
*/
78-
private static final Class<?>[] EXCS_CLASS_AND_INTERFACE_RESOLUTION = {
79-
NO_CLASS_DEF_FOUND_ERROR, CLASS_FORMAT_ERROR, VERIFY_ERROR, ABSTRACT_METHOD_ERROR,
80-
EXCEPTION_IN_INITIALIZER_ERROR, ILLEGAL_ACCESS_ERROR
81-
}; // Chapter 5.1
82-
private static final Class<?>[] EXCS_FIELD_AND_METHOD_RESOLUTION = {
83-
NO_SUCH_FIELD_ERROR, ILLEGAL_ACCESS_ERROR, NO_SUCH_METHOD_ERROR
84-
}; // Chapter 5.2
8595
private static final Class<?>[] EXCS_INTERFACE_METHOD_RESOLUTION = new Class<?>[0]; // Chapter 5.3 (as below)
86-
private static final Class<?>[] EXCS_STRING_RESOLUTION = new Class<?>[0];
87-
// Chapter 5.4 (no errors but the ones that _always_ could happen! How stupid.)
88-
private static final Class<?>[] EXCS_ARRAY_EXCEPTION = {
89-
NULL_POINTER_EXCEPTION, ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION
90-
};
9196

9297
/**
93-
* Enum corresponding to the various Exception Class arrays,
94-
* used by {@link ExceptionConst#createExceptions(EXCS, Class...)}
98+
* Empty array.
9599
*/
96-
public enum EXCS {
97-
EXCS_CLASS_AND_INTERFACE_RESOLUTION,
98-
EXCS_FIELD_AND_METHOD_RESOLUTION,
99-
EXCS_INTERFACE_METHOD_RESOLUTION,
100-
EXCS_STRING_RESOLUTION,
101-
EXCS_ARRAY_EXCEPTION,
102-
}
100+
private static final Class<?>[] EXCS_STRING_RESOLUTION = new Class<?>[0];
103101

104-
// helper method to merge exception class arrays
105-
private static Class<?>[] mergeExceptions(final Class<?>[] input, final Class<?> ... extraClasses) {
106-
final int extraLen = extraClasses == null ? 0 : extraClasses.length;
107-
final Class<?>[] excs = new Class<?>[input.length + extraLen];
108-
System.arraycopy(input, 0, excs, 0, input.length);
109-
if (extraLen > 0) {
110-
System.arraycopy(extraClasses, 0, excs, input.length, extraLen);
111-
}
112-
return excs;
113-
}
102+
// Chapter 5.4 (no errors but the ones that _always_ could happen! How stupid.)
103+
private static final Class<?>[] EXCS_ARRAY_EXCEPTION = {NULL_POINTER_EXCEPTION, ARRAY_INDEX_OUT_OF_BOUNDS_EXCEPTION};
114104

115105
/**
116106
* Creates a copy of the specified Exception Class array combined with any additional Exception classes.
107+
*
117108
* @param type the basic array type
118109
* @param extraClasses additional classes, if any
119110
* @return the merged array
120111
*/
121-
public static Class<?>[] createExceptions(final EXCS type, final Class<?> ... extraClasses) {
112+
public static Class<?>[] createExceptions(final EXCS type, final Class<?>... extraClasses) {
122113
switch (type) {
123114
case EXCS_CLASS_AND_INTERFACE_RESOLUTION:
124115
return mergeExceptions(EXCS_CLASS_AND_INTERFACE_RESOLUTION, extraClasses);
@@ -135,5 +126,8 @@ public static Class<?>[] createExceptions(final EXCS type, final Class<?> ... ex
135126
}
136127
}
137128

138-
129+
// helper method to merge exception class arrays
130+
private static Class<?>[] mergeExceptions(final Class<?>[] input, final Class<?>... extraClasses) {
131+
return Utils.arraysAppend(input, extraClasses);
132+
}
139133
}

0 commit comments

Comments
 (0)