@@ -169,7 +169,7 @@ public static boolean isObjectBrowserAvailable() {
169
169
private final Map <Class <?>, EntityInfo <?>> propertiesByClass = new HashMap <>();
170
170
private final LongHashMap <Class > classByEntityTypeId = new LongHashMap <>();
171
171
private final int [] allEntityTypeIds ;
172
- private final Map <Class , Box > boxes = new ConcurrentHashMap <>();
172
+ private final Map <Class <?> , Box <?> > boxes = new ConcurrentHashMap <>();
173
173
private final Set <Transaction > transactions = Collections .newSetFromMap (new WeakHashMap <>());
174
174
private final ExecutorService threadPool = new ObjectBoxThreadPool (this );
175
175
private final ObjectClassPublisher objectClassPublisher ;
@@ -609,7 +609,7 @@ void txCommitted(Transaction tx, @Nullable int[] entityTypeIdsAffected) {
609
609
}
610
610
}
611
611
612
- for (Box box : boxes .values ()) {
612
+ for (Box <?> box : boxes .values ()) {
613
613
box .txCommitted (tx );
614
614
}
615
615
@@ -623,17 +623,17 @@ void txCommitted(Transaction tx, @Nullable int[] entityTypeIdsAffected) {
623
623
* <p>
624
624
* Creates a Box only once and then always returns the cached instance.
625
625
*/
626
- @ SuppressWarnings ("unchecked" )
626
+ @ SuppressWarnings ("unchecked" ) // Casting is easier than writing a custom Map.
627
627
public <T > Box <T > boxFor (Class <T > entityClass ) {
628
- Box box = boxes .get (entityClass );
628
+ Box < T > box = ( Box < T >) boxes .get (entityClass );
629
629
if (box == null ) {
630
630
if (!dbNameByClass .containsKey (entityClass )) {
631
631
throw new IllegalArgumentException (entityClass +
632
632
" is not a known entity. Please add it and trigger generation again." );
633
633
}
634
634
// Ensure a box is created just once
635
635
synchronized (boxes ) {
636
- box = boxes .get (entityClass );
636
+ box = ( Box < T >) boxes .get (entityClass );
637
637
if (box == null ) {
638
638
box = new Box <>(this , entityClass );
639
639
boxes .put (entityClass , box );
@@ -689,7 +689,7 @@ public void runInReadTx(Runnable runnable) {
689
689
690
690
// TODO That's rather a quick fix, replace with a more general solution
691
691
// (that could maybe be a TX listener with abort callback?)
692
- for (Box box : boxes .values ()) {
692
+ for (Box <?> box : boxes .values ()) {
693
693
box .readTxFinished (tx );
694
694
}
695
695
@@ -773,7 +773,7 @@ public <T> T callInReadTx(Callable<T> callable) {
773
773
774
774
// TODO That's rather a quick fix, replace with a more general solution
775
775
// (that could maybe be a TX listener with abort callback?)
776
- for (Box box : boxes .values ()) {
776
+ for (Box <?> box : boxes .values ()) {
777
777
box .readTxFinished (tx );
778
778
}
779
779
@@ -886,7 +886,7 @@ public int cleanStaleReadTransactions() {
886
886
* {@link Box#closeThreadResources()} for all initiated boxes ({@link #boxFor(Class)}).
887
887
*/
888
888
public void closeThreadResources () {
889
- for (Box box : boxes .values ()) {
889
+ for (Box <?> box : boxes .values ()) {
890
890
box .closeThreadResources ();
891
891
}
892
892
// activeTx is cleaned up in finally blocks, so do not free them here
0 commit comments