#1504 adding position hints for ambiguous mapping methods (#1639)

This commit is contained in:
Sjaak Derksen 2018-11-03 08:57:42 +00:00 committed by GitHub
parent 60611d94cf
commit 1266796921
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -198,7 +198,6 @@ public class MappingResolverImpl implements MappingResolver {
if ( sourceType.isLiteral()
&& "java.lang.String".equals( sourceType.getFullyQualifiedName( ) )
&& targetType.isNative() ) {
// TODO: convey some error message
return null;
}
@ -273,8 +272,6 @@ public class MappingResolverImpl implements MappingResolver {
return null;
}
/**
* Returns a reference to a method mapping the given source type to the given target type, if such a method
* exists.
@ -485,6 +482,7 @@ public class MappingResolverImpl implements MappingResolver {
if ( sourceRHS.getSourceErrorMessagePart() != null ) {
messager.printMessage( mappingMethod.getExecutable(),
positionHint,
Message.GENERAL_AMBIGIOUS_MAPPING_METHOD,
sourceRHS.getSourceErrorMessagePart(),
returnType,
@ -493,6 +491,7 @@ public class MappingResolverImpl implements MappingResolver {
}
else {
messager.printMessage( mappingMethod.getExecutable(),
positionHint,
Message.GENERAL_AMBIGIOUS_FACTORY_METHOD,
returnType,
Strings.join( candidates, ", " )

View File

@ -100,7 +100,7 @@ public class QualifierTest {
diagnostics = {
@Diagnostic( type = ErroneousMapper.class,
kind = Kind.ERROR,
line = 29,
line = 28,
messageRegExp = "Ambiguous mapping methods found for mapping property "
+ "\"java.lang.String title\" to java.lang.String.*" )
}