diff --git a/java/java-impl/src/com/intellij/psi/impl/source/parsing/DeclarationParsing.java b/java/java-impl/src/com/intellij/psi/impl/source/parsing/DeclarationParsing.java index 4f8b677b1fc2..1fcd0a3532c1 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/parsing/DeclarationParsing.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/parsing/DeclarationParsing.java @@ -905,13 +905,14 @@ public class DeclarationParsing extends Parsing { if (tokenType != JavaTokenType.SEMICOLON && tokenType != JavaTokenType.LBRACE){ CompositeElement invalidElementsGroup = Factory.createErrorElement(JavaErrorMessages.message("expected.lbrace.or.semicolon")); method.rawAddChildren(invalidElementsGroup); + + final CharSequence buf = lexer.getBufferSequence(); Loop: while(true){ tokenType = lexer.getTokenType(); // Heuristic. Going to next line obviously means method signature is over, starting new method. // Necessary for correct CompleteStatementTest operation. - final CharSequence buf = lexer.getBufferSequence(); int start = lexer.getTokenStart(); for (int i = start - 1; i >= 0; i--) { if (buf.charAt(i) == '\n') break Loop;