#339 error message clarification: #321, adding coding hint to 'can't map property'

This commit is contained in:
sjaakd 2014-11-17 10:54:29 +01:00
parent 6a46ac068f
commit fd08330b94
2 changed files with 9 additions and 4 deletions

View File

@ -232,10 +232,13 @@ public class PropertyMapping extends ModelElement {
ctx.getMessager().printMessage(
Diagnostic.Kind.ERROR,
String.format(
"Can't map %s to \"%s %s\".",
"Can't map %s to \"%s %s\". "
+ "Consider to declare/implement a mapping method: \"%s map(%s value)\".",
sourceElement,
targetType,
targetPropertyName
targetPropertyName,
targetType,
getSourceType() /* original source type */
),
method.getExecutable()
);

View File

@ -46,11 +46,13 @@ public class ErroneousMappingsTest {
@Diagnostic(type = ErroneousMapper.class,
kind = Kind.ERROR,
line = 27,
messageRegExp = "Can't map property \"boolean foo\" to \"int foo\"\\."),
messageRegExp = "Can't map property \"boolean foo\" to \"int foo\". Consider to declare/implement a "
+ "mapping method: \"int map\\(boolean value\\)\"."),
@Diagnostic(type = ErroneousMapper.class,
kind = Kind.ERROR,
line = 29,
messageRegExp = "Can't map property \"int foo\" to \"boolean foo\"\\."),
messageRegExp = "Can't map property \"int foo\" to \"boolean foo\". Consider to declare/implement a "
+ "mapping method: \"boolean map\\(int value\\)\"."),
@Diagnostic(type = ErroneousMapper.class,
kind = Kind.ERROR,
line = 31,