src/java.xml/share/classes/com/sun/org/apache/bcel/internal/generic/InstructionFactory.java
changeset 48041 2743e489189e
parent 47216 71c04702a3d5
child 55496 8e0ae3830fca
equal deleted inserted replaced
48040:26f1193f1348 48041:2743e489189e
    30  * {@link InstructionConst} class.
    30  * {@link InstructionConst} class.
    31  *
    31  *
    32  * @version $Id: InstructionFactory.java 1749603 2016-06-21 20:50:19Z ggregory $
    32  * @version $Id: InstructionFactory.java 1749603 2016-06-21 20:50:19Z ggregory $
    33  * @see Const
    33  * @see Const
    34  * @see InstructionConst
    34  * @see InstructionConst
       
    35  * @LastModified: Nov 2017
    35  */
    36  */
    36 public class InstructionFactory {
    37 public class InstructionFactory {
    37 
    38 
    38     // N.N. These must agree with the order of Constants.T_CHAR through T_LONG
    39     // N.N. These must agree with the order of Constants.T_CHAR through T_LONG
    39     private static final String[] short_names = {
    40     private static final String[] short_names = {
   571             }
   572             }
   572             final String name = "com.sun.org.apache.bcel.internal.generic." + short_names[src - Const.T_CHAR] + "2"
   573             final String name = "com.sun.org.apache.bcel.internal.generic." + short_names[src - Const.T_CHAR] + "2"
   573                     + short_names[dest - Const.T_CHAR];
   574                     + short_names[dest - Const.T_CHAR];
   574             Instruction i = null;
   575             Instruction i = null;
   575             try {
   576             try {
   576                 i = (Instruction) java.lang.Class.forName(name).newInstance();
   577                 i = (Instruction) java.lang.Class.forName(name).getDeclaredConstructor().newInstance();
   577             } catch (final Exception e) {
   578             } catch (final Exception e) {
   578                 throw new RuntimeException("Could not find instruction: " + name, e);
   579                 throw new RuntimeException("Could not find instruction: " + name, e);
   579             }
   580             }
   580             return i;
   581             return i;
   581         } else if ((src_type instanceof ReferenceType) && (dest_type instanceof ReferenceType)) {
   582         } else if ((src_type instanceof ReferenceType) && (dest_type instanceof ReferenceType)) {