Closed
Description
In #1010 we added fixes from Google Error Prone. We have a lot more internal linter fixes!
Here's a run-down of things in this repo we can automatically fix. I'll send a PR.
- Remove a few unused imports
- Remove or narrow declared and caught checked exceptions across the board to match what's actually possible.
- Remove unnecessary use of Guava
Function
s and lambdas where direct method references will do. - Remove unnecessary use of on-the-fly class declarations where very short lambdas will do
- Make all member variables final that we safely can.
- Stylistically, reference inner classes (especially enums and Builders) wrt their outer class.
- Fix javadocs which include unescaped
<
and>
. - A few Javadoc fixes to make code links explicit
- Fix botched attempt to write
@code
inLogging.java
- Simplify some switch/cases (joining redundant cases and removing unnecessary default cases)
- Switch to Immutable collections wherever it's clearly possible.
- Add
@Override
in places where relevant - Add
buildOrThrow
where possible on protos - Replace
assertTrue
with more specific things (assertEquals
,assertSame
,assertThat(X).isLessThan(Y)
, etc) - Remove unnecessary declaration of variables which are only returned
- Remove unnecessary generic type specification on right-hand side of assignments.
- Switch from LinkedList to ArrayDeque since the latter is essentially always more efficient and we're only using it as a deque.
- Switching string splitting to
com.google.common.base.Splitter
which is more efficient. - Switch from
String.toLowerCase
toAscii.toLowerCase
for consistency in the face of different system locales - Switch from
String.equals("")
toString.empty()
in a few places - Use
Collections.addAll(X, Y)
instead ofX.addAll(Arrays.asList(Y))
converting an array to a list. - Remove unnecessary class qualification in a few places
- Make the Instrumentation class final and uninstantiatable since it only has static members.
- Stop checking for null on non-nullable protobuf members.
- Remove one mysterious unnecessary
String.valueOf
to make an identical string from a string. - Replace one
==
on aString
with.equals
- Misc other small things