lidavidm commented on code in PR #37723:
URL: https://github.com/apache/arrow/pull/37723#discussion_r1439490886


##########
java/memory/memory-core/src/main/java/org/apache/arrow/memory/util/CheckerFrameworkUtil.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+package org.apache.arrow.memory.util;
+
+import org.checkerframework.dataflow.qual.AssertMethod;
+
+/**
+ * Utility methods for handling global configuration into CheckerFramework 
library.
+ */
+public class CheckerFrameworkUtil {
+
+  /**
+   * Method annotation @AssertMethod indicates that a method checks a value 
and possibly
+   * throws an assertion. Using it can make flow-sensitive type refinement 
more effective.
+   *
+   * @param eval The assertion to be evaluated at compile time
+   */
+  @AssertMethod
+  public static void assertMethod(boolean eval) {

Review Comment:
   We already have Preconditions; can we just annotate that?



##########
java/memory/memory-core/src/main/java/org/apache/arrow/memory/util/CheckerFrameworkUtil.java:
##########
@@ -0,0 +1,39 @@
+/*
+ * 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.
+ */
+
+package org.apache.arrow.memory.util;
+
+import org.checkerframework.dataflow.qual.AssertMethod;
+
+/**
+ * Utility methods for handling global configuration into CheckerFramework 
library.
+ */
+public class CheckerFrameworkUtil {
+
+  /**
+   * Method annotation @AssertMethod indicates that a method checks a value 
and possibly
+   * throws an assertion. Using it can make flow-sensitive type refinement 
more effective.
+   *
+   * @param eval The assertion to be evaluated at compile time
+   */
+  @AssertMethod
+  public static void assertMethod(boolean eval) {

Review Comment:
   Alternatively, I'm led to believe that just bare `assert` is also understood 
by Checker Framework.



##########
java/memory/memory-core/src/main/java/org/apache/arrow/memory/Accountant.java:
##########
@@ -59,7 +61,7 @@ class Accountant implements AutoCloseable {
    */
   private final AtomicLong locallyHeldMemory = new AtomicLong();
 
-  public Accountant(Accountant parent, String name, long reservation, long 
maxAllocation) {
+  public Accountant(@Nullable Accountant parent, String name, long 
reservation, long maxAllocation) {

Review Comment:
   The default is to assume non-null, I believe



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to