diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-03-27 22:04:43 +0200 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2018-03-27 22:04:43 +0200 |
commit | 01bbd212e943c726049ad3d837d7a876f02e08d3 (patch) | |
tree | 7bc8b628b34490cdf0ad188a5636ba0067f89364 /src/core/lombok/javac/handlers/HandleData.java | |
parent | 3deb393911583aee8fcdd790bdb51b72737fe410 (diff) | |
download | lombok-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/HandleData.java')
-rw-r--r-- | src/core/lombok/javac/handlers/HandleData.java | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/core/lombok/javac/handlers/HandleData.java b/src/core/lombok/javac/handlers/HandleData.java index 9ecf8754..15f1fd83 100644 --- a/src/core/lombok/javac/handlers/HandleData.java +++ b/src/core/lombok/javac/handlers/HandleData.java @@ -40,6 +40,12 @@ import com.sun.tools.javac.tree.JCTree.JCAnnotation; */ @ProviderFor(JavacAnnotationHandler.class) public class HandleData extends JavacAnnotationHandler<Data> { + private HandleConstructor handleConstructor = new HandleConstructor(); + private HandleGetter handleGetter = new HandleGetter(); + private HandleSetter handleSetter = new HandleSetter(); + private HandleEqualsAndHashCode handleEqualsAndHashCode = new HandleEqualsAndHashCode(); + private HandleToString handleToString = new HandleToString(); + @Override public void handle(AnnotationValues<Data> annotation, JCAnnotation ast, JavacNode annotationNode) { handleFlagUsage(annotationNode, ConfigurationKeys.DATA_FLAG_USAGE, "@Data"); @@ -54,11 +60,10 @@ public class HandleData extends JavacAnnotationHandler<Data> { String staticConstructorName = annotation.getInstance().staticConstructor(); - // TODO move this to the end OR move it to the top in eclipse. - new HandleConstructor().generateRequiredArgsConstructor(typeNode, AccessLevel.PUBLIC, staticConstructorName, SkipIfConstructorExists.YES, annotationNode); - new HandleGetter().generateGetterForType(typeNode, annotationNode, AccessLevel.PUBLIC, true); - new HandleSetter().generateSetterForType(typeNode, annotationNode, AccessLevel.PUBLIC, true); - new HandleEqualsAndHashCode().generateEqualsAndHashCodeForType(typeNode, annotationNode); - new HandleToString().generateToStringForType(typeNode, annotationNode); + handleConstructor.generateRequiredArgsConstructor(typeNode, AccessLevel.PUBLIC, staticConstructorName, SkipIfConstructorExists.YES, annotationNode); + handleGetter.generateGetterForType(typeNode, annotationNode, AccessLevel.PUBLIC, true); + handleSetter.generateSetterForType(typeNode, annotationNode, AccessLevel.PUBLIC, true); + handleEqualsAndHashCode.generateEqualsAndHashCodeForType(typeNode, annotationNode); + handleToString.generateToStringForType(typeNode, annotationNode); } } |