Methods Summary |
---|
public com.sun.org.apache.bcel.internal.generic.Instruction | LOAD(int slot)
return new ALOAD(slot);
|
public com.sun.org.apache.bcel.internal.generic.Instruction | STORE(int slot)
return new ASTORE(slot);
|
public java.lang.String | getClassName()Returns the class name of an internal type's external representation.
return(STRING_CLASS);
|
public boolean | identicalTo(com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type other)
return this == other;
|
public boolean | isSimple()
return true;
|
public com.sun.org.apache.bcel.internal.generic.Type | toJCType()
return com.sun.org.apache.bcel.internal.generic.Type.STRING;
|
public java.lang.String | toSignature()
return "Ljava/lang/String;";
|
public java.lang.String | toString()
return "string";
|
public void | translateBox(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen)Translates an object of this type to its boxed representation.
translateTo(classGen, methodGen, Type.Reference);
|
public void | translateFrom(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen, java.lang.Class clazz)Translates an external (primitive) Java type into a string.
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
if (clazz.getName().equals("java.lang.String")) {
// same internal representation, convert null to ""
il.append(DUP);
final BranchHandle ifNonNull = il.append(new IFNONNULL(null));
il.append(POP);
il.append(new PUSH(cpg, ""));
ifNonNull.setTarget(il.append(NOP));
}
else {
ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
toString(), clazz.getName());
classGen.getParser().reportError(Constants.FATAL, err);
}
|
public void | translateTo(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.ReferenceType type)Expects a string on the stack and pushes a boxed string.
Strings are already boxed so the translation is just a NOP.
methodGen.getInstructionList().append(NOP);
|
public void | translateTo(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen, java.lang.Class clazz)Translates a internal string into an external (Java) string.
// Is String <: clazz? I.e. clazz in { String, Object }
if (clazz.isAssignableFrom(java.lang.String.class)) {
methodGen.getInstructionList().append(NOP);
}
else {
ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
toString(), clazz.getName());
classGen.getParser().reportError(Constants.FATAL, err);
}
|
public void | translateTo(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type type)Translates a string into an object of internal type type .
The translation to int is undefined since strings are always converted
to reals in arithmetic expressions.
if (type == Type.Boolean) {
translateTo(classGen, methodGen, (BooleanType) type);
}
else if (type == Type.Real) {
translateTo(classGen, methodGen, (RealType) type);
}
else if (type == Type.Reference) {
translateTo(classGen, methodGen, (ReferenceType) type);
}
else if (type == Type.ObjectString) {
// NOP -> same representation
}
else {
ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
toString(), type.toString());
classGen.getParser().reportError(Constants.FATAL, err);
}
|
public void | translateTo(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.BooleanType type)Translates a string into a synthesized boolean.
final InstructionList il = methodGen.getInstructionList();
FlowList falsel = translateToDesynthesized(classGen, methodGen, type);
il.append(ICONST_1);
final BranchHandle truec = il.append(new GOTO(null));
falsel.backPatch(il.append(ICONST_0));
truec.setTarget(il.append(NOP));
|
public void | translateTo(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.RealType type)Translates a string into a real by calling stringToReal() from the
basis library.
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
il.append(new INVOKESTATIC(cpg.addMethodref(BASIS_LIBRARY_CLASS,
STRING_TO_REAL,
STRING_TO_REAL_SIG)));
|
public com.sun.org.apache.xalan.internal.xsltc.compiler.FlowList | translateToDesynthesized(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.BooleanType type)Translates a string into a non-synthesized boolean. It does not push a
0 or a 1 but instead returns branchhandle list to be appended to the
false list.
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
il.append(new INVOKEVIRTUAL(cpg.addMethodref(STRING_CLASS,
"length", "()I")));
return new FlowList(il.append(new IFEQ(null)));
|
public void | translateUnBox(com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator classGen, com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator methodGen)Translates an object of this type to its unboxed representation.
methodGen.getInstructionList().append(NOP);
|