mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-20 02:17:53 +00:00
8038644: Fix raw and unchecked warnings in sun.java2d.*
Reviewed-by: darcy, prr
This commit is contained in:
parent
0a31e5f246
commit
81ae76b8dd
@ -49,7 +49,7 @@ public class Spans {
|
||||
* Holds a list of individual
|
||||
* Span instances.
|
||||
*/
|
||||
private List mSpans = new Vector(kMaxAddsSinceSort);
|
||||
private List<Span> mSpans = new Vector<>(kMaxAddsSinceSort);
|
||||
|
||||
/**
|
||||
* The number of <code>Span</code>
|
||||
@ -144,7 +144,7 @@ public class Spans {
|
||||
Collections.sort(mSpans);
|
||||
mAddsSinceSort = 0;
|
||||
|
||||
Iterator iter = mSpans.iterator();
|
||||
Iterator<Span> iter = mSpans.iterator();
|
||||
|
||||
/* Have 'span' start at the first span in
|
||||
* the collection. The collection may be empty
|
||||
@ -152,7 +152,7 @@ public class Spans {
|
||||
*/
|
||||
Span span = null;
|
||||
if (iter.hasNext()) {
|
||||
span = (Span) iter.next();
|
||||
span = iter.next();
|
||||
}
|
||||
|
||||
/* Loop over the spans collapsing those that intersect
|
||||
@ -160,7 +160,7 @@ public class Spans {
|
||||
*/
|
||||
while (iter.hasNext()) {
|
||||
|
||||
Span nextSpan = (Span) iter.next();
|
||||
Span nextSpan = iter.next();
|
||||
|
||||
/* The spans are in ascending start position
|
||||
* order and so the next span's starting point
|
||||
@ -202,9 +202,9 @@ public class Spans {
|
||||
private void printSpans() {
|
||||
System.out.println("----------");
|
||||
if (mSpans != null) {
|
||||
Iterator iter = mSpans.iterator();
|
||||
Iterator<Span> iter = mSpans.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Span span = (Span) iter.next();
|
||||
Span span = iter.next();
|
||||
System.out.println(span);
|
||||
}
|
||||
}
|
||||
@ -216,7 +216,7 @@ public class Spans {
|
||||
/**
|
||||
* Holds a single half-open interval.
|
||||
*/
|
||||
static class Span implements Comparable {
|
||||
static class Span implements Comparable<Span> {
|
||||
|
||||
/**
|
||||
* The span includes the starting point.
|
||||
@ -315,8 +315,7 @@ public class Spans {
|
||||
* position. The end position is ignored
|
||||
* in this ranking.
|
||||
*/
|
||||
public int compareTo(Object o) {
|
||||
Span otherSpan = (Span) o;
|
||||
public int compareTo(Span otherSpan) {
|
||||
float otherStart = otherSpan.getStart();
|
||||
int result;
|
||||
|
||||
@ -345,7 +344,7 @@ public class Spans {
|
||||
* <code>SpanIntersection.instance</code> to
|
||||
* get the single instance of this class.
|
||||
*/
|
||||
static class SpanIntersection implements Comparator {
|
||||
static class SpanIntersection implements Comparator<Span> {
|
||||
|
||||
/**
|
||||
* This class is a Singleton and the following
|
||||
@ -361,10 +360,8 @@ public class Spans {
|
||||
|
||||
}
|
||||
|
||||
public int compare(Object o1, Object o2) {
|
||||
public int compare(Span span1, Span span2) {
|
||||
int result;
|
||||
Span span1 = (Span) o1;
|
||||
Span span2 = (Span) o2;
|
||||
|
||||
/* Span 1 is entirely to the left of span2.
|
||||
* span1: <-----<
|
||||
|
||||
@ -1430,8 +1430,11 @@ public final class SunGraphics2D
|
||||
}
|
||||
}
|
||||
|
||||
RenderingHints makeHints(Map hints) {
|
||||
RenderingHints model = new RenderingHints(hints);
|
||||
RenderingHints makeHints(Map<?,?> hints) {
|
||||
RenderingHints model = new RenderingHints(null);
|
||||
if (hints != null) {
|
||||
model.putAll(hints);
|
||||
}
|
||||
model.put(SunHints.KEY_RENDERING,
|
||||
SunHints.Value.get(SunHints.INTKEY_RENDERING,
|
||||
renderHint));
|
||||
|
||||
@ -82,7 +82,7 @@ public abstract class SunGraphicsEnvironment extends GraphicsEnvironment
|
||||
|
||||
public SunGraphicsEnvironment() {
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction() {
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
String version = System.getProperty("os.version", "0.0");
|
||||
try {
|
||||
|
||||
@ -189,7 +189,7 @@ public class LCMS implements PCMM {
|
||||
LCMSImageLayout dest);
|
||||
public static native void freeTransform(long ID);
|
||||
|
||||
public static native void initLCMS(Class Trans, Class IL, Class Pf);
|
||||
public static native void initLCMS(Class<?> Trans, Class<?> IL, Class<?> Pf);
|
||||
|
||||
private LCMS() {};
|
||||
|
||||
@ -201,7 +201,7 @@ public class LCMS implements PCMM {
|
||||
}
|
||||
|
||||
java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction() {
|
||||
new java.security.PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
/* We need to load awt here because of usage trace and
|
||||
* disposer frameworks
|
||||
|
||||
@ -217,8 +217,8 @@ public class Blit extends GraphicsPrimitive
|
||||
Blit performop;
|
||||
Blit convertresult;
|
||||
|
||||
WeakReference srcTmp;
|
||||
WeakReference dstTmp;
|
||||
WeakReference<SurfaceData> srcTmp;
|
||||
WeakReference<SurfaceData> dstTmp;
|
||||
|
||||
public GeneralXorBlit(SurfaceType srctype,
|
||||
CompositeType comptype,
|
||||
@ -257,14 +257,14 @@ public class Blit extends GraphicsPrimitive
|
||||
} else {
|
||||
SurfaceData cachedSrc = null;
|
||||
if (srcTmp != null) {
|
||||
cachedSrc = (SurfaceData) srcTmp.get();
|
||||
cachedSrc = srcTmp.get();
|
||||
}
|
||||
src = convertFrom(convertsrc, srcData, srcx, srcy,
|
||||
width, height, cachedSrc);
|
||||
sx = 0;
|
||||
sy = 0;
|
||||
if (src != cachedSrc) {
|
||||
srcTmp = new WeakReference(src);
|
||||
srcTmp = new WeakReference<>(src);
|
||||
}
|
||||
}
|
||||
|
||||
@ -277,7 +277,7 @@ public class Blit extends GraphicsPrimitive
|
||||
// assert: convertresult != null
|
||||
SurfaceData cachedDst = null;
|
||||
if (dstTmp != null) {
|
||||
cachedDst = (SurfaceData) dstTmp.get();
|
||||
cachedDst = dstTmp.get();
|
||||
}
|
||||
dst = convertFrom(convertdst, dstData, dstx, dsty,
|
||||
width, height, cachedDst);
|
||||
@ -285,7 +285,7 @@ public class Blit extends GraphicsPrimitive
|
||||
dy = 0;
|
||||
opclip = null;
|
||||
if (dst != cachedDst) {
|
||||
dstTmp = new WeakReference(dst);
|
||||
dstTmp = new WeakReference<>(dst);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -50,7 +50,7 @@ public final class CustomComponent {
|
||||
public static void register() {
|
||||
// REMIND: This does not work for all destinations yet since
|
||||
// the screen SurfaceData objects do not implement getRaster
|
||||
Class owner = CustomComponent.class;
|
||||
Class<?> owner = CustomComponent.class;
|
||||
GraphicsPrimitive[] primitives = {
|
||||
new GraphicsPrimitiveProxy(owner, "OpaqueCopyAnyToArgb",
|
||||
Blit.methodSignature,
|
||||
|
||||
@ -50,7 +50,7 @@ import sun.font.GlyphList;
|
||||
|
||||
public final class GeneralRenderer {
|
||||
public static void register() {
|
||||
Class owner = GeneralRenderer.class;
|
||||
Class<?> owner = GeneralRenderer.class;
|
||||
GraphicsPrimitive[] primitives = {
|
||||
new GraphicsPrimitiveProxy(owner, "SetFillRectANY",
|
||||
FillRect.methodSignature,
|
||||
|
||||
@ -316,7 +316,7 @@ public abstract class GraphicsPrimitive {
|
||||
|
||||
public abstract GraphicsPrimitive traceWrap();
|
||||
|
||||
static HashMap traceMap;
|
||||
static HashMap<Object, int[]> traceMap;
|
||||
|
||||
public static int traceflags;
|
||||
public static String tracefile;
|
||||
@ -427,13 +427,14 @@ public abstract class GraphicsPrimitive {
|
||||
|
||||
public void run() {
|
||||
PrintStream ps = getTraceOutputFile();
|
||||
Iterator iterator = traceMap.entrySet().iterator();
|
||||
Iterator<Map.Entry<Object, int[]>> iterator =
|
||||
traceMap.entrySet().iterator();
|
||||
long total = 0;
|
||||
int numprims = 0;
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry me = (Map.Entry) iterator.next();
|
||||
Map.Entry<Object, int[]> me = iterator.next();
|
||||
Object prim = me.getKey();
|
||||
int[] count = (int[]) me.getValue();
|
||||
int[] count = me.getValue();
|
||||
if (count[0] == 1) {
|
||||
ps.print("1 call to ");
|
||||
} else {
|
||||
@ -455,15 +456,15 @@ public abstract class GraphicsPrimitive {
|
||||
public synchronized static void tracePrimitive(Object prim) {
|
||||
if ((traceflags & TRACECOUNTS) != 0) {
|
||||
if (traceMap == null) {
|
||||
traceMap = new HashMap();
|
||||
traceMap = new HashMap<>();
|
||||
TraceReporter.setShutdownHook();
|
||||
}
|
||||
Object o = traceMap.get(prim);
|
||||
int[] o = traceMap.get(prim);
|
||||
if (o == null) {
|
||||
o = new int[1];
|
||||
traceMap.put(prim, o);
|
||||
}
|
||||
((int[]) o)[0]++;
|
||||
o[0]++;
|
||||
}
|
||||
if ((traceflags & TRACELOG) != 0) {
|
||||
PrintStream ps = getTraceOutputFile();
|
||||
|
||||
@ -45,11 +45,11 @@ public final class GraphicsPrimitiveMgr {
|
||||
private static GraphicsPrimitive generalPrimitives[];
|
||||
private static boolean needssort = true;
|
||||
|
||||
private static native void initIDs(Class GP, Class ST, Class CT,
|
||||
Class SG2D, Class Color, Class AT,
|
||||
Class XORComp, Class AlphaComp,
|
||||
Class Path2D, Class Path2DFloat,
|
||||
Class SHints);
|
||||
private static native void initIDs(Class<?> GP, Class<?> ST, Class<?> CT,
|
||||
Class<?> SG2D, Class<?> Color, Class<?> AT,
|
||||
Class<?> XORComp, Class<?> AlphaComp,
|
||||
Class<?> Path2D, Class<?> Path2DFloat,
|
||||
Class<?> SHints);
|
||||
private static native void registerNativeLoops();
|
||||
|
||||
static {
|
||||
@ -73,16 +73,17 @@ public final class GraphicsPrimitiveMgr {
|
||||
public int uniqueID;
|
||||
}
|
||||
|
||||
private static Comparator primSorter = new Comparator() {
|
||||
public int compare(Object o1, Object o2) {
|
||||
int id1 = ((GraphicsPrimitive) o1).getUniqueID();
|
||||
int id2 = ((GraphicsPrimitive) o2).getUniqueID();
|
||||
private static Comparator<GraphicsPrimitive> primSorter =
|
||||
new Comparator<GraphicsPrimitive>() {
|
||||
public int compare(GraphicsPrimitive o1, GraphicsPrimitive o2) {
|
||||
int id1 = o1.getUniqueID();
|
||||
int id2 = o2.getUniqueID();
|
||||
|
||||
return (id1 == id2 ? 0 : (id1 < id2 ? -1 : 1));
|
||||
}
|
||||
};
|
||||
|
||||
private static Comparator primFinder = new Comparator() {
|
||||
private static Comparator<Object> primFinder = new Comparator<Object>() {
|
||||
public int compare(Object o1, Object o2) {
|
||||
int id1 = ((GraphicsPrimitive) o1).getUniqueID();
|
||||
int id2 = ((PrimitiveSpec) o2).uniqueID;
|
||||
|
||||
@ -41,7 +41,7 @@ package sun.java2d.loops;
|
||||
*/
|
||||
public class GraphicsPrimitiveProxy extends GraphicsPrimitive {
|
||||
|
||||
private Class owner;
|
||||
private Class<?> owner;
|
||||
private String relativeClassName;
|
||||
|
||||
/**
|
||||
@ -53,7 +53,7 @@ public class GraphicsPrimitiveProxy extends GraphicsPrimitive {
|
||||
* @param relativeClassName The name of the class this is a proxy for.
|
||||
* This should not include the package.
|
||||
*/
|
||||
public GraphicsPrimitiveProxy(Class owner, String relativeClassName,
|
||||
public GraphicsPrimitiveProxy(Class<?> owner, String relativeClassName,
|
||||
String methodSignature,
|
||||
int primID,
|
||||
SurfaceType srctype,
|
||||
@ -80,7 +80,7 @@ public class GraphicsPrimitiveProxy extends GraphicsPrimitive {
|
||||
String name = getPackageName(owner.getName()) + "."
|
||||
+ relativeClassName;
|
||||
try {
|
||||
Class clazz = Class.forName(name);
|
||||
Class<?> clazz = Class.forName(name);
|
||||
GraphicsPrimitive p = (GraphicsPrimitive) clazz.newInstance();
|
||||
if (!satisfiesSameAs(p)) {
|
||||
throw new RuntimeException("Primitive " + p
|
||||
|
||||
@ -143,8 +143,8 @@ public class MaskBlit extends GraphicsPrimitive
|
||||
MaskBlit performop;
|
||||
Blit convertresult;
|
||||
|
||||
WeakReference srcTmp;
|
||||
WeakReference dstTmp;
|
||||
WeakReference<SurfaceData> srcTmp;
|
||||
WeakReference<SurfaceData> dstTmp;
|
||||
|
||||
public General(SurfaceType srctype,
|
||||
CompositeType comptype,
|
||||
@ -184,14 +184,14 @@ public class MaskBlit extends GraphicsPrimitive
|
||||
} else {
|
||||
SurfaceData cachedSrc = null;
|
||||
if (srcTmp != null) {
|
||||
cachedSrc = (SurfaceData) srcTmp.get();
|
||||
cachedSrc = srcTmp.get();
|
||||
}
|
||||
src = convertFrom(convertsrc, srcData, srcx, srcy,
|
||||
width, height, cachedSrc);
|
||||
sx = 0;
|
||||
sy = 0;
|
||||
if (src != cachedSrc) {
|
||||
srcTmp = new WeakReference(src);
|
||||
srcTmp = new WeakReference<>(src);
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,7 +204,7 @@ public class MaskBlit extends GraphicsPrimitive
|
||||
// assert: convertresult != null
|
||||
SurfaceData cachedDst = null;
|
||||
if (dstTmp != null) {
|
||||
cachedDst = (SurfaceData) dstTmp.get();
|
||||
cachedDst = dstTmp.get();
|
||||
}
|
||||
dst = convertFrom(convertdst, dstData, dstx, dsty,
|
||||
width, height, cachedDst);
|
||||
@ -212,7 +212,7 @@ public class MaskBlit extends GraphicsPrimitive
|
||||
dy = 0;
|
||||
opclip = null;
|
||||
if (dst != cachedDst) {
|
||||
dstTmp = new WeakReference(dst);
|
||||
dstTmp = new WeakReference<>(dst);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -728,7 +728,7 @@ class OGLTextureToSurfaceTransform extends TransformBlit {
|
||||
class OGLGeneralBlit extends Blit {
|
||||
|
||||
private Blit performop;
|
||||
private WeakReference srcTmp;
|
||||
private WeakReference<SurfaceData> srcTmp;
|
||||
|
||||
OGLGeneralBlit(SurfaceType dstType,
|
||||
CompositeType compType,
|
||||
@ -750,7 +750,7 @@ class OGLGeneralBlit extends Blit {
|
||||
SurfaceData cachedSrc = null;
|
||||
if (srcTmp != null) {
|
||||
// use cached intermediate surface, if available
|
||||
cachedSrc = (SurfaceData)srcTmp.get();
|
||||
cachedSrc = srcTmp.get();
|
||||
}
|
||||
|
||||
// convert source to IntArgbPre
|
||||
@ -763,7 +763,7 @@ class OGLGeneralBlit extends Blit {
|
||||
|
||||
if (src != cachedSrc) {
|
||||
// cache the intermediate surface
|
||||
srcTmp = new WeakReference(src);
|
||||
srcTmp = new WeakReference<>(src);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -802,7 +802,7 @@ class OGLAnyCompositeBlit extends Blit {
|
||||
|
||||
if (dstBuffer != cachedDst) {
|
||||
// cache the intermediate surface
|
||||
dstTmp = new WeakReference(dstBuffer);
|
||||
dstTmp = new WeakReference<>(dstBuffer);
|
||||
}
|
||||
|
||||
// now blit the buffer back to the destination
|
||||
|
||||
@ -48,16 +48,16 @@ import sun.java2d.loops.GraphicsPrimitiveMgr;
|
||||
* SunGraphics2D.
|
||||
*/
|
||||
public class AlphaPaintPipe implements CompositePipe {
|
||||
static WeakReference cachedLastRaster;
|
||||
static WeakReference cachedLastColorModel;
|
||||
static WeakReference cachedLastData;
|
||||
static WeakReference<Raster> cachedLastRaster;
|
||||
static WeakReference<ColorModel> cachedLastColorModel;
|
||||
static WeakReference<SurfaceData> cachedLastData;
|
||||
|
||||
static class TileContext {
|
||||
SunGraphics2D sunG2D;
|
||||
PaintContext paintCtxt;
|
||||
ColorModel paintModel;
|
||||
WeakReference lastRaster;
|
||||
WeakReference lastData;
|
||||
WeakReference<Raster> lastRaster;
|
||||
WeakReference<SurfaceData> lastData;
|
||||
MaskBlit lastMask;
|
||||
Blit lastBlit;
|
||||
SurfaceData dstData;
|
||||
@ -105,8 +105,8 @@ public class AlphaPaintPipe implements CompositePipe {
|
||||
SurfaceData srcData = null;
|
||||
Raster lastRas = null;
|
||||
if (context.lastData != null && context.lastRaster != null) {
|
||||
srcData = (SurfaceData) context.lastData.get();
|
||||
lastRas = (Raster) context.lastRaster.get();
|
||||
srcData = context.lastData.get();
|
||||
lastRas = context.lastRaster.get();
|
||||
if (srcData == null || lastRas == null) {
|
||||
srcData = null;
|
||||
lastRas = null;
|
||||
@ -127,7 +127,7 @@ public class AlphaPaintPipe implements CompositePipe {
|
||||
}
|
||||
if (lastRas != srcRaster) {
|
||||
lastRas = srcRaster;
|
||||
context.lastRaster = new WeakReference(lastRas);
|
||||
context.lastRaster = new WeakReference<>(lastRas);
|
||||
// REMIND: This will fail for a non-Writable raster!
|
||||
BufferedImage bImg =
|
||||
new BufferedImage(paintModel,
|
||||
@ -135,7 +135,7 @@ public class AlphaPaintPipe implements CompositePipe {
|
||||
paintModel.isAlphaPremultiplied(),
|
||||
null);
|
||||
srcData = BufImgSurfaceData.createData(bImg);
|
||||
context.lastData = new WeakReference(srcData);
|
||||
context.lastData = new WeakReference<>(srcData);
|
||||
context.lastMask = null;
|
||||
context.lastBlit = null;
|
||||
}
|
||||
@ -197,7 +197,7 @@ public class AlphaPaintPipe implements CompositePipe {
|
||||
{
|
||||
// Avoid creating new WeakReference if possible
|
||||
cachedLastColorModel =
|
||||
new WeakReference(context.paintModel);
|
||||
new WeakReference<>(context.paintModel);
|
||||
}
|
||||
cachedLastData = context.lastData;
|
||||
}
|
||||
|
||||
@ -81,10 +81,10 @@ public abstract class RenderQueue {
|
||||
* A Set containing hard references to Objects that must stay alive until
|
||||
* the queue has been completely flushed.
|
||||
*/
|
||||
protected Set refSet;
|
||||
protected Set<Object> refSet;
|
||||
|
||||
protected RenderQueue() {
|
||||
refSet = new HashSet();
|
||||
refSet = new HashSet<>();
|
||||
buf = RenderBuffer.allocate(BUFFER_SIZE);
|
||||
}
|
||||
|
||||
|
||||
@ -39,14 +39,14 @@ public class SpanClipRenderer implements CompositePipe
|
||||
{
|
||||
CompositePipe outpipe;
|
||||
|
||||
static Class RegionClass = Region.class;
|
||||
static Class RegionIteratorClass = RegionIterator.class;
|
||||
static Class<?> RegionClass = Region.class;
|
||||
static Class<?> RegionIteratorClass = RegionIterator.class;
|
||||
|
||||
static {
|
||||
initIDs(RegionClass, RegionIteratorClass);
|
||||
}
|
||||
|
||||
static native void initIDs(Class rc, Class ric);
|
||||
static native void initIDs(Class<?> rc, Class<?> ric);
|
||||
|
||||
public SpanClipRenderer(CompositePipe pipe) {
|
||||
outpipe = pipe;
|
||||
|
||||
@ -72,7 +72,7 @@ public abstract class X11SurfaceData extends XSurfaceData {
|
||||
|
||||
protected int depth;
|
||||
|
||||
private static native void initIDs(Class xorComp, boolean tryDGA);
|
||||
private static native void initIDs(Class<?> xorComp, boolean tryDGA);
|
||||
protected native void initSurface(int depth, int width, int height,
|
||||
long drawable);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user