dweiss commented on a change in pull request #2301: URL: https://github.com/apache/lucene-solr/pull/2301#discussion_r570805734
########## File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/WordCase.java ########## @@ -53,14 +54,19 @@ static WordCase caseOf(CharSequence word, int length) { if (seenUpper && seenLower) break; } - return get(startsWithLower, seenUpper, seenLower); + return get(startCase, seenUpper, seenLower); } - private static WordCase get(boolean startsWithLower, boolean seenUpper, boolean seenLower) { - if (!startsWithLower) { - return !seenLower ? UPPER : !seenUpper ? TITLE : MIXED; + private static WordCase get(CharCase startCase, boolean seenUpper, boolean seenLower) { Review comment: Darn this method is case-crazy. :) Can you add a javadoc here and just show an example of what each of these WordCases are (or attach such an example to WordCase's enum values)? I'd also remove the negation and swap arguments in case UPPER - one thing less to reason about. ########## File path: lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/WordCase.java ########## @@ -53,14 +54,19 @@ static WordCase caseOf(CharSequence word, int length) { if (seenUpper && seenLower) break; } - return get(startsWithLower, seenUpper, seenLower); + return get(startCase, seenUpper, seenLower); } - private static WordCase get(boolean startsWithLower, boolean seenUpper, boolean seenLower) { - if (!startsWithLower) { - return !seenLower ? UPPER : !seenUpper ? TITLE : MIXED; + private static WordCase get(CharCase startCase, boolean seenUpper, boolean seenLower) { Review comment: I tried to follow that routine but fell into infinite recursion somewhere half way... :) The docs explain what it does much better! ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org