Package net.sf.rej.java.constantpool

Examples of net.sf.rej.java.constantpool.NameAndTypeInfo


        if (cpi.getType() == ConstantPoolInfo.CLASS) {
          // there can be array definitions here, too
          JavaType cls = new JavaType(cpi.getValue());
          imports.addType(cls.getType());
        } else if (cpi.getType() == ConstantPoolInfo.NAME_AND_TYPE) {
          NameAndTypeInfo nati = (NameAndTypeInfo) cpi;
          Descriptor desc = nati.getDescriptor();
          if (!desc.getReturn().isPrimitive()) {
            imports.addType(desc.getReturn().getType());
          }

          List al = desc.getParamList();
View Full Code Here


        } else {
          SystemFacade.getInstance().performAction(u, ic.getFilename());
        }
      }
    } if(cpi.getType() == ConstantPoolInfo.NAME_AND_TYPE) {
      NameAndTypeInfo nati = (NameAndTypeInfo)cpi;
      Descriptor desc = nati.getDescriptor();
      JavaType ret = desc.getReturn();
      boolean match = false;
      String newClassName = this.advisor.newClassNameFor(ret.getType());
      if (newClassName != null) {
        this.oldClassNames.put(newClassName, ret.getType());
        match = true;
        desc.setReturn(new JavaType(newClassName, ret.getDimensionCount()));
      }
     
      List params = desc.getParamList();
      List<JavaType> newParams = new ArrayList<JavaType>();
      for (int i=0; i < params.size(); i++) {
        JavaType param = (JavaType)params.get(i);
        newClassName = this.advisor.newClassNameFor(param.getType());
        if (newClassName != null) {
          this.oldClassNames.put(newClassName, param.getType());
          match = true;
          newParams.add(new JavaType(newClassName, param.getDimensionCount()));
        } else {
          newParams.add(param);
        }
      }
     
      if (match) {
        desc.setParamList(newParams);
        Undoable u = new ModifyNameAndTypeInfoAction(ic.getCf().getPool(), nati, desc);
        if (this.batchMode) {
          u.execute();
        } else {
          SystemFacade.getInstance().performAction(u, ic.getFilename());
        }
      }
    } if(cpi.getType() == ConstantPoolInfo.FIELD_REF) {
      RefInfo ri = (RefInfo)cpi;
      String className = ri.getClassName();
      String newFieldName = this.advisor.newFieldNameFor(className, ri.getTargetName(), ri.getDescriptor());
      if (newFieldName != null) {
        NameAndTypeInfo nati = ri.getNameAndTypeInfo();
       
        Undoable u = new ModifyNameAndTypeInfoAction(ic.getCf().getPool(), nati, newFieldName);
        if (this.batchMode) {
          u.execute();
        } else {
          SystemFacade.getInstance().performAction(u, ic.getFilename());         
        }
      }
    } else if(cpi.getType() == ConstantPoolInfo.METHOD_REF || cpi.getType() == ConstantPoolInfo.INTERFACE_METHOD_REF) {
      RefInfo ri = (RefInfo)cpi;
      String className = ri.getClassName();
      String newMethodName = this.advisor.newMethodNameFor(className, ri.getTargetName(), ri.getDescriptor());
      if (newMethodName != null) {
        NameAndTypeInfo nati = ri.getNameAndTypeInfo();
        Undoable u = new ModifyNameAndTypeInfoAction(ic.getCf().getPool(), nati, newMethodName);
        if (this.batchMode) {
          u.execute();
        } else {
          SystemFacade.getInstance().performAction(u, ic.getFilename());         
View Full Code Here

TOP

Related Classes of net.sf.rej.java.constantpool.NameAndTypeInfo

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.