Avoid unnecessary unboxing of Boolean (#3003)

This commit is contained in:
Prasanth Omanakuttan 2022-09-12 22:15:22 +05:30 committed by GitHub
parent 97c6755288
commit d593afed69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,6 @@ package org.mapstruct.ap;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
@ -119,7 +118,7 @@ public class MappingProcessor extends AbstractProcessor {
* <p> * <p>
* If the hierarchy of a mapper's source/target types is never completed (i.e. the missing super-types are not * If the hierarchy of a mapper's source/target types is never completed (i.e. the missing super-types are not
* generated by other processors), this mapper will not be generated; That's fine, the compiler will raise an error * generated by other processors), this mapper will not be generated; That's fine, the compiler will raise an error
* due to the inconsistent Java types used as source or target anyways. * due to the inconsistent Java types used as source or target anyway.
*/ */
private Set<DeferredMapper> deferredMappers = new HashSet<>(); private Set<DeferredMapper> deferredMappers = new HashSet<>();
@ -142,15 +141,15 @@ public class MappingProcessor extends AbstractProcessor {
String unmappedSourcePolicy = processingEnv.getOptions().get( UNMAPPED_SOURCE_POLICY ); String unmappedSourcePolicy = processingEnv.getOptions().get( UNMAPPED_SOURCE_POLICY );
return new Options( return new Options(
Boolean.valueOf( processingEnv.getOptions().get( SUPPRESS_GENERATOR_TIMESTAMP ) ), Boolean.parseBoolean( processingEnv.getOptions().get( SUPPRESS_GENERATOR_TIMESTAMP ) ),
Boolean.valueOf( processingEnv.getOptions().get( SUPPRESS_GENERATOR_VERSION_INFO_COMMENT ) ), Boolean.parseBoolean( processingEnv.getOptions().get( SUPPRESS_GENERATOR_VERSION_INFO_COMMENT ) ),
unmappedTargetPolicy != null ? ReportingPolicyGem.valueOf( unmappedTargetPolicy.toUpperCase() ) : null, unmappedTargetPolicy != null ? ReportingPolicyGem.valueOf( unmappedTargetPolicy.toUpperCase() ) : null,
unmappedSourcePolicy != null ? ReportingPolicyGem.valueOf( unmappedSourcePolicy.toUpperCase() ) : null, unmappedSourcePolicy != null ? ReportingPolicyGem.valueOf( unmappedSourcePolicy.toUpperCase() ) : null,
processingEnv.getOptions().get( DEFAULT_COMPONENT_MODEL ), processingEnv.getOptions().get( DEFAULT_COMPONENT_MODEL ),
processingEnv.getOptions().get( DEFAULT_INJECTION_STRATEGY ), processingEnv.getOptions().get( DEFAULT_INJECTION_STRATEGY ),
Boolean.valueOf( processingEnv.getOptions().get( ALWAYS_GENERATE_SERVICE_FILE ) ), Boolean.parseBoolean( processingEnv.getOptions().get( ALWAYS_GENERATE_SERVICE_FILE ) ),
Boolean.valueOf( processingEnv.getOptions().get( DISABLE_BUILDERS ) ), Boolean.parseBoolean( processingEnv.getOptions().get( DISABLE_BUILDERS ) ),
Boolean.valueOf( processingEnv.getOptions().get( VERBOSE ) ) Boolean.parseBoolean( processingEnv.getOptions().get( VERBOSE ) )
); );
} }
@ -352,7 +351,7 @@ public class MappingProcessor extends AbstractProcessor {
/** /**
* Retrieves all model element processors, ordered by their priority value * Retrieves all model element processors, ordered by their priority value
* (with the method retrieval processor having the lowest priority value (1) * (with the method retrieval processor having the lowest priority value (1))
* and the code generation processor the highest priority value. * and the code generation processor the highest priority value.
* *
* @return A list with all model element processors. * @return A list with all model element processors.
@ -372,7 +371,7 @@ public class MappingProcessor extends AbstractProcessor {
processors.add( processorIterator.next() ); processors.add( processorIterator.next() );
} }
Collections.sort( processors, new ProcessorComparator() ); processors.sort( new ProcessorComparator() );
return processors; return processors;
} }