Stack: ..., objectref, [arg1, [arg2 ...]] -> ...* * @see - * + * * The invokeinterface instruction in The Java Virtual Machine Specification */ public final class INVOKEINTERFACE extends InvokeInstruction { diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKESPECIAL.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKESPECIAL.java index d3eed22dae5..ce27d07fd20 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKESPECIAL.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKESPECIAL.java @@ -34,7 +34,7 @@ import com.sun.org.apache.bcel.internal.ExceptionConst; *
Stack: ..., objectref, [arg1, [arg2 ...]] -> ...* * @see - * + * * The invokespecial instruction in The Java Virtual Machine Specification */ public class INVOKESPECIAL extends InvokeInstruction { diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKESTATIC.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKESTATIC.java index 356e13133e7..a89702514a2 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKESTATIC.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKESTATIC.java @@ -33,7 +33,7 @@ import com.sun.org.apache.bcel.internal.ExceptionConst; *
Stack: ..., [arg1, [arg2 ...]] -> ...* * @see - * + * * The invokestatic instruction in The Java Virtual Machine Specification */ public class INVOKESTATIC extends InvokeInstruction { diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEVIRTUAL.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEVIRTUAL.java index a9652fd3403..bd5a2b5fd07 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEVIRTUAL.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/INVOKEVIRTUAL.java @@ -33,7 +33,7 @@ import com.sun.org.apache.bcel.internal.ExceptionConst; *
Stack: ..., objectref, [arg1, [arg2 ...]] -> ...* * @see - * + * * The invokevirtual instruction in The Java Virtual Machine Specification */ public class INVOKEVIRTUAL extends InvokeInstruction { diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionFactory.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionFactory.java index bb78cb97ff5..d2ec08ed678 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionFactory.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -32,7 +32,7 @@ import com.sun.org.apache.bcel.internal.Const; * * @see Const * @see InstructionConst - * @LastModified: Jan 2020 + * @LastModified: May 2021 */ public class InstructionFactory { @@ -76,30 +76,52 @@ public class InstructionFactory { */ public InvokeInstruction createInvoke( final String class_name, final String name, final Type ret_type, final Type[] arg_types, final short kind ) { + return createInvoke(class_name, name, ret_type, arg_types, kind, kind == Const.INVOKEINTERFACE); + } + + /** + * Creates an invoke instruction. (Except for invokedynamic.) + * + * @param class_name name of the called class + * @param name name of the called method + * @param ret_type return type of method + * @param arg_types argument types of method + * @param kind how to invoke: INVOKEINTERFACE, INVOKESTATIC, INVOKEVIRTUAL, or INVOKESPECIAL + * @param use_interface force use of InterfaceMethodref + * @return A new InvokeInstruction. + * @since 6.5.0 + */ + public InvokeInstruction createInvoke( final String class_name, final String name, final Type ret_type, + final Type[] arg_types, final short kind, final boolean use_interface) { + if (kind != Const.INVOKESPECIAL && kind != Const.INVOKEVIRTUAL && kind != Const.INVOKESTATIC + && kind != Const.INVOKEINTERFACE && kind != Const.INVOKEDYNAMIC) { + throw new IllegalArgumentException("Unknown invoke kind: " + kind); + } int index; int nargs = 0; final String signature = Type.getMethodSignature(ret_type, arg_types); for (final Type arg_type : arg_types) { nargs += arg_type.getSize(); } - if (kind == Const.INVOKEINTERFACE) { + if (use_interface) { index = cp.addInterfaceMethodref(class_name, name, signature); } else { index = cp.addMethodref(class_name, name, signature); } switch (kind) { - case Const.INVOKESPECIAL: - return new INVOKESPECIAL(index); - case Const.INVOKEVIRTUAL: - return new INVOKEVIRTUAL(index); - case Const.INVOKESTATIC: - return new INVOKESTATIC(index); - case Const.INVOKEINTERFACE: - return new INVOKEINTERFACE(index, nargs + 1); - case Const.INVOKEDYNAMIC: - return new INVOKEDYNAMIC(index); - default: - throw new RuntimeException("Oops: Unknown invoke kind: " + kind); + case Const.INVOKESPECIAL: + return new INVOKESPECIAL(index); + case Const.INVOKEVIRTUAL: + return new INVOKEVIRTUAL(index); + case Const.INVOKESTATIC: + return new INVOKESTATIC(index); + case Const.INVOKEINTERFACE: + return new INVOKEINTERFACE(index, nargs + 1); + case Const.INVOKEDYNAMIC: + return new INVOKEDYNAMIC(index); + default: + // Can't happen + throw new IllegalStateException("Unknown invoke kind: " + kind); } } @@ -248,7 +270,7 @@ public class InstructionFactory { case Const.T_OBJECT: return createInvoke(append_mos[1], Const.INVOKEVIRTUAL); default: - throw new RuntimeException("Oops: No append for this type? " + type); + throw new IllegalArgumentException("No append for this type? " + type); } } @@ -276,7 +298,7 @@ public class InstructionFactory { case Const.PUTSTATIC: return new PUTSTATIC(index); default: - throw new RuntimeException("Oops: Unknown getfield kind:" + kind); + throw new IllegalArgumentException("Unknown getfield kind:" + kind); } } @@ -310,7 +332,7 @@ public class InstructionFactory { case Const.T_VOID: return InstructionConst.RETURN; default: - throw new RuntimeException("Invalid type: " + type); + throw new IllegalArgumentException("Invalid type: " + type); } } @@ -338,7 +360,7 @@ public class InstructionFactory { case '>': return op.equals(">>>") ? InstructionConst.IUSHR : InstructionConst.ISHR; default: - throw new RuntimeException("Invalid operand " + op); + throw new IllegalArgumentException("Invalid operand " + op); } } @@ -366,7 +388,7 @@ public class InstructionFactory { case '>': return op.equals(">>>") ? InstructionConst.LUSHR : InstructionConst.LSHR; default: - throw new RuntimeException("Invalid operand " + op); + throw new IllegalArgumentException("Invalid operand " + op); } } @@ -384,7 +406,7 @@ public class InstructionFactory { case '%': return InstructionConst.FREM; default: - throw new RuntimeException("Invalid operand " + op); + throw new IllegalArgumentException("Invalid operand " + op); } } @@ -402,7 +424,7 @@ public class InstructionFactory { case '%': return InstructionConst.DREM; default: - throw new RuntimeException("Invalid operand " + op); + throw new IllegalArgumentException("Invalid operand " + op); } } @@ -427,7 +449,7 @@ public class InstructionFactory { case Const.T_DOUBLE: return createBinaryDoubleOp(first); default: - throw new RuntimeException("Invalid type " + type); + throw new IllegalArgumentException("Invalid type " + type); } } @@ -485,7 +507,7 @@ public class InstructionFactory { case Const.T_OBJECT: return new ASTORE(index); default: - throw new RuntimeException("Invalid type " + type); + throw new IllegalArgumentException("Invalid type " + type); } } @@ -511,7 +533,7 @@ public class InstructionFactory { case Const.T_OBJECT: return new ALOAD(index); default: - throw new RuntimeException("Invalid type " + type); + throw new IllegalArgumentException("Invalid type " + type); } } @@ -540,7 +562,7 @@ public class InstructionFactory { case Const.T_OBJECT: return InstructionConst.AALOAD; default: - throw new RuntimeException("Invalid type " + type); + throw new IllegalArgumentException("Invalid type " + type); } } @@ -569,7 +591,7 @@ public class InstructionFactory { case Const.T_OBJECT: return InstructionConst.AASTORE; default: - throw new RuntimeException("Invalid type " + type); + throw new IllegalArgumentException("Invalid type " + type); } } @@ -592,7 +614,7 @@ public class InstructionFactory { try { i = (Instruction) java.lang.Class.forName(name).getDeclaredConstructor().newInstance(); } catch (final Exception e) { - throw new RuntimeException("Could not find instruction: " + name, e); + throw new IllegalArgumentException("Could not find instruction: " + name, e); } return i; } else if ((src_type instanceof ReferenceType) && (dest_type instanceof ReferenceType)) { @@ -601,7 +623,7 @@ public class InstructionFactory { } return new CHECKCAST(cp.addClass(((ObjectType) dest_type).getClassName())); } else { - throw new RuntimeException("Can not cast " + src_type + " to " + dest_type); + throw new IllegalArgumentException("Cannot cast " + src_type + " to " + dest_type); } } @@ -699,7 +721,7 @@ public class InstructionFactory { case Const.T_VOID: return InstructionConst.NOP; default: - throw new RuntimeException("Invalid type: " + type); + throw new IllegalArgumentException("Invalid type: " + type); } } @@ -751,7 +773,7 @@ public class InstructionFactory { case Const.JSR_W: return new JSR_W(target); default: - throw new RuntimeException("Invalid opcode: " + opcode); + throw new IllegalArgumentException("Invalid opcode: " + opcode); } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionHandle.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionHandle.java index 25008e69d78..bdf78029537 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionHandle.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionHandle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -42,7 +42,7 @@ import com.sun.org.apache.bcel.internal.classfile.Utility; * @see Instruction * @see BranchHandle * @see InstructionList - * @LastModified: Jan 2020 + * @LastModified: May 2021 */ public class InstructionHandle { @@ -295,7 +295,7 @@ public class InstructionHandle { /** * @param next the next to set - * @ since 6.0 + * @since 6.0 */ final InstructionHandle setNext(final InstructionHandle next) { this.next = next; @@ -305,7 +305,7 @@ public class InstructionHandle { /** * @param prev the prev to set - * @ since 6.0 + * @since 6.0 */ final InstructionHandle setPrev(final InstructionHandle prev) { this.prev = prev; diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionList.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionList.java index 0e90723c530..28c53220444 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionList.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -47,14 +47,14 @@ import java.util.NoSuchElementException; * @see Instruction * @see InstructionHandle * @see BranchHandle - * @LastModified: Jan 2020 + * @LastModified: May 2021 */ public class InstructionList implements Iterable
Stack: ... -> ..., item* - * @LastModified: Jan 2020 + * @LastModified: May 2021 */ public class LDC extends CPInstruction implements PushInstruction, ExceptionThrower { @@ -112,7 +112,7 @@ public class LDC extends CPInstruction implements PushInstruction, ExceptionThro c = cpg.getConstantPool().getConstant(nameIndex); return new ObjectType(((com.sun.org.apache.bcel.internal.classfile.ConstantUtf8) c).getBytes()); default: // Never reached - throw new RuntimeException("Unknown or invalid constant type at " + super.getIndex()); + throw new IllegalArgumentException("Unknown or invalid constant type at " + super.getIndex()); } } @@ -129,7 +129,7 @@ public class LDC extends CPInstruction implements PushInstruction, ExceptionThro case com.sun.org.apache.bcel.internal.Const.CONSTANT_Class: return Type.CLASS; default: // Never reached - throw new RuntimeException("Unknown or invalid constant type at " + super.getIndex()); + throw new IllegalArgumentException("Unknown or invalid constant type at " + super.getIndex()); } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC2_W.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC2_W.java index 544b879647c..ade9b29cd84 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC2_W.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LDC2_W.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -25,7 +25,7 @@ package com.sun.org.apache.bcel.internal.generic; * *
Stack: ... -> ..., item.word1, item.word2* - * @LastModified: Jan 2020 + * @LastModified: May 2021 */ public class LDC2_W extends CPInstruction implements PushInstruction { @@ -50,7 +50,7 @@ public class LDC2_W extends CPInstruction implements PushInstruction { case com.sun.org.apache.bcel.internal.Const.CONSTANT_Double: return Type.DOUBLE; default: // Never reached - throw new RuntimeException("Unknown constant type " + super.getOpcode()); + throw new IllegalArgumentException("Unknown constant type " + super.getOpcode()); } } @@ -63,7 +63,7 @@ public class LDC2_W extends CPInstruction implements PushInstruction { case com.sun.org.apache.bcel.internal.Const.CONSTANT_Double: return ((com.sun.org.apache.bcel.internal.classfile.ConstantDouble) c).getBytes(); default: // Never reached - throw new RuntimeException("Unknown or invalid constant type at " + super.getIndex()); + throw new IllegalArgumentException("Unknown or invalid constant type at " + super.getIndex()); } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LineNumberGen.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LineNumberGen.java index a9ab4a8012e..b5ac6cda812 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LineNumberGen.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LineNumberGen.java @@ -21,6 +21,8 @@ package com.sun.org.apache.bcel.internal.generic; +import java.util.Objects; + import com.sun.org.apache.bcel.internal.classfile.LineNumber; /** @@ -33,8 +35,7 @@ import com.sun.org.apache.bcel.internal.classfile.LineNumber; public class LineNumberGen implements InstructionTargeter, Cloneable { private InstructionHandle ih; - private int src_line; - + private int srcLine; /** * Create a line number. @@ -76,16 +77,14 @@ public class LineNumberGen implements InstructionTargeter, Cloneable { * or that the `setPositions' methods has been called for the instruction list. */ public LineNumber getLineNumber() { - return new LineNumber(ih.getPosition(), src_line); + return new LineNumber(ih.getPosition(), srcLine); } - public void setInstruction( final InstructionHandle ih ) { // TODO could be package-protected? - if (ih == null) { - throw new NullPointerException("InstructionHandle may not be null"); - } - BranchInstruction.notifyTarget(this.ih, ih, this); - this.ih = ih; + public void setInstruction( final InstructionHandle instructionHandle ) { // TODO could be package-protected? + Objects.requireNonNull(instructionHandle, "instructionHandle"); + BranchInstruction.notifyTarget(this.ih, instructionHandle, this); + this.ih = instructionHandle; } @@ -105,11 +104,11 @@ public class LineNumberGen implements InstructionTargeter, Cloneable { public void setSourceLine( final int src_line ) { // TODO could be package-protected? - this.src_line = src_line; + this.srcLine = src_line; } public int getSourceLine() { - return src_line; + return srcLine; } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LocalVariableGen.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LocalVariableGen.java index 57961f346dc..4693af780e7 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LocalVariableGen.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LocalVariableGen.java @@ -39,8 +39,8 @@ public class LocalVariableGen implements InstructionTargeter, NamedAndTyped, Clo private Type type; private InstructionHandle start; private InstructionHandle end; - private int orig_index; // never changes; used to match up with LocalVariableTypeTable entries - private boolean live_to_end; + private int origIndex; // never changes; used to match up with LocalVariableTypeTable entries + private boolean liveToEnd; /** @@ -63,8 +63,8 @@ public class LocalVariableGen implements InstructionTargeter, NamedAndTyped, Clo this.index = index; setStart(start); setEnd(end); - this.orig_index = index; - this.live_to_end = end == null; + this.origIndex = index; + this.liveToEnd = end == null; } @@ -77,12 +77,12 @@ public class LocalVariableGen implements InstructionTargeter, NamedAndTyped, Clo * @param type its type * @param start from where the instruction is valid (null means from the start) * @param end until where the instruction is valid (null means to the end) - * @param orig_index index of local variable prior to any changes to index + * @param origIndex index of local variable prior to any changes to index */ public LocalVariableGen(final int index, final String name, final Type type, final InstructionHandle start, - final InstructionHandle end, final int orig_index) { + final InstructionHandle end, final int origIndex) { this(index, name, type, start, end); - this.orig_index = orig_index; + this.origIndex = origIndex; } @@ -95,7 +95,7 @@ public class LocalVariableGen implements InstructionTargeter, NamedAndTyped, Clo * Note that due to the conversion from byte code offset to InstructionHandle, * it is impossible to tell the difference between a live range that ends BEFORE * the last insturction of the method or a live range that ends AFTER the last - * instruction of the method. Hence the live_to_end flag to differentiate + * instruction of the method. Hence the liveToEnd flag to differentiate * between these two cases. * * @param cp constant pool @@ -106,14 +106,14 @@ public class LocalVariableGen implements InstructionTargeter, NamedAndTyped, Clo if ((start != null) && (end != null)) { start_pc = start.getPosition(); length = end.getPosition() - start_pc; - if ((end.getNext() == null) && live_to_end) { + if ((end.getNext() == null) && liveToEnd) { length += end.getInstruction().getLength(); } } final int name_index = cp.addUtf8(name); final int signature_index = cp.addUtf8(type.getSignature()); return new LocalVariable(start_pc, length, name_index, signature_index, index, cp - .getConstantPool(), orig_index); + .getConstantPool(), origIndex); } @@ -128,17 +128,17 @@ public class LocalVariableGen implements InstructionTargeter, NamedAndTyped, Clo public int getOrigIndex() { - return orig_index; + return origIndex; } public void setLiveToEnd( final boolean live_to_end) { - this.live_to_end = live_to_end; + this.liveToEnd = live_to_end; } public boolean getLiveToEnd() { - return live_to_end; + return liveToEnd; } diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LocalVariableInstruction.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LocalVariableInstruction.java index 5f009b2ade0..fb4d7545478 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LocalVariableInstruction.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/LocalVariableInstruction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -28,14 +28,14 @@ import com.sun.org.apache.bcel.internal.util.ByteSequence; /** * Abstract super class for instructions dealing with local variables. * - * @LastModified: Jan 2020 + * @LastModified: May 2021 */ public abstract class LocalVariableInstruction extends Instruction implements TypedInstruction, IndexedInstruction { private int n = -1; // index of referenced variable - private short c_tag = -1; // compact version, such as ILOAD_0 - private short canon_tag = -1; // canonical tag such as ILOAD + private short cTag = -1; // compact version, such as ILOAD_0 + private short canonTag = -1; // canonical tag such as ILOAD private boolean wide() { @@ -50,8 +50,8 @@ public abstract class LocalVariableInstruction extends Instruction implements Ty */ LocalVariableInstruction(final short canon_tag, final short c_tag) { super(); - this.canon_tag = canon_tag; - this.c_tag = c_tag; + this.canonTag = canon_tag; + this.cTag = c_tag; } @@ -65,13 +65,13 @@ public abstract class LocalVariableInstruction extends Instruction implements Ty /** * @param opcode Instruction opcode - * @param c_tag Instruction number for compact version, ALOAD_0, e.g. + * @param cTag Instruction number for compact version, ALOAD_0, e.g. * @param n local variable index (unsigned short) */ - protected LocalVariableInstruction(final short opcode, final short c_tag, final int n) { + protected LocalVariableInstruction(final short opcode, final short cTag, final int n) { super(opcode, (short) 2); - this.c_tag = c_tag; - canon_tag = opcode; + this.cTag = cTag; + canonTag = opcode; setIndex(n); } @@ -167,10 +167,10 @@ public abstract class LocalVariableInstruction extends Instruction implements Ty this.n = n; // Cannot be < 0 as this is checked above if (n <= 3) { // Use more compact instruction xLOAD_n - super.setOpcode((short) (c_tag + n)); + super.setOpcode((short) (cTag + n)); super.setLength(1); } else { - super.setOpcode(canon_tag); + super.setOpcode(canonTag); if (wide()) { super.setLength(4); } else { @@ -183,7 +183,7 @@ public abstract class LocalVariableInstruction extends Instruction implements Ty /** @return canonical tag for instruction, e.g., ALOAD for ALOAD_0 */ public short getCanonicalTag() { - return canon_tag; + return canonTag; } @@ -197,7 +197,7 @@ public abstract class LocalVariableInstruction extends Instruction implements Ty */ @Override public Type getType( final ConstantPoolGen cp ) { - switch (canon_tag) { + switch (canonTag) { case Const.ILOAD: case Const.ISTORE: return Type.INT; @@ -214,7 +214,7 @@ public abstract class LocalVariableInstruction extends Instruction implements Ty case Const.ASTORE: return Type.OBJECT; default: - throw new ClassGenException("Oops: unknown case in switch" + canon_tag); + throw new ClassGenException("Unknown case in switch" + canonTag); } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MethodGen.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MethodGen.java index 478082cc13f..f787b44b08d 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MethodGen.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/MethodGen.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -57,25 +57,25 @@ import java.util.Stack; * * @see InstructionList * @see Method - * @LastModified: Jan 2020 + * @LastModified: May 2021 */ public class MethodGen extends FieldGenOrMethodGen { - private String class_name; - private Type[] arg_types; - private String[] arg_names; - private int max_locals; - private int max_stack; + private String className; + private Type[] argTypes; + private String[] argNames; + private int maxLocals; + private int maxStack; private InstructionList il; - private boolean strip_attributes; - private LocalVariableTypeTable local_variable_type_table = null; - private final List
We use our super's target property as the default target.
+ *
We use our super's {@code target} property as the default target. * * @see LOOKUPSWITCH * @see TABLESWITCH * @see InstructionList - * @LastModified: Jan 2020 + * @LastModified: May 2021 */ public abstract class Select extends BranchInstruction implements VariableLengthInstruction, StackConsumer /* @since 6.0 */, StackProducer { diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SimpleElementValueGen.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SimpleElementValueGen.java index 946d962fcf3..bccb59cabaf 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SimpleElementValueGen.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/SimpleElementValueGen.java @@ -166,7 +166,7 @@ public class SimpleElementValueGen extends ElementValueGen idx = cpool.addInteger(value.getValueShort()); break; default: - throw new RuntimeException( + throw new IllegalArgumentException( "SimpleElementValueGen class does not know how to copy this type " + super.getElementValueType()); } } @@ -189,7 +189,7 @@ public class SimpleElementValueGen extends ElementValueGen public String getValueString() { if (super.getElementValueType() != STRING) { - throw new RuntimeException( + throw new IllegalStateException( "Dont call getValueString() on a non STRING ElementValue"); } final ConstantUtf8 c = (ConstantUtf8) getConstantPool().getConstant(idx); @@ -199,7 +199,7 @@ public class SimpleElementValueGen extends ElementValueGen public int getValueInt() { if (super.getElementValueType() != PRIMITIVE_INT) { - throw new RuntimeException( + throw new IllegalStateException( "Dont call getValueString() on a non STRING ElementValue"); } final ConstantInteger c = (ConstantInteger) getConstantPool().getConstant(idx); @@ -243,7 +243,7 @@ public class SimpleElementValueGen extends ElementValueGen final ConstantUtf8 cu8 = (ConstantUtf8) getConstantPool().getConstant(idx); return cu8.getBytes(); default: - throw new RuntimeException( + throw new IllegalStateException( "SimpleElementValueGen class does not know how to stringify type " + super.getElementValueType()); } } @@ -266,7 +266,7 @@ public class SimpleElementValueGen extends ElementValueGen dos.writeShort(idx); break; default: - throw new RuntimeException( + throw new IllegalStateException( "SimpleElementValueGen doesnt know how to write out type " + super.getElementValueType()); } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/Type.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/Type.java index ced2f1832e8..2e366dfc8d9 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/Type.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/Type.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -30,7 +30,7 @@ import com.sun.org.apache.bcel.internal.classfile.Utility; * Abstract super class for all possible java types, namely basic types * such as int, object types like String and array types, e.g. int[] * - * @LastModified: Jan 2020 + * @LastModified: May 2021 */ public abstract class Type { @@ -295,7 +295,7 @@ public abstract class Type { } else if (cl == Character.TYPE) { return CHAR; } else { - throw new IllegalStateException("Ooops, what primitive type is " + cl); + throw new IllegalStateException("Unknown primitive type " + cl); } } else { // "Real" class return ObjectType.getInstance(cl.getName()); diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELFactory.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELFactory.java index 18f9d5a5d08..ae7f74099e9 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELFactory.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/BCELFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -64,7 +64,7 @@ import com.sun.org.apache.bcel.internal.generic.Type; * A helper class for BCELifier. * * @see BCELifier - * @LastModified: Jan 2020 + * @LastModified: May 2021 */ class BCELFactory extends EmptyVisitor { @@ -201,7 +201,7 @@ class BCELFactory extends EmptyVisitor { + ", (short) " + dim + "));"); break; default: - throw new RuntimeException("Oops: " + opcode); + throw new IllegalArgumentException("Unhandled opcode: " + opcode); } } diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/CodeHTML.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/CodeHTML.java index 0ed26e4cf1c..fe8e9388391 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/CodeHTML.java +++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/CodeHTML.java @@ -48,21 +48,21 @@ import com.sun.org.apache.bcel.internal.classfile.Utility; */ final class CodeHTML { - private final String class_name; // name of current class + private final String className; // name of current class // private Method[] methods; // Methods to print private final PrintWriter file; // file to write to - private BitSet goto_set; - private final ConstantPool constant_pool; - private final ConstantHTML constant_html; + private BitSet gotoSet; + private final ConstantPool constantPool; + private final ConstantHTML constantHtml; private static boolean wide = false; CodeHTML(final String dir, final String class_name, final Method[] methods, final ConstantPool constant_pool, final ConstantHTML constant_html) throws IOException { - this.class_name = class_name; + this.className = class_name; // this.methods = methods; - this.constant_pool = constant_pool; - this.constant_html = constant_html; + this.constantPool = constant_pool; + this.constantHtml = constant_html; file = new PrintWriter(new FileOutputStream(dir + class_name + "_code.html")); file.println("
"); for (int i = 0; i < methods.length; i++) { @@ -231,19 +231,19 @@ final class CodeHTML { case Const.PUTFIELD: case Const.PUTSTATIC: index = bytes.readShort(); - final ConstantFieldref c1 = (ConstantFieldref) constant_pool.getConstant(index, + final ConstantFieldref c1 = (ConstantFieldref) constantPool.getConstant(index, Const.CONSTANT_Fieldref); class_index = c1.getClassIndex(); - name = constant_pool.getConstantString(class_index, Const.CONSTANT_Class); + name = constantPool.getConstantString(class_index, Const.CONSTANT_Class); name = Utility.compactClassName(name, false); index = c1.getNameAndTypeIndex(); - final String field_name = constant_pool.constantToString(index, Const.CONSTANT_NameAndType); - if (name.equals(class_name)) { // Local field - buf.append("").append(field_name) .append("\n"); } else { - buf.append(constant_html.referenceConstant(class_index)).append(".").append( + buf.append(constantHtml.referenceConstant(class_index)).append(".").append( field_name); } break; @@ -253,7 +253,7 @@ final class CodeHTML { case Const.INSTANCEOF: case Const.NEW: index = bytes.readShort(); - buf.append(constant_html.referenceConstant(index)); + buf.append(constantHtml.referenceConstant(index)); break; /* Operands are references to methods in constant pool */ @@ -269,7 +269,7 @@ final class CodeHTML { bytes.readUnsignedByte(); // Reserved // int nargs = bytes.readUnsignedByte(); // Redundant // int reserved = bytes.readUnsignedByte(); // Reserved - final ConstantInterfaceMethodref c = (ConstantInterfaceMethodref) constant_pool + final ConstantInterfaceMethodref c = (ConstantInterfaceMethodref) constantPool .getConstant(m_index, Const.CONSTANT_InterfaceMethodref); class_index = c.getClassIndex(); index = c.getNameAndTypeIndex(); @@ -277,7 +277,7 @@ final class CodeHTML { } else if (opcode == Const.INVOKEDYNAMIC) { // Special treatment needed bytes.readUnsignedByte(); // Reserved bytes.readUnsignedByte(); // Reserved - final ConstantInvokeDynamic c = (ConstantInvokeDynamic) constant_pool + final ConstantInvokeDynamic c = (ConstantInvokeDynamic) constantPool .getConstant(m_index, Const.CONSTANT_InvokeDynamic); index = c.getNameAndTypeIndex(); name = "#" + c.getBootstrapMethodAttrIndex(); @@ -285,21 +285,21 @@ final class CodeHTML { // UNDONE: Java8 now allows INVOKESPECIAL and INVOKESTATIC to // reference EITHER a Methodref OR an InterfaceMethodref. // Not sure if that affects this code or not. (markro) - final ConstantMethodref c = (ConstantMethodref) constant_pool.getConstant(m_index, + final ConstantMethodref c = (ConstantMethodref) constantPool.getConstant(m_index, Const.CONSTANT_Methodref); class_index = c.getClassIndex(); index = c.getNameAndTypeIndex(); name = Class2HTML.referenceClass(class_index); } - str = Class2HTML.toHTML(constant_pool.constantToString(constant_pool.getConstant( + str = Class2HTML.toHTML(constantPool.constantToString(constantPool.getConstant( index, Const.CONSTANT_NameAndType))); // Get signature, i.e., types - final ConstantNameAndType c2 = (ConstantNameAndType) constant_pool.getConstant(index, + final ConstantNameAndType c2 = (ConstantNameAndType) constantPool.getConstant(index, Const.CONSTANT_NameAndType); - signature = constant_pool.constantToString(c2.getSignatureIndex(), Const.CONSTANT_Utf8); + signature = constantPool.constantToString(c2.getSignatureIndex(), Const.CONSTANT_Utf8); final String[] args = Utility.methodSignatureArgumentTypes(signature, false); final String type = Utility.methodSignatureReturnType(signature, false); - buf.append(name).append(".").append(str).append( "").append("("); // List arguments @@ -317,30 +317,30 @@ final class CodeHTML { case Const.LDC_W: case Const.LDC2_W: index = bytes.readShort(); - buf.append("").append( - Class2HTML.toHTML(constant_pool.constantToString(index, - constant_pool.getConstant(index).getTag()))).append(""); + Class2HTML.toHTML(constantPool.constantToString(index, + constantPool.getConstant(index).getTag()))).append(""); break; case Const.LDC: index = bytes.readUnsignedByte(); - buf.append("").append( - Class2HTML.toHTML(constant_pool.constantToString(index, - constant_pool.getConstant(index).getTag()))).append(""); + Class2HTML.toHTML(constantPool.constantToString(index, + constantPool.getConstant(index).getTag()))).append(""); break; /* Array of references. */ case Const.ANEWARRAY: index = bytes.readShort(); - buf.append(constant_html.referenceConstant(index)); + buf.append(constantHtml.referenceConstant(index)); break; /* Multidimensional array of references. */ case Const.MULTIANEWARRAY: index = bytes.readShort(); final int dimensions = bytes.readByte(); - buf.append(constant_html.referenceConstant(index)).append(":").append(dimensions) + buf.append(constantHtml.referenceConstant(index)).append(":").append(dimensions) .append("-dimensional"); break; /* Increment local variable. @@ -389,7 +389,7 @@ final class CodeHTML { */ private void findGotos( final ByteSequence bytes, final Code code ) throws IOException { int index; - goto_set = new BitSet(bytes.available()); + gotoSet = new BitSet(bytes.available()); int opcode; /* First get Code attribute from method and the exceptions handled * (try .. catch) in this method. We only need the line number here. @@ -397,9 +397,9 @@ final class CodeHTML { if (code != null) { final CodeException[] ce = code.getExceptionTable(); for (final CodeException cex : ce) { - goto_set.set(cex.getStartPC()); - goto_set.set(cex.getEndPC()); - goto_set.set(cex.getHandlerPC()); + gotoSet.set(cex.getStartPC()); + gotoSet.set(cex.getEndPC()); + gotoSet.set(cex.getHandlerPC()); } // Look for local variables and their range final Attribute[] attributes = code.getAttributes(); @@ -410,8 +410,8 @@ final class CodeHTML { for (final LocalVariable var : vars) { final int start = var.getStartPC(); final int end = start + var.getLength(); - goto_set.set(start); - goto_set.set(end); + gotoSet.set(start); + gotoSet.set(end); } break; } @@ -439,21 +439,21 @@ final class CodeHTML { final int high = bytes.readInt(); offset = bytes.getIndex() - 12 - no_pad_bytes - 1; default_offset += offset; - goto_set.set(default_offset); + gotoSet.set(default_offset); for (int j = 0; j < (high - low + 1); j++) { index = offset + bytes.readInt(); - goto_set.set(index); + gotoSet.set(index); } } else { // LOOKUPSWITCH final int npairs = bytes.readInt(); offset = bytes.getIndex() - 8 - no_pad_bytes - 1; default_offset += offset; - goto_set.set(default_offset); + gotoSet.set(default_offset); for (int j = 0; j < npairs; j++) { // int match = bytes.readInt(); bytes.readInt(); index = offset + bytes.readInt(); - goto_set.set(index); + gotoSet.set(index); } } break; @@ -477,13 +477,13 @@ final class CodeHTML { case Const.JSR: //bytes.readByte(); // Skip already read byte index = bytes.getIndex() + bytes.readShort() - 1; - goto_set.set(index); + gotoSet.set(index); break; case Const.GOTO_W: case Const.JSR_W: //bytes.readByte(); // Skip already read byte index = bytes.getIndex() + bytes.readInt() - 1; - goto_set.set(index); + gotoSet.set(index); break; default: bytes.unreadByte(); @@ -513,7 +513,7 @@ final class CodeHTML { final Attribute[] attributes = method.getAttributes(); file.print("" + access + " " + "" + Class2HTML.referenceType(type) + " "
+ + className + "_methods.html#method" + method_number + "\" TARGET=Methods>"
+ html_name + "(");
for (int i = 0; i < args.length; i++) {
file.print(Class2HTML.referenceType(args[i]));
@@ -529,7 +529,7 @@ final class CodeHTML {
for (int i = 0; i < attributes.length; i++) {
byte tag = attributes[i].getTag();
if (tag != Const.ATTR_UNKNOWN) {
- file.print(" " + ret_type + " " + ref + arg_types
+ " \n " + ref + " " + ref + " " + str + " "
- + Class2HTML.toHTML(constant_pool.constantToString(index, tag))
+ + Class2HTML.toHTML(constantPool.constantToString(index, tag))
+ " " + Class2HTML.toHTML(constant_pool.constantToString(index, tag)) + "\n");
+ file.println(" " + Class2HTML.toHTML(constantPool.constantToString(index, tag)) + "\n");
} // switch
}
diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/InstructionFinder.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/InstructionFinder.java
index b9b4815311c..46d22379524 100644
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/InstructionFinder.java
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/InstructionFinder.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -64,7 +64,7 @@ import java.util.regex.Pattern;
*
* @see com.sun.org.apache.bcel.internal.generic.Instruction
* @see InstructionList
- * @LastModified: Jan 2020
+ * @LastModified: May 2021
*/
public class InstructionFinder {
@@ -72,7 +72,7 @@ public class InstructionFinder {
private static final int NO_OPCODES = 256; // Potential number, some are not used
private static final Map");
for (int j = 0; j < attributes2.length; j++) {
tag = attributes2[j].getTag();
- file.print("
");
}
if (code != null) { // No code, an abstract method, e.g.
- //System.out.println(name + "\n" + Utility.codeToString(code, constant_pool, 0, -1));
+ //System.out.println(name + "\n" + Utility.codeToString(code, constantPool, 0, -1));
// Print the byte code
try (ByteSequence stream = new ByteSequence(code)) {
stream.mark(stream.available());
@@ -568,7 +568,7 @@ final class CodeHTML {
* Set an anchor mark if this line is targetted by a goto, jsr, etc. Defining an anchor for every
* line is very inefficient!
*/
- if (goto_set.get(offset)) {
+ if (gotoSet.get(offset)) {
anchor = "";
}
String anchor2;
diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ConstantHTML.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ConstantHTML.java
index eeafbcfaff8..e2d5b4b5103 100644
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ConstantHTML.java
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ConstantHTML.java
@@ -44,25 +44,25 @@ import com.sun.org.apache.bcel.internal.classfile.Utility;
*/
final class ConstantHTML {
- private final String class_name; // name of current class
- private final String class_package; // name of package
- private final ConstantPool constant_pool; // reference to constant pool
+ private final String className; // name of current class
+ private final String classPackage; // name of package
+ private final ConstantPool constantPool; // reference to constant pool
private final PrintWriter file; // file to write to
- private final String[] constant_ref; // String to return for cp[i]
+ private final String[] constantRef; // String to return for cp[i]
private final Constant[] constants; // The constants in the cp
private final Method[] methods;
ConstantHTML(final String dir, final String class_name, final String class_package, final Method[] methods,
final ConstantPool constant_pool) throws IOException {
- this.class_name = class_name;
- this.class_package = class_package;
- this.constant_pool = constant_pool;
+ this.className = class_name;
+ this.classPackage = class_package;
+ this.constantPool = constant_pool;
this.methods = methods;
constants = constant_pool.getConstantPool();
file = new PrintWriter(new FileOutputStream(dir + class_name + "_cp.html"));
- constant_ref = new String[constants.length];
- constant_ref[0] = "<unknown>";
+ constantRef = new String[constants.length];
+ constantRef[0] = "<unknown>";
file.println("");
// Loop through constants, constants[0] is reserved
for (int i = 1; i < constants.length; i++) {
@@ -82,7 +82,7 @@ final class ConstantHTML {
String referenceConstant( final int index ) {
- return constant_ref[index];
+ return constantRef[index];
}
@@ -101,29 +101,29 @@ final class ConstantHTML {
case Const.CONSTANT_Methodref:
// Get class_index and name_and_type_index, depending on type
if (tag == Const.CONSTANT_Methodref) {
- final ConstantMethodref c = (ConstantMethodref) constant_pool.getConstant(index,
+ final ConstantMethodref c = (ConstantMethodref) constantPool.getConstant(index,
Const.CONSTANT_Methodref);
class_index = c.getClassIndex();
name_index = c.getNameAndTypeIndex();
} else {
- final ConstantInterfaceMethodref c1 = (ConstantInterfaceMethodref) constant_pool
+ final ConstantInterfaceMethodref c1 = (ConstantInterfaceMethodref) constantPool
.getConstant(index, Const.CONSTANT_InterfaceMethodref);
class_index = c1.getClassIndex();
name_index = c1.getNameAndTypeIndex();
}
// Get method name and its class
- final String method_name = constant_pool.constantToString(name_index,
+ final String method_name = constantPool.constantToString(name_index,
Const.CONSTANT_NameAndType);
final String html_method_name = Class2HTML.toHTML(method_name);
// Partially compacted class name, i.e., / -> .
- final String method_class = constant_pool.constantToString(class_index, Const.CONSTANT_Class);
+ final String method_class = constantPool.constantToString(class_index, Const.CONSTANT_Class);
String short_method_class = Utility.compactClassName(method_class); // I.e., remove java.lang.
- short_method_class = Utility.compactClassName(short_method_class, class_package
+ short_method_class = Utility.compactClassName(short_method_class, classPackage
+ ".", true); // Remove class package prefix
// Get method signature
- final ConstantNameAndType c2 = (ConstantNameAndType) constant_pool.getConstant(
+ final ConstantNameAndType c2 = (ConstantNameAndType) constantPool.getConstant(
name_index, Const.CONSTANT_NameAndType);
- final String signature = constant_pool.constantToString(c2.getSignatureIndex(),
+ final String signature = constantPool.constantToString(c2.getSignatureIndex(),
Const.CONSTANT_Utf8);
// Get array of strings containing the argument types
final String[] args = Utility.methodSignatureArgumentTypes(signature, false);
@@ -139,17 +139,17 @@ final class ConstantHTML {
}
buf.append(")");
final String arg_types = buf.toString();
- if (method_class.equals(class_name)) {
- ref = ""
+ html_method_name + "";
} else {
ref = ""
+ short_method_class + "." + html_method_name;
}
- constant_ref[index] = ret_type + " " + short_method_class
- + ".." + html_method_name + " " + arg_types;
file.println("
" + "
\n" + "" + "
");
break;
case Const.CONSTANT_Class:
- final ConstantClass c4 = (ConstantClass) constant_pool.getConstant(index, Const.CONSTANT_Class);
+ final ConstantClass c4 = (ConstantClass) constantPool.getConstant(index, Const.CONSTANT_Class);
name_index = c4.getNameIndex();
- final String class_name2 = constant_pool.constantToString(index, tag); // / -> .
+ final String class_name2 = constantPool.constantToString(index, tag); // / -> .
String short_class_name = Utility.compactClassName(class_name2); // I.e., remove java.lang.
- short_class_name = Utility.compactClassName(short_class_name, class_package + ".",
+ short_class_name = Utility.compactClassName(short_class_name, classPackage + ".",
true); // Remove class package prefix
ref = "" + short_class_name
+ "";
- constant_ref[index] = "" + short_class_name + "";
file.println("
\n"
@@ -186,40 +186,40 @@ final class ConstantHTML {
+ ")");
file.println("
Access flags Type "
@@ -95,7 +95,7 @@ final class MethodHTML {
if (attributes[i].getTag() == Const.ATTR_CONSTANT_VALUE) { // Default value
final String str = ((ConstantValue) attributes[i]).toString();
// Reference attribute in _attributes.html
- file.print("= = " + str + " \n");
break;
}
@@ -125,7 +125,7 @@ final class MethodHTML {
html_name = Class2HTML.toHTML(name);
file.print("" + access + " ");
- file.print("" + Class2HTML.referenceType(type) + " " + "" + Class2HTML.referenceType(type) + " " + "" + html_name
+ " \n(");
for (int i = 0; i < args.length; i++) {
@@ -144,7 +144,7 @@ final class MethodHTML {
file.print(" throws ");
final int[] exceptions = ((ExceptionTable) attributes[i]).getExceptionIndexTable();
for (int j = 0; j < exceptions.length; j++) {
- file.print(constant_html.referenceConstant(exceptions[j]));
+ file.print(constantHtml.referenceConstant(exceptions[j]));
if (j < exceptions.length - 1) {
file.print(", ");
}
diff --git a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/SyntheticRepository.java b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/SyntheticRepository.java
index 19eaa7ff3b7..c0c708235ec 100644
--- a/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/SyntheticRepository.java
+++ b/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/SyntheticRepository.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved.
*/
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -39,7 +39,7 @@ import java.util.Map;
*
* @see com.sun.org.apache.bcel.internal.Repository
*
- * @LastModified: Jan 2020
+ * @LastModified: May 2021
*/
public class SyntheticRepository implements Repository {
@@ -60,7 +60,7 @@ public class SyntheticRepository implements Repository {
public void storeClass(final JavaClass clazz) {
loadedClasses.put(clazz.getClassName(), new SoftReference<>(clazz));
clazz.setRepository(this);
- }
+ }
/**
* Remove class from repository
@@ -78,7 +78,7 @@ public class SyntheticRepository implements Repository {
final SoftReference