Skip to content

Commit d593afe

Browse files
authored
Avoid unnecessary unboxing of Boolean (#3003)
1 parent 97c6755 commit d593afe

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

processor/src/main/java/org/mapstruct/ap/MappingProcessor.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import java.io.PrintWriter;
99
import java.io.StringWriter;
1010
import java.util.ArrayList;
11-
import java.util.Collections;
1211
import java.util.Comparator;
1312
import java.util.HashSet;
1413
import java.util.Iterator;
@@ -119,7 +118,7 @@ public class MappingProcessor extends AbstractProcessor {
119118
* <p>
120119
* If the hierarchy of a mapper's source/target types is never completed (i.e. the missing super-types are not
121120
* generated by other processors), this mapper will not be generated; That's fine, the compiler will raise an error
122-
* due to the inconsistent Java types used as source or target anyways.
121+
* due to the inconsistent Java types used as source or target anyway.
123122
*/
124123
private Set<DeferredMapper> deferredMappers = new HashSet<>();
125124

@@ -142,15 +141,15 @@ private Options createOptions() {
142141
String unmappedSourcePolicy = processingEnv.getOptions().get( UNMAPPED_SOURCE_POLICY );
143142

144143
return new Options(
145-
Boolean.valueOf( processingEnv.getOptions().get( SUPPRESS_GENERATOR_TIMESTAMP ) ),
146-
Boolean.valueOf( processingEnv.getOptions().get( SUPPRESS_GENERATOR_VERSION_INFO_COMMENT ) ),
144+
Boolean.parseBoolean( processingEnv.getOptions().get( SUPPRESS_GENERATOR_TIMESTAMP ) ),
145+
Boolean.parseBoolean( processingEnv.getOptions().get( SUPPRESS_GENERATOR_VERSION_INFO_COMMENT ) ),
147146
unmappedTargetPolicy != null ? ReportingPolicyGem.valueOf( unmappedTargetPolicy.toUpperCase() ) : null,
148147
unmappedSourcePolicy != null ? ReportingPolicyGem.valueOf( unmappedSourcePolicy.toUpperCase() ) : null,
149148
processingEnv.getOptions().get( DEFAULT_COMPONENT_MODEL ),
150149
processingEnv.getOptions().get( DEFAULT_INJECTION_STRATEGY ),
151-
Boolean.valueOf( processingEnv.getOptions().get( ALWAYS_GENERATE_SERVICE_FILE ) ),
152-
Boolean.valueOf( processingEnv.getOptions().get( DISABLE_BUILDERS ) ),
153-
Boolean.valueOf( processingEnv.getOptions().get( VERBOSE ) )
150+
Boolean.parseBoolean( processingEnv.getOptions().get( ALWAYS_GENERATE_SERVICE_FILE ) ),
151+
Boolean.parseBoolean( processingEnv.getOptions().get( DISABLE_BUILDERS ) ),
152+
Boolean.parseBoolean( processingEnv.getOptions().get( VERBOSE ) )
154153
);
155154
}
156155

@@ -352,7 +351,7 @@ private <P, R> R process(ProcessorContext context, ModelElementProcessor<P, R> p
352351

353352
/**
354353
* Retrieves all model element processors, ordered by their priority value
355-
* (with the method retrieval processor having the lowest priority value (1)
354+
* (with the method retrieval processor having the lowest priority value (1))
356355
* and the code generation processor the highest priority value.
357356
*
358357
* @return A list with all model element processors.
@@ -372,7 +371,7 @@ private <P, R> R process(ProcessorContext context, ModelElementProcessor<P, R> p
372371
processors.add( processorIterator.next() );
373372
}
374373

375-
Collections.sort( processors, new ProcessorComparator() );
374+
processors.sort( new ProcessorComparator() );
376375

377376
return processors;
378377
}

0 commit comments

Comments
 (0)