bug-jel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-jel] Bug report: void method invocation, Unicode escapes


From: Ito Kazumitsu
Subject: [Bug-jel] Bug report: void method invocation, Unicode escapes
Date: Tue, 16 Mar 2004 12:11:47 +0900
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (Unebigoryomae) APEL/10.3 Emacs/20.7 (i386-msvc-windows98.2222) MULE/4.1 (AOI) Meadow/1.15 (SHOUBU:63)

Thanks for Jel.

And here is my bug report.  My test program is attached below.

Test case 0: evaluate "func(\"Test\\n\")"
Test case 1: evaluate "vfunc(\"Test\\n\")"
Test case 2: evaluate "func(\"\u65e5\u7acb\u96fb\u7dda\\n\")"
Test case 3: evaluate "func(\"\\u65e5\\u7acb\\u96fb\\u7dda\\n\")"

Results:
                         Java VM
Test case     Sun's 1.4.2_04             Kaffe 1.1.4
-----------   ----------------------     ---------------------
       0      PASS                       PASS
       1      VerifyError (*1)           PASS
       2      PASS                       PASS
       3      CompilationException (*2)  CompilationException (*2)

VerifyError (*1)
java.lang.VerifyError: (class: dump, method: evaluate signature: 
([Ljava/lang/Object;)Ljava/lang/Object;) Unable to pop operand off an empty 
stack
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:1610)
        at java.lang.Class.getConstructor0(Class.java:1922)
        at java.lang.Class.newInstance0(Class.java:278)
        at java.lang.Class.newInstance(Class.java:261)
        at gnu.jel.Evaluator.compile(Unknown Source)
        at TestJel.main(TestJel.java:22)

   Seeing this result, I understand that we cannot use a method
   which returns nothing.  But no problem occurs with Kaffe.

CompilationException (*2)
gnu.jel.CompilationException: Encountered unexpected character 'u'.
        at gnu.jel.Parser.consume(Unknown Source)
        at gnu.jel.Parser.parseEscape(Unknown Source)
        at gnu.jel.Parser.parseString(Unknown Source)
        at gnu.jel.Parser.nextToken(Unknown Source)
        at gnu.jel.Parser.invocation(Unknown Source)
        at gnu.jel.Parser.element(Unknown Source)
        at gnu.jel.Parser.unary(Unknown Source)
        at gnu.jel.Parser.binOP(Unknown Source)
        at gnu.jel.Parser.binOP(Unknown Source)
        at gnu.jel.Parser.binOP(Unknown Source)
        at gnu.jel.Parser.binOP(Unknown Source)
        at gnu.jel.Parser.binOP(Unknown Source)
        at gnu.jel.Parser.binOP(Unknown Source)
        at gnu.jel.Parser.binOP(Unknown Source)
        at gnu.jel.Parser.binOP(Unknown Source)
        at gnu.jel.Parser.binOP(Unknown Source)
        at gnu.jel.Parser.binOP(Unknown Source)
        at gnu.jel.Parser.conditional(Unknown Source)
        at gnu.jel.Parser.expression(Unknown Source)
        at gnu.jel.Parser.parse(Unknown Source)
        at gnu.jel.Evaluator.parse(Unknown Source)
        at gnu.jel.Evaluator.compileBits(Unknown Source)
        at gnu.jel.Evaluator.compile(Unknown Source)
        at TestJel.main(TestJel.java:22)

    Seeing this result, I understand that we cannot use Unicode escapes
    in the expression to be compiled.  Since test case 2 shows a good
    result,  I do not think this is a big problem.

Test program:

import gnu.jel.*;

public class TestJel {
    
    private static String[] exprs = new String[] {
        "func(\"Test\\n\")",
        "vfunc(\"Test\\n\")",
        "func(\"\u65e5\u7acb\u96fb\u7dda\\n\")",
        "func(\"\\u65e5\\u7acb\\u96fb\\u7dda\\n\")"
    };

    public static void main(String[] args) {
        String expr = exprs[Integer.parseInt(args[0])];
        String outenc = args[1];
        Test1 t = new Test1(outenc);
        try {
            Class[] dynamicLib=new Class[1];
            Object[] context=new Object[1];
            dynamicLib[0] = t.getClass();
            context[0] = t;
            Library lib = new Library(null, dynamicLib, null, null, null);
            CompiledExpression ce = Evaluator.compile(expr, lib, null);
            ce.evaluate(context);
        }
        catch (Throwable e) {
            e.printStackTrace();
        }
    }

    public static class Test1 {

        private String outenc;

        public Test1(String outenc) {
            this.outenc = outenc;
        }
        public boolean func(String s) throws Exception {
            System.out.write(s.getBytes(outenc));
            return true;
        }
        public void vfunc(String s) throws Exception {
            System.out.write(s.getBytes(outenc));
        }

    }

}




reply via email to

[Prev in Thread] Current Thread [Next in Thread]