예제 #1
0
 static {
   map.put(Tree.Kind.BOOLEAN_LITERAL, Boolean.class);
   map.put(Tree.Kind.CHAR_LITERAL, Character.class);
   map.put(Tree.Kind.STRING_LITERAL, String.class);
   map.put(Tree.Kind.INT_LITERAL, Integer.class);
   map.put(Tree.Kind.LONG_LITERAL, Long.class);
   map.put(Tree.Kind.FLOAT_LITERAL, Float.class);
   map.put(Tree.Kind.DOUBLE_LITERAL, Double.class);
 }
예제 #2
0
 public Void visitLiteral(LiteralTree tree, Void ignore) {
   System.err.println(tree);
   Class expect = map.get(tree.getKind());
   if (!check(tree.getValue(), expect)) {
     System.err.println("tree: " + tree);
     System.err.println("expected class: " + expect);
     if (tree.getValue() != null)
       System.err.println("actual class: " + tree.getValue().getClass());
     throw new AssertionError("unexpected value for literal");
   }
   return null;
 }