提交 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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 { ...@@ -280,7 +280,7 @@ public class AptJavaCompiler extends com.sun.tools.javac.main.JavaCompiler {
} }
if (verbose) if (verbose)
printVerbose("total", Long.toString(System.currentTimeMillis() - msec)); log.printVerbose("total", Long.toString(System.currentTimeMillis() - msec));
chk.reportDeferredDiagnostics(); chk.reportDeferredDiagnostics();
......
...@@ -2183,7 +2183,7 @@ public class ClassReader implements Completer { ...@@ -2183,7 +2183,7 @@ public class ClassReader implements Completer {
} }
currentClassFile = classfile; currentClassFile = classfile;
if (verbose) { if (verbose) {
printVerbose("loading", currentClassFile.toString()); log.printVerbose("loading", currentClassFile.toString());
} }
if (classfile.getKind() == JavaFileObject.Kind.CLASS) { if (classfile.getKind() == JavaFileObject.Kind.CLASS) {
filling = true; filling = true;
...@@ -2452,13 +2452,13 @@ public class ClassReader implements Completer { ...@@ -2452,13 +2452,13 @@ public class ClassReader implements Completer {
for (File file : fm.getLocation(SOURCE_PATH)) { for (File file : fm.getLocation(SOURCE_PATH)) {
path = path.prepend(file); path = path.prepend(file);
} }
printVerbose("sourcepath", path.reverse().toString()); log.printVerbose("sourcepath", path.reverse().toString());
} else if (wantSourceFiles) { } else if (wantSourceFiles) {
List<File> path = List.nil(); List<File> path = List.nil();
for (File file : fm.getLocation(CLASS_PATH)) { for (File file : fm.getLocation(CLASS_PATH)) {
path = path.prepend(file); path = path.prepend(file);
} }
printVerbose("sourcepath", path.reverse().toString()); log.printVerbose("sourcepath", path.reverse().toString());
} }
if (wantClassFiles) { if (wantClassFiles) {
List<File> path = List.nil(); List<File> path = List.nil();
...@@ -2468,7 +2468,7 @@ public class ClassReader implements Completer { ...@@ -2468,7 +2468,7 @@ public class ClassReader implements Completer {
for (File file : fm.getLocation(CLASS_PATH)) { for (File file : fm.getLocation(CLASS_PATH)) {
path = path.prepend(file); path = path.prepend(file);
} }
printVerbose("classpath", path.reverse().toString()); log.printVerbose("classpath", path.reverse().toString());
} }
} }
} }
...@@ -2519,14 +2519,6 @@ public class ClassReader implements Completer { ...@@ -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. /** Output for "-checkclassfile" option.
* @param key The key to look up the correct internationalized string. * @param key The key to look up the correct internationalized string.
* @param arg An argument for substitution into the output string. * @param arg An argument for substitution into the output string.
......
...@@ -1447,7 +1447,7 @@ public class ClassWriter extends ClassFile { ...@@ -1447,7 +1447,7 @@ public class ClassWriter extends ClassFile {
try { try {
writeClassFile(out, c); writeClassFile(out, c);
if (verbose) if (verbose)
log.printErrLines("verbose.wrote.file", outFile); log.printVerbose("wrote.file", outFile);
out.close(); out.close();
out = null; out = null;
} finally { } finally {
......
...@@ -585,7 +585,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter { ...@@ -585,7 +585,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
null, List.<JCTree>nil()); null, List.<JCTree>nil());
if (content != null) { if (content != null) {
if (verbose) { if (verbose) {
printVerbose("parsing.started", filename); log.printVerbose("parsing.started", filename);
} }
if (taskListener != null) { if (taskListener != null) {
TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, filename); TaskEvent e = new TaskEvent(TaskEvent.Kind.PARSE, filename);
...@@ -594,7 +594,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter { ...@@ -594,7 +594,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo); Parser parser = parserFactory.newParser(content, keepComments(), genEndPos, lineDebugInfo);
tree = parser.parseCompilationUnit(); tree = parser.parseCompilationUnit();
if (verbose) { 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 { ...@@ -681,7 +681,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
try { try {
new Pretty(out, true).printUnit(env.toplevel, cdef); new Pretty(out, true).printUnit(env.toplevel, cdef);
if (verbose) if (verbose)
printVerbose("wrote.file", outFile); log.printVerbose("wrote.file", outFile);
} finally { } finally {
out.close(); out.close();
} }
...@@ -867,7 +867,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter { ...@@ -867,7 +867,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
if (verbose) { if (verbose) {
elapsed_msec = elapsed(start_msec); elapsed_msec = elapsed(start_msec);
printVerbose("total", Long.toString(elapsed_msec)); log.printVerbose("total", Long.toString(elapsed_msec));
} }
reportDeferredDiagnostics(); reportDeferredDiagnostics();
...@@ -1154,7 +1154,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter { ...@@ -1154,7 +1154,7 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
if (verboseCompilePolicy) if (verboseCompilePolicy)
printNote("[attribute " + env.enclClass.sym + "]"); printNote("[attribute " + env.enclClass.sym + "]");
if (verbose) if (verbose)
printVerbose("checking.attribution", env.enclClass.sym); log.printVerbose("checking.attribution", env.enclClass.sym);
if (taskListener != null) { if (taskListener != null) {
TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym); TaskEvent e = new TaskEvent(TaskEvent.Kind.ANALYZE, env.toplevel, env.enclClass.sym);
...@@ -1575,14 +1575,6 @@ public class JavaCompiler implements ClassReader.SourceCompleter { ...@@ -1575,14 +1575,6 @@ public class JavaCompiler implements ClassReader.SourceCompleter {
Log.printLines(log.noticeWriter, lines); 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. /** Print numbers of errors and warnings.
*/ */
protected void printCount(String kind, int count) { 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -329,7 +329,6 @@ public class Log extends AbstractLog { ...@@ -329,7 +329,6 @@ public class Log extends AbstractLog {
printLines(errWriter, localize(key, args)); printLines(errWriter, localize(key, args));
} }
/** Print the text of a message to the noticeWriter stream, /** Print the text of a message to the noticeWriter stream,
* translating newlines appropriately for the platform. * translating newlines appropriately for the platform.
*/ */
...@@ -337,6 +336,14 @@ public class Log extends AbstractLog { ...@@ -337,6 +336,14 @@ public class Log extends AbstractLog {
printLines(noticeWriter, localize(key, args)); 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) { protected void directError(String key, Object... args) {
printErrLines(key, args); printErrLines(key, args);
errWriter.flush(); errWriter.flush();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册