aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok/javac/handlers/HandleValue.java
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2018-03-27 22:04:43 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2018-03-27 22:04:43 +0200
commit01bbd212e943c726049ad3d837d7a876f02e08d3 (patch)
tree7bc8b628b34490cdf0ad188a5636ba0067f89364 /src/core/lombok/javac/handlers/HandleValue.java
parent3deb393911583aee8fcdd790bdb51b72737fe410 (diff)
downloadlombok-01bbd212e943c726049ad3d837d7a876f02e08d3.tar.gz
lombok-01bbd212e943c726049ad3d837d7a876f02e08d3.tar.bz2
lombok-01bbd212e943c726049ad3d837d7a876f02e08d3.zip
[trivial] some memoryload improvements by not making a new instance but using a cached one instead. Fixes issue #1579
Diffstat (limited to 'src/core/lombok/javac/handlers/HandleValue.java')
-rw-r--r--src/core/lombok/javac/handlers/HandleValue.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/core/lombok/javac/handlers/HandleValue.java b/src/core/lombok/javac/handlers/HandleValue.java
index 3961085c..d1af4168 100644
--- a/src/core/lombok/javac/handlers/HandleValue.java
+++ b/src/core/lombok/javac/handlers/HandleValue.java
@@ -47,6 +47,12 @@ import com.sun.tools.javac.tree.JCTree.JCModifiers;
@ProviderFor(JavacAnnotationHandler.class)
@HandlerPriority(-512) //-2^9; to ensure @EqualsAndHashCode and such pick up on this handler making the class final and messing with the fields' access levels, run earlier.
public class HandleValue extends JavacAnnotationHandler<Value> {
+ private HandleFieldDefaults handleFieldDefaults = new HandleFieldDefaults();
+ private HandleConstructor handleConstructor = new HandleConstructor();
+ private HandleGetter handleGetter = new HandleGetter();
+ private HandleEqualsAndHashCode handleEqualsAndHashCode = new HandleEqualsAndHashCode();
+ private HandleToString handleToString = new HandleToString();
+
@Override public void handle(AnnotationValues<Value> annotation, JCAnnotation ast, JavacNode annotationNode) {
handleFlagUsage(annotationNode, ConfigurationKeys.VALUE_FLAG_USAGE, "@Value");
@@ -68,12 +74,10 @@ public class HandleValue extends JavacAnnotationHandler<Value> {
typeNode.rebuild();
}
}
- new HandleFieldDefaults().generateFieldDefaultsForType(typeNode, annotationNode, AccessLevel.PRIVATE, true, true);
-
- // TODO move this to the end OR move it to the top in eclipse.
- new HandleConstructor().generateAllArgsConstructor(typeNode, AccessLevel.PUBLIC, staticConstructorName, SkipIfConstructorExists.YES, annotationNode);
- new HandleGetter().generateGetterForType(typeNode, annotationNode, AccessLevel.PUBLIC, true);
- new HandleEqualsAndHashCode().generateEqualsAndHashCodeForType(typeNode, annotationNode);
- new HandleToString().generateToStringForType(typeNode, annotationNode);
+ handleFieldDefaults.generateFieldDefaultsForType(typeNode, annotationNode, AccessLevel.PRIVATE, true, true);
+ handleConstructor.generateAllArgsConstructor(typeNode, AccessLevel.PUBLIC, staticConstructorName, SkipIfConstructorExists.YES, annotationNode);
+ handleGetter.generateGetterForType(typeNode, annotationNode, AccessLevel.PUBLIC, true);
+ handleEqualsAndHashCode.generateEqualsAndHashCodeForType(typeNode, annotationNode);
+ handleToString.generateToStringForType(typeNode, annotationNode);
}
}