changeset 14621:a6fda38d8484

refactored System.out|err into local variables to avoid need for Checkstyle disabling filters (which the Eclipse CS plugin doesn't always see)
author Doug Simon <doug.simon@oracle.com>
date Wed, 19 Mar 2014 18:05:00 +0100
parents a0baf4eeb018
children aff1511f13a9
files graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/CountingProxy.java graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/System_setOut.java graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TimedCompilationPolicy.java
diffstat 4 files changed, 17 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/CountingProxy.java	Wed Mar 19 16:44:07 2014 +0100
+++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/logging/CountingProxy.java	Wed Mar 19 18:05:00 2014 +0100
@@ -22,6 +22,7 @@
  */
 package com.oracle.graal.hotspot.logging;
 
+import java.io.*;
 import java.lang.reflect.*;
 import java.util.*;
 import java.util.concurrent.*;
@@ -94,16 +95,15 @@
         }
     }
 
-    // CheckStyle: stop system..print check
     protected void print() {
         long sum = 0;
+        PrintStream out = System.out;
         for (Map.Entry<Method, AtomicLong> entry : calls.entrySet()) {
             Method method = entry.getKey();
             long count = entry.getValue().get();
             sum += count;
-            System.out.println(delegate.getClass().getSimpleName() + "." + method.getName() + ": " + count);
+            out.println(delegate.getClass().getSimpleName() + "." + method.getName() + ": " + count);
         }
-        System.out.println(delegate.getClass().getSimpleName() + " calls: " + sum);
+        out.println(delegate.getClass().getSimpleName() + " calls: " + sum);
     }
-    // CheckStyle: resume system..print check
 }
--- a/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/System_setOut.java	Wed Mar 19 16:44:07 2014 +0100
+++ b/graal/com.oracle.graal.jtt/src/com/oracle/graal/jtt/jdk/System_setOut.java	Wed Mar 19 18:05:00 2014 +0100
@@ -46,19 +46,18 @@
         return sum;
     }
 
-    // CheckStyle: stop system..print check
     private static void doPrint(int n) {
+        PrintStream out = System.out;
         for (int i = 0; i < n; i++) {
-            System.out.print('x');
+            out.print('x');
         }
     }
 
     public static void main(String[] args) throws Exception {
-        System.out.println(test(10000));
+        PrintStream out = System.out;
+        out.println(test(10000));
     }
 
-    // CheckStyle: resume system..print check
-
     @LongTest
     public void run0() throws Throwable {
         runTest("test", 10000);
--- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java	Wed Mar 19 16:44:07 2014 +0100
+++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/HexCodeFile.java	Wed Mar 19 18:05:00 2014 +0100
@@ -293,9 +293,8 @@
         }
 
         void warning(int offset, String message) {
-            // CheckStyle: stop system..print check
-            System.err.println("Warning: " + errorMessage(offset, message));
-            // CheckStyle: resume system..print check
+            PrintStream err = System.err;
+            err.println("Warning: " + errorMessage(offset, message));
         }
 
         String errorMessage(int offset, String message) {
@@ -323,10 +322,9 @@
             int lineStart = input.lastIndexOf(HexCodeFile.NEW_LINE, index) + 1;
 
             String l = input.substring(lineStart, lineStart + 10);
-            // CheckStyle: stop system..print check
-            System.out.println("YYY" + input.substring(index, index + 10) + "...");
-            System.out.println("XXX" + l + "...");
-            // CheckStyle: resume system..print check
+            PrintStream out = System.out;
+            out.println("YYY" + input.substring(index, index + 10) + "...");
+            out.println("XXX" + l + "...");
 
             int pos = input.indexOf(HexCodeFile.NEW_LINE, 0);
             int line = 1;
--- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TimedCompilationPolicy.java	Wed Mar 19 16:44:07 2014 +0100
+++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TimedCompilationPolicy.java	Wed Mar 19 18:05:00 2014 +0100
@@ -24,6 +24,8 @@
 
 import static com.oracle.graal.truffle.TruffleCompilerOptions.*;
 
+import java.io.*;
+
 public class TimedCompilationPolicy extends DefaultCompilationPolicy {
 
     @Override
@@ -39,9 +41,8 @@
             // maybe introduce another method?
             profile.reportTiminingFailed(timestamp);
             if (TruffleCompilationDecisionTimePrintFail.getValue()) {
-                // Checkstyle: stop
-                System.out.println(profile.getName() + ": timespan  " + (timespan / 1000000) + " ms  larger than threshold");
-                // Checkstyle: resume
+                PrintStream out = System.out;
+                out.println(profile.getName() + ": timespan  " + (timespan / 1000000) + " ms  larger than threshold");
             }
         }
         return false;