New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LUCENE-9497: add google error prone checks #1828
Changes from all commits
148f5dd
e2eb87f
9b882fb
006f657
c2c4aea
aedae13
1942d4d
2dd9a1b
3fc25ef
4e12bb3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
allprojects { prj -> | ||
plugins.withType(JavaPlugin) { | ||
prj.apply plugin: 'net.ltgt.errorprone' | ||
|
||
dependencies { | ||
errorprone("com.google.errorprone:error_prone_core") | ||
} | ||
|
||
tasks.withType(JavaCompile) { task -> | ||
options.errorprone.errorproneArgs = [ | ||
// test | ||
'-Xep:ExtendingJUnitAssert:OFF', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Personal style, but I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am okay with either of the two styles. Ideally we'd want this list to get much shorter soon :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Varun - feel free to take this branch (or patch) and roll it out on yours. I didn't intend it to be committed, I just wanted to show what's needed for it to compile and work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sounds good! I'll take the current branch and add two things and then commit the code
|
||
'-Xep:UseCorrectAssertInTests:OFF', | ||
'-Xep:DefaultPackage:OFF', | ||
'-Xep:FloatingPointLiteralPrecision:OFF', | ||
'-Xep:CatchFail:OFF', | ||
'-Xep:TryFailThrowable:OFF', | ||
'-Xep:MathAbsoluteRandom:OFF', | ||
'-Xep:AssertionFailureIgnored:OFF', | ||
'-Xep:JUnit4TestNotRun:OFF', | ||
'-Xep:FallThrough:OFF', | ||
'-Xep:CatchAndPrintStackTrace:OFF', | ||
'-Xep:ToStringReturnsNull:OFF', | ||
'-Xep:ArrayAsKeyOfSetOrMap:OFF', | ||
'-Xep:StaticAssignmentInConstructor:OFF', | ||
'-Xep:SelfAssignment:OFF', | ||
'-Xep:InvalidPatternSyntax:OFF', | ||
'-Xep:MissingFail:OFF', | ||
'-Xep:LossyPrimitiveCompare:OFF', | ||
'-Xep:ComparableType:OFF', | ||
'-Xep:InfiniteRecursion:OFF', | ||
'-Xep:MisusedDayOfYear:OFF', | ||
'-Xep:FloatingPointAssertionWithinEpsilon:OFF', | ||
|
||
'-Xep:ThrowNull:OFF', | ||
'-Xep:StaticGuardedByInstance:OFF', | ||
'-Xep:ArrayHashCode:OFF', | ||
'-Xep:ArrayEquals:OFF', | ||
'-Xep:IdentityBinaryExpression:OFF', | ||
'-Xep:ComplexBooleanConstant:OFF', | ||
'-Xep:ComplexBooleanConstant:OFF', | ||
'-Xep:StreamResourceLeak:OFF', | ||
'-Xep:UnnecessaryLambda:OFF', | ||
'-Xep:ObjectToString:OFF', | ||
'-Xep:URLEqualsHashCode:OFF', | ||
'-Xep:DoubleBraceInitialization:OFF', | ||
'-Xep:ShortCircuitBoolean:OFF', | ||
'-Xep:InputStreamSlowMultibyteRead:OFF', | ||
'-Xep:NonCanonicalType:OFF', | ||
'-Xep:CollectionIncompatibleType:OFF', | ||
'-Xep:TypeParameterShadowing:OFF', | ||
'-Xep:ThreadJoinLoop:OFF', | ||
'-Xep:MutableConstantField:OFF', | ||
'-Xep:ReturnValueIgnored:OFF', | ||
'-Xep:CollectionIncompatibleType:OFF', | ||
'-Xep:SameNameButDifferent:OFF', | ||
'-Xep:InvalidParam:OFF', | ||
'-Xep:CompareToZero:OFF', | ||
'-Xep:DoubleCheckedLocking:OFF', | ||
'-Xep:BadShiftAmount:OFF', | ||
'-Xep:CollectionUndefinedEquality:OFF', | ||
'-Xep:UnescapedEntity:OFF', | ||
'-Xep:BoxedPrimitiveEquality:OFF', | ||
'-Xep:LogicalAssignment:OFF', | ||
'-Xep:DoubleCheckedLocking:OFF', | ||
'-Xep:AmbiguousMethodReference:OFF', | ||
'-Xep:FormatString:OFF', | ||
'-Xep:InstanceOfAndCastMatchWrongType:OFF', | ||
'-Xep:ModifyCollectionInEnhancedForLoop:OFF', | ||
'-Xep:JavaLangClash:OFF', | ||
'-Xep:TypeParameterUnusedInFormals:OFF', | ||
'-Xep:UnusedNestedClass:OFF', | ||
'-Xep:OverrideThrowableToString:OFF', | ||
'-Xep:FutureReturnValueIgnored:OFF', | ||
'-Xep:BadInstanceof:OFF', | ||
'-Xep:UnusedNestedClass:OFF', | ||
'-Xep:OverrideThrowableToString:OFF', | ||
'-Xep:EqualsIncompatibleType:OFF', | ||
'-Xep:ByteBufferBackingArray:OFF', | ||
'-Xep:ByteBufferBackingArray:OFF', | ||
'-Xep:UnusedMethod:OFF', | ||
'-Xep:ObjectsHashCodePrimitive:OFF', | ||
'-Xep:ObjectsHashCodePrimitive:OFF', | ||
'-Xep:UnnecessaryAnonymousClass:OFF', | ||
'-Xep:BoxedPrimitiveConstructor:OFF', | ||
'-Xep:ArgumentSelectionDefectChecker:OFF', | ||
'-Xep:StringSplitter:OFF', | ||
'-Xep:MixedMutabilityReturnType:OFF', | ||
'-Xep:EqualsUnsafeCast:OFF', | ||
'-Xep:OperatorPrecedence:OFF', | ||
'-Xep:HidingField:OFF', | ||
'-Xep:ThreadPriorityCheck:OFF', | ||
'-Xep:InlineFormatString:OFF', | ||
'-Xep:EqualsUnsafeCast:OFF', | ||
'-Xep:UnsynchronizedOverridesSynchronized:OFF', | ||
'-Xep:OperatorPrecedence:OFF', | ||
'-Xep:ArrayToString:OFF', | ||
'-Xep:ClassCanBeStatic:OFF', | ||
'-Xep:InvalidInlineTag:OFF', | ||
'-Xep:EmptyCatch:OFF', | ||
'-Xep:UnnecessaryParentheses:OFF', | ||
'-Xep:AlmostJavadoc:OFF', | ||
'-Xep:Finally:OFF', | ||
'-Xep:ImmutableEnumChecker:OFF', | ||
'-Xep:NonAtomicVolatileUpdate:OFF', | ||
'-Xep:MutablePublicArray:OFF', | ||
'-Xep:LockNotBeforeTry:OFF', | ||
'-Xep:WaitNotInLoop:OFF', | ||
'-Xep:UndefinedEquals:OFF', | ||
'-Xep:JdkObsolete:OFF', | ||
'-Xep:NarrowingCompoundAssignment:OFF', | ||
'-Xep:InconsistentCapitalization:OFF', | ||
'-Xep:IntLongMath:OFF', | ||
'-Xep:SynchronizeOnNonFinalField:OFF', | ||
'-Xep:ThreadLocalUsage:OFF', | ||
'-Xep:ProtectedMembersInFinalClass:OFF', | ||
'-Xep:BadImport:OFF', | ||
'-Xep:InconsistentHashCode:OFF', | ||
'-Xep:MissingOverride:OFF', | ||
'-Xep:EqualsGetClass:OFF', | ||
'-Xep:PublicConstructorForAbstractClass:OFF', | ||
'-Xep:EscapedEntity:OFF', | ||
'-Xep:ModifiedButNotUsed:OFF', | ||
'-Xep:ReferenceEquality:OFF', | ||
'-Xep:InvalidBlockTag:OFF', | ||
'-Xep:MissingSummary:OFF', | ||
'-Xep:UnusedVariable:OFF' | ||
] | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -523,6 +523,7 @@ public void clear() { | |
* @throws NullPointerException | ||
* if the given map is <code>null</code>. | ||
*/ | ||
@SuppressWarnings("ReferenceEquality") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was the example you wanted to try out on how to suppress legitimate warnings of ReferenceEquality ( or any other warnings ) when we start enabling the checks ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, exactly. I wanted the pr to include an example of how this can be done. |
||
public static <V> CharArrayMap<V> unmodifiableMap(CharArrayMap<V> map) { | ||
if (map == null) | ||
throw new NullPointerException("Given map is null"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would also like to see
options.errorprone.disableWarningsInGeneratedCode = true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggested the same to Varun.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add this ? I probably missed it in my PR