提交 2c2ee4d7 编写于 作者: J jjg

6966736: javac verbose output is inconsistent

Reviewed-by: mcimadamore
上级 58438fd5
/*
* 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();
......
......@@ -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.
......
......@@ -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 {
......
......@@ -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) {
......
/*
* 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();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册