changeset 963:7798e3a5ecf5

6966736: javac verbose output is inconsistent Reviewed-by: mcimadamore
author jjg
date Fri, 04 Mar 2011 11:33:37 -0800
parents 8fb48a9ac9ec
children ebf7c13df6c0
files src/share/classes/com/sun/tools/apt/main/AptJavaCompiler.java src/share/classes/com/sun/tools/javac/jvm/ClassReader.java src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java src/share/classes/com/sun/tools/javac/main/JavaCompiler.java src/share/classes/com/sun/tools/javac/util/Log.java
diffstat 5 files changed, 21 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/apt/main/AptJavaCompiler.java	Thu Mar 03 18:05:52 2011 +0000
+++ b/src/share/classes/com/sun/tools/apt/main/AptJavaCompiler.java	Fri Mar 04 11:33:37 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -280,7 +280,7 @@
         }
 
         if (verbose)
-            printVerbose("total", Long.toString(System.currentTimeMillis() - msec));
+            log.printVerbose("total", Long.toString(System.currentTimeMillis() - msec));
 
         chk.reportDeferredDiagnostics();
 
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Thu Mar 03 18:05:52 2011 +0000
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Fri Mar 04 11:33:37 2011 -0800
@@ -2183,7 +2183,7 @@
                 }
                 currentClassFile = classfile;
                 if (verbose) {
-                    printVerbose("loading", currentClassFile.toString());
+                    log.printVerbose("loading", currentClassFile.toString());
                 }
                 if (classfile.getKind() == JavaFileObject.Kind.CLASS) {
                     filling = true;
@@ -2452,13 +2452,13 @@
                     for (File file : fm.getLocation(SOURCE_PATH)) {
                         path = path.prepend(file);
                     }
-                    printVerbose("sourcepath", path.reverse().toString());
+                    log.printVerbose("sourcepath", path.reverse().toString());
                 } else if (wantSourceFiles) {
                     List<File> path = List.nil();
                     for (File file : fm.getLocation(CLASS_PATH)) {
                         path = path.prepend(file);
                     }
-                    printVerbose("sourcepath", path.reverse().toString());
+                    log.printVerbose("sourcepath", path.reverse().toString());
                 }
                 if (wantClassFiles) {
                     List<File> path = List.nil();
@@ -2468,7 +2468,7 @@
                     for (File file : fm.getLocation(CLASS_PATH)) {
                         path = path.prepend(file);
                     }
-                    printVerbose("classpath",  path.reverse().toString());
+                    log.printVerbose("classpath",  path.reverse().toString());
                 }
             }
         }
@@ -2519,14 +2519,6 @@
             }
         }
 
-    /** Output for "-verbose" option.
-     *  @param key The key to look up the correct internationalized string.
-     *  @param arg An argument for substitution into the output string.
-     */
-    private void printVerbose(String key, CharSequence arg) {
-        log.printNoteLines("verbose." + key, arg);
-    }
-
     /** Output for "-checkclassfile" option.
      *  @param key The key to look up the correct internationalized string.
      *  @param arg An argument for substitution into the output string.
--- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Thu Mar 03 18:05:52 2011 +0000
+++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java	Fri Mar 04 11:33:37 2011 -0800
@@ -1447,7 +1447,7 @@
         try {
             writeClassFile(out, c);
             if (verbose)
-                log.printErrLines("verbose.wrote.file", outFile);
+                log.printVerbose("wrote.file", outFile);
             out.close();
             out = null;
         } finally {
--- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Mar 03 18:05:52 2011 +0000
+++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Fri Mar 04 11:33:37 2011 -0800
@@ -585,7 +585,7 @@
                                       null, List.<JCTree>nil());
         if (content != null) {
             if (verbose) {
-                printVerbose("parsing.started", filename);
+                log.printVerbose("parsing.started", filename);
             }
             if (taskListener != null) {
                 TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, filename);
@@ -594,7 +594,7 @@
             Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo);
             tree = parser.parseCompilationUnit();
             if (verbose) {
-                printVerbose("parsing.done", Long.toString(elapsed(msec)));
+                log.printVerbose("parsing.done", Long.toString(elapsed(msec)));
             }
         }
 
@@ -681,7 +681,7 @@
             try {
                 new Pretty(out, true).printUnit(env.toplevel, cdef);
                 if (verbose)
-                    printVerbose("wrote.file", outFile);
+                    log.printVerbose("wrote.file", outFile);
             } finally {
                 out.close();
             }
@@ -867,7 +867,7 @@
 
         if (verbose) {
             elapsed_msec = elapsed(start_msec);
-            printVerbose("total", Long.toString(elapsed_msec));
+            log.printVerbose("total", Long.toString(elapsed_msec));
         }
 
         reportDeferredDiagnostics();
@@ -1154,7 +1154,7 @@
         if (verboseCompilePolicy)
             printNote("[attribute " + env.enclClass.sym + "]");
         if (verbose)
-            printVerbose("checking.attribution", env.enclClass.sym);
+            log.printVerbose("checking.attribution", env.enclClass.sym);
 
         if (taskListener != null) {
             TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym);
@@ -1575,14 +1575,6 @@
         Log.printLines(log.noticeWriter, lines);
     }
 
-    /** Output for "-verbose" option.
-     *  @param key The key to look up the correct internationalized string.
-     *  @param arg An argument for substitution into the output string.
-     */
-    protected void printVerbose(String key, Object arg) {
-        log.printNoteLines("verbose." + key, arg);
-    }
-
     /** Print numbers of errors and warnings.
      */
     protected void printCount(String kind, int count) {
--- a/src/share/classes/com/sun/tools/javac/util/Log.java	Thu Mar 03 18:05:52 2011 +0000
+++ b/src/share/classes/com/sun/tools/javac/util/Log.java	Fri Mar 04 11:33:37 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -329,7 +329,6 @@
         printLines(errWriter, localize(key, args));
     }
 
-
     /** Print the text of a message to the noticeWriter stream,
      *  translating newlines appropriately for the platform.
      */
@@ -337,6 +336,14 @@
         printLines(noticeWriter, localize(key, args));
     }
 
+    /**
+     * Print the localized text of a "verbose" message to the
+     * noticeWriter stream.
+     */
+    public void printVerbose(String key, Object... args) {
+        printLines(noticeWriter, localize("verbose." + key, args));
+    }
+
     protected void directError(String key, Object... args) {
         printErrLines(key, args);
         errWriter.flush();