diff --git a/java/memory/memory-core/pom.xml b/java/memory/memory-core/pom.xml
index ce78fc479232..db1b0199bb72 100644
--- a/java/memory/memory-core/pom.xml
+++ b/java/memory/memory-core/pom.xml
@@ -47,6 +47,10 @@ under the License.
org.checkerframework
checker-qual
+
+ com.google.errorprone
+ error_prone_annotations
+
diff --git a/java/memory/memory-core/src/main/java/module-info.java b/java/memory/memory-core/src/main/java/module-info.java
index e2a07626c386..e74044ea41d4 100644
--- a/java/memory/memory-core/src/main/java/module-info.java
+++ b/java/memory/memory-core/src/main/java/module-info.java
@@ -27,5 +27,6 @@
requires jsr305;
requires static org.checkerframework.checker.qual;
requires static org.immutables.value.annotations;
+ requires static com.google.errorprone.annotations;
requires org.slf4j;
}
diff --git a/java/memory/memory-core/src/main/java/org/apache/arrow/memory/BaseAllocator.java b/java/memory/memory-core/src/main/java/org/apache/arrow/memory/BaseAllocator.java
index 3f4426d2c36e..dd6375e910b9 100644
--- a/java/memory/memory-core/src/main/java/org/apache/arrow/memory/BaseAllocator.java
+++ b/java/memory/memory-core/src/main/java/org/apache/arrow/memory/BaseAllocator.java
@@ -16,6 +16,8 @@
*/
package org.apache.arrow.memory;
+import com.google.errorprone.annotations.FormatMethod;
+import com.google.errorprone.annotations.FormatString;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -539,9 +541,8 @@ public String toVerboseString() {
return sb.toString();
}
- /* Remove @SuppressWarnings after fixing https://github.com/apache/arrow/issues/41951 */
- @SuppressWarnings("FormatStringAnnotation")
- private void hist(String noteFormat, Object... args) {
+ @FormatMethod
+ private void hist(@FormatString String noteFormat, Object... args) {
if (historicalLog != null) {
historicalLog.recordEvent(noteFormat, args);
}
diff --git a/java/memory/memory-core/src/main/java/org/apache/arrow/memory/util/HistoricalLog.java b/java/memory/memory-core/src/main/java/org/apache/arrow/memory/util/HistoricalLog.java
index 659ddde28df9..5b1bdd8b7244 100644
--- a/java/memory/memory-core/src/main/java/org/apache/arrow/memory/util/HistoricalLog.java
+++ b/java/memory/memory-core/src/main/java/org/apache/arrow/memory/util/HistoricalLog.java
@@ -16,6 +16,8 @@
*/
package org.apache.arrow.memory.util;
+import com.google.errorprone.annotations.FormatMethod;
+import com.google.errorprone.annotations.FormatString;
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Deque;
@@ -42,9 +44,8 @@ public class HistoricalLog {
* object instance is best.
* @param args for the format string, or nothing if none are required
*/
- @SuppressWarnings("FormatStringAnnotation")
- /* Remove @SuppressWarnings after fixing https://github.com/apache/arrow/issues/41951 */
- public HistoricalLog(final String idStringFormat, Object... args) {
+ @FormatMethod
+ public HistoricalLog(@FormatString final String idStringFormat, Object... args) {
this(Integer.MAX_VALUE, idStringFormat, args);
}
@@ -65,9 +66,8 @@ public HistoricalLog(final String idStringFormat, Object... args) {
* object instance is best.
* @param args for the format string, or nothing if none are required
*/
- @SuppressWarnings("AnnotateFormatMethod")
- public HistoricalLog(final int limit, final String idStringFormat, Object... args) {
- // Remove @SuppressWarnings after fixing https://github.com/apache/arrow/issues/41951
+ @FormatMethod
+ public HistoricalLog(final int limit, @FormatString final String idStringFormat, Object... args) {
this.limit = limit;
this.idString = String.format(idStringFormat, args);
this.firstEvent = null;
@@ -80,9 +80,8 @@ public HistoricalLog(final int limit, final String idStringFormat, Object... arg
* @param noteFormat {@link String#format} format string that describes the event
* @param args for the format string, or nothing if none are required
*/
- @SuppressWarnings("AnnotateFormatMethod")
- public synchronized void recordEvent(final String noteFormat, Object... args) {
- // Remove @SuppressWarnings after fixing https://github.com/apache/arrow/issues/41951
+ @FormatMethod
+ public synchronized void recordEvent(@FormatString final String noteFormat, Object... args) {
final String note = String.format(noteFormat, args);
final Event event = new Event(note);
if (firstEvent == null) {
diff --git a/java/pom.xml b/java/pom.xml
index 4228496ef682..4663e0f7433e 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -106,8 +106,7 @@ under the License.
2
true
- 9+181-r4173-1
- 2.28.0
+ 2.29.2
5.11.0
5.2.0
3.45.0
@@ -160,6 +159,12 @@ under the License.
jsr305
3.0.2
+
+ com.google.errorprone
+ error_prone_annotations
+ ${error_prone_core.version}
+ provided
+
org.slf4j
slf4j-api