6966736: javac verbose output is inconsistent

Reviewed-by: mcimadamore
This commit is contained in:
Jonathan Gibbons 2011-03-04 11:33:37 -08:00
parent 7b3d32182e
commit cc52e2d413
5 changed files with 21 additions and 30 deletions

View File

@ -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 @@ public class AptJavaCompiler extends com.sun.tools.javac.main.JavaCompiler {
}
if (verbose)
printVerbose("total", Long.toString(System.currentTimeMillis() - msec));
log.printVerbose("total", Long.toString(System.currentTimeMillis() - msec));
chk.reportDeferredDiagnostics();

View File

@ -2183,7 +2183,7 @@ public class ClassReader implements Completer {
}
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 @@ public class ClassReader implements Completer {
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 @@ public class ClassReader implements Completer {
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 @@ public class ClassReader implements Completer {
}
}
/** 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.

View File

@ -1447,7 +1447,7 @@ public class ClassWriter extends ClassFile {
try {
writeClassFile(out, c);
if (verbose)
log.printErrLines("verbose.wrote.file", outFile);
log.printVerbose("wrote.file", outFile);
out.close();
out = null;
} finally {

View File

@ -585,7 +585,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
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 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
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 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
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 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
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 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
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 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
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) {

View File

@ -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 @@ public class Log extends AbstractLog {
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 @@ public class Log extends AbstractLog {
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();