Exemple #1
0
 @Override
 public void visitLiteral(JCLiteral tree) {
   TypeTag typeTag = typeTag(tree);
   if (CTC_INT.equals(typeTag)) print("" + tree.value);
   else if (CTC_LONG.equals(typeTag)) print(tree.value + "L");
   else if (CTC_FLOAT.equals(typeTag)) print(tree.value + "F");
   else if (CTC_DOUBLE.equals(typeTag)) print("" + tree.value);
   else if (CTC_CHAR.equals(typeTag)) {
     print("\'" + quoteChar((char) ((Number) tree.value).intValue()) + "\'");
   } else if (CTC_BOOLEAN.equals(typeTag))
     print(((Number) tree.value).intValue() == 1 ? "true" : "false");
   else if (CTC_BOT.equals(typeTag)) print("null");
   else print("\"" + quoteChars(tree.value.toString()) + "\"");
 }
Exemple #2
0
  @Override
  public void visitTypeIdent(JCPrimitiveTypeTree tree) {
    TypeTag typeTag = typeTag(tree);

    if (CTC_BYTE.equals(typeTag)) print("byte");
    else if (CTC_CHAR.equals(typeTag)) print("char");
    else if (CTC_SHORT.equals(typeTag)) print("short");
    else if (CTC_INT.equals(typeTag)) print("int");
    else if (CTC_LONG.equals(typeTag)) print("long");
    else if (CTC_FLOAT.equals(typeTag)) print("float");
    else if (CTC_DOUBLE.equals(typeTag)) print("double");
    else if (CTC_BOOLEAN.equals(typeTag)) print("boolean");
    else if (CTC_VOID.equals(typeTag)) print("void");
    else print("error");
  }