docs & refactor: fix typos and improve readability in multiple classes (#3767)

- AnnotatedConstructor: Fixed a variable name typo (noArgConstructorToInBecluded → noArgConstructorToBeIncluded).
- AbstractBaseBuilder: Improved Javadoc by fixing typos and clarifying wording.
- SourceRhsSelector: Corrected a typo in the class-level Javadoc.
- InheritanceSelector: Enhanced readability by fixing typos and refining comments.
This commit is contained in:
cussle 2024-11-14 05:22:57 +09:00 committed by GitHub
parent 5bf2b152af
commit 0df3f6af95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 12 deletions

View File

@ -41,7 +41,7 @@ class AbstractBaseBuilder<B extends AbstractBaseBuilder<B>> {
} }
/** /**
* Checks if MapStruct is allowed to generate an automatic sub-mapping between {@code sourceType} and @{code * Checks if MapStruct is allowed to generate an automatic sub-mapping between {@code sourceType} and {@code
* targetType}. * targetType}.
* This will evaluate to {@code true}, when: * This will evaluate to {@code true}, when:
* <li> * <li>
@ -66,7 +66,7 @@ class AbstractBaseBuilder<B extends AbstractBaseBuilder<B>> {
/** /**
* Creates a forged assignment from the provided {@code sourceRHS} and {@code forgedMethod}. If a mapping method * Creates a forged assignment from the provided {@code sourceRHS} and {@code forgedMethod}. If a mapping method
* for the {@code forgedMethod} already exists, then this method used for the assignment. * for the {@code forgedMethod} already exists, this method will be used for the assignment.
* *
* @param sourceRHS that needs to be used for the assignment * @param sourceRHS that needs to be used for the assignment
* @param forgedMethod the forged method for which we want to create an {@link Assignment} * @param forgedMethod the forged method for which we want to create an {@link Assignment}

View File

@ -36,14 +36,14 @@ public class AnnotatedConstructor extends ModelElement implements Constructor {
if ( constructor instanceof NoArgumentConstructor ) { if ( constructor instanceof NoArgumentConstructor ) {
noArgumentConstructor = (NoArgumentConstructor) constructor; noArgumentConstructor = (NoArgumentConstructor) constructor;
} }
NoArgumentConstructor noArgConstructorToInBecluded = null; NoArgumentConstructor noArgConstructorToBeIncluded = null;
Set<SupportingConstructorFragment> fragmentsToBeIncluded = Collections.emptySet(); Set<SupportingConstructorFragment> fragmentsToBeIncluded = Collections.emptySet();
if ( includeNoArgConstructor ) { if ( includeNoArgConstructor ) {
if ( noArgumentConstructor != null ) { if ( noArgumentConstructor != null ) {
noArgConstructorToInBecluded = noArgumentConstructor; noArgConstructorToBeIncluded = noArgumentConstructor;
} }
else { else {
noArgConstructorToInBecluded = new NoArgumentConstructor( name, fragmentsToBeIncluded ); noArgConstructorToBeIncluded = new NoArgumentConstructor( name, fragmentsToBeIncluded );
} }
} }
else if ( noArgumentConstructor != null ) { else if ( noArgumentConstructor != null ) {
@ -53,7 +53,7 @@ public class AnnotatedConstructor extends ModelElement implements Constructor {
name, name,
mapperReferences, mapperReferences,
annotations, annotations,
noArgConstructorToInBecluded, noArgConstructorToBeIncluded,
fragmentsToBeIncluded fragmentsToBeIncluded
); );
} }

View File

@ -33,7 +33,7 @@ public class InheritanceSelector implements MethodSelector {
List<SelectedMethod<T>> candidatesWithBestMatchingSourceType = new ArrayList<>(); List<SelectedMethod<T>> candidatesWithBestMatchingSourceType = new ArrayList<>();
int bestMatchingSourceTypeDistance = Integer.MAX_VALUE; int bestMatchingSourceTypeDistance = Integer.MAX_VALUE;
// find the methods with the minimum distance regarding getParameter getParameter type // Find methods with the minimum inheritance distance from the source parameter type
for ( SelectedMethod<T> method : methods ) { for ( SelectedMethod<T> method : methods ) {
Parameter singleSourceParam = first( method.getMethod().getSourceParameters() ); Parameter singleSourceParam = first( method.getMethod().getSourceParameters() );
@ -49,17 +49,17 @@ public class InheritanceSelector implements MethodSelector {
return candidatesWithBestMatchingSourceType; return candidatesWithBestMatchingSourceType;
} }
private <T extends Method> int addToCandidateListIfMinimal(List<SelectedMethod<T>> candidatesWithBestMathingType, private <T extends Method> int addToCandidateListIfMinimal(List<SelectedMethod<T>> candidatesWithBestMatchingType,
int bestMatchingTypeDistance, SelectedMethod<T> method, int bestMatchingTypeDistance, SelectedMethod<T> method,
int currentTypeDistance) { int currentTypeDistance) {
if ( currentTypeDistance == bestMatchingTypeDistance ) { if ( currentTypeDistance == bestMatchingTypeDistance ) {
candidatesWithBestMathingType.add( method ); candidatesWithBestMatchingType.add( method );
} }
else if ( currentTypeDistance < bestMatchingTypeDistance ) { else if ( currentTypeDistance < bestMatchingTypeDistance ) {
bestMatchingTypeDistance = currentTypeDistance; bestMatchingTypeDistance = currentTypeDistance;
candidatesWithBestMathingType.clear(); candidatesWithBestMatchingType.clear();
candidatesWithBestMathingType.add( method ); candidatesWithBestMatchingType.add( method );
} }
return bestMatchingTypeDistance; return bestMatchingTypeDistance;
} }

View File

@ -12,7 +12,7 @@ import org.mapstruct.ap.internal.model.common.ParameterBinding;
import org.mapstruct.ap.internal.model.source.Method; import org.mapstruct.ap.internal.model.source.Method;
/** /**
* Selector that tries to resolve an ambiquity between methods that contain source parameters and * Selector that tries to resolve an ambiguity between methods that contain source parameters and
* {@link org.mapstruct.ap.internal.model.common.SourceRHS SourceRHS} type parameters. * {@link org.mapstruct.ap.internal.model.common.SourceRHS SourceRHS} type parameters.
* @author Filip Hrisafov * @author Filip Hrisafov
*/ */