Apache Lucene open-source search software
Align instanceof check with type cast (#13039)
Dmitry Cherniachenko13ea88050864
diff --git a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttributeImpl.java b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttributeImpl.javaindex b17f0183313..4ab42576ea9 100644--- a/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttributeImpl.java+++ b/lucene/core/src/java/org/apache/lucene/analysis/tokenattributes/PayloadAttributeImpl.java@@ -62,7 +62,7 @@ public class PayloadAttributeImpl extends AttributeImpl implements PayloadAttribreturn true;}- if (other instanceof PayloadAttribute) {+ if (other instanceof PayloadAttributeImpl) {PayloadAttributeImpl o = (PayloadAttributeImpl) other;if (o.payload == null || payload == null) {return o.payload == null && payload == null;diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/AnalyzerQueryNodeProcessor.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/AnalyzerQueryNodeProcessor.javaindex 282a0a2d08a..26746a6b0ed 100644--- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/AnalyzerQueryNodeProcessor.java+++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/standard/processors/AnalyzerQueryNodeProcessor.java@@ -38,13 +38,11 @@ import org.apache.lucene.queryparser.flexible.core.nodes.NoTokenFoundQueryNode;import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode;import org.apache.lucene.queryparser.flexible.core.nodes.QuotedFieldQueryNode;import org.apache.lucene.queryparser.flexible.core.nodes.RangeQueryNode;-import org.apache.lucene.queryparser.flexible.core.nodes.TextableQueryNode;import org.apache.lucene.queryparser.flexible.core.nodes.TokenizedPhraseQueryNode;import org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl;import org.apache.lucene.queryparser.flexible.standard.config.StandardQueryConfigHandler.ConfigurationKeys;import org.apache.lucene.queryparser.flexible.standard.config.StandardQueryConfigHandler.Operator;import org.apache.lucene.queryparser.flexible.standard.nodes.MultiPhraseQueryNode;-import org.apache.lucene.queryparser.flexible.standard.nodes.RegexpQueryNode;import org.apache.lucene.queryparser.flexible.standard.nodes.SynonymQueryNode;import org.apache.lucene.queryparser.flexible.standard.nodes.WildcardQueryNode;@@ -107,10 +105,9 @@ public class AnalyzerQueryNodeProcessor extends QueryNodeProcessorImpl {@Overrideprotected QueryNode postProcessNode(QueryNode node) throws QueryNodeException {- if (node instanceof TextableQueryNode+ if (node instanceof FieldQueryNode&& !(node instanceof WildcardQueryNode)&& !(node instanceof FuzzyQueryNode)- && !(node instanceof RegexpQueryNode)&& !(node.getParent() instanceof RangeQueryNode)) {FieldQueryNode fieldNode = ((FieldQueryNode) node);