Commit Graph

9630 Commits

Author SHA1 Message Date
David Ostrovsky 6672bacca4 Activate additional error prone checks
Change-Id: I1b351e04da9f08681f08aae9ce984c3d3285e88e
Signed-off-by: David Ostrovsky <david@ostrovsky.org>
2023-09-25 22:06:13 +02:00
Matthias Sohn a2bce029aa WorkingTreeIterator: directly filter input stream
This way we can avoid to access the byte buffers backing array.
Implement a ByteBufferInputStream to wrap a byte buffer which we can use
to expose the filter result as an input stream.

Change-Id: I461c82090de2562ea9b649b3f953aad4571e3d25
2023-09-25 22:06:13 +02:00
Matthias Sohn 84ced89dc3 [errorprone] Add missing javadoc summary
see https://google.github.io/styleguide/javaguide.html#s7.2-summary-fragment

Change-Id: Iaf4a6b55d4e4c59b7a2da3451164abb1bb47d4a1
2023-09-25 22:06:13 +02:00
Matthias Sohn d56ae55c83 [errorprone] Fix BadImport
See https://errorprone.info/bugpattern/BadImport

Change-Id: Iea98b15862ed0bc4bcad759a7240133769680808
2023-09-25 22:06:13 +02:00
Matthias Sohn a7edc7889c [errorprone] Prevent int expression may overflow
see https://errorprone.info/bugpattern/IntLongMath

Change-Id: Id201b7fc49b953d500e88b95e183127fe40ef6cc
2023-09-25 22:06:13 +02:00
Matthias Sohn 4cfe27dd06 [errorprone] Suppress ByteBufferBackingArray
The byte buffers used here are created by wrapping a byte[].

See https://errorprone.info/bugpattern/ByteBufferBackingArray

Change-Id: Idbc16d5ae4ff9f64b97be07a3cdf190716da191f
2023-09-25 22:06:12 +02:00
Matthias Sohn ac3794bf01 [errorprone] Suppress JavaLangClash to avoid breaking change
Renaming this class is a breaking change. Add a todo to rename it in
next major release.

See https://errorprone.info/bugpattern/JavaLangClash

Change-Id: I3528fd654e30d98f4ea43e71107d83324942141c
2023-09-25 22:06:12 +02:00
Matthias Sohn 049782743e [errorprone] Fix EqualsGetClass
See https://errorprone.info/bugpattern/EqualsGetClass

Change-Id: Ida19a7e60656f87518e5ae2ef5eae511edb5b837
2023-09-25 22:06:12 +02:00
Matthias Sohn 8c42901b54 [errorprone] MockSystemReader: fix CatchAndPrintStackTrace
See https://errorprone.info/bugpattern/CatchAndPrintStackTrace
Change-Id: If1ec66ea65eaef9311a650d8a5741a03ac76cb88

Change-Id: Ic52205bab141a4e3c6a9fefecf749f1ccfc0e491
2023-09-25 22:06:12 +02:00
Matthias Sohn 34fb4d487e [errorprone] MetaFilter: fix IdentityHashMapUsage
See https://errorprone.info/bugpattern/IdentityHashMapUsage

Change-Id: Ib49c2ca5506ea7468d2680faba254fa9cd430c2c
2023-09-25 22:06:12 +02:00
Matthias Sohn 7b79feb078 [errorprone] InternalFetchConnection: Suppress CatchAndPrintStackTrace
Handled by the client side pipe handling.

See https://errorprone.info/bugpattern/CatchAndPrintStackTrace

Change-Id: I4ae19dbd0d20d1a75b6587ce7ad36f58cb58dbc2
2023-09-25 22:06:12 +02:00
Matthias Sohn f8d91c2736 [errorprone] Don't swallow exception
See https://errorprone.info/bugpattern/UnusedException

Change-Id: I01568dfa22adbbaa50191aa2d0a445a3c252b803
2023-09-25 22:06:12 +02:00
Matthias Sohn 298f93e989 [errorprone] Fix inconsistent capitalization
See https://errorprone.info/bugpattern/InconsistentCapitalization

Change-Id: I5eaa35a053aca738e180fe22a05fad97877b7e0f
2023-09-25 22:06:12 +02:00
Matthias Sohn e5e54b61b4 [errorprone] PageRef#isStringRef: suppress UnusedMethod
See https://errorprone.info/bugpattern/UnusedMethod

