Skip to content

Let's apply our internal automated linter fixes #1043

Closed
@bpcreech

Description

@bpcreech

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.

  1. Remove a few unused imports
  2. Remove or narrow declared and caught checked exceptions across the board to match what's actually possible.
  3. Remove unnecessary use of Guava Functions and lambdas where direct method references will do.
  4. Remove unnecessary use of on-the-fly class declarations where very short lambdas will do
  5. Make all member variables final that we safely can.
  6. Stylistically, reference inner classes (especially enums and Builders) wrt their outer class.
  7. Fix javadocs which include unescaped < and >.
  8. A few Javadoc fixes to make code links explicit
  9. Fix botched attempt to write @code in Logging.java
  10. Simplify some switch/cases (joining redundant cases and removing unnecessary default cases)
  11. Switch to Immutable collections wherever it's clearly possible.
  12. Add @Override in places where relevant
  13. Add buildOrThrow where possible on protos
  14. Replace assertTrue with more specific things (assertEquals, assertSame, assertThat(X).isLessThan(Y), etc)
  15. Remove unnecessary declaration of variables which are only returned
  16. Remove unnecessary generic type specification on right-hand side of assignments.
  17. Switch from LinkedList to ArrayDeque since the latter is essentially always more efficient and we're only using it as a deque.
  18. Switching string splitting to com.google.common.base.Splitter which is more efficient.
  19. Switch from String.toLowerCase to Ascii.toLowerCase for consistency in the face of different system locales
  20. Switch from String.equals("") to String.empty() in a few places
  21. Use Collections.addAll(X, Y) instead of X.addAll(Arrays.asList(Y)) converting an array to a list.
  22. Remove unnecessary class qualification in a few places
  23. Make the Instrumentation class final and uninstantiatable since it only has static members.
  24. Stop checking for null on non-nullable protobuf members.
  25. Remove one mysterious unnecessary String.valueOf to make an identical string from a string.
  26. Replace one == on a String with .equals
  27. Misc other small things

Metadata

Metadata

Assignees

Labels

api: loggingIssues related to the googleapis/java-logging API.priority: p2Moderately-important priority. Fix may not be included in next release.type: cleanupAn internal cleanup or hygiene concern.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions