Package org.apache.bcel.classfile

Examples of org.apache.bcel.classfile.ConstantClass


            e.printStackTrace();
            return null;
        }
        // Adapt the class name to the passed value
        ConstantPool cp = clazz.getConstantPool();
        ConstantClass cl = (ConstantClass) cp.getConstant(clazz.getClassNameIndex(),
                Constants.CONSTANT_Class);
        ConstantUtf8 name = (ConstantUtf8) cp.getConstant(cl.getNameIndex(),
                Constants.CONSTANT_Utf8);
        name.setBytes(class_name.replace('.', '/'));
        return clazz;
    }
View Full Code Here


      CodeException[] exc_table = obj.getExceptionTable();
      for (int i=0; i<exc_table.length; i++){
        int exc_index = exc_table[i].getCatchType();
        if (exc_index != 0){ // if 0, it catches all Throwables
          checkIndex(obj, exc_index, CONST_Class);
          ConstantClass cc = (ConstantClass) (cp.getConstant(exc_index));
          checkIndex(cc, cc.getNameIndex(), CONST_Utf8); // cannot be sure this ConstantClass has already been visited (checked)!
          String cname = ((ConstantUtf8) cp.getConstant(cc.getNameIndex())).getBytes().replace('/','.');

          Verifier v = VerifierFactory.getVerifier(cname);
          VerificationResult vr = v.doPass1();

          if (vr != VerificationResult.VR_OK){
View Full Code Here

      int[] exc_indices = obj.getExceptionIndexTable();

      for (int i=0; i<exc_indices.length; i++){
        checkIndex(obj, exc_indices[i], CONST_Class);

        ConstantClass cc = (ConstantClass) (cp.getConstant(exc_indices[i]));
        checkIndex(cc, cc.getNameIndex(), CONST_Utf8); // cannot be sure this ConstantClass has already been visited (checked)!
        String cname = ((ConstantUtf8) cp.getConstant(cc.getNameIndex())).getBytes().replace('/','.'); //convert internal notation on-the-fly to external notation

        Verifier v = VerifierFactory.getVerifier(cname);
        VerificationResult vr = v.doPass1();

        if (vr != VerificationResult.VR_OK){
View Full Code Here

      if (!validFieldName(name)){
        throw new ClassConstraintException("Invalid field name '"+name+"' referenced by '"+tostring(obj)+"'.");
      }
     
      int class_index = obj.getClassIndex();
      ConstantClass cc = (ConstantClass) (cp.getConstant(class_index));
      String className = ((ConstantUtf8) (cp.getConstant(cc.getNameIndex()))).getBytes(); // Class Name in internal form
      if (! validClassName(className)){
        throw new ClassConstraintException("Illegal class name '"+className+"' used by '"+tostring(obj)+"'.");
      }

      String sig  = ((ConstantUtf8) (cp.getConstant(cnat.getSignatureIndex()))).getBytes(); // Field or Method signature(=descriptor)
View Full Code Here

      if (!validClassMethodName(name)){
        throw new ClassConstraintException("Invalid (non-interface) method name '"+name+"' referenced by '"+tostring(obj)+"'.");
      }

      int class_index = obj.getClassIndex();
      ConstantClass cc = (ConstantClass) (cp.getConstant(class_index));
      String className = ((ConstantUtf8) (cp.getConstant(cc.getNameIndex()))).getBytes(); // Class Name in internal form
      if (! validClassName(className)){
        throw new ClassConstraintException("Illegal class name '"+className+"' used by '"+tostring(obj)+"'.");
      }

      String sig  = ((ConstantUtf8) (cp.getConstant(cnat.getSignatureIndex()))).getBytes(); // Field or Method signature(=descriptor)
View Full Code Here

      if (!validInterfaceMethodName(name)){
        throw new ClassConstraintException("Invalid (interface) method name '"+name+"' referenced by '"+tostring(obj)+"'.");
      }

      int class_index = obj.getClassIndex();
      ConstantClass cc = (ConstantClass) (cp.getConstant(class_index));
      String className = ((ConstantUtf8) (cp.getConstant(cc.getNameIndex()))).getBytes(); // Class Name in internal form
      if (! validClassName(className)){
        throw new ClassConstraintException("Illegal class name '"+className+"' used by '"+tostring(obj)+"'.");
      }

      String sig  = ((ConstantUtf8) (cp.getConstant(cnat.getSignatureIndex()))).getBytes(); // Field or Method signature(=descriptor)
View Full Code Here

TOP

Related Classes of org.apache.bcel.classfile.ConstantClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.