use of org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral in project lombok by rzwitserloot.
the class EclipseHandlerUtil method copyAnnotationMemberValue0.
private static Expression copyAnnotationMemberValue0(Expression in) {
int s = in.sourceStart, e = in.sourceEnd;
if (in instanceof FalseLiteral)
return new FalseLiteral(s, e);
if (in instanceof TrueLiteral)
return new TrueLiteral(s, e);
if (in instanceof NullLiteral)
return new NullLiteral(s, e);
if (in instanceof CharLiteral)
return new CharLiteral(((Literal) in).source(), s, e);
if (in instanceof DoubleLiteral)
return new DoubleLiteral(((Literal) in).source(), s, e);
if (in instanceof FloatLiteral)
return new FloatLiteral(((Literal) in).source(), s, e);
if (in instanceof IntLiteral)
return IntLiteral.buildIntLiteral(((Literal) in).source(), s, e);
if (in instanceof LongLiteral)
return LongLiteral.buildLongLiteral(((Literal) in).source(), s, e);
if (in instanceof StringLiteral)
return new StringLiteral(((Literal) in).source(), s, e, reflectInt(STRING_LITERAL__LINE_NUMBER, in) + 1);
if (in instanceof ExtendedStringLiteral) {
StringLiteral str = new StringLiteral(((Literal) in).source(), s, e, reflectInt(STRING_LITERAL__LINE_NUMBER, in) + 1);
StringLiteral empty = new StringLiteral(new char[0], s, e, reflectInt(STRING_LITERAL__LINE_NUMBER, in) + 1);
return new ExtendedStringLiteral(str, empty);
}
if (in instanceof StringLiteralConcatenation) {
Expression[] literals = ((StringLiteralConcatenation) in).literals;
// 0 and 1 len shouldn't happen.
if (literals.length == 0)
return new StringLiteral(new char[0], s, e, 0);
if (literals.length == 1)
return copyAnnotationMemberValue0(literals[0]);
StringLiteralConcatenation c = new StringLiteralConcatenation((StringLiteral) literals[0], (StringLiteral) literals[1]);
for (int i = 2; i < literals.length; i++) c = c.extendsWith((StringLiteral) literals[i]);
return c;
}
if (in instanceof SingleNameReference) {
SingleNameReference snr = (SingleNameReference) in;
return new SingleNameReference(snr.token, pos(in));
}
if (in instanceof QualifiedNameReference) {
QualifiedNameReference qnr = (QualifiedNameReference) in;
return new QualifiedNameReference(qnr.tokens, poss(in, qnr.tokens.length), s, e);
}
// class refs
if (in instanceof ClassLiteralAccess)
return new ClassLiteralAccess(e, copyType(((ClassLiteralAccess) in).type));
// arrays
if (in instanceof ArrayInitializer) {
ArrayInitializer out = new ArrayInitializer();
out.sourceStart = s;
out.sourceEnd = e;
out.bits = in.bits;
out.implicitConversion = in.implicitConversion;
out.statementEnd = e;
Expression[] exprs = ((ArrayInitializer) in).expressions;
if (exprs != null) {
Expression[] copy = new Expression[exprs.length];
for (int i = 0; i < exprs.length; i++) copy[i] = copyAnnotationMemberValue(exprs[i]);
out.expressions = copy;
}
return out;
}
if (in instanceof BinaryExpression) {
BinaryExpression be = (BinaryExpression) in;
BinaryExpression out = new BinaryExpression(be);
out.left = copyAnnotationMemberValue(be.left);
out.right = copyAnnotationMemberValue(be.right);
out.sourceStart = s;
out.sourceEnd = e;
out.statementEnd = e;
return out;
}
return in;
}
use of org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral in project lombok by projectlombok.
the class EclipseHandlerUtil method copyAnnotationMemberValue0.
private static Expression copyAnnotationMemberValue0(Expression in) {
int s = in.sourceStart, e = in.sourceEnd;
if (in instanceof FalseLiteral)
return new FalseLiteral(s, e);
if (in instanceof TrueLiteral)
return new TrueLiteral(s, e);
if (in instanceof NullLiteral)
return new NullLiteral(s, e);
if (in instanceof CharLiteral)
return new CharLiteral(((Literal) in).source(), s, e);
if (in instanceof DoubleLiteral)
return new DoubleLiteral(((Literal) in).source(), s, e);
if (in instanceof FloatLiteral)
return new FloatLiteral(((Literal) in).source(), s, e);
if (in instanceof IntLiteral)
return IntLiteral.buildIntLiteral(((Literal) in).source(), s, e);
if (in instanceof LongLiteral)
return LongLiteral.buildLongLiteral(((Literal) in).source(), s, e);
if (in instanceof StringLiteral)
return new StringLiteral(((Literal) in).source(), s, e, reflectInt(STRING_LITERAL__LINE_NUMBER, in) + 1);
if (in instanceof ExtendedStringLiteral) {
StringLiteral str = new StringLiteral(((Literal) in).source(), s, e, reflectInt(STRING_LITERAL__LINE_NUMBER, in) + 1);
StringLiteral empty = new StringLiteral(new char[0], s, e, reflectInt(STRING_LITERAL__LINE_NUMBER, in) + 1);
return new ExtendedStringLiteral(str, empty);
}
if (in instanceof StringLiteralConcatenation) {
Expression[] literals = ((StringLiteralConcatenation) in).literals;
// 0 and 1 len shouldn't happen.
if (literals.length == 0)
return new StringLiteral(new char[0], s, e, 0);
if (literals.length == 1)
return copyAnnotationMemberValue0(literals[0]);
StringLiteralConcatenation c = new StringLiteralConcatenation((StringLiteral) literals[0], (StringLiteral) literals[1]);
for (int i = 2; i < literals.length; i++) c = c.extendsWith((StringLiteral) literals[i]);
return c;
}
if (in instanceof SingleNameReference) {
SingleNameReference snr = (SingleNameReference) in;
return new SingleNameReference(snr.token, pos(in));
}
if (in instanceof QualifiedNameReference) {
QualifiedNameReference qnr = (QualifiedNameReference) in;
return new QualifiedNameReference(qnr.tokens, poss(in, qnr.tokens.length), s, e);
}
// class refs
if (in instanceof ClassLiteralAccess)
return new ClassLiteralAccess(e, copyType(((ClassLiteralAccess) in).type));
// arrays
if (in instanceof ArrayInitializer) {
ArrayInitializer out = new ArrayInitializer();
out.sourceStart = s;
out.sourceEnd = e;
out.bits = in.bits;
out.implicitConversion = in.implicitConversion;
out.statementEnd = e;
Expression[] exprs = ((ArrayInitializer) in).expressions;
if (exprs != null) {
Expression[] copy = new Expression[exprs.length];
for (int i = 0; i < exprs.length; i++) copy[i] = copyAnnotationMemberValue(exprs[i]);
out.expressions = copy;
}
return out;
}
if (in instanceof BinaryExpression) {
BinaryExpression be = (BinaryExpression) in;
BinaryExpression out = new BinaryExpression(be);
out.left = copyAnnotationMemberValue(be.left);
out.right = copyAnnotationMemberValue(be.right);
out.sourceStart = s;
out.sourceEnd = e;
out.statementEnd = e;
return out;
}
return in;
}
Aggregations