src/share/classes/sun/java2d/loops/GraphicsPrimitive.java
Print this page
@@ -314,10 +314,11 @@
CompositeType comptype,
SurfaceType dsttype);
public abstract GraphicsPrimitive traceWrap();
+ @SuppressWarnings("rawtypes")
static HashMap traceMap;
public static int traceflags;
public static String tracefile;
public static PrintStream traceout;
@@ -326,11 +327,11 @@
public static final int TRACETIMESTAMP = 2;
public static final int TRACECOUNTS = 4;
static {
GetPropertyAction gpa = new GetPropertyAction("sun.java2d.trace");
- String trace = (String)AccessController.doPrivileged(gpa);
+ String trace = AccessController.doPrivileged(gpa);
if (trace != null) {
boolean verbose = false;
int traceflags = 0;
StringTokenizer st = new StringTokenizer(trace, ",");
while (st.hasMoreTokens()) {
@@ -389,22 +390,22 @@
}
private static PrintStream getTraceOutputFile() {
if (traceout == null) {
if (tracefile != null) {
- Object o =
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ FileOutputStream o = AccessController.doPrivileged(
+ new PrivilegedAction<FileOutputStream>() {
+ public FileOutputStream run() {
try {
return new FileOutputStream(tracefile);
} catch (FileNotFoundException e) {
return null;
}
}
});
if (o != null) {
- traceout = new PrintStream((OutputStream) o);
+ traceout = new PrintStream(o);
} else {
traceout = System.err;
}
} else {
traceout = System.err;
@@ -413,26 +414,28 @@
return traceout;
}
public static class TraceReporter extends Thread {
public static void setShutdownHook() {
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ public Void run() {
TraceReporter t = new TraceReporter();
t.setContextClassLoader(null);
Runtime.getRuntime().addShutdownHook(t);
return null;
}
});
}
public void run() {
PrintStream ps = getTraceOutputFile();
+ @SuppressWarnings("rawtypes")
Iterator iterator = traceMap.entrySet().iterator();
long total = 0;
int numprims = 0;
while (iterator.hasNext()) {
+ @SuppressWarnings("rawtypes")
Map.Entry me = (Map.Entry) iterator.next();
Object prim = me.getKey();
int[] count = (int[]) me.getValue();
if (count[0] == 1) {
ps.print("1 call to ");
@@ -450,10 +453,11 @@
numprims+" different primitives");
}
}
}
+ @SuppressWarnings({ "rawtypes", "unchecked" })
public synchronized static void tracePrimitive(Object prim) {
if ((traceflags & TRACECOUNTS) != 0) {
if (traceMap == null) {
traceMap = new HashMap();
TraceReporter.setShutdownHook();