Remove Xlint:-override,-fallthrough,-static
Adds `@SuppressWarnings("fallthrough")` in two places where the fallthrough is used to implement well known hashing algorithms.
This commit is contained in:
parent
1325c1442b
commit
20e7fa97db
|
@ -102,8 +102,8 @@ if (isEclipse) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked"
|
compileJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-serial,-try,-unchecked"
|
||||||
compileTestJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked"
|
compileTestJava.options.compilerArgs << "-Xlint:-cast,-deprecation,-rawtypes,-serial,-try,-unchecked"
|
||||||
|
|
||||||
forbiddenPatterns {
|
forbiddenPatterns {
|
||||||
exclude '**/*.json'
|
exclude '**/*.json'
|
||||||
|
|
|
@ -59,6 +59,7 @@ public enum MurmurHash3 {
|
||||||
* Note, this hashing function might be used to persist hashes, so if the way hashes are computed
|
* Note, this hashing function might be used to persist hashes, so if the way hashes are computed
|
||||||
* changes for some reason, it needs to be addressed (like in BloomFilter and MurmurHashField).
|
* changes for some reason, it needs to be addressed (like in BloomFilter and MurmurHashField).
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("fallthrough") // Intentionally uses fallthrough to implement a well known hashing algorithm
|
||||||
public static Hash128 hash128(byte[] key, int offset, int length, long seed, Hash128 hash) {
|
public static Hash128 hash128(byte[] key, int offset, int length, long seed, Hash128 hash) {
|
||||||
long h1 = seed;
|
long h1 = seed;
|
||||||
long h2 = seed;
|
long h2 = seed;
|
||||||
|
|
|
@ -258,6 +258,12 @@ public final class FactoryProvider2<F> implements InvocationHandler, Provider<F>
|
||||||
return o == this || o == factory;
|
return o == this || o == factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
// This way both this and its factory hash to the same spot, making hashCode consistent.
|
||||||
|
return factory.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if {@code thrown} can be thrown by {@code invoked} without wrapping.
|
* Returns true if {@code thrown} can be thrown by {@code invoked} without wrapping.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -519,6 +519,7 @@ public class BloomFilter {
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("fallthrough") // Uses fallthrough to implement a well know hashing algorithm
|
||||||
public static long hash3_x64_128(byte[] key, int offset, int length, long seed) {
|
public static long hash3_x64_128(byte[] key, int offset, int length, long seed) {
|
||||||
final int nblocks = length >> 4; // Process as 128-bit blocks.
|
final int nblocks = length >> 4; // Process as 128-bit blocks.
|
||||||
|
|
||||||
|
@ -598,7 +599,7 @@ public class BloomFilter {
|
||||||
case 2:
|
case 2:
|
||||||
k1 ^= ((long) key[offset + 1]) << 8;
|
k1 ^= ((long) key[offset + 1]) << 8;
|
||||||
case 1:
|
case 1:
|
||||||
k1 ^= ((long) key[offset]);
|
k1 ^= (key[offset]);
|
||||||
k1 *= c1;
|
k1 *= c1;
|
||||||
k1 = rotl64(k1, 31);
|
k1 = rotl64(k1, 31);
|
||||||
k1 *= c2;
|
k1 *= c2;
|
||||||
|
|
|
@ -58,11 +58,16 @@ public class SingleFieldsVisitor extends FieldsVisitor {
|
||||||
|
|
||||||
public void postProcess(MappedFieldType fieldType) {
|
public void postProcess(MappedFieldType fieldType) {
|
||||||
if (uid != null) {
|
if (uid != null) {
|
||||||
// TODO: this switch seems very wrong...either each case should be breaking, or this should not be a switch
|
|
||||||
switch (field) {
|
switch (field) {
|
||||||
case UidFieldMapper.NAME: addValue(field, uid.toString());
|
case UidFieldMapper.NAME:
|
||||||
case IdFieldMapper.NAME: addValue(field, uid.id());
|
addValue(field, uid.toString());
|
||||||
case TypeFieldMapper.NAME: addValue(field, uid.type());
|
break;
|
||||||
|
case IdFieldMapper.NAME:
|
||||||
|
addValue(field, uid.id());
|
||||||
|
break;
|
||||||
|
case TypeFieldMapper.NAME:
|
||||||
|
addValue(field, uid.type());
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,18 +151,10 @@ public class RandomExceptionCircuitBreakerIT extends ESIntegTestCase {
|
||||||
|
|
||||||
for (int i = 0; i < numSearches; i++) {
|
for (int i = 0; i < numSearches; i++) {
|
||||||
SearchRequestBuilder searchRequestBuilder = client().prepareSearch().setQuery(QueryBuilders.matchAllQuery());
|
SearchRequestBuilder searchRequestBuilder = client().prepareSearch().setQuery(QueryBuilders.matchAllQuery());
|
||||||
switch (randomIntBetween(0, 5)) {
|
if (random().nextBoolean()) {
|
||||||
case 5:
|
searchRequestBuilder.addSort("test-str", SortOrder.ASC);
|
||||||
case 4:
|
|
||||||
case 3:
|
|
||||||
searchRequestBuilder.addSort("test-str", SortOrder.ASC);
|
|
||||||
// fall through - sometimes get both fields
|
|
||||||
case 2:
|
|
||||||
case 1:
|
|
||||||
default:
|
|
||||||
searchRequestBuilder.addSort("test-num", SortOrder.ASC);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
searchRequestBuilder.addSort("test-num", SortOrder.ASC);
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
// Sort by the string and numeric fields, to load them into field data
|
// Sort by the string and numeric fields, to load them into field data
|
||||||
|
@ -249,6 +241,7 @@ public class RandomExceptionCircuitBreakerIT extends ESIntegTestCase {
|
||||||
if (random.nextDouble() < topLevelRatio) {
|
if (random.nextDouble() < topLevelRatio) {
|
||||||
throw new IOException("Forced top level Exception on [" + flag.name() + "]");
|
throw new IOException("Forced top level Exception on [" + flag.name() + "]");
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case Intersect:
|
case Intersect:
|
||||||
break;
|
break;
|
||||||
case Norms:
|
case Norms:
|
||||||
|
|
|
@ -56,11 +56,9 @@ dependencyLicenses {
|
||||||
mapping from: /jaxb-.*/, to: 'jaxb'
|
mapping from: /jaxb-.*/, to: 'jaxb'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.options.compilerArgs << '-Xlint:-path,-serial,-static,-unchecked'
|
compileJava.options.compilerArgs << '-Xlint:-path,-serial,-unchecked'
|
||||||
// TODO: why is deprecation needed here but not in maven....?
|
// TODO: why is deprecation needed here but not in maven....?
|
||||||
compileJava.options.compilerArgs << '-Xlint:-deprecation'
|
compileJava.options.compilerArgs << '-Xlint:-deprecation'
|
||||||
// TODO: and why does this static not show up in maven...
|
|
||||||
compileTestJava.options.compilerArgs << '-Xlint:-static'
|
|
||||||
|
|
||||||
thirdPartyAudit.excludes = [
|
thirdPartyAudit.excludes = [
|
||||||
// classes are missing
|
// classes are missing
|
||||||
|
|
|
@ -47,11 +47,7 @@ public class AzureDiscoveryModule extends AbstractModule {
|
||||||
private Settings settings;
|
private Settings settings;
|
||||||
|
|
||||||
// pkg private so it is settable by tests
|
// pkg private so it is settable by tests
|
||||||
static Class<? extends AzureComputeService> computeServiceImpl = AzureComputeServiceImpl.class;
|
Class<? extends AzureComputeService> computeServiceImpl = AzureComputeServiceImpl.class;
|
||||||
|
|
||||||
public static Class<? extends AzureComputeService> getComputeServiceImpl() {
|
|
||||||
return computeServiceImpl;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AzureDiscoveryModule(Settings settings) {
|
public AzureDiscoveryModule(Settings settings) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ dependencyLicenses {
|
||||||
mapping from: /asm-.*/, to: 'asm'
|
mapping from: /asm-.*/, to: 'asm'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.options.compilerArgs << '-Xlint:-cast,-fallthrough,-rawtypes'
|
compileJava.options.compilerArgs << '-Xlint:-cast,-rawtypes'
|
||||||
compileTestJava.options.compilerArgs << '-Xlint:-unchecked'
|
compileTestJava.options.compilerArgs << '-Xlint:-unchecked'
|
||||||
|
|
||||||
// regeneration logic, comes in via ant right now
|
// regeneration logic, comes in via ant right now
|
||||||
|
|
|
@ -2223,12 +2223,15 @@ class Analyzer extends PlanAParserBaseVisitor<Void> {
|
||||||
case LONG:
|
case LONG:
|
||||||
incremd.preConst = positive ? 1L : -1L;
|
incremd.preConst = positive ? 1L : -1L;
|
||||||
incremd.from = definition.longType;
|
incremd.from = definition.longType;
|
||||||
|
break;
|
||||||
case FLOAT:
|
case FLOAT:
|
||||||
incremd.preConst = positive ? 1.0F : -1.0F;
|
incremd.preConst = positive ? 1.0F : -1.0F;
|
||||||
incremd.from = definition.floatType;
|
incremd.from = definition.floatType;
|
||||||
|
break;
|
||||||
case DOUBLE:
|
case DOUBLE:
|
||||||
incremd.preConst = positive ? 1.0 : -1.0;
|
incremd.preConst = positive ? 1.0 : -1.0;
|
||||||
incremd.from = definition.doubleType;
|
incremd.from = definition.doubleType;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
incremd.preConst = positive ? 1 : -1;
|
incremd.preConst = positive ? 1 : -1;
|
||||||
incremd.from = definition.intType;
|
incremd.from = definition.intType;
|
||||||
|
|
|
@ -33,7 +33,7 @@ dependencies {
|
||||||
compile 'org.elasticsearch:securemock:1.2'
|
compile 'org.elasticsearch:securemock:1.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava.options.compilerArgs << '-Xlint:-cast,-deprecation,-fallthrough,-overrides,-rawtypes,-serial,-try,-unchecked'
|
compileJava.options.compilerArgs << '-Xlint:-cast,-deprecation,-rawtypes,-serial,-try,-unchecked'
|
||||||
compileTestJava.options.compilerArgs << '-Xlint:-rawtypes'
|
compileTestJava.options.compilerArgs << '-Xlint:-rawtypes'
|
||||||
|
|
||||||
// the main files are actually test files, so use the appopriate forbidden api sigs
|
// the main files are actually test files, so use the appopriate forbidden api sigs
|
||||||
|
|
Loading…
Reference in New Issue