« Return to Thread: [janino-dev] [jira] Created: (JANINO-117) UnparseVisitor does not handle Byte or Short Literals

[janino-dev] [jira] Created: (JANINO-117) UnparseVisitor does not handle Byte or Short Literals

by JIRA jira@codehaus.org :: Rate this Message:

Reply to Author | View in Thread

UnparseVisitor does not handle Byte or Short Literals
-----------------------------------------------------

                 Key: JANINO-117
                 URL: http://jira.codehaus.org/browse/JANINO-117
             Project: Janino
          Issue Type: Bug
            Reporter: Matt Fowles
            Assignee: Arno Unkrig
         Attachments: literals.diff

The following test will fail with a RuntimeException.  While parsed java cannot create a literal Byte or Short value, it is fairly easy to create them directly from the AST, and handling them is quite simple.

{code}
    public void testLiterals() throws Exception {
        Object[][] tests = new Object[][] {
                { new Java.Literal(null, new Short((short)1)), "((short)1)" },
                { new Java.Literal(null, new Byte((byte)1)),   "((byte)1)"  },
        };
        for(int i = 0; i < tests.length; ++i) {
            Atom expr = (Atom) tests[i][0];
            String expected = (String) tests[i][1];
           
            StringWriter sw = new StringWriter();
            UnparseVisitor uv = new UnparseVisitor(sw);
            expr.accept(uv);
            Assert.assertEquals(expected, sw.toString());
        }
    }
{code}

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: [janino-dev] [jira] Created: (JANINO-117) UnparseVisitor does not handle Byte or Short Literals