You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2021/10/08 18:20:27 UTC

[lucene] branch main updated: LUCENE-10136: allow 'var' declarations in source code (be reasonable though). (#368)

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new a613021  LUCENE-10136: allow 'var' declarations in source code (be reasonable though). (#368)
a613021 is described below

commit a613021ca4823c5eb8c9cf6947095bc5098ac500
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Fri Oct 8 20:20:22 2021 +0200

    LUCENE-10136: allow 'var' declarations in source code (be reasonable though). (#368)
---
 gradle/validation/validate-source-patterns.gradle                 | 4 +---
 lucene/CHANGES.txt                                                | 2 ++
 lucene/core/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 d59b5e5..0eea752 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 046f2ad..3c4ab42 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 cc8d50f..d80b102 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<String, String> data = new HashMap<>();
     Iterable<Map.Entry<String, String>> iter = writer.getLiveCommitData();
     if (iter != null) {
-      for (Map.Entry<String, String> ent : iter) {
+      for (var ent : iter) {
         data.put(ent.getKey(), ent.getValue());
       }
     }