From 2f21a866c164a5924a019cc40afcb06670ea7cb0 Mon Sep 17 00:00:00 2001 From: Dawid Weiss Date: Fri, 18 Nov 2022 16:42:59 +0100 Subject: [PATCH] Add star import check/validation (#11949) * Remove some old cruft that only slows down checks. Add star import check * Expand wildcard imports to comply with the rule. --- .../gradle/ErrorReportingTestListener.java | 6 ++++- .../validate-source-patterns.gradle | 22 ++-------------- .../wikipedia/WikipediaTokenizer.java | 6 ++++- .../de/TestGermanLightStemFilter.java | 2 +- .../MorphosyntacticTagsAttributeImpl.java | 4 +-- .../byTask/feeds/FileBasedQueryMaker.java | 4 ++- .../byTask/tasks/NewAnalyzerTask.java | 3 ++- .../blocktreeords/OrdsSegmentTermsEnum.java | 3 --- .../org/apache/lucene/document/Document.java | 5 +++- .../org/apache/lucene/index/CheckIndex.java | 7 +++++- .../apache/lucene/index/CompositeReader.java | 2 +- .../index/VectorSimilarityFunction.java | 5 +++- .../apache/lucene/search/PhrasePositions.java | 3 ++- .../lucene/store/InputStreamDataInput.java | 5 +++- .../lucene/store/OutputStreamDataOutput.java | 4 ++- .../lucene/util/automaton/Automata.java | 3 ++- .../DaciukMihovAutomatonBuilder.java | 6 ++++- .../src/test/org/apache/lucene/TestDemo.java | 6 ++++- .../test/org/apache/lucene/TestSearch.java | 25 +++++++++++++++---- .../lucene/analysis/TestCharArrayMap.java | 6 ++++- .../lucene/analysis/TestCharArraySet.java | 8 +++++- .../apache/lucene/document/TestDateTools.java | 6 ++++- .../lucene/document/TestManyKnnDocs.java | 6 ++++- .../apache/lucene/index/TestCheckIndex.java | 10 +++++++- .../index/TestExitableDirectoryReader.java | 12 ++++++++- .../apache/lucene/index/TestFieldsReader.java | 3 ++- .../lucene/index/TestIndexWriterCommit.java | 3 ++- .../apache/lucene/index/TestIsCurrent.java | 2 +- .../lucene/index/TestLazyProxSkipping.java | 2 +- .../lucene/index/TestMultiLevelSkipList.java | 5 +++- .../lucene/index/TestParallelLeafReader.java | 8 +++++- .../lucene/index/TestRollingUpdates.java | 7 +++--- .../lucene/index/TestStressIndexing.java | 5 ++-- .../lucene/index/TestTermVectorsReader.java | 3 ++- .../apache/lucene/index/TestTermsEnum2.java | 6 ++++- .../search/TestMultiThreadTermVectors.java | 5 +++- .../store/TestByteBuffersDataInput.java | 3 ++- .../lucene/util/TestAttributeSource.java | 13 +++++++++- .../apache/lucene/util/TestBytesRefArray.java | 6 ++++- .../apache/lucene/util/TestPagedBytes.java | 3 ++- .../lucene/util/TestRamUsageEstimator.java | 13 +++++++++- .../lucene/util/automaton/TestOperations.java | 11 ++++++-- .../org/apache/lucene/distribution/Sync.java | 11 ++++++-- .../lucene/luke/app/desktop/LukeMain.java | 5 ++-- .../desktop/components/LogsPanelProvider.java | 14 +++++++++-- .../components/LukeWindowProvider.java | 16 ++++++++++-- .../lucene/luke/models/util/IndexUtils.java | 24 +++++++++++++++++- .../lucene/monitor/HighlightsMatch.java | 8 +++++- .../lucene/monitor/MatchingQueries.java | 4 ++- .../org/apache/lucene/monitor/QueryIndex.java | 21 +++++++++++++--- .../lucene/monitor/WritableQueryIndex.java | 21 +++++++++++++--- .../function/valuesource/IDFValueSource.java | 3 ++- .../function/TestSortedSetFieldSource.java | 7 +++++- .../intervals/TestDisjunctionRewrites.java | 12 ++++++++- .../queries/payloads/PayloadHelper.java | 5 +++- .../lucene/queries/spans/TestBasics.java | 10 ++++++-- .../queries/spans/TestSpanContainQuery.java | 8 +++++- .../queries/spans/TestSpanExplanations.java | 11 +++++++- .../queries/spans/TestSpanFirstQuery.java | 4 ++- .../spans/TestSpanSearchEquivalence.java | 2 +- .../lucene/queries/spans/TestSpansEnum.java | 4 ++- .../charstream/FastCharStream.java | 4 ++- .../queryparser/classic/QueryParserBase.java | 23 +++++++++++++++-- ...NoChildOptimizationQueryNodeProcessor.java | 8 +++++- .../QueryNodeProcessorPipeline.java | 6 ++++- .../BooleanModifiersQueryNodeProcessor.java | 6 ++++- .../lucene/queryparser/xml/CoreParser.java | 20 ++++++++++++++- .../precedence/TestPrecedenceQueryParser.java | 5 +++- .../standard/TestMultiAnalyzerQPHelper.java | 5 +++- .../standard/TestMultiFieldQPHelper.java | 2 +- .../index/MergeOnFlushMergePolicy.java | 6 ++++- .../spatial/util/ShapeFieldCacheProvider.java | 6 ++++- .../lucene/spatial/SpatialTestCase.java | 4 ++- .../TestRandomSpatialOpFuzzyPrefixTree.java | 9 +++++-- .../spatial/spatial4j/TestGeo3dRpt.java | 4 ++- .../spatial3d/geom/TestGeoExactCircle.java | 4 ++- .../spatial3d/geom/TestRandomBinaryCodec.java | 5 +++- .../spatial3d/geom/TestRandomGeoPolygon.java | 4 ++- .../geom/TestRandomGeoShapeRelationship.java | 18 ++++++++++++- .../spatial3d/geom/TestRandomPlane.java | 3 ++- .../lucene/search/spell/LuceneDictionary.java | 2 +- .../lucene/search/suggest/FileDictionary.java | 5 +++- .../suggest/fst/FSTCompletionBuilder.java | 6 ++++- .../search/suggest/tst/TSTAutocomplete.java | 3 ++- .../suggest/fst/TestWFSTCompletion.java | 10 +++++++- .../analysis/BaseTokenStreamTestCase.java | 22 ++++++++++++++-- .../apache/lucene/tests/search/CheckHits.java | 7 +++++- .../util/RunListenerPrintReproduceInfo.java | 18 ++++++++++++- .../util/TestExceptionInBeforeClassHooks.java | 4 ++- 89 files changed, 545 insertions(+), 131 deletions(-) diff --git a/buildSrc/src/main/java/org/apache/lucene/gradle/ErrorReportingTestListener.java b/buildSrc/src/main/java/org/apache/lucene/gradle/ErrorReportingTestListener.java index 44cd09b33f4..9ba150909d8 100644 --- a/buildSrc/src/main/java/org/apache/lucene/gradle/ErrorReportingTestListener.java +++ b/buildSrc/src/main/java/org/apache/lucene/gradle/ErrorReportingTestListener.java @@ -16,7 +16,11 @@ */ package org.apache.lucene.gradle; -import java.io.*; +import java.io.BufferedReader; +import java.io.Closeable; +import java.io.IOException; +import java.io.UncheckedIOException; +import java.io.Writer; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; diff --git a/gradle/validation/validate-source-patterns.gradle b/gradle/validation/validate-source-patterns.gradle index 271084e616a..1300d63f756 100644 --- a/gradle/validation/validate-source-patterns.gradle +++ b/gradle/validation/validate-source-patterns.gradle @@ -153,7 +153,8 @@ class ValidateSourcePatternsTask extends DefaultTask { // Python and others merrily use var declarations, this is a problem _only_ in Java at least for 8x where we're forbidding var declarations def invalidJavaOnlyPatterns = [ - (~$/\n\s*var\s+.*=.*<>.*/$) : 'Diamond operators should not be used with var' + (~$/\n\s*var\s+.*=.*<>.*/$) : 'Diamond operators should not be used with var', + (~$/import\s+\w+(\.\w+)\.\*;/$) : 'Expand wildcard imports into explicit imports' ] def violations = new TreeSet(); @@ -167,8 +168,6 @@ class ValidateSourcePatternsTask extends DefaultTask { def javaCommentPattern = ~$/(?sm)^\Q/*\E(.*?)\Q*/\E/$; def xmlCommentPattern = ~$/(?sm)\Q\E/$; def lineSplitter = ~$/[\r\n]+/$; - def validLoggerPattern = ~$/(?s)\b(private\s|static\s|final\s){3}+\s*Logger\s+\p{javaJavaIdentifierStart}+\s+=\s+\QLoggerFactory.getLogger(MethodHandles.lookup().lookupClass());\E/$; - def validLoggerNamePattern = ~$/(?s)\b(private\s|static\s|final\s){3}+\s*Logger\s+log+\s+=\s+\QLoggerFactory.getLogger(MethodHandles.lookup().lookupClass());\E/$; def packagePattern = ~$/(?m)^\s*package\s+org\.apache.*;/$; def xmlTagPattern = ~$/(?m)\s*<[a-zA-Z].*/$; def validSPINameJavadocTag = ~$/(?s)\s*\*\s*@lucene\.spi\s+\{@value #NAME\}/$; @@ -199,12 +198,6 @@ class ValidateSourcePatternsTask extends DefaultTask { } } - def checkMockitoAssume = { f, text -> - if (text.contains("mockito") && !text.contains("assumeWorkingMockito()")) { - reportViolation(f, 'File uses Mockito but has no assumeWorkingMockito() call') - } - } - ProgressLogger progress = progressLoggerFactory.newOperation(this.class) progress.start(this.name, this.name) @@ -228,14 +221,6 @@ class ValidateSourcePatternsTask extends DefaultTask { } } if (f.name.endsWith('.java')) { - if (text.contains('org.slf4j.LoggerFactory')) { - if (!validLoggerPattern.matcher(text).find()) { - reportViolation(f, 'invalid logging pattern [not private static final, uses static class name]'); - } - if (!validLoggerNamePattern.matcher(text).find()) { - reportViolation(f, 'invalid logger name [log, uses static class name, not specialized logger]') - } - } // make sure that SPI names of all tokenizers/charfilters/tokenfilters are documented if (!f.name.contains("Test") && !f.name.contains("Mock") && !f.name.contains("Fake") && !text.contains("abstract class") && !f.name.equals("TokenizerFactory.java") && !f.name.equals("CharFilterFactory.java") && !f.name.equals("TokenFilterFactory.java") && @@ -247,9 +232,6 @@ class ValidateSourcePatternsTask extends DefaultTask { } } checkLicenseHeaderPrecedes(f, 'package', packagePattern, javaCommentPattern, text, ratDocument); - if (f.name.contains("Test")) { - checkMockitoAssume(f, text); - } invalidJavaOnlyPatterns.each { pattern,name -> if (pattern.matcher(text).find()) { diff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/wikipedia/WikipediaTokenizer.java b/lucene/analysis/common/src/java/org/apache/lucene/analysis/wikipedia/WikipediaTokenizer.java index bdb8799dbcf..099c5221bc1 100644 --- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/wikipedia/WikipediaTokenizer.java +++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/wikipedia/WikipediaTokenizer.java @@ -17,7 +17,11 @@ package org.apache.lucene.analysis.wikipedia; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Set; import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.apache.lucene.analysis.tokenattributes.FlagsAttribute; diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/de/TestGermanLightStemFilter.java b/lucene/analysis/common/src/test/org/apache/lucene/analysis/de/TestGermanLightStemFilter.java index 564bb569f27..0c830a72f3d 100644 --- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/de/TestGermanLightStemFilter.java +++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/de/TestGermanLightStemFilter.java @@ -16,7 +16,7 @@ */ package org.apache.lucene.analysis.de; -import static org.apache.lucene.tests.analysis.VocabularyAssert.*; +import static org.apache.lucene.tests.analysis.VocabularyAssert.assertVocabulary; import java.io.IOException; import org.apache.lucene.analysis.Analyzer; diff --git a/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagsAttributeImpl.java b/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagsAttributeImpl.java index a749045f0dd..cb744bac6fa 100644 --- a/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagsAttributeImpl.java +++ b/lucene/analysis/morfologik/src/java/org/apache/lucene/analysis/morfologik/MorphosyntacticTagsAttributeImpl.java @@ -1,4 +1,3 @@ -// -*- c-basic-offset: 2 -*- /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -17,7 +16,8 @@ */ package org.apache.lucene.analysis.morfologik; -import java.util.*; +import java.util.ArrayList; +import java.util.List; import org.apache.lucene.util.AttributeImpl; import org.apache.lucene.util.AttributeReflector; diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/FileBasedQueryMaker.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/FileBasedQueryMaker.java index 283178e9d00..ad39c16a2da 100644 --- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/FileBasedQueryMaker.java +++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/feeds/FileBasedQueryMaker.java @@ -16,7 +16,9 @@ */ package org.apache.lucene.benchmark.byTask.feeds; -import java.io.*; +import java.io.BufferedReader; +import java.io.InputStream; +import java.io.Reader; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewAnalyzerTask.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewAnalyzerTask.java index c18d3eb0f78..2248756998e 100644 --- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewAnalyzerTask.java +++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/NewAnalyzerTask.java @@ -20,7 +20,8 @@ import java.io.IOException; import java.io.StreamTokenizer; import java.io.StringReader; import java.lang.reflect.Constructor; -import java.util.*; +import java.util.ArrayList; +import java.util.List; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.benchmark.byTask.PerfRunData; import org.apache.lucene.benchmark.byTask.utils.AnalyzerFactory; diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsSegmentTermsEnum.java b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsSegmentTermsEnum.java index cbc245af1a8..d3107849ea1 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsSegmentTermsEnum.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/blocktreeords/OrdsSegmentTermsEnum.java @@ -16,9 +16,6 @@ */ package org.apache.lucene.codecs.blocktreeords; -// import java.io.*; -// import java.nio.charset.StandardCharsets; - import java.io.IOException; import java.io.PrintStream; import org.apache.lucene.codecs.BlockTermState; diff --git a/lucene/core/src/java/org/apache/lucene/document/Document.java b/lucene/core/src/java/org/apache/lucene/document/Document.java index 57061e2840d..49f7515018b 100644 --- a/lucene/core/src/java/org/apache/lucene/document/Document.java +++ b/lucene/core/src/java/org/apache/lucene/document/Document.java @@ -16,7 +16,10 @@ */ package org.apache.lucene.document; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; import org.apache.lucene.index.IndexReader; // for javadoc import org.apache.lucene.index.IndexableField; import org.apache.lucene.search.IndexSearcher; // for javadoc diff --git a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java index 0e8d7e2e22d..51be1b46578 100644 --- a/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java +++ b/lucene/core/src/java/org/apache/lucene/index/CheckIndex.java @@ -55,7 +55,12 @@ import org.apache.lucene.document.DocumentStoredFieldVisitor; import org.apache.lucene.index.CheckIndex.Status.DocValuesStatus; import org.apache.lucene.index.PointValues.IntersectVisitor; import org.apache.lucene.index.PointValues.Relation; -import org.apache.lucene.search.*; +import org.apache.lucene.search.DocIdSetIterator; +import org.apache.lucene.search.FieldExistsQuery; +import org.apache.lucene.search.LeafFieldComparator; +import org.apache.lucene.search.Sort; +import org.apache.lucene.search.SortField; +import org.apache.lucene.search.TopDocs; import org.apache.lucene.store.AlreadyClosedException; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; diff --git a/lucene/core/src/java/org/apache/lucene/index/CompositeReader.java b/lucene/core/src/java/org/apache/lucene/index/CompositeReader.java index 6c859f4bcb0..ccc454c5994 100644 --- a/lucene/core/src/java/org/apache/lucene/index/CompositeReader.java +++ b/lucene/core/src/java/org/apache/lucene/index/CompositeReader.java @@ -17,7 +17,7 @@ package org.apache.lucene.index; import java.util.List; -import org.apache.lucene.store.*; +import org.apache.lucene.store.Directory; /** * Instances of this reader type can only be used to get stored fields from the underlying diff --git a/lucene/core/src/java/org/apache/lucene/index/VectorSimilarityFunction.java b/lucene/core/src/java/org/apache/lucene/index/VectorSimilarityFunction.java index ad793facaeb..c69987dbb41 100644 --- a/lucene/core/src/java/org/apache/lucene/index/VectorSimilarityFunction.java +++ b/lucene/core/src/java/org/apache/lucene/index/VectorSimilarityFunction.java @@ -16,7 +16,10 @@ */ package org.apache.lucene.index; -import static org.apache.lucene.util.VectorUtil.*; +import static org.apache.lucene.util.VectorUtil.cosine; +import static org.apache.lucene.util.VectorUtil.dotProduct; +import static org.apache.lucene.util.VectorUtil.dotProductScore; +import static org.apache.lucene.util.VectorUtil.squareDistance; import org.apache.lucene.util.BytesRef; diff --git a/lucene/core/src/java/org/apache/lucene/search/PhrasePositions.java b/lucene/core/src/java/org/apache/lucene/search/PhrasePositions.java index a7864daeec0..be6892f19f4 100644 --- a/lucene/core/src/java/org/apache/lucene/search/PhrasePositions.java +++ b/lucene/core/src/java/org/apache/lucene/search/PhrasePositions.java @@ -17,7 +17,8 @@ package org.apache.lucene.search; import java.io.IOException; -import org.apache.lucene.index.*; +import org.apache.lucene.index.PostingsEnum; +import org.apache.lucene.index.Term; /** Position of a term in a document that takes into account the term offset within the phrase. */ final class PhrasePositions { diff --git a/lucene/core/src/java/org/apache/lucene/store/InputStreamDataInput.java b/lucene/core/src/java/org/apache/lucene/store/InputStreamDataInput.java index 803959711bc..8f83900be9f 100644 --- a/lucene/core/src/java/org/apache/lucene/store/InputStreamDataInput.java +++ b/lucene/core/src/java/org/apache/lucene/store/InputStreamDataInput.java @@ -16,7 +16,10 @@ */ package org.apache.lucene.store; -import java.io.*; +import java.io.Closeable; +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; /** A {@link DataInput} wrapping a plain {@link InputStream}. */ public class InputStreamDataInput extends DataInput implements Closeable { diff --git a/lucene/core/src/java/org/apache/lucene/store/OutputStreamDataOutput.java b/lucene/core/src/java/org/apache/lucene/store/OutputStreamDataOutput.java index 8b737e0f410..35534313c38 100644 --- a/lucene/core/src/java/org/apache/lucene/store/OutputStreamDataOutput.java +++ b/lucene/core/src/java/org/apache/lucene/store/OutputStreamDataOutput.java @@ -16,7 +16,9 @@ */ package org.apache.lucene.store; -import java.io.*; +import java.io.Closeable; +import java.io.IOException; +import java.io.OutputStream; /** A {@link DataOutput} wrapping a plain {@link OutputStream}. */ public class OutputStreamDataOutput extends DataOutput implements Closeable { diff --git a/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java b/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java index bf0669fca42..9a642338f09 100644 --- a/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java +++ b/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java @@ -29,7 +29,8 @@ package org.apache.lucene.util.automaton; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.StringHelper; diff --git a/lucene/core/src/java/org/apache/lucene/util/automaton/DaciukMihovAutomatonBuilder.java b/lucene/core/src/java/org/apache/lucene/util/automaton/DaciukMihovAutomatonBuilder.java index d96a88904d0..94002b04a40 100644 --- a/lucene/core/src/java/org/apache/lucene/util/automaton/DaciukMihovAutomatonBuilder.java +++ b/lucene/core/src/java/org/apache/lucene/util/automaton/DaciukMihovAutomatonBuilder.java @@ -16,7 +16,11 @@ */ package org.apache.lucene.util.automaton; -import java.util.*; +import java.util.Arrays; +import java.util.Collection; +import java.util.Comparator; +import java.util.HashMap; +import java.util.IdentityHashMap; import org.apache.lucene.util.ArrayUtil; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.CharsRef; diff --git a/lucene/core/src/test/org/apache/lucene/TestDemo.java b/lucene/core/src/test/org/apache/lucene/TestDemo.java index 0f64228a04c..349b47c074c 100644 --- a/lucene/core/src/test/org/apache/lucene/TestDemo.java +++ b/lucene/core/src/test/org/apache/lucene/TestDemo.java @@ -28,7 +28,11 @@ import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.IndexWriterConfig; import org.apache.lucene.index.Term; -import org.apache.lucene.search.*; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.PhraseQuery; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.search.TopDocs; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.tests.util.LuceneTestCase; diff --git a/lucene/core/src/test/org/apache/lucene/TestSearch.java b/lucene/core/src/test/org/apache/lucene/TestSearch.java index 727a571f9c0..40b9203bb42 100644 --- a/lucene/core/src/test/org/apache/lucene/TestSearch.java +++ b/lucene/core/src/test/org/apache/lucene/TestSearch.java @@ -21,11 +21,26 @@ import java.io.StringWriter; import java.util.ArrayList; import java.util.List; import java.util.Random; -import org.apache.lucene.analysis.*; -import org.apache.lucene.document.*; -import org.apache.lucene.index.*; -import org.apache.lucene.search.*; -import org.apache.lucene.store.*; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.document.Document; +import org.apache.lucene.document.Field; +import org.apache.lucene.document.NumericDocValuesField; +import org.apache.lucene.index.DirectoryReader; +import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.index.IndexWriterConfig; +import org.apache.lucene.index.MergePolicy; +import org.apache.lucene.index.Term; +import org.apache.lucene.search.BooleanClause; +import org.apache.lucene.search.BooleanQuery; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.PhraseQuery; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.ScoreDoc; +import org.apache.lucene.search.Sort; +import org.apache.lucene.search.SortField; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.store.Directory; import org.apache.lucene.tests.analysis.MockAnalyzer; import org.apache.lucene.tests.util.LuceneTestCase; diff --git a/lucene/core/src/test/org/apache/lucene/analysis/TestCharArrayMap.java b/lucene/core/src/test/org/apache/lucene/analysis/TestCharArrayMap.java index 625da794325..43b6d20d683 100644 --- a/lucene/core/src/test/org/apache/lucene/analysis/TestCharArrayMap.java +++ b/lucene/core/src/test/org/apache/lucene/analysis/TestCharArrayMap.java @@ -16,7 +16,11 @@ */ package org.apache.lucene.analysis; -import java.util.*; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Locale; +import java.util.Map; import org.apache.lucene.tests.util.LuceneTestCase; public class TestCharArrayMap extends LuceneTestCase { diff --git a/lucene/core/src/test/org/apache/lucene/analysis/TestCharArraySet.java b/lucene/core/src/test/org/apache/lucene/analysis/TestCharArraySet.java index b668be04478..7d432c22c25 100644 --- a/lucene/core/src/test/org/apache/lucene/analysis/TestCharArraySet.java +++ b/lucene/core/src/test/org/apache/lucene/analysis/TestCharArraySet.java @@ -16,7 +16,13 @@ */ package org.apache.lucene.analysis; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Set; import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.lucene.util.SuppressForbidden; diff --git a/lucene/core/src/test/org/apache/lucene/document/TestDateTools.java b/lucene/core/src/test/org/apache/lucene/document/TestDateTools.java index 8c2c22f8b6a..27db5162295 100644 --- a/lucene/core/src/test/org/apache/lucene/document/TestDateTools.java +++ b/lucene/core/src/test/org/apache/lucene/document/TestDateTools.java @@ -18,7 +18,11 @@ package org.apache.lucene.document; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.*; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.Locale; +import java.util.TimeZone; import org.apache.lucene.tests.util.LuceneTestCase; public class TestDateTools extends LuceneTestCase { diff --git a/lucene/core/src/test/org/apache/lucene/document/TestManyKnnDocs.java b/lucene/core/src/test/org/apache/lucene/document/TestManyKnnDocs.java index 5eb419fef8f..fff801d5547 100644 --- a/lucene/core/src/test/org/apache/lucene/document/TestManyKnnDocs.java +++ b/lucene/core/src/test/org/apache/lucene/document/TestManyKnnDocs.java @@ -17,7 +17,11 @@ package org.apache.lucene.document; import com.carrotsearch.randomizedtesting.annotations.TimeoutSuite; -import org.apache.lucene.index.*; +import org.apache.lucene.index.DirectoryReader; +import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.index.IndexWriterConfig; +import org.apache.lucene.index.TieredMergePolicy; +import org.apache.lucene.index.VectorSimilarityFunction; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.KnnVectorQuery; import org.apache.lucene.search.TopDocs; diff --git a/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java b/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java index 420abe06ad0..ac853c36ead 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestCheckIndex.java @@ -18,7 +18,15 @@ package org.apache.lucene.index; import java.io.ByteArrayOutputStream; import java.io.IOException; -import org.apache.lucene.document.*; +import org.apache.lucene.document.BinaryPoint; +import org.apache.lucene.document.Document; +import org.apache.lucene.document.Field; +import org.apache.lucene.document.FieldType; +import org.apache.lucene.document.KnnVectorField; +import org.apache.lucene.document.NumericDocValuesField; +import org.apache.lucene.document.StoredField; +import org.apache.lucene.document.StringField; +import org.apache.lucene.document.TextField; import org.apache.lucene.search.MatchAllDocsQuery; import org.apache.lucene.search.Sort; import org.apache.lucene.search.SortField; diff --git a/lucene/core/src/test/org/apache/lucene/index/TestExitableDirectoryReader.java b/lucene/core/src/test/org/apache/lucene/index/TestExitableDirectoryReader.java index 37d7c55d7d8..eed079a8bfe 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestExitableDirectoryReader.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestExitableDirectoryReader.java @@ -20,7 +20,17 @@ import static com.carrotsearch.randomizedtesting.RandomizedTest.atMost; import java.io.IOException; import java.util.Arrays; -import org.apache.lucene.document.*; +import org.apache.lucene.document.BinaryDocValuesField; +import org.apache.lucene.document.Document; +import org.apache.lucene.document.Field; +import org.apache.lucene.document.FieldType; +import org.apache.lucene.document.IntPoint; +import org.apache.lucene.document.KnnVectorField; +import org.apache.lucene.document.NumericDocValuesField; +import org.apache.lucene.document.SortedDocValuesField; +import org.apache.lucene.document.SortedNumericDocValuesField; +import org.apache.lucene.document.SortedSetDocValuesField; +import org.apache.lucene.document.StringField; import org.apache.lucene.index.ExitableDirectoryReader.ExitingReaderException; import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.IndexSearcher; diff --git a/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java b/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java index 88b848fdb54..7a240cef079 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java @@ -19,7 +19,8 @@ package org.apache.lucene.index; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.file.Path; -import java.util.*; +import java.util.HashMap; +import java.util.List; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.lucene.document.Document; import org.apache.lucene.document.DocumentStoredFieldVisitor; diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterCommit.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterCommit.java index 600dbbec870..ff13703eb5d 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterCommit.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriterCommit.java @@ -21,7 +21,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.lucene.analysis.*; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriterConfig.OpenMode; diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIsCurrent.java b/lucene/core/src/test/org/apache/lucene/index/TestIsCurrent.java index 6414492d525..78ba8f44f92 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestIsCurrent.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestIsCurrent.java @@ -19,7 +19,7 @@ package org.apache.lucene.index; import java.io.IOException; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import org.apache.lucene.store.*; +import org.apache.lucene.store.Directory; import org.apache.lucene.tests.index.RandomIndexWriter; import org.apache.lucene.tests.util.LuceneTestCase; import org.junit.Test; diff --git a/lucene/core/src/test/org/apache/lucene/index/TestLazyProxSkipping.java b/lucene/core/src/test/org/apache/lucene/index/TestLazyProxSkipping.java index 61c563bdbf9..d6c84895152 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestLazyProxSkipping.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestLazyProxSkipping.java @@ -17,7 +17,7 @@ package org.apache.lucene.index; import java.io.IOException; -import org.apache.lucene.analysis.*; +import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.search.IndexSearcher; diff --git a/lucene/core/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java b/lucene/core/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java index ea948c7b33e..a0d14f50705 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestMultiLevelSkipList.java @@ -18,7 +18,10 @@ package org.apache.lucene.index; import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.lucene.analysis.*; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.analysis.TokenFilter; +import org.apache.lucene.analysis.TokenStream; +import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.tokenattributes.PayloadAttribute; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; diff --git a/lucene/core/src/test/org/apache/lucene/index/TestParallelLeafReader.java b/lucene/core/src/test/org/apache/lucene/index/TestParallelLeafReader.java index ca6f26c78fd..170c86097cf 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestParallelLeafReader.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestParallelLeafReader.java @@ -21,8 +21,14 @@ import java.util.Random; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.NumericDocValuesField; -import org.apache.lucene.search.*; import org.apache.lucene.search.BooleanClause.Occur; +import org.apache.lucene.search.BooleanQuery; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.ScoreDoc; +import org.apache.lucene.search.Sort; +import org.apache.lucene.search.SortField; +import org.apache.lucene.search.TermQuery; import org.apache.lucene.store.AlreadyClosedException; import org.apache.lucene.store.Directory; import org.apache.lucene.tests.analysis.MockAnalyzer; diff --git a/lucene/core/src/test/org/apache/lucene/index/TestRollingUpdates.java b/lucene/core/src/test/org/apache/lucene/index/TestRollingUpdates.java index c16ef947f68..a1b70deba66 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestRollingUpdates.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestRollingUpdates.java @@ -19,17 +19,18 @@ package org.apache.lucene.index; import java.util.Random; import org.apache.lucene.codecs.Codec; import org.apache.lucene.codecs.memory.DirectPostingsFormat; -import org.apache.lucene.document.*; +import org.apache.lucene.document.Document; +import org.apache.lucene.document.Field; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.TermQuery; import org.apache.lucene.search.TopDocs; -import org.apache.lucene.store.*; +import org.apache.lucene.store.Directory; import org.apache.lucene.tests.analysis.MockAnalyzer; import org.apache.lucene.tests.store.BaseDirectoryWrapper; import org.apache.lucene.tests.util.LineFileDocs; import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.lucene.tests.util.TestUtil; -import org.apache.lucene.util.*; +import org.apache.lucene.util.BytesRef; import org.junit.Test; public class TestRollingUpdates extends LuceneTestCase { diff --git a/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing.java b/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing.java index ae921e83734..33e58cc7b13 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestStressIndexing.java @@ -16,9 +16,10 @@ */ package org.apache.lucene.index; -import org.apache.lucene.document.*; +import org.apache.lucene.document.Document; +import org.apache.lucene.document.Field; import org.apache.lucene.index.IndexWriterConfig.OpenMode; -import org.apache.lucene.store.*; +import org.apache.lucene.store.Directory; import org.apache.lucene.tests.analysis.MockAnalyzer; import org.apache.lucene.tests.store.MockDirectoryWrapper; import org.apache.lucene.tests.util.English; diff --git a/lucene/core/src/test/org/apache/lucene/index/TestTermVectorsReader.java b/lucene/core/src/test/org/apache/lucene/index/TestTermVectorsReader.java index 64bf38faf38..76693291518 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestTermVectorsReader.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestTermVectorsReader.java @@ -19,7 +19,8 @@ package org.apache.lucene.index; import java.io.IOException; import java.util.Arrays; import java.util.Random; -import org.apache.lucene.analysis.*; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; diff --git a/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java b/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java index 50db97ec3f9..ddca01a2387 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestTermsEnum2.java @@ -38,7 +38,11 @@ import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.lucene.tests.util.TestUtil; import org.apache.lucene.tests.util.automaton.AutomatonTestUtil; import org.apache.lucene.util.BytesRef; -import org.apache.lucene.util.automaton.*; +import org.apache.lucene.util.automaton.Automata; +import org.apache.lucene.util.automaton.Automaton; +import org.apache.lucene.util.automaton.CompiledAutomaton; +import org.apache.lucene.util.automaton.Operations; +import org.apache.lucene.util.automaton.RegExp; public class TestTermsEnum2 extends LuceneTestCase { private Directory dir; diff --git a/lucene/core/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java b/lucene/core/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java index 91403717d97..76931cfc325 100644 --- a/lucene/core/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java +++ b/lucene/core/src/test/org/apache/lucene/search/TestMultiThreadTermVectors.java @@ -17,7 +17,10 @@ package org.apache.lucene.search; import java.io.IOException; -import org.apache.lucene.document.*; +import org.apache.lucene.document.Document; +import org.apache.lucene.document.Field; +import org.apache.lucene.document.FieldType; +import org.apache.lucene.document.TextField; import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.Fields; import org.apache.lucene.index.IndexReader; diff --git a/lucene/core/src/test/org/apache/lucene/store/TestByteBuffersDataInput.java b/lucene/core/src/test/org/apache/lucene/store/TestByteBuffersDataInput.java index 17bba528db6..446cadee0ec 100644 --- a/lucene/core/src/test/org/apache/lucene/store/TestByteBuffersDataInput.java +++ b/lucene/core/src/test/org/apache/lucene/store/TestByteBuffersDataInput.java @@ -16,7 +16,8 @@ */ package org.apache.lucene.store; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import com.carrotsearch.randomizedtesting.RandomizedTest; import com.carrotsearch.randomizedtesting.Xoroshiro128PlusRandom; diff --git a/lucene/core/src/test/org/apache/lucene/util/TestAttributeSource.java b/lucene/core/src/test/org/apache/lucene/util/TestAttributeSource.java index ea403e1fd9f..cf7a244a784 100644 --- a/lucene/core/src/test/org/apache/lucene/util/TestAttributeSource.java +++ b/lucene/core/src/test/org/apache/lucene/util/TestAttributeSource.java @@ -20,7 +20,18 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.apache.lucene.analysis.TokenStream; -import org.apache.lucene.analysis.tokenattributes.*; +import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; +import org.apache.lucene.analysis.tokenattributes.CharTermAttributeImpl; +import org.apache.lucene.analysis.tokenattributes.FlagsAttribute; +import org.apache.lucene.analysis.tokenattributes.FlagsAttributeImpl; +import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; +import org.apache.lucene.analysis.tokenattributes.OffsetAttributeImpl; +import org.apache.lucene.analysis.tokenattributes.PayloadAttribute; +import org.apache.lucene.analysis.tokenattributes.PayloadAttributeImpl; +import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; +import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttributeImpl; +import org.apache.lucene.analysis.tokenattributes.TypeAttribute; +import org.apache.lucene.analysis.tokenattributes.TypeAttributeImpl; import org.apache.lucene.tests.analysis.Token; import org.apache.lucene.tests.util.LuceneTestCase; diff --git a/lucene/core/src/test/org/apache/lucene/util/TestBytesRefArray.java b/lucene/core/src/test/org/apache/lucene/util/TestBytesRefArray.java index d0cc3d3c2d3..95ff5254742 100644 --- a/lucene/core/src/test/org/apache/lucene/util/TestBytesRefArray.java +++ b/lucene/core/src/test/org/apache/lucene/util/TestBytesRefArray.java @@ -17,7 +17,11 @@ package org.apache.lucene.util; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Random; import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.lucene.tests.util.TestUtil; diff --git a/lucene/core/src/test/org/apache/lucene/util/TestPagedBytes.java b/lucene/core/src/test/org/apache/lucene/util/TestPagedBytes.java index 0163ed4f6bd..5e670a0125c 100644 --- a/lucene/core/src/test/org/apache/lucene/util/TestPagedBytes.java +++ b/lucene/core/src/test/org/apache/lucene/util/TestPagedBytes.java @@ -17,7 +17,8 @@ package org.apache.lucene.util; import java.io.IOException; -import java.util.*; +import java.util.Arrays; +import java.util.Random; import org.apache.lucene.store.DataInput; import org.apache.lucene.store.DataOutput; import org.apache.lucene.store.IOContext; diff --git a/lucene/core/src/test/org/apache/lucene/util/TestRamUsageEstimator.java b/lucene/core/src/test/org/apache/lucene/util/TestRamUsageEstimator.java index abdc408f385..bb0bba8ffd1 100644 --- a/lucene/core/src/test/org/apache/lucene/util/TestRamUsageEstimator.java +++ b/lucene/core/src/test/org/apache/lucene/util/TestRamUsageEstimator.java @@ -17,7 +17,18 @@ package org.apache.lucene.util; import static org.apache.lucene.tests.util.RamUsageTester.ramUsed; -import static org.apache.lucene.util.RamUsageEstimator.*; +import static org.apache.lucene.util.RamUsageEstimator.COMPRESSED_REFS_ENABLED; +import static org.apache.lucene.util.RamUsageEstimator.HOTSPOT_BEAN_CLASS; +import static org.apache.lucene.util.RamUsageEstimator.JVM_IS_HOTSPOT_64BIT; +import static org.apache.lucene.util.RamUsageEstimator.LONG_SIZE; +import static org.apache.lucene.util.RamUsageEstimator.MANAGEMENT_FACTORY_CLASS; +import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_ARRAY_HEADER; +import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_OBJECT_ALIGNMENT; +import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_OBJECT_HEADER; +import static org.apache.lucene.util.RamUsageEstimator.NUM_BYTES_OBJECT_REF; +import static org.apache.lucene.util.RamUsageEstimator.shallowSizeOf; +import static org.apache.lucene.util.RamUsageEstimator.shallowSizeOfInstance; +import static org.apache.lucene.util.RamUsageEstimator.sizeOf; import java.util.ArrayList; import java.util.Arrays; diff --git a/lucene/core/src/test/org/apache/lucene/util/automaton/TestOperations.java b/lucene/core/src/test/org/apache/lucene/util/automaton/TestOperations.java index 495d8f528af..8875bf8c771 100644 --- a/lucene/core/src/test/org/apache/lucene/util/automaton/TestOperations.java +++ b/lucene/core/src/test/org/apache/lucene/util/automaton/TestOperations.java @@ -19,11 +19,18 @@ package org.apache.lucene.util.automaton; import static org.apache.lucene.util.automaton.Operations.DEFAULT_DETERMINIZE_WORK_LIMIT; import com.carrotsearch.randomizedtesting.generators.RandomNumbers; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.lucene.tests.util.TestUtil; import org.apache.lucene.tests.util.automaton.AutomatonTestUtil; -import org.apache.lucene.util.*; +import org.apache.lucene.util.BytesRef; +import org.apache.lucene.util.IntsRef; +import org.apache.lucene.util.UnicodeUtil; public class TestOperations extends LuceneTestCase { /** Test string union. */ diff --git a/lucene/distribution.tests/src/test/org/apache/lucene/distribution/Sync.java b/lucene/distribution.tests/src/test/org/apache/lucene/distribution/Sync.java index e37f422ad43..cf8b414ac2d 100644 --- a/lucene/distribution.tests/src/test/org/apache/lucene/distribution/Sync.java +++ b/lucene/distribution.tests/src/test/org/apache/lucene/distribution/Sync.java @@ -18,9 +18,16 @@ package org.apache.lucene.distribution; import java.io.IOException; import java.io.UncheckedIOException; -import java.nio.file.*; +import java.nio.file.DirectoryStream; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.StandardCopyOption; import java.nio.file.attribute.BasicFileAttributes; -import java.util.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; import java.util.stream.Collectors; final class Sync { diff --git a/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/LukeMain.java b/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/LukeMain.java index de51c7b9bff..556420d71cc 100644 --- a/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/LukeMain.java +++ b/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/LukeMain.java @@ -19,14 +19,15 @@ package org.apache.lucene.luke.app.desktop; import static org.apache.lucene.luke.app.desktop.util.ExceptionHandler.handle; -import java.awt.*; +import java.awt.GraphicsEnvironment; import java.lang.invoke.MethodHandles; import java.util.Arrays; import java.util.concurrent.SynchronousQueue; import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; -import javax.swing.*; +import javax.swing.JFrame; +import javax.swing.UIManager; import org.apache.lucene.luke.app.desktop.components.LukeWindowProvider; import org.apache.lucene.luke.app.desktop.components.dialog.menubar.OpenIndexDialogFactory; import org.apache.lucene.luke.app.desktop.util.DialogOpener; diff --git a/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/components/LogsPanelProvider.java b/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/components/LogsPanelProvider.java index 400524d46cd..2124ffd7d6c 100644 --- a/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/components/LogsPanelProvider.java +++ b/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/components/LogsPanelProvider.java @@ -17,7 +17,10 @@ package org.apache.lucene.luke.app.desktop.components; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.Insets; +import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.StringSelection; import java.awt.event.HierarchyEvent; @@ -26,7 +29,14 @@ import java.util.Objects; import java.util.function.Function; import java.util.logging.Level; import java.util.stream.Collectors; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; import org.apache.lucene.luke.app.desktop.util.FontUtils; import org.apache.lucene.luke.app.desktop.util.MessageUtils; import org.apache.lucene.luke.util.CircularLogBufferHandler; diff --git a/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/components/LukeWindowProvider.java b/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/components/LukeWindowProvider.java index a7a46a825ba..5bcade4921a 100644 --- a/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/components/LukeWindowProvider.java +++ b/lucene/luke/src/java/org/apache/lucene/luke/app/desktop/components/LukeWindowProvider.java @@ -17,9 +17,21 @@ package org.apache.lucene.luke.app.desktop.components; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; import java.io.IOException; -import javax.swing.*; +import javax.swing.BorderFactory; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JMenuBar; +import javax.swing.JPanel; +import javax.swing.JTabbedPane; +import javax.swing.WindowConstants; import org.apache.lucene.luke.app.DirectoryHandler; import org.apache.lucene.luke.app.DirectoryObserver; import org.apache.lucene.luke.app.IndexHandler; diff --git a/lucene/luke/src/java/org/apache/lucene/luke/models/util/IndexUtils.java b/lucene/luke/src/java/org/apache/lucene/luke/models/util/IndexUtils.java index e616116114d..cab0bf5c04e 100644 --- a/lucene/luke/src/java/org/apache/lucene/luke/models/util/IndexUtils.java +++ b/lucene/luke/src/java/org/apache/lucene/luke/models/util/IndexUtils.java @@ -41,7 +41,29 @@ import java.util.stream.StreamSupport; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.core.WhitespaceAnalyzer; import org.apache.lucene.codecs.CodecUtil; -import org.apache.lucene.index.*; +import org.apache.lucene.index.BinaryDocValues; +import org.apache.lucene.index.CheckIndex; +import org.apache.lucene.index.DirectoryReader; +import org.apache.lucene.index.FieldInfo; +import org.apache.lucene.index.FieldInfos; +import org.apache.lucene.index.IndexCommit; +import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.IndexWriter; +import org.apache.lucene.index.IndexWriterConfig; +import org.apache.lucene.index.KeepOnlyLastCommitDeletionPolicy; +import org.apache.lucene.index.LeafReader; +import org.apache.lucene.index.MultiBits; +import org.apache.lucene.index.MultiDocValues; +import org.apache.lucene.index.MultiReader; +import org.apache.lucene.index.MultiTerms; +import org.apache.lucene.index.NoDeletionPolicy; +import org.apache.lucene.index.NumericDocValues; +import org.apache.lucene.index.SegmentInfos; +import org.apache.lucene.index.SortedDocValues; +import org.apache.lucene.index.SortedNumericDocValues; +import org.apache.lucene.index.SortedSetDocValues; +import org.apache.lucene.index.Terms; +import org.apache.lucene.index.TermsEnum; import org.apache.lucene.luke.util.LoggerFactory; import org.apache.lucene.store.Directory; import org.apache.lucene.store.FSDirectory; diff --git a/lucene/monitor/src/java/org/apache/lucene/monitor/HighlightsMatch.java b/lucene/monitor/src/java/org/apache/lucene/monitor/HighlightsMatch.java index 6092a5992a1..aadcc75fb6e 100644 --- a/lucene/monitor/src/java/org/apache/lucene/monitor/HighlightsMatch.java +++ b/lucene/monitor/src/java/org/apache/lucene/monitor/HighlightsMatch.java @@ -18,7 +18,13 @@ package org.apache.lucene.monitor; import java.io.IOException; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.search.Matches; import org.apache.lucene.search.MatchesIterator; diff --git a/lucene/monitor/src/java/org/apache/lucene/monitor/MatchingQueries.java b/lucene/monitor/src/java/org/apache/lucene/monitor/MatchingQueries.java index 3d4bd12ee4e..e13c47bc0d9 100644 --- a/lucene/monitor/src/java/org/apache/lucene/monitor/MatchingQueries.java +++ b/lucene/monitor/src/java/org/apache/lucene/monitor/MatchingQueries.java @@ -17,7 +17,9 @@ package org.apache.lucene.monitor; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.Map; /** * Class to hold the results of matching a single {@link org.apache.lucene.document.Document} diff --git a/lucene/monitor/src/java/org/apache/lucene/monitor/QueryIndex.java b/lucene/monitor/src/java/org/apache/lucene/monitor/QueryIndex.java index 3c40100ec08..a8ccd44218b 100644 --- a/lucene/monitor/src/java/org/apache/lucene/monitor/QueryIndex.java +++ b/lucene/monitor/src/java/org/apache/lucene/monitor/QueryIndex.java @@ -19,10 +19,25 @@ package org.apache.lucene.monitor; import java.io.Closeable; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import java.util.function.BiPredicate; -import org.apache.lucene.index.*; -import org.apache.lucene.search.*; +import org.apache.lucene.index.BinaryDocValues; +import org.apache.lucene.index.FieldInfo; +import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.LeafReaderContext; +import org.apache.lucene.index.SortedDocValues; +import org.apache.lucene.index.Term; +import org.apache.lucene.index.Terms; +import org.apache.lucene.index.TermsEnum; +import org.apache.lucene.search.MatchAllDocsQuery; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.Scorable; +import org.apache.lucene.search.ScoreMode; +import org.apache.lucene.search.SearcherManager; +import org.apache.lucene.search.TermQuery; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRefHash; diff --git a/lucene/monitor/src/java/org/apache/lucene/monitor/WritableQueryIndex.java b/lucene/monitor/src/java/org/apache/lucene/monitor/WritableQueryIndex.java index f4d7fa51c5e..d71e3729fa5 100644 --- a/lucene/monitor/src/java/org/apache/lucene/monitor/WritableQueryIndex.java +++ b/lucene/monitor/src/java/org/apache/lucene/monitor/WritableQueryIndex.java @@ -18,18 +18,33 @@ package org.apache.lucene.monitor; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; -import org.apache.lucene.document.*; +import org.apache.lucene.document.BinaryDocValuesField; +import org.apache.lucene.document.Document; +import org.apache.lucene.document.Field; +import org.apache.lucene.document.SortedDocValuesField; +import org.apache.lucene.document.StringField; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.Term; -import org.apache.lucene.search.*; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.MatchAllDocsQuery; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.Scorable; +import org.apache.lucene.search.ScoreMode; +import org.apache.lucene.search.SearcherManager; +import org.apache.lucene.search.SimpleCollector; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.IOUtils; import org.apache.lucene.util.NamedThreadFactory; diff --git a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IDFValueSource.java b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IDFValueSource.java index f73661e856a..003200a87ea 100644 --- a/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IDFValueSource.java +++ b/lucene/queries/src/java/org/apache/lucene/queries/function/valuesource/IDFValueSource.java @@ -18,7 +18,8 @@ package org.apache.lucene.queries.function.valuesource; import java.io.IOException; import java.util.Map; -import org.apache.lucene.index.*; +import org.apache.lucene.index.LeafReaderContext; +import org.apache.lucene.index.Term; import org.apache.lucene.queries.function.FunctionValues; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.search.similarities.PerFieldSimilarityWrapper; diff --git a/lucene/queries/src/test/org/apache/lucene/queries/function/TestSortedSetFieldSource.java b/lucene/queries/src/test/org/apache/lucene/queries/function/TestSortedSetFieldSource.java index 7b2a0acd277..27bd2192a9d 100644 --- a/lucene/queries/src/test/org/apache/lucene/queries/function/TestSortedSetFieldSource.java +++ b/lucene/queries/src/test/org/apache/lucene/queries/function/TestSortedSetFieldSource.java @@ -24,7 +24,12 @@ import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.LeafReader; import org.apache.lucene.queries.function.valuesource.SortedSetFieldSource; -import org.apache.lucene.search.*; +import org.apache.lucene.search.DocIdSetIterator; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.MatchAllDocsQuery; +import org.apache.lucene.search.ScoreMode; +import org.apache.lucene.search.SortField; +import org.apache.lucene.search.SortedSetSortField; import org.apache.lucene.store.Directory; import org.apache.lucene.tests.util.LuceneTestCase; import org.apache.lucene.util.BytesRef; diff --git a/lucene/queries/src/test/org/apache/lucene/queries/intervals/TestDisjunctionRewrites.java b/lucene/queries/src/test/org/apache/lucene/queries/intervals/TestDisjunctionRewrites.java index 759cef5da9b..ef85a9ca651 100644 --- a/lucene/queries/src/test/org/apache/lucene/queries/intervals/TestDisjunctionRewrites.java +++ b/lucene/queries/src/test/org/apache/lucene/queries/intervals/TestDisjunctionRewrites.java @@ -17,7 +17,17 @@ package org.apache.lucene.queries.intervals; -import static org.apache.lucene.queries.intervals.Intervals.*; +import static org.apache.lucene.queries.intervals.Intervals.containedBy; +import static org.apache.lucene.queries.intervals.Intervals.containing; +import static org.apache.lucene.queries.intervals.Intervals.fixField; +import static org.apache.lucene.queries.intervals.Intervals.maxgaps; +import static org.apache.lucene.queries.intervals.Intervals.maxwidth; +import static org.apache.lucene.queries.intervals.Intervals.notContainedBy; +import static org.apache.lucene.queries.intervals.Intervals.notContaining; +import static org.apache.lucene.queries.intervals.Intervals.or; +import static org.apache.lucene.queries.intervals.Intervals.ordered; +import static org.apache.lucene.queries.intervals.Intervals.phrase; +import static org.apache.lucene.queries.intervals.Intervals.term; import org.apache.lucene.tests.util.LuceneTestCase; diff --git a/lucene/queries/src/test/org/apache/lucene/queries/payloads/PayloadHelper.java b/lucene/queries/src/test/org/apache/lucene/queries/payloads/PayloadHelper.java index d861f808cb2..79316ce2b61 100644 --- a/lucene/queries/src/test/org/apache/lucene/queries/payloads/PayloadHelper.java +++ b/lucene/queries/src/test/org/apache/lucene/queries/payloads/PayloadHelper.java @@ -18,7 +18,10 @@ package org.apache.lucene.queries.payloads; import java.io.IOException; import java.util.Random; -import org.apache.lucene.analysis.*; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.analysis.TokenFilter; +import org.apache.lucene.analysis.TokenStream; +import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.tokenattributes.PayloadAttribute; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; diff --git a/lucene/queries/src/test/org/apache/lucene/queries/spans/TestBasics.java b/lucene/queries/src/test/org/apache/lucene/queries/spans/TestBasics.java index 6041e6abc3a..f53313a1bda 100644 --- a/lucene/queries/src/test/org/apache/lucene/queries/spans/TestBasics.java +++ b/lucene/queries/src/test/org/apache/lucene/queries/spans/TestBasics.java @@ -16,11 +16,17 @@ */ package org.apache.lucene.queries.spans; -import static org.apache.lucene.queries.spans.SpanTestUtil.*; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanFirstQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanNearOrderedQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanNearUnorderedQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanNotQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanOrQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanPositionRangeQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanTermQuery; import java.io.IOException; import java.util.Arrays; -import org.apache.lucene.analysis.*; +import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.TextField; diff --git a/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanContainQuery.java b/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanContainQuery.java index 8ee815781a4..709fbc17840 100644 --- a/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanContainQuery.java +++ b/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanContainQuery.java @@ -16,7 +16,13 @@ */ package org.apache.lucene.queries.spans; -import static org.apache.lucene.queries.spans.SpanTestUtil.*; +import static org.apache.lucene.queries.spans.SpanTestUtil.assertFinished; +import static org.apache.lucene.queries.spans.SpanTestUtil.assertNext; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanContainingQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanNearOrderedQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanOrQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanTermQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanWithinQuery; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; diff --git a/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanExplanations.java b/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanExplanations.java index 1a1e2a7126d..4610ff27702 100644 --- a/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanExplanations.java +++ b/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanExplanations.java @@ -26,8 +26,17 @@ import org.apache.lucene.index.DirectoryReader; import org.apache.lucene.index.IndexWriter; import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.Term; -import org.apache.lucene.search.*; import org.apache.lucene.search.BooleanClause.Occur; +import org.apache.lucene.search.BooleanQuery; +import org.apache.lucene.search.BoostQuery; +import org.apache.lucene.search.ConstantScoreQuery; +import org.apache.lucene.search.DisjunctionMaxQuery; +import org.apache.lucene.search.Explanation; +import org.apache.lucene.search.IndexSearcher; +import org.apache.lucene.search.PhraseQuery; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.ScoreMode; +import org.apache.lucene.search.TermQuery; import org.apache.lucene.store.Directory; /** TestExplanations subclass focusing on span queries */ diff --git a/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanFirstQuery.java b/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanFirstQuery.java index 5a38c07f233..20d563171dd 100644 --- a/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanFirstQuery.java +++ b/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanFirstQuery.java @@ -16,7 +16,9 @@ */ package org.apache.lucene.queries.spans; -import static org.apache.lucene.queries.spans.SpanTestUtil.*; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanFirstQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanNotQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanTermQuery; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.document.Document; diff --git a/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanSearchEquivalence.java b/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanSearchEquivalence.java index 77444ac73cb..3127aeaf364 100644 --- a/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanSearchEquivalence.java +++ b/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpanSearchEquivalence.java @@ -16,7 +16,7 @@ */ package org.apache.lucene.queries.spans; -import static org.apache.lucene.queries.spans.SpanTestUtil.*; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanQuery; import org.apache.lucene.index.Term; import org.apache.lucene.search.BooleanClause.Occur; diff --git a/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpansEnum.java b/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpansEnum.java index 4a0791b50bd..1b14dd044ff 100644 --- a/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpansEnum.java +++ b/lucene/queries/src/test/org/apache/lucene/queries/spans/TestSpansEnum.java @@ -16,7 +16,9 @@ */ package org.apache.lucene.queries.spans; -import static org.apache.lucene.queries.spans.SpanTestUtil.*; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanNotQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanOrQuery; +import static org.apache.lucene.queries.spans.SpanTestUtil.spanTermQuery; import java.io.IOException; import org.apache.lucene.document.Document; diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/charstream/FastCharStream.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/charstream/FastCharStream.java index 649ecf362be..968021c405d 100644 --- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/charstream/FastCharStream.java +++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/charstream/FastCharStream.java @@ -16,7 +16,9 @@ */ package org.apache.lucene.queryparser.charstream; -import java.io.*; +import java.io.IOException; +import java.io.Reader; +import java.io.UncheckedIOException; /** * An efficient implementation of JavaCC's CharStream interface. diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java index e303d1fd993..a59e0a1a7b9 100644 --- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java +++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/classic/QueryParserBase.java @@ -20,7 +20,13 @@ import static org.apache.lucene.util.automaton.Operations.DEFAULT_DETERMINIZE_WO import java.io.StringReader; import java.text.DateFormat; -import java.util.*; +import java.util.Calendar; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.lucene.analysis.Analyzer; @@ -30,9 +36,22 @@ import org.apache.lucene.queryparser.charstream.CharStream; import org.apache.lucene.queryparser.charstream.FastCharStream; import org.apache.lucene.queryparser.classic.QueryParser.Operator; import org.apache.lucene.queryparser.flexible.standard.CommonQueryParserConfiguration; -import org.apache.lucene.search.*; +import org.apache.lucene.search.BooleanClause; import org.apache.lucene.search.BooleanClause.Occur; +import org.apache.lucene.search.BooleanQuery; +import org.apache.lucene.search.BoostQuery; +import org.apache.lucene.search.FuzzyQuery; import org.apache.lucene.search.IndexSearcher.TooManyClauses; +import org.apache.lucene.search.MatchAllDocsQuery; +import org.apache.lucene.search.MultiPhraseQuery; +import org.apache.lucene.search.MultiTermQuery; +import org.apache.lucene.search.PhraseQuery; +import org.apache.lucene.search.PrefixQuery; +import org.apache.lucene.search.Query; +import org.apache.lucene.search.RegexpQuery; +import org.apache.lucene.search.TermQuery; +import org.apache.lucene.search.TermRangeQuery; +import org.apache.lucene.search.WildcardQuery; import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRefBuilder; import org.apache.lucene.util.QueryBuilder; diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/processors/NoChildOptimizationQueryNodeProcessor.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/processors/NoChildOptimizationQueryNodeProcessor.java index 9f3649ad11d..9ec2d4e97f5 100644 --- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/processors/NoChildOptimizationQueryNodeProcessor.java +++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/processors/NoChildOptimizationQueryNodeProcessor.java @@ -18,7 +18,13 @@ package org.apache.lucene.queryparser.flexible.core.processors; import java.util.List; import org.apache.lucene.queryparser.flexible.core.QueryNodeException; -import org.apache.lucene.queryparser.flexible.core.nodes.*; +import org.apache.lucene.queryparser.flexible.core.nodes.BooleanQueryNode; +import org.apache.lucene.queryparser.flexible.core.nodes.BoostQueryNode; +import org.apache.lucene.queryparser.flexible.core.nodes.DeletedQueryNode; +import org.apache.lucene.queryparser.flexible.core.nodes.MatchNoDocsQueryNode; +import org.apache.lucene.queryparser.flexible.core.nodes.ModifierQueryNode; +import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode; +import org.apache.lucene.queryparser.flexible.core.nodes.TokenizedPhraseQueryNode; /** * A {@link NoChildOptimizationQueryNodeProcessor} removes every BooleanQueryNode, BoostQueryNode, diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/processors/QueryNodeProcessorPipeline.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/processors/QueryNodeProcessorPipeline.java index d08db31d438..dcd2b8f5e03 100644 --- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/processors/QueryNodeProcessorPipeline.java +++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/core/processors/QueryNodeProcessorPipeline.java @@ -16,7 +16,11 @@ */ package org.apache.lucene.queryparser.flexible.core.processors; -import java.util.*; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.ListIterator; import org.apache.lucene.queryparser.flexible.core.QueryNodeException; import org.apache.lucene.queryparser.flexible.core.config.QueryConfigHandler; import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode; diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/precedence/processors/BooleanModifiersQueryNodeProcessor.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/precedence/processors/BooleanModifiersQueryNodeProcessor.java index 084ca146fc8..fc7332efc50 100644 --- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/precedence/processors/BooleanModifiersQueryNodeProcessor.java +++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/flexible/precedence/processors/BooleanModifiersQueryNodeProcessor.java @@ -19,8 +19,12 @@ package org.apache.lucene.queryparser.flexible.precedence.processors; import java.util.ArrayList; import java.util.List; import org.apache.lucene.queryparser.flexible.core.QueryNodeException; -import org.apache.lucene.queryparser.flexible.core.nodes.*; +import org.apache.lucene.queryparser.flexible.core.nodes.AndQueryNode; +import org.apache.lucene.queryparser.flexible.core.nodes.BooleanQueryNode; +import org.apache.lucene.queryparser.flexible.core.nodes.ModifierQueryNode; import org.apache.lucene.queryparser.flexible.core.nodes.ModifierQueryNode.Modifier; +import org.apache.lucene.queryparser.flexible.core.nodes.OrQueryNode; +import org.apache.lucene.queryparser.flexible.core.nodes.QueryNode; import org.apache.lucene.queryparser.flexible.core.processors.QueryNodeProcessorImpl; import org.apache.lucene.queryparser.flexible.precedence.PrecedenceQueryParser; import org.apache.lucene.queryparser.flexible.standard.config.StandardQueryConfigHandler; diff --git a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java index d61dbb49990..809e50ebb4f 100644 --- a/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java +++ b/lucene/queryparser/src/java/org/apache/lucene/queryparser/xml/CoreParser.java @@ -25,7 +25,25 @@ import javax.xml.parsers.ParserConfigurationException; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.queries.spans.SpanQuery; import org.apache.lucene.queryparser.classic.QueryParser; -import org.apache.lucene.queryparser.xml.builders.*; +import org.apache.lucene.queryparser.xml.builders.BooleanQueryBuilder; +import org.apache.lucene.queryparser.xml.builders.BoostingTermBuilder; +import org.apache.lucene.queryparser.xml.builders.ConstantScoreQueryBuilder; +import org.apache.lucene.queryparser.xml.builders.DisjunctionMaxQueryBuilder; +import org.apache.lucene.queryparser.xml.builders.MatchAllDocsQueryBuilder; +import org.apache.lucene.queryparser.xml.builders.PointRangeQueryBuilder; +import org.apache.lucene.queryparser.xml.builders.RangeQueryBuilder; +import org.apache.lucene.queryparser.xml.builders.SpanFirstBuilder; +import org.apache.lucene.queryparser.xml.builders.SpanNearBuilder; +import org.apache.lucene.queryparser.xml.builders.SpanNotBuilder; +import org.apache.lucene.queryparser.xml.builders.SpanOrBuilder; +import org.apache.lucene.queryparser.xml.builders.SpanOrTermsBuilder; +import org.apache.lucene.queryparser.xml.builders.SpanPositionRangeBuilder; +import org.apache.lucene.queryparser.xml.builders.SpanQueryBuilder; +import org.apache.lucene.queryparser.xml.builders.SpanQueryBuilderFactory; +import org.apache.lucene.queryparser.xml.builders.SpanTermBuilder; +import org.apache.lucene.queryparser.xml.builders.TermQueryBuilder; +import org.apache.lucene.queryparser.xml.builders.TermsQueryBuilder; +import org.apache.lucene.queryparser.xml.builders.UserInputQueryBuilder; import org.apache.lucene.search.Query; import org.w3c.dom.Document; import org.w3c.dom.Element; diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/precedence/TestPrecedenceQueryParser.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/precedence/TestPrecedenceQueryParser.java index a1049368139..a23745fbdd6 100644 --- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/precedence/TestPrecedenceQueryParser.java +++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/precedence/TestPrecedenceQueryParser.java @@ -25,7 +25,10 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.TimeZone; -import org.apache.lucene.analysis.*; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.analysis.TokenFilter; +import org.apache.lucene.analysis.TokenStream; +import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; import org.apache.lucene.document.DateTools; diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestMultiAnalyzerQPHelper.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestMultiAnalyzerQPHelper.java index 6c790ae42fb..54c61e013ef 100644 --- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestMultiAnalyzerQPHelper.java +++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestMultiAnalyzerQPHelper.java @@ -17,7 +17,10 @@ package org.apache.lucene.queryparser.flexible.standard; import java.io.IOException; -import org.apache.lucene.analysis.*; +import org.apache.lucene.analysis.Analyzer; +import org.apache.lucene.analysis.TokenFilter; +import org.apache.lucene.analysis.TokenStream; +import org.apache.lucene.analysis.Tokenizer; import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; diff --git a/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestMultiFieldQPHelper.java b/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestMultiFieldQPHelper.java index 7c9bb9a54cc..58c04ee2464 100644 --- a/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestMultiFieldQPHelper.java +++ b/lucene/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestMultiFieldQPHelper.java @@ -20,7 +20,7 @@ import java.io.Reader; import java.io.StringReader; import java.util.HashMap; import java.util.Map; -import org.apache.lucene.analysis.*; +import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.index.DirectoryReader; diff --git a/lucene/sandbox/src/java/org/apache/lucene/sandbox/index/MergeOnFlushMergePolicy.java b/lucene/sandbox/src/java/org/apache/lucene/sandbox/index/MergeOnFlushMergePolicy.java index 53e4d9941e4..109f1606ad9 100644 --- a/lucene/sandbox/src/java/org/apache/lucene/sandbox/index/MergeOnFlushMergePolicy.java +++ b/lucene/sandbox/src/java/org/apache/lucene/sandbox/index/MergeOnFlushMergePolicy.java @@ -20,7 +20,11 @@ package org.apache.lucene.sandbox.index; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.apache.lucene.index.*; +import org.apache.lucene.index.FilterMergePolicy; +import org.apache.lucene.index.MergePolicy; +import org.apache.lucene.index.MergeTrigger; +import org.apache.lucene.index.SegmentCommitInfo; +import org.apache.lucene.index.SegmentInfos; /** * A simple extension to wrap {@link MergePolicy} to merge all tiny segments (or at least segments diff --git a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/util/ShapeFieldCacheProvider.java b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/util/ShapeFieldCacheProvider.java index ca99bf69c98..ad0958c354b 100644 --- a/lucene/spatial-extras/src/java/org/apache/lucene/spatial/util/ShapeFieldCacheProvider.java +++ b/lucene/spatial-extras/src/java/org/apache/lucene/spatial/util/ShapeFieldCacheProvider.java @@ -18,7 +18,11 @@ package org.apache.lucene.spatial.util; import java.io.IOException; import java.util.WeakHashMap; -import org.apache.lucene.index.*; +import org.apache.lucene.index.IndexReader; +import org.apache.lucene.index.LeafReader; +import org.apache.lucene.index.PostingsEnum; +import org.apache.lucene.index.Terms; +import org.apache.lucene.index.TermsEnum; import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.util.BytesRef; import org.locationtech.spatial4j.shape.Shape; diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialTestCase.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialTestCase.java index 00d413f009c..ef48a1feee6 100644 --- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialTestCase.java +++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/SpatialTestCase.java @@ -16,7 +16,9 @@ */ package org.apache.lucene.spatial; -import static com.carrotsearch.randomizedtesting.RandomizedTest.*; +import static com.carrotsearch.randomizedtesting.RandomizedTest.randomDouble; +import static com.carrotsearch.randomizedtesting.RandomizedTest.randomGaussian; +import static com.carrotsearch.randomizedtesting.RandomizedTest.randomIntBetween; import java.io.IOException; import java.util.ArrayList; diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/TestRandomSpatialOpFuzzyPrefixTree.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/TestRandomSpatialOpFuzzyPrefixTree.java index 6fae9796a28..988c2c96065 100644 --- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/TestRandomSpatialOpFuzzyPrefixTree.java +++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/prefix/TestRandomSpatialOpFuzzyPrefixTree.java @@ -16,8 +16,13 @@ */ package org.apache.lucene.spatial.prefix; -import static com.carrotsearch.randomizedtesting.RandomizedTest.*; -import static org.locationtech.spatial4j.shape.SpatialRelation.*; +import static com.carrotsearch.randomizedtesting.RandomizedTest.randomBoolean; +import static com.carrotsearch.randomizedtesting.RandomizedTest.randomInt; +import static com.carrotsearch.randomizedtesting.RandomizedTest.randomIntBetween; +import static org.locationtech.spatial4j.shape.SpatialRelation.CONTAINS; +import static org.locationtech.spatial4j.shape.SpatialRelation.DISJOINT; +import static org.locationtech.spatial4j.shape.SpatialRelation.INTERSECTS; +import static org.locationtech.spatial4j.shape.SpatialRelation.WITHIN; import com.carrotsearch.randomizedtesting.annotations.Repeat; import java.io.IOException; diff --git a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/TestGeo3dRpt.java b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/TestGeo3dRpt.java index 0d3e8125a03..3bc8ec0faa9 100644 --- a/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/TestGeo3dRpt.java +++ b/lucene/spatial-extras/src/test/org/apache/lucene/spatial/spatial4j/TestGeo3dRpt.java @@ -16,7 +16,9 @@ */ package org.apache.lucene.spatial.spatial4j; -import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.*; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomGeoAreaShape; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomPlanetModel; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomShapeType; import static org.locationtech.spatial4j.distance.DistanceUtils.DEGREES_TO_RADIANS; import java.io.IOException; diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestGeoExactCircle.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestGeoExactCircle.java index 28036e2aeff..ced5ed0ca23 100644 --- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestGeoExactCircle.java +++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestGeoExactCircle.java @@ -17,7 +17,9 @@ package org.apache.lucene.spatial3d.geom; -import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.*; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomGeoAreaShape; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomGeoPoint; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomPlanetModel; import com.carrotsearch.randomizedtesting.annotations.Repeat; import org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator; diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomBinaryCodec.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomBinaryCodec.java index 3c0a6a895be..eb0cbdf0c77 100644 --- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomBinaryCodec.java +++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomBinaryCodec.java @@ -17,7 +17,10 @@ package org.apache.lucene.spatial3d.geom; -import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.*; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomGeoPoint; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomGeoShape; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomPlanetModel; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomShapeType; import com.carrotsearch.randomizedtesting.annotations.Repeat; import java.io.ByteArrayInputStream; diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomGeoPolygon.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomGeoPolygon.java index 92adb09f9d6..4dde79c8784 100644 --- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomGeoPolygon.java +++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomGeoPolygon.java @@ -16,7 +16,9 @@ */ package org.apache.lucene.spatial3d.geom; -import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.*; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.orderPoints; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomGeoPoint; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomPlanetModel; import com.carrotsearch.randomizedtesting.generators.BiasedNumbers; import java.util.ArrayList; diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomGeoShapeRelationship.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomGeoShapeRelationship.java index 9b63b4e4e9e..773f7ee06ad 100644 --- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomGeoShapeRelationship.java +++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomGeoShapeRelationship.java @@ -17,7 +17,23 @@ package org.apache.lucene.spatial3d.geom; -import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.*; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.COLLECTION; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.CONCAVE_SIMPLE_POLYGON; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.CONVEX_POLYGON; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.CONVEX_SIMPLE_POLYGON; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.Constraints; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.LINE; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.POINT; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.getEmptyConstraint; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.isConcave; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomConcaveShapeType; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomConvexShapeType; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomGeoAreaShape; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomGeoAreaShapeType; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomGeoPoint; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomGeoShape; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomPlanetModel; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomShapeType; import org.apache.lucene.tests.util.LuceneTestCase; import org.junit.Test; diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomPlane.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomPlane.java index 503188a102f..c3c65a150ed 100644 --- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomPlane.java +++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/TestRandomPlane.java @@ -17,7 +17,8 @@ package org.apache.lucene.spatial3d.geom; -import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.*; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomGeoPoint; +import static org.apache.lucene.spatial3d.tests.RandomGeo3dShapeGenerator.randomPlanetModel; import com.carrotsearch.randomizedtesting.annotations.Repeat; import java.util.ArrayList; diff --git a/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java b/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java index 8e158610382..6d3defe476e 100644 --- a/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/spell/LuceneDictionary.java @@ -16,7 +16,7 @@ */ package org.apache.lucene.search.spell; -import java.io.*; +import java.io.IOException; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.MultiTerms; import org.apache.lucene.index.Terms; diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/FileDictionary.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/FileDictionary.java index 07984f47f95..e7cd84d8424 100644 --- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/FileDictionary.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/FileDictionary.java @@ -16,7 +16,10 @@ */ package org.apache.lucene.search.suggest; -import java.io.*; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; import java.nio.charset.StandardCharsets; import java.util.Set; import org.apache.lucene.search.spell.Dictionary; diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionBuilder.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionBuilder.java index 7661933a4e7..0b0ef0ce90e 100644 --- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionBuilder.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/fst/FSTCompletionBuilder.java @@ -24,7 +24,11 @@ import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.BytesRefBuilder; import org.apache.lucene.util.BytesRefIterator; import org.apache.lucene.util.IntsRefBuilder; -import org.apache.lucene.util.fst.*; +import org.apache.lucene.util.fst.FST; +import org.apache.lucene.util.fst.FSTCompiler; +import org.apache.lucene.util.fst.NoOutputs; +import org.apache.lucene.util.fst.Outputs; +import org.apache.lucene.util.fst.Util; /** * Finite state automata based implementation of "autocomplete" functionality. diff --git a/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java b/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java index 6aa7b5f77c2..3e1c27c8580 100644 --- a/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java +++ b/lucene/suggest/src/java/org/apache/lucene/search/suggest/tst/TSTAutocomplete.java @@ -16,7 +16,8 @@ */ package org.apache.lucene.search.suggest.tst; -import java.util.*; +import java.util.ArrayList; +import java.util.Stack; /** * Ternary Search Trie implementation. diff --git a/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/TestWFSTCompletion.java b/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/TestWFSTCompletion.java index a61e6275b9c..780906d21c6 100644 --- a/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/TestWFSTCompletion.java +++ b/lucene/suggest/src/test/org/apache/lucene/search/suggest/fst/TestWFSTCompletion.java @@ -16,7 +16,15 @@ */ package org.apache.lucene.search.suggest.fst; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.TreeMap; +import java.util.TreeSet; import org.apache.lucene.search.suggest.Input; import org.apache.lucene.search.suggest.InputArrayIterator; import org.apache.lucene.search.suggest.Lookup.LookupResult; diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/analysis/BaseTokenStreamTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/tests/analysis/BaseTokenStreamTestCase.java index 7009247b086..b2ce16d8077 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/tests/analysis/BaseTokenStreamTestCase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/tests/analysis/BaseTokenStreamTestCase.java @@ -25,12 +25,30 @@ import java.io.Writer; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Random; +import java.util.Set; import java.util.concurrent.CountDownLatch; import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.analysis.TokenStreamToAutomaton; -import org.apache.lucene.analysis.tokenattributes.*; +import org.apache.lucene.analysis.tokenattributes.CharTermAttribute; +import org.apache.lucene.analysis.tokenattributes.FlagsAttribute; +import org.apache.lucene.analysis.tokenattributes.KeywordAttribute; +import org.apache.lucene.analysis.tokenattributes.OffsetAttribute; +import org.apache.lucene.analysis.tokenattributes.PayloadAttribute; +import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute; +import org.apache.lucene.analysis.tokenattributes.PositionLengthAttribute; +import org.apache.lucene.analysis.tokenattributes.TermToBytesRefAttribute; +import org.apache.lucene.analysis.tokenattributes.TypeAttribute; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; import org.apache.lucene.document.FieldType; diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/search/CheckHits.java b/lucene/test-framework/src/java/org/apache/lucene/tests/search/CheckHits.java index 4b3a49cb2aa..cbcf99c536e 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/tests/search/CheckHits.java +++ b/lucene/test-framework/src/java/org/apache/lucene/tests/search/CheckHits.java @@ -16,7 +16,12 @@ */ package org.apache.lucene.tests.search; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.IOException; import java.util.Collection; diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/util/RunListenerPrintReproduceInfo.java b/lucene/test-framework/src/java/org/apache/lucene/tests/util/RunListenerPrintReproduceInfo.java index fdcaef3db1a..9fa50a20417 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/tests/util/RunListenerPrintReproduceInfo.java +++ b/lucene/test-framework/src/java/org/apache/lucene/tests/util/RunListenerPrintReproduceInfo.java @@ -16,7 +16,23 @@ */ package org.apache.lucene.tests.util; -import static org.apache.lucene.tests.util.LuceneTestCase.*; +import static org.apache.lucene.tests.util.LuceneTestCase.DEFAULT_LINE_DOCS_FILE; +import static org.apache.lucene.tests.util.LuceneTestCase.JENKINS_LARGE_LINE_DOCS_FILE; +import static org.apache.lucene.tests.util.LuceneTestCase.RANDOM_MULTIPLIER; +import static org.apache.lucene.tests.util.LuceneTestCase.SYSPROP_AWAITSFIX; +import static org.apache.lucene.tests.util.LuceneTestCase.SYSPROP_MONSTER; +import static org.apache.lucene.tests.util.LuceneTestCase.SYSPROP_NIGHTLY; +import static org.apache.lucene.tests.util.LuceneTestCase.SYSPROP_WEEKLY; +import static org.apache.lucene.tests.util.LuceneTestCase.TEST_AWAITSFIX; +import static org.apache.lucene.tests.util.LuceneTestCase.TEST_CODEC; +import static org.apache.lucene.tests.util.LuceneTestCase.TEST_DIRECTORY; +import static org.apache.lucene.tests.util.LuceneTestCase.TEST_DOCVALUESFORMAT; +import static org.apache.lucene.tests.util.LuceneTestCase.TEST_LINE_DOCS_FILE; +import static org.apache.lucene.tests.util.LuceneTestCase.TEST_MONSTER; +import static org.apache.lucene.tests.util.LuceneTestCase.TEST_NIGHTLY; +import static org.apache.lucene.tests.util.LuceneTestCase.TEST_POSTINGSFORMAT; +import static org.apache.lucene.tests.util.LuceneTestCase.TEST_WEEKLY; +import static org.apache.lucene.tests.util.LuceneTestCase.classEnvRule; import com.carrotsearch.randomizedtesting.LifecycleScope; import com.carrotsearch.randomizedtesting.RandomizedContext; diff --git a/lucene/test-framework/src/test/org/apache/lucene/tests/util/TestExceptionInBeforeClassHooks.java b/lucene/test-framework/src/test/org/apache/lucene/tests/util/TestExceptionInBeforeClassHooks.java index 7a31b41f762..8fc46e627c0 100644 --- a/lucene/test-framework/src/test/org/apache/lucene/tests/util/TestExceptionInBeforeClassHooks.java +++ b/lucene/test-framework/src/test/org/apache/lucene/tests/util/TestExceptionInBeforeClassHooks.java @@ -16,7 +16,9 @@ */ package org.apache.lucene.tests.util; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.junit.Assert;