src/macosx/classes/sun/font/CStrike.java

Print this page
rev 10199 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz, prappo
Contributed-by: Otavio Santana <otaviojava@java.net>


 398                 if (-index < SECOND_LAYER_SIZE) {
 399                     // catch common unicodes
 400                     if (secondLayerCache == null) {
 401                         secondLayerCache = new SparseBitShiftingTwoLayerArray(SECOND_LAYER_SIZE, 7); // 128x128
 402                     }
 403                     secondLayerCache.put(-index, value);
 404                     return;
 405                 }
 406             } else {
 407                 if (index < FIRST_LAYER_SIZE) {
 408                     // catch common glyphcodes
 409                     firstLayerCache[index] = value;
 410                     return;
 411                 }
 412             }
 413 
 414             if (generalCache == null) {
 415                 generalCache = new HashMap<Integer, Long>();
 416             }
 417 
 418             generalCache.put(new Integer(index), new Long(value));
 419         }
 420 
 421         public synchronized void dispose() {
 422             // rdar://problem/5204197
 423             // Note that sun.font.Font2D.getStrike() actively disposes
 424             // cleared strikeRef.  We need to check the disposed flag to
 425             // prevent double frees of native resources.
 426             if (disposed) {
 427                 return;
 428             }
 429 
 430             super.dispose();
 431 
 432             // clean out the first array
 433             disposeLongArray(firstLayerCache);
 434 
 435             // clean out the two layer arrays
 436             if (secondLayerCache != null) {
 437                 final long[][] secondLayerLongArrayArray = secondLayerCache.cache;
 438                 for (int i = 0; i < secondLayerLongArrayArray.length; i++) {




 398                 if (-index < SECOND_LAYER_SIZE) {
 399                     // catch common unicodes
 400                     if (secondLayerCache == null) {
 401                         secondLayerCache = new SparseBitShiftingTwoLayerArray(SECOND_LAYER_SIZE, 7); // 128x128
 402                     }
 403                     secondLayerCache.put(-index, value);
 404                     return;
 405                 }
 406             } else {
 407                 if (index < FIRST_LAYER_SIZE) {
 408                     // catch common glyphcodes
 409                     firstLayerCache[index] = value;
 410                     return;
 411                 }
 412             }
 413 
 414             if (generalCache == null) {
 415                 generalCache = new HashMap<Integer, Long>();
 416             }
 417 
 418             generalCache.put(new Integer(index), Long.valueOf(value));
 419         }
 420 
 421         public synchronized void dispose() {
 422             // rdar://problem/5204197
 423             // Note that sun.font.Font2D.getStrike() actively disposes
 424             // cleared strikeRef.  We need to check the disposed flag to
 425             // prevent double frees of native resources.
 426             if (disposed) {
 427                 return;
 428             }
 429 
 430             super.dispose();
 431 
 432             // clean out the first array
 433             disposeLongArray(firstLayerCache);
 434 
 435             // clean out the two layer arrays
 436             if (secondLayerCache != null) {
 437                 final long[][] secondLayerLongArrayArray = secondLayerCache.cache;
 438                 for (int i = 0; i < secondLayerLongArrayArray.length; i++) {