Change-Id: I8c2ca60ac786e20edb7112c268d638aa2488bcb8
2023-09-25 22:06:12 +02:00
Matthias Sohn 37f60c7984 [errorprone] FileReftableStack: fix EqualsUnsafeCast
See https://errorprone.info/bugpattern/EqualsUnsafeCast

Change-Id: I23274c1850061f0574133f52692e125cfa6b92ff
2023-09-25 22:06:12 +02:00
Matthias Sohn bf92bb9bca [errorprone] Suppress MissingSummary for translation bundles
Change-Id: I4da51c7e089366b016a0cc64f768a151c24bc956
2023-09-25 22:06:12 +02:00
Matthias Sohn e23796cbdb [errorprone] CommandLineMergeTool: Remove unused constuctor
See https://errorprone.info/bugpattern/UnusedMethod

Change-Id: I711279d7b81c61111c7c129b3d119affc515fe70
2023-09-25 22:06:12 +02:00
Matthias Sohn 254ffbfb0d [errorprone] SimilarityRenameDetector: suppress IntLongMath
Indexes are positiv.

See https://errorprone.info/bugpattern/IntLongMath

Change-Id: I9ef90b3667f833e2d708ff608929990e0a09036c
2023-09-25 22:06:12 +02:00
Matthias Sohn 7092803ad2 Add comment why protocol list uses WeakReference
Change-Id: I997933cbf1bcae94a6edd9db58c25ec1bb96445f
2023-09-25 22:06:12 +02:00
Matthias Sohn d5bcf199c7 [errorprone] Transport: Suppress ModifyCollectionInEnhancedForLoop
CopyOnWriteArrayList is thread-safe.

See
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/concurrent/CopyOnWriteArrayList.html
https://errorprone.info/bugpattern/ModifyCollectionInEnhancedForLoop

Change-Id: I97c411e7d171cb39a9c0676b076d48103db6ff88
2023-09-25 22:05:14 +02:00
Matthias Sohn 8302377d91 [errorprone] Rename method parameter to silence InvalidParam
See https://errorprone.info/bugpattern/InvalidParam

Change-Id: I53279bc5e0fc59788d42994be9931857b918414b
2023-09-25 16:15:35 +02:00
Matthias Sohn e6c808600d [errorprone] MyersDiff#main: fix CatchAndPrintStackTrace
Use a PrintWriter similarly like Main#run of org.eclipse.jgit.pgm does.

See https://errorprone.info/bugpattern/CatchAndPrintStackTrace

Change-Id: I8ee34da53d94ddb72b73ae86bfebc3b7f0a3dc04
2023-09-25 16:15:35 +02:00
Matthias Sohn 2d16df1a07 [errorprone] TagCommand: Remove unused parameter of private method
See https://errorprone.info/bugpattern/UnusedVariable

Change-Id: I7e8aae3494ce60dbeb474f6bead0817c36276e69
2023-09-25 16:15:35 +02:00
Matthias Sohn 28d4b34902 [errorprone] PathFilter#getPathsBestEffort: fix ArrayAsKeyOfSetOrMap
See https://errorprone.info/bugpattern/ArrayAsKeyOfSetOrMap

Change-Id: Ia94899bfa68db39f4eb8bfca455c92f5c888647c
2023-09-25 16:15:35 +02:00
Matthias Sohn cda8ffdbb4 [errorprone] DirCacheEntry: suppress JavaInstantGetSecondsGetNano
We get the seconds in the line before we access nanos.

See https://errorprone.info/bugpattern/JavaInstantGetSecondsGetNano

Change-Id: If79690378d5b31d76b06d26e07434d3dff8c92fb
2023-09-25 16:15:34 +02:00
Matthias Sohn d0b9ab1c4a [errorprone] Directly implement functional interface
instead of saving it in a lambda. Prefer to implement the functional
interface method directly and use a method reference instead.

See https://errorprone.info/bugpattern/UnnecessaryLambda

Change-Id: I7f7ebd27cd6354545c157960718d9845882e1732
2023-09-25 16:15:34 +02:00
Matthias Sohn ba2f9affc6 [errorprone] InterruptTimer#terminate: ensure Thread#join succeeds
See https://errorprone.info/bugpattern/ThreadJoinLoop

Change-Id: Ia67a284311a156c22c18575470ee5fbf734e10cc
2023-09-25 16:15:34 +02:00
Matthias Sohn a17e05437b [errorprone] RawParseUtils@parseHexInt64: suppress IntLongMath
see https://errorprone.info/bugpattern/IntLongMath

