boolean (IElementType type) { if (ElementType.JAVA_COMMENT_OR_WHITESPACE_BIT_SET.contains(type)) { return true; } // annotations, method refs & lambdas if (type == JavaTokenType.AT || type == JavaTokenType.ARROW || type == JavaTokenType.DOUBLE_COLON) { return (result = false); } // anonymous classes else if (type == JavaTokenType.NEW_KEYWORD) { seenNew = true; } else if (seenNew && type == JavaTokenType.SEMICOLON) { seenNew = false; seenLParen = false; } else if (seenNew && type == JavaTokenType.LBRACE && seenLParen) { return (result = false); } else if (seenNew && type == JavaTokenType.LPARENTH) { seenLParen = true; } else if (ElementType.MODIFIER_BIT_SET.contains(type)) { seenModifier = true; } // local classes else if (type == JavaTokenType.CLASS_KEYWORD && (last != JavaTokenType.DOT || preLast != JavaTokenType.IDENTIFIER || seenModifier) || type == JavaTokenType.ENUM_KEYWORD || type == JavaTokenType.INTERFACE_KEYWORD) { return (result = false); } // if record is inside lazy parseable element, tokens are not remapped and record token is still identifier // This token combination may be "record RecordName (" or "record RecordName<..." // Local records without < or ( won't be parsed else if (preLast == JavaTokenType.IDENTIFIER && last == JavaTokenType.IDENTIFIER && (type == JavaTokenType.LPARENTH || type == JavaTokenType.LT)) { return (result = false); } preLast = last; last = type; return true; }