return true;
}
if (CurrentToken->isOneOf(tok::r_paren, tok::r_square, tok::r_brace,
- tok::colon, tok::question))
+ tok::colon))
+ return false;
+ if (CurrentToken->is(tok::question) &&
+ Style.Language != FormatStyle::LK_Java)
return false;
// If a && or || is found and interpreted as a binary operator, this set
// of angles is likely part of something like "a < b && c > d". If the
}
bool parseConditional() {
+ if (Style.Language == FormatStyle::LK_Java &&
+ CurrentToken->isOneOf(tok::comma, tok::greater))
+ return true; // This is a generic "?".
+
while (CurrentToken) {
if (CurrentToken->is(tok::colon)) {
CurrentToken->Type = TT_ConditionalExpr;
verifyFormat("Iterable<? extends SomeObject> a;");
verifyFormat("A.<B>doSomething();");
+
+ verifyFormat("@Override\n"
+ "public Map<String, ?> getAll() {\n"
+ "}");
}
TEST_F(FormatTestJava, StringConcatenation) {