Change-Id: I71acd5eec252b8c43d7c411f513e502694830727
2023-09-25 16:15:34 +02:00
Matthias Sohn 978cbb84c4 [errorprone] Exceptions should not override #toString
Instead of overriding #toString provide getter for additional
information so that code handling the exception can access it.

See https://errorprone.info/bugpattern/OverrideThrowableToString

Change-Id: Ie577ae9327e0234d55481253f2604b1644ea3f01
2023-09-25 16:15:34 +02:00
Matthias Sohn 1e92426c5a [errorprone] Fix invalid param in javadoc
See https://errorprone.info/bugpattern/InvalidParam

Change-Id: Ife74575bb4080c3386affbfbaf9373931d72c3f3
2023-09-25 16:15:33 +02:00
Matthias Sohn e53c1864e6 [errorprone] FS#searchPath: handle surprising behavior of String#split
See https://errorprone.info/bugpattern/StringSplitter

Change-Id: Ic80f6c53ea96537ed4d046621e774288fced7ce1
2023-09-25 16:15:33 +02:00
Matthias Sohn a94e54ce87 [errorprone] FileStoreAttributes#FUTURE_RUNNER: Fix corePoolSize
[ErroneousThreadPoolConstructorChecker] Thread pool size will never go
beyond corePoolSize if an unbounded queue is used.

see https://errorprone.info/bugpattern/ErroneousThreadPoolConstructorChecker

Change-Id: Icdeaffa05301567611682da86130440f863f2ecc
2023-09-22 23:31:28 +02:00
Matthias Sohn 13bea495c7 [errorprone] Express duration using seconds which is clearer
[CanonicalDuration] Duration can be expressed more clearly with
different units.

see https://errorprone.info/bugpattern/CanonicalDuration

