[ https://issues.apache.org/jira/browse/LUCENE-9440?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17168854#comment-17168854 ]
ASF subversion and git services commented on LUCENE-9440: --------------------------------------------------------- Commit 2f1ee1003b7598558471454ed3a2959bb79fc696 in lucene-solr's branch refs/heads/branch_8x from Michael McCandless [ https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=2f1ee10 ] LUCENE-9440: call FieldInfo.checkConsistency for real (not under assert) > FieldInfo#checkConsistency called twice from Lucene50(60)FieldInfosFormat#read > ------------------------------------------------------------------------------ > > Key: LUCENE-9440 > URL: https://issues.apache.org/jira/browse/LUCENE-9440 > Project: Lucene - Core > Issue Type: Improvement > Components: core/index > Affects Versions: master (9.0) > Reporter: Yauheni Putsykovich > Priority: Trivial > Attachments: LUCENE-9440.patch, LUCENE-9440.patch > > > Reviewing code I noticed that we do call _infos[i].checkConsistency();_ > method twice: first time inside the _FiledInfo_'s constructor and a second > one just after we've created an object. > org/apache/lucene/codecs/lucene50/Lucene50FieldInfosFormat.java:150 > {code:java} > infos[i] = new FieldInfo(name, fieldNumber, storeTermVector, omitNorms, > storePayloads, indexOptions, docValuesType, dvGen, attributes, 0, 0, 0, > false); > infos[i].checkConsistency(); > {code} > _FileInfo_'s constructor(notice the last line) > {code:java} > public FieldInfo(String name, int number, boolean storeTermVector, boolean > omitNorms, boolean storePayloads, > IndexOptions indexOptions, DocValuesType docValues, long > dvGen, Map<String,String> attributes, > int pointDimensionCount, int pointIndexDimensionCount, int > pointNumBytes, boolean softDeletesField) { > this.name = Objects.requireNonNull(name); > this.number = number; > this.docValuesType = Objects.requireNonNull(docValues, "DocValuesType must > not be null (field: \"" + name + "\")"); > this.indexOptions = Objects.requireNonNull(indexOptions, "IndexOptions must > not be null (field: \"" + name + "\")"); > if (indexOptions != IndexOptions.NONE) { > this.storeTermVector = storeTermVector; > this.storePayloads = storePayloads; > this.omitNorms = omitNorms; > } else { // for non-indexed fields, leave defaults > this.storeTermVector = false; > this.storePayloads = false; > this.omitNorms = false; > } > this.dvGen = dvGen; > this.attributes = Objects.requireNonNull(attributes); > this.pointDimensionCount = pointDimensionCount; > this.pointIndexDimensionCount = pointIndexDimensionCount; > this.pointNumBytes = pointNumBytes; > this.softDeletesField = softDeletesField; > assert checkConsistency(); > } > {code} > > By this patch, I will remove the second call and leave only one in the > constructor. > -- 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