diff --git a/build-tools/missing-doclet/src/main/java/org/apache/lucene/missingdoclet/MissingDoclet.java b/build-tools/missing-doclet/src/main/java/org/apache/lucene/missingdoclet/MissingDoclet.java index 823e86d21b8d..d46b231865e4 100644 --- a/build-tools/missing-doclet/src/main/java/org/apache/lucene/missingdoclet/MissingDoclet.java +++ b/build-tools/missing-doclet/src/main/java/org/apache/lucene/missingdoclet/MissingDoclet.java @@ -230,8 +230,8 @@ private void check(Element element) { case PACKAGE: checkComment(element); break; - // class-like elements, check them, then recursively check their children (fields and - // methods) + // class-like elements, check them, then recursively check their children (fields and + // methods) case CLASS: case INTERFACE: case ENUM: @@ -251,7 +251,7 @@ private void check(Element element) { } } break; - // method-like elements, check them if we are configured to do so + // method-like elements, check them if we are configured to do so case METHOD: case CONSTRUCTOR: case FIELD: diff --git a/changelog/unreleased/gjf-SOLR-18296.yml b/changelog/unreleased/gjf-SOLR-18296.yml new file mode 100644 index 000000000000..97120872d964 --- /dev/null +++ b/changelog/unreleased/gjf-SOLR-18296.yml @@ -0,0 +1,7 @@ +title: Upgrade google-java-format to 1.35.0 (fixes JDK 24/25 build break) +type: dependency_update +authors: + - name: Serhiy Bzhezytskyy +links: +- name: SOLR-18296 + url: https://issues.apache.org/jira/browse/SOLR-18296 diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 0494670cf530..453442a14cbd 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -103,7 +103,7 @@ google-guava = "33.6.0-jre" # @keep for version alignment google-j2objc = "3.1" # @keep This is GJF version for spotless/ tidy. -google-javaformat = "1.18.1" +google-javaformat = "1.35.0" # @keep for version alignment google-protobuf = "4.35.1" # @keep Gradle version to run the build diff --git a/solr/core/src/java/org/apache/solr/blockcache/BlockDirectory.java b/solr/core/src/java/org/apache/solr/blockcache/BlockDirectory.java index c1ef93b790ef..87466127260d 100644 --- a/solr/core/src/java/org/apache/solr/blockcache/BlockDirectory.java +++ b/solr/core/src/java/org/apache/solr/blockcache/BlockDirectory.java @@ -323,21 +323,21 @@ boolean useReadCache(String name, IOContext context) { return false; } switch (context.context()) { - // depending on params, we don't cache on merges or when only reading once + // depending on params, we don't cache on merges or when only reading once case MERGE: { return cacheMerges; } - /* TODO - case READ: - { - if (context.readOnce) { - return cacheReadOnce; - } else { - return true; - } + /* TODO + case READ: + { + if (context.readOnce) { + return cacheReadOnce; + } else { + return true; } - */ + } + */ default: { return true; diff --git a/solr/core/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java b/solr/core/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java index 85073e37fc77..ae4ba8d96448 100644 --- a/solr/core/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/DocumentAnalysisRequestHandler.java @@ -279,7 +279,7 @@ SolrInputDocument readDocument(XMLStreamReader reader, IndexSchema schema) while (true) { int event = reader.next(); switch (event) { - // Add everything to the text + // Add everything to the text case XMLStreamConstants.SPACE: case XMLStreamConstants.CDATA: case XMLStreamConstants.CHARACTERS: diff --git a/solr/core/src/java/org/apache/solr/handler/IncrementalShardBackup.java b/solr/core/src/java/org/apache/solr/handler/IncrementalShardBackup.java index 71ea48eac82f..6c94d6955a5b 100644 --- a/solr/core/src/java/org/apache/solr/handler/IncrementalShardBackup.java +++ b/solr/core/src/java/org/apache/solr/handler/IncrementalShardBackup.java @@ -275,8 +275,9 @@ private BackupStats incrementalCopy(Collection indexFiles, Directory dir case Error err -> throw err; case IOException ioe -> throw ioe; case RuntimeException re -> throw re; - default -> throw new SolrException( - SolrException.ErrorCode.UNKNOWN, "Error during parallel backup upload", cause); + default -> + throw new SolrException( + SolrException.ErrorCode.UNKNOWN, "Error during parallel backup upload", cause); } } catch (InterruptedException e) { uploadFutures.forEach(f -> f.cancel(true)); diff --git a/solr/core/src/java/org/apache/solr/handler/RestoreCore.java b/solr/core/src/java/org/apache/solr/handler/RestoreCore.java index 244a50e78277..2d5e1f2fa92d 100644 --- a/solr/core/src/java/org/apache/solr/handler/RestoreCore.java +++ b/solr/core/src/java/org/apache/solr/handler/RestoreCore.java @@ -195,8 +195,9 @@ public boolean doRestore() throws Exception { case Error err -> throw err; case IOException ioe -> throw ioe; case RuntimeException re -> throw re; - default -> throw new SolrException( - SolrException.ErrorCode.UNKNOWN, "Error during parallel restore download", cause); + default -> + throw new SolrException( + SolrException.ErrorCode.UNKNOWN, "Error during parallel restore download", cause); } } catch (InterruptedException e) { downloadFutures.forEach(f -> f.cancel(true)); diff --git a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java index 1f0eb6c2fb32..7f6c334cf9bd 100644 --- a/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/admin/ZookeeperInfoHandler.java @@ -461,9 +461,10 @@ private FilterType extractFilterType(SolrParams params) { case "none" -> FilterType.none; case "name" -> FilterType.name; case "status" -> FilterType.status; - default -> throw new SolrException( - ErrorCode.BAD_REQUEST, - "Invalid filterType '" + filterType + "'. Allowed values are: none, name, status"); + default -> + throw new SolrException( + ErrorCode.BAD_REQUEST, + "Invalid filterType '" + filterType + "'. Allowed values are: none, name, status"); }; } return FilterType.none; diff --git a/solr/core/src/java/org/apache/solr/handler/component/PivotFacetValue.java b/solr/core/src/java/org/apache/solr/handler/component/PivotFacetValue.java index b13b604d12b8..c21c898fd37e 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/PivotFacetValue.java +++ b/solr/core/src/java/org/apache/solr/handler/component/PivotFacetValue.java @@ -145,8 +145,9 @@ public static PivotFacetValue createFromNamedList( case STATS -> statsValues = (NamedList>>) value; case QUERIES -> queryCounts = (NamedList) value; case RANGES -> ranges = (SimpleOrderedMap>) value; - default -> throw new RuntimeException( - "PivotListEntry contains unaccounted for item: " + pivotEntry); + default -> + throw new RuntimeException( + "PivotListEntry contains unaccounted for item: " + pivotEntry); } } diff --git a/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java b/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java index 3897d6c737e0..3e7a066841f3 100644 --- a/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java +++ b/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java @@ -768,7 +768,7 @@ protected String stageToString(int stage) { return "EXECUTE_QUERY"; case STAGE_GET_FIELDS: return "GET_FIELDS"; - // nobody wants to think it was DONE and canceled after it completed... + // nobody wants to think it was DONE and canceled after it completed... case STAGE_DONE: return "FINISHING"; default: diff --git a/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java b/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java index ff07a8fb5a9c..a5a6feab2cb1 100644 --- a/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java +++ b/solr/core/src/java/org/apache/solr/handler/loader/JsonLoader.java @@ -215,7 +215,7 @@ void processUpdate(Reader reader) throws IOException { } break; } - // fall through + // fall through case JSONParser.LONG: case JSONParser.NUMBER: diff --git a/solr/core/src/java/org/apache/solr/handler/loader/XMLLoader.java b/solr/core/src/java/org/apache/solr/handler/loader/XMLLoader.java index 869d4790db90..72d93f87b78d 100644 --- a/solr/core/src/java/org/apache/solr/handler/loader/XMLLoader.java +++ b/solr/core/src/java/org/apache/solr/handler/loader/XMLLoader.java @@ -300,7 +300,7 @@ void processDelete(SolrQueryRequest req, UpdateRequestProcessor processor, XMLSt deleteCmd.clear(); break; - // Add everything to the text + // Add everything to the text case XMLStreamConstants.SPACE: case XMLStreamConstants.CDATA: case XMLStreamConstants.CHARACTERS: @@ -356,7 +356,7 @@ protected SolrInputDocument readDoc(XMLStreamReader parser, boolean forgiveNameA while (!complete) { int event = parser.next(); switch (event) { - // Add everything to the text + // Add everything to the text case XMLStreamConstants.SPACE: case XMLStreamConstants.CDATA: case XMLStreamConstants.CHARACTERS: diff --git a/solr/core/src/java/org/apache/solr/handler/tagger/TermPrefixCursor.java b/solr/core/src/java/org/apache/solr/handler/tagger/TermPrefixCursor.java index 8fad2964d9ae..8c4a1787e272 100644 --- a/solr/core/src/java/org/apache/solr/handler/tagger/TermPrefixCursor.java +++ b/solr/core/src/java/org/apache/solr/handler/tagger/TermPrefixCursor.java @@ -128,7 +128,7 @@ private boolean seekPrefix() throws IOException { if (termsEnum.next() == null) { // case END return false; } - // fall through to NOT_FOUND + // fall through to NOT_FOUND case NOT_FOUND: // termsEnum must start with prefixBuf to continue diff --git a/solr/core/src/java/org/apache/solr/internal/csv/CSVPrinter.java b/solr/core/src/java/org/apache/solr/internal/csv/CSVPrinter.java index 88da81b3a835..e759236a5c2c 100644 --- a/solr/core/src/java/org/apache/solr/internal/csv/CSVPrinter.java +++ b/solr/core/src/java/org/apache/solr/internal/csv/CSVPrinter.java @@ -97,7 +97,7 @@ public void printlnComment(String comment) throws IOException { if (i + 1 < comment.length() && comment.charAt(i + 1) == '\n') { i++; } - // break intentionally excluded. + // break intentionally excluded. case '\n': println(); out.write(this.strategy.getCommentStart()); diff --git a/solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.java b/solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.java index e6f96174fc2b..6ed245c50469 100644 --- a/solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.java +++ b/solr/core/src/java/org/apache/solr/response/SchemaXmlWriter.java @@ -159,16 +159,16 @@ private void writeFieldTypes(List> fieldTypePropertiesL Object fieldTypePropValue = fieldTypeProperty.getValue(); switch (fieldTypePropName) { - case FieldType.ANALYZER -> analyzerProperties = - (SimpleOrderedMap) fieldTypePropValue; - case FieldType.INDEX_ANALYZER -> indexAnalyzerProperties = - (SimpleOrderedMap) fieldTypePropValue; - case FieldType.QUERY_ANALYZER -> queryAnalyzerProperties = - (SimpleOrderedMap) fieldTypePropValue; - case FieldType.MULTI_TERM_ANALYZER -> multiTermAnalyzerProperties = - (SimpleOrderedMap) fieldTypePropValue; - case FieldType.SIMILARITY -> perFieldSimilarityProperties = - (SimpleOrderedMap) fieldTypePropValue; + case FieldType.ANALYZER -> + analyzerProperties = (SimpleOrderedMap) fieldTypePropValue; + case FieldType.INDEX_ANALYZER -> + indexAnalyzerProperties = (SimpleOrderedMap) fieldTypePropValue; + case FieldType.QUERY_ANALYZER -> + queryAnalyzerProperties = (SimpleOrderedMap) fieldTypePropValue; + case FieldType.MULTI_TERM_ANALYZER -> + multiTermAnalyzerProperties = (SimpleOrderedMap) fieldTypePropValue; + case FieldType.SIMILARITY -> + perFieldSimilarityProperties = (SimpleOrderedMap) fieldTypePropValue; default -> writeAttr(fieldTypePropName, fieldTypePropValue.toString()); } } @@ -229,8 +229,8 @@ private void writeAnalyzer(SimpleOrderedMap analyzerProperties, String a String name = analyzerProperty.getKey(); Object value = analyzerProperty.getValue(); switch (name) { - case FieldType.CHAR_FILTERS -> charFilterPropertiesList = - (List>) value; + case FieldType.CHAR_FILTERS -> + charFilterPropertiesList = (List>) value; case FieldType.TOKENIZER -> tokenizerProperties = (SimpleOrderedMap) value; case FieldType.FILTERS -> filterPropertiesList = (List>) value; case FieldType.CLASS_NAME -> { diff --git a/solr/core/src/java/org/apache/solr/schema/BBoxField.java b/solr/core/src/java/org/apache/solr/schema/BBoxField.java index 1e7155f61b7b..4b85573ad73d 100644 --- a/solr/core/src/java/org/apache/solr/schema/BBoxField.java +++ b/solr/core/src/java/org/apache/solr/schema/BBoxField.java @@ -170,7 +170,7 @@ protected DoubleValuesSource getValueSourceFromSpatialArgs( } switch (scoreParam) { - // TODO move these to superclass after LUCENE-5804 ? + // TODO move these to superclass after LUCENE-5804 ? case OVERLAP_RATIO: double queryTargetProportion = 0.25; // Suggested default; weights towards target area diff --git a/solr/core/src/java/org/apache/solr/schema/DenseVectorField.java b/solr/core/src/java/org/apache/solr/schema/DenseVectorField.java index f29714d5b1ee..9cd1d0a27eee 100644 --- a/solr/core/src/java/org/apache/solr/schema/DenseVectorField.java +++ b/solr/core/src/java/org/apache/solr/schema/DenseVectorField.java @@ -592,12 +592,13 @@ public SortField getSortField(SchemaField field, boolean top) { private Query getSeededQuery(Query knnQuery, Query seed) { return switch (knnQuery) { - case SolrKnnFloatVectorQuery knnFloatQuery -> SeededKnnVectorQuery.fromFloatQuery( - knnFloatQuery, seed); - case SolrKnnByteVectorQuery knnByteQuery -> SeededKnnVectorQuery.fromByteQuery( - knnByteQuery, seed); - default -> throw new SolrException( - SolrException.ErrorCode.SERVER_ERROR, "Invalid type of knn query"); + case SolrKnnFloatVectorQuery knnFloatQuery -> + SeededKnnVectorQuery.fromFloatQuery(knnFloatQuery, seed); + case SolrKnnByteVectorQuery knnByteQuery -> + SeededKnnVectorQuery.fromByteQuery(knnByteQuery, seed); + default -> + throw new SolrException( + SolrException.ErrorCode.SERVER_ERROR, "Invalid type of knn query"); }; } @@ -606,24 +607,30 @@ private Query getEarlyTerminationQuery(Query knnQuery, EarlyTerminationParams ea (earlyTermination.getSaturationThreshold() != null && earlyTermination.getPatience() != null); return switch (knnQuery) { - case SolrKnnFloatVectorQuery knnFloatQuery -> useExplicitParams - ? PatienceKnnVectorQuery.fromFloatQuery( - knnFloatQuery, - earlyTermination.getSaturationThreshold(), - earlyTermination.getPatience()) - : PatienceKnnVectorQuery.fromFloatQuery(knnFloatQuery); - case SolrKnnByteVectorQuery knnByteQuery -> useExplicitParams - ? PatienceKnnVectorQuery.fromByteQuery( - knnByteQuery, - earlyTermination.getSaturationThreshold(), - earlyTermination.getPatience()) - : PatienceKnnVectorQuery.fromByteQuery(knnByteQuery); - case SeededKnnVectorQuery seedQuery -> useExplicitParams - ? PatienceKnnVectorQuery.fromSeededQuery( - seedQuery, earlyTermination.getSaturationThreshold(), earlyTermination.getPatience()) - : PatienceKnnVectorQuery.fromSeededQuery(seedQuery); - default -> throw new SolrException( - SolrException.ErrorCode.SERVER_ERROR, "Invalid type of knn query"); + case SolrKnnFloatVectorQuery knnFloatQuery -> + useExplicitParams + ? PatienceKnnVectorQuery.fromFloatQuery( + knnFloatQuery, + earlyTermination.getSaturationThreshold(), + earlyTermination.getPatience()) + : PatienceKnnVectorQuery.fromFloatQuery(knnFloatQuery); + case SolrKnnByteVectorQuery knnByteQuery -> + useExplicitParams + ? PatienceKnnVectorQuery.fromByteQuery( + knnByteQuery, + earlyTermination.getSaturationThreshold(), + earlyTermination.getPatience()) + : PatienceKnnVectorQuery.fromByteQuery(knnByteQuery); + case SeededKnnVectorQuery seedQuery -> + useExplicitParams + ? PatienceKnnVectorQuery.fromSeededQuery( + seedQuery, + earlyTermination.getSaturationThreshold(), + earlyTermination.getPatience()) + : PatienceKnnVectorQuery.fromSeededQuery(seedQuery); + default -> + throw new SolrException( + SolrException.ErrorCode.SERVER_ERROR, "Invalid type of knn query"); }; } } diff --git a/solr/core/src/java/org/apache/solr/search/QParser.java b/solr/core/src/java/org/apache/solr/search/QParser.java index 8f0977f7e004..21c7d7649971 100644 --- a/solr/core/src/java/org/apache/solr/search/QParser.java +++ b/solr/core/src/java/org/apache/solr/search/QParser.java @@ -349,8 +349,8 @@ public ValueSource parseAsValueSource() throws SyntaxError { return switch (q) { case null -> new LongConstValueSource(0); case FunctionQuery functionQuery -> functionQuery.getValueSource(); - case FunctionScoreQuery functionQuery -> ValueSource.fromDoubleValuesSource( - functionQuery.getSource()); + case FunctionScoreQuery functionQuery -> + ValueSource.fromDoubleValuesSource(functionQuery.getSource()); default -> new QueryValueSource(q, 0.0f); }; } diff --git a/solr/core/src/java/org/apache/solr/search/ReRankQParserPlugin.java b/solr/core/src/java/org/apache/solr/search/ReRankQParserPlugin.java index 33bb7f2a35b5..d9c9d193f877 100644 --- a/solr/core/src/java/org/apache/solr/search/ReRankQParserPlugin.java +++ b/solr/core/src/java/org/apache/solr/search/ReRankQParserPlugin.java @@ -81,10 +81,12 @@ private static Rescorer createRescorer( final Query reRankQuery, final double reRankWeight, final ReRankOperator reRankOperator) { assert null != reRankQuery; return switch (reRankQuery) { - case FunctionQuery functionQuery -> new ReRankDoubleValuesSourceRescorer( - functionQuery.getValueSource().asDoubleValuesSource(), reRankWeight, reRankOperator); - case FunctionScoreQuery functionQuery -> new ReRankDoubleValuesSourceRescorer( - functionQuery.getSource(), reRankWeight, reRankOperator); + case FunctionQuery functionQuery -> + new ReRankDoubleValuesSourceRescorer( + functionQuery.getValueSource().asDoubleValuesSource(), reRankWeight, reRankOperator); + case FunctionScoreQuery functionQuery -> + new ReRankDoubleValuesSourceRescorer( + functionQuery.getSource(), reRankWeight, reRankOperator); default -> new ReRankQueryRescorer(reRankQuery, reRankWeight, reRankOperator); }; } diff --git a/solr/core/src/java/org/apache/solr/search/facet/FacetHeatmap.java b/solr/core/src/java/org/apache/solr/search/facet/FacetHeatmap.java index 57d69d47c522..557536d3a848 100644 --- a/solr/core/src/java/org/apache/solr/search/facet/FacetHeatmap.java +++ b/solr/core/src/java/org/apache/solr/search/facet/FacetHeatmap.java @@ -324,11 +324,11 @@ private static Object formatCountsVal( // A PNG graphic; compressed. Good for large & dense heatmaps; hard to consume. return asPngBytes(columns, rows, counts, debugInfo); - // TODO case UTFGRID https://github.com/mapbox/utfgrid-spec - // TODO case skipList: //A sequence of values; negative values are actually how many 0's to - // insert. Good for small or large but sparse heatmaps. - // TODO auto choose png or skipList; use skipList when < ~25% full or <= ~512 cells remember - // to augment error list below when we add more formats. + // TODO case UTFGRID https://github.com/mapbox/utfgrid-spec + // TODO case skipList: //A sequence of values; negative values are actually how many 0's to + // insert. Good for small or large but sparse heatmaps. + // TODO auto choose png or skipList; use skipList when < ~25% full or <= ~512 cells remember + // to augment error list below when we add more formats. default: throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Unknown format: " + format); } diff --git a/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java b/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java index 82ef9ec23419..42531d5fd4a1 100644 --- a/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java +++ b/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java @@ -352,7 +352,7 @@ static long parseFormDataContent( currentStream = valueStream; break; } - // fall-through + // fall-through default: currentStream.write(b); } diff --git a/solr/core/src/java/org/apache/solr/update/UpdateLog.java b/solr/core/src/java/org/apache/solr/update/UpdateLog.java index ef35d3c9b0c6..17fd8477b277 100644 --- a/solr/core/src/java/org/apache/solr/update/UpdateLog.java +++ b/solr/core/src/java/org/apache/solr/update/UpdateLog.java @@ -690,7 +690,7 @@ public SolrMetricsContext getSolrMetricsContext() { private long computeBufferedOps() { return switch (state) { - // numRecords counts header as a record + // numRecords counts header as a record case BUFFERING -> (bufferTlog == null ? 0 : bufferTlog.numRecords() - 1); case APPLYING_BUFFERED -> { if (tlog == null) yield 0; diff --git a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java index b2d307aa8521..c1bece3037d0 100644 --- a/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java +++ b/solr/core/src/test/org/apache/solr/cloud/TestPullReplica.java @@ -130,9 +130,9 @@ public void testCreateDelete() throws Exception { try { switch (random().nextInt(3)) { case 0 -> - // Sometimes use SolrJ - CollectionAdminRequest.createCollection(collectionName, "conf", 2, 1, 0, 3) - .process(cluster.getSolrClient()); + // Sometimes use SolrJ + CollectionAdminRequest.createCollection(collectionName, "conf", 2, 1, 0, 3) + .process(cluster.getSolrClient()); case 1 -> { // Sometimes use v1 API var jetty = cluster.getRandomJetty(random()); diff --git a/solr/core/src/test/org/apache/solr/handler/admin/api/GetMetricsTest.java b/solr/core/src/test/org/apache/solr/handler/admin/api/GetMetricsTest.java index fc054b5da095..4ddf224c9d9e 100644 --- a/solr/core/src/test/org/apache/solr/handler/admin/api/GetMetricsTest.java +++ b/solr/core/src/test/org/apache/solr/handler/admin/api/GetMetricsTest.java @@ -199,7 +199,8 @@ public void accept(Mutable arg0) { @Test public void testGetMetricsCategoryParams() throws IOException { - String expected = """ + String expected = + """ category="QUERY" """; diff --git a/solr/modules/language-models/src/java/org/apache/solr/languagemodels/model/SolrTextToVectorModel.java b/solr/modules/language-models/src/java/org/apache/solr/languagemodels/model/SolrTextToVectorModel.java index 9b171d2e51de..776409e6f018 100644 --- a/solr/modules/language-models/src/java/org/apache/solr/languagemodels/model/SolrTextToVectorModel.java +++ b/solr/modules/language-models/src/java/org/apache/solr/languagemodels/model/SolrTextToVectorModel.java @@ -84,15 +84,16 @@ public static SolrTextToVectorModel getInstance( Duration timeOut = Duration.ofSeconds((Long) params.get(paramName)); builder.getClass().getMethod(paramName, Duration.class).invoke(builder, timeOut); } - case MAX_SEGMENTS_PER_BATCH_PARAM, MAX_RETRIES_PARAM -> builder - .getClass() - .getMethod(paramName, Integer.class) - .invoke(builder, ((Long) params.get(paramName)).intValue()); + case MAX_SEGMENTS_PER_BATCH_PARAM, MAX_RETRIES_PARAM -> + builder + .getClass() + .getMethod(paramName, Integer.class) + .invoke(builder, ((Long) params.get(paramName)).intValue()); - /* - * For primitive params if there's only one setter available, we call it. - * If there's choice we default to the string one - */ + /* + * For primitive params if there's only one setter available, we call it. + * If there's choice we default to the string one + */ default -> { ArrayList paramNameMatches = new ArrayList<>(); for (var method : builder.getClass().getMethods()) { diff --git a/solr/modules/opentelemetry/src/java/org/apache/solr/opentelemetry/OtlpExporterFactory.java b/solr/modules/opentelemetry/src/java/org/apache/solr/opentelemetry/OtlpExporterFactory.java index ab95b2bf89e3..eb0529f2b707 100644 --- a/solr/modules/opentelemetry/src/java/org/apache/solr/opentelemetry/OtlpExporterFactory.java +++ b/solr/modules/opentelemetry/src/java/org/apache/solr/opentelemetry/OtlpExporterFactory.java @@ -42,12 +42,14 @@ public MetricExporter getExporter() { } return switch (OTLP_EXPORTER_PROTOCOL) { - case "grpc" -> OtlpGrpcMetricExporter.getDefault().toBuilder() - .setEndpoint(OTLP_EXPORTER_GRPC_ENDPOINT) - .build(); - case "http" -> OtlpHttpMetricExporter.getDefault().toBuilder() - .setEndpoint(OTLP_EXPORTER_HTTP_ENDPOINT) - .build(); + case "grpc" -> + OtlpGrpcMetricExporter.getDefault().toBuilder() + .setEndpoint(OTLP_EXPORTER_GRPC_ENDPOINT) + .build(); + case "http" -> + OtlpHttpMetricExporter.getDefault().toBuilder() + .setEndpoint(OTLP_EXPORTER_HTTP_ENDPOINT) + .build(); case "none" -> null; default -> { log.warn( diff --git a/solr/modules/s3-repository/src/test/org/apache/solr/s3/S3ReadWriteTest.java b/solr/modules/s3-repository/src/test/org/apache/solr/s3/S3ReadWriteTest.java index d4d13c717580..9f360c644acc 100644 --- a/solr/modules/s3-repository/src/test/org/apache/solr/s3/S3ReadWriteTest.java +++ b/solr/modules/s3-repository/src/test/org/apache/solr/s3/S3ReadWriteTest.java @@ -129,7 +129,7 @@ public void testReadWithConnectionLoss() throws IOException { int numBytesToRead = random().nextInt(maxBuffer) + 1; // test both read() and read(buffer, off, len) switch (random().nextInt(3)) { - // read() + // read() case 0: { for (int i = 0; i < numBytesToRead && !done; i++) { @@ -140,7 +140,7 @@ public void testReadWithConnectionLoss() throws IOException { } } break; - // read(byte, off, len) + // read(byte, off, len) case 1: { int readLen = input.read(buffer, 0, numBytesToRead); @@ -152,7 +152,7 @@ public void testReadWithConnectionLoss() throws IOException { } } break; - // skip(len) + // skip(len) case 2: { // We only want to skip 1 because diff --git a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrFilter.java b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrFilter.java index e29c8ef805d6..d43f1ae4c187 100644 --- a/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrFilter.java +++ b/solr/modules/sql/src/java/org/apache/solr/handler/sql/SolrFilter.java @@ -632,11 +632,11 @@ protected Pair translateBinary2(RexNode left, RexNode right) return new Pair<>(name, rightLiteral); case CAST: return translateBinary2(((RexCall) left).getOperands().get(0), right); - // case OTHER_FUNCTION: - // String itemName = SolrRules.isItem((RexCall) left); - // if (itemName != null) { - // return translateOp2(op, itemName, rightLiteral); - // } + // case OTHER_FUNCTION: + // String itemName = SolrRules.isItem((RexCall) left); + // if (itemName != null) { + // return translateOp2(op, itemName, rightLiteral); + // } default: return null; } diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/QueryResponse.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/QueryResponse.java index c783563634be..392d61801227 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/QueryResponse.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/QueryResponse.java @@ -123,8 +123,8 @@ public void setResponse(NamedList res) { case "sort_values" -> _sortvalues = (NamedList) val; case "facet_counts" -> _facetInfo = (NamedList) val; - // extractFacetInfo inspects _results, so defer calling it - // in case it hasn't been populated yet. + // extractFacetInfo inspects _results, so defer calling it + // in case it hasn't been populated yet. case "debug" -> { _debugInfo = (NamedList) val; extractDebugInfo(_debugInfo); @@ -151,7 +151,7 @@ public void setResponse(NamedList res) { } case "facets" -> _jsonFacetingInfo = (NamedList) val; - // Don't call extractJsonFacetingInfo(_jsonFacetingInfo) here in an effort to do it lazily + // Don't call extractJsonFacetingInfo(_jsonFacetingInfo) here in an effort to do it lazily case "suggest" -> { _suggestInfo = (NamedList>) val; extractSuggesterInfo(_suggestInfo); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/response/XMLResponseParser.java b/solr/solrj/src/java/org/apache/solr/client/solrj/response/XMLResponseParser.java index 5bc358b4f5e7..565f1b0c080e 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/response/XMLResponseParser.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/response/XMLResponseParser.java @@ -332,7 +332,7 @@ protected NamedList readNamedList(XMLStreamReader parser) throws XMLStre break; case XMLStreamConstants.SPACE: - // TODO? should this be trimmed? make sure it only gets one/two space? + // TODO? should this be trimmed? make sure it only gets one/two space? case XMLStreamConstants.CDATA: case XMLStreamConstants.CHARACTERS: builder.append(parser.getText()); @@ -421,7 +421,7 @@ else if( type != t && !(t == KnownType.NULL || type == KnownType.NULL)) { break; case XMLStreamConstants.SPACE: - // TODO? should this be trimmed? make sure it only gets one/two space? + // TODO? should this be trimmed? make sure it only gets one/two space? case XMLStreamConstants.CDATA: case XMLStreamConstants.CHARACTERS: builder.append(parser.getText()); @@ -545,7 +545,7 @@ protected SolrDocument readDocument(XMLStreamReader parser) throws XMLStreamExce break; case XMLStreamConstants.SPACE: - // TODO? should this be trimmed? make sure it only gets one/two space? + // TODO? should this be trimmed? make sure it only gets one/two space? case XMLStreamConstants.CDATA: case XMLStreamConstants.CHARACTERS: builder.append(parser.getText()); diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/NodePreferenceRulesComparator.java b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/NodePreferenceRulesComparator.java index e2e4ad4cd2ae..ac6e3fbbee2a 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/routing/NodePreferenceRulesComparator.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/routing/NodePreferenceRulesComparator.java @@ -238,7 +238,7 @@ yield switch (preferenceRule.value) { private Comparator getPreferenceUrlComparator(PreferenceRule preferenceRule) { Comparator comparator = switch (preferenceRule.name) { - // These preferences are not supported for URLs + // These preferences are not supported for URLs case ShardParams.SHARDS_PREFERENCE_REPLICA_TYPE: case ShardParams.SHARDS_PREFERENCE_REPLICA_LEADER: case ShardParams.SHARDS_PREFERENCE_NODE_WITH_SAME_SYSPROP: diff --git a/solr/solrj/src/java/org/apache/solr/common/util/DOMUtil.java b/solr/solrj/src/java/org/apache/solr/common/util/DOMUtil.java index 32bcc873bef4..0a2c93d9aa90 100644 --- a/solr/solrj/src/java/org/apache/solr/common/util/DOMUtil.java +++ b/solr/solrj/src/java/org/apache/solr/common/util/DOMUtil.java @@ -249,19 +249,19 @@ private static void getText(Node nd, StringBuilder buf) { break; case Node.ATTRIBUTE_NODE: /* fall through */ - /* Putting Attribute nodes in this section does not exactly - match the definition of how textContent should behave - according to the DOM Level-3 Core documentation - which - specifies that the Attr's children should have their - textContent contacted (Attr's can have a single child which - is either Text node or an EntityReference). In practice, - DOM implementations do not seem to use child nodes of - Attributes, storing the "text" directly as the nodeValue. - Fortunately, the DOM Spec indicates that when Attr.nodeValue - is read, it should return the nodeValue from the child Node, - so this approach should work both for strict implementations, - and implementations actually encountered. - */ + /* Putting Attribute nodes in this section does not exactly + match the definition of how textContent should behave + according to the DOM Level-3 Core documentation - which + specifies that the Attr's children should have their + textContent contacted (Attr's can have a single child which + is either Text node or an EntityReference). In practice, + DOM implementations do not seem to use child nodes of + Attributes, storing the "text" directly as the nodeValue. + Fortunately, the DOM Spec indicates that when Attr.nodeValue + is read, it should return the nodeValue from the child Node, + so this approach should work both for strict implementations, + and implementations actually encountered. + */ case Node.TEXT_NODE: /* fall through */ case Node.CDATA_SECTION_NODE: /* fall through */ case Node.COMMENT_NODE: /* fall through */ diff --git a/solr/solrj/src/java/org/apache/solr/common/util/Hash.java b/solr/solrj/src/java/org/apache/solr/common/util/Hash.java index e327893b4d93..81866d6c77a4 100644 --- a/solr/solrj/src/java/org/apache/solr/common/util/Hash.java +++ b/solr/solrj/src/java/org/apache/solr/common/util/Hash.java @@ -332,10 +332,10 @@ public static int murmurhash3_x86_32(byte[] data, int offset, int len, int seed) switch (len & 0x03) { case 3: k1 = (data[roundedEnd + 2] & 0xff) << 16; - // fallthrough + // fallthrough case 2: k1 |= (data[roundedEnd + 1] & 0xff) << 8; - // fallthrough + // fallthrough case 1: k1 |= (data[roundedEnd] & 0xff); k1 *= c1; diff --git a/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java b/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java index f637d8841036..e3e9ff67b82e 100644 --- a/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java +++ b/solr/solrj/src/java/org/apache/solr/common/util/JsonTextWriter.java @@ -123,7 +123,7 @@ default void writeStr(String name, String val, boolean needsEscaping) throws IOE case '\u2029': unicodeEscape(getWriter(), ch); break; - // case '/': + // case '/': default: { if (ch <= 0x1F) { diff --git a/solr/solrj/src/java/org/noggit/JSONParser.java b/solr/solrj/src/java/org/noggit/JSONParser.java index 125706032b7d..3a7d45e023ff 100644 --- a/solr/solrj/src/java/org/noggit/JSONParser.java +++ b/solr/solrj/src/java/org/noggit/JSONParser.java @@ -883,7 +883,7 @@ private int next(int ch) throws IOException { // implementation? for (; ; ) { switch (ch) { - // this is not the exclusive list of whitespace chars... the rest are handled in default: + // this is not the exclusive list of whitespace chars... the rest are handled in default: case ' ': case '\t': case '\r': diff --git a/solr/solrj/src/java/org/noggit/JSONUtil.java b/solr/solrj/src/java/org/noggit/JSONUtil.java index 5d7708fb25dd..dfc675154f72 100644 --- a/solr/solrj/src/java/org/noggit/JSONUtil.java +++ b/solr/solrj/src/java/org/noggit/JSONUtil.java @@ -126,7 +126,7 @@ public static void writeChar(char ch, CharArr out) { out.write('\\'); out.write('f'); break; - // case '/': + // case '/': case '\u2028': // valid JSON, but not valid json script case '\u2029': unicodeEscape(ch, out); diff --git a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java index ca9ef93e5245..64090fb8e179 100644 --- a/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java +++ b/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java @@ -2398,8 +2398,7 @@ public void testUpdateField() throws Exception { concurrentClient.lastError.getMessage().contains("version conflict")); } else if (client instanceof - SolrExampleStreamingHttp2Test.ErrorTrackingConcurrentUpdateSolrClient - concurrentClient) { + SolrExampleStreamingHttp2Test.ErrorTrackingConcurrentUpdateSolrClient concurrentClient) { client.commit(); // just to be sure the client has sent the doc assertNotNull( "ConcurrentUpdateSolrClient did not report an error", concurrentClient.lastError);