equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
40 import com.sun.tools.javac.api.DiagnosticFormatter; |
40 import com.sun.tools.javac.api.DiagnosticFormatter; |
41 import com.sun.tools.javac.main.Main; |
41 import com.sun.tools.javac.main.Main; |
42 import com.sun.tools.javac.main.Option; |
42 import com.sun.tools.javac.main.Option; |
43 import com.sun.tools.javac.tree.EndPosTable; |
43 import com.sun.tools.javac.tree.EndPosTable; |
44 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag; |
44 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag; |
|
45 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticInfo; |
45 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; |
46 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; |
46 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; |
47 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; |
47 |
48 |
48 import static com.sun.tools.javac.main.Option.*; |
49 import static com.sun.tools.javac.main.Option.*; |
49 |
50 |
595 public void printLines(String key, Object... args) { |
596 public void printLines(String key, Object... args) { |
596 PrintWriter noticeWriter = writers.get(WriterKind.NOTICE); |
597 PrintWriter noticeWriter = writers.get(WriterKind.NOTICE); |
597 printRawLines(noticeWriter, localize(key, args)); |
598 printRawLines(noticeWriter, localize(key, args)); |
598 } |
599 } |
599 |
600 |
|
601 public void printLines(DiagnosticInfo diag) { |
|
602 PrintWriter noticeWriter = writers.get(WriterKind.NOTICE); |
|
603 printRawLines(noticeWriter, localize(diag)); |
|
604 } |
|
605 |
600 public void printLines(PrefixKind pk, String key, Object... args) { |
606 public void printLines(PrefixKind pk, String key, Object... args) { |
601 PrintWriter noticeWriter = writers.get(WriterKind.NOTICE); |
607 PrintWriter noticeWriter = writers.get(WriterKind.NOTICE); |
602 printRawLines(noticeWriter, localize(pk, key, args)); |
608 printRawLines(noticeWriter, localize(pk, key, args)); |
603 } |
609 } |
604 |
610 |
787 |
793 |
788 public String localize(JCDiagnostic.DiagnosticInfo diagInfo) { |
794 public String localize(JCDiagnostic.DiagnosticInfo diagInfo) { |
789 if (useRawMessages) { |
795 if (useRawMessages) { |
790 return diagInfo.key(); |
796 return diagInfo.key(); |
791 } else { |
797 } else { |
792 return messages.getLocalizedString(diagInfo.key(), diagInfo.args); |
798 return messages.getLocalizedString(diagInfo); |
793 } |
799 } |
794 } |
800 } |
795 |
801 |
796 /** Find a localized string in the resource bundle. |
802 /** Find a localized string in the resource bundle. |
797 * @param key The key for the localized string. |
803 * @param key The key for the localized string. |