[ https://issues.apache.org/jira/browse/LUCENE-9570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17251599#comment-17251599 ]
Dawid Weiss edited comment on LUCENE-9570 at 12/18/20, 8:57 AM: ---------------------------------------------------------------- Just a note of the problematic code that I had to manually adjust. ---- Long single-line comments after the braces; formatter tries to keep these after the brace, sometimes forcing line breaks. These commands should be moved manually to precede the statement. {code:java} - boolean[] mustRewriteHolder = {false}; // boolean wrapped in 1-ary array so it's mutable from inner class + boolean[] mustRewriteHolder = { + false + }; // boolean wrapped in 1-ary array so it's mutable from inner class {code} Should be: {code:java} // boolean wrapped in 1-ary array so it's mutable from inner class boolean[] mustRewriteHolder = {false}; {code} ---- Occasional block comments with very long lines (formed out of single-line comments) are broken as if each line comment is separate. This makes sense and leaves the code consistent but in many cases such comments could be block comments (and then the formatter would lay out text properly). {code:java} - // (2) When two or more fields have term vectors, given the field-then-doc algorithm, the underlying term - // vectors will be fetched in a terrible access pattern unless we highlight a doc at a time and use a special - // current-doc TV cache. So we do that. Hopefully one day TVs will be improved to make this pointless. + // (2) When two or more fields have term vectors, given the field-then-doc algorithm, the + // underlying term + // vectors will be fetched in a terrible access pattern unless we highlight a doc at a time + // and use a special + // current-doc TV cache. So we do that. Hopefully one day TVs will be improved to make this + // pointless. {code} — Formatter doesn't "correct" non-block statements in ifs, elses, etc. Like this fragment: {code:java} - static Object checkTagsArgument( Object tags ){ - if( tags instanceof String ) return tags; - else if( tags instanceof String[] ) return tags; - throw new IllegalArgumentException( "type of preTags/postTags must be a String or String[]" ); + + static Object checkTagsArgument(Object tags) { + if (tags instanceof String) return tags; + else if (tags instanceof String[]) return tags; + throw new IllegalArgumentException("type of preTags/postTags must be a String or String[]"); } {code} This should be corrected manually to have braces (where appropriate for improved clarity). was (Author: dweiss): Just a note of the problematic code that I had to manually adjust. ---- Long single-line comments after the braces; formatter tries to keep these after the brace, sometimes forcing line breaks. These commands should be moved manually to precede the statement. {code} - boolean[] mustRewriteHolder = {false}; // boolean wrapped in 1-ary array so it's mutable from inner class + boolean[] mustRewriteHolder = { + false + }; // boolean wrapped in 1-ary array so it's mutable from inner class {code} Should be: {code} // boolean wrapped in 1-ary array so it's mutable from inner class boolean[] mustRewriteHolder = {false}; {code} ---- Occasional block comments with very long lines (formed out of single-line comments) are broken as if each line comment is separate. This makes sense and leaves the code consistent but in many cases such comments could be block comments (and then the formatter would lay out text properly). {code} - // (2) When two or more fields have term vectors, given the field-then-doc algorithm, the underlying term - // vectors will be fetched in a terrible access pattern unless we highlight a doc at a time and use a special - // current-doc TV cache. So we do that. Hopefully one day TVs will be improved to make this pointless. + // (2) When two or more fields have term vectors, given the field-then-doc algorithm, the + // underlying term + // vectors will be fetched in a terrible access pattern unless we highlight a doc at a time + // and use a special + // current-doc TV cache. So we do that. Hopefully one day TVs will be improved to make this + // pointless. {code} > Review code diffs after automatic formatting and correct problems before it > is applied > -------------------------------------------------------------------------------------- > > Key: LUCENE-9570 > URL: https://issues.apache.org/jira/browse/LUCENE-9570 > Project: Lucene - Core > Issue Type: Sub-task > Reporter: Dawid Weiss > Assignee: Dawid Weiss > Priority: Blocker > > Review and correct all the javadocs before they're messed up by automatic > formatting. Apply project-by-project, review diff, correct. Lots of diffs but > it should be relatively quick. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org