Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.ObjectType


                type = (Type)s_typeMap.get(base);
            }
           
            // create and record base type if new
            if (type == null) {
                type = new ObjectType(base);
                s_typeMap.put(base, type);
            }
           
            // create and record array type
            if (dimen > 0) {
View Full Code Here


    public static Transform getTransformationForJavaClass(
        JavaClass claz,
        ConstantPoolGen cp) {
        Field[] fields = claz.getFields();
        ObjectType fieldType;
        Transform t;
        for (int i = 0; i < fields.length; i++) {

            try {
                fieldType = (ObjectType) fields[i].getType();
            } catch (ClassCastException ex) {
                continue;
            }
            for (Iterator j = transmap.iterator(); j.hasNext();) {
                t = (Transform) j.next();
                if (fieldType.equals(t.getLogType())
                    || fieldType.isCastableTo(t.getLogType())) {
                    logger.info(
                        "Found logger attribute: "
                            + fieldType
                            + " "
                            + fields[i].getName());
View Full Code Here

                // Build the initial frame situation for this method.
                Frame f = new Frame(mg.getMaxLocals(),mg.getMaxStack());
                if ( !mg.isStatic() ){
                    if (mg.getName().equals(Constants.CONSTRUCTOR_NAME)){
                        Frame._this = new UninitializedObjectType(new ObjectType(jc.getClassName()));
                        f.getLocals().set(0, Frame._this);
                    }
                    else{
                        Frame._this = null;
                        f.getLocals().set(0, new ObjectType(jc.getClassName()));
                    }
                }
                Type[] argtypes = mg.getArgumentTypes();
                int twoslotoffset = 0;
                for (int j=0; j<argtypes.length; j++){
View Full Code Here

        } else if (clazz.isArray()) {
            return new ArrayType(translate(clazz.getComponentType()), 1);

        } else {

            return new ObjectType(clazz.getName());
        }
    }
View Full Code Here

        // A RuntimeException should not cause an
        // UndeclaredThrowableException, so we catch and re-throw it
        // that before throwable.
        if (handle_throwable_exception && handle_runtime_exception) {
            mg.addExceptionHandler(tryStart, tryEnd, rethrowLocation,
                    new ObjectType("java.lang.RuntimeException"));
        }

        // If anything else is thrown, it is wrapped in an
        // UndeclaredThrowable
        if (handle_throwable_exception) {
            InstructionHandle handlerStart = il.append(new ASTORE(1));

            il
                    .append(new NEW(
                            cp
                                    .addClass("java.lang.reflect.UndeclaredThrowableException")));
            il.append(InstructionConstants.DUP);
            il.append(new ALOAD(1));
            il.append(new INVOKESPECIAL(cp.addMethodref(
                    "java.lang.reflect.UndeclaredThrowableException", "<init>",
                    "(Ljava/lang/Throwable;)V")));

            il.append(new ATHROW());

            mg.addExceptionHandler(tryStart, tryEnd, handlerStart,
                    new ObjectType("java.lang.Throwable"));
        }

        //
        // DONE
        //
View Full Code Here

        case Constants.T_SHORT:
        case Constants.T_INT:
        case Constants.T_FLOAT:

            // float
            il.append(fac.createNew(new ObjectType(BASIC_CLASS_NAMES[tag])));

            // float Float
            il.append(InstructionConstants.DUP_X1);

            // Float float Float
            il.append(InstructionConstants.SWAP);

            // Float Float float
            il.append(fac.createInvoke(BASIC_CLASS_NAMES[tag], "<init>",
                    Type.VOID, new Type[] { type }, Constants.INVOKESPECIAL));

            // Float
            return;

        case Constants.T_DOUBLE:
        case Constants.T_LONG:

            // double/2
            il.append(fac.createNew(new ObjectType(BASIC_CLASS_NAMES[tag])));

            // double/2 Double
            il.append(InstructionConstants.DUP_X2);

            // Double double/2 Double
View Full Code Here

        case Constants.T_SHORT:
        case Constants.T_INT:
        case Constants.T_LONG:
        case Constants.T_FLOAT:
        case Constants.T_DOUBLE:
            il.append(fac.createCast(Type.OBJECT, new ObjectType(
                    BASIC_CLASS_NAMES[tag])));
            return emitInvoke(il, fac, UNBOXING_METHOD[tag]);

        case Constants.T_OBJECT:
        case Constants.T_ARRAY:
View Full Code Here

     
      @Override
      public void accept(Expression e) {
        if(e instanceof NewInstance) {
          if(((NewInstance) e).getType() instanceof ObjectType) {
            ObjectType obj = (ObjectType)((NewInstance) e).getType();
            if(StringUtils.equals("java.lang.StringBuilder", obj.getClassName())) {
              System.out.println(obj.getClassName());
            }
           
          }
        }
      }
View Full Code Here

      igc.getGraph().addEdge(source, target, ie);
    }
  }
 
  private void addExceptionHandle(IntermediateEdge ie, CodeExceptionGen ceg) {
    ObjectType ot = ceg.getCatchType();
    Resolved resolved = null;
    if(ot == null) {
      resolved = new Resolved((InstructionHandle)ie.getTarget(), Type.THROWABLE, "e");
    }
    else {
      resolved = new Resolved((InstructionHandle)ie.getTarget(), ot, ot.toString());
    }
   
    ie.getAttributes().put(EXCEPTION_STACK_KEY, resolved);
  }
View Full Code Here

            int local = methodGen.isStatic() ? 0 : 1;

            for (Type type : parameterTypeList) {
                if (type instanceof ObjectType) {
                    ObjectType objectType = (ObjectType) type;

                    for (ObjectType streamBase : streamBaseList) {
                        if (Hierarchy.isSubtype(objectType, streamBase)) {
                            // OK, found a parameter that is a resource.
                            // Create a Stream object to represent it.
                            // The Stream will be uninteresting, so it will
                            // inhibit reporting for any stream that wraps it.
                            Stream paramStream = new Stream(firstLocation, objectType.getClassName(), streamBase.getClassName());
                            paramStream.setIsOpenOnCreation(true);
                            paramStream.setOpenLocation(firstLocation);
                            paramStream.setInstanceParam(local);
                            resourceCollection.addPreexistingResource(paramStream);
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.ObjectType

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.