Package net.sf.rej.java

Examples of net.sf.rej.java.JavaType


   * @return A String with the class names edited to reflect the
   *         imports.
   */
    public String getFieldString(Imports imports, Descriptor desc, String className, String fieldName) {
        StringBuffer sb = new StringBuffer();
        JavaType ret = desc.getReturn();
        if (ret.isPrimitive()) {
            sb.append(ret);
        } else {
            sb.append(imports.getShortName(ret.getType()));
            sb.append(ret.getDimensions());
        }
        sb.append(" ");
        sb.append(imports.getShortName(className));
        sb.append(".");
        sb.append(fieldName);
View Full Code Here


  }
 
  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
        JavaType ret = this.lv.getDescriptor().getReturn();
        sb.append("        ");
        sb.append(ret.getType());
        sb.append(ret.getDimensions() + " " + lv.getName() + " (#" + lv.getIndex() + " " + lv.getStartPc() + " - " + lv.getEndPc() + ")");
       
        return sb.toString();
  }
View Full Code Here

    newFileName = newFileName + newClassPart + ".class";
    return newFileName;
  }
 
  private void processDescriptor(IterationContext ic, Descriptor desc, DescriptorEnabled descEnabled) {
    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);
      }
    }
   
View Full Code Here

   
  @Override
  public void processConstantPoolInfo(IterationContext ic, ConstantPoolInfo cpi) {
    if(cpi.getType() == ConstantPoolInfo.CLASS) {
      ClassInfo ci = (ClassInfo)cpi;
      JavaType jt = new JavaType(ci.getName());
      String newClassName = this.advisor.newClassNameFor(jt.getType());
      if(newClassName != null) {
        this.oldClassNames.put(newClassName, jt.getType());
        Undoable u = new ModifyClassInfoAction(ic.getCf().getPool(), ci, newClassName + jt.getDimensions());
        if (this.batchMode) {
          u.execute();
        } 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);
        }
      }
     