Change-Id: I7f358b5adabee1523e56b109a2c81c74ec523b74
2023-09-22 23:31:28 +02:00
Matthias Sohn ec0657ba01 [errorprone] Use ArrayList instead of LinkedList
[JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or
ArrayDeque.

see https://errorprone.info/bugpattern/JdkObsolete

Change-Id: I13fb953f55fc7b6e007d6fd6a6a1bfd377773588
2023-09-22 23:31:28 +02:00
Matthias Sohn b4f4ae472a [errorprone] AddCommand#filepattern: use a more specific type
Variable type can use a more specific type to convey more information to
callers.
	private Collection<String> filepatterns;
	                  ^
    (see https://errorprone.info/bugpattern/PreferredInterfaceType)

Change-Id: I68b74de65aba3bb849ef508d7dcdd8b85b0ab100
2023-09-22 23:31:28 +02:00
Matthias Sohn ebdf71c117 [errorprone] Suppress UnnecessaryParentheses
for the sake of readability.

See https://errorprone.info/bugpattern/UnnecessaryParentheses

Change-Id: I8444db78c408d4e8bd71bf7e575b9af637900629
2023-09-22 23:31:28 +02:00
Matthias Sohn 4cf246c9ab [errorprone] Remove unnecessary parentheses
see https://errorprone.info/bugpattern/UnnecessaryParentheses

Change-Id: Id08cf0e05b3d35f139fc34e0aa83882555a8a81a
2023-09-22 23:31:27 +02:00
Matthias Sohn d65170603f tools/BUILD: Sort errorprone rules alphabetically
Change-Id: I006940eb8a7710d5b8ea66c6f805f0dd08e62a31
2023-09-22 17:04:19 +02:00
Matthias Sohn 136b8953e2 Update jetty to 10.0.16
Change-Id: I918e308e71fa978c9f25e3fad63c5f2e94ec3be7
2023-09-22 17:04:19 +02:00
Matthias Sohn ff10cd2d81 Update bazel to 6.3.2
With bazel 6.2.0 building the change
I918e308e71fa978c9f25e3fad63c5f2e94ec3be7 fails with this error:

$ bazelisk build all
INFO: Invocation ID: ba94402e-d1db-4920-ad46-58139ef7ca55
INFO: Analyzed target //:all (96 packages loaded, 1961 targets
configured).
INFO: Found 1 target...
ERROR: /Users/xxxxxxx/.cache/bazel/b645215973ac043930fa5900e337e822/external/jetty-util-ajax/jar/BUILD:3:12:
Extracting interface @jetty-util-ajax//jar:jar failed: (Segmentation
fault): ijar failed: error executing command (from target
@jetty-util-ajax//jar:jar)
external/remote_java_tools_darwin_arm64/java_tools/ijar/ijar
external/jetty-util-ajax/jar/jetty-util-ajax-10.0.16.jar ... (remaining
3 arguments skipped)
...

Updating bazel to 6.3.2 fixes this problem.

Release notes for bazel 6.3.2:
https://github.com/bazelbuild/bazel/releases/tag/6.3.2

Change-Id: I4f697b2f9a560732c89e2a0410ae6133e8c382ef
2023-09-22 17:04:18 +02:00
Matthias Sohn 01d6d8a193 DfsPackFile: remove unnecessary @SuppressWarnings("boxing")
Change-Id: I7af999dc4434b7b57bb7e0b84b9b64d24efce220
2023-09-22 17:04:18 +02:00
Matthias Sohn 1924d353ef CommitGraphWriter: Remove unnecessary semicolon
Change-Id: I8ea87d0ff3be8a541e72210f0da7fec1f43008e8
2023-09-22 17:00:15 +02:00
Matthias Sohn 4262150f74 CommitGraphWriter: fix boxing warnings
Change-Id: I35c3a3baadb8d7d73c01252fe4333fa2159722ee
2023-09-22 17:00:15 +02:00
Matthias Sohn c57257bc01 CommitGraphWriter#createCoreChunks: Remove not-thrown exceptions
Change-Id: I0e6f32ed415dc3a0ccadbeae46c979c378ebb0fc
2023-09-22 17:00:14 +02:00
Ivan Frade 2390a89f28 CommitGraphWriter: Decouple Stats from computing bloom filters
The public stats object is created only to be populated by the computation of
bloom filters.

Make the computation return its numbers with the results and copy them
to the stats when needed. This eliminates the side effects from the
computation and makes it easier to add more data to the stats later.

Change-Id: I7a5e55fc3a17f5a294edf3a3b725b2d9c0280a5a
2023-09-21 11:45:04 -07:00
Ivan Frade f1a9d92a30 CommitGraphWriter: Move bloom filter calculation out of createChunks
It looks confusing that the createChunks method calculates bloom
filters.

Make the calculations before and pass the result to the method.

Change-Id: If6e3c0e644f7f940f268ca7266f577f012278ff3
2023-09-20 13:55:11 -07:00
Ronald Bhuleskar e0bd4882fb Documentation: Move writeChangedPaths flag from commitGraph to gc section.
The flag commitGraph.writeChangedPaths is not correct. The option was introduced in commit 3b77e33 (Jul 19th) under gc section so updating the documentation to reflect it under correct section.

Change-Id: Ie8f82931594ed3fd1ee3e4532d2e7475878a33a1
2023-09-19 13:33:37 -07:00
Matthias Sohn 916200e278 [errorprone] Fix wrong comparison which always evaluated to false
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/commitgraph/GraphObjectIndex.java:59:
error: [ComparisonOutOfRange] ints may have a value in the range
-2147483648 to 2147483647; therefore, this comparison to
Integer.MAX_VALUE will always evaluate to false
			if (table[k] > Integer.MAX_VALUE) {
			             ^

See https://errorprone.info/bugpattern/ComparisonOutOfRange

We need to check if variable `uint` of type `long` exceeds the maximum
possible int value before casting it to `int` below.

This was introduced in Ib5c0d6678cb242870a0f5841bd413ad3885e95f6

Change-Id: I675d594f523084be4c1678328cc343065e32d998
2023-09-15 12:12:25 +02:00
Matthias Sohn cf5ec856bd [errorprone] Remove unnecessary comparison
Raised by errorprone:

org.eclipse.jgit/src/org/eclipse/jgit/lib/CommitConfig.java:406: error:
[ComparisonOutOfRange] chars may have a value in the range 0 to 65535;
therefore, this comparison to 0 will always evaluate to true
					if (ch >= 0 && ch < inUse.length) {
					       ^
see https://errorprone.info/bugpattern/ComparisonOutOfRange

Change-Id: I9625aa7894a34dbffd77d39a40c6e285c86b56d5
2023-09-15 11:55:04 +02:00
Matthias Sohn 290902d9f3 Update org.eclipse.jdt:ecj to 3.35.0
Change-Id: Ic1d7fe65a0255bc0cdaf7a7285dd3532277ec07b
2023-09-15 02:07:36 +02:00