#339 Some comment and typo fixes

This commit is contained in:
Gunnar Morling 2015-02-05 23:01:58 +01:00
parent b83c430758
commit 0772dce41b
3 changed files with 20 additions and 7 deletions

View File

@ -473,7 +473,7 @@ public class MappingResolverImpl implements MappingResolver {
}
else {
messager.printMessage( mappingMethod.getExecutable(),
Message.GENERAL_AMBIGIOUSFACTORY_METHOD,
Message.GENERAL_AMBIGIOUS_FACTORY_METHOD,
returnType,
Strings.join( candidates, ", " )
);

View File

@ -22,6 +22,12 @@ import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.AnnotationValue;
import javax.lang.model.element.Element;
/**
* Prints out diagnostics raised by the annotation processor. Messages are Java format strings taking the given
* arguments for interpolation.
*
* @author Sjaak Derksen
*/
public interface FormattingMessager {
/**

View File

@ -21,14 +21,13 @@ package org.mapstruct.ap.util;
import javax.tools.Diagnostic;
/**
* A message used in warnings/errors raised by the annotation processor.
*
* @author Sjaak Derksen
*/
public enum Message {
// CHECKSTYLE:OFF
// CHECKSTYLE:OFF
BEANMAPPING_NO_ELEMENTS( "'resultType' and 'qualifiedBy' are undefined in @BeanMapping, define at least one of them." ),
BEANMAPPING_NOT_ASSIGNABLE( "%s not assignable to: %s." ),
BEANMAPPING_UNKNOWN_PROPERTY_IN_RETURNTYPE( "Unknown property \"%s\" in return type." ),
@ -36,6 +35,7 @@ public enum Message {
BEANMAPPING_SEVERAL_POSSIBLE_TARGET_ACCESSORS( "Found several matching getters for property \"%s\"." ),
BEANMAPPING_UNMAPPED_TARGETS_WARNING( "Unmapped target %s.", Diagnostic.Kind.WARNING ),
BEANMAPPING_UNMAPPED_TARGETS_ERROR( "Unmapped target %s." ),
PROPERTYMAPPING_MAPPING_NOT_FOUND( "Can't map %s to \"%s %s\". Consider to declare/implement a mapping method: \"%s map(%s value)\"." ),
PROPERTYMAPPING_DUPLICATE_TARGETS( "Target property \"%s\" must not be mapped more than once." ),
PROPERTYMAPPING_EMPTY_TARGET( "Target must not be empty in @Mapping." ),
@ -47,25 +47,32 @@ public enum Message {
PROPERTYMAPPING_INVALID_PARAMETER_NAME( "Method has no parameter named \"%s\"." ),
PROPERTYMAPPING_NO_PROPERTY_IN_PARAMETER( "The type of parameter \"%s\" has no property named \"%s\"." ),
PROPERTYMAPPING_INVALID_PROPERTY_NAME( "No property named \"%s\" exists in source parameter(s)." ),
CONSTANTMAPPING_MAPPING_NOT_FOUND( "Can't map \"%s %s\" to \"%s %s\"." ),
MAPMAPPING_KEY_MAPPING_NOT_FOUND( "Can't create implementation of method %s. Found no method nor built-in conversion for mapping source key type to target key type." ),
MAPMAPPING_VALUE_MAPPING_NOT_FOUND( "Can't create implementation of method %s. Found no method nor built-in conversion for mapping source value type to target value type." ),
MAPMAPPING_NO_ELEMENTS( "'keyDateFormat', 'keyQualifiedBy', 'keyTargetType', 'valueDateFormat', 'valueQualfiedBy' and 'valueTargetType' are all undefined in @MapMapping, define at least one of them." ),
ITERABLEMAPPING_MAPPING_NOT_FOUND( "Can't create implementation of method %s. Found no method nor built-in conversion for mapping source element type into target element type." ),
ITERABLEMAPPING_NO_ELEMENTS( "'dateformat', 'qualifiedBy' and 'elementTargetType' are undefined in @IterableMapping, define at least one of them." ),
ENUMMAPPING_MULTIPLE_TARGETS( "One enum constant must not be mapped to more than one target constant, but constant %s is mapped to %s." ),
ENUMMAPPING_UNDEFINED_SOURCE( "A source constant must be specified for mappings of an enum mapping method." ),
ENUMMAPPING_NON_EXISTING_CONSTANT( "Constant %s doesn't exist in enum type %s." ),
ENUMMAPPING_UNDEFINED_TARGET( "A target constant must be specified for mappings of an enum mapping method." ),
ENUMMAPPING_UNMAPPED_TARGETS( "The following constants from the source enum have no corresponding constant in the target enum and must be be mapped via @Mapping: %s." ),
DECORATOR_NO_SUBTYPE( "Specified decorator type is no subtype of the annotated mapper type." ),
DECORATOR_CONSTRUCTOR( "Specified decorator type has no default constructor nor a constructor with a single parameter accepting the decorated mapper type." ),
GENERAL_NO_IMPLEMENTATION( "No implementation type is registered for return type %s." ),
GENERAL_AMBIGIOUS_MAPPING_METHOD( "Ambiguous mapping methods found for mapping %s to %s: %s." ),
GENERAL_AMBIGIOUSFACTORY_METHOD( "Ambiguous mapping methods found for factorizing %s: %s." ),
GENERAL_AMBIGIOUS_FACTORY_METHOD( "Ambiguous mapping methods found for factorizing %s: %s." ),
GENERAL_UNSUPPORTED_DATE_FORMAT_CHECK( "No dateFormat check is supported for types %s, %s" ),
GENERAL_VALID_DATE( "given date format \"%s\" is valid." ),
GENERAL_INVALID_DATE( "given date format \"%s\" is invalid. Message: \"%s\"." ),
GENERAL_VALID_DATE( "Given date format \"%s\" is valid." ),
GENERAL_INVALID_DATE( "Given date format \"%s\" is invalid. Message: \"%s\"." ),
RETRIEVAL_NO_INPUT_ARGS( "Can't generate mapping method with no input arguments." ),
RETRIEVAL_DUPLICATE_MAPPING_TARGETS( "Can't generate mapping method with more than one @MappingTarget parameter." ),
RETRIEVAL_VOID_MAPPING_METHOD( "Can't generate mapping method with return type void." ),
@ -77,6 +84,7 @@ public enum Message {
RETRIEVAL_PRIMITIVE_RETURN( "Can't generate mapping method with primitive return type." ),
RETRIEVAL_ENUM_TO_NON_ENUM( "Can't generate mapping method from enum type to non-enum type." ),
RETRIEVAL_NON_ENUM_TO_ENUM( "Can't generate mapping method from non-enum type to enum type." ),
INHERITCONFIGURATION_BOTH( "Method cannot be annotated with both a @InheritConfiguration and @InheritInverseConfiguration." ),
INHERITINVERSECONFIGURATION_REFERENCE_HAS_INVERSE( "Resolved inverse mapping method %s() should not carry the @InheritInverseConfiguration annotation itself." ),
INHERITINVERSECONFIGURATION_REFERENCE_HAS_FORWARD( "Resolved inverse mapping method %s() should not carry the @InheritConfiguration annotation." ),
@ -112,5 +120,4 @@ public enum Message {
public Diagnostic.Kind getDiagnosticKind() {
return kind;
}
}