Skip to content

Commit

Permalink
Remove unused string literal code
Browse files Browse the repository at this point in the history
This code was never used because StringLiteralConcatenation and
ExtendedStringLiteral extend StringLiterals and get handled a few lines
above. We might need to add it back and fix it if we want to copy
annotations like @annotation("a" + "b") without transforming them to
@annotation("ab")
  • Loading branch information
Rawi01 authored and rspilker committed Mar 18, 2024
1 parent 3b20b70 commit 521be03
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions src/core/lombok/eclipse/handlers/EclipseHandlerUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
package lombok.eclipse.handlers;

import static lombok.core.handlers.HandlerUtil.*;
import static lombok.eclipse.Eclipse.*;
import static lombok.eclipse.EcjAugments.*;
import static lombok.eclipse.Eclipse.*;
import static lombok.eclipse.handlers.EclipseHandlerUtil.EclipseReflectiveMembers.*;

import java.lang.reflect.Array;
Expand Down Expand Up @@ -60,7 +60,6 @@
import org.eclipse.jdt.internal.compiler.ast.DoubleLiteral;
import org.eclipse.jdt.internal.compiler.ast.EqualExpression;
import org.eclipse.jdt.internal.compiler.ast.Expression;
import org.eclipse.jdt.internal.compiler.ast.ExtendedStringLiteral;
import org.eclipse.jdt.internal.compiler.ast.FalseLiteral;
import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration;
import org.eclipse.jdt.internal.compiler.ast.FieldReference;
Expand All @@ -86,7 +85,6 @@
import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference;
import org.eclipse.jdt.internal.compiler.ast.Statement;
import org.eclipse.jdt.internal.compiler.ast.StringLiteral;
import org.eclipse.jdt.internal.compiler.ast.StringLiteralConcatenation;
import org.eclipse.jdt.internal.compiler.ast.ThisReference;
import org.eclipse.jdt.internal.compiler.ast.ThrowStatement;
import org.eclipse.jdt.internal.compiler.ast.TrueLiteral;
Expand Down Expand Up @@ -123,6 +121,7 @@
import lombok.core.debug.ProblemReporter;
import lombok.core.handlers.HandlerUtil;
import lombok.core.handlers.HandlerUtil.FieldAccess;
import lombok.core.handlers.HandlerUtil.JavadocTag;
import lombok.eclipse.EcjAugments;
import lombok.eclipse.Eclipse;
import lombok.eclipse.EclipseAST;
Expand Down Expand Up @@ -416,20 +415,6 @@ private static Expression copyAnnotationMemberValue0(Expression in) {
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;
}

// enums and field accesses (as long as those are references to compile time constant literals that's also acceptable)

Expand Down

0 comments on commit 521be03

Please sign in to comment.