LUCENE-10136: allow 'var' declarations in source code (be reasonable though). (#368)

This commit is contained in:
Dawid Weiss 2021-10-08 20:20:22 +02:00 committed by GitHub
parent 9b1fc0ecc8
commit a613021ca4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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());
}
}