Example #1
0
        public static ConstantPoolInfo Read(ClassReader classReader)
        {
            ushort           tag = classReader.ReadU1();
            ConstantPoolInfo constantPoolInfo = null;

            switch (tag)
            {
            case 7:
                constantPoolInfo = new ConstantClass(); break;

            case 9:
                constantPoolInfo = new ConstantFieldRef(); break;

            case 10:
                constantPoolInfo = new ConstantMethodRef(); break;

            case 11:
                constantPoolInfo = new ConstantInterfaceMethodRef(); break;

            case 8:
                constantPoolInfo = new ConstantString(); break;

            case 3:
                constantPoolInfo = new ConstantInteger(); break;

            case 4:
                constantPoolInfo = new ConstantFloat(); break;

            case 5:
                constantPoolInfo = new ConstantLong(); break;

            case 6:
                constantPoolInfo = new ConstantDouble(); break;

            case 12:
                constantPoolInfo = new ConstantNameAndType(); break;

            case 1:
                constantPoolInfo = new ConstantUtf8(); break;

            case 15:
                constantPoolInfo = new ConstantMethodHandle(); break;

            case 16:
                constantPoolInfo = new ConstantMethodType(); break;

            case 18:
                constantPoolInfo = new ConstantInvokeDynamic(); break;

            default:
                throw new Exception("ClassFileError:constantPoolInfo incorrect");
            }
            constantPoolInfo.Tag = tag;
            constantPoolInfo.ReadConstantPoolInfo(classReader);

            return(constantPoolInfo);
        }
 public void AddConstantInterfaceMethodRef(ConstantInterfaceMethodRef constantInterfaceMethodRef)
 {
     constantInterfaceMethodRefs.Add(constantInterfaceMethodRef);
     router.Add(constantInterfaceMethodRefs.Count);
 }