Before:
public void doSooooooooooooooooooooooooooomething() throws
LooooooooooooooooooooooooooooongException {}
After:
public void doSooooooooooooooooooooooooooomething()
throws LooooooooooooooooooooooooooooongException {}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@220041
91177308-0d34-0410-b5e6-
96231b3b80d8
bool TokenAnnotator::canBreakBefore(const AnnotatedLine &Line,
const FormatToken &Right) {
const FormatToken &Left = *Right.Previous;
+
+ if (Style.Language == FormatStyle::LK_Java) {
+ if (Left.is(tok::identifier) && Left.TokenText == "throws")
+ return false;
+ }
+
if (Left.is(tok::at))
return false;
if (Left.Tok.getObjCKeywordID() == tok::objc_interface)
return format(Code, 0, Code.size(), Style);
}
- static FormatStyle getGoogleJSStyleWithColumns(unsigned ColumnLimit) {
- FormatStyle Style = getGoogleStyle(FormatStyle::LK_Java);
- Style.ColumnLimit = ColumnLimit;
- return Style;
- }
-
static void verifyFormat(
llvm::StringRef Code,
const FormatStyle &Style = getGoogleStyle(FormatStyle::LK_Java)) {
"}");
}
+TEST_F(FormatTestJava, ThrowsDeclarations) {
+ verifyFormat("public void doSooooooooooooooooooooooooooomething()\n"
+ " throws LooooooooooooooooooooooooooooongException {}");
+}
+
} // end namespace tooling
} // end namespace clang