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 58
58
* @param <T> Entity class for which the Query is built.
59
59
*/
60
60
@ SuppressWarnings ({"WeakerAccess" , "UnusedReturnValue" , "unused" })
61
- public class QueryBuilder <T > implements Closeable {
61
+ public class QueryBuilder <T > {
62
62
63
63
public enum StringOrder {
64
64
/**
@@ -229,7 +229,9 @@ private QueryBuilder(long storeHandle, long subQueryBuilderHandle) {
229
229
}
230
230
231
231
/**
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()}.
233
235
*/
234
236
@ SuppressWarnings ("deprecation" ) // finalize()
235
237
@ Override
@@ -238,6 +240,12 @@ protected void finalize() throws Throwable {
238
240
super .finalize ();
239
241
}
240
242
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.
241
249
public synchronized void close () {
242
250
if (handle != 0 ) {
243
251
// Closeable recommendation: mark as "closed" before nativeDestroy could throw.
You can’t perform that action at this time.
0 commit comments