Fri, 04 Mar 2011 11:33:37 -0800
6966736: javac verbose output is inconsistent
Reviewed-by: mcimadamore
1.1 --- a/src/share/classes/com/sun/tools/apt/main/AptJavaCompiler.java Thu Mar 03 18:05:52 2011 +0000 1.2 +++ b/src/share/classes/com/sun/tools/apt/main/AptJavaCompiler.java Fri Mar 04 11:33:37 2011 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -280,7 +280,7 @@ 1.11 } 1.12 1.13 if (verbose) 1.14 - printVerbose("total", Long.toString(System.currentTimeMillis() - msec)); 1.15 + log.printVerbose("total", Long.toString(System.currentTimeMillis() - msec)); 1.16 1.17 chk.reportDeferredDiagnostics(); 1.18
2.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Thu Mar 03 18:05:52 2011 +0000 2.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Fri Mar 04 11:33:37 2011 -0800 2.3 @@ -2183,7 +2183,7 @@ 2.4 } 2.5 currentClassFile = classfile; 2.6 if (verbose) { 2.7 - printVerbose("loading", currentClassFile.toString()); 2.8 + log.printVerbose("loading", currentClassFile.toString()); 2.9 } 2.10 if (classfile.getKind() == JavaFileObject.Kind.CLASS) { 2.11 filling = true; 2.12 @@ -2452,13 +2452,13 @@ 2.13 for (File file : fm.getLocation(SOURCE_PATH)) { 2.14 path = path.prepend(file); 2.15 } 2.16 - printVerbose("sourcepath", path.reverse().toString()); 2.17 + log.printVerbose("sourcepath", path.reverse().toString()); 2.18 } else if (wantSourceFiles) { 2.19 List<File> path = List.nil(); 2.20 for (File file : fm.getLocation(CLASS_PATH)) { 2.21 path = path.prepend(file); 2.22 } 2.23 - printVerbose("sourcepath", path.reverse().toString()); 2.24 + log.printVerbose("sourcepath", path.reverse().toString()); 2.25 } 2.26 if (wantClassFiles) { 2.27 List<File> path = List.nil(); 2.28 @@ -2468,7 +2468,7 @@ 2.29 for (File file : fm.getLocation(CLASS_PATH)) { 2.30 path = path.prepend(file); 2.31 } 2.32 - printVerbose("classpath", path.reverse().toString()); 2.33 + log.printVerbose("classpath", path.reverse().toString()); 2.34 } 2.35 } 2.36 } 2.37 @@ -2519,14 +2519,6 @@ 2.38 } 2.39 } 2.40 2.41 - /** Output for "-verbose" option. 2.42 - * @param key The key to look up the correct internationalized string. 2.43 - * @param arg An argument for substitution into the output string. 2.44 - */ 2.45 - private void printVerbose(String key, CharSequence arg) { 2.46 - log.printNoteLines("verbose." + key, arg); 2.47 - } 2.48 - 2.49 /** Output for "-checkclassfile" option. 2.50 * @param key The key to look up the correct internationalized string. 2.51 * @param arg An argument for substitution into the output string.
3.1 --- a/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Thu Mar 03 18:05:52 2011 +0000 3.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Fri Mar 04 11:33:37 2011 -0800 3.3 @@ -1447,7 +1447,7 @@ 3.4 try { 3.5 writeClassFile(out, c); 3.6 if (verbose) 3.7 - log.printErrLines("verbose.wrote.file", outFile); 3.8 + log.printVerbose("wrote.file", outFile); 3.9 out.close(); 3.10 out = null; 3.11 } finally {
4.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Thu Mar 03 18:05:52 2011 +0000 4.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Fri Mar 04 11:33:37 2011 -0800 4.3 @@ -585,7 +585,7 @@ 4.4 null, List.<JCTree>nil()); 4.5 if (content != null) { 4.6 if (verbose) { 4.7 - printVerbose("parsing.started", filename); 4.8 + log.printVerbose("parsing.started", filename); 4.9 } 4.10 if (taskListener != null) { 4.11 TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, filename); 4.12 @@ -594,7 +594,7 @@ 4.13 Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo); 4.14 tree = parser.parseCompilationUnit(); 4.15 if (verbose) { 4.16 - printVerbose("parsing.done", Long.toString(elapsed(msec))); 4.17 + log.printVerbose("parsing.done", Long.toString(elapsed(msec))); 4.18 } 4.19 } 4.20 4.21 @@ -681,7 +681,7 @@ 4.22 try { 4.23 new Pretty(out, true).printUnit(env.toplevel, cdef); 4.24 if (verbose) 4.25 - printVerbose("wrote.file", outFile); 4.26 + log.printVerbose("wrote.file", outFile); 4.27 } finally { 4.28 out.close(); 4.29 } 4.30 @@ -867,7 +867,7 @@ 4.31 4.32 if (verbose) { 4.33 elapsed_msec = elapsed(start_msec); 4.34 - printVerbose("total", Long.toString(elapsed_msec)); 4.35 + log.printVerbose("total", Long.toString(elapsed_msec)); 4.36 } 4.37 4.38 reportDeferredDiagnostics(); 4.39 @@ -1154,7 +1154,7 @@ 4.40 if (verboseCompilePolicy) 4.41 printNote("[attribute " + env.enclClass.sym + "]"); 4.42 if (verbose) 4.43 - printVerbose("checking.attribution", env.enclClass.sym); 4.44 + log.printVerbose("checking.attribution", env.enclClass.sym); 4.45 4.46 if (taskListener != null) { 4.47 TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym); 4.48 @@ -1575,14 +1575,6 @@ 4.49 Log.printLines(log.noticeWriter, lines); 4.50 } 4.51 4.52 - /** Output for "-verbose" option. 4.53 - * @param key The key to look up the correct internationalized string. 4.54 - * @param arg An argument for substitution into the output string. 4.55 - */ 4.56 - protected void printVerbose(String key, Object arg) { 4.57 - log.printNoteLines("verbose." + key, arg); 4.58 - } 4.59 - 4.60 /** Print numbers of errors and warnings. 4.61 */ 4.62 protected void printCount(String kind, int count) {
5.1 --- a/src/share/classes/com/sun/tools/javac/util/Log.java Thu Mar 03 18:05:52 2011 +0000 5.2 +++ b/src/share/classes/com/sun/tools/javac/util/Log.java Fri Mar 04 11:33:37 2011 -0800 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -329,7 +329,6 @@ 5.11 printLines(errWriter, localize(key, args)); 5.12 } 5.13 5.14 - 5.15 /** Print the text of a message to the noticeWriter stream, 5.16 * translating newlines appropriately for the platform. 5.17 */ 5.18 @@ -337,6 +336,14 @@ 5.19 printLines(noticeWriter, localize(key, args)); 5.20 } 5.21 5.22 + /** 5.23 + * Print the localized text of a "verbose" message to the 5.24 + * noticeWriter stream. 5.25 + */ 5.26 + public void printVerbose(String key, Object... args) { 5.27 + printLines(noticeWriter, localize("verbose." + key, args)); 5.28 + } 5.29 + 5.30 protected void directError(String key, Object... args) { 5.31 printErrLines(key, args); 5.32 errWriter.flush();