File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
objectbox-java/src/main/java/io/objectbox/query Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 5858 * @param <T> Entity class for which the Query is built.
5959 */
6060@ SuppressWarnings ({"WeakerAccess" , "UnusedReturnValue" , "unused" })
61- public class QueryBuilder <T > implements Closeable {
61+ public class QueryBuilder <T > {
6262
6363 public enum StringOrder {
6464 /**
@@ -229,7 +229,9 @@ private QueryBuilder(long storeHandle, long subQueryBuilderHandle) {
229229 }
230230
231231 /**
232- * Explicitly call {@link #close()} instead to avoid expensive finalization.
232+ * Typically {@link #build()} is called on this which calls {@link #close()} and avoids expensive finalization here.
233+ * <p>
234+ * If {@link #build()} is not called, make sure to explicitly call {@link #close()}.
233235 */
234236 @ SuppressWarnings ("deprecation" ) // finalize()
235237 @ Override
@@ -238,6 +240,12 @@ protected void finalize() throws Throwable {
238240 super .finalize ();
239241 }
240242
243+ /**
244+ * Close this query builder and free used resources.
245+ * <p>
246+ * This is not required when calling {@link #build()}.
247+ */
248+ // Not implementing (Auto)Closeable as QueryBuilder is typically closed due to build() getting called.
241249 public synchronized void close () {
242250 if (handle != 0 ) {
243251 // Closeable recommendation: mark as "closed" before nativeDestroy could throw.
You can’t perform that action at this time.
0 commit comments