mirror of https://github.com/apache/lucene.git
SOLR-13568: Precommit fail Java var until 9x. Fail var...
This commit is contained in:
parent
52f1108a0e
commit
f6f1b4244c
|
@ -49,6 +49,13 @@ def invalidPatterns = [
|
||||||
(~$/import java\.lang\.\w+;/$) : 'java.lang import is unnecessary'
|
(~$/import java\.lang\.\w+;/$) : 'java.lang import is unnecessary'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
// 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'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
def baseDir = properties['basedir'];
|
def baseDir = properties['basedir'];
|
||||||
def baseDirLen = baseDir.length() + 1;
|
def baseDirLen = baseDir.length() + 1;
|
||||||
|
|
||||||
|
@ -200,6 +207,11 @@ ant.fileScanner{
|
||||||
reportViolation(f, "Solr test cases should extend SolrTestCase rather than LuceneTestCase");
|
reportViolation(f, "Solr test cases should extend SolrTestCase rather than LuceneTestCase");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
invalidJavaOnlyPatterns.each { pattern,name ->
|
||||||
|
if (pattern.matcher(text).find()) {
|
||||||
|
reportViolation(f, name);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (f.name.endsWith('.xml') || f.name.endsWith('.xml.template')) {
|
if (f.name.endsWith('.xml') || f.name.endsWith('.xml.template')) {
|
||||||
checkLicenseHeaderPrecedes(f, '<tag>', xmlTagPattern, xmlCommentPattern, text, ratDocument);
|
checkLicenseHeaderPrecedes(f, '<tag>', xmlTagPattern, xmlCommentPattern, text, ratDocument);
|
||||||
|
|
|
@ -166,6 +166,8 @@ Other Changes
|
||||||
|
|
||||||
* SOLR-13573: Add SolrRangeQuery getters for upper, lower bound (Brian Rhees via Jason Gerlowski)
|
* SOLR-13573: Add SolrRangeQuery getters for upper, lower bound (Brian Rhees via Jason Gerlowski)
|
||||||
|
|
||||||
|
* SOLR-13658: Precommit fail Java "var" until 9x. Fail "var...<>" constructs entirely (Erick Erickson)
|
||||||
|
|
||||||
================== 8.2.0 ==================
|
================== 8.2.0 ==================
|
||||||
|
|
||||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.solr.client.solrj;
|
||||||
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
@ -688,15 +689,15 @@ abstract public class SolrExampleTests extends SolrExampleTestsBase
|
||||||
Assert.assertEquals(0, rsp.getResults().getNumFound());
|
Assert.assertEquals(0, rsp.getResults().getNumFound());
|
||||||
|
|
||||||
ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update");
|
ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update");
|
||||||
var file = getFile("solrj/books.csv");
|
File file = getFile("solrj/books.csv");
|
||||||
final int opened[] = new int[] {0};
|
final int opened[] = new int[] {0};
|
||||||
final int closed[] = new int[] {0};
|
final int closed[] = new int[] {0};
|
||||||
|
|
||||||
var assertClosed = random().nextBoolean();
|
boolean assertClosed = random().nextBoolean();
|
||||||
if (assertClosed) {
|
if (assertClosed) {
|
||||||
var allBytes = Files.readAllBytes(file.toPath());
|
byte[] allBytes = Files.readAllBytes(file.toPath());
|
||||||
|
|
||||||
var contentStreamMock = new ContentStreamBase.ByteArrayStream(allBytes, "solrj/books.csv", "application/csv") {
|
ContentStreamBase.ByteArrayStream contentStreamMock = new ContentStreamBase.ByteArrayStream(allBytes, "solrj/books.csv", "application/csv") {
|
||||||
@Override
|
@Override
|
||||||
public InputStream getStream() throws IOException {
|
public InputStream getStream() throws IOException {
|
||||||
opened [0]++;
|
opened [0]++;
|
||||||
|
|
Loading…
Reference in New Issue