@@ -91,7 +91,6 @@ public class TypeFactory {
9191 private final TypeUtils typeUtils ;
9292 private final FormattingMessager messager ;
9393 private final RoundContext roundContext ;
94- private final VersionInformation versionInformation ;
9594
9695 private final TypeMirror iterableType ;
9796 private final TypeMirror collectionType ;
@@ -111,7 +110,6 @@ public TypeFactory(ElementUtils elementUtils, TypeUtils typeUtils, FormattingMes
111110 this .typeUtils = typeUtils ;
112111 this .messager = messager ;
113112 this .roundContext = roundContext ;
114- this .versionInformation = versionInformation ;
115113 this .notToBeImportedTypes = notToBeImportedTypes ;
116114
117115 iterableType = typeUtils .erasure ( elementUtils .getTypeElement ( Iterable .class .getCanonicalName () ).asType () );
@@ -125,9 +123,10 @@ public TypeFactory(ElementUtils elementUtils, TypeUtils typeUtils, FormattingMes
125123 implementationTypes .put ( Collection .class .getName (), withInitialCapacity ( getType ( ArrayList .class ) ) );
126124 implementationTypes .put ( List .class .getName (), withInitialCapacity ( getType ( ArrayList .class ) ) );
127125
126+ boolean sourceVersionAtLeast19 = versionInformation .isSourceVersionAtLeast19 ();
128127 implementationTypes .put (
129128 Set .class .getName (),
130- isSourceVersionAtLeast19 () ?
129+ sourceVersionAtLeast19 ?
131130 withFactoryMethod ( getType ( LinkedHashSet .class ), LINKED_HASH_SET_FACTORY_METHOD_NAME ) :
132131 withLoadFactorAdjustment ( getType ( LinkedHashSet .class ) )
133132 );
@@ -136,7 +135,7 @@ public TypeFactory(ElementUtils elementUtils, TypeUtils typeUtils, FormattingMes
136135
137136 implementationTypes .put (
138137 Map .class .getName (),
139- isSourceVersionAtLeast19 () ?
138+ sourceVersionAtLeast19 ?
140139 withFactoryMethod ( getType ( LinkedHashMap .class ), LINKED_HASH_MAP_FACTORY_METHOD_NAME ) :
141140 withLoadFactorAdjustment ( getType ( LinkedHashMap .class ) )
142141 );
@@ -480,10 +479,6 @@ private boolean isExecutableType(TypeMirror accessorType) {
480479 return accessorType .getKind () == TypeKind .EXECUTABLE ;
481480 }
482481
483- private boolean isSourceVersionAtLeast19 () {
484- return versionInformation != null && versionInformation .isSourceVersionAtLeast19 ();
485- }
486-
487482 public Type getReturnType (ExecutableType method ) {
488483 return getType ( method .getReturnType () );
489484 }
0 commit comments