review fix: EnumValues constructor call should be marked as implicit#2090
review fix: EnumValues constructor call should be marked as implicit#2090monperrus merged 10 commits intoINRIA:masterfrom
Conversation
|
|
||
| List<CtComment> comments = firstEnumValue.getComments(); | ||
| assertEquals(1, comments.size()); | ||
| assertTrue(comments.get(0) instanceof CtJavaDoc); |
There was a problem hiding this comment.
assert on the comment content
|
|
||
| for (CtEnumValue enumValue : enumValues) { | ||
| CtExpression defaultExpression = enumValue.getDefaultExpression(); | ||
| assertTrue(defaultExpression.isImplicit()); |
There was a problem hiding this comment.
assert on the pretty-print of enum values (implicit constructor calls)
|
@pvojtechovsky I got an assertion error with elementPrinterHelper.printList(ctEnum.getEnumValues(),
null, false, null, false, false, "," + DefaultJavaPrettyPrinter.LINE_SEPARATOR, false, false, ";",
enumValue -> scan(enumValue));I don't really know where to start for fixing that one... Do you have an idea? |
| elementPrinterHelper.printList(ctEnum.getEnumValues(), | ||
| null, false, null, false, false, ",", true, false, ";", | ||
| null, false, null, false, false, "," + DefaultJavaPrettyPrinter.LINE_SEPARATOR, false, false, ";", | ||
| enumValue -> scan(enumValue)); |
There was a problem hiding this comment.
it is not actually allowed to send token which contains two different token types: "," and EOL
Solution:
replace
enumValue -> scan(enumValue)with
enumValue -> {
printer.writeln();
scan(enumValue)
}| if (!constructorCall.isImplicit()) { | ||
| this.getPrinterTokenWriter().writeSeparator("("); | ||
| elementPrinterHelper.printList(constructorCall.getArguments(), null, false, null, false, false, ",", true, false, null, expr -> scan(expr)); | ||
| this.getPrinterTokenWriter().writeSeparator(")"); |
There was a problem hiding this comment.
remove both writeSepratator calls and use instead:
elementPrinterHelper.printList(constructorCall.getArguments(), null, false, "(", false, false, ",", true, false, ")", expr -> scan(expr));There was a problem hiding this comment.
Hmmm I tried with "(" for the first parameter, but it works indeed better at the right place :)
|
should only be merged after #2096? |
|
No it can be already merged |
No description provided.