View Full Code Here

  @Override
  public List<StackElement> getPushedElements(DecompilationContext dc) {
    List<StackElement> elements = new ArrayList<StackElement>();
    RefInfo ri = (RefInfo) dc.getConstantPool().get(this.index);
    Descriptor desc = ri.getDescriptor();
    JavaType jt = desc.getReturn();
    if (jt.getDimensionCount() > 0 || (!jt.isPrimitive())) {
      // array or primitive are both refs
      elements.add(new StackElement("result", StackElementType.REF));
    } else {
      // primitive non-array
      if (jt.getType().equals("long")) {
        elements.add(new StackElement("result", StackElementType.LONG));       
      } else if (jt.getType().equals("float")) {
        elements.add(new StackElement("result", StackElementType.FLOAT));
      } else if (jt.getType().equals("double")) {
        elements.add(new StackElement("result", StackElementType.DOUBLE));
      } else if (jt.getType().equals("void")) {
        // void, nothing is put on stack
      } else {
        // boolean, byte, short, char and int are all of type int
        elements.add(new StackElement("result", StackElementType.INT));
      }
View Full Code Here

  @Override
  public List<StackElement> getPushedElements(DecompilationContext dc) {
    List<StackElement> elements = new ArrayList<StackElement>();
    RefInfo ri = (RefInfo) dc.getConstantPool().get(this.index);
    Descriptor desc = ri.getDescriptor();
    JavaType jt = desc.getReturn();
    if (jt.getDimensionCount() > 0 || (!jt.isPrimitive())) {
      // array or primitive are both refs
      elements.add(new StackElement("result", StackElementType.REF));
    } else {
      // primitive non-array
      if (jt.getType().equals("long")) {
        elements.add(new StackElement("result", StackElementType.LONG));       
      } else if (jt.getType().equals("float")) {
        elements.add(new StackElement("result", StackElementType.FLOAT));
      } else if (jt.getType().equals("double")) {
        elements.add(new StackElement("result", StackElementType.DOUBLE));
      } else if (jt.getType().equals("void")) {
        // void, nothing is put on stack
      } else {
        // boolean, byte, short, char and int are all of type int
        elements.add(new StackElement("result", StackElementType.INT));
      }
View Full Code Here

  public List<StackElement> getPoppedElements(DecompilationContext dc) {
    List<StackElement> elements = new ArrayList<StackElement>();
    elements.add(new StackElement("objectref", StackElementType.REF));
    RefInfo ri = (RefInfo) dc.getConstantPool().get(this.index);
    Descriptor desc = ri.getDescriptor();
    JavaType jt = desc.getReturn();
    if (jt.getDimensionCount() > 0 || (!jt.isPrimitive())) {
      // array or primitive are both refs
      elements.add(new StackElement("value", StackElementType.REF));
    } else {
      // primitive non-array
      if (jt.getType().equals("long")) {
        elements.add(new StackElement("value", StackElementType.LONG));       
      } else if (jt.getType().equals("float")) {
        elements.add(new StackElement("value", StackElementType.FLOAT));
      } else if (jt.getType().equals("double")) {
        elements.add(new StackElement("value", StackElementType.DOUBLE));
      } else {
        // boolean, byte, short, char and int are all of type int
        elements.add(new StackElement("value", StackElementType.INT));
      }
View Full Code Here

  @Override
  public List<StackElement> getPushedElements(DecompilationContext dc) {
    List<StackElement> elements = new ArrayList<StackElement>();
    RefInfo ri = (RefInfo) dc.getConstantPool().get(this.index);
    Descriptor desc = ri.getDescriptor();
    JavaType jt = desc.getReturn();
    if (jt.getDimensionCount() > 0 || (!jt.isPrimitive())) {
      // array or primitive are both refs
      elements.add(new StackElement("result", StackElementType.REF));
    } else {
      // primitive non-array
      if (jt.getType().equals("long")) {
        elements.add(new StackElement("result", StackElementType.LONG));       
      } else if (jt.getType().equals("float")) {
        elements.add(new StackElement("result", StackElementType.FLOAT));
      } else if (jt.getType().equals("double")) {
        elements.add(new StackElement("result", StackElementType.DOUBLE));
      } else if (jt.getType().equals("void")) {
        // void, nothing is put on stack
      } else {
        // boolean, byte, short, char and int are all of type int
        elements.add(new StackElement("result", StackElementType.INT));
      }
View Full Code Here

  @Override
  public List<StackElement> getPushedElements(DecompilationContext dc) {
    List<StackElement> elements = new ArrayList<StackElement>();
    RefInfo ri = (RefInfo) dc.getConstantPool().get(this.index);
    Descriptor desc = ri.getDescriptor();
    JavaType jt = desc.getReturn();
    if (jt.getDimensionCount() > 0 || (!jt.isPrimitive())) {
      // array or primitive are both refs
      elements.add(new StackElement("result", StackElementType.REF));
    } else {
      // primitive non-array
      if (jt.getType().equals("long")) {
        elements.add(new StackElement("result", StackElementType.LONG));       
      } else if (jt.getType().equals("float")) {
        elements.add(new StackElement("result", StackElementType.FLOAT));
      } else if (jt.getType().equals("double")) {
        elements.add(new StackElement("result", StackElementType.DOUBLE));
      } else if (jt.getType().equals("void")) {
        // void, nothing is put on stack
      } else {
        // boolean, byte, short, char and int are all of type int
        elements.add(new StackElement("result", StackElementType.INT));
      }
View Full Code Here

  @Override
  public List<StackElement> getPushedElements(DecompilationContext dc) {
    List<StackElement> elements = new ArrayList<StackElement>();
    RefInfo ri = (RefInfo) dc.getConstantPool().get(this.index);
    Descriptor desc = ri.getDescriptor();
    JavaType jt = desc.getReturn();
    if (jt.getDimensionCount() > 0 || (!jt.isPrimitive())) {
      // array or primitive are both refs
      elements.add(new StackElement("result", StackElementType.REF));
    } else {
      // primitive non-array
      if (jt.getType().equals("long")) {
        elements.add(new StackElement("result", StackElementType.LONG));       
      } else if (jt.getType().equals("float")) {
        elements.add(new StackElement("result", StackElementType.FLOAT));
      } else if (jt.getType().equals("double")) {
        elements.add(new StackElement("result", StackElementType.DOUBLE));
      } else {
        // boolean, byte, short, char and int are all of type int
        elements.add(new StackElement("result", StackElementType.INT));
      }
View Full Code Here

TOP

Related Classes of net.sf.rej.java.JavaType

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.