aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2021-03-04 22:15:49 +0100
committerGitHub <noreply@github.com>2021-03-04 22:15:49 +0100
commita7e9e8af49c61d2e9929ef9c807f18aa0d6d6c31 (patch)
treee6713dd9695ac67fe6af2c4ee80c589244d75ea3 /src/core/lombok
parente959e8882c11349fb87cea3a134de263249d7b21 (diff)
parent4a2e117e86479c07a23efc4b81615a9e266a95d1 (diff)
downloadlombok-a7e9e8af49c61d2e9929ef9c807f18aa0d6d6c31.tar.gz
lombok-a7e9e8af49c61d2e9929ef9c807f18aa0d6d6c31.tar.bz2
lombok-a7e9e8af49c61d2e9929ef9c807f18aa0d6d6c31.zip
Merge pull request #2762 from Rawi01/utility-class-rename
Mark generated UtilityClass constructor as generated
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/eclipse/handlers/HandleUtilityClass.java19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/core/lombok/eclipse/handlers/HandleUtilityClass.java b/src/core/lombok/eclipse/handlers/HandleUtilityClass.java
index 2349f839..5e7d2853 100644
--- a/src/core/lombok/eclipse/handlers/HandleUtilityClass.java
+++ b/src/core/lombok/eclipse/handlers/HandleUtilityClass.java
@@ -25,8 +25,6 @@ import static lombok.core.handlers.HandlerUtil.*;
import static lombok.eclipse.Eclipse.*;
import static lombok.eclipse.handlers.EclipseHandlerUtil.*;
-import java.util.Arrays;
-
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
import org.eclipse.jdt.internal.compiler.ast.AllocationExpression;
@@ -158,37 +156,28 @@ public class HandleUtilityClass extends EclipseAnnotationHandler<UtilityClass> {
ASTNode source = sourceNode.get();
TypeDeclaration typeDeclaration = ((TypeDeclaration) typeNode.get());
- long p = (long) source.sourceStart << 32 | source.sourceEnd;
ConstructorDeclaration constructor = new ConstructorDeclaration(((CompilationUnitDeclaration) typeNode.top().get()).compilationResult);
constructor.modifiers = ClassFileConstants.AccPrivate;
constructor.selector = typeDeclaration.name;
constructor.constructorCall = new ExplicitConstructorCall(ExplicitConstructorCall.ImplicitSuper);
- constructor.constructorCall.sourceStart = source.sourceStart;
- constructor.constructorCall.sourceEnd = source.sourceEnd;
constructor.thrownExceptions = null;
constructor.typeParameters = null;
constructor.bits |= ECLIPSE_DO_NOT_TOUCH_FLAG;
- constructor.bodyStart = constructor.declarationSourceStart = constructor.sourceStart = source.sourceStart;
- constructor.bodyEnd = constructor.declarationSourceEnd = constructor.sourceEnd = source.sourceEnd;
constructor.arguments = null;
- AllocationExpression exception = new AllocationExpression();
- setGeneratedBy(exception, source);
long[] ps = new long[JAVA_LANG_UNSUPPORTED_OPERATION_EXCEPTION.length];
- Arrays.fill(ps, p);
+ AllocationExpression exception = new AllocationExpression();
exception.type = new QualifiedTypeReference(JAVA_LANG_UNSUPPORTED_OPERATION_EXCEPTION, ps);
- setGeneratedBy(exception.type, source);
exception.arguments = new Expression[] {
- new StringLiteral(UNSUPPORTED_MESSAGE, source.sourceStart, source.sourceEnd, 0)
+ new StringLiteral(UNSUPPORTED_MESSAGE, 0, 0, 0)
};
- setGeneratedBy(exception.arguments[0], source);
- ThrowStatement throwStatement = new ThrowStatement(exception, source.sourceStart, source.sourceEnd);
- setGeneratedBy(throwStatement, source);
+ ThrowStatement throwStatement = new ThrowStatement(exception, 0, 0);
constructor.statements = new Statement[] {throwStatement};
+ constructor.traverse(new SetGeneratedByVisitor(source), typeDeclaration.scope);
injectMethod(typeNode, constructor);
}
}