aboutsummaryrefslogtreecommitdiff
path: root/src/core/lombok
diff options
context:
space:
mode:
authorRoland Praml <praml@foconis.de>2018-07-08 16:54:20 +0200
committerRoel Spilker <r.spilker@gmail.com>2018-08-20 20:46:31 +0200
commitd2ec0e7bdd8faea3ad5553a276299573fb52ff78 (patch)
treeeb7b1f1f7921856c0afac67ebfb9f3f43756bb7b /src/core/lombok
parent8151e710fc9add7232f2828bc069077d6eb1c457 (diff)
downloadlombok-d2ec0e7bdd8faea3ad5553a276299573fb52ff78.tar.gz
lombok-d2ec0e7bdd8faea3ad5553a276299573fb52ff78.tar.bz2
lombok-d2ec0e7bdd8faea3ad5553a276299573fb52ff78.zip
replace Collection<FieldAccess> by FieldAccess[] array (saves iterator instance)
Diffstat (limited to 'src/core/lombok')
-rw-r--r--src/core/lombok/core/AST.java12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/lombok/core/AST.java b/src/core/lombok/core/AST.java
index 1142018f..fe7a4330 100644
--- a/src/core/lombok/core/AST.java
+++ b/src/core/lombok/core/AST.java
@@ -216,19 +216,19 @@ public abstract class AST<A extends AST<A, L, N>, L extends LombokNode<A, L, N>,
}
}
- private static final ConcurrentMap<Class<?>, Collection<FieldAccess>> fieldsOfASTClasses = new ConcurrentHashMap<Class<?>, Collection<FieldAccess>>();
+ private static final ConcurrentMap<Class<?>, FieldAccess[]> fieldsOfASTClasses = new ConcurrentHashMap<Class<?>, FieldAccess[]>();
/** Returns FieldAccess objects for the stated class. Each field that contains objects of the kind returned by
* {@link #getStatementTypes()}, either directly or inside of an array or java.util.collection (or array-of-arrays,
* or collection-of-collections, et cetera), is returned.
*/
- protected Collection<FieldAccess> fieldsOf(Class<?> c) {
- Collection<FieldAccess> fields = fieldsOfASTClasses.get(c);
+ protected FieldAccess[] fieldsOf(Class<?> c) {
+ FieldAccess[] fields = fieldsOfASTClasses.get(c);
if (fields != null) return fields;
- fields = new ArrayList<FieldAccess>();
- getFields(c, fields);
- fieldsOfASTClasses.putIfAbsent(c, fields);
+ List<FieldAccess> fieldList = new ArrayList<FieldAccess>();
+ getFields(c, fieldList);
+ fieldsOfASTClasses.putIfAbsent(c, fieldList.toArray(new FieldAccess[fieldList.size()]));
return fieldsOfASTClasses.get(c);
}