From a613021ca4823c5eb8c9cf6947095bc5098ac500 Mon Sep 17 00:00:00 2001 From: Dawid Weiss Date: Fri, 8 Oct 2021 20:20:22 +0200 Subject: [PATCH] LUCENE-10136: allow 'var' declarations in source code (be reasonable though). (#368) --- gradle/validation/validate-source-patterns.gradle | 4 +--- lucene/CHANGES.txt | 2 ++ .../src/test/org/apache/lucene/index/TestIndexWriter.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gradle/validation/validate-source-patterns.gradle b/gradle/validation/validate-source-patterns.gradle index d59b5e56412..0eea752d18d 100644 --- a/gradle/validation/validate-source-patterns.gradle +++ b/gradle/validation/validate-source-patterns.gradle @@ -115,7 +115,6 @@ configure(rootProject) { // default excludes. exclude '**/build/**' - exclude 'dev-tools/missing-doclet/src/**/*.java' // <-- TODO: remove once we allow "var" on master // ourselves :-) exclude 'gradle/validation/validate-source-patterns.gradle' @@ -157,8 +156,7 @@ 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+/$) : 'var is not allowed in until we stop development on the 8x code line' + (~$/\n\s*var\s+.*=.*<>.*/$) : 'Diamond operators should not be used with var' ] def found = 0; diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 046f2ad07f3..3c4ab42fe22 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -359,6 +359,8 @@ Changes in Backwards Compatibility Policy Other +* LUCENE-10136: allow 'var' declarations in source code (Dawid Weiss) + * LUCENE-9570, LUCENE-9564: Apply google java format and enforce it on source Java files. Review diffs and correct automatic formatting oddities. (Erick Erickson, Bruno Roustant, Dawid Weiss) diff --git a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java index cc8d50fccc3..d80b1022c0f 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestIndexWriter.java @@ -1965,7 +1965,7 @@ public class TestIndexWriter extends LuceneTestCase { Map data = new HashMap<>(); Iterable> iter = writer.getLiveCommitData(); if (iter != null) { - for (Map.Entry ent : iter) { + for (var ent : iter) { data.put(ent.getKey(), ent.getValue()); } }