Mercurial > hg > openjdk > jdk6 > langtools
changeset 7:ef4609d484d6 jdk6-b03
6755902: Changes for openjdk6 build 03
6507179: javadoc -source 1.3 does not work with jdk6
Summary: Final b03 state (as defined by the source bundle)
Reviewed-by: darcy
author | ohair |
---|---|
date | Fri, 30 Jan 2009 16:20:53 -0800 |
parents | 60984077fb67 |
children | f2c4205f2569 |
files | THIRD_PARTY_README src/share/classes/com/sun/tools/javac/comp/Check.java src/share/classes/com/sun/tools/javac/util/Log.java src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java test/tools/javadoc/sourceOption/SourceOption.java test/tools/javadoc/sourceOption/p/A.java |
diffstat | 6 files changed, 89 insertions(+), 111 deletions(-) [+] |
line wrap: on
line diff
--- a/THIRD_PARTY_README Fri Jan 30 16:16:49 2009 -0800 +++ b/THIRD_PARTY_README Fri Jan 30 16:20:53 2009 -0800 @@ -1431,63 +1431,6 @@ END src/solaris/native/sun/awt/HPkeysym.h ****************************************************** -BEGIN src/solaris/native/sun/awt/Xinerama.c -/***************************************************************** -Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Digital Equipment Corporation -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from Digital -Equipment Corporation. -******************************************************************/ -END src/solaris/native/sun/awt/Xinerama.c -****************************************************** -BEGIN src/solaris/native/sun/awt/Xinerama.h -/* -Copyright (C) 1994-2001 The XFree86 Project, Inc. All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Soft- -ware"), to deal in the Software without restriction, including without -limitation the rights to use, copy, modify, merge, publish, distribute, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, provided that the above copyright -notice(s) and this permission notice appear in all copies of the Soft- -ware and that both the above copyright notice(s) and this permission -notice appear in supporting documentation. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- -ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY -RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN -THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE- -QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR- -MANCE OF THIS SOFTWARE. - -Except as contained in this notice, the name of a copyright holder shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization of -the copyright holder. -*/ -END src/solaris/native/sun/awt/Xinerama.h ****************************************************** BEGIN src/solaris/native/sun/awt/Xrandr.h /* @@ -1619,33 +1562,6 @@ AND src/solaris/native/sun/awt/wsutils.h ***************************************************************** -BEGIN src/solaris/native/sun/awt/panoramiXext.h -Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Digital Equipment Corporation -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from Digital -Equipment Corporation. - -END src/solaris/native/sun/awt/panoramiXext.h -****************************************************** - BEGIN src/solaris/native/sun/awt/randr.h *
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Jan 30 16:16:49 2009 -0800 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Jan 30 16:20:53 2009 -0800 @@ -100,9 +100,12 @@ boolean verboseDeprecated = lint.isEnabled(LintCategory.DEPRECATION); boolean verboseUnchecked = lint.isEnabled(LintCategory.UNCHECKED); + boolean enforceMandatoryWarnings = source.enforceMandatoryWarnings(); - deprecationHandler = new MandatoryWarningHandler(log,verboseDeprecated, "deprecated"); - uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked, "unchecked"); + deprecationHandler = new MandatoryWarningHandler(log,verboseDeprecated, + enforceMandatoryWarnings, "deprecated"); + uncheckedHandler = new MandatoryWarningHandler(log, verboseUnchecked, + enforceMandatoryWarnings, "unchecked"); } /** Switch: generics enabled?
--- a/src/share/classes/com/sun/tools/javac/util/Log.java Fri Jan 30 16:16:49 2009 -0800 +++ b/src/share/classes/com/sun/tools/javac/util/Log.java Fri Jan 30 16:20:53 2009 -0800 @@ -33,7 +33,6 @@ import java.util.Set; import javax.tools.DiagnosticListener; import javax.tools.JavaFileObject; -import com.sun.tools.javac.code.Source; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType; @@ -83,10 +82,6 @@ */ public boolean emitWarnings; - /** Enforce mandatory warnings. - */ - private boolean enforceMandatoryWarnings; - /** Print stack trace on errors? */ public boolean dumpOnError; @@ -135,9 +130,6 @@ DiagnosticListener<? super JavaFileObject> diagListener = context.get(DiagnosticListener.class); this.diagListener = diagListener; - - Source source = Source.instance(context); - this.enforceMandatoryWarnings = source.enforceMandatoryWarnings(); } // where private int getIntOption(Options options, String optionName, int defaultValue) { @@ -462,10 +454,7 @@ * @param args Fields of the warning message. */ public void mandatoryWarning(DiagnosticPosition pos, String key, Object ... args) { - if (enforceMandatoryWarnings) - report(diags.mandatoryWarning(source, pos, key, args)); - else - report(diags.warning(source, pos, key, args)); + report(diags.mandatoryWarning(source, pos, key, args)); } /** Report a warning that cannot be suppressed. @@ -503,13 +492,26 @@ } /** Provide a non-fatal notification, unless suppressed by the -nowarn option. + * @param file The file to which the note applies. + * @param key The key for the localized notification message. + * @param args Fields of the notification message. + */ + public void note(JavaFileObject file, String key, Object ... args) { + report(diags.note(wrap(file), null, key, args)); + } + + /** Provide a non-fatal notification, unless suppressed by the -nowarn option. * @param key The key for the localized notification message. * @param args Fields of the notification message. */ public void mandatoryNote(final JavaFileObject file, String key, Object ... args) { - JCDiagnostic.DiagnosticSource wrapper = null; - if (file != null) { - wrapper = new JCDiagnostic.DiagnosticSource() { + report(diags.mandatoryNote(wrap(file), key, args)); + } + + private JCDiagnostic.DiagnosticSource wrap(final JavaFileObject file) { + if (file == null) + return null; + return new JCDiagnostic.DiagnosticSource() { public JavaFileObject getFile() { return file; } @@ -526,11 +528,6 @@ return (endPosTables == null ? null : endPosTables.get(file)); } }; - } - if (enforceMandatoryWarnings) - report(diags.mandatoryNote(wrapper, key, args)); - else - report(diags.note(wrapper, null, key, args)); } private DiagnosticPosition wrap(int pos) {
--- a/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java Fri Jan 30 16:16:49 2009 -0800 +++ b/src/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java Fri Jan 30 16:20:53 2009 -0800 @@ -101,12 +101,16 @@ * individual instances should be given, or whether an aggregate * message should be generated at the end of the compilation. * Typically set via -Xlint:option. + * @param enforceMandatory + * True if mandatory warnings and notes are being enforced. * @param prefix A common prefix for the set of message keys for * the messages that may be generated. */ - public MandatoryWarningHandler(Log log, boolean verbose, String prefix) { + public MandatoryWarningHandler(Log log, boolean verbose, + boolean enforceMandatory, String prefix) { this.log = log; this.verbose = verbose; + this.enforceMandatory = enforceMandatory; this.prefix = prefix; } @@ -122,7 +126,7 @@ if (log.nwarnings < log.MaxWarnings) { // generate message and remember the source file - log.mandatoryWarning(pos, msg, args); + logMandatoryWarning(pos, msg, args); sourcesWithReportedWarnings.add(currentSource); } else if (deferredDiagnosticKind == null) { // set up deferred message @@ -163,12 +167,12 @@ public void reportDeferredDiagnostic() { if (deferredDiagnosticKind != null) { if (deferredDiagnosticArg == null) - log.mandatoryNote(deferredDiagnosticSource, deferredDiagnosticKind.getKey(prefix)); + logMandatoryNote(deferredDiagnosticSource, deferredDiagnosticKind.getKey(prefix)); else - log.mandatoryNote(deferredDiagnosticSource, deferredDiagnosticKind.getKey(prefix), deferredDiagnosticArg); + logMandatoryNote(deferredDiagnosticSource, deferredDiagnosticKind.getKey(prefix), deferredDiagnosticArg); if (!verbose) - log.mandatoryNote(deferredDiagnosticSource, prefix + ".recompile"); + logMandatoryNote(deferredDiagnosticSource, prefix + ".recompile"); } } @@ -224,4 +228,32 @@ * deferredDiagnosticKind is updated. */ private Object deferredDiagnosticArg; + + /** + * True if mandatory warnings and notes are being enforced. + */ + private final boolean enforceMandatory; + + /** + * Reports a mandatory warning to the log. If mandatory warnings + * are not being enforced, treat this as an ordinary warning. + */ + private void logMandatoryWarning(DiagnosticPosition pos, String msg, + Object... args) { + if (enforceMandatory) + log.mandatoryWarning(pos, msg, args); + else + log.warning(pos, msg, args); + } + + /** + * Reports a mandatory note to the log. If mandatory notes are + * not being enforced, treat this as an ordinary note. + */ + private void logMandatoryNote(JavaFileObject file, String msg, Object... args) { + if (enforceMandatory) + log.mandatoryNote(file, msg, args); + else + log.note(file, msg, args); + } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/tools/javadoc/sourceOption/SourceOption.java Fri Jan 30 16:20:53 2009 -0800 @@ -0,0 +1,24 @@ +/* + * @test + * @bug 6507179 + * @summary Ensure that "-source" option isn't ignored. + * @author Scott Seligman + */ + +import com.sun.javadoc.*; + +public class SourceOption extends Doclet { + + public static void main(String[] args) { + if (com.sun.tools.javadoc.Main.execute( + "javadoc", + "SourceOption", + new String[] {"-source", "1.3", "p"}) != 0) + throw new Error("Javadoc encountered warnings or errors."); + } + + public static boolean start(RootDoc root) { + root.classes(); // force parser into action + return true; + } +}