use of org.eclipse.jdt.internal.compiler.ast.CharLiteral in project lombok by rzwitserloot.
the class HandleConstructor method getDefaultExpr.
private static Expression getDefaultExpr(TypeReference type, int s, int e) {
boolean array = type instanceof ArrayTypeReference;
if (array)
return new NullLiteral(s, e);
char[] lastToken = type.getLastToken();
if (Arrays.equals(TypeConstants.BOOLEAN, lastToken))
return new FalseLiteral(s, e);
if (Arrays.equals(TypeConstants.CHAR, lastToken))
return new CharLiteral(new char[] { '\'', '\\', '0', '\'' }, s, e);
if (Arrays.equals(TypeConstants.BYTE, lastToken) || Arrays.equals(TypeConstants.SHORT, lastToken) || Arrays.equals(TypeConstants.INT, lastToken))
return IntLiteral.buildIntLiteral(new char[] { '0' }, s, e);
if (Arrays.equals(TypeConstants.LONG, lastToken))
return LongLiteral.buildLongLiteral(new char[] { '0', 'L' }, s, e);
if (Arrays.equals(TypeConstants.FLOAT, lastToken))
return new FloatLiteral(new char[] { '0', 'F' }, s, e);
if (Arrays.equals(TypeConstants.DOUBLE, lastToken))
return new DoubleLiteral(new char[] { '0', 'D' }, s, e);
return new NullLiteral(s, e);
}
Aggregations