santiagopg 2003/03/18 10:33:57
Modified: java/src/org/apache/xalan/xsltc/compiler/util VoidType.java
Log:
Override definition of Type.POP() in VoidType to return NOP instead of POP.
If type is void, there's nothing to be popped. This problem shows up when
invoking an external Java function whose return type is void.
Revision Changes Path
1.6 +9 -4
xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/VoidType.java
Index: VoidType.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/VoidType.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- VoidType.java 30 Jan 2003 18:46:09 -0000 1.5
+++ VoidType.java 18 Mar 2003 18:33:57 -0000 1.6
@@ -63,6 +63,7 @@
package org.apache.xalan.xsltc.compiler.util;
+import org.apache.bcel.generic.Instruction;
import org.apache.bcel.generic.InstructionList;
import org.apache.bcel.generic.PUSH;
import org.apache.xalan.xsltc.compiler.Constants;
@@ -86,6 +87,10 @@
return null; // should never be called
}
+ public Instruction POP() {
+ return NOP;
+ }
+
/**
* Translates a void into an object of internal type <code>type</code>.
* This translation is needed when calling external functions
@@ -93,7 +98,7 @@
*
* @see org.apache.xalan.xsltc.compiler.util.Type#translateTo
*/
- public void translateTo(ClassGenerator classGen, MethodGenerator
methodGen,
+ public void translateTo(ClassGenerator classGen, MethodGenerator
methodGen,
Type type) {
if (type == Type.String) {
translateTo(classGen, methodGen, (StringType) type);
@@ -110,7 +115,7 @@
*
* @see org.apache.xalan.xsltc.compiler.util.Type#translateTo
*/
- public void translateTo(ClassGenerator classGen, MethodGenerator
methodGen,
+ public void translateTo(ClassGenerator classGen, MethodGenerator
methodGen,
StringType type) {
final InstructionList il = methodGen.getInstructionList();
il.append(new PUSH(classGen.getConstantPool(), ""));
@@ -120,7 +125,7 @@
* Translates an external (primitive) Java type into a void.
* Only an external "void" can be converted to this class.
*/
- public void translateFrom(ClassGenerator classGen, MethodGenerator
methodGen,
+ public void translateFrom(ClassGenerator classGen, MethodGenerator
methodGen,
Class clazz) {
if (!clazz.getName().equals("void")) {
ErrorMsg err = new ErrorMsg(ErrorMsg.DATA_CONVERSION_ERR,
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]