# HG changeset patch # User duke # Date 1504960605 -7200 # Node ID 57173ad5c534f971c87cb88e0e44feefc970adac # Parent 000f4e4ddd396e76ef9a1b0b077f55f3bbf0663b# Parent 75e8600f11364725bf9b64df8de236d3d3dab2a4 Merge diff -r 000f4e4ddd39 -r 57173ad5c534 .hgtags-top-repo --- a/.hgtags-top-repo Fri Sep 01 14:13:40 2017 +0000 +++ b/.hgtags-top-repo Sat Sep 09 14:36:45 2017 +0200 @@ -446,3 +446,4 @@ b656dea9398ef601f7fc08d1a5157a560e0ccbe0 jdk-9+181 682e2a6df836f4731f92eb2ddcd467075047f6ea jdk-10+20 90cdfe56f1543267a8005e638bd1b44551fda189 jdk-10+21 +8625e8491887bfd4310b2cfc2b84bac26312ba20 jdk-10+22 diff -r 000f4e4ddd39 -r 57173ad5c534 common/autoconf/configure.ac --- a/common/autoconf/configure.ac Fri Sep 01 14:13:40 2017 +0000 +++ b/common/autoconf/configure.ac Sat Sep 09 14:36:45 2017 +0200 @@ -209,6 +209,7 @@ # Need toolchain to setup dtrace HOTSPOT_SETUP_DTRACE HOTSPOT_ENABLE_DISABLE_AOT +HOTSPOT_ENABLE_DISABLE_CDS HOTSPOT_ENABLE_DISABLE_GTEST ############################################################################### diff -r 000f4e4ddd39 -r 57173ad5c534 common/autoconf/generated-configure.sh --- a/common/autoconf/generated-configure.sh Fri Sep 01 14:13:40 2017 +0000 +++ b/common/autoconf/generated-configure.sh Sat Sep 09 14:36:45 2017 +0200 @@ -702,6 +702,7 @@ FIXPATH_DETACH_FLAG FIXPATH BUILD_GTEST +ENABLE_CDS ENABLE_AOT GCOV_ENABLED ZIP_EXTERNAL_DEBUG_SYMBOLS @@ -1191,6 +1192,7 @@ enable_native_coverage enable_dtrace enable_aot +enable_cds enable_hotspot_gtest with_stdc__lib with_msvcr_dll @@ -1999,6 +2001,8 @@ enable ahead of time compilation feature. Default is auto, where aot is enabled if all dependencies are present. + --enable-cds[=yes/no] enable class data sharing feature in non-minimal VM. + Default is yes. --disable-hotspot-gtest Disables building of the Hotspot unit tests --disable-freetype-bundling disable bundling of the freetype library with the @@ -2016,7 +2020,8 @@ --disable-generate-classlist forces enabling or disabling of the generation of a CDS classlist at build time. Default is to generate - it when either the server or client JVMs are built. + it when either the server or client JVMs are built + and enable-cds is true. --enable-sjavac use sjavac to do fast incremental compiles [disabled] --disable-javac-server disable javac server [enabled] @@ -4295,7 +4300,7 @@ # All valid JVM features, regardless of platform VALID_JVM_FEATURES="compiler1 compiler2 zero shark minimal dtrace jvmti jvmci \ - graal fprof vm-structs jni-check services management all-gcs nmt cds \ + graal vm-structs jni-check services management all-gcs nmt cds \ static-build link-time-opt aot" # All valid JVM variants @@ -4345,6 +4350,11 @@ # +################################################################################ +# Allow to disable CDS +# + + ############################################################################### # Set up all JVM features for each JVM variant. # @@ -5151,7 +5161,7 @@ #CUSTOM_AUTOCONF_INCLUDE # Do not change or remove the following line, it is needed for consistency checks: -DATE_WHEN_GENERATED=1504187184 +DATE_WHEN_GENERATED=1504441177 ############################################################################### # @@ -54216,6 +54226,23 @@ + # Check whether --enable-cds was given. +if test "${enable_cds+set}" = set; then : + enableval=$enable_cds; +fi + + + if test "x$enable_cds" = "x" || test "x$enable_cds" = "xyes"; then + ENABLE_CDS="true" + elif test "x$enable_cds" = "xno"; then + ENABLE_CDS="false" + else + as_fn_error $? "Invalid value for --enable-cds: $enable_cds" "$LINENO" 5 + fi + + + + # Check whether --enable-hotspot-gtest was given. if test "${enable_hotspot_gtest+set}" = set; then : enableval=$enable_hotspot_gtest; @@ -65810,8 +65837,12 @@ fi INCLUDE_GRAAL="true" else - # By default enable graal build where AOT is available - if test "x$ENABLE_AOT" = "xtrue"; then + # By default enable graal build on linux-x64 or where AOT is available. + # graal build requires jvmci. + if test "x$JVM_FEATURES_jvmci" = "xjvmci" && \ + (test "x$OPENJDK_TARGET_CPU" = "xx86_64" && \ + test "x$OPENJDK_TARGET_OS" = "xlinux" || \ + test "x$ENABLE_AOT" = "xtrue") ; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } JVM_FEATURES_graal="graal" @@ -65856,7 +65887,10 @@ fi # All variants but minimal (and custom) get these features - NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jvmti fprof vm-structs jni-check services management all-gcs nmt cds" + NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jvmti vm-structs jni-check services management all-gcs nmt" + if test "x$ENABLE_CDS" = "xtrue"; then + NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cds" + fi # Enable features depending on variant. JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_aot $JVM_FEATURES_graal" @@ -65960,7 +65994,7 @@ # Check if it's likely that it's possible to generate the classlist. Depending # on exact jvm configuration it could be possible anyway. - if [[ " $JVM_VARIANTS " =~ " server " ]] || [[ " $JVM_VARIANTS " =~ " client " ]] ; then + if test "x$ENABLE_CDS" = "xtrue" && ( [[ " $JVM_VARIANTS " =~ " server " ]] || [[ " $JVM_VARIANTS " =~ " client " ]] ); then ENABLE_GENERATE_CLASSLIST_POSSIBLE="true" else ENABLE_GENERATE_CLASSLIST_POSSIBLE="false" @@ -65973,8 +66007,8 @@ $as_echo "yes, forced" >&6; } ENABLE_GENERATE_CLASSLIST="true" if test "x$ENABLE_GENERATE_CLASSLIST_POSSIBLE" = "xfalse"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS" >&5 -$as_echo "$as_me: WARNING: Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS and enable-cds=$ENABLE_CDS" >&5 +$as_echo "$as_me: WARNING: Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS and enable-cds=$ENABLE_CDS" >&2;} fi elif test "x$enable_generate_classlist" = "xno"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, forced" >&5 diff -r 000f4e4ddd39 -r 57173ad5c534 common/autoconf/hotspot.m4 --- a/common/autoconf/hotspot.m4 Fri Sep 01 14:13:40 2017 +0000 +++ b/common/autoconf/hotspot.m4 Sat Sep 09 14:36:45 2017 +0200 @@ -25,7 +25,7 @@ # All valid JVM features, regardless of platform VALID_JVM_FEATURES="compiler1 compiler2 zero shark minimal dtrace jvmti jvmci \ - graal fprof vm-structs jni-check services management all-gcs nmt cds \ + graal vm-structs jni-check services management all-gcs nmt cds \ static-build link-time-opt aot" # All valid JVM variants @@ -240,6 +240,25 @@ AC_SUBST(ENABLE_AOT) ]) +################################################################################ +# Allow to disable CDS +# +AC_DEFUN_ONCE([HOTSPOT_ENABLE_DISABLE_CDS], +[ + AC_ARG_ENABLE([cds], [AS_HELP_STRING([--enable-cds@<:@=yes/no@:>@], + [enable class data sharing feature in non-minimal VM. Default is yes.])]) + + if test "x$enable_cds" = "x" || test "x$enable_cds" = "xyes"; then + ENABLE_CDS="true" + elif test "x$enable_cds" = "xno"; then + ENABLE_CDS="false" + else + AC_MSG_ERROR([Invalid value for --enable-cds: $enable_cds]) + fi + + AC_SUBST(ENABLE_CDS) +]) + ############################################################################### # Set up all JVM features for each JVM variant. # @@ -335,8 +354,12 @@ fi INCLUDE_GRAAL="true" else - # By default enable graal build where AOT is available - if test "x$ENABLE_AOT" = "xtrue"; then + # By default enable graal build on linux-x64 or where AOT is available. + # graal build requires jvmci. + if test "x$JVM_FEATURES_jvmci" = "xjvmci" && \ + (test "x$OPENJDK_TARGET_CPU" = "xx86_64" && \ + test "x$OPENJDK_TARGET_OS" = "xlinux" || \ + test "x$ENABLE_AOT" = "xtrue") ; then AC_MSG_RESULT([yes]) JVM_FEATURES_graal="graal" INCLUDE_GRAAL="true" @@ -374,7 +397,10 @@ fi # All variants but minimal (and custom) get these features - NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jvmti fprof vm-structs jni-check services management all-gcs nmt cds" + NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES jvmti vm-structs jni-check services management all-gcs nmt" + if test "x$ENABLE_CDS" = "xtrue"; then + NON_MINIMAL_FEATURES="$NON_MINIMAL_FEATURES cds" + fi # Enable features depending on variant. JVM_FEATURES_server="compiler1 compiler2 $NON_MINIMAL_FEATURES $JVM_FEATURES $JVM_FEATURES_jvmci $JVM_FEATURES_aot $JVM_FEATURES_graal" diff -r 000f4e4ddd39 -r 57173ad5c534 common/autoconf/jdk-options.m4 --- a/common/autoconf/jdk-options.m4 Fri Sep 01 14:13:40 2017 +0000 +++ b/common/autoconf/jdk-options.m4 Sat Sep 09 14:36:45 2017 +0200 @@ -496,11 +496,12 @@ [ AC_ARG_ENABLE([generate-classlist], [AS_HELP_STRING([--disable-generate-classlist], [forces enabling or disabling of the generation of a CDS classlist at build time. - Default is to generate it when either the server or client JVMs are built.])]) + Default is to generate it when either the server or client JVMs are built and + enable-cds is true.])]) # Check if it's likely that it's possible to generate the classlist. Depending # on exact jvm configuration it could be possible anyway. - if HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client); then + if test "x$ENABLE_CDS" = "xtrue" && (HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client)); then ENABLE_GENERATE_CLASSLIST_POSSIBLE="true" else ENABLE_GENERATE_CLASSLIST_POSSIBLE="false" @@ -511,7 +512,7 @@ AC_MSG_RESULT([yes, forced]) ENABLE_GENERATE_CLASSLIST="true" if test "x$ENABLE_GENERATE_CLASSLIST_POSSIBLE" = "xfalse"; then - AC_MSG_WARN([Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS]) + AC_MSG_WARN([Generation of classlist might not be possible with JVM Variants $JVM_VARIANTS and enable-cds=$ENABLE_CDS]) fi elif test "x$enable_generate_classlist" = "xno"; then AC_MSG_RESULT([no, forced]) diff -r 000f4e4ddd39 -r 57173ad5c534 common/conf/jib-profiles.js --- a/common/conf/jib-profiles.js Fri Sep 01 14:13:40 2017 +0000 +++ b/common/conf/jib-profiles.js Sat Sep 09 14:36:45 2017 +0200 @@ -818,6 +818,49 @@ } }, + "macosx-x64-open": { + artifacts: { + jdk: { + local: "bundles/\\(jdk.*bin.tar.gz\\)", + remote: [ + "bundles/openjdk/GPL/osx-x64/jdk-" + data.version + + "_osx-x64_bin.tar.gz", + "bundles/openjdk/GPL/osx-x64/\\1" + ], + subdir: "jdk-" + data.version + }, + jre: { + local: "bundles/\\(jre.*bin.tar.gz\\)", + remote: "bundles/openjdk/GPL/osx-x64/\\1", + }, + test: { + local: "bundles/\\(jdk.*bin-tests.tar.gz\\)", + remote: [ + "bundles/openjdk/GPL/osx-x64/jdk-" + data.version + + "_osx-x64_bin-tests.tar.gz", + "bundles/openjdk/GPL/osx-x64/\\1" + ] + }, + jdk_symbols: { + local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)", + remote: [ + "bundles/openjdk/GPL/osx-x64/jdk-" + data.version + + "_osx-x64_bin-symbols.tar.gz", + "bundles/openjdk/GPL/osx-x64/\\1" + ], + subdir: "jdk-" + data.version + }, + jre_symbols: { + local: "bundles/\\(jre.*bin-symbols.tar.gz\\)", + remote: "bundles/openjdk/GPL/osx-x64/\\1", + }, + doc_api_spec: { + local: "bundles/\\(jdk.*doc-api-spec.tar.gz\\)", + remote: "bundles/openjdk/GPL/osx-x64/\\1", + }, + } + }, + "windows-x86-open": { artifacts: { jdk: { @@ -884,10 +927,11 @@ profiles["linux-x64-ri"] = clone(profiles["linux-x64-open"]); profiles["linux-x86-ri"] = clone(profiles["linux-x86-open"]); profiles["linux-x86-ri-debug"] = clone(profiles["linux-x86-open-debug"]); + profiles["macosx-x64-ri"] = clone(profiles["macosx-x64-open"]); profiles["windows-x86-ri"] = clone(profiles["windows-x86-open"]); // Generate artifacts for ri profiles - [ "linux-x64-ri", "linux-x86-ri", "linux-x86-ri-debug", "windows-x86-ri" ] + [ "linux-x64-ri", "linux-x86-ri", "linux-x86-ri-debug", "macosx-x64-ri", "windows-x86-ri" ] .forEach(function (name) { // Rewrite all remote dirs to "bundles/openjdk/BCL/..." for (artifactName in profiles[name].artifacts) { diff -r 000f4e4ddd39 -r 57173ad5c534 corba/.hgtags --- a/corba/.hgtags Fri Sep 01 14:13:40 2017 +0000 +++ b/corba/.hgtags Sat Sep 09 14:36:45 2017 +0200 @@ -446,3 +446,4 @@ ba71941ad9dba53b8fffb30602ef673eee88696c jdk-9+181 7a54ec280513a33e49e60546c0cf9ca573925a43 jdk-10+20 68b5f8eeac3325c02aac2f4b452b8a37c20c970e jdk-10+21 +1f4456d51b07098af1848d0d968084b1e9b85a36 jdk-10+22 diff -r 000f4e4ddd39 -r 57173ad5c534 corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java --- a/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java Fri Sep 01 14:13:40 2017 +0000 +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/ORB.java Sat Sep 09 14:36:45 2017 +0200 @@ -85,15 +85,15 @@ * three {@code init} methods. Two of the three methods use the properties * (associations of a name with a value) shown in the * table below.
- * - * + *
Standard Java CORBA Properties:
+ * * - * + * * - * - * + * + * * - * + * * * *
Standard Java CORBA Properties
Property Name Property Value
Property Name Property Value
org.omg.CORBA.ORBClass
org.omg.CORBA.ORBClassclass name of an ORB implementation
org.omg.CORBA.ORBSingletonClass
org.omg.CORBA.ORBSingletonClassclass name of the ORB returned by {@code init()}
diff -r 000f4e4ddd39 -r 57173ad5c534 corba/src/java.corba/share/classes/org/omg/CORBA/TCKind.java --- a/corba/src/java.corba/share/classes/org/omg/CORBA/TCKind.java Fri Sep 01 14:13:40 2017 +0000 +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/TCKind.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -237,175 +237,175 @@ /** * The TCKind constant whose value field is - * initialized with TCKind._tk_null. + * initialized with {@code TCKind._tk_null}. */ public static final TCKind tk_null = new TCKind(_tk_null); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_void. + * initialized with {@code TCKind._tk_void}. */ public static final TCKind tk_void = new TCKind(_tk_void); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_short. + * initialized with {@code TCKind._tk_short}. */ public static final TCKind tk_short = new TCKind(_tk_short); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_long. + * initialized with {@code TCKind._tk_long}. */ public static final TCKind tk_long = new TCKind(_tk_long); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_ushort. + * initialized with {@code TCKind._tk_ushort}. */ public static final TCKind tk_ushort = new TCKind(_tk_ushort); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_ulong. + * initialized with {@code TCKind._tk_ulong}. */ public static final TCKind tk_ulong = new TCKind(_tk_ulong); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_float. + * initialized with {@code TCKind._tk_float}. */ public static final TCKind tk_float = new TCKind(_tk_float); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_double. + * initialized with {@code TCKind._tk_double}. */ public static final TCKind tk_double = new TCKind(_tk_double); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_boolean. + * initialized with {@code TCKind._tk_boolean}. */ public static final TCKind tk_boolean = new TCKind(_tk_boolean); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_char. + * initialized with {@code TCKind._tk_char}. */ public static final TCKind tk_char = new TCKind(_tk_char); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_octet. + * initialized with {@code TCKind._tk_octet}. */ public static final TCKind tk_octet = new TCKind(_tk_octet); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_any. + * initialized with {@code TCKind._tk_any}. */ public static final TCKind tk_any = new TCKind(_tk_any); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_TypeCode. + * initialized with {@code TCKind._tk_TypeCode}. */ public static final TCKind tk_TypeCode = new TCKind(_tk_TypeCode); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_Principal. + * initialized with {@code TCKind._tk_Principal}. */ public static final TCKind tk_Principal = new TCKind(_tk_Principal); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_objref. + * initialized with {@code TCKind._tk_objref}. */ public static final TCKind tk_objref = new TCKind(_tk_objref); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_struct. + * initialized with {@code TCKind._tk_struct}. */ public static final TCKind tk_struct = new TCKind(_tk_struct); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_union. + * initialized with {@code TCKind._tk_union}. */ public static final TCKind tk_union = new TCKind(_tk_union); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_enum. + * initialized with {@code TCKind._tk_enum}. */ public static final TCKind tk_enum = new TCKind(_tk_enum); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_string. + * initialized with {@code TCKind._tk_string}. */ public static final TCKind tk_string = new TCKind(_tk_string); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_sequence. + * initialized with {@code TCKind._tk_sequence}. */ public static final TCKind tk_sequence = new TCKind(_tk_sequence); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_array. + * initialized with {@code TCKind._tk_array}. */ public static final TCKind tk_array = new TCKind(_tk_array); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_alias. + * initialized with {@code TCKind._tk_alias}. */ public static final TCKind tk_alias = new TCKind(_tk_alias); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_except. + * initialized with {@code TCKind._tk_except}. */ public static final TCKind tk_except = new TCKind(_tk_except); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_longlong. + * initialized with {@code TCKind._tk_longlong}. */ public static final TCKind tk_longlong = new TCKind(_tk_longlong); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_ulonglong. + * initialized with {@code TCKind._tk_ulonglong}. */ public static final TCKind tk_ulonglong = new TCKind(_tk_ulonglong); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_longdouble. + * initialized with {@code TCKind._tk_longdouble}. */ public static final TCKind tk_longdouble = new TCKind(_tk_longdouble); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_wchar. + * initialized with {@code TCKind._tk_wchar}. */ public static final TCKind tk_wchar = new TCKind(_tk_wchar); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_wstring. + * initialized with {@code TCKind._tk_wstring}. */ public static final TCKind tk_wstring = new TCKind(_tk_wstring); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_fixed. + * initialized with {@code TCKind._tk_fixed}. */ public static final TCKind tk_fixed = new TCKind(_tk_fixed); @@ -413,26 +413,26 @@ /** * The TCKind constant whose value field is - * initialized with TCKind._tk_value. + * initialized with {@code TCKind._tk_value}. */ public static final TCKind tk_value = new TCKind(_tk_value); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_value_box. + * initialized with {@code TCKind._tk_value_box}. */ public static final TCKind tk_value_box = new TCKind(_tk_value_box); // orbos 98-01-18: Objects By Value -- end /** * The TCKind constant whose value field is - * initialized with TCKind._tk_native. + * initialized with {@code TCKind._tk_native}. */ public static final TCKind tk_native = new TCKind(_tk_native); /** * The TCKind constant whose value field is - * initialized with TCKind._tk_abstract_interface. + * initialized with {@code TCKind._tk_abstract_interface}. */ public static final TCKind tk_abstract_interface = new TCKind(_tk_abstract_interface); diff -r 000f4e4ddd39 -r 57173ad5c534 corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html --- a/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html Fri Sep 01 14:13:40 2017 +0000 +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html Sat Sep 09 14:36:45 2017 +0200 @@ -1,10 +1,10 @@ - + Official Specifications for CORBA support in Java[tm] SE 6 - +

Official Specifications for CORBA support in Java[tm] SE 6

diff -r 000f4e4ddd39 -r 57173ad5c534 corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html --- a/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html Fri Sep 01 14:13:40 2017 +0000 +++ b/corba/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html Sat Sep 09 14:36:45 2017 +0200 @@ -1,17 +1,17 @@ - + IDL-to-Java Generated Files - +

IDL-to-Java Generated Files

The files that are generated by the IDL-to-Java compiler, in accordance with the IDL-to-Java Language Mapping Specification, -which is implemented in JavaTM SE 6 +which is implemented in Java™ SE 6 according the compliance document. diff -r 000f4e4ddd39 -r 57173ad5c534 corba/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl --- a/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl Fri Sep 01 14:13:40 2017 +0000 +++ b/corba/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl Sat Sep 09 14:36:45 2017 +0200 @@ -584,7 +584,7 @@ * Shows the validity of each attribute or operation * * - *   + * * send_request * send_poll * receive_reply @@ -592,182 +592,176 @@ * receive_other * * - * + * * * - * Inherited from RequestInfo: + * Inherited from RequestInfo: * * - *

request_id

+ * request_id * yes * yes * yes * yes * yes * - *

operation

+ * operation * yes * yes * yes * yes * yes * - *

arguments

+ * arguments * yes1 * no * yes * no * no * - *

exceptions

+ * exceptions * yes * no * yes * yes * yes * - *

contexts

+ * contexts * yes * no * yes * yes * yes * - *

operation_context

+ * operation_context * yes * no * yes * yes - * yes - * + * yes * - *

result

+ * result * no * no * yes * no - * no - * + * no * - *

response_expected

+ * response_expected * yes * yes * yes * yes * yes * - *

sync_scope

+ * sync_scope * yes * no * yes * yes - * yes - * + * yes * - *

reply_status

+ * reply_status * no * no * yes * yes * yes * - *

forward_reference

+ * forward_reference * no * no * no * no - * yes2 - * + * yes2 * - *

get_slot

+ * get_slot * yes * yes * yes * yes * yes * - *

get_request_service_context

+ * get_request_service_context * yes * no * yes * yes * yes * - *

get_reply_service_context

+ * get_reply_service_context * no * no * yes * yes - * yes - * + * yes * * - * ClientRequestInfo-specific: + * ClientRequestInfo-specific: * * - *

target

+ * target * yes * yes * yes * yes * yes * - *

effective_target

+ * effective_target * yes * yes * yes * yes - * yes - * + * yes * - *

effective_profile

+ * effective_profile * yes * yes * yes * yes * yes * - *

received_exception

+ * received_exception * no * no * no * yes * no * - *

received_exception_id

+ * received_exception_id * no * no * no * yes * no * - *

get_effective_component

+ * get_effective_component * yes * no * yes * yes * yes * - *

get_effective_components

+ * get_effective_components * yes * no * yes * yes * yes * - *

get_request_policy

+ * get_request_policy * yes * no * yes * yes * yes * - *

add_request_service_context

- * yes - * no - * no - * no - * no + * add_request_service_context + * yes + * no + * no + * no + * no * * * @@ -940,7 +934,7 @@ * Shows the validity of each attribute or operation * * - *   + * * receive_request_
service_contexts * receive_request * send_reply @@ -948,28 +942,28 @@ * send_other * * - * + * * * * - * Inherited from RequestInfo: + * Inherited from RequestInfo: * * - *

request_id

+ * request_id * yes * yes * yes * yes * yes * - *

operation

+ * operation * yes * yes * yes * yes * yes * - *

arguments

+ * arguments * no * yes1 * yes @@ -977,21 +971,21 @@ * no2 * * - *

exceptions

+ * exceptions * no * yes * yes * yes * yes * - *

contexts

+ * contexts * no * yes * yes * yes * yes * - *

operation_context

+ * operation_context * no * yes * yes @@ -999,7 +993,7 @@ * no * * - *

result

+ * result * no * no * yes @@ -1007,113 +1001,136 @@ * no * * - *

response_expected

+ * response_expected * yes * yes * yes * yes * yes * - *

sync_scope

+ * sync_scope * yes * yes * yes * yes * yes * - * request_id - * yes yes yes yes yes - * - * operation - * yes yes yes yes yes + * reply_status + * no + * no + * yes + * yes + * yes * - * arguments - * no yes1 - * yes no2 - * no2 - * + * forward_reference + * no + * no + * no + * no + * yes2 * - * exceptions - * no yes yes yes yes - * - * contexts - * no yes yes yes yes - * - * operation_context - * no yes yes no no + * get_slot + * yes + * yes + * yes + * yes + * yes * - * result - * no no yes no no - * - * response_expected - * yes yes yes yes yes + * get_request_service_context + * yes + * no + * yes + * yes + * yes * - * sync_scope - * yes yes yes yes yes - * - * reply_status - * no no yes yes yes + * get_reply_service_context + * no + * no + * yes + * yes + * yes * - * forward_reference - * no no no no yes2 - * + * + * ServerRequestInfo-specific: + * * - * get_slot - * yes yes yes yes yes + * sending_exception + * no + * no + * no + * yes + * no * - * get_request_service_context - * yes no yes yes yes - * - * get_reply_service_context - * no no yes yes yes + * object_id + * no + * yes + * yes + * yes3 + * yes3 * - * - * ServerRequestInfo-specific: - * - * - * sending_exception - * no no no yes no + * adapter_id + * no + * yes + * yes + * yes3 + * yes3 * - * object_id - * no yes yes yes3 - * yes3 - * - * - * adapter_id - * no yes yes yes3 - * yes3 - * - * - * server_id - * no yes yes yes yes + * server_id + * no + * yes + * yes + * yes + * yes * - * orb_id - * no yes yes yes yes + * orb_id + * no + * yes + * yes + * yes + * yes + * + * adapter_name + * no + * yes + * yes + * yes + * yes * - * adapter_name - * no yes yes yes yes - * - * target_most_derived_interface - * no yes no4 - * no4 - * no4 - * + * target_most_derived_interface + * no + * yes + * no4 + * no4 + * no4 * - * get_server_policy - * yes yes yes yes yes + * get_server_policy + * yes + * yes + * yes + * yes + * yes * - * set_slot - * yes yes yes yes yes + * set_slot + * yes + * yes + * yes + * yes + * yes * - * target_is_a - * no yes no4 - * no4 - * no4 - * + * target_is_a + * no + * yes + * no4 + * no4 + * no4 * - * add_reply_service_context - * yes yes yes yes yes - * + * add_reply_service_context + * yes + * yes + * yes + * yes + * yes + * * * *
    diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/.hgtags --- a/hotspot/.hgtags Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/.hgtags Sat Sep 09 14:36:45 2017 +0200 @@ -606,3 +606,4 @@ 4a443796f6f57842d6a0434ac27ca3d1033ccc20 jdk-9+181 e93ed1a092409351c90b3a76d80b9aa8b44d5e6a jdk-10+20 bdb2dbc43ff065b74c2121bdfb0d6e1fa8684b73 jdk-10+21 +71337910df60ff2b62daf10357f553def25e2d0b jdk-10+22 diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/make/lib/JvmFeatures.gmk --- a/hotspot/make/lib/JvmFeatures.gmk Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/make/lib/JvmFeatures.gmk Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ # -# Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2013, 2017, 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 @@ -88,11 +88,6 @@ JVM_EXCLUDE_FILES += jvmciCodeInstaller_$(HOTSPOT_TARGET_CPU_ARCH).cpp endif -ifneq ($(call check-jvm-feature, fprof), true) - JVM_CFLAGS_FEATURES += -DINCLUDE_FPROF=0 - JVM_EXCLUDE_FILES += fprofiler.cpp -endif - ifneq ($(call check-jvm-feature, vm-structs), true) JVM_CFLAGS_FEATURES += -DINCLUDE_VM_STRUCTS=0 JVM_EXCLUDE_FILES += vmStructs.cpp diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/cpu/aarch64/vm/aarch64.ad --- a/hotspot/src/cpu/aarch64/vm/aarch64.ad Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/cpu/aarch64/vm/aarch64.ad Sat Sep 09 14:36:45 2017 +0200 @@ -12614,7 +12614,7 @@ match(Set dst (AndI (URShiftI src rshift) mask)); ins_cost(INSN_COST); - format %{ "ubfxw $dst, $src, $mask" %} + format %{ "ubfxw $dst, $src, $rshift, $mask" %} ins_encode %{ int rshift = $rshift$$constant; long mask = $mask$$constant; @@ -12629,7 +12629,7 @@ match(Set dst (AndL (URShiftL src rshift) mask)); ins_cost(INSN_COST); - format %{ "ubfx $dst, $src, $mask" %} + format %{ "ubfx $dst, $src, $rshift, $mask" %} ins_encode %{ int rshift = $rshift$$constant; long mask = $mask$$constant; @@ -12647,7 +12647,7 @@ match(Set dst (ConvI2L (AndI (URShiftI src rshift) mask))); ins_cost(INSN_COST * 2); - format %{ "ubfx $dst, $src, $mask" %} + format %{ "ubfx $dst, $src, $rshift, $mask" %} ins_encode %{ int rshift = $rshift$$constant; long mask = $mask$$constant; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/cpu/aarch64/vm/aarch64_ad.m4 --- a/hotspot/src/cpu/aarch64/vm/aarch64_ad.m4 Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/cpu/aarch64/vm/aarch64_ad.m4 Sat Sep 09 14:36:45 2017 +0200 @@ -183,7 +183,7 @@ match(Set dst (And$1 ($2$1 src rshift) mask)); ins_cost(INSN_COST); - format %{ "$3 $dst, $src, $mask" %} + format %{ "$3 $dst, $src, $rshift, $mask" %} ins_encode %{ int rshift = $rshift$$constant; long mask = $mask$$constant; @@ -203,7 +203,7 @@ match(Set dst (ConvI2L (AndI (URShiftI src rshift) mask))); ins_cost(INSN_COST * 2); - format %{ "ubfx $dst, $src, $mask" %} + format %{ "ubfx $dst, $src, $rshift, $mask" %} ins_encode %{ int rshift = $rshift$$constant; long mask = $mask$$constant; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -3630,6 +3630,12 @@ } #if INCLUDE_ALL_GCS +/* + * g1_write_barrier_pre -- G1GC pre-write barrier for store of new_val at + * store_addr. + * + * Allocates rscratch1 + */ void MacroAssembler::g1_write_barrier_pre(Register obj, Register pre_val, Register thread, @@ -3645,10 +3651,8 @@ Label done; Label runtime; - assert(pre_val != noreg, "check this code"); - - if (obj != noreg) - assert_different_registers(obj, pre_val, tmp); + assert_different_registers(obj, pre_val, tmp, rscratch1); + assert(pre_val != noreg && tmp != noreg, "expecting a register"); Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() + SATBMarkQueue::byte_offset_of_active())); @@ -3722,12 +3726,22 @@ bind(done); } +/* + * g1_write_barrier_post -- G1GC post-write barrier for store of new_val at + * store_addr + * + * Allocates rscratch1 + */ void MacroAssembler::g1_write_barrier_post(Register store_addr, Register new_val, Register thread, Register tmp, Register tmp2) { assert(thread == rthread, "must be"); + assert_different_registers(store_addr, new_val, thread, tmp, tmp2, + rscratch1); + assert(store_addr != noreg && new_val != noreg && tmp != noreg + && tmp2 != noreg, "expecting a register"); Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() + DirtyCardQueue::byte_offset_of_index())); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -2067,7 +2067,7 @@ __ g1_write_barrier_pre(noreg /* obj */, r0 /* pre_val */, rthread /* thread */, - rscratch1 /* tmp */, + rscratch2 /* tmp */, true /* tosca_live */, true /* expand_call */); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp --- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -170,7 +170,7 @@ // G1 barrier needs uncompressed oop for region cross check. Register new_val = val; if (UseCompressedOops) { - new_val = rscratch1; + new_val = rscratch2; __ mov(new_val, val); } __ store_heap_oop(Address(r3, 0), val); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -292,7 +292,7 @@ if (VerifyThread) { // NOTE: this chops off the heads of the 64-bit O registers. // make sure G2_thread contains the right value - save_frame_and_mov(0, Lmethod, Lmethod); // to avoid clobbering O0 (and propagate Lmethod for -Xprof) + save_frame_and_mov(0, Lmethod, Lmethod); // to avoid clobbering O0 (and propagate Lmethod) mov(G1, L1); // avoid clobbering G1 // G2 saved below mov(G3, L3); // avoid clobbering G3 @@ -398,7 +398,7 @@ #ifdef ASSERT // check that it WAS previously set - save_frame_and_mov(0, Lmethod, Lmethod); // Propagate Lmethod to helper frame for -Xprof + save_frame_and_mov(0, Lmethod, Lmethod); // Propagate Lmethod to helper frame ld_ptr(sp_addr, L0); tst(L0); breakpoint_trap(Assembler::zero, Assembler::ptr_cc); @@ -618,7 +618,7 @@ # ifdef ASSERT // Check that we are not overwriting any other oop. - save_frame_and_mov(0, Lmethod, Lmethod); // Propagate Lmethod for -Xprof + save_frame_and_mov(0, Lmethod, Lmethod); // Propagate Lmethod ld_ptr(vm_result_addr, L0); tst(L0); restore(); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp --- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -2928,7 +2928,7 @@ __ br(Assembler::zero, false, Assembler::pt, notFinal); __ delayed()->and3(Rret, 0xFF, G4_scratch); // gets number of parameters - if (RewriteBytecodes && !UseSharedSpaces) { + if (RewriteBytecodes && !UseSharedSpaces && !DumpSharedSpaces) { patch_bytecode(Bytecodes::_fast_invokevfinal, Rscratch, Rtemp); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java --- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc.binformat/src/jdk/tools/jaotc/binformat/BinaryContainer.java Sat Sep 09 14:36:45 2017 +0200 @@ -187,10 +187,9 @@ {"StubRoutines::_arrayof_oop_disjoint_arraycopy", "_aot_stub_routines_arrayof_oop_disjoint_arraycopy"}, {"StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit", "_aot_stub_routines_arrayof_oop_disjoint_arraycopy_uninit"}, - {"StubRoutines::_checkcast_arraycopy", "_aot_stub_routines_checkcast_arraycopy"}, + {"StubRoutines::_unsafe_arraycopy", "_aot_stub_routines_unsafe_arraycopy"}, - - + {"StubRoutines::_checkcast_arraycopy", "_aot_stub_routines_checkcast_arraycopy"}, {"StubRoutines::_aescrypt_encryptBlock", "_aot_stub_routines_aescrypt_encryptBlock"}, {"StubRoutines::_aescrypt_decryptBlock", "_aot_stub_routines_aescrypt_decryptBlock"}, @@ -478,8 +477,8 @@ } /** - * Creates a global symbol of the form {@code "A" + container name}. - * Note, linker on Windows does not allow names which start with '.' + * Creates a global symbol of the form {@code "A" + container name}. Note, linker on Windows + * does not allow names which start with '.' * * @param container container to create a symbol for */ @@ -685,7 +684,8 @@ } /** - * Add oop symbol by as follows. Extend the oop.got section with another slot for the VM to patch. + * Add oop symbol by as follows. Extend the oop.got section with another slot for the VM to + * patch. * * @param oopName name of the oop symbol */ @@ -728,10 +728,9 @@ } /** - * Add klass symbol by as follows. - * - Adding the symbol name to the metaspace.names section - * - Add the offset of the name in metaspace.names to metaspace.offsets - * - Extend the klasses.got section with another slot for the VM to patch + * Add klass symbol by as follows. - Adding the symbol name to the metaspace.names section - Add + * the offset of the name in metaspace.names to metaspace.offsets - Extend the klasses.got + * section with another slot for the VM to patch * * @param klassName name of the metaspace symbol * @return the got offset in the klasses.got of the metaspace symbol diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTBackend.java --- a/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTBackend.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTBackend.java Sat Sep 09 14:36:45 2017 +0200 @@ -27,6 +27,8 @@ import org.graalvm.compiler.code.CompilationResult; import org.graalvm.compiler.core.GraalCompiler; +import org.graalvm.compiler.core.common.CompilationIdentifier; +import org.graalvm.compiler.core.common.CompilationIdentifier.Verbosity; import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.hotspot.HotSpotBackend; import org.graalvm.compiler.hotspot.HotSpotCompiledCodeBuilder; @@ -127,7 +129,13 @@ ProfilingInfo profilingInfo = DefaultProfilingInfo.get(TriState.FALSE); final boolean isImmutablePIC = true; - CompilationResult compilationResult = new CompilationResult(resolvedMethod.getName(), isImmutablePIC); + CompilationIdentifier id = new CompilationIdentifier() { + @Override + public String toString(Verbosity verbosity) { + return resolvedMethod.getName(); + } + }; + CompilationResult compilationResult = new CompilationResult(id, isImmutablePIC); return GraalCompiler.compileGraph(graph, resolvedMethod, providers, backend, graphBuilderSuite, OptimisticOptimizations.ALL, profilingInfo, getSuites(), getLirSuites(), compilationResult, CompilationResultBuilderFactory.Default); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.replacements/src/org/graalvm/compiler/api/replacements/ClassSubstitution.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.replacements/src/org/graalvm/compiler/api/replacements/ClassSubstitution.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.api.replacements/src/org/graalvm/compiler/api/replacements/ClassSubstitution.java Sat Sep 09 14:36:45 2017 +0200 @@ -57,7 +57,9 @@ /** * Determines if the substitutions are for classes that may not be part of the runtime. - * Substitutions for such classes are omitted if the original classes cannot be found. + * Substitutions for such classes are omitted if the original classes cannot be found. If + * multiple classes are specified using {@link #className()} and {@link #optional()} is false, + * then at least one of the classes is required to be reachable. */ boolean optional() default false; } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.test/src/org/graalvm/compiler/asm/test/AssemblerTest.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.test/src/org/graalvm/compiler/asm/test/AssemblerTest.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.test/src/org/graalvm/compiler/asm/test/AssemblerTest.java Sat Sep 09 14:36:45 2017 +0200 @@ -90,7 +90,7 @@ StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).compilationId(compilationId).build(); CallingConvention cc = backend.newLIRGenerationResult(compilationId, null, null, graph, null).getCallingConvention(); - CompilationResult compResult = new CompilationResult(); + CompilationResult compResult = new CompilationResult(graph.compilationId()); byte[] targetCode = test.generateCode(compResult, codeCache.getTarget(), registerConfig, cc); compResult.setTargetCode(targetCode, targetCode.length); compResult.setTotalFrameSize(0); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.code/src/org/graalvm/compiler/code/CompilationResult.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.code/src/org/graalvm/compiler/code/CompilationResult.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.code/src/org/graalvm/compiler/code/CompilationResult.java Sat Sep 09 14:36:45 2017 +0200 @@ -33,6 +33,7 @@ import java.util.List; import java.util.Objects; +import org.graalvm.compiler.core.common.CompilationIdentifier; import org.graalvm.compiler.graph.NodeSourcePosition; import org.graalvm.util.EconomicSet; @@ -190,6 +191,8 @@ private final String name; + private final CompilationIdentifier compilationId; + /** * The buffer containing the emitted machine code. */ @@ -222,21 +225,26 @@ private boolean isImmutablePIC; - public CompilationResult() { - this(null, false); + public CompilationResult(CompilationIdentifier compilationId) { + this(compilationId, compilationId.toString(CompilationIdentifier.Verbosity.NAME), false); + } + + public CompilationResult(CompilationIdentifier compilationId, String name) { + this(compilationId, name, false); + } + + public CompilationResult(CompilationIdentifier compilationId, boolean isImmutablePIC) { + this(compilationId, null, isImmutablePIC); + } + + public CompilationResult(CompilationIdentifier compilationId, String name, boolean isImmutablePIC) { + this.compilationId = compilationId; + this.name = name; + this.isImmutablePIC = isImmutablePIC; } public CompilationResult(String name) { - this(name, false); - } - - public CompilationResult(boolean isImmutablePIC) { - this(null, isImmutablePIC); - } - - public CompilationResult(String name, boolean isImmutablePIC) { - this.name = name; - this.isImmutablePIC = isImmutablePIC; + this(null, name); } @Override @@ -266,6 +274,7 @@ this.totalFrameSize == that.totalFrameSize && this.targetCodeSize == that.targetCodeSize && Objects.equals(this.name, that.name) && + Objects.equals(this.compilationId, that.compilationId) && Objects.equals(this.annotations, that.annotations) && Objects.equals(this.dataSection, that.dataSection) && Objects.equals(this.exceptionHandlers, that.exceptionHandlers) && @@ -670,6 +679,10 @@ return name; } + public CompilationIdentifier getCompilationId() { + return compilationId; + } + public void setHasUnsafeAccess(boolean hasUnsafeAccess) { checkOpen(); this.hasUnsafeAccess = hasUnsafeAccess; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraalCompilerTest.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraalCompilerTest.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/GraalCompilerTest.java Sat Sep 09 14:36:45 2017 +0200 @@ -949,7 +949,7 @@ try (AllocSpy spy = AllocSpy.open(installedCodeOwner); DebugContext.Scope ds = debug.scope("Compiling", new DebugDumpScope(id.toString(CompilationIdentifier.Verbosity.ID), true))) { CompilationPrinter printer = CompilationPrinter.begin(options, id, installedCodeOwner, INVOCATION_ENTRY_BCI); - CompilationResult compResult = compile(installedCodeOwner, graphToCompile, new CompilationResult(), id, options); + CompilationResult compResult = compile(installedCodeOwner, graphToCompile, new CompilationResult(graphToCompile.compilationId()), id, options); printer.finish(compResult); try (DebugContext.Scope s = debug.scope("CodeInstall", getCodeCache(), installedCodeOwner, compResult); @@ -1019,17 +1019,19 @@ */ protected final CompilationResult compile(ResolvedJavaMethod installedCodeOwner, StructuredGraph graph) { OptionValues options = graph == null ? getInitialOptions() : graph.getOptions(); - return compile(installedCodeOwner, graph, new CompilationResult(), getOrCreateCompilationId(installedCodeOwner, graph), options); + CompilationIdentifier compilationId = getOrCreateCompilationId(installedCodeOwner, graph); + return compile(installedCodeOwner, graph, new CompilationResult(compilationId), compilationId, options); } protected final CompilationResult compile(ResolvedJavaMethod installedCodeOwner, StructuredGraph graph, CompilationIdentifier compilationId) { OptionValues options = graph == null ? getInitialOptions() : graph.getOptions(); - return compile(installedCodeOwner, graph, new CompilationResult(), compilationId, options); + return compile(installedCodeOwner, graph, new CompilationResult(compilationId), compilationId, options); } protected final CompilationResult compile(ResolvedJavaMethod installedCodeOwner, StructuredGraph graph, OptionValues options) { assert graph == null || graph.getOptions() == options; - return compile(installedCodeOwner, graph, new CompilationResult(), getOrCreateCompilationId(installedCodeOwner, graph), options); + CompilationIdentifier compilationId = getOrCreateCompilationId(installedCodeOwner, graph); + return compile(installedCodeOwner, graph, new CompilationResult(compilationId), compilationId, options); } /** diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/InfopointReasonTest.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/InfopointReasonTest.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/InfopointReasonTest.java Sat Sep 09 14:36:45 2017 +0200 @@ -64,7 +64,7 @@ final ResolvedJavaMethod method = getResolvedJavaMethod("testMethod"); final StructuredGraph graph = parseEager(method, AllowAssumptions.YES); final CompilationResult cr = compileGraph(graph, graph.method(), getProviders(), getBackend(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, graph.getProfilingInfo(), - createSuites(graph.getOptions()), createLIRSuites(graph.getOptions()), new CompilationResult(), CompilationResultBuilderFactory.Default); + createSuites(graph.getOptions()), createLIRSuites(graph.getOptions()), new CompilationResult(graph.compilationId()), CompilationResultBuilderFactory.Default); for (Infopoint sp : cr.getInfopoints()) { assertNotNull(sp.reason); if (sp instanceof Call) { @@ -86,7 +86,7 @@ assertTrue(graphLineSPs > 0); PhaseSuite graphBuilderSuite = getCustomGraphBuilderSuite(GraphBuilderConfiguration.getDefault(getDefaultGraphBuilderPlugins()).withFullInfopoints(true)); final CompilationResult cr = compileGraph(graph, graph.method(), getProviders(), getBackend(), graphBuilderSuite, OptimisticOptimizations.ALL, graph.getProfilingInfo(), - createSuites(graph.getOptions()), createLIRSuites(graph.getOptions()), new CompilationResult(), CompilationResultBuilderFactory.Default); + createSuites(graph.getOptions()), createLIRSuites(graph.getOptions()), new CompilationResult(graph.compilationId()), CompilationResultBuilderFactory.Default); int lineSPs = 0; for (Infopoint sp : cr.getInfopoints()) { assertNotNull(sp.reason); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/InvokeGraal.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/InvokeGraal.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/tutorial/InvokeGraal.java Sat Sep 09 14:36:45 2017 +0200 @@ -123,7 +123,7 @@ ProfilingInfo profilingInfo = graph.getProfilingInfo(method); /* The default class and configuration for compilation results. */ - CompilationResult compilationResult = new CompilationResult(); + CompilationResult compilationResult = new CompilationResult(graph.compilationId()); CompilationResultBuilderFactory factory = CompilationResultBuilderFactory.Default; /* Invoke the whole Graal compilation pipeline. */ diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph.test/src/org/graalvm/compiler/graph/test/NodeBitMapTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph.test/src/org/graalvm/compiler/graph/test/NodeBitMapTest.java Sat Sep 09 14:36:45 2017 +0200 @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2017, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package org.graalvm.compiler.graph.test; + +import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_IGNORED; +import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_IGNORED; + +import java.util.ConcurrentModificationException; +import java.util.Iterator; +import java.util.NoSuchElementException; + +import org.graalvm.compiler.api.test.Graal; +import org.graalvm.compiler.graph.Graph; +import org.graalvm.compiler.graph.Node; +import org.graalvm.compiler.graph.NodeBitMap; +import org.graalvm.compiler.graph.NodeClass; +import org.graalvm.compiler.nodeinfo.NodeInfo; +import org.graalvm.compiler.options.OptionValues; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +public class NodeBitMapTest extends GraphTest { + + @NodeInfo(cycles = CYCLES_IGNORED, size = SIZE_IGNORED) + static final class TestNode extends Node { + public static final NodeClass TYPE = NodeClass.create(TestNode.class); + + protected TestNode() { + super(TYPE); + } + } + + private Graph graph; + private TestNode[] nodes = new TestNode[100]; + private NodeBitMap map; + + @Before + public void before() { + // Need to initialize HotSpotGraalRuntime before any Node class is initialized. + Graal.getRuntime(); + + OptionValues options = getOptions(); + graph = new Graph(options, getDebug(options)); + for (int i = 0; i < nodes.length; i++) { + nodes[i] = graph.add(new TestNode()); + } + map = graph.createNodeBitMap(); + } + + @Test + public void iterateEmpty() { + for (Node n : map) { + Assert.fail("no elements expected: " + n); + } + } + + @Test + public void iterateMarkedNodes() { + map.mark(nodes[99]); + map.mark(nodes[0]); + map.mark(nodes[7]); + map.mark(nodes[1]); + map.mark(nodes[53]); + + Iterator iter = map.iterator(); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[0], iter.next()); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[1], iter.next()); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[7], iter.next()); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[53], iter.next()); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[99], iter.next()); + Assert.assertFalse(iter.hasNext()); + } + + @Test + public void deleteNodeWhileIterating() { + map.mark(nodes[99]); + map.mark(nodes[0]); + map.mark(nodes[7]); + map.mark(nodes[1]); + map.mark(nodes[53]); + + Iterator iter = map.iterator(); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[0], iter.next()); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[1], iter.next()); + nodes[7].markDeleted(); + nodes[53].markDeleted(); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[99], iter.next()); + Assert.assertFalse(iter.hasNext()); + } + + @Test + public void deleteAllNodesBeforeIterating() { + for (int i = 0; i < nodes.length; i++) { + map.mark(nodes[i]); + nodes[i].markDeleted(); + } + + Iterator iter = map.iterator(); + Assert.assertFalse(iter.hasNext()); + } + + @Test + public void multipleHasNextInvocations() { + map.mark(nodes[7]); + + Iterator iter = map.iterator(); + Assert.assertTrue(iter.hasNext()); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[7], iter.next()); + Assert.assertFalse(iter.hasNext()); + } + + @Test(expected = NoSuchElementException.class) + public void noSuchElement() { + map.iterator().next(); + } + + @Test(expected = ConcurrentModificationException.class) + public void concurrentModification() { + map.mark(nodes[7]); + + map.mark(nodes[99]); + map.mark(nodes[0]); + map.mark(nodes[7]); + map.mark(nodes[1]); + map.mark(nodes[53]); + + Iterator iter = map.iterator(); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[0], iter.next()); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[1], iter.next()); + Assert.assertTrue(iter.hasNext()); + nodes[7].markDeleted(); + iter.next(); + } + + @Test + public void nextWithoutHasNext() { + map.mark(nodes[99]); + map.mark(nodes[0]); + map.mark(nodes[7]); + map.mark(nodes[1]); + map.mark(nodes[53]); + + Iterator iter = map.iterator(); + Assert.assertEquals(nodes[0], iter.next()); + Assert.assertEquals(nodes[1], iter.next()); + Assert.assertEquals(nodes[7], iter.next()); + Assert.assertEquals(nodes[53], iter.next()); + Assert.assertEquals(nodes[99], iter.next()); + Assert.assertFalse(iter.hasNext()); + } + + @Test + public void markWhileIterating() { + map.mark(nodes[0]); + + Iterator iter = map.iterator(); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[0], iter.next()); + map.mark(nodes[7]); + Assert.assertTrue(iter.hasNext()); + map.mark(nodes[1]); + Assert.assertEquals(nodes[7], iter.next()); + map.mark(nodes[99]); + map.mark(nodes[53]); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[53], iter.next()); + Assert.assertTrue(iter.hasNext()); + Assert.assertEquals(nodes[99], iter.next()); + Assert.assertFalse(iter.hasNext()); + } +} diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeBitMap.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeBitMap.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/NodeBitMap.java Sat Sep 09 14:36:45 2017 +0200 @@ -23,22 +23,23 @@ package org.graalvm.compiler.graph; import java.util.Arrays; +import java.util.ConcurrentModificationException; import java.util.Iterator; +import java.util.NoSuchElementException; import org.graalvm.compiler.graph.iterators.NodeIterable; -public final class NodeBitMap implements NodeIterable { +public final class NodeBitMap extends NodeIdAccessor implements NodeIterable { private static final int SHIFT = 6; private long[] bits; private int nodeCount; private int counter; - private final Graph graph; public NodeBitMap(Graph graph) { + super(graph); this.nodeCount = graph.nodeIdCount(); this.bits = new long[sizeForNodeCount(nodeCount)]; - this.graph = graph; } private static int sizeForNodeCount(int nodeCount) { @@ -50,9 +51,9 @@ } private NodeBitMap(NodeBitMap other) { + super(other.graph); this.bits = other.bits.clone(); this.nodeCount = other.nodeCount; - this.graph = other.graph; } public Graph graph() { @@ -60,12 +61,12 @@ } public boolean isNew(Node node) { - return node.id() >= nodeCount; + return getNodeId(node) >= nodeCount; } public boolean isMarked(Node node) { assert check(node, false); - return isMarked(node.id()); + return isMarked(getNodeId(node)); } public boolean checkAndMarkInc(Node node) { @@ -84,33 +85,33 @@ public boolean isMarkedAndGrow(Node node) { assert check(node, true); - int id = node.id(); + int id = getNodeId(node); checkGrow(id); return isMarked(id); } public void mark(Node node) { assert check(node, false); - int id = node.id(); + int id = getNodeId(node); bits[id >> SHIFT] |= (1L << id); } public void markAndGrow(Node node) { assert check(node, true); - int id = node.id(); + int id = getNodeId(node); checkGrow(id); bits[id >> SHIFT] |= (1L << id); } public void clear(Node node) { assert check(node, false); - int id = node.id(); + int id = getNodeId(node); bits[id >> SHIFT] &= ~(1L << id); } public void clearAndGrow(Node node) { assert check(node, true); - int id = node.id(); + int id = getNodeId(node); checkGrow(id); bits[id >> SHIFT] &= ~(1L << id); } @@ -181,15 +182,30 @@ } } - protected int nextMarkedNodeId(int fromNodeId) { + protected Node nextMarkedNode(int fromNodeId) { assert fromNodeId >= 0; int wordIndex = fromNodeId >> SHIFT; int wordsInUse = bits.length; if (wordIndex < wordsInUse) { - long word = bits[wordIndex] & (0xFFFFFFFFFFFFFFFFL << fromNodeId); + long word = getPartOfWord(bits[wordIndex], fromNodeId); while (true) { - if (word != 0) { - return wordIndex * Long.SIZE + Long.numberOfTrailingZeros(word); + while (word != 0) { + int bitIndex = Long.numberOfTrailingZeros(word); + int nodeId = wordIndex * Long.SIZE + bitIndex; + Node result = graph.getNode(nodeId); + if (result == null) { + // node was deleted -> clear the bit and continue searching + bits[wordIndex] = bits[wordIndex] & ~(1 << bitIndex); + int nextNodeId = nodeId + 1; + if ((nextNodeId & (Long.SIZE - 1)) == 0) { + // we reached the end of this word + break; + } else { + word = getPartOfWord(word, nextNodeId); + } + } else { + return result; + } } if (++wordIndex == wordsInUse) { break; @@ -197,30 +213,56 @@ word = bits[wordIndex]; } } - return -2; + return null; + } + + private static long getPartOfWord(long word, int firstNodeIdToInclude) { + return word & (0xFFFFFFFFFFFFFFFFL << firstNodeIdToInclude); } + /** + * This iterator only returns nodes that are marked in the {@link NodeBitMap} and are alive in + * the corresponding {@link Graph}. + */ private class MarkedNodeIterator implements Iterator { - private int nextNodeId; + private int currentNodeId; + private Node currentNode; MarkedNodeIterator() { - nextNodeId = -1; + currentNodeId = -1; forward(); } private void forward() { - nextNodeId = NodeBitMap.this.nextMarkedNodeId(nextNodeId + 1); + assert currentNode == null; + currentNode = NodeBitMap.this.nextMarkedNode(currentNodeId + 1); + if (currentNode != null) { + assert currentNode.isAlive(); + currentNodeId = getNodeId(currentNode); + } else { + currentNodeId = -1; + } } @Override public boolean hasNext() { - return nextNodeId >= 0; + if (currentNode == null && currentNodeId >= 0) { + forward(); + } + return currentNodeId >= 0; } @Override public Node next() { - Node result = graph.getNode(nextNodeId); - forward(); + if (!hasNext()) { + throw new NoSuchElementException(); + } + if (!currentNode.isAlive()) { + throw new ConcurrentModificationException("NodeBitMap was modified between the calls to hasNext() and next()"); + } + + Node result = currentNode; + currentNode = null; return result; } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64RawNativeCallNode.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.aarch64/src/org/graalvm/compiler/hotspot/aarch64/AArch64RawNativeCallNode.java Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2014, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package org.graalvm.compiler.hotspot.aarch64; - -import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_UNKNOWN; -import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_UNKNOWN; - -import org.graalvm.compiler.core.aarch64.AArch64NodeLIRBuilder; -import org.graalvm.compiler.core.common.type.RawPointerStamp; -import org.graalvm.compiler.core.common.type.Stamp; -import org.graalvm.compiler.core.common.type.StampFactory; -import org.graalvm.compiler.graph.NodeClass; -import org.graalvm.compiler.graph.NodeInputList; -import org.graalvm.compiler.nodeinfo.NodeInfo; -import org.graalvm.compiler.nodes.FixedWithNextNode; -import org.graalvm.compiler.nodes.ValueNode; -import org.graalvm.compiler.nodes.spi.LIRLowerable; -import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool; - -import jdk.vm.ci.code.CallingConvention; -import jdk.vm.ci.hotspot.HotSpotCallingConventionType; -import jdk.vm.ci.meta.JavaConstant; -import jdk.vm.ci.meta.JavaKind; -import jdk.vm.ci.meta.JavaType; -import jdk.vm.ci.meta.MetaAccessProvider; -import jdk.vm.ci.meta.ResolvedJavaType; -import jdk.vm.ci.meta.Value; - -@NodeInfo(cycles = CYCLES_UNKNOWN, cyclesRationale = "Native call is a block hole", size = SIZE_UNKNOWN) -public final class AArch64RawNativeCallNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass TYPE = NodeClass.create(AArch64RawNativeCallNode.class); - - protected final JavaConstant functionPointer; - @Input NodeInputList args; - - public AArch64RawNativeCallNode(JavaKind returnType, JavaConstant functionPointer, ValueNode[] args) { - super(TYPE, StampFactory.forKind(returnType)); - this.functionPointer = functionPointer; - this.args = new NodeInputList<>(this, args); - } - - private static class PointerType implements JavaType { - - @Override - public String getName() { - return "void*"; - } - - @Override - public JavaType getComponentType() { - return null; - } - - @Override - public JavaType getArrayClass() { - return null; - } - - @Override - public JavaKind getJavaKind() { - // native pointers and java objects use the same registers in the calling convention - return JavaKind.Object; - } - - @Override - public ResolvedJavaType resolve(ResolvedJavaType accessingClass) { - return null; - } - } - - private static JavaType toJavaType(Stamp stamp, MetaAccessProvider metaAccess) { - if (stamp instanceof RawPointerStamp) { - return new PointerType(); - } else { - return stamp.javaType(metaAccess); - } - } - - @Override - public void generate(NodeLIRBuilderTool generator) { - AArch64NodeLIRBuilder gen = (AArch64NodeLIRBuilder) generator; - Value[] parameter = new Value[args.count()]; - JavaType[] parameterTypes = new JavaType[args.count()]; - for (int i = 0; i < args.count(); i++) { - parameter[i] = generator.operand(args.get(i)); - parameterTypes[i] = toJavaType(args.get(i).stamp(), gen.getLIRGeneratorTool().getMetaAccess()); - } - JavaType returnType = toJavaType(stamp(), gen.getLIRGeneratorTool().getMetaAccess()); - CallingConvention cc = generator.getLIRGeneratorTool().getCodeCache().getRegisterConfig().getCallingConvention(HotSpotCallingConventionType.NativeCall, returnType, parameterTypes, - generator.getLIRGeneratorTool()); - gen.getLIRGeneratorTool().emitCCall(functionPointer.asLong(), cc, parameter); - if (this.getStackKind() != JavaKind.Void) { - generator.setResult(this, gen.getLIRGeneratorTool().emitMove(cc.getReturn())); - } - } - -} diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64RawNativeCallNode.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.amd64/src/org/graalvm/compiler/hotspot/amd64/AMD64RawNativeCallNode.java Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2014, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package org.graalvm.compiler.hotspot.amd64; - -import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_UNKNOWN; - -import org.graalvm.compiler.core.amd64.AMD64NodeLIRBuilder; -import org.graalvm.compiler.core.common.type.RawPointerStamp; -import org.graalvm.compiler.core.common.type.Stamp; -import org.graalvm.compiler.core.common.type.StampFactory; -import org.graalvm.compiler.graph.NodeClass; -import org.graalvm.compiler.graph.NodeInputList; -import org.graalvm.compiler.nodeinfo.NodeInfo; -import org.graalvm.compiler.nodeinfo.NodeSize; -import org.graalvm.compiler.nodes.FixedWithNextNode; -import org.graalvm.compiler.nodes.ValueNode; -import org.graalvm.compiler.nodes.spi.LIRLowerable; -import org.graalvm.compiler.nodes.spi.NodeLIRBuilderTool; - -import jdk.vm.ci.code.CallingConvention; -import jdk.vm.ci.hotspot.HotSpotCallingConventionType; -import jdk.vm.ci.meta.JavaConstant; -import jdk.vm.ci.meta.JavaKind; -import jdk.vm.ci.meta.JavaType; -import jdk.vm.ci.meta.MetaAccessProvider; -import jdk.vm.ci.meta.ResolvedJavaType; -import jdk.vm.ci.meta.Value; - -@NodeInfo(cycles = CYCLES_UNKNOWN, cyclesRationale = "Native call is a block hole", size = NodeSize.SIZE_UNKNOWN) -public final class AMD64RawNativeCallNode extends FixedWithNextNode implements LIRLowerable { - public static final NodeClass TYPE = NodeClass.create(AMD64RawNativeCallNode.class); - - protected final JavaConstant functionPointer; - @Input NodeInputList args; - - public AMD64RawNativeCallNode(JavaKind returnType, JavaConstant functionPointer, ValueNode[] args) { - super(TYPE, StampFactory.forKind(returnType)); - this.functionPointer = functionPointer; - this.args = new NodeInputList<>(this, args); - } - - private static class PointerType implements JavaType { - - @Override - public String getName() { - return "void*"; - } - - @Override - public JavaType getComponentType() { - return null; - } - - @Override - public JavaType getArrayClass() { - return null; - } - - @Override - public JavaKind getJavaKind() { - // native pointers and java objects use the same registers in the calling convention - return JavaKind.Object; - } - - @Override - public ResolvedJavaType resolve(ResolvedJavaType accessingClass) { - return null; - } - } - - private static JavaType toJavaType(Stamp stamp, MetaAccessProvider metaAccess) { - if (stamp instanceof RawPointerStamp) { - return new PointerType(); - } else { - return stamp.javaType(metaAccess); - } - } - - @Override - public void generate(NodeLIRBuilderTool generator) { - AMD64NodeLIRBuilder gen = (AMD64NodeLIRBuilder) generator; - Value[] parameter = new Value[args.count()]; - JavaType[] parameterTypes = new JavaType[args.count()]; - for (int i = 0; i < args.count(); i++) { - parameter[i] = generator.operand(args.get(i)); - parameterTypes[i] = toJavaType(args.get(i).stamp(), gen.getLIRGeneratorTool().getMetaAccess()); - } - JavaType returnType = toJavaType(stamp(), gen.getLIRGeneratorTool().getMetaAccess()); - CallingConvention cc = generator.getLIRGeneratorTool().getCodeCache().getRegisterConfig().getCallingConvention(HotSpotCallingConventionType.NativeCall, returnType, parameterTypes, - generator.getLIRGeneratorTool()); - gen.getLIRGeneratorTool().emitCCall(functionPointer.asLong(), cc, parameter, countFloatingTypeArguments(args)); - if (this.getStackKind() != JavaKind.Void) { - generator.setResult(this, gen.getLIRGeneratorTool().emitMove(cc.getReturn())); - } - } - - private static int countFloatingTypeArguments(NodeInputList args) { - int count = 0; - for (ValueNode n : args) { - if (n.getStackKind() == JavaKind.Double || n.getStackKind() == JavaKind.Float) { - count++; - } - } - if (count > 8) { - return 8; - } - return count; - } - -} diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java Sat Sep 09 14:36:45 2017 +0200 @@ -207,7 +207,6 @@ "oracle/jrockit/jfr/Timing.counterTime()J", "oracle/jrockit/jfr/VMJFR.classID0(Ljava/lang/Class;)J", "oracle/jrockit/jfr/VMJFR.threadID()I", - "sun/misc/Unsafe.copyMemory(Ljava/lang/Object;JLjava/lang/Object;JJ)V", "sun/nio/cs/ISO_8859_1$Encoder.encodeISOArray([CI[BII)I", "sun/security/provider/DigestBase.implCompressMultiBlock([BII)I", "sun/security/provider/SHA.implCompress([BI)V", @@ -273,7 +272,6 @@ "jdk/internal/misc/Unsafe.compareAndExchangeShortRelease(Ljava/lang/Object;JSS)S", "jdk/internal/misc/Unsafe.compareAndSetByte(Ljava/lang/Object;JBB)Z", "jdk/internal/misc/Unsafe.compareAndSetShort(Ljava/lang/Object;JSS)Z", - "jdk/internal/misc/Unsafe.copyMemory0(Ljava/lang/Object;JLjava/lang/Object;JJ)V", "jdk/internal/misc/Unsafe.getAndAddByte(Ljava/lang/Object;JB)B", "jdk/internal/misc/Unsafe.getAndAddShort(Ljava/lang/Object;JS)S", "jdk/internal/misc/Unsafe.getAndSetByte(Ljava/lang/Object;JB)B", diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotUnsafeSubstitutionTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotUnsafeSubstitutionTest.java Sat Sep 09 14:36:45 2017 +0200 @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2017, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package org.graalvm.compiler.hotspot.test; + +import org.graalvm.compiler.replacements.test.MethodSubstitutionTest; +import org.junit.Test; + +import jdk.vm.ci.code.InstalledCode; +import jdk.vm.ci.meta.ResolvedJavaMethod; +import sun.misc.Unsafe; + +/** + * Tests the VM independent intrinsification of {@link Unsafe} methods. + */ +public class HotSpotUnsafeSubstitutionTest extends MethodSubstitutionTest { + + public void testSubstitution(String testMethodName, Class holder, String methodName, Class[] parameterTypes, Object receiver, Object[] args1, Object[] args2) { + ResolvedJavaMethod testMethod = getResolvedJavaMethod(testMethodName); + ResolvedJavaMethod originalMethod = getResolvedJavaMethod(holder, methodName, parameterTypes); + + // Force compilation + InstalledCode code = getCode(testMethod); + assert code != null; + + // Verify that the original method and the substitution produce the same value + Object expected = invokeSafe(originalMethod, receiver, args1); + Object actual = invokeSafe(testMethod, null, args2); + assertDeepEquals(expected, actual); + + // Verify that the generated code and the original produce the same value + expected = invokeSafe(originalMethod, receiver, args1); + actual = executeVarargsSafe(code, args2); + assertDeepEquals(expected, actual); + + } + + @Test + public void testUnsafeSubstitutions() throws Exception { + testGraph("unsafeCopyMemory"); + } + + public void unsafeCopyMemory(Object srcBase, long srcOffset, Object dstBase, long dstOffset, long bytes) { + UNSAFE.copyMemory(srcBase, srcOffset, dstBase, dstOffset, bytes); + } + + public byte[] testCopyMemorySnippet(long src, int bytes) { + byte[] result = new byte[bytes]; + UNSAFE.copyMemory(null, src, result, Unsafe.ARRAY_BYTE_BASE_OFFSET, bytes); + return result; + } + + @Test + public void testCopyMemory() { + int size = 128; + long src = UNSAFE.allocateMemory(size); + for (int i = 0; i < size; i++) { + UNSAFE.putByte(null, src + i, (byte) i); + } + test("testCopyMemorySnippet", src, size); + } +} diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java Sat Sep 09 14:36:45 2017 +0200 @@ -64,9 +64,9 @@ import org.graalvm.compiler.options.OptionValues; import org.graalvm.compiler.phases.tiers.SuitesProvider; import org.graalvm.compiler.word.Word; -import org.graalvm.util.Equivalence; import org.graalvm.util.EconomicMap; import org.graalvm.util.EconomicSet; +import org.graalvm.util.Equivalence; import org.graalvm.util.MapCursor; import org.graalvm.word.Pointer; @@ -258,6 +258,18 @@ private static native void sha5ImplCompressStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word bufAddr, Object state); /** + * @see org.graalvm.compiler.hotspot.meta.HotSpotUnsafeSubstitutions#copyMemory + */ + public static final ForeignCallDescriptor UNSAFE_ARRAYCOPY = new ForeignCallDescriptor("unsafe_arraycopy", void.class, Word.class, Word.class, Word.class); + + public static void unsafeArraycopy(Word srcAddr, Word dstAddr, Word size) { + unsafeArraycopyStub(HotSpotBackend.UNSAFE_ARRAYCOPY, srcAddr, dstAddr, size); + } + + @NodeIntrinsic(ForeignCallNode.class) + private static native void unsafeArraycopyStub(@ConstantNodeParameter ForeignCallDescriptor descriptor, Word srcAddr, Word dstAddr, Word size); + + /** * @see VMErrorNode */ public static final ForeignCallDescriptor VM_ERROR = new ForeignCallDescriptor("vm_error", void.class, Object.class, Object.class, long.class); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java Sat Sep 09 14:36:45 2017 +0200 @@ -198,7 +198,7 @@ public CompilationResult compile(ResolvedJavaMethod method, int entryBCI, boolean useProfilingInfo, CompilationIdentifier compilationId, OptionValues options, DebugContext debug) { StructuredGraph graph = createGraph(method, entryBCI, useProfilingInfo, compilationId, options, debug); - CompilationResult result = new CompilationResult(); + CompilationResult result = new CompilationResult(compilationId); return compileHelper(CompilationResultBuilderFactory.Default, result, graph, method, entryBCI, useProfilingInfo, options); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotGraphBuilderPlugins.java Sat Sep 09 14:36:45 2017 +0200 @@ -111,6 +111,7 @@ import jdk.vm.ci.meta.JavaKind; import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ResolvedJavaMethod; +import sun.misc.Unsafe; /** * Defines the {@link Plugins} used when running on HotSpot. @@ -202,6 +203,7 @@ registerCRC32Plugins(invocationPlugins, config, replacementBytecodeProvider); registerBigIntegerPlugins(invocationPlugins, config, replacementBytecodeProvider); registerSHAPlugins(invocationPlugins, config, replacementBytecodeProvider); + registerUnsafePlugins(invocationPlugins, replacementBytecodeProvider); StandardGraphBuilderPlugins.registerInvocationPlugins(metaAccess, snippetReflection, invocationPlugins, replacementBytecodeProvider, true); for (NodeIntrinsicPluginFactory factory : GraalServices.load(NodeIntrinsicPluginFactory.class)) { @@ -313,6 +315,17 @@ r.registerMethodSubstitution(ReflectionSubstitutions.class, "getClassAccessFlags", Class.class); } + private static void registerUnsafePlugins(InvocationPlugins plugins, BytecodeProvider replacementBytecodeProvider) { + Registration r; + if (Java8OrEarlier) { + r = new Registration(plugins, Unsafe.class, replacementBytecodeProvider); + } else { + r = new Registration(plugins, "jdk.internal.misc.Unsafe", replacementBytecodeProvider); + } + r.registerMethodSubstitution(HotSpotUnsafeSubstitutions.class, HotSpotUnsafeSubstitutions.copyMemoryName, "copyMemory", Receiver.class, Object.class, long.class, Object.class, long.class, + long.class); + } + private static final LocationIdentity INSTANCE_KLASS_CONSTANTS = NamedLocationIdentity.immutable("InstanceKlass::_constants"); private static final LocationIdentity CONSTANT_POOL_LENGTH = NamedLocationIdentity.immutable("ConstantPool::_length"); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java Sat Sep 09 14:36:45 2017 +0200 @@ -51,6 +51,7 @@ import static org.graalvm.compiler.hotspot.HotSpotBackend.SHA5_IMPL_COMPRESS; import static org.graalvm.compiler.hotspot.HotSpotBackend.SHA_IMPL_COMPRESS; import static org.graalvm.compiler.hotspot.HotSpotBackend.SQUARE_TO_LEN; +import static org.graalvm.compiler.hotspot.HotSpotBackend.UNSAFE_ARRAYCOPY; import static org.graalvm.compiler.hotspot.HotSpotBackend.UNWIND_EXCEPTION_TO_CALLER; import static org.graalvm.compiler.hotspot.HotSpotBackend.VM_ERROR; import static org.graalvm.compiler.hotspot.HotSpotBackend.WRONG_METHOD_HANDLER; @@ -330,6 +331,8 @@ registerCheckcastArraycopyDescriptor(true, c.checkcastArraycopyUninit); registerCheckcastArraycopyDescriptor(false, c.checkcastArraycopy); + registerForeignCall(UNSAFE_ARRAYCOPY, c.unsafeArraycopy, NativeCall, DESTROYS_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, NamedLocationIdentity.any()); + if (c.useMultiplyToLenIntrinsic()) { registerForeignCall(MULTIPLY_TO_LEN, c.multiplyToLen, NativeCall, DESTROYS_REGISTERS, LEAF_NOFP, NOT_REEXECUTABLE, NamedLocationIdentity.getArrayLocation(JavaKind.Int)); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotUnsafeSubstitutions.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotUnsafeSubstitutions.java Sat Sep 09 14:36:45 2017 +0200 @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2017, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package org.graalvm.compiler.hotspot.meta; + +import static org.graalvm.compiler.serviceprovider.JDK9Method.Java8OrEarlier; + +import org.graalvm.compiler.api.replacements.ClassSubstitution; +import org.graalvm.compiler.api.replacements.MethodSubstitution; +import org.graalvm.compiler.hotspot.HotSpotBackend; +import org.graalvm.compiler.hotspot.nodes.ComputeObjectAddressNode; +import org.graalvm.compiler.word.Word; +import org.graalvm.word.WordFactory; + +@ClassSubstitution(className = {"jdk.internal.misc.Unsafe", "sun.misc.Unsafe"}) +public class HotSpotUnsafeSubstitutions { + + public static final String copyMemoryName = Java8OrEarlier ? "copyMemory" : "copyMemory0"; + + @SuppressWarnings("unused") + @MethodSubstitution(isStatic = false) + static void copyMemory(Object receiver, Object srcBase, long srcOffset, Object destBase, long destOffset, long bytes) { + Word srcAddr = WordFactory.unsigned(ComputeObjectAddressNode.get(srcBase, srcOffset)); + Word dstAddr = WordFactory.unsigned(ComputeObjectAddressNode.get(destBase, destOffset)); + Word size = Word.signed(bytes); + HotSpotBackend.unsafeArraycopy(srcAddr, dstAddr, size); + } +} diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/Stub.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/Stub.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/Stub.java Sat Sep 09 14:36:45 2017 +0200 @@ -216,8 +216,9 @@ @SuppressWarnings("try") private CompilationResult buildCompilationResult(DebugContext debug, final Backend backend) { - CompilationResult compResult = new CompilationResult(toString(), GeneratePIC.getValue(options)); - final StructuredGraph graph = getGraph(debug, getStubCompilationId()); + CompilationIdentifier compilationId = getStubCompilationId(); + final StructuredGraph graph = getGraph(debug, compilationId); + CompilationResult compResult = new CompilationResult(compilationId, toString(), GeneratePIC.getValue(options)); // Stubs cannot be recompiled so they cannot be compiled with assumptions assert graph.getAssumptions() == null; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceInterval.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceInterval.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceInterval.java Sat Sep 09 14:36:45 2017 +0200 @@ -365,10 +365,6 @@ return intTo; } - int numUsePositions() { - return numUsePos(); - } - public void setLocationHint(IntervalHint interval) { locationHint = interval; } @@ -452,6 +448,10 @@ return spillSt == SpillState.StartInMemory || (spillSt == SpillState.SpillStore && opId > spillDefinitionPos() && !canMaterialize()); } + public boolean preSpilledAllocated() { + return spillState() == SpillState.StartInMemory && numUsePos() == 0 && !hasHint(); + } + // test intersection boolean intersects(TraceInterval i) { return intersectsAt(i) != -1; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanLifetimeAnalysisPhase.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanLifetimeAnalysisPhase.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanLifetimeAnalysisPhase.java Sat Sep 09 14:36:45 2017 +0200 @@ -541,16 +541,23 @@ assert instructionIndex == 0 : "not at start?" + instructionIndex; handleTraceBegin(blocks[0]); - // fix spill state for phi/incoming intervals - for (TraceInterval interval : allocator.intervals()) { - if (interval != null && interval.spillState().equals(SpillState.NoDefinitionFound) && interval.spillDefinitionPos() != -1) { - // there was a definition in a phi/incoming - interval.setSpillState(SpillState.NoSpillStore); - } - } if (TraceRAuseInterTraceHints.getValue(allocator.getLIR().getOptions())) { addInterTraceHints(); } + // fix spill state for phi/incoming intervals + for (TraceInterval interval : allocator.intervals()) { + if (interval != null) { + if (interval.spillState().equals(SpillState.NoDefinitionFound) && interval.spillDefinitionPos() != -1) { + // there was a definition in a phi/incoming + interval.setSpillState(SpillState.NoSpillStore); + } + if (interval.preSpilledAllocated()) { + // pre-spill unused, start in memory intervals + allocator.assignSpillSlot(interval); + } + } + } + for (FixedInterval interval1 : allocator.fixedIntervals()) { if (interval1 != null) { /* We use [-1, 0] to avoid intersection with incoming values. */ diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanPhase.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanPhase.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/alloc/trace/lsra/TraceLinearScanPhase.java Sat Sep 09 14:36:45 2017 +0200 @@ -153,7 +153,7 @@ @Override public boolean apply(TraceInterval i) { // all TraceIntervals are variable intervals - return true; + return !i.preSpilledAllocated(); } }; private static final Comparator SORT_BY_FROM_COMP = new Comparator() { diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/lir/GraalCompilerState.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/lir/GraalCompilerState.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.microbenchmarks/src/org/graalvm/compiler/microbenchmarks/lir/GraalCompilerState.java Sat Sep 09 14:36:45 2017 +0200 @@ -319,7 +319,7 @@ assert !graph.isFrozen(); ResolvedJavaMethod installedCodeOwner = graph.method(); request = new Request<>(graph, installedCodeOwner, getProviders(), getBackend(), getDefaultGraphBuilderSuite(), OptimisticOptimizations.ALL, - graph.getProfilingInfo(), createSuites(getOptions()), createLIRSuites(getOptions()), new CompilationResult(), CompilationResultBuilderFactory.Default); + graph.getProfilingInfo(), createSuites(getOptions()), createLIRSuites(getOptions()), new CompilationResult(graph.compilationId()), CompilationResultBuilderFactory.Default); } /** diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java Sat Sep 09 14:36:45 2017 +0200 @@ -209,7 +209,6 @@ int nodeCount = nodeOrder.nextOrderId; assert nodeOrder.orderIds.get(graph.start()) == START_NODE_ORDER_ID; assert nodeOrder.orderIds.get(graph.start().next()) == FIRST_NODE_ORDER_ID; - assert nodeCount == graph.getNodeCount() + 1; long[] nodeStartOffsets = new long[nodeCount]; UnmodifiableMapCursor cursor = nodeOrder.orderIds.getEntries(); @@ -218,6 +217,7 @@ Integer orderId = cursor.getValue(); assert !(node instanceof AbstractBeginNode) || nodeOrder.orderIds.get(((AbstractBeginNode) node).next()) == orderId + BEGIN_NEXT_ORDER_ID_OFFSET; + assert nodeStartOffsets[orderId] == 0; nodeStartOffsets[orderId] = writer.getBytesWritten(); /* Write out the type, properties, and edges. */ @@ -284,7 +284,6 @@ writer.putUV(nodeOrder.maxFixedNodeOrderId); writer.putUV(nodeCount); for (int i = 0; i < nodeCount; i++) { - assert i == NULL_ORDER_ID || i == START_NODE_ORDER_ID || nodeStartOffsets[i] > 0; writer.putUV(metadataStart - nodeStartOffsets[i]); } @@ -344,8 +343,25 @@ } while (current != null); maxFixedNodeOrderId = nextOrderId - 1; + + /* + * Emit all parameters consecutively at a known location (after all fixed nodes). This + * allows substituting parameters when inlining during decoding by pre-initializing the + * decoded node list. + * + * Note that not all parameters must be present (unused parameters are deleted after + * parsing). This leads to holes in the orderId, i.e., unused orderIds. + */ + int parameterCount = graph.method().getSignature().getParameterCount(!graph.method().isStatic()); + for (ParameterNode node : graph.getNodes(ParameterNode.TYPE)) { + assert orderIds.get(node) == null : "Parameter node must not be ordered yet"; + assert node.index() < parameterCount : "Parameter index out of range"; + orderIds.set(node, nextOrderId + node.index()); + } + nextOrderId += parameterCount; + for (Node node : graph.getNodes()) { - assert (node instanceof FixedNode) == (orderIds.get(node) != null) : "all fixed nodes must be ordered: " + node; + assert (node instanceof FixedNode || node instanceof ParameterNode) == (orderIds.get(node) != null) : "all fixed nodes and ParameterNodes must be ordered: " + node; add(node); } } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CFGPrinterObserver.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CFGPrinterObserver.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CFGPrinterObserver.java Sat Sep 09 14:36:45 2017 +0200 @@ -37,6 +37,7 @@ import org.graalvm.compiler.bytecode.BytecodeDisassembler; import org.graalvm.compiler.code.CompilationResult; import org.graalvm.compiler.code.DisassemblerProvider; +import org.graalvm.compiler.core.common.CompilationIdentifier; import org.graalvm.compiler.core.common.alloc.Trace; import org.graalvm.compiler.core.common.alloc.TraceBuilderResult; import org.graalvm.compiler.core.common.cfg.AbstractBlockBase; @@ -72,6 +73,7 @@ private CFGPrinter cfgPrinter; private File cfgFile; private JavaMethod curMethod; + private CompilationIdentifier curCompilation; private List curDecorators = Collections.emptyList(); @Override @@ -92,6 +94,7 @@ */ private boolean checkMethodScope(DebugContext debug) { JavaMethod method = null; + CompilationIdentifier compilation = null; ArrayList decorators = new ArrayList<>(); for (Object o : debug.context()) { if (o instanceof JavaMethod) { @@ -102,22 +105,33 @@ if (graph.method() != null) { method = graph.method(); decorators.clear(); + compilation = graph.compilationId(); } } else if (o instanceof DebugDumpScope) { DebugDumpScope debugDumpScope = (DebugDumpScope) o; if (debugDumpScope.decorator) { decorators.add(debugDumpScope.name); } + } else if (o instanceof CompilationResult) { + CompilationResult compilationResult = (CompilationResult) o; + compilation = compilationResult.getCompilationId(); } } - if (method == null) { + if (method == null && compilation == null) { return false; } - if (!method.equals(curMethod) || !curDecorators.equals(decorators)) { - cfgPrinter.printCompilation(method); + if (compilation != null) { + if (!compilation.equals(curCompilation) || !curDecorators.equals(decorators)) { + cfgPrinter.printCompilation(compilation); + } + } else { + if (!method.equals(curMethod) || !curDecorators.equals(decorators)) { + cfgPrinter.printCompilation(method); + } } + curCompilation = compilation; curMethod = method; curDecorators = decorators; return true; @@ -277,6 +291,7 @@ cfgPrinter = null; curDecorators = Collections.emptyList(); curMethod = null; + curCompilation = null; } } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CompilationPrinter.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CompilationPrinter.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.printer/src/org/graalvm/compiler/printer/CompilationPrinter.java Sat Sep 09 14:36:45 2017 +0200 @@ -31,6 +31,7 @@ import java.util.List; import java.util.Map; +import org.graalvm.compiler.core.common.CompilationIdentifier; import org.graalvm.compiler.debug.LogStream; import org.graalvm.compiler.debug.TTY; import org.graalvm.compiler.lir.util.IndexedValueMap; @@ -115,12 +116,25 @@ /** * Prints a compilation timestamp for a given method. * - * @param method the method for which a timestamp will be printed + * @param javaMethod the method for which a timestamp will be printed */ - public void printCompilation(JavaMethod method) { + public void printCompilation(JavaMethod javaMethod) { + printCompilation(javaMethod.format("%H::%n"), javaMethod.format("%f %r %H.%n(%p)")); + } + + /** + * Prints a compilation id. + * + * @param compilationId the compilation method for which an id will be printed + */ + public void printCompilation(CompilationIdentifier compilationId) { + printCompilation(compilationId.toString(CompilationIdentifier.Verbosity.DETAILED), compilationId.toString(CompilationIdentifier.Verbosity.DETAILED)); + } + + private void printCompilation(final String name, String method) { begin("compilation"); - out.print("name \" ").print(method.format("%H::%n")).println('"'); - out.print("method \"").print(method.format("%f %r %H.%n(%p)")).println('"'); + out.print("name \" ").print(name).println('"'); + out.print("method \"").print(method).println('"'); out.print("date ").println(System.currentTimeMillis()); end("compilation"); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.verifier/src/org/graalvm/compiler/replacements/verifier/ClassSubstitutionVerifier.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.verifier/src/org/graalvm/compiler/replacements/verifier/ClassSubstitutionVerifier.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.verifier/src/org/graalvm/compiler/replacements/verifier/ClassSubstitutionVerifier.java Sat Sep 09 14:36:45 2017 +0200 @@ -95,10 +95,13 @@ TypeElement typeElement = null; for (String className : classNames) { typeElement = env.getElementUtils().getTypeElement(className); - if (typeElement == null && !optional) { - env.getMessager().printMessage(Kind.ERROR, String.format("The class '%s' was not found on the classpath.", stringValue), sourceElement, classSubstition, stringValue); + if (typeElement != null) { + break; } } + if (typeElement == null && !optional) { + env.getMessager().printMessage(Kind.ERROR, String.format("The class '%s' was not found on the classpath.", stringValue), sourceElement, classSubstition, stringValue); + } return typeElement; } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java --- a/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java Sat Sep 09 14:36:45 2017 +0200 @@ -707,10 +707,22 @@ } } + LoopScope inlineLoopScope = createInitialLoopScope(inlineScope, predecessor); + + /* + * The GraphEncoder assigns parameters a nodeId immediately after the fixed nodes. + * Initializing createdNodes here avoid decoding and immediately replacing the + * ParameterNodes. + */ + int firstArgumentNodeId = inlineScope.maxFixedNodeOrderId + 1; + for (int i = 0; i < arguments.length; i++) { + inlineLoopScope.createdNodes[firstArgumentNodeId + i] = arguments[i]; + } + /* * Do the actual inlining by returning the initial loop scope for the inlined method scope. */ - return createInitialLoopScope(inlineScope, predecessor); + return inlineLoopScope; } @Override @@ -1028,9 +1040,7 @@ if (node instanceof ParameterNode) { ParameterNode param = (ParameterNode) node; if (methodScope.isInlinedMethod()) { - Node result = methodScope.arguments[param.index()]; - assert result != null; - return result; + throw GraalError.shouldNotReachHere("Parameter nodes are already registered when the inlined scope is created"); } else if (parameterPlugin != null) { assert !methodScope.isInlinedMethod(); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os/aix/vm/os_aix.cpp --- a/hotspot/src/os/aix/vm/os_aix.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os/aix/vm/os_aix.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -1185,62 +1185,6 @@ // directory not the java application's temp directory, ala java.io.tmpdir. const char* os::get_temp_directory() { return "/tmp"; } -static bool file_exists(const char* filename) { - struct stat statbuf; - if (filename == NULL || strlen(filename) == 0) { - return false; - } - return os::stat(filename, &statbuf) == 0; -} - -bool os::dll_build_name(char* buffer, size_t buflen, - const char* pname, const char* fname) { - bool retval = false; - // Copied from libhpi - const size_t pnamelen = pname ? strlen(pname) : 0; - - // Return error on buffer overflow. - if (pnamelen + strlen(fname) + 10 > (size_t) buflen) { - *buffer = '\0'; - return retval; - } - - if (pnamelen == 0) { - snprintf(buffer, buflen, "lib%s.so", fname); - retval = true; - } else if (strchr(pname, *os::path_separator()) != NULL) { - int n; - char** pelements = split_path(pname, &n); - if (pelements == NULL) { - return false; - } - for (int i = 0; i < n; i++) { - // Really shouldn't be NULL, but check can't hurt - if (pelements[i] == NULL || strlen(pelements[i]) == 0) { - continue; // skip the empty path values - } - snprintf(buffer, buflen, "%s/lib%s.so", pelements[i], fname); - if (file_exists(buffer)) { - retval = true; - break; - } - } - // release the storage - for (int i = 0; i < n; i++) { - if (pelements[i] != NULL) { - FREE_C_HEAP_ARRAY(char, pelements[i]); - } - } - if (pelements != NULL) { - FREE_C_HEAP_ARRAY(char*, pelements); - } - } else { - snprintf(buffer, buflen, "%s/lib%s.so", pname, fname); - retval = true; - } - return retval; -} - // Check if addr is inside libjvm.so. bool os::address_is_in_vm(address addr) { @@ -1493,12 +1437,7 @@ } void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) { - st->print("CPU:"); - st->print("total %d", os::processor_count()); - // It's not safe to query number of active processors after crash. - // st->print("(active %d)", os::active_processor_count()); - st->print(" %s", VM_Version::features()); - st->cr(); + // Nothing to do beyond what os::print_cpu_info() does. } static void print_signal_handler(outputStream* st, int sig, @@ -2668,11 +2607,10 @@ //////////////////////////////////////////////////////////////////////////////// // suspend/resume support -// the low-level signal-based suspend/resume support is a remnant from the +// The low-level signal-based suspend/resume support is a remnant from the // old VM-suspension that used to be for java-suspension, safepoints etc, -// within hotspot. Now there is a single use-case for this: -// - calling get_thread_pc() on the VMThread by the flat-profiler task -// that runs in the watcher thread. +// within hotspot. Currently used by JFR's OSThreadSampler +// // The remaining code is greatly simplified from the more general suspension // code that used to be used. // @@ -2688,7 +2626,13 @@ // // Note that the SR_lock plays no role in this suspend/resume protocol, // but is checked for NULL in SR_handler as a thread termination indicator. +// The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs. // +// Note that resume_clear_context() and suspend_save_context() are needed +// by SR_handler(), so that fetch_frame_from_ucontext() works, +// which in part is used by: +// - Forte Analyzer: AsyncGetCallTrace() +// - StackBanging: get_frame_at_stack_banging_point() static void resume_clear_context(OSThread *osthread) { osthread->set_ucontext(NULL); @@ -3695,44 +3639,6 @@ } } -class PcFetcher : public os::SuspendedThreadTask { -public: - PcFetcher(Thread* thread) : os::SuspendedThreadTask(thread) {} - ExtendedPC result(); -protected: - void do_task(const os::SuspendedThreadTaskContext& context); -private: - ExtendedPC _epc; -}; - -ExtendedPC PcFetcher::result() { - guarantee(is_done(), "task is not done yet."); - return _epc; -} - -void PcFetcher::do_task(const os::SuspendedThreadTaskContext& context) { - Thread* thread = context.thread(); - OSThread* osthread = thread->osthread(); - if (osthread->ucontext() != NULL) { - _epc = os::Aix::ucontext_get_pc((const ucontext_t *) context.ucontext()); - } else { - // NULL context is unexpected, double-check this is the VMThread. - guarantee(thread->is_VM_thread(), "can only be called for VMThread"); - } -} - -// Suspends the target using the signal mechanism and then grabs the PC before -// resuming the target. Used by the flat-profiler only -ExtendedPC os::get_thread_pc(Thread* thread) { - // Make sure that it is called by the watcher for the VMThread. - assert(Thread::current()->is_Watcher_thread(), "Must be watcher"); - assert(thread->is_VM_thread(), "Can only be called for VMThread"); - - PcFetcher fetcher(thread); - fetcher.run(); - return fetcher.result(); -} - //////////////////////////////////////////////////////////////////////////////// // debug support diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os/bsd/vm/os_bsd.cpp --- a/hotspot/src/os/bsd/vm/os_bsd.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -1172,13 +1172,6 @@ // DLL functions -#define JNI_LIB_PREFIX "lib" -#ifdef __APPLE__ - #define JNI_LIB_SUFFIX ".dylib" -#else - #define JNI_LIB_SUFFIX ".so" -#endif - const char* os::dll_file_extension() { return JNI_LIB_SUFFIX; } // This must be hard coded because it's the system's temporary @@ -1201,62 +1194,6 @@ const char* os::get_temp_directory() { return "/tmp"; } #endif // __APPLE__ -static bool file_exists(const char* filename) { - struct stat statbuf; - if (filename == NULL || strlen(filename) == 0) { - return false; - } - return os::stat(filename, &statbuf) == 0; -} - -bool os::dll_build_name(char* buffer, size_t buflen, - const char* pname, const char* fname) { - bool retval = false; - // Copied from libhpi - const size_t pnamelen = pname ? strlen(pname) : 0; - - // Return error on buffer overflow. - if (pnamelen + strlen(fname) + strlen(JNI_LIB_PREFIX) + strlen(JNI_LIB_SUFFIX) + 2 > buflen) { - return retval; - } - - if (pnamelen == 0) { - snprintf(buffer, buflen, JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, fname); - retval = true; - } else if (strchr(pname, *os::path_separator()) != NULL) { - int n; - char** pelements = split_path(pname, &n); - if (pelements == NULL) { - return false; - } - for (int i = 0; i < n; i++) { - // Really shouldn't be NULL, but check can't hurt - if (pelements[i] == NULL || strlen(pelements[i]) == 0) { - continue; // skip the empty path values - } - snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, - pelements[i], fname); - if (file_exists(buffer)) { - retval = true; - break; - } - } - // release the storage - for (int i = 0; i < n; i++) { - if (pelements[i] != NULL) { - FREE_C_HEAP_ARRAY(char, pelements[i]); - } - } - if (pelements != NULL) { - FREE_C_HEAP_ARRAY(char*, pelements); - } - } else { - snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, pname, fname); - retval = true; - } - return retval; -} - // check if addr is inside libjvm.so bool os::address_is_in_vm(address addr) { static address libjvm_base_addr; @@ -2666,11 +2603,10 @@ //////////////////////////////////////////////////////////////////////////////// // suspend/resume support -// the low-level signal-based suspend/resume support is a remnant from the +// The low-level signal-based suspend/resume support is a remnant from the // old VM-suspension that used to be for java-suspension, safepoints etc, -// within hotspot. Now there is a single use-case for this: -// - calling get_thread_pc() on the VMThread by the flat-profiler task -// that runs in the watcher thread. +// within hotspot. Currently used by JFR's OSThreadSampler +// // The remaining code is greatly simplified from the more general suspension // code that used to be used. // @@ -2686,6 +2622,13 @@ // // Note that the SR_lock plays no role in this suspend/resume protocol, // but is checked for NULL in SR_handler as a thread termination indicator. +// The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs. +// +// Note that resume_clear_context() and suspend_save_context() are needed +// by SR_handler(), so that fetch_frame_from_ucontext() works, +// which in part is used by: +// - Forte Analyzer: AsyncGetCallTrace() +// - StackBanging: get_frame_at_stack_banging_point() static void resume_clear_context(OSThread *osthread) { osthread->set_ucontext(NULL); @@ -3584,45 +3527,6 @@ } } -/// -class PcFetcher : public os::SuspendedThreadTask { - public: - PcFetcher(Thread* thread) : os::SuspendedThreadTask(thread) {} - ExtendedPC result(); - protected: - void do_task(const os::SuspendedThreadTaskContext& context); - private: - ExtendedPC _epc; -}; - -ExtendedPC PcFetcher::result() { - guarantee(is_done(), "task is not done yet."); - return _epc; -} - -void PcFetcher::do_task(const os::SuspendedThreadTaskContext& context) { - Thread* thread = context.thread(); - OSThread* osthread = thread->osthread(); - if (osthread->ucontext() != NULL) { - _epc = os::Bsd::ucontext_get_pc((const ucontext_t *) context.ucontext()); - } else { - // NULL context is unexpected, double-check this is the VMThread - guarantee(thread->is_VM_thread(), "can only be called for VMThread"); - } -} - -// Suspends the target using the signal mechanism and then grabs the PC before -// resuming the target. Used by the flat-profiler only -ExtendedPC os::get_thread_pc(Thread* thread) { - // Make sure that it is called by the watcher for the VMThread - assert(Thread::current()->is_Watcher_thread(), "Must be watcher"); - assert(thread->is_VM_thread(), "Can only be called for VMThread"); - - PcFetcher fetcher(thread); - fetcher.run(); - return fetcher.result(); -} - //////////////////////////////////////////////////////////////////////////////// // debug support diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os/linux/vm/os_linux.cpp --- a/hotspot/src/os/linux/vm/os_linux.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os/linux/vm/os_linux.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -1419,53 +1419,6 @@ return os::stat(filename, &statbuf) == 0; } -bool os::dll_build_name(char* buffer, size_t buflen, - const char* pname, const char* fname) { - bool retval = false; - // Copied from libhpi - const size_t pnamelen = pname ? strlen(pname) : 0; - - // Return error on buffer overflow. - if (pnamelen + strlen(fname) + 10 > (size_t) buflen) { - return retval; - } - - if (pnamelen == 0) { - snprintf(buffer, buflen, "lib%s.so", fname); - retval = true; - } else if (strchr(pname, *os::path_separator()) != NULL) { - int n; - char** pelements = split_path(pname, &n); - if (pelements == NULL) { - return false; - } - for (int i = 0; i < n; i++) { - // Really shouldn't be NULL, but check can't hurt - if (pelements[i] == NULL || strlen(pelements[i]) == 0) { - continue; // skip the empty path values - } - snprintf(buffer, buflen, "%s/lib%s.so", pelements[i], fname); - if (file_exists(buffer)) { - retval = true; - break; - } - } - // release the storage - for (int i = 0; i < n; i++) { - if (pelements[i] != NULL) { - FREE_C_HEAP_ARRAY(char, pelements[i]); - } - } - if (pelements != NULL) { - FREE_C_HEAP_ARRAY(char*, pelements); - } - } else { - snprintf(buffer, buflen, "%s/lib%s.so", pname, fname); - retval = true; - } - return retval; -} - // check if addr is inside libjvm.so bool os::address_is_in_vm(address addr) { static address libjvm_base_addr; @@ -4047,11 +4000,10 @@ //////////////////////////////////////////////////////////////////////////////// // suspend/resume support -// the low-level signal-based suspend/resume support is a remnant from the +// The low-level signal-based suspend/resume support is a remnant from the // old VM-suspension that used to be for java-suspension, safepoints etc, -// within hotspot. Now there is a single use-case for this: -// - calling get_thread_pc() on the VMThread by the flat-profiler task -// that runs in the watcher thread. +// within hotspot. Currently used by JFR's OSThreadSampler +// // The remaining code is greatly simplified from the more general suspension // code that used to be used. // @@ -4067,6 +4019,13 @@ // // Note that the SR_lock plays no role in this suspend/resume protocol, // but is checked for NULL in SR_handler as a thread termination indicator. +// The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs. +// +// Note that resume_clear_context() and suspend_save_context() are needed +// by SR_handler(), so that fetch_frame_from_ucontext() works, +// which in part is used by: +// - Forte Analyzer: AsyncGetCallTrace() +// - StackBanging: get_frame_at_stack_banging_point() static void resume_clear_context(OSThread *osthread) { osthread->set_ucontext(NULL); @@ -5107,44 +5066,6 @@ } } -class PcFetcher : public os::SuspendedThreadTask { - public: - PcFetcher(Thread* thread) : os::SuspendedThreadTask(thread) {} - ExtendedPC result(); - protected: - void do_task(const os::SuspendedThreadTaskContext& context); - private: - ExtendedPC _epc; -}; - -ExtendedPC PcFetcher::result() { - guarantee(is_done(), "task is not done yet."); - return _epc; -} - -void PcFetcher::do_task(const os::SuspendedThreadTaskContext& context) { - Thread* thread = context.thread(); - OSThread* osthread = thread->osthread(); - if (osthread->ucontext() != NULL) { - _epc = os::Linux::ucontext_get_pc((const ucontext_t *) context.ucontext()); - } else { - // NULL context is unexpected, double-check this is the VMThread - guarantee(thread->is_VM_thread(), "can only be called for VMThread"); - } -} - -// Suspends the target using the signal mechanism and then grabs the PC before -// resuming the target. Used by the flat-profiler only -ExtendedPC os::get_thread_pc(Thread* thread) { - // Make sure that it is called by the watcher for the VMThread - assert(Thread::current()->is_Watcher_thread(), "Must be watcher"); - assert(thread->is_VM_thread(), "Can only be called for VMThread"); - - PcFetcher fetcher(thread); - fetcher.run(); - return fetcher.result(); -} - //////////////////////////////////////////////////////////////////////////////// // debug support diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os/posix/vm/os_posix.cpp --- a/hotspot/src/os/posix/vm/os_posix.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os/posix/vm/os_posix.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -24,7 +24,6 @@ #include "utilities/globalDefinitions.hpp" #include "prims/jvm.h" -#include "semaphore_posix.hpp" #include "runtime/frame.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/os.hpp" @@ -32,6 +31,11 @@ #include "utilities/macros.hpp" #include "utilities/vmError.hpp" +#ifndef __APPLE__ +// POSIX unamed semaphores are not supported on OS X. +#include "semaphore_posix.hpp" +#endif + #include #include #include diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os/solaris/vm/osThread_solaris.hpp --- a/hotspot/src/os/solaris/vm/osThread_solaris.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os/solaris/vm/osThread_solaris.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -65,12 +65,6 @@ void set_lwp_id(uint id) { _lwp_id = id; } void set_native_priority(int prio) { _native_priority = prio; } - // *************************************************************** - // interrupt support. interrupts (using signals) are used to get - // the thread context (get_thread_pc), to set the thread context - // (set_thread_pc), and to implement java.lang.Thread.interrupt. - // *************************************************************** - public: os::SuspendResume sr; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os/solaris/vm/os_solaris.cpp --- a/hotspot/src/os/solaris/vm/os_solaris.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -1356,60 +1356,6 @@ // directory not the java application's temp directory, ala java.io.tmpdir. const char* os::get_temp_directory() { return "/tmp"; } -static bool file_exists(const char* filename) { - struct stat statbuf; - if (filename == NULL || strlen(filename) == 0) { - return false; - } - return os::stat(filename, &statbuf) == 0; -} - -bool os::dll_build_name(char* buffer, size_t buflen, - const char* pname, const char* fname) { - bool retval = false; - const size_t pnamelen = pname ? strlen(pname) : 0; - - // Return error on buffer overflow. - if (pnamelen + strlen(fname) + 10 > (size_t) buflen) { - return retval; - } - - if (pnamelen == 0) { - snprintf(buffer, buflen, "lib%s.so", fname); - retval = true; - } else if (strchr(pname, *os::path_separator()) != NULL) { - int n; - char** pelements = split_path(pname, &n); - if (pelements == NULL) { - return false; - } - for (int i = 0; i < n; i++) { - // really shouldn't be NULL but what the heck, check can't hurt - if (pelements[i] == NULL || strlen(pelements[i]) == 0) { - continue; // skip the empty path values - } - snprintf(buffer, buflen, "%s/lib%s.so", pelements[i], fname); - if (file_exists(buffer)) { - retval = true; - break; - } - } - // release the storage - for (int i = 0; i < n; i++) { - if (pelements[i] != NULL) { - FREE_C_HEAP_ARRAY(char, pelements[i]); - } - } - if (pelements != NULL) { - FREE_C_HEAP_ARRAY(char*, pelements); - } - } else { - snprintf(buffer, buflen, "%s/lib%s.so", pname, fname); - retval = true; - } - return retval; -} - // check if addr is inside libjvm.so bool os::address_is_in_vm(address addr) { static address libjvm_base_addr; @@ -3496,6 +3442,37 @@ schedctl_start(schedctl_init()); } +//////////////////////////////////////////////////////////////////////////////// +// suspend/resume support + +// The low-level signal-based suspend/resume support is a remnant from the +// old VM-suspension that used to be for java-suspension, safepoints etc, +// within hotspot. Currently used by JFR's OSThreadSampler +// +// The remaining code is greatly simplified from the more general suspension +// code that used to be used. +// +// The protocol is quite simple: +// - suspend: +// - sends a signal to the target thread +// - polls the suspend state of the osthread using a yield loop +// - target thread signal handler (SR_handler) sets suspend state +// and blocks in sigsuspend until continued +// - resume: +// - sets target osthread state to continue +// - sends signal to end the sigsuspend loop in the SR_handler +// +// Note that the SR_lock plays no role in this suspend/resume protocol, +// but is checked for NULL in SR_handler as a thread termination indicator. +// The SR_lock is, however, used by JavaThread::java_suspend()/java_resume() APIs. +// +// Note that resume_clear_context() and suspend_save_context() are needed +// by SR_handler(), so that fetch_frame_from_ucontext() works, +// which in part is used by: +// - Forte Analyzer: AsyncGetCallTrace() +// - StackBanging: get_frame_at_stack_banging_point() +// - JFR: get_topframe()-->....-->get_valid_uc_in_signal_handler() + static void resume_clear_context(OSThread *osthread) { osthread->set_ucontext(NULL); } @@ -3506,7 +3483,7 @@ static PosixSemaphore sr_semaphore; -void os::Solaris::SR_handler(Thread* thread, ucontext_t* uc) { +void os::Solaris::SR_handler(Thread* thread, ucontext_t* context) { // Save and restore errno to avoid confusing native code with EINTR // after sigsuspend. int old_errno = errno; @@ -3516,7 +3493,7 @@ os::SuspendResume::State current = osthread->sr.state(); if (current == os::SuspendResume::SR_SUSPEND_REQUEST) { - suspend_save_context(osthread, uc); + suspend_save_context(osthread, context); // attempt to switch the state, we assume we had a SUSPEND_REQUEST os::SuspendResume::State state = osthread->sr.suspended(); @@ -3663,45 +3640,6 @@ } } -class PcFetcher : public os::SuspendedThreadTask { - public: - PcFetcher(Thread* thread) : os::SuspendedThreadTask(thread) {} - ExtendedPC result(); - protected: - void do_task(const os::SuspendedThreadTaskContext& context); - private: - ExtendedPC _epc; -}; - -ExtendedPC PcFetcher::result() { - guarantee(is_done(), "task is not done yet."); - return _epc; -} - -void PcFetcher::do_task(const os::SuspendedThreadTaskContext& context) { - Thread* thread = context.thread(); - OSThread* osthread = thread->osthread(); - if (osthread->ucontext() != NULL) { - _epc = os::Solaris::ucontext_get_pc((const ucontext_t *) context.ucontext()); - } else { - // NULL context is unexpected, double-check this is the VMThread - guarantee(thread->is_VM_thread(), "can only be called for VMThread"); - } -} - -// A lightweight implementation that does not suspend the target thread and -// thus returns only a hint. Used for profiling only! -ExtendedPC os::get_thread_pc(Thread* thread) { - // Make sure that it is called by the watcher and the Threads lock is owned. - assert(Thread::current()->is_Watcher_thread(), "Must be watcher and own Threads_lock"); - // For now, is only used to profile the VM Thread - assert(thread->is_VM_thread(), "Can only be called for VMThread"); - PcFetcher fetcher(thread); - fetcher.run(); - return fetcher.result(); -} - - // This does not do anything on Solaris. This is basically a hook for being // able to use structured exception handling (thread-local exception filters) on, e.g., Win32. void os::os_exception_wrapper(java_call_t f, JavaValue* value, diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os/windows/vm/decoder_windows.cpp --- a/hotspot/src/os/windows/vm/decoder_windows.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os/windows/vm/decoder_windows.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -27,160 +27,99 @@ #include "runtime/arguments.hpp" #include "runtime/os.hpp" #include "decoder_windows.hpp" +#include "windbghelp.hpp" WindowsDecoder::WindowsDecoder() { - _dbghelp_handle = NULL; - _can_decode_in_vm = false; - _pfnSymGetSymFromAddr64 = NULL; - _pfnUndecorateSymbolName = NULL; -#ifdef AMD64 - _pfnStackWalk64 = NULL; - _pfnSymFunctionTableAccess64 = NULL; - _pfnSymGetModuleBase64 = NULL; -#endif + _can_decode_in_vm = true; _decoder_status = no_error; initialize(); } void WindowsDecoder::initialize() { - if (!has_error() && _dbghelp_handle == NULL) { - HMODULE handle = ::LoadLibrary("dbghelp.dll"); - if (!handle) { - _decoder_status = helper_not_found; - return; - } - - _dbghelp_handle = handle; - - pfn_SymSetOptions _pfnSymSetOptions = (pfn_SymSetOptions)::GetProcAddress(handle, "SymSetOptions"); - pfn_SymInitialize _pfnSymInitialize = (pfn_SymInitialize)::GetProcAddress(handle, "SymInitialize"); - _pfnSymGetSymFromAddr64 = (pfn_SymGetSymFromAddr64)::GetProcAddress(handle, "SymGetSymFromAddr64"); - _pfnUndecorateSymbolName = (pfn_UndecorateSymbolName)::GetProcAddress(handle, "UnDecorateSymbolName"); - - if (_pfnSymSetOptions == NULL || _pfnSymInitialize == NULL || _pfnSymGetSymFromAddr64 == NULL) { - uninitialize(); - _decoder_status = helper_func_error; - return; - } - -#ifdef AMD64 - _pfnStackWalk64 = (pfn_StackWalk64)::GetProcAddress(handle, "StackWalk64"); - _pfnSymFunctionTableAccess64 = (pfn_SymFunctionTableAccess64)::GetProcAddress(handle, "SymFunctionTableAccess64"); - _pfnSymGetModuleBase64 = (pfn_SymGetModuleBase64)::GetProcAddress(handle, "SymGetModuleBase64"); - if (_pfnStackWalk64 == NULL || _pfnSymFunctionTableAccess64 == NULL || _pfnSymGetModuleBase64 == NULL) { - // We can't call StackWalk64 to walk the stack, but we are still - // able to decode the symbols. Let's limp on. - _pfnStackWalk64 = NULL; - _pfnSymFunctionTableAccess64 = NULL; - _pfnSymGetModuleBase64 = NULL; - } -#endif - + if (!has_error()) { HANDLE hProcess = ::GetCurrentProcess(); - _pfnSymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_EXACT_SYMBOLS); - if (!_pfnSymInitialize(hProcess, NULL, TRUE)) { - _pfnSymGetSymFromAddr64 = NULL; - _pfnUndecorateSymbolName = NULL; - ::FreeLibrary(handle); - _dbghelp_handle = NULL; + WindowsDbgHelp::symSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_EXACT_SYMBOLS); + if (!WindowsDbgHelp::symInitialize(hProcess, NULL, TRUE)) { _decoder_status = helper_init_error; return; } // set pdb search paths - pfn_SymSetSearchPath _pfn_SymSetSearchPath = - (pfn_SymSetSearchPath)::GetProcAddress(handle, "SymSetSearchPath"); - pfn_SymGetSearchPath _pfn_SymGetSearchPath = - (pfn_SymGetSearchPath)::GetProcAddress(handle, "SymGetSearchPath"); - if (_pfn_SymSetSearchPath != NULL && _pfn_SymGetSearchPath != NULL) { - char paths[MAX_PATH]; - int len = sizeof(paths); - if (!_pfn_SymGetSearchPath(hProcess, paths, len)) { - paths[0] = '\0'; - } else { - // available spaces in path buffer - len -= (int)strlen(paths); - } + char paths[MAX_PATH]; + int len = sizeof(paths); + if (!WindowsDbgHelp::symGetSearchPath(hProcess, paths, len)) { + paths[0] = '\0'; + } else { + // available spaces in path buffer + len -= (int)strlen(paths); + } - char tmp_path[MAX_PATH]; - DWORD dwSize; - HMODULE hJVM = ::GetModuleHandle("jvm.dll"); - tmp_path[0] = '\0'; - // append the path where jvm.dll is located - if (hJVM != NULL && (dwSize = ::GetModuleFileName(hJVM, tmp_path, sizeof(tmp_path))) > 0) { - while (dwSize > 0 && tmp_path[dwSize] != '\\') { - dwSize --; - } - - tmp_path[dwSize] = '\0'; - - if (dwSize > 0 && len > (int)dwSize + 1) { - strncat(paths, os::path_separator(), 1); - strncat(paths, tmp_path, dwSize); - len -= dwSize + 1; - } + char tmp_path[MAX_PATH]; + DWORD dwSize; + HMODULE hJVM = ::GetModuleHandle("jvm.dll"); + tmp_path[0] = '\0'; + // append the path where jvm.dll is located + if (hJVM != NULL && (dwSize = ::GetModuleFileName(hJVM, tmp_path, sizeof(tmp_path))) > 0) { + while (dwSize > 0 && tmp_path[dwSize] != '\\') { + dwSize --; } - // append $JRE/bin. Arguments::get_java_home actually returns $JRE - // path - char *p = Arguments::get_java_home(); - assert(p != NULL, "empty java home"); - size_t java_home_len = strlen(p); - if (len > (int)java_home_len + 5) { + tmp_path[dwSize] = '\0'; + + if (dwSize > 0 && len > (int)dwSize + 1) { strncat(paths, os::path_separator(), 1); - strncat(paths, p, java_home_len); - strncat(paths, "\\bin", 4); - len -= (int)(java_home_len + 5); + strncat(paths, tmp_path, dwSize); + len -= dwSize + 1; } + } - // append $JDK/bin path if it exists - assert(java_home_len < MAX_PATH, "Invalid path length"); - // assume $JRE is under $JDK, construct $JDK/bin path and - // see if it exists or not - if (strncmp(&p[java_home_len - 3], "jre", 3) == 0) { - strncpy(tmp_path, p, java_home_len - 3); - tmp_path[java_home_len - 3] = '\0'; - strncat(tmp_path, "bin", 3); + // append $JRE/bin. Arguments::get_java_home actually returns $JRE + // path + char *p = Arguments::get_java_home(); + assert(p != NULL, "empty java home"); + size_t java_home_len = strlen(p); + if (len > (int)java_home_len + 5) { + strncat(paths, os::path_separator(), 1); + strncat(paths, p, java_home_len); + strncat(paths, "\\bin", 4); + len -= (int)(java_home_len + 5); + } - // if the directory exists - DWORD dwAttrib = GetFileAttributes(tmp_path); - if (dwAttrib != INVALID_FILE_ATTRIBUTES && - (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) { - // tmp_path should have the same length as java_home_len, since we only - // replaced 'jre' with 'bin' - if (len > (int)java_home_len + 1) { - strncat(paths, os::path_separator(), 1); - strncat(paths, tmp_path, java_home_len); - } + // append $JDK/bin path if it exists + assert(java_home_len < MAX_PATH, "Invalid path length"); + // assume $JRE is under $JDK, construct $JDK/bin path and + // see if it exists or not + if (strncmp(&p[java_home_len - 3], "jre", 3) == 0) { + strncpy(tmp_path, p, java_home_len - 3); + tmp_path[java_home_len - 3] = '\0'; + strncat(tmp_path, "bin", 3); + + // if the directory exists + DWORD dwAttrib = GetFileAttributes(tmp_path); + if (dwAttrib != INVALID_FILE_ATTRIBUTES && + (dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) { + // tmp_path should have the same length as java_home_len, since we only + // replaced 'jre' with 'bin' + if (len > (int)java_home_len + 1) { + strncat(paths, os::path_separator(), 1); + strncat(paths, tmp_path, java_home_len); } } - - _pfn_SymSetSearchPath(hProcess, paths); } - // find out if jvm.dll contains private symbols, by decoding - // current function and comparing the result - address addr = (address)Decoder::demangle; - char buf[MAX_PATH]; - if (decode(addr, buf, sizeof(buf), NULL, NULL, true /* demangle */)) { - _can_decode_in_vm = !strcmp(buf, "Decoder::demangle"); - } + WindowsDbgHelp::symSetSearchPath(hProcess, paths); + + // find out if jvm.dll contains private symbols, by decoding + // current function and comparing the result + address addr = (address)Decoder::demangle; + char buf[MAX_PATH]; + if (decode(addr, buf, sizeof(buf), NULL, NULL, true /* demangle */)) { + _can_decode_in_vm = !strcmp(buf, "Decoder::demangle"); + } } } -void WindowsDecoder::uninitialize() { - _pfnSymGetSymFromAddr64 = NULL; - _pfnUndecorateSymbolName = NULL; -#ifdef AMD64 - _pfnStackWalk64 = NULL; - _pfnSymFunctionTableAccess64 = NULL; - _pfnSymGetModuleBase64 = NULL; -#endif - if (_dbghelp_handle != NULL) { - ::FreeLibrary(_dbghelp_handle); - } - _dbghelp_handle = NULL; -} +void WindowsDecoder::uninitialize() {} bool WindowsDecoder::can_decode_C_frame_in_vm() const { return (!has_error() && _can_decode_in_vm); @@ -188,14 +127,14 @@ bool WindowsDecoder::decode(address addr, char *buf, int buflen, int* offset, const char* modulepath, bool demangle_name) { - if (_pfnSymGetSymFromAddr64 != NULL) { + if (!has_error()) { PIMAGEHLP_SYMBOL64 pSymbol; char symbolInfo[MAX_PATH + sizeof(IMAGEHLP_SYMBOL64)]; pSymbol = (PIMAGEHLP_SYMBOL64)symbolInfo; pSymbol->MaxNameLength = MAX_PATH; pSymbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64); DWORD64 displacement; - if (_pfnSymGetSymFromAddr64(::GetCurrentProcess(), (DWORD64)addr, &displacement, pSymbol)) { + if (WindowsDbgHelp::symGetSymFromAddr64(::GetCurrentProcess(), (DWORD64)addr, &displacement, pSymbol)) { if (buf != NULL) { if (!(demangle_name && demangle(pSymbol->Name, buf, buflen))) { jio_snprintf(buf, buflen, "%s", pSymbol->Name); @@ -211,69 +150,9 @@ } bool WindowsDecoder::demangle(const char* symbol, char *buf, int buflen) { - return _pfnUndecorateSymbolName != NULL && - _pfnUndecorateSymbolName(symbol, buf, buflen, UNDNAME_COMPLETE); -} - -#ifdef AMD64 -BOOL WindowsDbgHelp::StackWalk64(DWORD MachineType, - HANDLE hProcess, - HANDLE hThread, - LPSTACKFRAME64 StackFrame, - PVOID ContextRecord, - PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine, - PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine, - PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine, - PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress) { - DecoderLocker locker; - WindowsDecoder* wd = (WindowsDecoder*)locker.decoder(); - - if (!wd->has_error() && wd->_pfnStackWalk64) { - return wd->_pfnStackWalk64(MachineType, - hProcess, - hThread, - StackFrame, - ContextRecord, - ReadMemoryRoutine, - FunctionTableAccessRoutine, - GetModuleBaseRoutine, - TranslateAddress); - } else { - return false; + if (!has_error()) { + return WindowsDbgHelp::unDecorateSymbolName(symbol, buf, buflen, UNDNAME_COMPLETE) > 0; } + return false; } -PVOID WindowsDbgHelp::SymFunctionTableAccess64(HANDLE hProcess, DWORD64 AddrBase) { - DecoderLocker locker; - WindowsDecoder* wd = (WindowsDecoder*)locker.decoder(); - - if (!wd->has_error() && wd->_pfnSymFunctionTableAccess64) { - return wd->_pfnSymFunctionTableAccess64(hProcess, AddrBase); - } else { - return NULL; - } -} - -pfn_SymFunctionTableAccess64 WindowsDbgHelp::pfnSymFunctionTableAccess64() { - DecoderLocker locker; - WindowsDecoder* wd = (WindowsDecoder*)locker.decoder(); - - if (!wd->has_error()) { - return wd->_pfnSymFunctionTableAccess64; - } else { - return NULL; - } -} - -pfn_SymGetModuleBase64 WindowsDbgHelp::pfnSymGetModuleBase64() { - DecoderLocker locker; - WindowsDecoder* wd = (WindowsDecoder*)locker.decoder(); - - if (!wd->has_error()) { - return wd->_pfnSymGetModuleBase64; - } else { - return NULL; - } -} - -#endif // AMD64 diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os/windows/vm/decoder_windows.hpp --- a/hotspot/src/os/windows/vm/decoder_windows.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os/windows/vm/decoder_windows.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -25,33 +25,8 @@ #ifndef OS_WINDOWS_VM_DECODER_WINDOWS_HPP #define OS_WINDOWS_VM_DECIDER_WINDOWS_HPP -#include -#include - #include "utilities/decoder.hpp" -// functions needed for decoding symbols -typedef DWORD (WINAPI *pfn_SymSetOptions)(DWORD); -typedef BOOL (WINAPI *pfn_SymInitialize)(HANDLE, PCTSTR, BOOL); -typedef BOOL (WINAPI *pfn_SymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64); -typedef DWORD (WINAPI *pfn_UndecorateSymbolName)(const char*, char*, DWORD, DWORD); -typedef BOOL (WINAPI *pfn_SymSetSearchPath)(HANDLE, PCTSTR); -typedef BOOL (WINAPI *pfn_SymGetSearchPath)(HANDLE, PTSTR, int); - -#ifdef AMD64 -typedef BOOL (WINAPI *pfn_StackWalk64)(DWORD MachineType, - HANDLE hProcess, - HANDLE hThread, - LPSTACKFRAME64 StackFrame, - PVOID ContextRecord, - PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine, - PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine, - PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine, - PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress); -typedef PVOID (WINAPI *pfn_SymFunctionTableAccess64)(HANDLE hProcess, DWORD64 AddrBase); -typedef DWORD64 (WINAPI *pfn_SymGetModuleBase64)(HANDLE hProcess, DWORD64 dwAddr); -#endif - class WindowsDecoder : public AbstractDecoder { public: @@ -70,38 +45,8 @@ void initialize(); void uninitialize(); -private: - HMODULE _dbghelp_handle; bool _can_decode_in_vm; - pfn_SymGetSymFromAddr64 _pfnSymGetSymFromAddr64; - pfn_UndecorateSymbolName _pfnUndecorateSymbolName; -#ifdef AMD64 - pfn_StackWalk64 _pfnStackWalk64; - pfn_SymFunctionTableAccess64 _pfnSymFunctionTableAccess64; - pfn_SymGetModuleBase64 _pfnSymGetModuleBase64; - friend class WindowsDbgHelp; -#endif }; -#ifdef AMD64 -// TODO: refactor and move the handling of dbghelp.dll outside of Decoder -class WindowsDbgHelp : public Decoder { -public: - static BOOL StackWalk64(DWORD MachineType, - HANDLE hProcess, - HANDLE hThread, - LPSTACKFRAME64 StackFrame, - PVOID ContextRecord, - PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine, - PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine, - PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine, - PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress); - static PVOID SymFunctionTableAccess64(HANDLE hProcess, DWORD64 AddrBase); - - static pfn_SymFunctionTableAccess64 pfnSymFunctionTableAccess64(); - static pfn_SymGetModuleBase64 pfnSymGetModuleBase64(); -}; -#endif - #endif // OS_WINDOWS_VM_DECODER_WINDOWS_HPP diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os/windows/vm/os_windows.cpp --- a/hotspot/src/os/windows/vm/os_windows.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os/windows/vm/os_windows.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -74,6 +74,8 @@ #include "utilities/growableArray.hpp" #include "utilities/macros.hpp" #include "utilities/vmError.hpp" +#include "windbghelp.hpp" + #ifdef _DEBUG #include @@ -1009,7 +1011,6 @@ } void os::abort(bool dump_core, void* siginfo, const void* context) { - HINSTANCE dbghelp; EXCEPTION_POINTERS ep; MINIDUMP_EXCEPTION_INFORMATION mei; MINIDUMP_EXCEPTION_INFORMATION* pmei; @@ -1026,28 +1027,6 @@ win32::exit_process_or_thread(win32::EPT_PROCESS, 1); } - dbghelp = os::win32::load_Windows_dll("DBGHELP.DLL", NULL, 0); - - if (dbghelp == NULL) { - jio_fprintf(stderr, "Failed to load dbghelp.dll\n"); - CloseHandle(dumpFile); - win32::exit_process_or_thread(win32::EPT_PROCESS, 1); - } - - _MiniDumpWriteDump = - CAST_TO_FN_PTR(BOOL(WINAPI *)(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, - PMINIDUMP_EXCEPTION_INFORMATION, - PMINIDUMP_USER_STREAM_INFORMATION, - PMINIDUMP_CALLBACK_INFORMATION), - GetProcAddress(dbghelp, - "MiniDumpWriteDump")); - - if (_MiniDumpWriteDump == NULL) { - jio_fprintf(stderr, "Failed to find MiniDumpWriteDump() in module dbghelp.dll.\n"); - CloseHandle(dumpFile); - win32::exit_process_or_thread(win32::EPT_PROCESS, 1); - } - dumpType = (MINIDUMP_TYPE)(MiniDumpWithFullMemory | MiniDumpWithHandleData | MiniDumpWithFullMemoryInfo | MiniDumpWithThreadInfo | MiniDumpWithUnloadedModules); @@ -1064,8 +1043,8 @@ // Older versions of dbghelp.dll (the one shipped with Win2003 for example) may not support all // the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then. - if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, NULL, NULL) == false && - _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, NULL, NULL) == false) { + if (!WindowsDbgHelp::miniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, NULL, NULL) && + !WindowsDbgHelp::miniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, NULL, NULL)) { jio_fprintf(stderr, "Call to MiniDumpWriteDump() failed (Error 0x%x)\n", GetLastError()); } CloseHandle(dumpFile); @@ -1198,70 +1177,6 @@ } } -static bool file_exists(const char* filename) { - if (filename == NULL || strlen(filename) == 0) { - return false; - } - return GetFileAttributes(filename) != INVALID_FILE_ATTRIBUTES; -} - -bool os::dll_build_name(char *buffer, size_t buflen, - const char* pname, const char* fname) { - bool retval = false; - const size_t pnamelen = pname ? strlen(pname) : 0; - const char c = (pnamelen > 0) ? pname[pnamelen-1] : 0; - - // Return error on buffer overflow. - if (pnamelen + strlen(fname) + 10 > buflen) { - return retval; - } - - if (pnamelen == 0) { - jio_snprintf(buffer, buflen, "%s.dll", fname); - retval = true; - } else if (c == ':' || c == '\\') { - jio_snprintf(buffer, buflen, "%s%s.dll", pname, fname); - retval = true; - } else if (strchr(pname, *os::path_separator()) != NULL) { - int n; - char** pelements = split_path(pname, &n); - if (pelements == NULL) { - return false; - } - for (int i = 0; i < n; i++) { - char* path = pelements[i]; - // Really shouldn't be NULL, but check can't hurt - size_t plen = (path == NULL) ? 0 : strlen(path); - if (plen == 0) { - continue; // skip the empty path values - } - const char lastchar = path[plen - 1]; - if (lastchar == ':' || lastchar == '\\') { - jio_snprintf(buffer, buflen, "%s%s.dll", path, fname); - } else { - jio_snprintf(buffer, buflen, "%s\\%s.dll", path, fname); - } - if (file_exists(buffer)) { - retval = true; - break; - } - } - // release the storage - for (int i = 0; i < n; i++) { - if (pelements[i] != NULL) { - FREE_C_HEAP_ARRAY(char, pelements[i]); - } - } - if (pelements != NULL) { - FREE_C_HEAP_ARRAY(char*, pelements); - } - } else { - jio_snprintf(buffer, buflen, "%s\\%s.dll", pname, fname); - retval = true; - } - return retval; -} - // Needs to be in os specific directory because windows requires another // header file const char* os::get_current_directory(char *buf, size_t buflen) { @@ -3591,22 +3506,6 @@ return interrupted; } -// Get's a pc (hint) for a running thread. Currently used only for profiling. -ExtendedPC os::get_thread_pc(Thread* thread) { - CONTEXT context; - context.ContextFlags = CONTEXT_CONTROL; - HANDLE handle = thread->osthread()->thread_handle(); - if (GetThreadContext(handle, &context)) { -#ifdef _M_AMD64 - return ExtendedPC((address) context.Rip); -#else - return ExtendedPC((address) context.Eip); -#endif - } else { - return ExtendedPC(NULL); - } -} - // GetCurrentThreadId() returns DWORD intx os::current_thread_id() { return GetCurrentThreadId(); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os/windows/vm/windbghelp.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/os/windows/vm/windbghelp.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -0,0 +1,306 @@ +/* + * Copyright (c) 2017, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "utilities/ostream.hpp" +#include "windbghelp.hpp" + +#include + +typedef DWORD (WINAPI *pfn_SymSetOptions)(DWORD); +typedef DWORD (WINAPI *pfn_SymGetOptions)(void); +typedef BOOL (WINAPI *pfn_SymInitialize)(HANDLE, PCTSTR, BOOL); +typedef BOOL (WINAPI *pfn_SymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64); +typedef DWORD (WINAPI *pfn_UnDecorateSymbolName)(const char*, char*, DWORD, DWORD); +typedef BOOL (WINAPI *pfn_SymSetSearchPath)(HANDLE, PCTSTR); +typedef BOOL (WINAPI *pfn_SymGetSearchPath)(HANDLE, PTSTR, int); +typedef BOOL (WINAPI *pfn_StackWalk64)(DWORD MachineType, + HANDLE hProcess, + HANDLE hThread, + LPSTACKFRAME64 StackFrame, + PVOID ContextRecord, + PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine, + PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine, + PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine, + PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress); +typedef PVOID (WINAPI *pfn_SymFunctionTableAccess64)(HANDLE hProcess, DWORD64 AddrBase); +typedef DWORD64 (WINAPI *pfn_SymGetModuleBase64)(HANDLE hProcess, DWORD64 dwAddr); +typedef BOOL (WINAPI *pfn_MiniDumpWriteDump) (HANDLE hProcess, DWORD ProcessId, HANDLE hFile, + MINIDUMP_TYPE DumpType, PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, + PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, + PMINIDUMP_CALLBACK_INFORMATION CallbackParam); +typedef BOOL (WINAPI *pfn_SymGetLineFromAddr64) (HANDLE hProcess, DWORD64 dwAddr, + PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line); +typedef LPAPI_VERSION (WINAPI *pfn_ImagehlpApiVersion)(void); + +// Add functions as needed. +#define FOR_ALL_FUNCTIONS(DO) \ + DO(ImagehlpApiVersion) \ + DO(SymGetOptions) \ + DO(SymSetOptions) \ + DO(SymInitialize) \ + DO(SymGetSymFromAddr64) \ + DO(UnDecorateSymbolName) \ + DO(SymSetSearchPath) \ + DO(SymGetSearchPath) \ + DO(StackWalk64) \ + DO(SymFunctionTableAccess64) \ + DO(SymGetModuleBase64) \ + DO(MiniDumpWriteDump) \ + DO(SymGetLineFromAddr64) + + +#define DECLARE_FUNCTION_POINTER(functionname) \ +static pfn_##functionname g_pfn_##functionname; + +FOR_ALL_FUNCTIONS(DECLARE_FUNCTION_POINTER) + + +static HMODULE g_dll_handle = NULL; +static DWORD g_dll_load_error = 0; +static API_VERSION g_version = { 0, 0, 0, 0 }; + +static enum { + state_uninitialized = 0, + state_ready = 1, + state_error = 2 +} g_state = state_uninitialized; + +static void initialize() { + + assert(g_state == state_uninitialized, "wrong sequence"); + g_state = state_error; + + g_dll_handle = ::LoadLibrary("DBGHELP.DLL"); + if (g_dll_handle == NULL) { + g_dll_load_error = ::GetLastError(); + } else { + // Note: We loaded the DLL successfully. From here on we count + // initialization as success. We still may fail to load all of the + // desired function pointers successfully, but DLL may still be usable + // enough for our purposes. + g_state = state_ready; + +#define DO_RESOLVE(functionname) \ + g_pfn_##functionname = (pfn_##functionname) ::GetProcAddress(g_dll_handle, #functionname); + + FOR_ALL_FUNCTIONS(DO_RESOLVE) + + // Retrieve version information. + if (g_pfn_ImagehlpApiVersion) { + const API_VERSION* p = g_pfn_ImagehlpApiVersion(); + memcpy(&g_version, p, sizeof(API_VERSION)); + } + } + +} + +///////////////////// External functions ////////////////////////// + +// All outside facing functions are synchronized. Also, we run +// initialization on first touch. + + +// Call InitializeCriticalSection as early as possible. +class CritSect { + CRITICAL_SECTION cs; +public: + CritSect() { ::InitializeCriticalSection(&cs); } + void enter() { ::EnterCriticalSection(&cs); } + void leave() { ::LeaveCriticalSection(&cs); } +}; + +static CritSect g_cs; + +class EntryGuard { +public: + EntryGuard() { + g_cs.enter(); + if (g_state == state_uninitialized) { + initialize(); + } + } + ~EntryGuard() { + g_cs.leave(); + } +}; + +DWORD WindowsDbgHelp::symSetOptions(DWORD arg) { + EntryGuard entry_guard; + if (g_pfn_SymSetOptions != NULL) { + return g_pfn_SymSetOptions(arg); + } + return 0; +} + +DWORD WindowsDbgHelp::symGetOptions(void) { + EntryGuard entry_guard; + if (g_pfn_SymGetOptions != NULL) { + return g_pfn_SymGetOptions(); + } + return 0; +} + +BOOL WindowsDbgHelp::symInitialize(HANDLE hProcess, PCTSTR UserSearchPath, BOOL fInvadeProcess) { + EntryGuard entry_guard; + if (g_pfn_SymInitialize != NULL) { + return g_pfn_SymInitialize(hProcess, UserSearchPath, fInvadeProcess); + } + return FALSE; +} + +BOOL WindowsDbgHelp::symGetSymFromAddr64(HANDLE hProcess, DWORD64 the_address, + PDWORD64 Displacement, PIMAGEHLP_SYMBOL64 Symbol) { + EntryGuard entry_guard; + if (g_pfn_SymGetSymFromAddr64 != NULL) { + return g_pfn_SymGetSymFromAddr64(hProcess, the_address, Displacement, Symbol); + } + return FALSE; +} + +DWORD WindowsDbgHelp::unDecorateSymbolName(const char* DecoratedName, char* UnDecoratedName, + DWORD UndecoratedLength, DWORD Flags) { + EntryGuard entry_guard; + if (g_pfn_UnDecorateSymbolName != NULL) { + return g_pfn_UnDecorateSymbolName(DecoratedName, UnDecoratedName, UndecoratedLength, Flags); + } + if (UnDecoratedName != NULL && UndecoratedLength > 0) { + UnDecoratedName[0] = '\0'; + } + return 0; +} + +BOOL WindowsDbgHelp::symSetSearchPath(HANDLE hProcess, PCTSTR SearchPath) { + EntryGuard entry_guard; + if (g_pfn_SymSetSearchPath != NULL) { + return g_pfn_SymSetSearchPath(hProcess, SearchPath); + } + return FALSE; +} + +BOOL WindowsDbgHelp::symGetSearchPath(HANDLE hProcess, PTSTR SearchPath, int SearchPathLength) { + EntryGuard entry_guard; + if (g_pfn_SymGetSearchPath != NULL) { + return g_pfn_SymGetSearchPath(hProcess, SearchPath, SearchPathLength); + } + return FALSE; +} + +BOOL WindowsDbgHelp::stackWalk64(DWORD MachineType, + HANDLE hProcess, + HANDLE hThread, + LPSTACKFRAME64 StackFrame, + PVOID ContextRecord) { + EntryGuard entry_guard; + if (g_pfn_StackWalk64 != NULL) { + return g_pfn_StackWalk64(MachineType, hProcess, hThread, StackFrame, + ContextRecord, + NULL, // ReadMemoryRoutine + g_pfn_SymFunctionTableAccess64, // FunctionTableAccessRoutine, + g_pfn_SymGetModuleBase64, // GetModuleBaseRoutine + NULL // TranslateAddressRoutine + ); + } + return FALSE; +} + +PVOID WindowsDbgHelp::symFunctionTableAccess64(HANDLE hProcess, DWORD64 AddrBase) { + EntryGuard entry_guard; + if (g_pfn_SymFunctionTableAccess64 != NULL) { + return g_pfn_SymFunctionTableAccess64(hProcess, AddrBase); + } + return NULL; +} + +DWORD64 WindowsDbgHelp::symGetModuleBase64(HANDLE hProcess, DWORD64 dwAddr) { + EntryGuard entry_guard; + if (g_pfn_SymGetModuleBase64 != NULL) { + return g_pfn_SymGetModuleBase64(hProcess, dwAddr); + } + return 0; +} + +BOOL WindowsDbgHelp::miniDumpWriteDump(HANDLE hProcess, DWORD ProcessId, HANDLE hFile, + MINIDUMP_TYPE DumpType, PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, + PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, + PMINIDUMP_CALLBACK_INFORMATION CallbackParam) { + EntryGuard entry_guard; + if (g_pfn_MiniDumpWriteDump != NULL) { + return g_pfn_MiniDumpWriteDump(hProcess, ProcessId, hFile, DumpType, + ExceptionParam, UserStreamParam, CallbackParam); + } + return FALSE; +} + +BOOL WindowsDbgHelp::symGetLineFromAddr64(HANDLE hProcess, DWORD64 dwAddr, + PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line) { + EntryGuard entry_guard; + if (g_pfn_SymGetLineFromAddr64 != NULL) { + return g_pfn_SymGetLineFromAddr64(hProcess, dwAddr, pdwDisplacement, Line); + } + return FALSE; +} + +// Print one liner describing state (if library loaded, which functions are +// missing - if any, and the dbhelp API version) +void WindowsDbgHelp::print_state_on(outputStream* st) { + // Note: We should not lock while printing, but this should be + // safe to do without lock anyway. + st->print("dbghelp: "); + + if (g_state == state_uninitialized) { + st->print("uninitialized."); + } else if (g_state == state_error) { + st->print("loading error: %u", g_dll_load_error); + } else { + st->print("loaded successfully "); + + // We may want to print dll file name here - which may be interesting for + // cases where more than one version exists on the system, e.g. with a + // debugging sdk separately installed. But we get the file name in the DLL + // section of the hs-err file too, so this may be redundant. + + // Print version. + st->print("- version: %u.%u.%u", + g_version.MajorVersion, g_version.MinorVersion, g_version.Revision); + + // Print any functions which failed to load. + int num_missing = 0; + st->print(" - missing functions: "); + + #define CHECK_AND_PRINT_IF_NULL(functionname) \ + if (g_pfn_##functionname == NULL) { \ + st->print("%s" #functionname, ((num_missing > 0) ? ", " : "")); \ + num_missing ++; \ + } + + FOR_ALL_FUNCTIONS(CHECK_AND_PRINT_IF_NULL) + + if (num_missing == 0) { + st->print("none"); + } + } + st->cr(); +} + diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os/windows/vm/windbghelp.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/src/os/windows/vm/windbghelp.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2017, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef OS_WINDOWS_VM_DBGHELPLOADER_HPP +#define OS_WINDOWS_VM_DBGHELPLOADER_HPP + +#include +#include + +// This is a very plain wrapper for loading dbghelp.dll. It does not offer +// any additional functionality. It takes care of locking. + +class outputStream; + +// Please note: dbghelp.dll may not have been loaded, or it may have been loaded but not +// all functions may be available (because on the target system dbghelp.dll is of an +// older version). +// In all these cases we return an error from the WindowsDbgHelp::symXXXX() wrapper. We never +// assert. It should always be safe to call these functions, but caller has to process the +// return code (which he would have to do anyway). +namespace WindowsDbgHelp { + + DWORD symSetOptions(DWORD); + DWORD symGetOptions(void); + BOOL symInitialize(HANDLE, PCTSTR, BOOL); + BOOL symGetSymFromAddr64(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64); + DWORD unDecorateSymbolName(const char*, char*, DWORD, DWORD); + BOOL symSetSearchPath(HANDLE, PCTSTR); + BOOL symGetSearchPath(HANDLE, PTSTR, int); + BOOL stackWalk64(DWORD MachineType, + HANDLE hProcess, + HANDLE hThread, + LPSTACKFRAME64 StackFrame, + PVOID ContextRecord); + PVOID symFunctionTableAccess64(HANDLE hProcess, DWORD64 AddrBase); + DWORD64 symGetModuleBase64(HANDLE hProcess, DWORD64 dwAddr); + BOOL miniDumpWriteDump(HANDLE hProcess, DWORD ProcessId, HANDLE hFile, + MINIDUMP_TYPE DumpType, PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, + PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, + PMINIDUMP_CALLBACK_INFORMATION CallbackParam); + BOOL symGetLineFromAddr64 (HANDLE hProcess, DWORD64 dwAddr, + PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line); + + // Print one liner describing state (if library loaded, which functions are + // missing - if any, and the dbhelp API version) + void print_state_on(outputStream* st); + +}; + + +#endif // OS_WINDOWS_VM_DBGHELPLOADER_HPP + diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.hpp --- a/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os_cpu/aix_ppc/vm/atomic_aix_ppc.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -106,8 +106,8 @@ template<> template inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { - STATIC_CAST(4 == sizeof(I)); - STATIC_CAST(4 == sizeof(D)); + STATIC_ASSERT(4 == sizeof(I)); + STATIC_ASSERT(4 == sizeof(D)); D result; @@ -129,8 +129,8 @@ template<> template inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { - STATIC_CAST(8 == sizeof(I)); - STATIC_CAST(8 == sizeof(D)); + STATIC_ASSERT(8 == sizeof(I)); + STATIC_ASSERT(8 == sizeof(D)); D result; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os_cpu/aix_ppc/vm/thread_aix_ppc.hpp --- a/hotspot/src/os_cpu/aix_ppc/vm/thread_aix_ppc.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os_cpu/aix_ppc/vm/thread_aix_ppc.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2013 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -29,7 +29,6 @@ private: void pd_initialize() { _anchor.clear(); - _last_interpreter_fp = NULL; } // The `last' frame is the youngest Java frame on the thread's stack. @@ -60,20 +59,4 @@ bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, bool isInJava); - // -Xprof support - // - // In order to find the last Java fp from an async profile - // tick, we store the current interpreter fp in the thread. - // This value is only valid while we are in the C++ interpreter - // and profiling. - protected: - intptr_t *_last_interpreter_fp; - - public: - static ByteSize last_interpreter_fp_offset() { - return byte_offset_of(JavaThread, _last_interpreter_fp); - } - - intptr_t* last_interpreter_fp() { return _last_interpreter_fp; } - #endif // OS_CPU_AIX_PPC_VM_THREAD_AIX_PPC_HPP diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.hpp --- a/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os_cpu/bsd_zero/vm/atomic_bsd_zero.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -184,8 +184,8 @@ template<> template inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { - STATIC_CAST(4 == sizeof(I)); - STATIC_CAST(4 == sizeof(D)); + STATIC_ASSERT(4 == sizeof(I)); + STATIC_ASSERT(4 == sizeof(D)); #ifdef ARM return add_using_helper(arm_add_and_fetch, add_value, dest); @@ -201,8 +201,8 @@ template<> template inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { - STATIC_CAST(8 == sizeof(I)); - STATIC_CAST(8 == sizeof(D)); + STATIC_ASSERT(8 == sizeof(I)); + STATIC_ASSERT(8 == sizeof(D)); return __sync_add_and_fetch(dest, add_value); } @@ -283,7 +283,7 @@ T volatile* dest, T compare_value, cmpxchg_memory_order order) const { - STATIC_CAST(4 == sizeof(T)); + STATIC_ASSERT(4 == sizeof(T)); #ifdef ARM return cmpxchg_using_helper(arm_compare_and_swap, exchange_value, dest, compare_value); #else @@ -301,7 +301,7 @@ T volatile* dest, T compare_value, cmpxchg_memory_order order) const { - STATIC_CAST(8 == sizeof(T)); + STATIC_ASSERT(8 == sizeof(T)); return __sync_val_compare_and_swap(dest, compare_value, exchange_value); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.hpp --- a/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os_cpu/linux_ppc/vm/atomic_linux_ppc.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -104,8 +104,8 @@ template<> template inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { - STATIC_CAST(4 == sizeof(I)); - STATIC_CAST(4 == sizeof(D)); + STATIC_ASSERT(4 == sizeof(I)); + STATIC_ASSERT(4 == sizeof(D)); D result; @@ -127,8 +127,8 @@ template<> template inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { - STATIC_CAST(8 == sizeof(I)); - STATIC_CAST(8 == sizeof(D)); + STATIC_ASSERT(8 == sizeof(I)); + STATIC_ASSERT(8 == sizeof(D)); D result; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os_cpu/linux_ppc/vm/thread_linux_ppc.hpp --- a/hotspot/src/os_cpu/linux_ppc/vm/thread_linux_ppc.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os_cpu/linux_ppc/vm/thread_linux_ppc.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2013 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -30,7 +30,6 @@ void pd_initialize() { _anchor.clear(); - _last_interpreter_fp = NULL; } // The `last' frame is the youngest Java frame on the thread's stack. @@ -62,22 +61,4 @@ bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, bool isInJava); - protected: - - // -Xprof support - // - // In order to find the last Java fp from an async profile - // tick, we store the current interpreter fp in the thread. - // This value is only valid while we are in the C++ interpreter - // and profiling. - intptr_t *_last_interpreter_fp; - - public: - - static ByteSize last_interpreter_fp_offset() { - return byte_offset_of(JavaThread, _last_interpreter_fp); - } - - intptr_t* last_interpreter_fp() { return _last_interpreter_fp; } - #endif // OS_CPU_LINUX_PPC_VM_THREAD_LINUX_PPC_HPP diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os_cpu/linux_s390/vm/atomic_linux_s390.hpp --- a/hotspot/src/os_cpu/linux_s390/vm/atomic_linux_s390.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os_cpu/linux_s390/vm/atomic_linux_s390.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -92,9 +92,9 @@ template<> template -inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { - STATIC_CAST(4 == sizeof(I)); - STATIC_CAST(4 == sizeof(D)); +inline D Atomic::PlatformAdd<4>::add_and_fetch(I inc, D volatile* dest) const { + STATIC_ASSERT(4 == sizeof(I)); + STATIC_ASSERT(4 == sizeof(D)); D old, upd; @@ -143,9 +143,9 @@ template<> template -inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { - STATIC_CAST(8 == sizeof(I)); - STATIC_CAST(8 == sizeof(D)); +inline D Atomic::PlatformAdd<8>::add_and_fetch(I inc, D volatile* dest) const { + STATIC_ASSERT(8 == sizeof(I)); + STATIC_ASSERT(8 == sizeof(D)); D old, upd; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os_cpu/linux_s390/vm/thread_linux_s390.hpp --- a/hotspot/src/os_cpu/linux_s390/vm/thread_linux_s390.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os_cpu/linux_s390/vm/thread_linux_s390.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -30,7 +30,6 @@ void pd_initialize() { _anchor.clear(); - _last_interpreter_fp = NULL; } // The `last' frame is the youngest Java frame on the thread's stack. @@ -61,22 +60,4 @@ bool pd_get_top_frame_for_signal_handler(frame* fr_addr, void* ucontext, bool isInJava); - protected: - - // -Xprof support - // - // In order to find the last Java fp from an async profile - // tick, we store the current interpreter fp in the thread. - // This value is only valid while we are in the C++ interpreter - // and profiling. - intptr_t *_last_interpreter_fp; - - public: - - static ByteSize last_interpreter_fp_offset() { - return byte_offset_of(JavaThread, _last_interpreter_fp); - } - - intptr_t* last_interpreter_fp() { return _last_interpreter_fp; } - #endif // OS_CPU_LINUX_S390_VM_THREAD_LINUX_S390_HPP diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.hpp --- a/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os_cpu/linux_sparc/vm/atomic_linux_sparc.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -62,8 +62,8 @@ template<> template inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { - STATIC_CAST(4 == sizeof(I)); - STATIC_CAST(4 == sizeof(D)); + STATIC_ASSERT(4 == sizeof(I)); + STATIC_ASSERT(4 == sizeof(D)); D rv; __asm__ volatile( @@ -81,10 +81,11 @@ return rv; } +template<> template inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { - STATIC_CAST(8 == sizeof(I)); - STATIC_CAST(8 == sizeof(D)); + STATIC_ASSERT(8 == sizeof(I)); + STATIC_ASSERT(8 == sizeof(D)); D rv; __asm__ volatile( diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp --- a/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os_cpu/linux_zero/vm/atomic_linux_zero.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -178,8 +178,8 @@ template<> template inline D Atomic::PlatformAdd<4>::add_and_fetch(I add_value, D volatile* dest) const { - STATIC_CAST(4 == sizeof(I)); - STATIC_CAST(4 == sizeof(D)); + STATIC_ASSERT(4 == sizeof(I)); + STATIC_ASSERT(4 == sizeof(D)); #ifdef ARM return add_using_helper(arm_add_and_fetch, add_value, dest); @@ -195,8 +195,8 @@ template<> template inline D Atomic::PlatformAdd<8>::add_and_fetch(I add_value, D volatile* dest) const { - STATIC_CAST(8 == sizeof(I)); - STATIC_CAST(8 == sizeof(D)); + STATIC_ASSERT(8 == sizeof(I)); + STATIC_ASSERT(8 == sizeof(D)); return __sync_add_and_fetch(dest, add_value); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp --- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -29,7 +29,6 @@ #include "classfile/vmSymbols.hpp" #include "code/icBuffer.hpp" #include "code/vtableStubs.hpp" -#include "decoder_windows.hpp" #include "interpreter/interpreter.hpp" #include "jvm_windows.h" #include "memory/allocation.inline.hpp" @@ -51,10 +50,12 @@ #include "runtime/stubRoutines.hpp" #include "runtime/thread.inline.hpp" #include "runtime/timer.hpp" +#include "unwind_windows_x86.hpp" #include "utilities/events.hpp" #include "utilities/vmError.hpp" +#include "windbghelp.hpp" -# include "unwind_windows_x86.hpp" + #undef REG_SP #undef REG_FP #undef REG_PC @@ -401,24 +402,18 @@ lastpc = pc; } - PVOID p = WindowsDbgHelp::SymFunctionTableAccess64(GetCurrentProcess(), stk.AddrPC.Offset); + PVOID p = WindowsDbgHelp::symFunctionTableAccess64(GetCurrentProcess(), stk.AddrPC.Offset); if (!p) { // StackWalk64() can't handle this PC. Calling StackWalk64 again may cause crash. break; } - BOOL result = WindowsDbgHelp::StackWalk64( + BOOL result = WindowsDbgHelp::stackWalk64( IMAGE_FILE_MACHINE_AMD64, // __in DWORD MachineType, GetCurrentProcess(), // __in HANDLE hProcess, GetCurrentThread(), // __in HANDLE hThread, &stk, // __inout LP STACKFRAME64 StackFrame, - &ctx, // __inout PVOID ContextRecord, - NULL, // __in_opt PREAD_PROCESS_MEMORY_ROUTINE64 ReadMemoryRoutine, - WindowsDbgHelp::pfnSymFunctionTableAccess64(), - // __in_opt PFUNCTION_TABLE_ACCESS_ROUTINE64 FunctionTableAccessRoutine, - WindowsDbgHelp::pfnSymGetModuleBase64(), - // __in_opt PGET_MODULE_BASE_ROUTINE64 GetModuleBaseRoutine, - NULL); // __in_opt PTRANSLATE_ADDRESS_ROUTINE64 TranslateAddress + &ctx); // __inout PVOID ContextRecord, if (!result) { break; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/Xusage.txt --- a/hotspot/src/share/vm/Xusage.txt Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/Xusage.txt Sat Sep 09 14:36:45 2017 +0200 @@ -12,7 +12,6 @@ -Xms set initial Java heap size -Xmx set maximum Java heap size -Xss set java thread stack size - -Xprof output cpu profiling data (deprecated) -Xfuture enable strictest checks, anticipating future default -Xrs reduce use of OS signals by Java/VM (see documentation) -Xcheck:jni perform additional checks for JNI functions diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/aot/aotCodeHeap.cpp --- a/hotspot/src/share/vm/aot/aotCodeHeap.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/aot/aotCodeHeap.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -478,6 +478,8 @@ SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_arrayof_oop_disjoint_arraycopy", address, StubRoutines::_arrayof_oop_disjoint_arraycopy); SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_arrayof_oop_disjoint_arraycopy_uninit", address, StubRoutines::_arrayof_oop_disjoint_arraycopy_uninit); + SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_unsafe_arraycopy", address, StubRoutines::_unsafe_arraycopy); + SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_checkcast_arraycopy", address, StubRoutines::_checkcast_arraycopy); SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_stub_routines_aescrypt_encryptBlock", address, StubRoutines::_aescrypt_encryptBlock); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/classfile/classLoader.cpp --- a/hotspot/src/share/vm/classfile/classLoader.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/classfile/classLoader.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -57,7 +57,6 @@ #include "prims/jvm_misc.hpp" #include "runtime/arguments.hpp" #include "runtime/compilationPolicy.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/handles.hpp" #include "runtime/handles.inline.hpp" #include "runtime/init.hpp" @@ -147,6 +146,7 @@ ClassPathEntry* ClassLoader::_first_append_entry = NULL; ClassPathEntry* ClassLoader::_last_append_entry = NULL; int ClassLoader::_num_entries = 0; +int ClassLoader::_num_boot_entries = -1; #if INCLUDE_CDS GrowableArray* ClassLoader::_boot_modules_array = NULL; GrowableArray* ClassLoader::_platform_modules_array = NULL; @@ -242,7 +242,7 @@ // Given a fully qualified class name, find its defining package in the class loader's // package entry table. -static PackageEntry* get_package_entry(const char* class_name, ClassLoaderData* loader_data, TRAPS) { +PackageEntry* ClassLoader::get_package_entry(const char* class_name, ClassLoaderData* loader_data, TRAPS) { ResourceMark rm(THREAD); const char *pkg_name = ClassLoader::package_from_name(class_name); if (pkg_name == NULL) { @@ -509,7 +509,7 @@ #endif } else { - PackageEntry* package_entry = get_package_entry(name, ClassLoaderData::the_null_class_loader_data(), CHECK_NULL); + PackageEntry* package_entry = ClassLoader::get_package_entry(name, ClassLoaderData::the_null_class_loader_data(), CHECK_NULL); if (package_entry != NULL) { ResourceMark rm; // Get the module name @@ -540,6 +540,13 @@ return NULL; } +JImageLocationRef ClassLoader::jimage_find_resource(JImageFile* jf, + const char* module_name, + const char* file_name, + jlong &size) { + return ((*JImageFindResource)(jf, module_name, get_jimage_version_string(), file_name, &size)); +} + #ifndef PRODUCT bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version, const char* package, @@ -1066,7 +1073,7 @@ char path[JVM_MAXPATHLEN]; char ebuf[1024]; void* handle = NULL; - if (os::dll_build_name(path, sizeof(path), Arguments::get_dll_dir(), "zip")) { + if (os::dll_locate_lib(path, sizeof(path), Arguments::get_dll_dir(), "zip")) { handle = os::dll_load(path, ebuf, sizeof ebuf); } if (handle == NULL) { @@ -1104,7 +1111,7 @@ char path[JVM_MAXPATHLEN]; char ebuf[1024]; void* handle = NULL; - if (os::dll_build_name(path, sizeof(path), Arguments::get_dll_dir(), "jimage")) { + if (os::dll_locate_lib(path, sizeof(path), Arguments::get_dll_dir(), "jimage")) { handle = os::dll_load(path, ebuf, sizeof ebuf); } if (handle == NULL) { @@ -1434,7 +1441,6 @@ const char* const class_name = name->as_C_string(); EventMark m("loading class %s", class_name); - ThreadProfilerMark tpm(ThreadProfilerMark::classLoaderRegion); const char* const file_name = file_name_for_class_name(class_name, name->utf8_length()); @@ -1459,9 +1465,6 @@ // This would include: // [--patch-module==()*]; [jimage | exploded module build] // - // DumpSharedSpaces and search_append_only are mutually exclusive and cannot - // be true at the same time. - assert(!(DumpSharedSpaces && search_append_only), "DumpSharedSpaces and search_append_only are both true"); // Load Attempt #1: --patch-module // Determine the class' defining module. If it appears in the _patch_mod_entries, @@ -1507,6 +1510,11 @@ e = _first_append_entry; while (e != NULL) { + if (DumpSharedSpaces && classpath_index >= _num_boot_entries) { + // Do not load any class from the app classpath using the boot loader. Let + // the built-in app class laoder load them. + break; + } stream = e->open_stream(file_name, CHECK_NULL); if (!context.check(stream, classpath_index)) { return NULL; @@ -1520,9 +1528,6 @@ } if (NULL == stream) { - if (DumpSharedSpaces) { - tty->print_cr("Preload Warning: Cannot find %s", class_name); - } return NULL; } @@ -1548,6 +1553,100 @@ return context.record_result(name, e, classpath_index, result, THREAD); } +#if INCLUDE_CDS +static char* skip_uri_protocol(char* source) { + if (strncmp(source, "file:", 5) == 0) { + // file: protocol path could start with file:/ or file:/// + // locate the char after all the forward slashes + int offset = 5; + while (*(source + offset) == '/') { + offset++; + } + source += offset; + // for non-windows platforms, move back one char as the path begins with a '/' +#ifndef _WINDOWS + source -= 1; +#endif + } else if (strncmp(source, "jrt:/", 5) == 0) { + source += 5; + } + return source; +} + +void ClassLoader::record_shared_class_loader_type(InstanceKlass* ik, const ClassFileStream* stream) { + assert(DumpSharedSpaces, "sanity"); + assert(stream != NULL, "sanity"); + + if (ik->is_anonymous()) { + // We do not archive anonymous classes. + return; + } + + if (stream->source() == NULL) { + if (ik->class_loader() == NULL) { + // JFR classes + ik->set_shared_classpath_index(0); + ik->set_class_loader_type(ClassLoader::BOOT_LOADER); + } + return; + } + + assert(has_jrt_entry(), "CDS dumping does not support exploded JDK build"); + + ModuleEntry* module = ik->module(); + ClassPathEntry* e = NULL; + int classpath_index = 0; + + // Check if the class is from the runtime image + if (module != NULL && (module->location() != NULL) && + (module->location()->starts_with("jrt:"))) { + e = _jrt_entry; + classpath_index = 0; + } else { + classpath_index = 1; + ResourceMark rm; + char* canonical_path = NEW_RESOURCE_ARRAY(char, JVM_MAXPATHLEN); + for (e = _first_append_entry; e != NULL; e = e->next()) { + if (get_canonical_path(e->name(), canonical_path, JVM_MAXPATHLEN)) { + char* src = (char*)stream->source(); + // save the path from the file: protocol or the module name from the jrt: protocol + // if no protocol prefix is found, src is the same as stream->source() after the following call + src = skip_uri_protocol(src); + if (strcmp(canonical_path, os::native_path((char*)src)) == 0) { + break; + } + classpath_index ++; + } + } + if (e == NULL) { + assert(ik->shared_classpath_index() < 0, + "must be a class from a custom jar which isn't in the class path or boot class path"); + return; + } + } + + if (classpath_index < _num_boot_entries) { + // ik is either: + // 1) a boot class loaded from the runtime image during vm initialization (classpath_index = 0); or + // 2) a user's class from -Xbootclasspath/a (classpath_index > 0) + // In the second case, the classpath_index, classloader_type will be recorded via + // context.record_result() in ClassLoader::load_class(Symbol* name, bool search_append_only, TRAPS). + if (classpath_index > 0) { + return; + } + } + + ResourceMark rm; + const char* const class_name = ik->name()->as_C_string(); + const char* const file_name = file_name_for_class_name(class_name, + ik->name()->utf8_length()); + assert(file_name != NULL, "invariant"); + Thread* THREAD = Thread::current(); + ClassLoaderExt::Context context(class_name, file_name, CATCH); + context.record_result(ik->name(), e, classpath_index, ik, THREAD); +} +#endif // INCLUDE_CDS + // Initialize the class loader's access to methods in libzip. Parse and // process the boot classpath into a list ClassPathEntry objects. Once // this list has been created, it must not change order (see class PackageInfo) @@ -1632,6 +1731,7 @@ #if INCLUDE_CDS void ClassLoader::initialize_shared_path() { if (DumpSharedSpaces) { + _num_boot_entries = _num_entries; ClassLoaderExt::setup_search_paths(); _shared_paths_misc_info->write_jint(0); // see comments in SharedPathsMiscInfo::check() } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/classfile/classLoader.hpp --- a/hotspot/src/share/vm/classfile/classLoader.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/classfile/classLoader.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -25,6 +25,7 @@ #ifndef SHARE_VM_CLASSFILE_CLASSLOADER_HPP #define SHARE_VM_CLASSFILE_CLASSLOADER_HPP +#include "classfile/jimage.hpp" #include "runtime/orderAccess.hpp" #include "runtime/perfData.hpp" #include "utilities/exceptions.hpp" @@ -47,6 +48,7 @@ class JImageFile; class ClassFileStream; +class PackageEntry; class ClassPathEntry : public CHeapObj { private: @@ -103,7 +105,6 @@ jlong pos; /* position of LOC header (if negative) or data */ } jzentry; - class ClassPathZipEntry: public ClassPathEntry { enum { _unknown = 0, @@ -249,6 +250,10 @@ // the entries on the _first_append_entry linked list. static int _num_entries; + // number of entries in the boot class path including the + // java runtime image + static int _num_boot_entries; + // Array of module names associated with the boot class loader CDS_ONLY(static GrowableArray* _boot_modules_array;) @@ -289,6 +294,7 @@ static bool get_canonical_path(const char* orig, char* out, int len); static const char* file_name_for_class_name(const char* class_name, int class_name_len); + static PackageEntry* get_package_entry(const char* class_name, ClassLoaderData* loader_data, TRAPS); public: static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg); @@ -436,7 +442,10 @@ static void initialize_module_loader_map(JImageFile* jimage); static s2 classloader_type(Symbol* class_name, ClassPathEntry* e, int classpath_index, TRAPS); + static void record_shared_class_loader_type(InstanceKlass* ik, const ClassFileStream* stream); #endif + static JImageLocationRef jimage_find_resource(JImageFile* jf, const char* module_name, + const char* file_name, jlong &size); static void trace_class_path(const char* msg, const char* name = NULL); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/classfile/classLoaderData.cpp --- a/hotspot/src/share/vm/classfile/classLoaderData.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -75,6 +75,9 @@ #include "utilities/growableArray.hpp" #include "utilities/macros.hpp" #include "utilities/ostream.hpp" +#if INCLUDE_ALL_GCS +#include "gc/g1/g1SATBCardTableModRefBS.hpp" +#endif // INCLUDE_ALL_GCS #if INCLUDE_TRACE #include "trace/tracing.hpp" #endif @@ -764,6 +767,25 @@ return OopHandle(_handles.add(h())); } +void ClassLoaderData::remove_handle(OopHandle h) { + oop* ptr = h.ptr_raw(); + if (ptr != NULL) { + assert(_handles.contains(ptr), "Got unexpected handle " PTR_FORMAT, p2i(ptr)); +#if INCLUDE_ALL_GCS + // This barrier is used by G1 to remember the old oop values, so + // that we don't forget any objects that were live at the snapshot at + // the beginning. + if (UseG1GC) { + oop obj = *ptr; + if (obj != NULL) { + G1SATBCardTableModRefBS::enqueue(obj); + } + } +#endif + *ptr = NULL; + } +} + void ClassLoaderData::init_handle_locked(OopHandle& dest, Handle h) { MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag); if (dest.resolve() != NULL) { diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/classfile/classLoaderData.hpp --- a/hotspot/src/share/vm/classfile/classLoaderData.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -364,6 +364,7 @@ const char* loader_name(); OopHandle add_handle(Handle h); + void remove_handle(OopHandle h); void init_handle_locked(OopHandle& pd, Handle h); // used for concurrent access to ModuleEntry::_pd field void add_class(Klass* k, bool publicize = true); void remove_class(Klass* k); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/classfile/classLoaderExt.hpp --- a/hotspot/src/share/vm/classfile/classLoaderExt.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/classfile/classLoaderExt.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -26,6 +26,7 @@ #define SHARE_VM_CLASSFILE_CLASSLOADEREXT_HPP #include "classfile/classLoader.hpp" +#include "classfile/systemDictionary.hpp" #include "oops/instanceKlass.hpp" #include "runtime/handles.hpp" @@ -56,8 +57,15 @@ if (ClassLoader::add_package(_file_name, classpath_index, THREAD)) { #if INCLUDE_CDS if (DumpSharedSpaces) { - s2 classloader_type = ClassLoader::classloader_type( - class_name, e, classpath_index, CHECK_(result)); + oop loader = result->class_loader(); + s2 classloader_type = ClassLoader::BOOT_LOADER; + if (SystemDictionary::is_system_class_loader(loader)) { + classloader_type = ClassLoader::APP_LOADER; + ClassLoaderExt::set_has_app_classes(); + } else if (SystemDictionary::is_platform_class_loader(loader)) { + classloader_type = ClassLoader::PLATFORM_LOADER; + ClassLoaderExt::set_has_platform_classes(); + } result->set_shared_classpath_index(classpath_index); result->set_class_loader_type(classloader_type); } @@ -82,6 +90,13 @@ return true; } static Klass* load_one_class(ClassListParser* parser, TRAPS); +#if INCLUDE_CDS + static void set_has_app_classes() {} + static void set_has_platform_classes() {} + static char* read_manifest(ClassPathEntry* entry, jint *manifest_size, TRAPS) { + return NULL; + } +#endif }; #endif // SHARE_VM_CLASSFILE_CLASSLOADEREXT_HPP diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/classfile/dictionary.cpp --- a/hotspot/src/share/vm/classfile/dictionary.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/classfile/dictionary.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -85,6 +85,7 @@ void Dictionary::free_entry(DictionaryEntry* entry) { // avoid recursion when deleting linked list + // pd_set is accessed during a safepoint. while (entry->pd_set() != NULL) { ProtectionDomainEntry* to_delete = entry->pd_set(); entry->set_pd_set(to_delete->next()); @@ -101,7 +102,7 @@ if (protection_domain == instance_klass()->protection_domain()) { // Ensure this doesn't show up in the pd_set (invariant) bool in_pd_set = false; - for (ProtectionDomainEntry* current = _pd_set; + for (ProtectionDomainEntry* current = pd_set_acquire(); current != NULL; current = current->next()) { if (current->protection_domain() == protection_domain) { @@ -121,7 +122,7 @@ return true; } - for (ProtectionDomainEntry* current = _pd_set; + for (ProtectionDomainEntry* current = pd_set_acquire(); current != NULL; current = current->next()) { if (current->protection_domain() == protection_domain) return true; @@ -135,12 +136,12 @@ if (!contains_protection_domain(protection_domain())) { ProtectionDomainCacheEntry* entry = SystemDictionary::cache_get(protection_domain); ProtectionDomainEntry* new_head = - new ProtectionDomainEntry(entry, _pd_set); + new ProtectionDomainEntry(entry, pd_set()); // Warning: Preserve store ordering. The SystemDictionary is read // without locks. The new ProtectionDomainEntry must be // complete before other threads can be allowed to see it // via a store to _pd_set. - OrderAccess::release_store_ptr(&_pd_set, new_head); + release_set_pd_set(new_head); } LogTarget(Trace, protectiondomain) lt; if (lt.is_enabled()) { @@ -365,11 +366,21 @@ for (int i = 0; i < table_size(); ++i) { DictionaryEntry* p = bucket(i); while (p != NULL) { - DictionaryEntry* tmp; - tmp = p->next(); - p->set_next(master_list); - master_list = p; - p = tmp; + DictionaryEntry* next = p->next(); + InstanceKlass*ik = p->instance_klass(); + // we cannot include signed classes in the archive because the certificates + // used during dump time may be different than those used during + // runtime (due to expiration, etc). + if (ik->signers() != NULL) { + ResourceMark rm; + tty->print_cr("Preload Warning: Skipping %s from signed JAR", + ik->name()->as_C_string()); + free_entry(p); + } else { + p->set_next(master_list); + master_list = p; + } + p = next; } set_entry(i, NULL); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/classfile/dictionary.hpp --- a/hotspot/src/share/vm/classfile/dictionary.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/classfile/dictionary.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -29,6 +29,7 @@ #include "classfile/systemDictionary.hpp" #include "oops/instanceKlass.hpp" #include "oops/oop.hpp" +#include "runtime/orderAccess.hpp" #include "utilities/hashtable.hpp" #include "utilities/ostream.hpp" @@ -48,21 +49,6 @@ DictionaryEntry* get_entry(int index, unsigned int hash, Symbol* name); protected: - DictionaryEntry* bucket(int i) const { - return (DictionaryEntry*)Hashtable::bucket(i); - } - - // The following method is not MT-safe and must be done under lock. - DictionaryEntry** bucket_addr(int i) { - return (DictionaryEntry**)Hashtable::bucket_addr(i); - } - - void add_entry(int index, DictionaryEntry* new_entry) { - Hashtable::add_entry(index, (HashtableEntry*)new_entry); - } - - void free_entry(DictionaryEntry* entry); - static size_t entry_size(); public: Dictionary(ClassLoaderData* loader_data, int table_size); @@ -106,6 +92,24 @@ void print_on(outputStream* st) const; void verify(); + DictionaryEntry* bucket(int i) const { + return (DictionaryEntry*)Hashtable::bucket(i); + } + + // The following method is not MT-safe and must be done under lock. + DictionaryEntry** bucket_addr(int i) { + return (DictionaryEntry**)Hashtable::bucket_addr(i); + } + + void add_entry(int index, DictionaryEntry* new_entry) { + Hashtable::add_entry(index, (HashtableEntry*)new_entry); + } + + void unlink_entry(DictionaryEntry* entry) { + Hashtable::unlink_entry((HashtableEntry*)entry); + } + + void free_entry(DictionaryEntry* entry); }; // An entry in the class loader data dictionaries, this describes a class as @@ -134,7 +138,7 @@ // It is essentially a cache to avoid repeated Java up-calls to // ClassLoader.checkPackageAccess(). // - ProtectionDomainEntry* _pd_set; + ProtectionDomainEntry* volatile _pd_set; public: // Tells whether a protection is in the approved set. @@ -153,8 +157,15 @@ return (DictionaryEntry**)HashtableEntry::next_addr(); } - ProtectionDomainEntry* pd_set() const { return _pd_set; } - void set_pd_set(ProtectionDomainEntry* pd_set) { _pd_set = pd_set; } + ProtectionDomainEntry* pd_set() const { return _pd_set; } + void set_pd_set(ProtectionDomainEntry* new_head) { _pd_set = new_head; } + + ProtectionDomainEntry* pd_set_acquire() const { + return (ProtectionDomainEntry*)OrderAccess::load_ptr_acquire(&_pd_set); + } + void release_set_pd_set(ProtectionDomainEntry* new_head) { + OrderAccess::release_store_ptr(&_pd_set, new_head); + } // Tells whether the initiating class' protection domain can access the klass in this entry bool is_valid_protection_domain(Handle protection_domain) { @@ -167,7 +178,7 @@ } void verify_protection_domain_set() { - for (ProtectionDomainEntry* current = _pd_set; + for (ProtectionDomainEntry* current = pd_set(); // accessed at a safepoint current != NULL; current = current->_next) { current->_pd_cache->protection_domain()->verify(); @@ -181,7 +192,7 @@ void print_count(outputStream *st) { int count = 0; - for (ProtectionDomainEntry* current = _pd_set; + for (ProtectionDomainEntry* current = pd_set(); // accessed inside SD lock current != NULL; current = current->_next) { count++; @@ -246,10 +257,6 @@ class SymbolPropertyTable : public Hashtable { friend class VMStructs; private: - SymbolPropertyEntry* bucket(int i) { - return (SymbolPropertyEntry*) Hashtable::bucket(i); - } - // The following method is not MT-safe and must be done under lock. SymbolPropertyEntry** bucket_addr(int i) { return (SymbolPropertyEntry**) Hashtable::bucket_addr(i); @@ -303,5 +310,9 @@ void methods_do(void f(Method*)); void verify(); + + SymbolPropertyEntry* bucket(int i) { + return (SymbolPropertyEntry*) Hashtable::bucket(i); + } }; #endif // SHARE_VM_CLASSFILE_DICTIONARY_HPP diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/classfile/klassFactory.cpp --- a/hotspot/src/share/vm/classfile/klassFactory.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/classfile/klassFactory.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -70,11 +70,25 @@ ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader()); int path_index = ik->shared_classpath_index(); - SharedClassPathEntry* ent = - (SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index); + const char* pathname; + if (path_index < 0) { + // shared classes loaded by user defined class loader + // do not have shared_classpath_index + ModuleEntry* mod_entry = ik->module(); + if (mod_entry != NULL && (mod_entry->location() != NULL)) { + ResourceMark rm; + pathname = (const char*)(mod_entry->location()->as_C_string()); + } else { + pathname = ""; + } + } else { + SharedClassPathEntry* ent = + (SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index); + pathname = ent == NULL ? NULL : ent->name(); + } ClassFileStream* stream = new ClassFileStream(ptr, end_ptr - ptr, - ent == NULL ? NULL : ent->name(), + pathname, ClassFileStream::verify); ClassFileParser parser(stream, class_name, @@ -215,8 +229,10 @@ TRACE_KLASS_CREATION(result, parser, THREAD); -#if INCLUDE_CDS && INCLUDE_JVMTI +#if INCLUDE_CDS if (DumpSharedSpaces) { + ClassLoader::record_shared_class_loader_type(result, stream); +#if INCLUDE_JVMTI assert(cached_class_file == NULL, "Sanity"); // Archive the class stream data into the optional data section JvmtiCachedClassFileData *p; @@ -233,8 +249,9 @@ p->length = len; memcpy(p->data, bytes, len); result->set_archived_class_data(p); +#endif // INCLUDE_JVMTI } -#endif +#endif // INCLUDE_CDS return result; } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/classfile/stringTable.cpp --- a/hotspot/src/share/vm/classfile/stringTable.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/classfile/stringTable.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -729,7 +729,6 @@ } G1CollectedHeap::heap()->end_archive_alloc_range(string_space, os::vm_allocation_granularity()); - assert(string_space->length() <= 2, "sanity"); return true; } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/classfile/systemDictionary.cpp --- a/hotspot/src/share/vm/classfile/systemDictionary.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -66,6 +66,7 @@ #include "prims/resolvedMethodTable.hpp" #include "prims/methodHandles.hpp" #include "runtime/arguments.hpp" +#include "runtime/arguments_ext.hpp" #include "runtime/biasedLocking.hpp" #include "runtime/fieldType.hpp" #include "runtime/handles.inline.hpp" @@ -869,7 +870,7 @@ // during compilations. MutexLocker mu(Compile_lock, THREAD); update_dictionary(d_index, d_hash, p_index, p_hash, - k, class_loader, THREAD); + k, class_loader, THREAD); } if (JvmtiExport::should_post_class_load()) { @@ -910,12 +911,9 @@ if (protection_domain() == NULL) return k; // Check the protection domain has the right access - { - MutexLocker mu(SystemDictionary_lock, THREAD); - if (dictionary->is_valid_protection_domain(d_index, d_hash, name, - protection_domain)) { - return k; - } + if (dictionary->is_valid_protection_domain(d_index, d_hash, name, + protection_domain)) { + return k; } // Verify protection domain. If it fails an exception is thrown @@ -1009,7 +1007,6 @@ // Create a new CLD for anonymous class, that uses the same class loader // as the host_klass guarantee(host_klass->class_loader() == class_loader(), "should be the same"); - guarantee(!DumpSharedSpaces, "must not create anonymous classes when dumping"); loader_data = ClassLoaderData::anonymous_class_loader_data(class_loader(), CHECK_NULL); } else { loader_data = ClassLoaderData::class_loader_data(class_loader()); @@ -1078,6 +1075,15 @@ Handle protection_domain, ClassFileStream* st, TRAPS) { +#if INCLUDE_CDS + ResourceMark rm(THREAD); + if (DumpSharedSpaces && !class_loader.is_null() && + !ArgumentsExt::using_AppCDS() && strcmp(class_name->as_C_string(), "Unnamed") != 0) { + // If AppCDS is not enabled, don't define the class at dump time (except for the "Unnamed" + // class, which is used by MethodHandles). + THROW_MSG_NULL(vmSymbols::java_lang_ClassNotFoundException(), class_name->as_C_string()); + } +#endif HandleMark hm(THREAD); @@ -1104,11 +1110,13 @@ InstanceKlass* k = NULL; #if INCLUDE_CDS - k = SystemDictionaryShared::lookup_from_stream(class_name, - class_loader, - protection_domain, - st, - CHECK_NULL); + if (!DumpSharedSpaces) { + k = SystemDictionaryShared::lookup_from_stream(class_name, + class_loader, + protection_domain, + st, + CHECK_NULL); + } #endif if (k == NULL) { @@ -1217,6 +1225,16 @@ "Cannot use sharing if java.base is patched"); ResourceMark rm; int path_index = ik->shared_classpath_index(); + ClassLoaderData* loader_data = class_loader_data(class_loader); + if (path_index < 0) { + // path_index < 0 indicates that the class is intended for a custom loader + // and should not be loaded by boot/platform/app loaders + if (loader_data->is_builtin_class_loader_data()) { + return false; + } else { + return true; + } + } SharedClassPathEntry* ent = (SharedClassPathEntry*)FileMapInfo::shared_classpath(path_index); if (!Universe::is_module_initialized()) { @@ -1230,7 +1248,6 @@ PackageEntry* pkg_entry = NULL; ModuleEntry* mod_entry = NULL; const char* pkg_string = NULL; - ClassLoaderData* loader_data = class_loader_data(class_loader); pkg_name = InstanceKlass::package_from_name(class_name, CHECK_false); if (pkg_name != NULL) { pkg_string = pkg_name->as_C_string(); @@ -1403,6 +1420,18 @@ } return ik; } + +void SystemDictionary::clear_invoke_method_table() { + SymbolPropertyEntry* spe = NULL; + for (int index = 0; index < _invoke_method_table->table_size(); index++) { + SymbolPropertyEntry* p = _invoke_method_table->bucket(index); + while (p != NULL) { + spe = p; + p = p->next(); + _invoke_method_table->free_entry(spe); + } + } +} #endif // INCLUDE_CDS InstanceKlass* SystemDictionary::load_instance_class(Symbol* class_name, Handle class_loader, TRAPS) { @@ -1449,7 +1478,6 @@ } } } else { - assert(!DumpSharedSpaces, "Archive dumped after module system initialization"); // After the module system has been initialized, check if the class' // package is in a module defined to the boot loader. if (pkg_name == NULL || pkg_entry == NULL || pkg_entry->in_unnamed_module()) { @@ -1968,8 +1996,19 @@ invoke_method_table()->methods_do(f); } +class RemoveClassesClosure : public CLDClosure { + public: + void do_cld(ClassLoaderData* cld) { + if (cld->is_system_class_loader_data() || cld->is_platform_class_loader_data()) { + cld->dictionary()->remove_classes_in_error_state(); + } + } +}; + void SystemDictionary::remove_classes_in_error_state() { ClassLoaderData::the_null_class_loader_data()->dictionary()->remove_classes_in_error_state(); + RemoveClassesClosure rcc; + ClassLoaderDataGraph::cld_do(&rcc); } // ---------------------------------------------------------------------------- @@ -2910,6 +2949,56 @@ } } +class CombineDictionariesClosure : public CLDClosure { + private: + Dictionary* _master_dictionary; + public: + CombineDictionariesClosure(Dictionary* master_dictionary) : + _master_dictionary(master_dictionary) {} + void do_cld(ClassLoaderData* cld) { + ResourceMark rm; + if (cld->is_system_class_loader_data() || cld->is_platform_class_loader_data()) { + for (int i = 0; i < cld->dictionary()->table_size(); ++i) { + Dictionary* curr_dictionary = cld->dictionary(); + DictionaryEntry* p = curr_dictionary->bucket(i); + while (p != NULL) { + Symbol* name = p->instance_klass()->name(); + unsigned int d_hash = _master_dictionary->compute_hash(name); + int d_index = _master_dictionary->hash_to_index(d_hash); + DictionaryEntry* next = p->next(); + if (p->literal()->class_loader_data() != cld) { + // This is an initiating class loader entry; don't use it + log_trace(cds)("Skipping initiating cl entry: %s", name->as_C_string()); + curr_dictionary->free_entry(p); + } else { + log_trace(cds)("Moved to boot dictionary: %s", name->as_C_string()); + curr_dictionary->unlink_entry(p); + p->set_pd_set(NULL); // pd_set is runtime only information and will be reconstructed. + _master_dictionary->add_entry(d_index, p); + } + p = next; + } + *curr_dictionary->bucket_addr(i) = NULL; + } + } + } +}; + +// Combining platform and system loader dictionaries into boot loader dictionaries. +// During run time, we only have one shared dictionary. +void SystemDictionary::combine_shared_dictionaries() { + assert(DumpSharedSpaces, "dump time only"); + Dictionary* master_dictionary = ClassLoaderData::the_null_class_loader_data()->dictionary(); + CombineDictionariesClosure cdc(master_dictionary); + ClassLoaderDataGraph::cld_do(&cdc); + + // These tables are no longer valid or necessary. Keeping them around will + // cause SystemDictionary::verify() to fail. Let's empty them. + _placeholders = new PlaceholderTable(_placeholder_table_size); + _loader_constraints = new LoaderConstraintTable(_loader_constraint_size); + + NOT_PRODUCT(SystemDictionary::verify()); +} // caller needs ResourceMark const char* SystemDictionary::loader_name(const oop loader) { diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/classfile/systemDictionary.hpp --- a/hotspot/src/share/vm/classfile/systemDictionary.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -385,6 +385,7 @@ public: // Sharing support. static void reorder_dictionary_for_sharing(); + static void combine_shared_dictionaries(); static size_t count_bytes_for_buckets(); static size_t count_bytes_for_table(); static void copy_buckets(char* top, char* end); @@ -643,6 +644,7 @@ TRAPS); static bool is_system_class_loader(oop class_loader); static bool is_platform_class_loader(oop class_loader); + static void clear_invoke_method_table(); protected: static InstanceKlass* find_shared_class(Symbol* class_name); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/code/nmethod.cpp --- a/hotspot/src/share/vm/code/nmethod.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/code/nmethod.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -1220,7 +1220,7 @@ // for stack scanning. if (state == not_entrant) { mark_as_seen_on_stack(); - OrderAccess::storestore(); + OrderAccess::storestore(); // _stack_traversal_mark and _state } // Change state diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/code/nmethod.hpp --- a/hotspot/src/share/vm/code/nmethod.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/code/nmethod.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -136,7 +136,7 @@ // stack. An not_entrant method can be removed when there are no // more activations, i.e., when the _stack_traversal_mark is less than // current sweep traversal index. - volatile jlong _stack_traversal_mark; + volatile long _stack_traversal_mark; // The _hotness_counter indicates the hotness of a method. The higher // the value the hotter the method. The hotness counter of a nmethod is @@ -396,8 +396,8 @@ public: // Sweeper support - jlong stack_traversal_mark() { return OrderAccess::load_acquire(&_stack_traversal_mark); } - void set_stack_traversal_mark(jlong l) { OrderAccess::release_store(&_stack_traversal_mark, l); } + long stack_traversal_mark() { return _stack_traversal_mark; } + void set_stack_traversal_mark(long l) { _stack_traversal_mark = l; } // implicit exceptions support address continuation_for_implicit_exception(address pc); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/compiler/disassembler.cpp --- a/hotspot/src/share/vm/compiler/disassembler.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/compiler/disassembler.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2017, 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 @@ -30,7 +30,6 @@ #include "gc/shared/collectedHeap.hpp" #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/handles.inline.hpp" #include "runtime/os.hpp" #include "runtime/stubCodeGenerator.hpp" @@ -163,7 +162,6 @@ bool _print_pc; bool _print_bytes; address _cur_insn; - int _total_ticks; int _bytes_per_line; // arch-specific formatting option static bool match(const char* event, const char* tag) { @@ -213,18 +211,6 @@ _nm->print_code_comment_on(st, COMMENT_COLUMN, pc0, pc); // this calls reloc_string_for which calls oop::print_value_on } - - // Output pc bucket ticks if we have any - if (total_ticks() != 0) { - address bucket_pc = FlatProfiler::bucket_start_for(pc); - if (bucket_pc != NULL && bucket_pc > pc0 && bucket_pc <= pc) { - int bucket_count = FlatProfiler::bucket_count_for(pc0); - if (bucket_count != 0) { - st->bol(); - st->print_cr("%3.1f%% [%d]", bucket_count*100.0/total_ticks(), bucket_count); - } - } - } // follow each complete insn by a nice newline st->cr(); } @@ -233,8 +219,6 @@ outputStream* output() { return _output; } address cur_insn() { return _cur_insn; } - int total_ticks() { return _total_ticks; } - void set_total_ticks(int n) { _total_ticks = n; } const char* options() { return _option_buf; } }; @@ -561,20 +545,6 @@ #endif env.output()->print_cr(" [" PTR_FORMAT ", " PTR_FORMAT "] " JLONG_FORMAT " bytes", p2i(p), p2i(end), ((jlong)(end - p))); - // If there has been profiling, print the buckets. - if (FlatProfiler::bucket_start_for(p) != NULL) { - unsigned char* p1 = p; - int total_bucket_count = 0; - while (p1 < end) { - unsigned char* p0 = p1; - p1 += pd_instruction_alignment(); - address bucket_pc = FlatProfiler::bucket_start_for(p1); - if (bucket_pc != NULL && bucket_pc > p0 && bucket_pc <= p1) - total_bucket_count += FlatProfiler::bucket_count_for(p0); - } - env.set_total_ticks(total_bucket_count); - } - // Print constant table. if (nm->consts_size() > 0) { nm->print_nmethod_labels(env.output(), nm->consts_begin()); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp --- a/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/g1/g1CollectedHeap.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -1719,7 +1719,6 @@ G1BlockOffsetTable::compute_size(g1_rs.size() / HeapWordSize), G1BlockOffsetTable::heap_map_factor()); - ReservedSpace cardtable_rs(G1SATBCardTableLoggingModRefBS::compute_size(g1_rs.size() / HeapWordSize)); G1RegionToSpaceMapper* cardtable_storage = create_aux_memory_mapper("Card Table", G1SATBCardTableLoggingModRefBS::compute_size(g1_rs.size() / HeapWordSize), diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp --- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -54,7 +54,6 @@ _gc_par_phases[UniverseRoots] = new WorkerDataArray(max_gc_threads, "Universe Roots (ms):"); _gc_par_phases[JNIRoots] = new WorkerDataArray(max_gc_threads, "JNI Handles Roots (ms):"); _gc_par_phases[ObjectSynchronizerRoots] = new WorkerDataArray(max_gc_threads, "ObjectSynchronizer Roots (ms):"); - _gc_par_phases[FlatProfilerRoots] = new WorkerDataArray(max_gc_threads, "FlatProfiler Roots (ms):"); _gc_par_phases[ManagementRoots] = new WorkerDataArray(max_gc_threads, "Management Roots (ms):"); _gc_par_phases[SystemDictionaryRoots] = new WorkerDataArray(max_gc_threads, "SystemDictionary Roots (ms):"); _gc_par_phases[CLDGRoots] = new WorkerDataArray(max_gc_threads, "CLDG Roots (ms):"); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp --- a/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/g1/g1GCPhaseTimes.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -49,7 +49,6 @@ UniverseRoots, JNIRoots, ObjectSynchronizerRoots, - FlatProfilerRoots, ManagementRoots, SystemDictionaryRoots, CLDGRoots, diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/g1/g1HeapVerifier.cpp --- a/hotspot/src/share/vm/gc/g1/g1HeapVerifier.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/g1/g1HeapVerifier.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -62,7 +62,7 @@ oop obj = oopDesc::decode_heap_oop_not_null(heap_oop); if (_g1h->is_obj_dead_cond(obj, _vo)) { Log(gc, verify) log; - log.info("Root location " PTR_FORMAT " points to dead obj " PTR_FORMAT, p2i(p), p2i(obj)); + log.error("Root location " PTR_FORMAT " points to dead obj " PTR_FORMAT, p2i(p), p2i(obj)); if (_vo == VerifyOption_G1UseMarkWord) { log.error(" Mark word: " PTR_FORMAT, p2i(obj->mark())); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp --- a/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/g1/g1MarkSweep.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -48,7 +48,6 @@ #include "prims/jvmtiExport.hpp" #include "runtime/atomic.hpp" #include "runtime/biasedLocking.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/synchronizer.hpp" #include "runtime/thread.hpp" #include "runtime/vmThread.hpp" diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/g1/g1RootProcessor.cpp --- a/hotspot/src/share/vm/gc/g1/g1RootProcessor.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/g1/g1RootProcessor.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, 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 @@ -38,7 +38,6 @@ #include "gc/g1/g1RootProcessor.hpp" #include "gc/g1/heapRegion.inline.hpp" #include "memory/allocation.inline.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/mutex.hpp" #include "services/management.hpp" #include "utilities/macros.hpp" @@ -272,13 +271,6 @@ } { - G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::FlatProfilerRoots, worker_i); - if (!_process_strong_tasks.is_task_claimed(G1RP_PS_FlatProfiler_oops_do)) { - FlatProfiler::oops_do(strong_roots); - } - } - - { G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_i); if (!_process_strong_tasks.is_task_claimed(G1RP_PS_Management_oops_do)) { Management::oops_do(strong_roots); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/g1/g1RootProcessor.hpp --- a/hotspot/src/share/vm/gc/g1/g1RootProcessor.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/g1/g1RootProcessor.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -57,7 +57,6 @@ G1RP_PS_Universe_oops_do, G1RP_PS_JNIHandles_oops_do, G1RP_PS_ObjectSynchronizer_oops_do, - G1RP_PS_FlatProfiler_oops_do, G1RP_PS_Management_oops_do, G1RP_PS_SystemDictionary_oops_do, G1RP_PS_ClassLoaderDataGraph_oops_do, diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/parallel/pcTasks.cpp --- a/hotspot/src/share/vm/gc/parallel/pcTasks.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/parallel/pcTasks.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -39,7 +39,6 @@ #include "oops/objArrayKlass.inline.hpp" #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/jniHandles.hpp" #include "runtime/thread.hpp" #include "runtime/vmThread.hpp" @@ -105,10 +104,6 @@ ObjectSynchronizer::oops_do(&mark_and_push_closure); break; - case flat_profiler: - FlatProfiler::oops_do(&mark_and_push_closure); - break; - case management: Management::oops_do(&mark_and_push_closure); break; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/parallel/pcTasks.hpp --- a/hotspot/src/share/vm/gc/parallel/pcTasks.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/parallel/pcTasks.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -94,12 +94,11 @@ jni_handles = 2, threads = 3, object_synchronizer = 4, - flat_profiler = 5, - management = 6, - jvmti = 7, - system_dictionary = 8, - class_loader_data = 9, - code_cache = 10 + management = 5, + jvmti = 6, + system_dictionary = 7, + class_loader_data = 8, + code_cache = 9 }; private: RootType _root_type; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp --- a/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/parallel/psMarkSweep.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -50,7 +50,6 @@ #include "logging/log.hpp" #include "oops/oop.inline.hpp" #include "runtime/biasedLocking.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/safepoint.hpp" #include "runtime/vmThread.hpp" #include "services/management.hpp" @@ -514,7 +513,6 @@ MarkingCodeBlobClosure each_active_code_blob(mark_and_push_closure(), !CodeBlobToOopClosure::FixRelocations); Threads::oops_do(mark_and_push_closure(), &each_active_code_blob); ObjectSynchronizer::oops_do(mark_and_push_closure()); - FlatProfiler::oops_do(mark_and_push_closure()); Management::oops_do(mark_and_push_closure()); JvmtiExport::oops_do(mark_and_push_closure()); SystemDictionary::always_strong_oops_do(mark_and_push_closure()); @@ -607,7 +605,6 @@ JNIHandles::oops_do(adjust_pointer_closure()); // Global (strong) JNI handles Threads::oops_do(adjust_pointer_closure(), NULL); ObjectSynchronizer::oops_do(adjust_pointer_closure()); - FlatProfiler::oops_do(adjust_pointer_closure()); Management::oops_do(adjust_pointer_closure()); JvmtiExport::oops_do(adjust_pointer_closure()); SystemDictionary::oops_do(adjust_pointer_closure()); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp --- a/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/parallel/psParallelCompact.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -60,7 +60,6 @@ #include "oops/objArrayKlass.inline.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/safepoint.hpp" #include "runtime/vmThread.hpp" #include "services/management.hpp" @@ -2086,7 +2085,6 @@ // We scan the thread roots in parallel Threads::create_thread_roots_marking_tasks(q); q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::object_synchronizer)); - q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::flat_profiler)); q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::management)); q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::system_dictionary)); q->enqueue(new MarkFromRootsTask(MarkFromRootsTask::class_loader_data)); @@ -2169,7 +2167,6 @@ JNIHandles::oops_do(&oop_closure); // Global (strong) JNI handles Threads::oops_do(&oop_closure, NULL); ObjectSynchronizer::oops_do(&oop_closure); - FlatProfiler::oops_do(&oop_closure); Management::oops_do(&oop_closure); JvmtiExport::oops_do(&oop_closure); SystemDictionary::oops_do(&oop_closure); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/parallel/psScavenge.cpp --- a/hotspot/src/share/vm/gc/parallel/psScavenge.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/parallel/psScavenge.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -49,7 +49,6 @@ #include "logging/log.hpp" #include "oops/oop.inline.hpp" #include "runtime/biasedLocking.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/handles.inline.hpp" #include "runtime/threadCritical.hpp" #include "runtime/vmThread.hpp" @@ -381,7 +380,6 @@ // We scan the thread roots in parallel Threads::create_thread_roots_tasks(q); q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::object_synchronizer)); - q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::flat_profiler)); q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::management)); q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::system_dictionary)); q->enqueue(new ScavengeRootsTask(ScavengeRootsTask::class_loader_data)); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/parallel/psTasks.cpp --- a/hotspot/src/share/vm/gc/parallel/psTasks.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/parallel/psTasks.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, 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 @@ -38,7 +38,6 @@ #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/oop.inline.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/thread.hpp" #include "runtime/vmThread.hpp" #include "services/management.hpp" @@ -74,10 +73,6 @@ ObjectSynchronizer::oops_do(&roots_closure); break; - case flat_profiler: - FlatProfiler::oops_do(&roots_closure); - break; - case system_dictionary: SystemDictionary::oops_do(&roots_closure); break; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/parallel/psTasks.hpp --- a/hotspot/src/share/vm/gc/parallel/psTasks.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/parallel/psTasks.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, 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 @@ -57,12 +57,11 @@ jni_handles = 2, threads = 3, object_synchronizer = 4, - flat_profiler = 5, - system_dictionary = 6, - class_loader_data = 7, - management = 8, - jvmti = 9, - code_cache = 10 + system_dictionary = 5, + class_loader_data = 6, + management = 7, + jvmti = 8, + code_cache = 9 }; private: RootType _root_type; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/serial/genMarkSweep.cpp --- a/hotspot/src/share/vm/gc/serial/genMarkSweep.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/serial/genMarkSweep.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -46,7 +46,6 @@ #include "oops/instanceRefKlass.hpp" #include "oops/oop.inline.hpp" #include "prims/jvmtiExport.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/handles.inline.hpp" #include "runtime/synchronizer.hpp" #include "runtime/thread.inline.hpp" diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp --- a/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/gc/shared/genCollectedHeap.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -47,7 +47,6 @@ #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" #include "runtime/biasedLocking.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/handles.hpp" #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" @@ -71,7 +70,6 @@ GCH_PS_Universe_oops_do, GCH_PS_JNIHandles_oops_do, GCH_PS_ObjectSynchronizer_oops_do, - GCH_PS_FlatProfiler_oops_do, GCH_PS_Management_oops_do, GCH_PS_SystemDictionary_oops_do, GCH_PS_ClassLoaderDataGraph_oops_do, @@ -606,9 +604,6 @@ if (!_process_strong_tasks->is_task_claimed(GCH_PS_ObjectSynchronizer_oops_do)) { ObjectSynchronizer::oops_do(strong_roots); } - if (!_process_strong_tasks->is_task_claimed(GCH_PS_FlatProfiler_oops_do)) { - FlatProfiler::oops_do(strong_roots); - } if (!_process_strong_tasks->is_task_claimed(GCH_PS_Management_oops_do)) { Management::oops_do(strong_roots); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/interpreter/rewriter.cpp --- a/hotspot/src/share/vm/interpreter/rewriter.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/interpreter/rewriter.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -109,6 +109,11 @@ MetadataFactory::free_metadata(loader_data, cache); _pool->set_cache(NULL); // so the verifier isn't confused } + + DEBUG_ONLY( + if (DumpSharedSpaces) { + cache->verify_just_initialized(); + }) } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/logging/logTag.hpp --- a/hotspot/src/share/vm/logging/logTag.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/logging/logTag.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -140,6 +140,7 @@ LOG_TAG(timer) \ LOG_TAG(update) \ LOG_TAG(unload) /* Trace unloading of classes */ \ + LOG_TAG(unshareable) \ LOG_TAG(verification) \ LOG_TAG(verify) \ LOG_TAG(vmoperation) \ diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/memory/metaspaceClosure.hpp --- a/hotspot/src/share/vm/memory/metaspaceClosure.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/memory/metaspaceClosure.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -275,7 +275,8 @@ address, bool, UniqueMetaspaceClosure::my_hash, // solaris compiler doesn't like: primitive_hash
    UniqueMetaspaceClosure::my_equals, // solaris compiler doesn't like: primitive_equals
    - 16384> _has_been_visited; + 15889, // prime number + ResourceObj::C_HEAP> _has_been_visited; }; #endif // SHARE_VM_MEMORY_METASPACE_ITERATOR_HPP diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/memory/metaspaceShared.cpp --- a/hotspot/src/share/vm/memory/metaspaceShared.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -374,25 +374,63 @@ // Global object for holding classes that have been loaded. Since this // is run at a safepoint just before exit, this is the entire set of classes. static GrowableArray* _global_klass_objects; + +static void collect_array_classes(Klass* k) { + _global_klass_objects->append_if_missing(k); + if (k->is_array_klass()) { + // Add in the array classes too + ArrayKlass* ak = ArrayKlass::cast(k); + Klass* h = ak->higher_dimension(); + if (h != NULL) { + h->array_klasses_do(collect_array_classes); + } + } +} + class CollectClassesClosure : public KlassClosure { void do_klass(Klass* k) { if (!(k->is_instance_klass() && InstanceKlass::cast(k)->is_in_error_state())) { _global_klass_objects->append_if_missing(k); } + if (k->is_array_klass()) { + // Add in the array classes too + ArrayKlass* ak = ArrayKlass::cast(k); + Klass* h = ak->higher_dimension(); + if (h != NULL) { + h->array_klasses_do(collect_array_classes); + } + } } }; static void remove_unshareable_in_classes() { for (int i = 0; i < _global_klass_objects->length(); i++) { Klass* k = _global_klass_objects->at(i); - k->remove_unshareable_info(); + if (!k->is_objArray_klass()) { + // InstanceKlass and TypeArrayKlass will in turn call remove_unshareable_info + // on their array classes. + assert(k->is_instance_klass() || k->is_typeArray_klass(), "must be"); + k->remove_unshareable_info(); + } + } +} + +static void remove_java_mirror_in_classes() { + for (int i = 0; i < _global_klass_objects->length(); i++) { + Klass* k = _global_klass_objects->at(i); + if (!k->is_objArray_klass()) { + // InstanceKlass and TypeArrayKlass will in turn call remove_unshareable_info + // on their array classes. + assert(k->is_instance_klass() || k->is_typeArray_klass(), "must be"); + k->remove_java_mirror(); + } } } static void rewrite_nofast_bytecode(Method* method) { - RawBytecodeStream bcs(method); + BytecodeStream bcs(method); while (!bcs.is_last_bytecode()) { - Bytecodes::Code opcode = bcs.raw_next(); + Bytecodes::Code opcode = bcs.next(); switch (opcode) { case Bytecodes::_getfield: *bcs.bcp() = Bytecodes::_nofast_getfield; break; case Bytecodes::_putfield: *bcs.bcp() = Bytecodes::_nofast_putfield; break; @@ -446,6 +484,17 @@ } } +NOT_PRODUCT( +static void assert_not_anonymous_class(InstanceKlass* k) { + assert(!(k->is_anonymous()), "cannot archive anonymous classes"); +} + +// Anonymous classes are not stored inside any dictionaries. They are created by +// SystemDictionary::parse_stream() with a non-null host_klass. +static void assert_no_anonymoys_classes_in_dictionaries() { + ClassLoaderDataGraph::dictionary_classes_do(assert_not_anonymous_class); +}) + // Objects of the Metadata types (such as Klass and ConstantPool) have C++ vtables. // (In GCC this is the field ::_vptr, i.e., first word in the object.) // @@ -957,8 +1006,8 @@ } memcpy(p, obj, bytes); bool isnew = _new_loc_table->put(obj, (address)p); + log_trace(cds)("Copy: " PTR_FORMAT " ==> " PTR_FORMAT " %d", p2i(obj), p2i(p), bytes); assert(isnew, "must be"); - log_trace(cds)("Copy: " PTR_FORMAT " ==> " PTR_FORMAT " %d", p2i(obj), p2i(p), bytes); _alloc_stats->record(ref->msotype(), int(newtop - oldtop), read_only); if (ref->msotype() == MetaspaceObj::SymbolType) { @@ -1151,6 +1200,9 @@ // Reorder the system dictionary. Moving the symbols affects // how the hash table indices are calculated. SystemDictionary::reorder_dictionary_for_sharing(); + tty->print("Removing java_mirror ... "); + remove_java_mirror_in_classes(); + tty->print_cr("done. "); NOT_PRODUCT(SystemDictionary::verify();) size_t buckets_bytes = SystemDictionary::count_bytes_for_buckets(); @@ -1218,11 +1270,20 @@ rewrite_nofast_bytecodes_and_calculate_fingerprints(); tty->print_cr("done. "); + // Move classes from platform/system dictionaries into the boot dictionary + SystemDictionary::combine_shared_dictionaries(); + // Remove all references outside the metadata tty->print("Removing unshareable information ... "); remove_unshareable_in_classes(); tty->print_cr("done. "); + // We don't support archiving anonymous classes. Verify that they are not stored in + // the any dictionaries. + NOT_PRODUCT(assert_no_anonymoys_classes_in_dictionaries()); + + SystemDictionaryShared::finalize_verification_constraints(); + ArchiveCompactor::initialize(); ArchiveCompactor::copy_and_compact(); @@ -1312,6 +1373,14 @@ ArchiveCompactor::alloc_stats()->print_stats(int(_ro_region.used()), int(_rw_region.used()), int(_mc_region.used()), int(_md_region.used())); } + + if (PrintSystemDictionaryAtExit) { + SystemDictionary::print(); + } + // There may be other pending VM operations that operate on the InstanceKlasses, + // which will fail because InstanceKlasses::remove_unshareable_info() + // has been called. Forget these operations and exit the VM directly. + vm_direct_exit(0); } void VM_PopulateDumpSharedSpace::print_region_stats() { @@ -1438,10 +1507,6 @@ exit(1); } } - - // Copy the verification constraints from C_HEAP-alloced GrowableArrays to RO-alloced - // Arrays - SystemDictionaryShared::finalize_verification_constraints(); } void MetaspaceShared::prepare_for_dumping() { @@ -1509,17 +1574,11 @@ link_and_cleanup_shared_classes(CATCH); tty->print_cr("Rewriting and linking classes: done"); + SystemDictionary::clear_invoke_method_table(); + VM_PopulateDumpSharedSpace op; VMThread::execute(&op); } - - if (PrintSystemDictionaryAtExit) { - SystemDictionary::print(); - } - - // Since various initialization steps have been undone by this process, - // it is not reasonable to continue running a java process. - exit(0); } @@ -1529,8 +1588,14 @@ while (parser.parse_one_line()) { Klass* klass = ClassLoaderExt::load_one_class(&parser, THREAD); - - CLEAR_PENDING_EXCEPTION; + if (HAS_PENDING_EXCEPTION) { + if (klass == NULL && + (PENDING_EXCEPTION->klass()->name() == vmSymbols::java_lang_ClassNotFoundException())) { + // print a warning only when the pending exception is class not found + tty->print_cr("Preload Warning: Cannot find %s", parser.current_class_name()); + } + CLEAR_PENDING_EXCEPTION; + } if (klass != NULL) { if (log_is_enabled(Trace, cds)) { ResourceMark rm; diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/memory/universe.cpp --- a/hotspot/src/share/vm/memory/universe.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/memory/universe.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -63,7 +63,6 @@ #include "runtime/atomic.hpp" #include "runtime/commandLineFlagConstraintList.hpp" #include "runtime/deoptimization.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/handles.inline.hpp" #include "runtime/init.hpp" #include "runtime/java.hpp" diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/oops/arrayKlass.cpp --- a/hotspot/src/share/vm/oops/arrayKlass.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/oops/arrayKlass.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -187,12 +187,29 @@ void ArrayKlass::remove_unshareable_info() { Klass::remove_unshareable_info(); + if (_higher_dimension != NULL) { + ArrayKlass *ak = ArrayKlass::cast(higher_dimension()); + ak->remove_unshareable_info(); + } +} + +void ArrayKlass::remove_java_mirror() { + Klass::remove_java_mirror(); + if (_higher_dimension != NULL) { + ArrayKlass *ak = ArrayKlass::cast(higher_dimension()); + ak->remove_java_mirror(); + } } void ArrayKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) { assert(loader_data == ClassLoaderData::the_null_class_loader_data(), "array classes belong to null loader"); Klass::restore_unshareable_info(loader_data, protection_domain, CHECK); // Klass recreates the component mirror also + + if (_higher_dimension != NULL) { + ArrayKlass *ak = ArrayKlass::cast(higher_dimension()); + ak->restore_unshareable_info(loader_data, protection_domain, CHECK); + } } // Printing diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/oops/arrayKlass.hpp --- a/hotspot/src/share/vm/oops/arrayKlass.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/oops/arrayKlass.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -130,6 +130,7 @@ // CDS support - remove and restore oops from metadata. Oops are not shared. virtual void remove_unshareable_info(); + virtual void remove_java_mirror(); virtual void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS); // Printing diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/oops/constantPool.cpp --- a/hotspot/src/share/vm/oops/constantPool.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/oops/constantPool.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -89,8 +89,6 @@ void ConstantPool::deallocate_contents(ClassLoaderData* loader_data) { if (cache() != NULL) { - MetadataFactory::free_array(loader_data, reference_map()); - set_reference_map(NULL); MetadataFactory::free_metadata(loader_data, cache()); set_cache(NULL); } @@ -259,10 +257,14 @@ } objArrayOop rr = resolved_references(); + Array* ref_map = reference_map(); if (rr != NULL) { - for (int i = 0; i < rr->length(); i++) { + int ref_map_len = ref_map == NULL ? 0 : ref_map->length(); + int rr_len = rr->length(); + for (int i = 0; i < rr_len; i++) { oop p = rr->obj_at(i); - if (p != NULL) { + rr->obj_at_put(i, NULL); + if (p != NULL && i < ref_map_len) { int index = object_to_cp_index(i); // Skip the entry if the string hash code is 0 since the string // is not included in the shared string_table, see StringTable::copy_shared_string. @@ -273,11 +275,10 @@ // have a 'bad' reference in the archived resolved_reference // array. rr->obj_at_put(i, op); - } else { - rr->obj_at_put(i, NULL); } } } + oop archived = MetaspaceShared::archive_heap_object(rr, THREAD); _cache->set_archived_references(archived); set_resolved_references(NULL); @@ -348,6 +349,26 @@ // class redefinition. Since shared ConstantPools cannot be deallocated anyway, // we always set _on_stack to true to avoid having to change _flags during runtime. _flags |= (_on_stack | _is_shared); + int num_klasses = 0; + for (int index = 1; index < length(); index++) { // Index 0 is unused + assert(!tag_at(index).is_unresolved_klass_in_error(), "This must not happen during dump time"); + if (tag_at(index).is_klass()) { + // This class was resolved as a side effect of executing Java code + // during dump time. We need to restore it back to an UnresolvedClass, + // so that the proper class loading and initialization can happen + // at runtime. + CPKlassSlot kslot = klass_slot_at(index); + int resolved_klass_index = kslot.resolved_klass_index(); + int name_index = kslot.name_index(); + assert(tag_at(name_index).is_symbol(), "sanity"); + resolved_klasses()->at_put(resolved_klass_index, NULL); + tag_at_put(index, JVM_CONSTANT_UnresolvedClass); + assert(klass_name_at(index) == symbol_at(name_index), "sanity"); + } + } + if (cache() != NULL) { + cache()->remove_unshareable_info(); + } } int ConstantPool::cp_to_object_index(int cp_index) { diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/oops/cpCache.cpp --- a/hotspot/src/share/vm/oops/cpCache.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/oops/cpCache.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -23,9 +23,12 @@ */ #include "precompiled.hpp" +#include "interpreter/bytecodeStream.hpp" +#include "interpreter/bytecodes.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/rewriter.hpp" #include "logging/log.hpp" +#include "memory/metadataFactory.hpp" #include "memory/metaspaceClosure.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.inline.hpp" @@ -48,6 +51,24 @@ assert(constant_pool_index() == index, ""); } +void ConstantPoolCacheEntry::verify_just_initialized(bool f2_used) { + assert((_indices & (~cp_index_mask)) == 0, "sanity"); + assert(_f1 == NULL, "sanity"); + assert(_flags == 0, "sanity"); + if (!f2_used) { + assert(_f2 == 0, "sanity"); + } +} + +void ConstantPoolCacheEntry::reinitialize(bool f2_used) { + _indices &= cp_index_mask; + _f1 = NULL; + _flags = 0; + if (!f2_used) { + _f2 = 0; + } +} + int ConstantPoolCacheEntry::make_flags(TosState state, int option_bits, int field_index_or_method_params) { @@ -608,6 +629,74 @@ } } +void ConstantPoolCache::verify_just_initialized() { + DEBUG_ONLY(walk_entries_for_initialization(/*check_only = */ true)); +} + +void ConstantPoolCache::remove_unshareable_info() { + walk_entries_for_initialization(/*check_only = */ false); +} + +void ConstantPoolCache::walk_entries_for_initialization(bool check_only) { + assert(DumpSharedSpaces, "sanity"); + // When dumping the archive, we want to clean up the ConstantPoolCache + // to remove any effect of linking due to the execution of Java code -- + // each ConstantPoolCacheEntry will have the same contents as if + // ConstantPoolCache::initialize has just returned: + // + // - We keep the ConstantPoolCache::constant_pool_index() bits for all entries. + // - We keep the "f2" field for entries used by invokedynamic and invokehandle + // - All other bits in the entries are cleared to zero. + ResourceMark rm; + + InstanceKlass* ik = constant_pool()->pool_holder(); + bool* f2_used = NEW_RESOURCE_ARRAY(bool, length()); + memset(f2_used, 0, sizeof(bool) * length()); + + // Find all the slots that we need to preserve f2 + for (int i = 0; i < ik->methods()->length(); i++) { + Method* m = ik->methods()->at(i); + RawBytecodeStream bcs(m); + while (!bcs.is_last_bytecode()) { + Bytecodes::Code opcode = bcs.raw_next(); + switch (opcode) { + case Bytecodes::_invokedynamic: { + int index = Bytes::get_native_u4(bcs.bcp() + 1); + int cp_cache_index = constant_pool()->invokedynamic_cp_cache_index(index); + f2_used[cp_cache_index] = 1; + } + break; + case Bytecodes::_invokehandle: { + int cp_cache_index = Bytes::get_native_u2(bcs.bcp() + 1); + f2_used[cp_cache_index] = 1; + } + break; + default: + break; + } + } + } + + if (check_only) { + DEBUG_ONLY( + for (int i=0; iverify_just_initialized(f2_used[i]); + }) + } else { + for (int i=0; ireinitialize(f2_used[i]); + } + } +} + +void ConstantPoolCache::deallocate_contents(ClassLoaderData* data) { + assert(!is_shared(), "shared caches are not deallocated"); + data->remove_handle(_resolved_references); + set_resolved_references(NULL); + MetadataFactory::free_array(data, _reference_map); + set_reference_map(NULL); +} + #if INCLUDE_CDS_JAVA_HEAP oop ConstantPoolCache::archived_references() { assert(UseSharedSpaces, "UseSharedSpaces expected."); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/oops/cpCache.hpp --- a/hotspot/src/share/vm/oops/cpCache.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/oops/cpCache.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -393,6 +393,9 @@ // When shifting flags as a 32-bit int, make sure we don't need an extra mask for tos_state: assert((((u4)-1 >> tos_state_shift) & ~tos_state_mask) == 0, "no need for tos_state mask"); } + + void verify_just_initialized(bool f2_used); + void reinitialize(bool f2_used); }; @@ -464,7 +467,11 @@ // Assembly code support static int resolved_references_offset_in_bytes() { return offset_of(ConstantPoolCache, _resolved_references); } + // CDS support + void remove_unshareable_info(); + void verify_just_initialized(); private: + void walk_entries_for_initialization(bool check_only); void set_length(int length) { _length = length; } static int header_size() { return sizeof(ConstantPoolCache) / wordSize; } @@ -510,9 +517,9 @@ void dump_cache(); #endif // INCLUDE_JVMTI - // Deallocate - no fields to deallocate + // RedefineClasses support DEBUG_ONLY(bool on_stack() { return false; }) - void deallocate_contents(ClassLoaderData* data) {} + void deallocate_contents(ClassLoaderData* data); bool is_klass() const { return false; } // Printing diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/oops/instanceKlass.cpp --- a/hotspot/src/share/vm/oops/instanceKlass.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/oops/instanceKlass.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -747,10 +747,10 @@ char* message = NEW_RESOURCE_ARRAY(char, msglen); if (NULL == message) { // Out of memory: can't create detailed error message - THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), className); + THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), className); } else { jio_snprintf(message, msglen, "%s%s", desc, className); - THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), message); + THROW_MSG(vmSymbols::java_lang_NoClassDefFoundError(), message); } } @@ -2067,14 +2067,14 @@ m->remove_unshareable_info(); } + // do array classes also. + if (array_klasses() != NULL) { + array_klasses()->remove_unshareable_info(); + } + // These are not allocated from metaspace, but they should should all be empty - // during dump time, so we don't need to worry about them in InstanceKlass::metaspace_pointers_do(). + // during dump time, so we don't need to worry about them in InstanceKlass::iterate(). guarantee(_source_debug_extension == NULL, "must be"); - guarantee(_oop_map_cache == NULL, "must be"); - guarantee(_init_thread == NULL, "must be"); - guarantee(_oop_map_cache == NULL, "must be"); - guarantee(_jni_ids == NULL, "must be"); - guarantee(_methods_jmethod_ids == NULL, "must be"); guarantee(_dep_context == DependencyContext::EMPTY, "must be"); guarantee(_osr_nmethods_head == NULL, "must be"); @@ -2082,12 +2082,20 @@ guarantee(_breakpoints == NULL, "must be"); guarantee(_previous_versions == NULL, "must be"); #endif + + _init_thread = NULL; + _methods_jmethod_ids = NULL; + _jni_ids = NULL; + _oop_map_cache = NULL; } -static void restore_unshareable_in_class(Klass* k, TRAPS) { - // Array classes have null protection domain. - // --> see ArrayKlass::complete_create_array_klass() - k->restore_unshareable_info(ClassLoaderData::the_null_class_loader_data(), Handle(), CHECK); +void InstanceKlass::remove_java_mirror() { + Klass::remove_java_mirror(); + + // do array classes also. + if (array_klasses() != NULL) { + array_klasses()->remove_java_mirror(); + } } void InstanceKlass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) { @@ -2114,7 +2122,11 @@ // restore constant pool resolved references constants()->restore_unshareable_info(CHECK); - array_klasses_do(restore_unshareable_in_class, CHECK); + if (array_klasses() != NULL) { + // Array classes have null protection domain. + // --> see ArrayKlass::complete_create_array_klass() + array_klasses()->restore_unshareable_info(ClassLoaderData::the_null_class_loader_data(), Handle(), CHECK); + } } // returns true IFF is_in_error_state() has been changed as a result of this call. diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/oops/instanceKlass.hpp --- a/hotspot/src/share/vm/oops/instanceKlass.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/oops/instanceKlass.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -327,8 +327,6 @@ } void set_class_loader_type(s2 loader_type) { - assert(( _misc_flags & loader_type_bits()) == 0, - "Should only be called once for each class."); switch (loader_type) { case ClassLoader::BOOT_LOADER: _misc_flags |= _misc_is_shared_boot_class; @@ -1335,6 +1333,7 @@ public: // CDS support - remove and restore oops from metadata. Oops are not shared. virtual void remove_unshareable_info(); + virtual void remove_java_mirror(); virtual void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS); // jvm support diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/oops/klass.cpp --- a/hotspot/src/share/vm/oops/klass.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/oops/klass.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -512,11 +512,13 @@ void Klass::remove_unshareable_info() { assert (DumpSharedSpaces, "only called for DumpSharedSpaces"); TRACE_REMOVE_ID(this); + if (log_is_enabled(Trace, cds, unshareable)) { + ResourceMark rm; + log_trace(cds, unshareable)("remove: %s", external_name()); + } set_subklass(NULL); set_next_sibling(NULL); - // Clear the java mirror - set_java_mirror(NULL); set_next_link(NULL); // Null out class_loader_data because we don't share that yet. @@ -524,10 +526,23 @@ set_is_shared(); } +void Klass::remove_java_mirror() { + assert (DumpSharedSpaces, "only called for DumpSharedSpaces"); + if (log_is_enabled(Trace, cds, unshareable)) { + ResourceMark rm; + log_trace(cds, unshareable)("remove java_mirror: %s", external_name()); + } + set_java_mirror(NULL); +} + void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) { assert(is_klass(), "ensure C++ vtable is restored"); assert(is_shared(), "must be set"); TRACE_RESTORE_ID(this); + if (log_is_enabled(Trace, cds, unshareable)) { + ResourceMark rm; + log_trace(cds, unshareable)("restore: %s", external_name()); + } // If an exception happened during CDS restore, some of these fields may already be // set. We leave the class on the CLD list, even if incomplete so that we don't diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/oops/klass.hpp --- a/hotspot/src/share/vm/oops/klass.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/oops/klass.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -479,6 +479,7 @@ // CDS support - remove and restore oops from metadata. Oops are not shared. virtual void remove_unshareable_info(); + virtual void remove_java_mirror(); virtual void restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS); protected: diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/oops/method.cpp --- a/hotspot/src/share/vm/oops/method.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/oops/method.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -944,10 +944,6 @@ _from_compiled_entry = cds_adapter->get_c2i_entry_trampoline(); assert(*((int*)_from_compiled_entry) == 0, "must be NULL during dump time, to be initialized at run time"); - - // In case of DumpSharedSpaces, _method_data should always be NULL. - assert(_method_data == NULL, "unexpected method data?"); - set_method_data(NULL); clear_method_counters(); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/oops/oopHandle.hpp --- a/hotspot/src/share/vm/oops/oopHandle.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/oops/oopHandle.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -46,6 +46,9 @@ OopHandle(oop* w) : _obj(w) {} oop resolve() const { return (_obj == NULL) ? (oop)NULL : *_obj; } + + // Used only for removing handle. + oop* ptr_raw() { return _obj; } }; #endif // SHARE_VM_OOPS_OOPHANDLE_HPP diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/opto/runtime.cpp --- a/hotspot/src/share/vm/opto/runtime.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/opto/runtime.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -61,7 +61,6 @@ #include "opto/runtime.hpp" #include "opto/subnode.hpp" #include "runtime/atomic.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/handles.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/javaCalls.hpp" diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/prims/jni.cpp --- a/hotspot/src/share/vm/prims/jni.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/prims/jni.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -62,7 +62,6 @@ #include "runtime/atomic.hpp" #include "runtime/compilationPolicy.hpp" #include "runtime/fieldDescriptor.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/handles.inline.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/java.hpp" diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/prims/jvmtiExport.cpp --- a/hotspot/src/share/vm/prims/jvmtiExport.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -2497,14 +2497,13 @@ library = os::dll_load(agent, ebuf, sizeof ebuf); } else { // Try to load the agent from the standard dll directory - if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), + if (os::dll_locate_lib(buffer, sizeof(buffer), Arguments::get_dll_dir(), agent)) { library = os::dll_load(buffer, ebuf, sizeof ebuf); } if (library == NULL) { - // not found - try local path - char ns[1] = {0}; - if (os::dll_build_name(buffer, sizeof(buffer), ns, agent)) { + // not found - try OS default library path + if (os::dll_build_name(buffer, sizeof(buffer), agent)) { library = os::dll_load(buffer, ebuf, sizeof ebuf); } } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/arguments.cpp --- a/hotspot/src/share/vm/runtime/arguments.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/runtime/arguments.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -78,7 +78,6 @@ char* Arguments::_java_command = NULL; SystemProperty* Arguments::_system_properties = NULL; const char* Arguments::_gc_log_filename = NULL; -bool Arguments::_has_profile = false; size_t Arguments::_conservative_max_heap_alignment = 0; size_t Arguments::_min_heap_size = 0; Arguments::Mode Arguments::_mode = _mixed; @@ -379,6 +378,9 @@ { "MaxGCMinorPauseMillis", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() }, { "UseConcMarkSweepGC", JDK_Version::jdk(9), JDK_Version::undefined(), JDK_Version::undefined() }, { "MonitorInUseLists", JDK_Version::jdk(10),JDK_Version::undefined(), JDK_Version::undefined() }, + { "MaxRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, + { "MinRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, + { "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() }, // --- Deprecated alias flags (see also aliased_jvm_flags) - sorted by obsolete_in then expired_in: { "DefaultMaxRAMFraction", JDK_Version::jdk(8), JDK_Version::undefined(), JDK_Version::undefined() }, @@ -1291,13 +1293,11 @@ "jdk.module.limitmods", "jdk.module.path", "jdk.module.upgrade.path", - "jdk.module.addmods.0", "jdk.module.patch.0" }; const char* unsupported_options[] = { "-m", // cannot use at dump time "--limit-modules", // ignored at dump time "--module-path", // ignored at dump time "--upgrade-module-path", // ignored at dump time - "--add-modules", // ignored at dump time "--patch-module" // ignored at dump time }; assert(ARRAY_SIZE(unsupported_properties) == ARRAY_SIZE(unsupported_options), "must be"); @@ -2069,20 +2069,33 @@ } } + // Convert deprecated flags + if (FLAG_IS_DEFAULT(MaxRAMPercentage) && + !FLAG_IS_DEFAULT(MaxRAMFraction)) + MaxRAMPercentage = 100.0 / MaxRAMFraction; + + if (FLAG_IS_DEFAULT(MinRAMPercentage) && + !FLAG_IS_DEFAULT(MinRAMFraction)) + MinRAMPercentage = 100.0 / MinRAMFraction; + + if (FLAG_IS_DEFAULT(InitialRAMPercentage) && + !FLAG_IS_DEFAULT(InitialRAMFraction)) + InitialRAMPercentage = 100.0 / InitialRAMFraction; + // If the maximum heap size has not been set with -Xmx, // then set it as fraction of the size of physical memory, // respecting the maximum and minimum sizes of the heap. if (FLAG_IS_DEFAULT(MaxHeapSize)) { - julong reasonable_max = phys_mem / MaxRAMFraction; - - if (phys_mem <= MaxHeapSize * MinRAMFraction) { + julong reasonable_max = (julong)((phys_mem * MaxRAMPercentage) / 100); + if (phys_mem <= (julong)((MaxHeapSize * MinRAMPercentage) / 100)) { // Small physical memory, so use a minimum fraction of it for the heap - reasonable_max = phys_mem / MinRAMFraction; + reasonable_max = (julong)((phys_mem * MinRAMPercentage) / 100); } else { // Not-small physical memory, so require a heap at least // as large as MaxHeapSize reasonable_max = MAX2(reasonable_max, (julong)MaxHeapSize); } + if (!FLAG_IS_DEFAULT(ErgoHeapSizeLimit) && ErgoHeapSizeLimit != 0) { // Limit the heap size to ErgoHeapSizeLimit reasonable_max = MIN2(reasonable_max, (julong)ErgoHeapSizeLimit); @@ -2135,7 +2148,7 @@ reasonable_minimum = limit_by_allocatable_memory(reasonable_minimum); if (InitialHeapSize == 0) { - julong reasonable_initial = phys_mem / InitialRAMFraction; + julong reasonable_initial = (julong)((phys_mem * InitialRAMPercentage) / 100); reasonable_initial = MAX3(reasonable_initial, reasonable_minimum, (julong)min_heap_size()); reasonable_initial = MIN2(reasonable_initial, (julong)MaxHeapSize); @@ -2667,17 +2680,11 @@ } // Do final processing now that all arguments have been parsed - result = finalize_vm_init_args(); + result = finalize_vm_init_args(patch_mod_javabase); if (result != JNI_OK) { return result; } -#if INCLUDE_CDS - if (UseSharedSpaces && patch_mod_javabase) { - no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched."); - } -#endif - return JNI_OK; } @@ -3152,16 +3159,12 @@ if (FLAG_SET_CMDLINE(bool, ReduceSignalUsage, true) != Flag::SUCCESS) { return JNI_EINVAL; } - // -Xprof + // -Xprof } else if (match_option(option, "-Xprof")) { -#if INCLUDE_FPROF - log_warning(arguments)("Option -Xprof was deprecated in version 9 and will likely be removed in a future release."); - _has_profile = true; -#else // INCLUDE_FPROF - jio_fprintf(defaultStream::error_stream(), - "Flat profiling is not supported in this VM.\n"); - return JNI_ERR; -#endif // INCLUDE_FPROF + char version[256]; + // Obsolete in JDK 10 + JDK_Version::jdk(10).to_string(version, sizeof(version)); + warning("Ignoring option %s; support was removed in %s", option->optionString, version); // -Xconcurrentio } else if (match_option(option, "-Xconcurrentio")) { if (FLAG_SET_CMDLINE(bool, UseLWPSynchronization, true) != Flag::SUCCESS) { @@ -3602,7 +3605,7 @@ return nonEmptyDirs; } -jint Arguments::finalize_vm_init_args() { +jint Arguments::finalize_vm_init_args(bool patch_mod_javabase) { // check if the default lib/endorsed directory exists; if so, error char path[JVM_MAXPATHLEN]; const char* fileSep = os::file_separator(); @@ -3723,6 +3726,17 @@ } #endif +#if INCLUDE_CDS + if (DumpSharedSpaces) { + // Disable biased locking now as it interferes with the clean up of + // the archived Klasses and Java string objects (at dump time only). + UseBiasedLocking = false; + } + if (UseSharedSpaces && patch_mod_javabase) { + no_shared_spaces("CDS is disabled when " JAVA_BASE_NAME " module is patched."); + } +#endif + return JNI_OK; } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/arguments.hpp --- a/hotspot/src/share/vm/runtime/arguments.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/runtime/arguments.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -412,7 +412,6 @@ static bool _sun_java_launcher_is_altjvm; // Option flags - static bool _has_profile; static const char* _gc_log_filename; // Value of the conservative maximum heap alignment needed static size_t _conservative_max_heap_alignment; @@ -536,7 +535,7 @@ const JavaVMInitArgs *java_options_args, const JavaVMInitArgs *cmd_line_args); static jint parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_mod_javabase, Flag::Flags origin); - static jint finalize_vm_init_args(); + static jint finalize_vm_init_args(bool patch_mod_javabase); static bool is_bad_option(const JavaVMOption* option, jboolean ignore, const char* option_type); static bool is_bad_option(const JavaVMOption* option, jboolean ignore) { @@ -696,9 +695,6 @@ // -Dsun.java.launcher.pid static int sun_java_launcher_pid() { return _sun_java_launcher_pid; } - // -Xprof - static bool has_profile() { return _has_profile; } - // -Xms static size_t min_heap_size() { return _min_heap_size; } static void set_min_heap_size(size_t v) { _min_heap_size = v; } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/arguments_ext.hpp --- a/hotspot/src/share/vm/runtime/arguments_ext.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/runtime/arguments_ext.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2017, 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 @@ -36,6 +36,7 @@ // Otherwise returns false. static inline bool process_options(const JavaVMOption *option) { return false; } static inline void report_unsupported_options() { } + static inline bool using_AppCDS() { return false; } }; void ArgumentsExt::set_gc_specific_flags() { diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/fprofiler.cpp --- a/hotspot/src/share/vm/runtime/fprofiler.cpp Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1623 +0,0 @@ -/* - * Copyright (c) 1997, 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#include "precompiled.hpp" -#include "classfile/classLoader.hpp" -#include "code/codeCache.hpp" -#include "code/vtableStubs.hpp" -#include "gc/shared/collectedHeap.inline.hpp" -#include "interpreter/interpreter.hpp" -#include "memory/allocation.inline.hpp" -#include "memory/resourceArea.hpp" -#include "memory/universe.inline.hpp" -#include "oops/oop.inline.hpp" -#include "oops/symbol.hpp" -#include "runtime/deoptimization.hpp" -#include "runtime/fprofiler.hpp" -#include "runtime/mutexLocker.hpp" -#include "runtime/stubCodeGenerator.hpp" -#include "runtime/stubRoutines.hpp" -#include "runtime/task.hpp" -#include "runtime/thread.inline.hpp" -#include "runtime/vframe.hpp" -#include "utilities/macros.hpp" - -// Static fields of FlatProfiler -int FlatProfiler::received_gc_ticks = 0; -int FlatProfiler::vm_operation_ticks = 0; -int FlatProfiler::threads_lock_ticks = 0; -int FlatProfiler::class_loader_ticks = 0; -int FlatProfiler::extra_ticks = 0; -int FlatProfiler::blocked_ticks = 0; -int FlatProfiler::deopt_ticks = 0; -int FlatProfiler::unknown_ticks = 0; -int FlatProfiler::interpreter_ticks = 0; -int FlatProfiler::compiler_ticks = 0; -int FlatProfiler::received_ticks = 0; -int FlatProfiler::delivered_ticks = 0; -int* FlatProfiler::bytecode_ticks = NULL; -int* FlatProfiler::bytecode_ticks_stub = NULL; -int FlatProfiler::all_int_ticks = 0; -int FlatProfiler::all_comp_ticks = 0; -int FlatProfiler::all_ticks = 0; -bool FlatProfiler::full_profile_flag = false; -ThreadProfiler* FlatProfiler::thread_profiler = NULL; -ThreadProfiler* FlatProfiler::vm_thread_profiler = NULL; -FlatProfilerTask* FlatProfiler::task = NULL; -elapsedTimer FlatProfiler::timer; -int FlatProfiler::interval_ticks_previous = 0; -IntervalData* FlatProfiler::interval_data = NULL; - -ThreadProfiler::ThreadProfiler() { - // Space for the ProfilerNodes - const int area_size = 1 * ProfilerNodeSize * 1024; - area_bottom = AllocateHeap(area_size, mtInternal); - area_top = area_bottom; - area_limit = area_bottom + area_size; - - // ProfilerNode pointer table - table = NEW_C_HEAP_ARRAY(ProfilerNode*, table_size, mtInternal); - initialize(); - engaged = false; -} - -ThreadProfiler::~ThreadProfiler() { - FreeHeap(area_bottom); - area_bottom = NULL; - area_top = NULL; - area_limit = NULL; - FreeHeap(table); - table = NULL; -} - -// Statics for ThreadProfiler -int ThreadProfiler::table_size = 1024; - -int ThreadProfiler::entry(int value) { - value = (value > 0) ? value : -value; - return value % table_size; -} - -ThreadProfilerMark::ThreadProfilerMark(ThreadProfilerMark::Region r) { - _r = r; - _pp = NULL; - assert(((r > ThreadProfilerMark::noRegion) && (r < ThreadProfilerMark::maxRegion)), "ThreadProfilerMark::Region out of bounds"); - Thread* tp = Thread::current(); - if (tp != NULL && tp->is_Java_thread()) { - JavaThread* jtp = (JavaThread*) tp; - ThreadProfiler* pp = jtp->get_thread_profiler(); - _pp = pp; - if (pp != NULL) { - pp->region_flag[r] = true; - } - } -} - -ThreadProfilerMark::~ThreadProfilerMark() { - if (_pp != NULL) { - _pp->region_flag[_r] = false; - } - _pp = NULL; -} - -// Random other statics -static const int col1 = 2; // position of output column 1 -static const int col2 = 11; // position of output column 2 -static const int col3 = 25; // position of output column 3 -static const int col4 = 55; // position of output column 4 - - -// Used for detailed profiling of nmethods. -class PCRecorder : AllStatic { - private: - static int* counters; - static address base; - enum { - bucket_size = 16 - }; - static int index_for(address pc) { return (pc - base)/bucket_size; } - static address pc_for(int index) { return base + (index * bucket_size); } - static int size() { - return ((int)CodeCache::max_capacity())/bucket_size * BytesPerWord; - } - public: - static address bucket_start_for(address pc) { - if (counters == NULL) return NULL; - return pc_for(index_for(pc)); - } - static int bucket_count_for(address pc) { return counters[index_for(pc)]; } - static void init(); - static void record(address pc); - static void print(); - static void print_blobs(CodeBlob* cb); -}; - -int* PCRecorder::counters = NULL; -address PCRecorder::base = NULL; - -void PCRecorder::init() { - MutexLockerEx lm(CodeCache_lock, Mutex::_no_safepoint_check_flag); - int s = size(); - counters = NEW_C_HEAP_ARRAY(int, s, mtInternal); - for (int index = 0; index < s; index++) { - counters[index] = 0; - } - base = CodeCache::low_bound(); -} - -void PCRecorder::record(address pc) { - if (counters == NULL) return; - assert(CodeCache::contains(pc), "must be in CodeCache"); - counters[index_for(pc)]++; -} - - -address FlatProfiler::bucket_start_for(address pc) { - return PCRecorder::bucket_start_for(pc); -} - -int FlatProfiler::bucket_count_for(address pc) { - return PCRecorder::bucket_count_for(pc); -} - -void PCRecorder::print() { - if (counters == NULL) return; - - tty->cr(); - tty->print_cr("Printing compiled methods with PC buckets having more than " INTX_FORMAT " ticks", ProfilerPCTickThreshold); - tty->print_cr("==================================================================="); - tty->cr(); - - GrowableArray* candidates = new GrowableArray(20); - - - int s; - { - MutexLockerEx lm(CodeCache_lock, Mutex::_no_safepoint_check_flag); - s = size(); - } - - for (int index = 0; index < s; index++) { - int count = counters[index]; - if (count > ProfilerPCTickThreshold) { - address pc = pc_for(index); - CodeBlob* cb = CodeCache::find_blob_unsafe(pc); - if (cb != NULL && candidates->find(cb) < 0) { - candidates->push(cb); - } - } - } - for (int i = 0; i < candidates->length(); i++) { - print_blobs(candidates->at(i)); - } -} - -void PCRecorder::print_blobs(CodeBlob* cb) { - if (cb != NULL) { - cb->print(); - if (cb->is_nmethod()) { - ((nmethod*)cb)->print_code(); - } - tty->cr(); - } else { - tty->print_cr("stub code"); - } -} - -class tick_counter { // holds tick info for one node - public: - int ticks_in_code; - int ticks_in_native; - - tick_counter() { ticks_in_code = ticks_in_native = 0; } - tick_counter(int code, int native) { ticks_in_code = code; ticks_in_native = native; } - - int total() const { - return (ticks_in_code + ticks_in_native); - } - - void add(tick_counter* a) { - ticks_in_code += a->ticks_in_code; - ticks_in_native += a->ticks_in_native; - } - - void update(TickPosition where) { - switch(where) { - case tp_code: ticks_in_code++; break; - case tp_native: ticks_in_native++; break; - } - } - - void print_code(outputStream* st, int total_ticks) { - st->print("%5.1f%% %5d ", total() * 100.0 / total_ticks, ticks_in_code); - } - - void print_native(outputStream* st) { - st->print(" + %5d ", ticks_in_native); - } -}; - -class ProfilerNode { - private: - ProfilerNode* _next; - public: - tick_counter ticks; - - public: - - void* operator new(size_t size, ThreadProfiler* tp) throw(); - void operator delete(void* p); - - ProfilerNode() { - _next = NULL; - } - - virtual ~ProfilerNode() { - if (_next) - delete _next; - } - - void set_next(ProfilerNode* n) { _next = n; } - ProfilerNode* next() { return _next; } - - void update(TickPosition where) { ticks.update(where);} - int total_ticks() { return ticks.total(); } - - virtual bool is_interpreted() const { return false; } - virtual bool is_compiled() const { return false; } - virtual bool is_stub() const { return false; } - virtual bool is_runtime_stub() const{ return false; } - virtual void oops_do(OopClosure* f) = 0; - - virtual bool interpreted_match(Method* m) const { return false; } - virtual bool compiled_match(Method* m ) const { return false; } - virtual bool stub_match(Method* m, const char* name) const { return false; } - virtual bool adapter_match() const { return false; } - virtual bool runtimeStub_match(const CodeBlob* stub, const char* name) const { return false; } - virtual bool unknown_compiled_match(const CodeBlob* cb) const { return false; } - - static void print_title(outputStream* st) { - st->print(" + native"); - st->fill_to(col3); - st->print("Method"); - st->fill_to(col4); - st->cr(); - } - - static void print_total(outputStream* st, tick_counter* t, int total, const char* msg) { - t->print_code(st, total); - st->fill_to(col2); - t->print_native(st); - st->fill_to(col3); - st->print("%s", msg); - st->cr(); - } - - virtual Method* method() = 0; - - virtual void print_method_on(outputStream* st) { - int limit; - int i; - Method* m = method(); - Symbol* k = m->klass_name(); - // Print the class name with dots instead of slashes - limit = k->utf8_length(); - for (i = 0 ; i < limit ; i += 1) { - char c = (char) k->byte_at(i); - if (c == '/') { - c = '.'; - } - st->print("%c", c); - } - if (limit > 0) { - st->print("."); - } - Symbol* n = m->name(); - limit = n->utf8_length(); - for (i = 0 ; i < limit ; i += 1) { - char c = (char) n->byte_at(i); - st->print("%c", c); - } - if (Verbose || WizardMode) { - // Disambiguate overloaded methods - Symbol* sig = m->signature(); - sig->print_symbol_on(st); - } else if (MethodHandles::is_signature_polymorphic(m->intrinsic_id())) - // compare with Method::print_short_name - MethodHandles::print_as_basic_type_signature_on(st, m->signature(), true); - } - - virtual void print(outputStream* st, int total_ticks) { - ticks.print_code(st, total_ticks); - st->fill_to(col2); - ticks.print_native(st); - st->fill_to(col3); - print_method_on(st); - st->cr(); - } - - // for hashing into the table - static int hash(Method* method) { - // The point here is to try to make something fairly unique - // out of the fields we can read without grabbing any locks - // since the method may be locked when we need the hash. - return ( - method->code_size() ^ - method->max_stack() ^ - method->max_locals() ^ - method->size_of_parameters()); - } - - // for sorting - static int compare(ProfilerNode** a, ProfilerNode** b) { - return (*b)->total_ticks() - (*a)->total_ticks(); - } -}; - -void* ProfilerNode::operator new(size_t size, ThreadProfiler* tp) throw() { - void* result = (void*) tp->area_top; - tp->area_top += size; - - if (tp->area_top > tp->area_limit) { - fatal("flat profiler buffer overflow"); - } - return result; -} - -void ProfilerNode::operator delete(void* p){ -} - -class interpretedNode : public ProfilerNode { - private: - Method* _method; - oop _class_loader; // needed to keep metadata for the method alive - public: - interpretedNode(Method* method, TickPosition where) : ProfilerNode() { - _method = method; - _class_loader = method->method_holder()->class_loader(); - update(where); - } - - bool is_interpreted() const { return true; } - - bool interpreted_match(Method* m) const { - return _method == m; - } - - void oops_do(OopClosure* f) { - f->do_oop(&_class_loader); - } - - Method* method() { return _method; } - - static void print_title(outputStream* st) { - st->fill_to(col1); - st->print("%11s", "Interpreted"); - ProfilerNode::print_title(st); - } - - void print(outputStream* st, int total_ticks) { - ProfilerNode::print(st, total_ticks); - } - - void print_method_on(outputStream* st) { - ProfilerNode::print_method_on(st); - MethodCounters* mcs = method()->method_counters(); - if (Verbose && mcs != NULL) mcs->invocation_counter()->print_short(); - } -}; - -class compiledNode : public ProfilerNode { - private: - Method* _method; - oop _class_loader; // needed to keep metadata for the method alive - public: - compiledNode(Method* method, TickPosition where) : ProfilerNode() { - _method = method; - _class_loader = method->method_holder()->class_loader(); - update(where); - } - bool is_compiled() const { return true; } - - bool compiled_match(Method* m) const { - return _method == m; - } - - Method* method() { return _method; } - - void oops_do(OopClosure* f) { - f->do_oop(&_class_loader); - } - - static void print_title(outputStream* st) { - st->fill_to(col1); - st->print("%11s", "Compiled"); - ProfilerNode::print_title(st); - } - - void print(outputStream* st, int total_ticks) { - ProfilerNode::print(st, total_ticks); - } - - void print_method_on(outputStream* st) { - ProfilerNode::print_method_on(st); - } -}; - -class stubNode : public ProfilerNode { - private: - Method* _method; - oop _class_loader; // needed to keep metadata for the method alive - const char* _symbol; // The name of the nearest VM symbol (for +ProfileVM). Points to a unique string - public: - stubNode(Method* method, const char* name, TickPosition where) : ProfilerNode() { - _method = method; - _class_loader = method->method_holder()->class_loader(); - _symbol = name; - update(where); - } - - bool is_stub() const { return true; } - - void oops_do(OopClosure* f) { - f->do_oop(&_class_loader); - } - - bool stub_match(Method* m, const char* name) const { - return (_method == m) && (_symbol == name); - } - - Method* method() { return _method; } - - static void print_title(outputStream* st) { - st->fill_to(col1); - st->print("%11s", "Stub"); - ProfilerNode::print_title(st); - } - - void print(outputStream* st, int total_ticks) { - ProfilerNode::print(st, total_ticks); - } - - void print_method_on(outputStream* st) { - ProfilerNode::print_method_on(st); - print_symbol_on(st); - } - - void print_symbol_on(outputStream* st) { - if(_symbol) { - st->print(" (%s)", _symbol); - } - } -}; - -class adapterNode : public ProfilerNode { - public: - adapterNode(TickPosition where) : ProfilerNode() { - update(where); - } - bool is_compiled() const { return true; } - - bool adapter_match() const { return true; } - - Method* method() { return NULL; } - - void oops_do(OopClosure* f) { - ; - } - - void print(outputStream* st, int total_ticks) { - ProfilerNode::print(st, total_ticks); - } - - void print_method_on(outputStream* st) { - st->print("%s", "adapters"); - } -}; - -class runtimeStubNode : public ProfilerNode { - private: - const RuntimeStub* _stub; - const char* _symbol; // The name of the nearest VM symbol when ProfileVM is on. Points to a unique string. - public: - runtimeStubNode(const CodeBlob* stub, const char* name, TickPosition where) : ProfilerNode(), _stub(NULL), _symbol(name) { - assert(stub->is_runtime_stub(), "wrong code blob"); - _stub = (RuntimeStub*) stub; - update(where); - } - - bool is_runtime_stub() const { return true; } - - bool runtimeStub_match(const CodeBlob* stub, const char* name) const { - assert(stub->is_runtime_stub(), "wrong code blob"); - return _stub->entry_point() == ((RuntimeStub*)stub)->entry_point() && - (_symbol == name); - } - - Method* method() { return NULL; } - - static void print_title(outputStream* st) { - st->fill_to(col1); - st->print("%11s", "Runtime stub"); - ProfilerNode::print_title(st); - } - - void oops_do(OopClosure* f) { - ; - } - - void print(outputStream* st, int total_ticks) { - ProfilerNode::print(st, total_ticks); - } - - void print_method_on(outputStream* st) { - st->print("%s", _stub->name()); - print_symbol_on(st); - } - - void print_symbol_on(outputStream* st) { - if(_symbol) { - st->print(" (%s)", _symbol); - } - } -}; - - -class unknown_compiledNode : public ProfilerNode { - const char *_name; - public: - unknown_compiledNode(const CodeBlob* cb, TickPosition where) : ProfilerNode() { - if ( cb->is_buffer_blob() ) - _name = ((const BufferBlob*)cb)->name(); - else - _name = ((const SingletonBlob*)cb)->name(); - update(where); - } - bool is_compiled() const { return true; } - - bool unknown_compiled_match(const CodeBlob* cb) const { - if ( cb->is_buffer_blob() ) - return !strcmp(((const BufferBlob*)cb)->name(), _name); - else - return !strcmp(((const SingletonBlob*)cb)->name(), _name); - } - - Method* method() { return NULL; } - - void oops_do(OopClosure* f) { - ; - } - - void print(outputStream* st, int total_ticks) { - ProfilerNode::print(st, total_ticks); - } - - void print_method_on(outputStream* st) { - st->print("%s", _name); - } -}; - -class vmNode : public ProfilerNode { - private: - const char* _name; // "optional" name obtained by os means such as dll lookup - public: - vmNode(const TickPosition where) : ProfilerNode() { - _name = NULL; - update(where); - } - - vmNode(const char* name, const TickPosition where) : ProfilerNode() { - _name = os::strdup(name); - update(where); - } - - ~vmNode() { - if (_name != NULL) { - os::free((void*)_name); - } - } - - const char *name() const { return _name; } - bool is_compiled() const { return true; } - - bool vm_match(const char* name) const { return strcmp(name, _name) == 0; } - - Method* method() { return NULL; } - - static int hash(const char* name){ - // Compute a simple hash - const char* cp = name; - int h = 0; - - if(name != NULL){ - while(*cp != '\0'){ - h = (h << 1) ^ *cp; - cp++; - } - } - return h; - } - - void oops_do(OopClosure* f) { - ; - } - - void print(outputStream* st, int total_ticks) { - ProfilerNode::print(st, total_ticks); - } - - void print_method_on(outputStream* st) { - if(_name==NULL){ - st->print("%s", "unknown code"); - } - else { - st->print("%s", _name); - } - } -}; - -void ThreadProfiler::interpreted_update(Method* method, TickPosition where) { - int index = entry(ProfilerNode::hash(method)); - if (!table[index]) { - table[index] = new (this) interpretedNode(method, where); - } else { - ProfilerNode* prev = table[index]; - for(ProfilerNode* node = prev; node; node = node->next()) { - if (node->interpreted_match(method)) { - node->update(where); - return; - } - prev = node; - } - prev->set_next(new (this) interpretedNode(method, where)); - } -} - -void ThreadProfiler::compiled_update(Method* method, TickPosition where) { - int index = entry(ProfilerNode::hash(method)); - if (!table[index]) { - table[index] = new (this) compiledNode(method, where); - } else { - ProfilerNode* prev = table[index]; - for(ProfilerNode* node = prev; node; node = node->next()) { - if (node->compiled_match(method)) { - node->update(where); - return; - } - prev = node; - } - prev->set_next(new (this) compiledNode(method, where)); - } -} - -void ThreadProfiler::stub_update(Method* method, const char* name, TickPosition where) { - int index = entry(ProfilerNode::hash(method)); - if (!table[index]) { - table[index] = new (this) stubNode(method, name, where); - } else { - ProfilerNode* prev = table[index]; - for(ProfilerNode* node = prev; node; node = node->next()) { - if (node->stub_match(method, name)) { - node->update(where); - return; - } - prev = node; - } - prev->set_next(new (this) stubNode(method, name, where)); - } -} - -void ThreadProfiler::adapter_update(TickPosition where) { - int index = 0; - if (!table[index]) { - table[index] = new (this) adapterNode(where); - } else { - ProfilerNode* prev = table[index]; - for(ProfilerNode* node = prev; node; node = node->next()) { - if (node->adapter_match()) { - node->update(where); - return; - } - prev = node; - } - prev->set_next(new (this) adapterNode(where)); - } -} - -void ThreadProfiler::runtime_stub_update(const CodeBlob* stub, const char* name, TickPosition where) { - int index = 0; - if (!table[index]) { - table[index] = new (this) runtimeStubNode(stub, name, where); - } else { - ProfilerNode* prev = table[index]; - for(ProfilerNode* node = prev; node; node = node->next()) { - if (node->runtimeStub_match(stub, name)) { - node->update(where); - return; - } - prev = node; - } - prev->set_next(new (this) runtimeStubNode(stub, name, where)); - } -} - - -void ThreadProfiler::unknown_compiled_update(const CodeBlob* cb, TickPosition where) { - int index = 0; - if (!table[index]) { - table[index] = new (this) unknown_compiledNode(cb, where); - } else { - ProfilerNode* prev = table[index]; - for(ProfilerNode* node = prev; node; node = node->next()) { - if (node->unknown_compiled_match(cb)) { - node->update(where); - return; - } - prev = node; - } - prev->set_next(new (this) unknown_compiledNode(cb, where)); - } -} - -void ThreadProfiler::vm_update(TickPosition where) { - vm_update(NULL, where); -} - -void ThreadProfiler::vm_update(const char* name, TickPosition where) { - int index = entry(vmNode::hash(name)); - assert(index >= 0, "Must be positive"); - // Note that we call strdup below since the symbol may be resource allocated - if (!table[index]) { - table[index] = new (this) vmNode(name, where); - } else { - ProfilerNode* prev = table[index]; - for(ProfilerNode* node = prev; node; node = node->next()) { - if (((vmNode *)node)->vm_match(name)) { - node->update(where); - return; - } - prev = node; - } - prev->set_next(new (this) vmNode(name, where)); - } -} - - -class FlatProfilerTask : public PeriodicTask { -public: - FlatProfilerTask(int interval_time) : PeriodicTask(interval_time) {} - void task(); -}; - -void FlatProfiler::record_vm_operation() { - if (Universe::heap()->is_gc_active()) { - FlatProfiler::received_gc_ticks += 1; - return; - } - - if (DeoptimizationMarker::is_active()) { - FlatProfiler::deopt_ticks += 1; - return; - } - - FlatProfiler::vm_operation_ticks += 1; -} - -void FlatProfiler::record_vm_tick() { - // Profile the VM Thread itself if needed - // This is done without getting the Threads_lock and we can go deep - // inside Safepoint, etc. - if( ProfileVM ) { - ResourceMark rm; - ExtendedPC epc; - const char *name = NULL; - char buf[256]; - buf[0] = '\0'; - - vm_thread_profiler->inc_thread_ticks(); - - // Get a snapshot of a current VMThread pc (and leave it running!) - // The call may fail in some circumstances - epc = os::get_thread_pc(VMThread::vm_thread()); - if(epc.pc() != NULL) { - if (os::dll_address_to_function_name(epc.pc(), buf, sizeof(buf), NULL)) { - name = buf; - } - } - if (name != NULL) { - vm_thread_profiler->vm_update(name, tp_native); - } - } -} - -void FlatProfiler::record_thread_ticks() { - - int maxthreads, suspendedthreadcount; - JavaThread** threadsList; - bool interval_expired = false; - - if (ProfileIntervals && - (FlatProfiler::received_ticks >= interval_ticks_previous + ProfileIntervalsTicks)) { - interval_expired = true; - interval_ticks_previous = FlatProfiler::received_ticks; - } - - // Try not to wait for the Threads_lock - if (Threads_lock->try_lock()) { - { // Threads_lock scope - maxthreads = Threads::number_of_threads(); - threadsList = NEW_C_HEAP_ARRAY(JavaThread *, maxthreads, mtInternal); - suspendedthreadcount = 0; - for (JavaThread* tp = Threads::first(); tp != NULL; tp = tp->next()) { - if (tp->is_Compiler_thread()) { - // Only record ticks for active compiler threads - CompilerThread* cthread = (CompilerThread*)tp; - if (cthread->task() != NULL) { - // The compiler is active. If we need to access any of the fields - // of the compiler task we should suspend the CompilerThread first. - FlatProfiler::compiler_ticks += 1; - continue; - } - } - - // First externally suspend all threads by marking each for - // external suspension - so it will stop at its next transition - // Then do a safepoint - ThreadProfiler* pp = tp->get_thread_profiler(); - if (pp != NULL && pp->engaged) { - MutexLockerEx ml(tp->SR_lock(), Mutex::_no_safepoint_check_flag); - if (!tp->is_external_suspend() && !tp->is_exiting()) { - tp->set_external_suspend(); - threadsList[suspendedthreadcount++] = tp; - } - } - } - Threads_lock->unlock(); - } - // Suspend each thread. This call should just return - // for any threads that have already self-suspended - // Net result should be one safepoint - for (int j = 0; j < suspendedthreadcount; j++) { - JavaThread *tp = threadsList[j]; - if (tp) { - tp->java_suspend(); - } - } - - // We are responsible for resuming any thread on this list - for (int i = 0; i < suspendedthreadcount; i++) { - JavaThread *tp = threadsList[i]; - if (tp) { - ThreadProfiler* pp = tp->get_thread_profiler(); - if (pp != NULL && pp->engaged) { - HandleMark hm; - FlatProfiler::delivered_ticks += 1; - if (interval_expired) { - FlatProfiler::interval_record_thread(pp); - } - // This is the place where we check to see if a user thread is - // blocked waiting for compilation. - if (tp->blocked_on_compilation()) { - pp->compiler_ticks += 1; - pp->interval_data_ref()->inc_compiling(); - } else { - pp->record_tick(tp); - } - } - MutexLocker ml(Threads_lock); - tp->java_resume(); - } - } - if (interval_expired) { - FlatProfiler::interval_print(); - FlatProfiler::interval_reset(); - } - - FREE_C_HEAP_ARRAY(JavaThread *, threadsList); - } else { - // Couldn't get the threads lock, just record that rather than blocking - FlatProfiler::threads_lock_ticks += 1; - } - -} - -void FlatProfilerTask::task() { - FlatProfiler::received_ticks += 1; - - if (ProfileVM) { - FlatProfiler::record_vm_tick(); - } - - VM_Operation* op = VMThread::vm_operation(); - if (op != NULL) { - FlatProfiler::record_vm_operation(); - if (SafepointSynchronize::is_at_safepoint()) { - return; - } - } - FlatProfiler::record_thread_ticks(); -} - -void ThreadProfiler::record_interpreted_tick(JavaThread* thread, frame fr, TickPosition where, int* ticks) { - FlatProfiler::all_int_ticks++; - if (!FlatProfiler::full_profile()) { - return; - } - - if (!fr.is_interpreted_frame_valid(thread)) { - // tick came at a bad time - interpreter_ticks += 1; - FlatProfiler::interpreter_ticks += 1; - return; - } - - // The frame has been fully validated so we can trust the method and bci - - Method* method = *fr.interpreter_frame_method_addr(); - - interpreted_update(method, where); - - // update byte code table - InterpreterCodelet* desc = Interpreter::codelet_containing(fr.pc()); - if (desc != NULL && desc->bytecode() >= 0) { - ticks[desc->bytecode()]++; - } -} - -void ThreadProfiler::record_compiled_tick(JavaThread* thread, frame fr, TickPosition where) { - const char *name = NULL; - TickPosition localwhere = where; - - FlatProfiler::all_comp_ticks++; - if (!FlatProfiler::full_profile()) return; - - CodeBlob* cb = fr.cb(); - - // For runtime stubs, record as native rather than as compiled - if (cb->is_runtime_stub()) { - RegisterMap map(thread, false); - fr = fr.sender(&map); - cb = fr.cb(); - localwhere = tp_native; - } - - Method* method = cb->is_compiled() ? cb->as_compiled_method()->method() : (Method*) NULL; - if (method == NULL) { - if (cb->is_runtime_stub()) - runtime_stub_update(cb, name, localwhere); - else - unknown_compiled_update(cb, localwhere); - } - else { - if (method->is_native()) { - stub_update(method, name, localwhere); - } else { - compiled_update(method, localwhere); - } - } -} - -extern "C" void find(int x); - - -void ThreadProfiler::record_tick_for_running_frame(JavaThread* thread, frame fr) { - // The tick happened in real code -> non VM code - if (fr.is_interpreted_frame()) { - interval_data_ref()->inc_interpreted(); - record_interpreted_tick(thread, fr, tp_code, FlatProfiler::bytecode_ticks); - return; - } - - if (CodeCache::contains(fr.pc())) { - interval_data_ref()->inc_compiled(); - PCRecorder::record(fr.pc()); - record_compiled_tick(thread, fr, tp_code); - return; - } - - if (VtableStubs::stub_containing(fr.pc()) != NULL) { - unknown_ticks_array[ut_vtable_stubs] += 1; - return; - } - - frame caller = fr.profile_find_Java_sender_frame(thread); - - if (caller.sp() != NULL && caller.pc() != NULL) { - record_tick_for_calling_frame(thread, caller); - return; - } - - unknown_ticks_array[ut_running_frame] += 1; - FlatProfiler::unknown_ticks += 1; -} - -void ThreadProfiler::record_tick_for_calling_frame(JavaThread* thread, frame fr) { - // The tick happened in VM code - interval_data_ref()->inc_native(); - if (fr.is_interpreted_frame()) { - record_interpreted_tick(thread, fr, tp_native, FlatProfiler::bytecode_ticks_stub); - return; - } - if (CodeCache::contains(fr.pc())) { - record_compiled_tick(thread, fr, tp_native); - return; - } - - frame caller = fr.profile_find_Java_sender_frame(thread); - - if (caller.sp() != NULL && caller.pc() != NULL) { - record_tick_for_calling_frame(thread, caller); - return; - } - - unknown_ticks_array[ut_calling_frame] += 1; - FlatProfiler::unknown_ticks += 1; -} - -void ThreadProfiler::record_tick(JavaThread* thread) { - FlatProfiler::all_ticks++; - thread_ticks += 1; - - // Here's another way to track global state changes. - // When the class loader starts it marks the ThreadProfiler to tell it it is in the class loader - // and we check that here. - // This is more direct, and more than one thread can be in the class loader at a time, - // but it does mean the class loader has to know about the profiler. - if (region_flag[ThreadProfilerMark::classLoaderRegion]) { - class_loader_ticks += 1; - FlatProfiler::class_loader_ticks += 1; - return; - } else if (region_flag[ThreadProfilerMark::extraRegion]) { - extra_ticks += 1; - FlatProfiler::extra_ticks += 1; - return; - } - // Note that the WatcherThread can now stop for safepoints - uint32_t debug_bits = 0; - if (!thread->wait_for_ext_suspend_completion(SuspendRetryCount, - SuspendRetryDelay, &debug_bits)) { - unknown_ticks_array[ut_unknown_thread_state] += 1; - FlatProfiler::unknown_ticks += 1; - return; - } - - frame fr; - - switch (thread->thread_state()) { - case _thread_in_native: - case _thread_in_native_trans: - case _thread_in_vm: - case _thread_in_vm_trans: - if (thread->profile_last_Java_frame(&fr)) { - if (fr.is_runtime_frame()) { - RegisterMap map(thread, false); - fr = fr.sender(&map); - } - record_tick_for_calling_frame(thread, fr); - } else { - unknown_ticks_array[ut_no_last_Java_frame] += 1; - FlatProfiler::unknown_ticks += 1; - } - break; - // handle_special_runtime_exit_condition self-suspends threads in Java - case _thread_in_Java: - case _thread_in_Java_trans: - if (thread->profile_last_Java_frame(&fr)) { - if (fr.is_safepoint_blob_frame()) { - RegisterMap map(thread, false); - fr = fr.sender(&map); - } - record_tick_for_running_frame(thread, fr); - } else { - unknown_ticks_array[ut_no_last_Java_frame] += 1; - FlatProfiler::unknown_ticks += 1; - } - break; - case _thread_blocked: - case _thread_blocked_trans: - if (thread->osthread() && thread->osthread()->get_state() == RUNNABLE) { - if (thread->profile_last_Java_frame(&fr)) { - if (fr.is_safepoint_blob_frame()) { - RegisterMap map(thread, false); - fr = fr.sender(&map); - record_tick_for_running_frame(thread, fr); - } else { - record_tick_for_calling_frame(thread, fr); - } - } else { - unknown_ticks_array[ut_no_last_Java_frame] += 1; - FlatProfiler::unknown_ticks += 1; - } - } else { - blocked_ticks += 1; - FlatProfiler::blocked_ticks += 1; - } - break; - case _thread_uninitialized: - case _thread_new: - // not used, included for completeness - case _thread_new_trans: - unknown_ticks_array[ut_no_last_Java_frame] += 1; - FlatProfiler::unknown_ticks += 1; - break; - default: - unknown_ticks_array[ut_unknown_thread_state] += 1; - FlatProfiler::unknown_ticks += 1; - break; - } - return; -} - -void ThreadProfiler::engage() { - engaged = true; - timer.start(); -} - -void ThreadProfiler::disengage() { - engaged = false; - timer.stop(); -} - -void ThreadProfiler::initialize() { - for (int index = 0; index < table_size; index++) { - table[index] = NULL; - } - thread_ticks = 0; - blocked_ticks = 0; - compiler_ticks = 0; - interpreter_ticks = 0; - for (int ut = 0; ut < ut_end; ut += 1) { - unknown_ticks_array[ut] = 0; - } - region_flag[ThreadProfilerMark::classLoaderRegion] = false; - class_loader_ticks = 0; - region_flag[ThreadProfilerMark::extraRegion] = false; - extra_ticks = 0; - timer.start(); - interval_data_ref()->reset(); -} - -void ThreadProfiler::reset() { - timer.stop(); - if (table != NULL) { - for (int index = 0; index < table_size; index++) { - ProfilerNode* n = table[index]; - if (n != NULL) { - delete n; - } - } - } - initialize(); -} - -void FlatProfiler::allocate_table() { - { // Bytecode table - bytecode_ticks = NEW_C_HEAP_ARRAY(int, Bytecodes::number_of_codes, mtInternal); - bytecode_ticks_stub = NEW_C_HEAP_ARRAY(int, Bytecodes::number_of_codes, mtInternal); - for(int index = 0; index < Bytecodes::number_of_codes; index++) { - bytecode_ticks[index] = 0; - bytecode_ticks_stub[index] = 0; - } - } - - if (ProfilerRecordPC) PCRecorder::init(); - - interval_data = NEW_C_HEAP_ARRAY(IntervalData, interval_print_size, mtInternal); - FlatProfiler::interval_reset(); -} - -void FlatProfiler::engage(JavaThread* mainThread, bool fullProfile) { - full_profile_flag = fullProfile; - if (bytecode_ticks == NULL) { - allocate_table(); - } - if(ProfileVM && (vm_thread_profiler == NULL)){ - vm_thread_profiler = new ThreadProfiler(); - } - if (task == NULL) { - task = new FlatProfilerTask(WatcherThread::delay_interval); - task->enroll(); - } - timer.start(); - if (mainThread != NULL) { - // When mainThread was created, it might not have a ThreadProfiler - ThreadProfiler* pp = mainThread->get_thread_profiler(); - if (pp == NULL) { - mainThread->set_thread_profiler(new ThreadProfiler()); - } else { - pp->reset(); - } - mainThread->get_thread_profiler()->engage(); - } - // This is where we would assign thread_profiler - // if we wanted only one thread_profiler for all threads. - thread_profiler = NULL; -} - -void FlatProfiler::disengage() { - if (!task) { - return; - } - timer.stop(); - task->disenroll(); - delete task; - task = NULL; - if (thread_profiler != NULL) { - thread_profiler->disengage(); - } else { - MutexLocker tl(Threads_lock); - for (JavaThread* tp = Threads::first(); tp != NULL; tp = tp->next()) { - ThreadProfiler* pp = tp->get_thread_profiler(); - if (pp != NULL) { - pp->disengage(); - } - } - } -} - -void FlatProfiler::reset() { - if (task) { - disengage(); - } - - class_loader_ticks = 0; - extra_ticks = 0; - received_gc_ticks = 0; - vm_operation_ticks = 0; - compiler_ticks = 0; - deopt_ticks = 0; - interpreter_ticks = 0; - blocked_ticks = 0; - unknown_ticks = 0; - received_ticks = 0; - delivered_ticks = 0; - timer.stop(); -} - -bool FlatProfiler::is_active() { - return task != NULL; -} - -void FlatProfiler::print_byte_code_statistics() { - GrowableArray * array = new GrowableArray(200); - - tty->print_cr(" Bytecode ticks:"); - for (int index = 0; index < Bytecodes::number_of_codes; index++) { - if (FlatProfiler::bytecode_ticks[index] > 0 || FlatProfiler::bytecode_ticks_stub[index] > 0) { - tty->print_cr(" %4d %4d = %s", - FlatProfiler::bytecode_ticks[index], - FlatProfiler::bytecode_ticks_stub[index], - Bytecodes::name( (Bytecodes::Code) index)); - } - } - tty->cr(); -} - -void print_ticks(const char* title, int ticks, int total) { - if (ticks > 0) { - tty->print("%5.1f%% %5d", ticks * 100.0 / total, ticks); - tty->fill_to(col3); - tty->print("%s", title); - tty->cr(); - } -} - -void ThreadProfiler::print(const char* thread_name) { - ResourceMark rm; - MutexLocker ppl(ProfilePrint_lock); - int index = 0; // Declared outside for loops for portability - - if (table == NULL) { - return; - } - - if (thread_ticks <= 0) { - return; - } - - const char* title = "too soon to tell"; - double secs = timer.seconds(); - - GrowableArray * array = new GrowableArray(200); - for(index = 0; index < table_size; index++) { - for(ProfilerNode* node = table[index]; node; node = node->next()) - array->append(node); - } - - array->sort(&ProfilerNode::compare); - - // compute total (sanity check) - int active = - class_loader_ticks + - compiler_ticks + - interpreter_ticks + - unknown_ticks(); - for (index = 0; index < array->length(); index++) { - active += array->at(index)->ticks.total(); - } - int total = active + blocked_ticks; - - tty->cr(); - tty->print_cr("Flat profile of %3.2f secs (%d total ticks): %s", secs, total, thread_name); - if (total != thread_ticks) { - print_ticks("Lost ticks", thread_ticks-total, thread_ticks); - } - tty->cr(); - - // print interpreted methods - tick_counter interpreted_ticks; - bool has_interpreted_ticks = false; - int print_count = 0; - for (index = 0; index < array->length(); index++) { - ProfilerNode* n = array->at(index); - if (n->is_interpreted()) { - interpreted_ticks.add(&n->ticks); - if (!has_interpreted_ticks) { - interpretedNode::print_title(tty); - has_interpreted_ticks = true; - } - if (print_count++ < ProfilerNumberOfInterpretedMethods) { - n->print(tty, active); - } - } - } - if (has_interpreted_ticks) { - if (print_count <= ProfilerNumberOfInterpretedMethods) { - title = "Total interpreted"; - } else { - title = "Total interpreted (including elided)"; - } - interpretedNode::print_total(tty, &interpreted_ticks, active, title); - tty->cr(); - } - - // print compiled methods - tick_counter compiled_ticks; - bool has_compiled_ticks = false; - print_count = 0; - for (index = 0; index < array->length(); index++) { - ProfilerNode* n = array->at(index); - if (n->is_compiled()) { - compiled_ticks.add(&n->ticks); - if (!has_compiled_ticks) { - compiledNode::print_title(tty); - has_compiled_ticks = true; - } - if (print_count++ < ProfilerNumberOfCompiledMethods) { - n->print(tty, active); - } - } - } - if (has_compiled_ticks) { - if (print_count <= ProfilerNumberOfCompiledMethods) { - title = "Total compiled"; - } else { - title = "Total compiled (including elided)"; - } - compiledNode::print_total(tty, &compiled_ticks, active, title); - tty->cr(); - } - - // print stub methods - tick_counter stub_ticks; - bool has_stub_ticks = false; - print_count = 0; - for (index = 0; index < array->length(); index++) { - ProfilerNode* n = array->at(index); - if (n->is_stub()) { - stub_ticks.add(&n->ticks); - if (!has_stub_ticks) { - stubNode::print_title(tty); - has_stub_ticks = true; - } - if (print_count++ < ProfilerNumberOfStubMethods) { - n->print(tty, active); - } - } - } - if (has_stub_ticks) { - if (print_count <= ProfilerNumberOfStubMethods) { - title = "Total stub"; - } else { - title = "Total stub (including elided)"; - } - stubNode::print_total(tty, &stub_ticks, active, title); - tty->cr(); - } - - // print runtime stubs - tick_counter runtime_stub_ticks; - bool has_runtime_stub_ticks = false; - print_count = 0; - for (index = 0; index < array->length(); index++) { - ProfilerNode* n = array->at(index); - if (n->is_runtime_stub()) { - runtime_stub_ticks.add(&n->ticks); - if (!has_runtime_stub_ticks) { - runtimeStubNode::print_title(tty); - has_runtime_stub_ticks = true; - } - if (print_count++ < ProfilerNumberOfRuntimeStubNodes) { - n->print(tty, active); - } - } - } - if (has_runtime_stub_ticks) { - if (print_count <= ProfilerNumberOfRuntimeStubNodes) { - title = "Total runtime stubs"; - } else { - title = "Total runtime stubs (including elided)"; - } - runtimeStubNode::print_total(tty, &runtime_stub_ticks, active, title); - tty->cr(); - } - - if (blocked_ticks + class_loader_ticks + interpreter_ticks + compiler_ticks + unknown_ticks() != 0) { - tty->fill_to(col1); - tty->print_cr("Thread-local ticks:"); - print_ticks("Blocked (of total)", blocked_ticks, total); - print_ticks("Class loader", class_loader_ticks, active); - print_ticks("Extra", extra_ticks, active); - print_ticks("Interpreter", interpreter_ticks, active); - print_ticks("Compilation", compiler_ticks, active); - print_ticks("Unknown: vtable stubs", unknown_ticks_array[ut_vtable_stubs], active); - print_ticks("Unknown: null method", unknown_ticks_array[ut_null_method], active); - print_ticks("Unknown: running frame", unknown_ticks_array[ut_running_frame], active); - print_ticks("Unknown: calling frame", unknown_ticks_array[ut_calling_frame], active); - print_ticks("Unknown: no pc", unknown_ticks_array[ut_no_pc], active); - print_ticks("Unknown: no last frame", unknown_ticks_array[ut_no_last_Java_frame], active); - print_ticks("Unknown: thread_state", unknown_ticks_array[ut_unknown_thread_state], active); - tty->cr(); - } - - if (WizardMode) { - tty->print_cr("Node area used: " INTX_FORMAT " Kb", (area_top - area_bottom) / 1024); - } - reset(); -} - -/* -ThreadProfiler::print_unknown(){ - if (table == NULL) { - return; - } - - if (thread_ticks <= 0) { - return; - } -} */ - -void FlatProfiler::print(int unused) { - ResourceMark rm; - if (thread_profiler != NULL) { - thread_profiler->print("All threads"); - } else { - MutexLocker tl(Threads_lock); - for (JavaThread* tp = Threads::first(); tp != NULL; tp = tp->next()) { - ThreadProfiler* pp = tp->get_thread_profiler(); - if (pp != NULL) { - pp->print(tp->get_thread_name()); - } - } - } - - if (ProfilerPrintByteCodeStatistics) { - print_byte_code_statistics(); - } - - if (non_method_ticks() > 0) { - tty->cr(); - tty->print_cr("Global summary of %3.2f seconds:", timer.seconds()); - print_ticks("Received ticks", received_ticks, received_ticks); - print_ticks("Received GC ticks", received_gc_ticks, received_ticks); - print_ticks("Compilation", compiler_ticks, received_ticks); - print_ticks("Deoptimization", deopt_ticks, received_ticks); - print_ticks("Other VM operations", vm_operation_ticks, received_ticks); -#ifndef PRODUCT - print_ticks("Blocked ticks", blocked_ticks, received_ticks); - print_ticks("Threads_lock blocks", threads_lock_ticks, received_ticks); - print_ticks("Delivered ticks", delivered_ticks, received_ticks); - print_ticks("All ticks", all_ticks, received_ticks); -#endif - print_ticks("Class loader", class_loader_ticks, received_ticks); - print_ticks("Extra ", extra_ticks, received_ticks); - print_ticks("Interpreter", interpreter_ticks, received_ticks); - print_ticks("Unknown code", unknown_ticks, received_ticks); - } - - PCRecorder::print(); - - if(ProfileVM){ - tty->cr(); - vm_thread_profiler->print("VM Thread"); - } -} - -void IntervalData::print_header(outputStream* st) { - st->print("i/c/n/g"); -} - -void IntervalData::print_data(outputStream* st) { - st->print("%d/%d/%d/%d", interpreted(), compiled(), native(), compiling()); -} - -void FlatProfiler::interval_record_thread(ThreadProfiler* tp) { - IntervalData id = tp->interval_data(); - int total = id.total(); - tp->interval_data_ref()->reset(); - - // Insertion sort the data, if it's relevant. - for (int i = 0; i < interval_print_size; i += 1) { - if (total > interval_data[i].total()) { - for (int j = interval_print_size - 1; j > i; j -= 1) { - interval_data[j] = interval_data[j-1]; - } - interval_data[i] = id; - break; - } - } -} - -void FlatProfiler::interval_print() { - if ((interval_data[0].total() > 0)) { - tty->stamp(); - tty->print("\t"); - IntervalData::print_header(tty); - for (int i = 0; i < interval_print_size; i += 1) { - if (interval_data[i].total() > 0) { - tty->print("\t"); - interval_data[i].print_data(tty); - } - } - tty->cr(); - } -} - -void FlatProfiler::interval_reset() { - for (int i = 0; i < interval_print_size; i += 1) { - interval_data[i].reset(); - } -} - -void ThreadProfiler::oops_do(OopClosure* f) { - if (table == NULL) return; - - for(int index = 0; index < table_size; index++) { - for(ProfilerNode* node = table[index]; node; node = node->next()) - node->oops_do(f); - } -} - -void FlatProfiler::oops_do(OopClosure* f) { - if (thread_profiler != NULL) { - thread_profiler->oops_do(f); - } else { - for (JavaThread* tp = Threads::first(); tp != NULL; tp = tp->next()) { - ThreadProfiler* pp = tp->get_thread_profiler(); - if (pp != NULL) { - pp->oops_do(f); - } - } - } -} diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/fprofiler.hpp --- a/hotspot/src/share/vm/runtime/fprofiler.hpp Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,319 +0,0 @@ -/* - * Copyright (c) 1997, 2013, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -#ifndef SHARE_VM_RUNTIME_FPROFILER_HPP -#define SHARE_VM_RUNTIME_FPROFILER_HPP - -#include "utilities/macros.hpp" -#include "runtime/timer.hpp" - -// a simple flat profiler for Java - - -// Forward declaration of classes defined in this header file -class ThreadProfiler; -class ThreadProfilerMark; -class FlatProfiler; -class IntervalData; - -// Declarations of classes defined only in the implementation. -class ProfilerNode; -class FlatProfilerTask; - -enum TickPosition { - tp_code, - tp_native -}; - -// One of these guys is constructed as we enter interesting regions -// and destructed as we exit the region. While we are in the region -// ticks are allotted to the region. -class ThreadProfilerMark: public StackObj { -public: - // For now, the only thread-specific region is the class loader. - enum Region { noRegion, classLoaderRegion, extraRegion, maxRegion }; - - ThreadProfilerMark(Region) NOT_FPROF_RETURN; - ~ThreadProfilerMark() NOT_FPROF_RETURN; - -private: - ThreadProfiler* _pp; - Region _r; -}; - -#if INCLUDE_FPROF - -class IntervalData VALUE_OBJ_CLASS_SPEC { - // Just to keep these things all together -private: - int _interpreted; - int _compiled; - int _native; - int _compiling; -public: - int interpreted() { - return _interpreted; - } - int compiled() { - return _compiled; - } - int native() { - return _native; - } - int compiling() { - return _compiling; - } - int total() { - return (interpreted() + compiled() + native() + compiling()); - } - void inc_interpreted() { - _interpreted += 1; - } - void inc_compiled() { - _compiled += 1; - } - void inc_native() { - _native += 1; - } - void inc_compiling() { - _compiling += 1; - } - void reset() { - _interpreted = 0; - _compiled = 0; - _native = 0; - _compiling = 0; - } - static void print_header(outputStream* st); - void print_data(outputStream* st); -}; -#endif // INCLUDE_FPROF - -class ThreadProfiler: public CHeapObj { -public: - ThreadProfiler() NOT_FPROF_RETURN; - ~ThreadProfiler() NOT_FPROF_RETURN; - - // Resets the profiler - void reset() NOT_FPROF_RETURN; - - // Activates the profiler for a certain thread - void engage() NOT_FPROF_RETURN; - - // Deactivates the profiler - void disengage() NOT_FPROF_RETURN; - - // Prints the collected profiling information - void print(const char* thread_name) NOT_FPROF_RETURN; - - // Garbage Collection Support - void oops_do(OopClosure* f) NOT_FPROF_RETURN; - -#if INCLUDE_FPROF -private: - // for recording ticks. - friend class ProfilerNode; - char* area_bottom; // preallocated area for pnodes - char* area_top; - char* area_limit; - static int table_size; - ProfilerNode** table; - -private: - void record_interpreted_tick(JavaThread* thread, frame fr, TickPosition where, int* ticks); - void record_compiled_tick (JavaThread* thread, frame fr, TickPosition where); - void interpreted_update(Method* method, TickPosition where); - void compiled_update (Method* method, TickPosition where); - void stub_update (Method* method, const char* name, TickPosition where); - void adapter_update (TickPosition where); - - void runtime_stub_update(const CodeBlob* stub, const char* name, TickPosition where); - void unknown_compiled_update (const CodeBlob* cb, TickPosition where); - - void vm_update (TickPosition where); - void vm_update (const char* name, TickPosition where); - - void record_tick_for_running_frame(JavaThread* thread, frame fr); - void record_tick_for_calling_frame(JavaThread* thread, frame fr); - - void initialize(); - - static int entry(int value); - - -private: - friend class FlatProfiler; - void record_tick(JavaThread* thread); - bool engaged; - // so we can do percentages for this thread, and quick checks for activity - int thread_ticks; - int compiler_ticks; - int interpreter_ticks; - -public: - void inc_thread_ticks() { thread_ticks += 1; } - -private: - friend class ThreadProfilerMark; - // counters for thread-specific regions - bool region_flag[ThreadProfilerMark::maxRegion]; - int class_loader_ticks; - int extra_ticks; - -private: - // other thread-specific regions - int blocked_ticks; - enum UnknownTickSites { - ut_null_method, - ut_vtable_stubs, - ut_running_frame, - ut_calling_frame, - ut_no_pc, - ut_no_last_Java_frame, - ut_unknown_thread_state, - ut_end - }; - int unknown_ticks_array[ut_end]; - int unknown_ticks() { - int result = 0; - for (int ut = 0; ut < ut_end; ut += 1) { - result += unknown_ticks_array[ut]; - } - return result; - } - - elapsedTimer timer; - - // For interval timing -private: - IntervalData _interval_data; - IntervalData interval_data() { - return _interval_data; - } - IntervalData* interval_data_ref() { - return &_interval_data; - } -#endif // INCLUDE_FPROF -}; - -class FlatProfiler: AllStatic { -public: - static void reset() NOT_FPROF_RETURN ; - static void engage(JavaThread* mainThread, bool fullProfile) NOT_FPROF_RETURN ; - static void disengage() NOT_FPROF_RETURN ; - static void print(int unused) NOT_FPROF_RETURN ; - static bool is_active() NOT_FPROF_RETURN_(false) ; - - // This is NULL if each thread has its own thread profiler, - // else this is the single thread profiler used by all threads. - // In particular it makes a difference during garbage collection, - // where you only want to traverse each thread profiler once. - static ThreadProfiler* get_thread_profiler() NOT_FPROF_RETURN_(NULL); - - // Garbage Collection Support - static void oops_do(OopClosure* f) NOT_FPROF_RETURN ; - - // Support for disassembler to inspect the PCRecorder - - // Returns the start address for a given pc - // NULL is returned if the PCRecorder is inactive - static address bucket_start_for(address pc) NOT_FPROF_RETURN_(NULL); - - enum { MillisecsPerTick = 10 }; // ms per profiling ticks - - // Returns the number of ticks recorded for the bucket - // pc belongs to. - static int bucket_count_for(address pc) NOT_FPROF_RETURN_(0); - -#if INCLUDE_FPROF - - private: - static bool full_profile() { - return full_profile_flag; - } - - friend class ThreadProfiler; - // the following group of ticks cover everything that's not attributed to individual Java methods - static int received_gc_ticks; // ticks during which gc was active - static int vm_operation_ticks; // total ticks in vm_operations other than GC - static int threads_lock_ticks; // the number of times we couldn't get the Threads_lock without blocking - static int blocked_ticks; // ticks when the thread was blocked. - static int class_loader_ticks; // total ticks in class loader - static int extra_ticks; // total ticks an extra temporary measuring - static int compiler_ticks; // total ticks in compilation - static int interpreter_ticks; // ticks in unknown interpreted method - static int deopt_ticks; // ticks in deoptimization - static int unknown_ticks; // ticks that cannot be categorized - static int received_ticks; // ticks that were received by task - static int delivered_ticks; // ticks that were delivered by task - static int non_method_ticks() { - return - ( received_gc_ticks - + vm_operation_ticks - + deopt_ticks - + threads_lock_ticks - + blocked_ticks - + compiler_ticks - + interpreter_ticks - + unknown_ticks ); - } - static elapsedTimer timer; - - // Counts of each of the byte codes - static int* bytecode_ticks; - static int* bytecode_ticks_stub; - static void print_byte_code_statistics(); - - // the ticks below are for continuous profiling (to adjust recompilation, etc.) - static int all_ticks; // total count of ticks received so far - static int all_int_ticks; // ticks in interpreter - static int all_comp_ticks; // ticks in compiled code (+ native) - static bool full_profile_flag; // collecting full profile? - - // to accumulate thread-specific data - // if we aren't profiling individual threads. - static ThreadProfiler* thread_profiler; - static ThreadProfiler* vm_thread_profiler; - - static void allocate_table(); - - // The task that periodically interrupts things. - friend class FlatProfilerTask; - static FlatProfilerTask* task; - static void record_vm_operation(); - static void record_vm_tick(); - static void record_thread_ticks(); - - // For interval analysis - private: - static int interval_ticks_previous; // delivered_ticks from the last interval - static void interval_record_thread(ThreadProfiler* tp); // extract ticks from ThreadProfiler. - static void interval_print(); // print interval data. - static void interval_reset(); // reset interval data. - enum {interval_print_size = 10}; - static IntervalData* interval_data; -#endif // INCLUDE_FPROF -}; - -#endif // SHARE_VM_RUNTIME_FPROFILER_HPP diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/globals.hpp --- a/hotspot/src/share/vm/runtime/globals.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/runtime/globals.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -2037,7 +2037,7 @@ \ product(size_t, ErgoHeapSizeLimit, 0, \ "Maximum ergonomically set heap size (in bytes); zero means use " \ - "MaxRAM / MaxRAMFraction") \ + "MaxRAM * MaxRAMPercentage / 100") \ range(0, max_uintx) \ \ experimental(bool, UseCGroupMemoryLimitForHeap, false, \ @@ -2046,18 +2046,34 @@ \ product(uintx, MaxRAMFraction, 4, \ "Maximum fraction (1/n) of real memory used for maximum heap " \ - "size") \ + "size. " \ + "Deprecated, use MaxRAMPercentage instead") \ range(1, max_uintx) \ \ product(uintx, MinRAMFraction, 2, \ "Minimum fraction (1/n) of real memory used for maximum heap " \ - "size on systems with small physical memory size") \ + "size on systems with small physical memory size. " \ + "Deprecated, use MinRAMPercentage instead") \ range(1, max_uintx) \ \ product(uintx, InitialRAMFraction, 64, \ - "Fraction (1/n) of real memory used for initial heap size") \ + "Fraction (1/n) of real memory used for initial heap size. " \ + "Deprecated, use InitialRAMPercentage instead") \ range(1, max_uintx) \ \ + product(double, MaxRAMPercentage, 25.0, \ + "Maximum percentage of real memory used for maximum heap size") \ + range(0.0, 100.0) \ + \ + product(double, MinRAMPercentage, 50.0, \ + "Minimum percentage of real memory used for maximum heap" \ + "size on systems with small physical memory size") \ + range(0.0, 100.0) \ + \ + product(double, InitialRAMPercentage, 1.5625, \ + "Percentage of real memory used for initial heap size") \ + range(0.0, 100.0) \ + \ develop(uintx, MaxVirtMemFraction, 2, \ "Maximum fraction (1/n) of virtual memory used for ergonomically "\ "determining maximum heap size") \ diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/java.cpp --- a/hotspot/src/share/vm/runtime/java.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/runtime/java.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -55,7 +55,6 @@ #include "runtime/biasedLocking.hpp" #include "runtime/compilationPolicy.hpp" #include "runtime/deoptimization.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/init.hpp" #include "runtime/interfaceSupport.hpp" #include "runtime/java.hpp" @@ -465,12 +464,6 @@ WatcherThread::stop(); } - // Print statistics gathered (profiling ...) - if (Arguments::has_profile()) { - FlatProfiler::disengage(); - FlatProfiler::print(10); - } - // shut down the StatSampler task StatSampler::disengage(); StatSampler::destroy(); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/javaCalls.cpp --- a/hotspot/src/share/vm/runtime/javaCalls.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/runtime/javaCalls.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -308,9 +308,6 @@ } void JavaCalls::call_helper(JavaValue* result, const methodHandle& method, JavaCallArguments* args, TRAPS) { - // During dumping, Java execution environment is not fully initialized. Also, Java execution - // may cause undesirable side-effects in the class metadata. - assert(!DumpSharedSpaces, "must not execute Java bytecodes when dumping"); JavaThread* thread = (JavaThread*)THREAD; assert(thread->is_Java_thread(), "must be called by a java thread"); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/os.cpp --- a/hotspot/src/share/vm/runtime/os.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/runtime/os.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -235,6 +235,82 @@ return OS_OK; } +bool os::dll_build_name(char* buffer, size_t size, const char* fname) { + int n = jio_snprintf(buffer, size, "%s%s%s", JNI_LIB_PREFIX, fname, JNI_LIB_SUFFIX); + return (n != -1); +} + +// Helper for dll_locate_lib. +// Pass buffer and printbuffer as we already printed the path to buffer +// when we called get_current_directory. This way we avoid another buffer +// of size MAX_PATH. +static bool conc_path_file_and_check(char *buffer, char *printbuffer, size_t printbuflen, + const char* pname, char lastchar, const char* fname) { + + // Concatenate path and file name, but don't print double path separators. + const char *filesep = (WINDOWS_ONLY(lastchar == ':' ||) lastchar == os::file_separator()[0]) ? + "" : os::file_separator(); + int ret = jio_snprintf(printbuffer, printbuflen, "%s%s%s", pname, filesep, fname); + // Check whether file exists. + if (ret != -1) { + struct stat statbuf; + return os::stat(buffer, &statbuf) == 0; + } + return false; +} + +bool os::dll_locate_lib(char *buffer, size_t buflen, + const char* pname, const char* fname) { + bool retval = false; + + size_t fullfnamelen = strlen(JNI_LIB_PREFIX) + strlen(fname) + strlen(JNI_LIB_SUFFIX); + char* fullfname = (char*)NEW_C_HEAP_ARRAY(char, fullfnamelen + 1, mtInternal); + if (dll_build_name(fullfname, fullfnamelen + 1, fname)) { + const size_t pnamelen = pname ? strlen(pname) : 0; + + if (pnamelen == 0) { + // If no path given, use current working directory. + const char* p = get_current_directory(buffer, buflen); + if (p != NULL) { + const size_t plen = strlen(buffer); + const char lastchar = buffer[plen - 1]; + retval = conc_path_file_and_check(buffer, &buffer[plen], buflen - plen, + "", lastchar, fullfname); + } + } else if (strchr(pname, *os::path_separator()) != NULL) { + // A list of paths. Search for the path that contains the library. + int n; + char** pelements = split_path(pname, &n); + if (pelements != NULL) { + for (int i = 0; i < n; i++) { + char* path = pelements[i]; + // Really shouldn't be NULL, but check can't hurt. + size_t plen = (path == NULL) ? 0 : strlen(path); + if (plen == 0) { + continue; // Skip the empty path values. + } + const char lastchar = path[plen - 1]; + retval = conc_path_file_and_check(buffer, buffer, buflen, path, lastchar, fullfname); + if (retval) break; + } + // Release the storage allocated by split_path. + for (int i = 0; i < n; i++) { + if (pelements[i] != NULL) { + FREE_C_HEAP_ARRAY(char, pelements[i]); + } + } + FREE_C_HEAP_ARRAY(char*, pelements); + } + } else { + // A definite path. + const char lastchar = pname[pnamelen-1]; + retval = conc_path_file_and_check(buffer, buffer, buflen, pname, lastchar, fullfname); + } + } + + FREE_C_HEAP_ARRAY(char*, fullfname); + return retval; +} // --------------------- sun.misc.Signal (optional) --------------------- @@ -427,13 +503,13 @@ // Try to load verify dll first. In 1.3 java dll depends on it and is not // always able to find it when the loading executable is outside the JDK. // In order to keep working with 1.2 we ignore any loading errors. - if (dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), + if (dll_locate_lib(buffer, sizeof(buffer), Arguments::get_dll_dir(), "verify")) { dll_load(buffer, ebuf, sizeof(ebuf)); } // Load java dll - if (dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), + if (dll_locate_lib(buffer, sizeof(buffer), Arguments::get_dll_dir(), "java")) { _native_java_library = dll_load(buffer, ebuf, sizeof(ebuf)); } @@ -444,7 +520,7 @@ #if defined(__OpenBSD__) // Work-around OpenBSD's lack of $ORIGIN support by pre-loading libnet.so // ignore errors - if (dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), + if (dll_locate_lib(buffer, sizeof(buffer), Arguments::get_dll_dir(), "net")) { dll_load(buffer, ebuf, sizeof(ebuf)); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/os.hpp --- a/hotspot/src/share/vm/runtime/os.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/runtime/os.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -476,7 +476,6 @@ static frame fetch_frame_from_context(const void* ucVoid); static frame fetch_frame_from_ucontext(Thread* thread, void* ucVoid); - static ExtendedPC get_thread_pc(Thread *thread); static void breakpoint(); static bool start_debugging(char *buf, int buflen); @@ -541,9 +540,16 @@ static const char* get_temp_directory(); static const char* get_current_directory(char *buf, size_t buflen); - // Builds a platform-specific full library path given a ld path and lib name - // Returns true if buffer contains full path to existing file, false otherwise + // Builds the platform-specific name of a library. + // Returns false if the buffer is too small. static bool dll_build_name(char* buffer, size_t size, + const char* fname); + + // Builds a platform-specific full library path given an ld path and + // unadorned library name. Returns true if the buffer contains a full + // path to an existing file, false otherwise. If pathname is empty, + // uses the path to the current directory. + static bool dll_locate_lib(char* buffer, size_t size, const char* pathname, const char* fname); // Symbol lookup, find nearest function name; basically it implements diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/sweeper.cpp --- a/hotspot/src/share/vm/runtime/sweeper.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/runtime/sweeper.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -53,7 +53,7 @@ public: int traversal; int compile_id; - jlong traversal_mark; + long traversal_mark; int state; const char* kind; address vep; @@ -62,7 +62,7 @@ void print() { tty->print_cr("traversal = %d compile_id = %d %s uep = " PTR_FORMAT " vep = " - PTR_FORMAT " state = %d traversal_mark "JLONG_FORMAT" line = %d", + PTR_FORMAT " state = %d traversal_mark %ld line = %d", traversal, compile_id, kind == NULL ? "" : kind, @@ -629,6 +629,7 @@ } else if (cm->is_not_entrant()) { // If there are no current activations of this method on the // stack we can safely convert it to a zombie method + OrderAccess::loadload(); // _stack_traversal_mark and _state if (cm->can_convert_to_zombie()) { // Clear ICStubs to prevent back patching stubs of zombie or flushed // nmethods during the next safepoint (see ICStub::finalize). diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/thread.cpp --- a/hotspot/src/share/vm/runtime/thread.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/runtime/thread.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -63,7 +63,6 @@ #include "runtime/commandLineFlagWriteableList.hpp" #include "runtime/commandLineFlagRangeList.hpp" #include "runtime/deoptimization.hpp" -#include "runtime/fprofiler.hpp" #include "runtime/frame.inline.hpp" #include "runtime/globals.hpp" #include "runtime/init.hpp" @@ -748,19 +747,6 @@ } #endif // PRODUCT -// Called by flat profiler -// Callers have already called wait_for_ext_suspend_completion -// The assertion for that is currently too complex to put here: -bool JavaThread::profile_last_Java_frame(frame* _fr) { - bool gotframe = false; - // self suspension saves needed state. - if (has_last_Java_frame() && _anchor.walkable()) { - *_fr = pd_last_frame(); - gotframe = true; - } - return gotframe; -} - void Thread::interrupt(Thread* thread) { debug_only(check_for_dangling_thread_pointer(thread);) os::interrupt(thread); @@ -1381,14 +1367,6 @@ while (watcher_thread() != NULL) { // This wait should make safepoint checks, wait without a timeout, // and wait as a suspend-equivalent condition. - // - // Note: If the FlatProfiler is running, then this thread is waiting - // for the WatcherThread to terminate and the WatcherThread, via the - // FlatProfiler task, is waiting for the external suspend request on - // this thread to complete. wait_for_ext_suspend_completion() will - // eventually timeout, but that takes time. Making this wait a - // suspend-equivalent condition solves that timeout problem. - // Terminator_lock->wait(!Mutex::_no_safepoint_check_flag, 0, Mutex::_as_suspend_equivalent_flag); } @@ -1505,16 +1483,6 @@ } #endif // PRODUCT - set_thread_profiler(NULL); - if (FlatProfiler::is_active()) { - // This is where we would decide to either give each thread it's own profiler - // or use one global one from FlatProfiler, - // or up to some count of the number of profiled threads, etc. - ThreadProfiler* pp = new ThreadProfiler(); - pp->engage(); - set_thread_profiler(pp); - } - // Setup safepoint state info for this thread ThreadSafepointState::create(this); @@ -1660,7 +1628,6 @@ // All Java related clean up happens in exit ThreadSafepointState::destroy(this); - if (_thread_profiler != NULL) delete _thread_profiler; if (_thread_stat != NULL) delete _thread_stat; #if INCLUDE_JVMCI @@ -1775,13 +1742,6 @@ Handle threadObj(this, this->threadObj()); assert(threadObj.not_null(), "Java thread object should be created"); - if (get_thread_profiler() != NULL) { - get_thread_profiler()->disengage(); - ResourceMark rm; - get_thread_profiler()->print(get_thread_name()); - } - - // FIXIT: This code should be moved into else part, when reliable 1.2/1.3 check is in place { EXCEPTION_MARK; @@ -1983,12 +1943,6 @@ #endif // INCLUDE_ALL_GCS void JavaThread::cleanup_failed_attach_current_thread() { - if (get_thread_profiler() != NULL) { - get_thread_profiler()->disengage(); - ResourceMark rm; - get_thread_profiler()->print(get_thread_name()); - } - if (active_handles() != NULL) { JNIHandleBlock* block = active_handles(); set_active_handles(NULL); @@ -2786,9 +2740,6 @@ // Verify that the deferred card marks have been flushed. assert(deferred_card_mark().is_empty(), "Should be empty during GC"); - // The ThreadProfiler oops_do is done from FlatProfiler::oops_do - // since there may be more than one thread using each ThreadProfiler. - // Traverse the GCHandles Thread::oops_do(f, cf); @@ -3717,14 +3668,6 @@ Thread* THREAD = Thread::current(); - // At this point, the Universe is initialized, but we have not executed - // any byte code. Now is a good time (the only time) to dump out the - // internal state of the JVM for sharing. - if (DumpSharedSpaces) { - MetaspaceShared::preload_and_dump(CHECK_JNI_ERR); - ShouldNotReachHere(); - } - // Always call even when there are not JVMTI environments yet, since environments // may be attached late and JVMTI must track phases of VM execution JvmtiExport::enter_early_start_phase(); @@ -3849,7 +3792,6 @@ } #endif // INCLUDE_MANAGEMENT - if (Arguments::has_profile()) FlatProfiler::engage(main_thread, true); if (MemProfiling) MemProfiler::engage(); StatSampler::engage(); if (CheckJNICalls) JniPeriodicChecker::engage(); @@ -3887,6 +3829,12 @@ #ifdef ASSERT _vm_complete = true; #endif + + if (DumpSharedSpaces) { + MetaspaceShared::preload_and_dump(CHECK_JNI_ERR); + ShouldNotReachHere(); + } + return JNI_OK; } @@ -3925,13 +3873,12 @@ } } else { // Try to load the agent from the standard dll directory - if (os::dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), + if (os::dll_locate_lib(buffer, sizeof(buffer), Arguments::get_dll_dir(), name)) { library = os::dll_load(buffer, ebuf, sizeof ebuf); } - if (library == NULL) { // Try the local directory - char ns[1] = {0}; - if (os::dll_build_name(buffer, sizeof(buffer), ns, name)) { + if (library == NULL) { // Try the library path directory. + if (os::dll_build_name(buffer, sizeof(buffer), name)) { library = os::dll_load(buffer, ebuf, sizeof ebuf); } if (library == NULL) { @@ -4139,7 +4086,7 @@ // + Call before_exit(), prepare for VM exit // > run VM level shutdown hooks (they are registered through JVM_OnExit(), // currently the only user of this mechanism is File.deleteOnExit()) -// > stop flat profiler, StatSampler, watcher thread, CMS threads, +// > stop StatSampler, watcher thread, CMS threads, // post thread end and vm death events to JVMTI, // stop signal thread // + Call JavaThread::exit(), it will: @@ -4168,14 +4115,6 @@ while (Threads::number_of_non_daemon_threads() > 1) // This wait should make safepoint checks, wait without a timeout, // and wait as a suspend-equivalent condition. - // - // Note: If the FlatProfiler is running and this thread is waiting - // for another non-daemon thread to finish, then the FlatProfiler - // is waiting for the external suspend request on this thread to - // complete. wait_for_ext_suspend_completion() will eventually - // timeout, but that takes time. Making this wait a suspend- - // equivalent condition solves that timeout problem. - // Threads_lock->wait(!Mutex::_no_safepoint_check_flag, 0, Mutex::_as_suspend_equivalent_flag); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/thread.hpp --- a/hotspot/src/share/vm/runtime/thread.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/runtime/thread.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -56,7 +56,6 @@ #endif class ThreadSafepointState; -class ThreadProfiler; class JvmtiThreadState; class JvmtiGetLoadedClassesClosure; @@ -1720,23 +1719,6 @@ void deoptimized_wrt_marked_nmethods(); - // Profiling operation (see fprofile.cpp) - public: - bool profile_last_Java_frame(frame* fr); - - private: - ThreadProfiler* _thread_profiler; - private: - friend class FlatProfiler; // uses both [gs]et_thread_profiler. - friend class FlatProfilerTask; // uses get_thread_profiler. - friend class ThreadProfilerMark; // uses get_thread_profiler. - ThreadProfiler* get_thread_profiler() { return _thread_profiler; } - ThreadProfiler* set_thread_profiler(ThreadProfiler* tp) { - ThreadProfiler* result = _thread_profiler; - _thread_profiler = tp; - return result; - } - public: // Returns the running thread as a JavaThread static inline JavaThread* current(); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/runtime/vmStructs.cpp --- a/hotspot/src/share/vm/runtime/vmStructs.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/runtime/vmStructs.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -841,7 +841,7 @@ nonstatic_field(nmethod, _verified_entry_point, address) \ nonstatic_field(nmethod, _osr_entry_point, address) \ volatile_nonstatic_field(nmethod, _lock_count, jint) \ - volatile_nonstatic_field(nmethod, _stack_traversal_mark, jlong) \ + volatile_nonstatic_field(nmethod, _stack_traversal_mark, long) \ nonstatic_field(nmethod, _compile_id, int) \ nonstatic_field(nmethod, _comp_level, int) \ \ diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/services/diagnosticCommand.cpp --- a/hotspot/src/share/vm/services/diagnosticCommand.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/services/diagnosticCommand.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -414,11 +414,7 @@ } void SystemGCDCmd::execute(DCmdSource source, TRAPS) { - if (!DisableExplicitGC) { - Universe::heap()->collect(GCCause::_dcmd_gc_run); - } else { - output()->print_cr("Explicit GC is disabled, no GC has been performed."); - } + Universe::heap()->collect(GCCause::_dcmd_gc_run); } void RunFinalizationDCmd::execute(DCmdSource source, TRAPS) { diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/utilities/decoder.cpp --- a/hotspot/src/share/vm/utilities/decoder.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/utilities/decoder.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -30,6 +30,7 @@ #if defined(_WINDOWS) #include "decoder_windows.hpp" + #include "windbghelp.hpp" #elif defined(__APPLE__) #include "decoder_machO.hpp" #elif defined(AIX) @@ -162,3 +163,9 @@ _shared_decoder = &_do_nothing_decoder; } +void Decoder::print_state_on(outputStream* st) { +#ifdef _WINDOWS + WindowsDbgHelp::print_state_on(st); +#endif +} + diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/utilities/decoder.hpp --- a/hotspot/src/share/vm/utilities/decoder.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/utilities/decoder.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -29,6 +29,7 @@ #include "memory/allocation.hpp" #include "runtime/mutex.hpp" #include "runtime/mutexLocker.hpp" +#include "utilities/ostream.hpp" class AbstractDecoder : public CHeapObj { public: @@ -41,7 +42,6 @@ out_of_memory, // out of memory file_invalid, // invalid elf file file_not_found, // could not found symbol file (on windows), such as jvm.pdb or jvm.map - helper_not_found, // could not load dbghelp.dll (Windows only) helper_func_error, // decoding functions not found (Windows only) helper_init_error // SymInitialize failed (Windows only) }; @@ -117,6 +117,9 @@ // shutdown shared instance static void shutdown(); + + static void print_state_on(outputStream* st); + protected: // shared decoder instance, _shared_instance_lock is needed static AbstractDecoder* get_shared_instance(); diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/utilities/exceptions.cpp --- a/hotspot/src/share/vm/utilities/exceptions.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/utilities/exceptions.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -87,13 +87,9 @@ #endif // ASSERT if (thread->is_VM_thread() - || !thread->can_call_java() - || DumpSharedSpaces ) { + || !thread->can_call_java()) { // We do not care what kind of exception we get for the vm-thread or a thread which // is compiling. We just install a dummy exception object - // - // We also cannot throw a proper exception when dumping, because we cannot run - // Java bytecodes now. A dummy exception will suffice. thread->set_pending_exception(Universe::vm_exception(), file, line); return true; } @@ -114,13 +110,9 @@ } if (thread->is_VM_thread() - || !thread->can_call_java() - || DumpSharedSpaces ) { + || !thread->can_call_java()) { // We do not care what kind of exception we get for the vm-thread or a thread which // is compiling. We just install a dummy exception object - // - // We also cannot throw a proper exception when dumping, because we cannot run - // Java bytecodes now. A dummy exception will suffice. thread->set_pending_exception(Universe::vm_exception(), file, line); return true; } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/utilities/macros.hpp --- a/hotspot/src/share/vm/utilities/macros.hpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/utilities/macros.hpp Sat Sep 09 14:36:45 2017 +0200 @@ -65,18 +65,6 @@ #define NOT_JVMTI_RETURN_(code) { return code; } #endif // INCLUDE_JVMTI -#ifndef INCLUDE_FPROF -#define INCLUDE_FPROF 1 -#endif - -#if INCLUDE_FPROF -#define NOT_FPROF_RETURN /* next token must be ; */ -#define NOT_FPROF_RETURN_(code) /* next token must be ; */ -#else -#define NOT_FPROF_RETURN {} -#define NOT_FPROF_RETURN_(code) { return code; } -#endif // INCLUDE_FPROF - #ifndef INCLUDE_VM_STRUCTS #define INCLUDE_VM_STRUCTS 1 #endif diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/src/share/vm/utilities/vmError.cpp --- a/hotspot/src/share/vm/utilities/vmError.cpp Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/src/share/vm/utilities/vmError.cpp Sat Sep 09 14:36:45 2017 +0200 @@ -890,6 +890,13 @@ st->cr(); } + STEP("printing native decoder state") + + if (_verbose) { + Decoder::print_state_on(st); + st->cr(); + } + STEP("printing VM options") if (_verbose) { diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/test/Makefile --- a/hotspot/test/Makefile Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/test/Makefile Sat Sep 09 14:36:45 2017 +0200 @@ -70,8 +70,8 @@ CONCURRENCY := 12 endif -# Make sure MaxRAMFraction is high enough to not cause OOM or swapping since we may end up with a lot of JVM's -JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMFraction=$(shell expr $(CONCURRENCY) \* 4) +# Make sure MaxRAMPercentage is high enough to not cause OOM or swapping since we may end up with a lot of JVM's +JTREG_BASIC_OPTIONS += -vmoption:-XX:MaxRAMPercentage=$(shell expr 25 / $(CONCURRENCY)) # Include the common base file with most of the logic include ../../test/TestCommon.gmk diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/test/gc/g1/TestGCLogMessages.java --- a/hotspot/test/gc/g1/TestGCLogMessages.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/test/gc/g1/TestGCLogMessages.java Sat Sep 09 14:36:45 2017 +0200 @@ -110,7 +110,6 @@ new LogMessageWithLevel("Universe Roots", Level.TRACE), new LogMessageWithLevel("JNI Handles Roots", Level.TRACE), new LogMessageWithLevel("ObjectSynchronizer Roots", Level.TRACE), - new LogMessageWithLevel("FlatProfiler Roots", Level.TRACE), new LogMessageWithLevel("Management Roots", Level.TRACE), new LogMessageWithLevel("SystemDictionary Roots", Level.TRACE), new LogMessageWithLevel("CLDG Roots", Level.TRACE), diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java --- a/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java Sat Sep 09 14:36:45 2017 +0200 @@ -36,10 +36,10 @@ public class FlagWithInvalidValue { public static void main(String[] args) throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - "-XX:MaxRAMFraction=v", "-version"); + "-XX:MaxRAMPercentage=v", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("Improperly specified VM option 'MaxRAMFraction=v'"); + output.shouldContain("Improperly specified VM option 'MaxRAMPercentage=v'"); output.shouldHaveExitValue(1); } } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java --- a/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java Sat Sep 09 14:36:45 2017 +0200 @@ -36,17 +36,17 @@ public class NonBooleanFlagWithInvalidBooleanPrefix { public static void main(String[] args) throws Exception { ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( - "-XX:-MaxRAMFraction=16", "-version"); + "-XX:-MaxRAMPercentage=1", "-version"); OutputAnalyzer output = new OutputAnalyzer(pb.start()); - output.shouldContain("Unexpected +/- setting in VM option 'MaxRAMFraction=16'"); + output.shouldContain("Unexpected +/- setting in VM option 'MaxRAMPercentage=1'"); output.shouldHaveExitValue(1); pb = ProcessTools.createJavaProcessBuilder( - "-XX:+MaxRAMFraction=16", "-version"); + "-XX:+MaxRAMPercentage=1", "-version"); output = new OutputAnalyzer(pb.start()); - output.shouldContain("Unexpected +/- setting in VM option 'MaxRAMFraction=16'"); + output.shouldContain("Unexpected +/- setting in VM option 'MaxRAMPercentage=1'"); output.shouldHaveExitValue(1); } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java --- a/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java Sat Sep 09 14:36:45 2017 +0200 @@ -42,7 +42,6 @@ "-green", "-native", "-Xrs", - "-Xprof", "-Xconcurrentio", "-Xinternalversion", "-Xprintflags", diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java --- a/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/test/runtime/CommandLine/VMDeprecatedOptions.java Sat Sep 09 14:36:45 2017 +0200 @@ -43,6 +43,9 @@ {"MaxGCMinorPauseMillis", "1032"}, {"MustCallLoadClassInternal", "false"}, {"UnsyncloadClass", "false"}, + {"MaxRAMFraction", "8"}, + {"MinRAMFraction", "2"}, + {"InitialRAMFraction", "64"}, // deprecated alias flags (see also aliased_jvm_flags): {"DefaultMaxRAMFraction", "4"}, diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/test/runtime/MinimalVM/Xprof.java --- a/hotspot/test/runtime/MinimalVM/Xprof.java Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2016, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * @test - * @requires vm.flavor == "minimal" - * @modules java.base/jdk.internal.misc - * @library /test/lib - * @run driver Xprof - */ - -import jdk.test.lib.process.OutputAnalyzer; -import jdk.test.lib.process.ProcessTools; - -public class Xprof { - - public static void main(String args[]) throws Exception { - ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-minimal", "-Xprof", "-version"); - new OutputAnalyzer(pb.start()) - .shouldContain("Flat profiling is not supported in this VM.") - .shouldHaveExitValue(1); - - } -} diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java --- a/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/test/runtime/SharedArchiveFile/BootAppendTests.java Sat Sep 09 14:36:45 2017 +0200 @@ -205,7 +205,11 @@ OutputAnalyzer out = CDSTestUtils.runWithArchive(opts); CDSTestUtils.checkExec(out, opts, "[class,load] org.omg.CORBA.Context"); if (!CDSTestUtils.isUnableToMap(out)) { - out.shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar"); + if (mode.equals("off")) { + out.shouldMatch(".*\\[class,load\\] org.omg.CORBA.Context source:.*bootAppend.jar"); + } else { + CDSTestUtils.checkExec(out, opts, "[class,load] org.omg.CORBA.Context source: shared objects file"); + } } } } diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/test/runtime/SharedArchiveFile/NonBootLoaderClasses.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hotspot/test/runtime/SharedArchiveFile/NonBootLoaderClasses.java Sat Sep 09 14:36:45 2017 +0200 @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2017, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test NonBootLoaderClasses + * @summary Test to ensure platform and app classes are not being archived + * @requires (vm.opt.UseCompressedOops == null) | (vm.opt.UseCompressedOops == true) + * @library /test/lib + * @modules java.base/jdk.internal.misc + * java.management + * @run main NonBootLoaderClasses + */ + +import jdk.test.lib.cds.CDSOptions; +import jdk.test.lib.cds.CDSTestUtils; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import java.io.File; + +public class NonBootLoaderClasses { + public static void main(String[] args) throws Exception { + final String PLATFORM_CLASS = "jdk/dynalink/DynamicLinker"; + final String APP_CLASS = "com/sun/tools/javac/Main"; + String[] classes = {PLATFORM_CLASS, APP_CLASS}; + String classList = + CDSTestUtils.makeClassList(classes).getPath(); + String archiveName = "NonBootLoaderClasses.jsa"; + CDSOptions opts = (new CDSOptions()) + .addPrefix("-XX:ExtraSharedClassListFile=" + classList) + .setArchiveName(archiveName); + CDSTestUtils.createArchiveAndCheck(opts); + + // Print the shared dictionary and inspect the output + ProcessBuilder pb = ProcessTools.createJavaProcessBuilder( + "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=./" + archiveName, + "-XX:+PrintSharedArchiveAndExit", "-XX:+PrintSharedDictionary"); + OutputAnalyzer out = CDSTestUtils.executeAndLog(pb, "print-shared-archive"); + if (!CDSTestUtils.isUnableToMap(out)) { + out.shouldContain("archive is valid") + .shouldHaveExitValue(0) // Should report success in error code. + .shouldNotContain(PLATFORM_CLASS) + .shouldNotContain(APP_CLASS); + } + } +} diff -r 000f4e4ddd39 -r 57173ad5c534 hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java --- a/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java Fri Sep 01 14:13:40 2017 +0000 +++ b/hotspot/test/runtime/modules/PatchModule/PatchModuleCDS.java Sat Sep 09 14:36:45 2017 +0200 @@ -69,7 +69,7 @@ "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=" + filename, "-Xshare:dump", - "--patch-module=java.base=" + System.getProperty("test.classes"), + "--patch-module=java.naming=" + System.getProperty("test.classes"), "-Xlog:class+path=info", "-version"); new OutputAnalyzer(pb.start()) diff -r 000f4e4ddd39 -r 57173ad5c534 jaxp/.hgtags --- a/jaxp/.hgtags Fri Sep 01 14:13:40 2017 +0000 +++ b/jaxp/.hgtags Sat Sep 09 14:36:45 2017 +0200 @@ -446,3 +446,4 @@ ea18d767c9ec50ea7f40bbe6cf7379d3538110f1 jdk-9+181 f7d596aa57aece4e5f473b1ac97e26cd0aebc647 jdk-10+20 dcd49f380d7504a49769c26d7bd756623cb9b828 jdk-10+21 +47872600e78b509a15490fe009986d4969794f56 jdk-10+22 diff -r 000f4e4ddd39 -r 57173ad5c534 jaxws/.hgtags --- a/jaxws/.hgtags Fri Sep 01 14:13:40 2017 +0000 +++ b/jaxws/.hgtags Sat Sep 09 14:36:45 2017 +0200 @@ -449,3 +449,4 @@ 4f852cc3a1c998e78a989ba4667ffa9b867d9d01 jdk-9+181 1658a5e7d171e9c3cc2462fac2789ec63294ecca jdk-10+20 30ed8fb6a1d17e4065d07bc031cf2368aeca8d1e jdk-10+21 +c162c9e4c9c0976c8de44d2377a16a452bb99126 jdk-10+22 diff -r 000f4e4ddd39 -r 57173ad5c534 jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBPermission.java --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBPermission.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/JAXBPermission.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2017, 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 @@ -41,15 +41,19 @@ * and for each provides a description of what the permission allows * and a discussion of the risks of granting code the permission. * - * + *
    + * + * * - * - * - * + * + * + * * + * * + * * - * + * * * + * *
    Permission target name, what the permission allows, and associated risks"
    Permission Target NameWhat the Permission AllowsRisks of Allowing this PermissionPermission Target NameWhat the Permission AllowsRisks of Allowing this Permission
    setDatatypeConvertersetDatatypeConverter * Allows the code to set VM-wide {@link DatatypeConverterInterface} * via {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface) the setDatatypeConverter method} @@ -63,6 +67,7 @@ * another application running in the same JVM. *
    * * @see java.security.BasicPermission diff -r 000f4e4ddd39 -r 57173ad5c534 jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Marshaller.java --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Marshaller.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Marshaller.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -373,7 +373,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See + * object reachable from {@code jaxbElement}). See * Marshalling a JAXB element. * @throws IllegalArgumentException * If any of the method parameters are null @@ -395,7 +395,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See + * object reachable from {@code jaxbElement}). See * Marshalling a JAXB element. * @throws IllegalArgumentException * If any of the method parameters are null @@ -417,7 +417,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See + * object reachable from {@code jaxbElement}). See * Marshalling a JAXB element. * @throws IllegalArgumentException * If any of the method parameters are null @@ -440,7 +440,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See + * object reachable from {@code jaxbElement}). See * Marshalling a JAXB element. * @throws IllegalArgumentException * If any of the method parameters are null @@ -462,7 +462,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See + * object reachable from {@code jaxbElement}). See * Marshalling a JAXB element. * @throws IllegalArgumentException * If any of the method parameters are null @@ -488,7 +488,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See + * object reachable from {@code jaxbElement}). See * Marshalling a JAXB element. * @throws IllegalArgumentException * If any of the method parameters are null @@ -511,7 +511,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See + * object reachable from {@code jaxbElement}). See * Marshalling a JAXB element. * @throws IllegalArgumentException * If any of the method parameters are null @@ -535,7 +535,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See + * object reachable from {@code jaxbElement}). See * Marshalling a JAXB element. * @throws IllegalArgumentException * If any of the method parameters are null @@ -575,7 +575,7 @@ * {@code Marshaller}. This method can only be used to set one of * the standard JAXB defined properties above or a provider specific * property. Attempting to set an undefined property will result in - * a PropertyException being thrown. See + * a PropertyException being thrown. See * Supported Properties. * * @param name the name of the property to be set. This value can either @@ -596,7 +596,7 @@ * {@code Marshaller}. This method can only be used to get one of * the standard JAXB defined properties above or a provider specific * property. Attempting to get an undefined property will result in - * a PropertyException being thrown. See + * a PropertyException being thrown. See * Supported Properties. * * @param name the name of the property to retrieve diff -r 000f4e4ddd39 -r 57173ad5c534 jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Unmarshaller.java --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Unmarshaller.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/Unmarshaller.java Sat Sep 09 14:36:45 2017 +0200 @@ -186,13 +186,13 @@ * Unmarshalling can deserialize XML data that represents either an entire XML document * or a subtree of an XML document. Typically, it is sufficient to use the * unmarshalling methods described by - * Unmarshal root element that is declared globally. + * Unmarshal root element that is declared globally. * These unmarshal methods utilize {@link JAXBContext}'s mapping of global XML element * declarations and type definitions to JAXB mapped classes to initiate the * unmarshalling of the root element of XML data. When the {@link JAXBContext}'s * mappings are not sufficient to unmarshal the root element of XML data, * the application can assist the unmarshalling process by using the - * unmarshal by declaredType methods. + * unmarshal by declaredType methods. * These methods are useful for unmarshalling XML data where * the root element corresponds to a local element declaration in the schema. * @@ -245,32 +245,29 @@ * instance are set. * * - * + *
    + * * * - * - * - * - * + * + * * * - * - * + * + * * * * * - * + * * * * - * + * * * * - * + * * * * @@ -279,7 +276,7 @@ * *

    * The following is an example of - * unmarshal by declaredType method. + * unmarshal by declaredType method. *

    * Unmarshal by declaredType from a {@code org.w3c.dom.Node}: *

    @@ -414,7 +411,7 @@ * content tree. * *

    - * Implements Unmarshal Global Root Element. + * Implements Unmarshal Global Root Element. * * @param f the file to unmarshal XML data from * @return the newly created root object of the java content tree @@ -425,7 +422,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data + * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If the file parameter is null */ @@ -437,7 +434,7 @@ * be incomplete when using this form of the unmarshal API. * *

    - * Implements Unmarshal Global Root Element. + * Implements Unmarshal Global Root Element. * * @param is the InputStream to unmarshal XML data from * @return the newly created root object of the java content tree @@ -448,7 +445,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data + * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If the InputStream parameter is null */ @@ -461,7 +458,7 @@ * because a Reader does not provide the system ID. * *

    - * Implements Unmarshal Global Root Element. + * Implements Unmarshal Global Root Element. * * @param reader the Reader to unmarshal XML data from * @return the newly created root object of the java content tree @@ -472,7 +469,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data + * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If the InputStream parameter is null * @since 1.6, JAXB 2.0 @@ -484,7 +481,7 @@ * content tree. * *

    - * Implements Unmarshal Global Root Element. + * Implements Unmarshal Global Root Element. * * @param url the url to unmarshal XML data from * @return the newly created root object of the java content tree @@ -495,7 +492,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data + * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If the URL parameter is null */ @@ -506,7 +503,7 @@ * resulting content tree. * *

    - * Implements Unmarshal Global Root Element. + * Implements Unmarshal Global Root Element. * * @param source the input source to unmarshal XML data from * @return the newly created root object of the java content tree @@ -517,7 +514,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data + * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If the InputSource parameter is null */ @@ -528,7 +525,7 @@ * content tree. * *

    - * Implements Unmarshal Global Root Element. + * Implements Unmarshal Global Root Element. * * @param node * the document/element to unmarshal XML data from. @@ -541,7 +538,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data + * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If the Node parameter is null * @see #unmarshal(org.w3c.dom.Node, Class) @@ -553,7 +550,7 @@ * and return the resulting content tree. * *

    - * Implements Unmarshal by Declared Type + * Implements Unmarshal by Declared Type * * @param node * the document/element to unmarshal XML data from. @@ -561,7 +558,7 @@ * @param declaredType * appropriate JAXB mapped class to hold {@code node}'s XML data. * - * @return JAXB Element representation of {@code node} + * @return JAXB Element representation of {@code node} * * @throws JAXBException * If any unexpected errors occur while unmarshalling @@ -569,7 +566,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data + * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If any parameter is null * @since 1.6, JAXB 2.0 @@ -581,7 +578,7 @@ * resulting content tree. * *

    - * Implements Unmarshal Global Root Element. + * Implements Unmarshal Global Root Element. * *

    * @@ -627,7 +624,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data + * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If the Source parameter is null * @see #unmarshal(javax.xml.transform.Source, Class) @@ -641,16 +638,16 @@ * resulting content tree. * *

    - * Implements Unmarshal by Declared Type + * Implements Unmarshal by Declared Type * *

    - * See SAX 2.0 Parser Pluggability + * See SAX 2.0 Parser Pluggability * * @param source the XML Source to unmarshal XML data from (providers are * only required to support SAXSource, DOMSource, and StreamSource) * @param declaredType * appropriate JAXB mapped class to hold {@code source}'s xml root element - * @return Java content rooted by JAXB Element + * @return Java content rooted by JAXB Element * * @throws JAXBException * If any unexpected errors occur while unmarshalling @@ -658,7 +655,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data + * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If any parameter is null * @since 1.6, JAXB 2.0 @@ -671,7 +668,7 @@ * resulting content tree. * *

    - * Implements Unmarshal Global Root Element. + * Implements Unmarshal Global Root Element. * *

    * This method assumes that the parser is on a START_DOCUMENT or @@ -691,7 +688,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data + * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If the {@code reader} parameter is null * @throws IllegalStateException @@ -708,7 +705,7 @@ * and return the resulting content tree. * *

    - * This method implements unmarshal by declaredType. + * This method implements unmarshal by declaredType. *

    * This method assumes that the parser is on a START_DOCUMENT or * START_ELEMENT event. Unmarshalling will be done from this @@ -721,7 +718,7 @@ * @param declaredType * appropriate JAXB mapped class to hold {@code reader}'s START_ELEMENT XML data. * - * @return content tree rooted by JAXB Element representation + * @return content tree rooted by JAXB Element representation * * @throws JAXBException * If any unexpected errors occur while unmarshalling @@ -729,7 +726,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data + * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If any parameter is null * @since 1.6, JAXB 2.0 @@ -741,7 +738,7 @@ * resulting content tree. * *

    - * This method is an Unmarshal Global Root method. + * This method is an Unmarshal Global Root method. * *

    * This method assumes that the parser is on a START_DOCUMENT or @@ -761,7 +758,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data + * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If the {@code reader} parameter is null * @throws IllegalStateException @@ -778,7 +775,7 @@ * and return the resulting content tree. * *

    - * This method implements unmarshal by declaredType. + * This method implements unmarshal by declaredType. * *

    * This method assumes that the parser is on a START_DOCUMENT or @@ -792,7 +789,7 @@ * @param declaredType * appropriate JAXB mapped class to hold {@code reader}'s START_ELEMENT XML data. * - * @return content tree rooted by JAXB Element representation + * @return content tree rooted by JAXB Element representation * * @throws JAXBException * If any unexpected errors occur while unmarshalling @@ -800,7 +797,7 @@ * If the {@link ValidationEventHandler ValidationEventHandler} * returns false from its {@code handleEvent} method or the * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data + * binding. See Unmarshalling XML Data * @throws IllegalArgumentException * If any parameter is null * @since 1.6, JAXB 2.0 @@ -913,7 +910,7 @@ * {@code Unmarshaller}. This method can only be used to set one of * the standard JAXB defined properties above or a provider specific * property. Attempting to set an undefined property will result in - * a PropertyException being thrown. See + * a PropertyException being thrown. See * Supported Properties. * * @param name the name of the property to be set. This value can either @@ -934,7 +931,7 @@ * {@code Unmarshaller}. This method can only be used to get one of * the standard JAXB defined properties above or a provider specific * property. Attempting to get an undefined property will result in - * a PropertyException being thrown. See + * a PropertyException being thrown. See * Supported Properties. * * @param name the name of the property to retrieve diff -r 000f4e4ddd39 -r 57173ad5c534 jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlNsForm.java --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlNsForm.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlNsForm.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2017, 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 @@ -36,23 +36,26 @@ * The namespace qualification values are used in the annotations * defined in this packge. The enumeration values are mapped as follows: * - *

    Unmarshal By Declared Type returned JAXBElement
    - * Unmarshal By Declared Type returned JAXBElement - *
    JAXBElement PropertyValueJAXBElement PropertyValue
    name{@code xml element name}name{@code xml element name}
    valuevalue{@code instanceof declaredType}
    declaredTypedeclaredTypeunmarshal method {@code declaredType} parameter
    scopescope{@code null} (actual scope is unknown)
    + *
    + * + * + * + * + * + * + * + * * * - * - * - * - * - * - * + * * * - * - * + * + * * * - * - * + * + * * * diff -r 000f4e4ddd39 -r 57173ad5c534 jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2017, 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 @@ -113,58 +113,60 @@ * complex type or simple type. The notational symbols used in the table are: *
      *
    • {@literal ->} : represents a mapping
    • - *
    • [x]+ : one or more occurances of x
    • + *
    • [x]+ : one or more occurrences of x
    • *
    • [ {@code @XmlValue} property ]: JavaBean property annotated with * {@code @XmlValue}
    • *
    • X : don't care *
    *
    - *
    Mapping of enumeration values
    Enum ValueXML Schema Value
    Enum ValueXML Schema Value
    UNQUALIFIEDUNQUALIFIEDunqualified
    QUALIFIED
    QUALIFIEDqualified
    UNSET
    UNSETnamespace qualification attribute is absent from the * XML Schema fragment
    + *
    + * + * + * + * + * + * + * + * + * + * * * - * - * - * - * - * - * - * - * * * - * + * * * * * - * + * * * - * + * * * * * - * + * * * - * + * * * * * - * + * * * - * + * * * * * - * + * * * - * + * * * * diff -r 000f4e4ddd39 -r 57173ad5c534 jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/package-info.java --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/package-info.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/package-info.java Sat Sep 09 14:36:45 2017 +0200 @@ -26,13 +26,13 @@ /** * {@link javax.xml.bind.annotation.adapters.XmlAdapter} and its spec-defined * sub-classes to allow arbitrary Java classes to be used with JAXB. - *

    + * *

    Package Specification

    - *

    + * *

    - *

    + * *

    Related Documentation

    *

    * For overviews, tutorials, examples, guides, and tool documentation, diff -r 000f4e4ddd39 -r 57173ad5c534 jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/package.html --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/package.html Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ - - - - - - - - - - -

    - {@link javax.xml.bind.annotation.adapters.XmlAdapter} and its spec-defined - sub-classes to allow arbitrary Java classes to be used with JAXB. - -

    Package Specification

    - - - -

    Related Documentation

    - - For overviews, tutorials, examples, guides, and tool documentation, - please see: - - - - - - - - diff -r 000f4e4ddd39 -r 57173ad5c534 jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/package.html --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/package.html Fri Sep 01 14:13:40 2017 +0000 +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/annotation/package.html Sat Sep 09 14:36:45 2017 +0200 @@ -1,6 +1,6 @@ - + - - - - - - - - - -

    - JAXB Provider Use Only: Provides partial default implementations for - some of the javax.xml.bind interfaces. - -

    - JAXB Providers can extend these classes and implement the abstract - methods. - -

    Package Specification

    - - - -

    Related Documentation

    - - For overviews, tutorials, examples, guides, and tool documentation, - please see: - - - - - - - - diff -r 000f4e4ddd39 -r 57173ad5c534 jaxws/src/java.xml.bind/share/classes/javax/xml/bind/util/package-info.java --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/util/package-info.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/util/package-info.java Sat Sep 09 14:36:45 2017 +0200 @@ -25,13 +25,13 @@ /** * Useful client utility classes. - *

    + * *

    Package Specification

    - *

    + * *

    - *

    + * *

    Related Documentation

    *

    * For overviews, tutorials, examples, guides, and tool documentation, diff -r 000f4e4ddd39 -r 57173ad5c534 jaxws/src/java.xml.bind/share/classes/javax/xml/bind/util/package.html --- a/jaxws/src/java.xml.bind/share/classes/javax/xml/bind/util/package.html Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ - - - - - - - - - - - -

    - Useful client utility classes. - -

    Package Specification

    - - - -

    Related Documentation

    - - For overviews, tutorials, examples, guides, and tool documentation, - please see: - - - - - - - - diff -r 000f4e4ddd39 -r 57173ad5c534 jaxws/src/java.xml.ws/share/classes/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java --- a/jaxws/src/java.xml.ws/share/classes/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jaxws/src/java.xml.ws/share/classes/javax/xml/ws/wsaddressing/W3CEndpointReferenceBuilder.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -145,7 +145,7 @@ * Sets the {@code endpointName} as * {@code wsam:ServiceName/@EndpointName} in the * {@code wsa:Metadata} element. This method can only be called - * after the {@link #serviceName} method has been called. + * after the {@link #serviceName(QName)} method has been called. *

    * See * 2.1 Referencing WSDL Metadata from an EPR for more details. diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/.hgtags --- a/jdk/.hgtags Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/.hgtags Sat Sep 09 14:36:45 2017 +0200 @@ -446,3 +446,4 @@ bd66ea2fdde3d60a73b5272263a7b8b0ca926a33 jdk-9+181 6256e94781f55e6f9e04eb284298d00eb9c5e106 jdk-10+20 4e08a69241eab6e7a67a819a7b4fe29e7398855d jdk-10+21 +83720375178f919700dfbbd90650f8c8e0cf34f2 jdk-10+22 diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/make/data/charsetmapping/ISO_8859_16.map --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/make/data/charsetmapping/ISO_8859_16.map Sat Sep 09 14:36:45 2017 +0200 @@ -0,0 +1,258 @@ +# Confirmed with the mapping at +# http://ftp.unicode.org/Public/MAPPINGS/ISO8859/8859-16.TXT +0x00 U+0000 +0x01 U+0001 +0x02 U+0002 +0x03 U+0003 +0x04 U+0004 +0x05 U+0005 +0x06 U+0006 +0x07 U+0007 +0x08 U+0008 +0x09 U+0009 +0x0A U+000A +0x0B U+000B +0x0C U+000C +0x0D U+000D +0x0E U+000E +0x0F U+000F +0x10 U+0010 +0x11 U+0011 +0x12 U+0012 +0x13 U+0013 +0x14 U+0014 +0x15 U+0015 +0x16 U+0016 +0x17 U+0017 +0x18 U+0018 +0x19 U+0019 +0x1A U+001A +0x1B U+001B +0x1C U+001C +0x1D U+001D +0x1E U+001E +0x1F U+001F +0x20 U+0020 +0x21 U+0021 +0x22 U+0022 +0x23 U+0023 +0x24 U+0024 +0x25 U+0025 +0x26 U+0026 +0x27 U+0027 +0x28 U+0028 +0x29 U+0029 +0x2A U+002A +0x2B U+002B +0x2C U+002C +0x2D U+002D +0x2E U+002E +0x2F U+002F +0x30 U+0030 +0x31 U+0031 +0x32 U+0032 +0x33 U+0033 +0x34 U+0034 +0x35 U+0035 +0x36 U+0036 +0x37 U+0037 +0x38 U+0038 +0x39 U+0039 +0x3A U+003A +0x3B U+003B +0x3C U+003C +0x3D U+003D +0x3E U+003E +0x3F U+003F +0x40 U+0040 +0x41 U+0041 +0x42 U+0042 +0x43 U+0043 +0x44 U+0044 +0x45 U+0045 +0x46 U+0046 +0x47 U+0047 +0x48 U+0048 +0x49 U+0049 +0x4A U+004A +0x4B U+004B +0x4C U+004C +0x4D U+004D +0x4E U+004E +0x4F U+004F +0x50 U+0050 +0x51 U+0051 +0x52 U+0052 +0x53 U+0053 +0x54 U+0054 +0x55 U+0055 +0x56 U+0056 +0x57 U+0057 +0x58 U+0058 +0x59 U+0059 +0x5A U+005A +0x5B U+005B +0x5C U+005C +0x5D U+005D +0x5E U+005E +0x5F U+005F +0x60 U+0060 +0x61 U+0061 +0x62 U+0062 +0x63 U+0063 +0x64 U+0064 +0x65 U+0065 +0x66 U+0066 +0x67 U+0067 +0x68 U+0068 +0x69 U+0069 +0x6A U+006A +0x6B U+006B +0x6C U+006C +0x6D U+006D +0x6E U+006E +0x6F U+006F +0x70 U+0070 +0x71 U+0071 +0x72 U+0072 +0x73 U+0073 +0x74 U+0074 +0x75 U+0075 +0x76 U+0076 +0x77 U+0077 +0x78 U+0078 +0x79 U+0079 +0x7A U+007A +0x7B U+007B +0x7C U+007C +0x7D U+007D +0x7E U+007E +0x7F U+007F +0x80 U+0080 +0x81 U+0081 +0x82 U+0082 +0x83 U+0083 +0x84 U+0084 +0x85 U+0085 +0x86 U+0086 +0x87 U+0087 +0x88 U+0088 +0x89 U+0089 +0x8A U+008A +0x8B U+008B +0x8C U+008C +0x8D U+008D +0x8E U+008E +0x8F U+008F +0x90 U+0090 +0x91 U+0091 +0x92 U+0092 +0x93 U+0093 +0x94 U+0094 +0x95 U+0095 +0x96 U+0096 +0x97 U+0097 +0x98 U+0098 +0x99 U+0099 +0x9A U+009A +0x9B U+009B +0x9C U+009C +0x9D U+009D +0x9E U+009E +0x9F U+009F +0xA0 U+00A0 +0xA1 U+0104 +0xA2 U+0105 +0xA3 U+0141 +0xA4 U+20AC +0xA5 U+201E +0xA6 U+0160 +0xA7 U+00A7 +0xA8 U+0161 +0xA9 U+00A9 +0xAA U+0218 +0xAB U+00AB +0xAC U+0179 +0xAD U+00AD +0xAE U+017A +0xAF U+017B +0xB0 U+00B0 +0xB1 U+00B1 +0xB2 U+010C +0xB3 U+0142 +0xB4 U+017D +0xB5 U+201D +0xB6 U+00B6 +0xB7 U+00B7 +0xB8 U+017E +0xB9 U+010D +0xBA U+0219 +0xBB U+00BB +0xBC U+0152 +0xBD U+0153 +0xBE U+0178 +0xBF U+017C +0xC0 U+00C0 +0xC1 U+00C1 +0xC2 U+00C2 +0xC3 U+0102 +0xC4 U+00C4 +0xC5 U+0106 +0xC6 U+00C6 +0xC7 U+00C7 +0xC8 U+00C8 +0xC9 U+00C9 +0xCA U+00CA +0xCB U+00CB +0xCC U+00CC +0xCD U+00CD +0xCE U+00CE +0xCF U+00CF +0xD0 U+0110 +0xD1 U+0143 +0xD2 U+00D2 +0xD3 U+00D3 +0xD4 U+00D4 +0xD5 U+0150 +0xD6 U+00D6 +0xD7 U+015A +0xD8 U+0170 +0xD9 U+00D9 +0xDA U+00DA +0xDB U+00DB +0xDC U+00DC +0xDD U+0118 +0xDE U+021A +0xDF U+00DF +0xE0 U+00E0 +0xE1 U+00E1 +0xE2 U+00E2 +0xE3 U+0103 +0xE4 U+00E4 +0xE5 U+0107 +0xE6 U+00E6 +0xE7 U+00E7 +0xE8 U+00E8 +0xE9 U+00E9 +0xEA U+00EA +0xEB U+00EB +0xEC U+00EC +0xED U+00ED +0xEE U+00EE +0xEF U+00EF +0xF0 U+0111 +0xF1 U+0144 +0xF2 U+00F2 +0xF3 U+00F3 +0xF4 U+00F4 +0xF5 U+0151 +0xF6 U+00F6 +0xF7 U+015B +0xF8 U+0171 +0xF9 U+00F9 +0xFA U+00FA +0xFB U+00FB +0xFC U+00FC +0xFD U+0119 +0xFE U+021B +0xFF U+00FF diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/make/data/charsetmapping/charsets --- a/jdk/make/data/charsetmapping/charsets Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/make/data/charsetmapping/charsets Sat Sep 09 14:36:45 2017 +0200 @@ -257,6 +257,8 @@ hisname ISO8859_15 ascii true alias ISO_8859-15 # IANA alias + alias Latin-9 + alias csISO885915 alias 8859_15 # Other aliases alias ISO-8859-15 alias ISO8859_15 @@ -272,6 +274,18 @@ alias csISOlatin9 alias ISO8859_15_FDIS +charset ISO-8859-16 ISO_8859_16 + package sun.nio.cs + type sbcs + hisname ISO8859_16 + ascii true + alias iso-ir-226 + alias ISO_8859-16:2001 + alias ISO_8859-16 + alias latin10 + alias l10 + alias csISO885916 + charset KOI8-R KOI8_R package sun.nio.cs type sbcs diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/make/lib/Awt2dLibraries.gmk --- a/jdk/make/lib/Awt2dLibraries.gmk Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/make/lib/Awt2dLibraries.gmk Sat Sep 09 14:36:45 2017 +0200 @@ -311,7 +311,6 @@ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \ $(LIBJAVA_HEADER_FLAGS) # @@ -536,7 +535,6 @@ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \ -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \ -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \ - -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \ $(LIBJAVA_HEADER_FLAGS) \ # diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/make/lib/SoundLibraries.gmk --- a/jdk/make/lib/SoundLibraries.gmk Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/make/lib/SoundLibraries.gmk Sat Sep 09 14:36:45 2017 +0200 @@ -61,6 +61,7 @@ -DUSE_PLATFORM_MIDI_IN=TRUE \ -DUSE_PORTS=TRUE LIBJSOUND_SRC_FILES += \ + PLATFORM_API_WinOS_Charset_Util.cpp \ PLATFORM_API_WinOS_MidiIn.cpp \ PLATFORM_API_WinOS_MidiOut.c \ PLATFORM_API_WinOS_Util.c \ @@ -190,6 +191,7 @@ OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ SRC := $(LIBJSOUND_SRC_DIRS), \ INCLUDE_FILES := Utilities.c $(LIBJSOUND_DAUDIOFILES) \ + PLATFORM_API_WinOS_Charset_Util.cpp \ PLATFORM_API_WinOS_DirectSound.cpp, \ OPTIMIZATION := LOW, \ CFLAGS := $(CFLAGS_JDKLIB) \ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/make/mapfiles/libawt/mapfile-mawt-vers --- a/jdk/make/mapfiles/libawt/mapfile-mawt-vers Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/make/mapfiles/libawt/mapfile-mawt-vers Sat Sep 09 14:36:45 2017 +0200 @@ -132,7 +132,6 @@ Java_sun_java2d_x11_X11SurfaceData_initIDs; Java_sun_java2d_x11_X11SurfaceData_initOps; Java_sun_java2d_x11_X11SurfaceData_initSurface; - Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable; Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable; Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; Java_sun_java2d_x11_X11SurfaceData_XSetXorMode; diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/make/mapfiles/libawt/mapfile-vers-linux --- a/jdk/make/mapfiles/libawt/mapfile-vers-linux Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/make/mapfiles/libawt/mapfile-vers-linux Sat Sep 09 14:36:45 2017 +0200 @@ -252,7 +252,6 @@ Java_sun_awt_X11SurfaceData_initIDs; Java_sun_awt_X11SurfaceData_initOps; Java_sun_awt_X11SurfaceData_initSurface; - Java_sun_awt_X11SurfaceData_isDgaAvailable; Java_sun_awt_X11SurfaceData_setInvalid; Java_sun_awt_X11SurfaceData_flushNativeSurface; awt_display; diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/make/mapfiles/libawt_xawt/mapfile-vers --- a/jdk/make/mapfiles/libawt_xawt/mapfile-vers Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/make/mapfiles/libawt_xawt/mapfile-vers Sat Sep 09 14:36:45 2017 +0200 @@ -364,7 +364,6 @@ Java_sun_java2d_x11_X11Renderer_XFillRoundRect; Java_sun_java2d_x11_X11Renderer_devCopyArea; Java_sun_java2d_x11_X11SurfaceData_initIDs; - Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable; Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable; Java_sun_java2d_x11_X11SurfaceData_initSurface; Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.base/share/classes/java/io/FileOutputStream.java --- a/jdk/src/java.base/share/classes/java/io/FileOutputStream.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.base/share/classes/java/io/FileOutputStream.java Sat Sep 09 14:36:45 2017 +0200 @@ -91,7 +91,7 @@ * If the file exists but is a directory rather than a regular file, does * not exist but cannot be created, or cannot be opened for any other * reason then a FileNotFoundException is thrown. - *

    + * * @implSpec Invoking this constructor with the parameter {@code name} is * equivalent to invoking {@link #FileOutputStream(String,boolean) * new FileOutputStream(name, false)}. diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.base/share/classes/module-info.java --- a/jdk/src/java.base/share/classes/module-info.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.base/share/classes/module-info.java Sat Sep 09 14:36:45 2017 +0200 @@ -35,7 +35,7 @@ * The jrt file system can be created by calling * {@link java.nio.file.FileSystems#newFileSystem * FileSystems.newFileSystem(URI.create("jrt:/"))}. - *

    + * *

    Tool Guides:
    *
    {@extLink java_tool_reference java launcher}, * {@extLink keytool_tool_reference keytool}
    diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties --- a/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.base/share/classes/sun/launcher/resources/launcher.properties Sat Sep 09 14:36:45 2017 +0200 @@ -137,7 +137,6 @@ \ -Xms set initial Java heap size\n\ \ -Xmx set maximum Java heap size\n\ \ -Xnoclassgc disable class garbage collection\n\ -\ -Xprof output cpu profiling data (deprecated)\n\ \ -Xrs reduce use of OS signals by Java/VM (see documentation)\n\ \ -Xshare:auto use shared class data if possible (default)\n\ \ -Xshare:off do not attempt to use shared class data\n\ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.base/share/classes/sun/nio/cs/Unicode.java --- a/jdk/src/java.base/share/classes/sun/nio/cs/Unicode.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.base/share/classes/sun/nio/cs/Unicode.java Sat Sep 09 14:36:45 2017 +0200 @@ -38,6 +38,7 @@ return ((cs instanceof US_ASCII) || (cs instanceof ISO_8859_1) || (cs instanceof ISO_8859_15) + || (cs instanceof ISO_8859_16) || (cs instanceof MS1252) || (cs instanceof UTF_8) || (cs instanceof UTF_16) diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/macosx/classes/apple/laf/AquaLookAndFeel.java --- a/jdk/src/java.desktop/macosx/classes/apple/laf/AquaLookAndFeel.java Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2011, 2014, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package apple.laf; - -/* - * This class is essentially a placeholder since - * "apple.laf.AquaLookAndFeel" is so widely used, documented, - * and hard coded that it is impractical to remove it. - */ -@SuppressWarnings("serial") // JDK implementation class -public class AquaLookAndFeel extends com.apple.laf.AquaLookAndFeel { } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationAdapter.java --- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationAdapter.java Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2011, 2017, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.apple.eawt; - -import java.awt.desktop.AboutHandler; -import java.awt.desktop.AppForegroundListener; -import java.awt.desktop.AppHiddenListener; -import java.awt.desktop.AppReopenedListener; -import java.awt.desktop.OpenFilesHandler; -import java.awt.desktop.OpenURIHandler; -import java.awt.desktop.PreferencesHandler; -import java.awt.desktop.PrintFilesHandler; -import java.awt.desktop.QuitHandler; -import java.awt.desktop.ScreenSleepListener; -import java.awt.desktop.SystemEventListener; -import java.awt.desktop.SystemSleepListener; -import java.awt.desktop.UserSessionListener; - -/** - * An abstract adapter class for receiving {@code ApplicationEvents}. - * - * ApplicationEvents are deprecated. Use individual app event listeners or handlers instead. - * - * @see Application#addAppEventListener(SystemEventListener) - * - * @see AboutHandler - * @see PreferencesHandler - * @see OpenURIHandler - * @see OpenFilesHandler - * @see PrintFilesHandler - * @see QuitHandler - * - * @see AppReopenedListener - * @see AppForegroundListener - * @see AppHiddenListener - * @see UserSessionListener - * @see ScreenSleepListener - * @see SystemSleepListener - * - * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReopenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse}. - * @since 1.4 - */ -@SuppressWarnings("deprecation") -@Deprecated -public class ApplicationAdapter implements ApplicationListener { - @Deprecated - public void handleAbout(final ApplicationEvent event) { } - - @Deprecated - public void handleOpenApplication(final ApplicationEvent event) { } - - @Deprecated - public void handleOpenFile(final ApplicationEvent event) { } - - @Deprecated - public void handlePreferences(final ApplicationEvent event) { } - - @Deprecated - public void handlePrintFile(final ApplicationEvent event) { } - - @Deprecated - public void handleQuit(final ApplicationEvent event) { } - - @Deprecated - public void handleReOpenApplication(final ApplicationEvent event) { } -} diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationEvent.java --- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationEvent.java Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2011, 2017, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.apple.eawt; - -import java.awt.desktop.AboutHandler; -import java.awt.desktop.AppReopenedListener; -import java.awt.desktop.OpenFilesHandler; -import java.awt.desktop.PreferencesHandler; -import java.awt.desktop.PrintFilesHandler; -import java.awt.desktop.QuitHandler; -import java.util.EventObject; - -/** - * The class of events sent to the deprecated ApplicationListener callbacks. - * - * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReopenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse} - * @since 1.4 - */ -@Deprecated -@SuppressWarnings("serial") // JDK implementation class -public class ApplicationEvent extends EventObject { - private String fFilename = null; - private boolean fHandled = false; - - ApplicationEvent(final Object source) { - super(source); - } - - ApplicationEvent(final Object source, final String filename) { - super(source); - fFilename = filename; - } - - /** - * Determines whether an ApplicationListener has acted on a particular event. - * An event is marked as having been handled with {@code setHandled(true)}. - * - * @return {@code true} if the event has been handled, otherwise {@code false} - * - * @since 1.4 - * @deprecated - */ - @Deprecated - public boolean isHandled() { - return fHandled; - } - - /** - * Marks the event as handled. - * After this method handles an ApplicationEvent, it may be useful to specify that it has been handled. - * This is usually used in conjunction with {@code getHandled()}. - * Set to {@code true} to designate that this event has been handled. By default it is {@code false}. - * - * @param state {@code true} if the event has been handled, otherwise {@code false}. - * - * @since 1.4 - * @deprecated - */ - @Deprecated - public void setHandled(final boolean state) { - fHandled = state; - } - - /** - * Provides the filename associated with a particular AppleEvent. - * When the ApplicationEvent corresponds to an AppleEvent that needs to act on a particular file, the ApplicationEvent carries the name of the specific file with it. - * For example, the Print and Open events refer to specific files. - * For these cases, this returns the appropriate file name. - * - * @return the full path to the file associated with the event, if applicable, otherwise {@code null} - * - * @since 1.4 - * @deprecated use {@link OpenFilesHandler} or {@link PrintFilesHandler} instead - */ - @Deprecated - public String getFilename() { - return fFilename; - } -} diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationListener.java --- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/ApplicationListener.java Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,166 +0,0 @@ -/* - * Copyright (c) 2011, 2017, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.apple.eawt; - -import java.awt.desktop.AboutHandler; -import java.awt.desktop.AppForegroundListener; -import java.awt.desktop.AppHiddenListener; -import java.awt.desktop.AppReopenedListener; -import java.awt.desktop.OpenFilesHandler; -import java.awt.desktop.OpenURIHandler; -import java.awt.desktop.PreferencesHandler; -import java.awt.desktop.PrintFilesHandler; -import java.awt.desktop.QuitHandler; -import java.awt.desktop.ScreenSleepListener; -import java.awt.desktop.SystemEventListener; -import java.awt.desktop.SystemSleepListener; -import java.awt.desktop.UserSessionListener; -import java.util.EventListener; - -/** - * ApplicationEvents are deprecated. Use individual AppEvent listeners or handlers instead. - * - * @see Application#addAppEventListener(SystemEventListener) - * - * @see AboutHandler - * @see PreferencesHandler - * @see OpenURIHandler - * @see OpenFilesHandler - * @see PrintFilesHandler - * @see QuitHandler - * - * @see AppReopenedListener - * @see AppForegroundListener - * @see AppHiddenListener - * @see UserSessionListener - * @see ScreenSleepListener - * @see SystemSleepListener - * - * @since 1.4 - * @deprecated replaced by {@link AboutHandler}, {@link PreferencesHandler}, {@link AppReopenedListener}, {@link OpenFilesHandler}, {@link PrintFilesHandler}, {@link QuitHandler}, {@link MacQuitResponse} - */ -@SuppressWarnings("deprecation") -@Deprecated -public interface ApplicationListener extends EventListener { - /** - * Called when the user selects the About item in the application menu. If {@code event} is not handled by - * setting {@code isHandled(true)}, a default About window consisting of the application's name and icon is - * displayed. To display a custom About window, designate the {@code event} as being handled and display the - * appropriate About window. - * - * @param event an ApplicationEvent initiated by the user choosing About in the application menu - * @deprecated use {@link AboutHandler} - */ - @Deprecated - public void handleAbout(ApplicationEvent event); - - /** - * Called when the application receives an Open Application event from the Finder or another application. Usually - * this will come from the Finder when a user double-clicks your application icon. If there is any special code - * that you want to run when you user launches your application from the Finder or by sending an Open Application - * event from another application, include that code as part of this handler. The Open Application event is sent - * after AWT has been loaded. - * - * @param event the Open Application event - * @deprecated no replacement - */ - @Deprecated - public void handleOpenApplication(ApplicationEvent event); - - /** - * Called when the application receives an Open Document event from the Finder or another application. This event - * is generated when a user double-clicks a document in the Finder. If the document is registered as belonging - * to your application, this event is sent to your application. Documents are bound to a particular application based - * primarily on their suffix. In the Finder, a user selects a document and then from the File Menu chooses Get Info. - * The Info window allows users to bind a document to a particular application. - * - * These events are sent only if the bound application has file types listed in the Info.plist entries Document Types - * or CFBundleDocumentTypes. - * - * The ApplicationEvent sent to this handler holds a reference to the file being opened. - * - * @param event an Open Document event with reference to the file to be opened - * @deprecated use {@link OpenFilesHandler} - */ - @Deprecated - public void handleOpenFile(ApplicationEvent event); - - /** - * Called when the Preference item in the application menu is selected. Native Mac OS X applications make their - * Preferences window available through the application menu. Java applications are automatically given an application - * menu in Mac OS X. By default, the Preferences item is disabled in that menu. If you are deploying an application - * on Mac OS X, you should enable the preferences item with {@code setEnabledPreferencesMenu(true)} in the - * Application object and then display your Preferences window in this handler. - * - * @param event triggered when the user selects Preferences from the application menu - * @deprecated use {@link PreferencesHandler} - */ - @Deprecated - public void handlePreferences(ApplicationEvent event); - - /** - * Called when the application is sent a request to print a particular file or files. You can allow other applications to - * print files with your application by implementing this handler. If another application sends a Print Event along - * with the name of a file that your application knows how to process, you can use this handler to determine what to - * do with that request. You might open your entire application, or just invoke your printing classes. - * - * These events are sent only if the bound application has file types listed in the Info.plist entries Document Types - * or CFBundleDocumentTypes. - * - * The ApplicationEvent sent to this handler holds a reference to the file being opened. - * - * @param event a Print Document event with a reference to the file(s) to be printed - * @deprecated use {@link PrintFilesHandler} - */ - @Deprecated - public void handlePrintFile(ApplicationEvent event); - - /** - * Called when the application is sent the Quit event. This event is generated when the user selects Quit from the - * application menu, when the user types Command-Q, or when the user control clicks on your application icon in the - * Dock and chooses Quit. You can either accept or reject the request to quit. You might want to reject the request - * to quit if the user has unsaved work. Reject the request, move into your code to save changes, then quit your - * application. To accept the request to quit, and terminate the application, set {@code isHandled(true)} for the - * {@code event}. To reject the quit, set {@code isHandled(false)}. - * - * @param event a Quit Application event - * @deprecated use {@link QuitHandler} and {@link MacQuitResponse} - */ - @Deprecated - public void handleQuit(ApplicationEvent event); - - /** - * Called when the application receives a Reopen Application event from the Finder or another application. Usually - * this will come when a user clicks on your application icon in the Dock. If there is any special code - * that needs to run when your user clicks on your application icon in the Dock or when a Reopen Application - * event is sent from another application, include that code as part of this handler. - * - * @param event the Reopen Application event - * @deprecated use {@link AppReopenedListener} - */ - @Deprecated - public void handleReOpenApplication(ApplicationEvent event); -} diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/macosx/classes/sun/font/CCharToGlyphMapper.java --- a/jdk/src/java.desktop/macosx/classes/sun/font/CCharToGlyphMapper.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/macosx/classes/sun/font/CCharToGlyphMapper.java Sat Sep 09 14:36:45 2017 +0200 @@ -282,7 +282,7 @@ if (code >= HI_SURROGATE_START && code <= HI_SURROGATE_END && m < missed - 1) { - char low = indicies[m + 1]; + char low = unmappedChars[m + 1]; if (low >= LO_SURROGATE_START && low <= LO_SURROGATE_END) { code = (code - HI_SURROGATE_START) * 0x400 + low - LO_SURROGATE_START + 0x10000; diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDropTargetContextPeer.java --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDropTargetContextPeer.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDropTargetContextPeer.java Sat Sep 09 14:36:45 2017 +0200 @@ -51,20 +51,6 @@ super(); } - // We block, waiting for an empty event to get posted (CToolkit.invokeAndWait) - // This is so we finish dispatching DropTarget events before we dispatch the dragDropFinished event (which is a higher priority). - private void flushEvents(Component c) { - try { - LWCToolkit.invokeAndWait(new Runnable() { - public synchronized void run() { - } - }, c); - } - catch(Exception e) { - e.printStackTrace(); - } - } - protected Object getNativeData(long format) { long nativeDropTarget = this.getNativeDragContext(); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, 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 @@ -281,7 +281,7 @@ // Allow TSM to look at the event and potentially send back NSTextInputClient messages. [self interpretKeyEvents:[NSArray arrayWithObject:event]]; - if (fEnablePressAndHold && [event willBeHandledByComplexInputMethod]) { + if (fEnablePressAndHold && [event willBeHandledByComplexInputMethod] && fInputMethodLOCKABLE) { fProcessingKeystroke = NO; if (!fInPressAndHold) { fInPressAndHold = YES; @@ -770,11 +770,9 @@ CDragSource *dragSource = self._dragSource; NSDragOperation dragOp = NSDragOperationNone; - if (dragSource != nil) + if (dragSource != nil) { dragOp = [dragSource draggingSourceOperationMaskForLocal:flag]; - else if ([super respondsToSelector:@selector(draggingSourceOperationMaskForLocal:)]) - dragOp = [super draggingSourceOperationMaskForLocal:flag]; - + } return dragOp; } @@ -784,11 +782,9 @@ CDragSource *dragSource = self._dragSource; NSArray* array = nil; - if (dragSource != nil) + if (dragSource != nil) { array = [dragSource namesOfPromisedFilesDroppedAtDestination:dropDestination]; - else if ([super respondsToSelector:@selector(namesOfPromisedFilesDroppedAtDestination:)]) - array = [super namesOfPromisedFilesDroppedAtDestination:dropDestination]; - + } return array; } @@ -797,10 +793,9 @@ // If draggingSource is nil route the message to the superclass (if responding to the selector): CDragSource *dragSource = self._dragSource; - if (dragSource != nil) + if (dragSource != nil) { [dragSource draggedImage:image beganAt:screenPoint]; - else if ([super respondsToSelector:@selector(draggedImage::)]) - [super draggedImage:image beganAt:screenPoint]; + } } - (void)draggedImage:(NSImage *)image endedAt:(NSPoint)screenPoint operation:(NSDragOperation)operation @@ -808,10 +803,9 @@ // If draggingSource is nil route the message to the superclass (if responding to the selector): CDragSource *dragSource = self._dragSource; - if (dragSource != nil) + if (dragSource != nil) { [dragSource draggedImage:image endedAt:screenPoint operation:operation]; - else if ([super respondsToSelector:@selector(draggedImage:::)]) - [super draggedImage:image endedAt:screenPoint operation:operation]; + } } - (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenPoint @@ -819,10 +813,9 @@ // If draggingSource is nil route the message to the superclass (if responding to the selector): CDragSource *dragSource = self._dragSource; - if (dragSource != nil) + if (dragSource != nil) { [dragSource draggedImage:image movedTo:screenPoint]; - else if ([super respondsToSelector:@selector(draggedImage::)]) - [super draggedImage:image movedTo:screenPoint]; + } } - (BOOL)ignoreModifierKeysWhileDragging @@ -831,11 +824,9 @@ CDragSource *dragSource = self._dragSource; BOOL result = FALSE; - if (dragSource != nil) + if (dragSource != nil) { result = [dragSource ignoreModifierKeysWhileDragging]; - else if ([super respondsToSelector:@selector(ignoreModifierKeysWhileDragging)]) - result = [super ignoreModifierKeysWhileDragging]; - + } return result; } @@ -849,11 +840,9 @@ CDropTarget *dropTarget = self._dropTarget; NSDragOperation dragOp = NSDragOperationNone; - if (dropTarget != nil) + if (dropTarget != nil) { dragOp = [dropTarget draggingEntered:sender]; - else if ([super respondsToSelector:@selector(draggingEntered:)]) - dragOp = [super draggingEntered:sender]; - + } return dragOp; } @@ -863,11 +852,9 @@ CDropTarget *dropTarget = self._dropTarget; NSDragOperation dragOp = NSDragOperationNone; - if (dropTarget != nil) + if (dropTarget != nil) { dragOp = [dropTarget draggingUpdated:sender]; - else if ([super respondsToSelector:@selector(draggingUpdated:)]) - dragOp = [super draggingUpdated:sender]; - + } return dragOp; } @@ -876,10 +863,9 @@ // If draggingDestination is nil route the message to the superclass: CDropTarget *dropTarget = self._dropTarget; - if (dropTarget != nil) + if (dropTarget != nil) { [dropTarget draggingExited:sender]; - else if ([super respondsToSelector:@selector(draggingExited:)]) - [super draggingExited:sender]; + } } - (BOOL)prepareForDragOperation:(id )sender @@ -888,11 +874,9 @@ CDropTarget *dropTarget = self._dropTarget; BOOL result = FALSE; - if (dropTarget != nil) + if (dropTarget != nil) { result = [dropTarget prepareForDragOperation:sender]; - else if ([super respondsToSelector:@selector(prepareForDragOperation:)]) - result = [super prepareForDragOperation:sender]; - + } return result; } @@ -902,11 +886,9 @@ CDropTarget *dropTarget = self._dropTarget; BOOL result = FALSE; - if (dropTarget != nil) + if (dropTarget != nil) { result = [dropTarget performDragOperation:sender]; - else if ([super respondsToSelector:@selector(performDragOperation:)]) - result = [super performDragOperation:sender]; - + } return result; } @@ -915,10 +897,9 @@ // If draggingDestination is nil route the message to the superclass: CDropTarget *dropTarget = self._dropTarget; - if (dropTarget != nil) + if (dropTarget != nil) { [dropTarget concludeDragOperation:sender]; - else if ([super respondsToSelector:@selector(concludeDragOperation:)]) - [super concludeDragOperation:sender]; + } } - (void)draggingEnded:(id )sender @@ -926,10 +907,9 @@ // If draggingDestination is nil route the message to the superclass: CDropTarget *dropTarget = self._dropTarget; - if (dropTarget != nil) + if (dropTarget != nil) { [dropTarget draggingEnded:sender]; - else if ([super respondsToSelector:@selector(draggingEnded:)]) - [super draggingEnded:sender]; + } } /******************************** END NSDraggingDestination Interface ********************************/ @@ -986,6 +966,13 @@ // We also don't want to send the character that triggered the insertText, usually a return. [3337563] fKeyEventsNeeded = NO; } + else { + // Need to set back the fKeyEventsNeeded flag so that the string following the + // marked text is not ignored by keyDown + if ([useString length] > 0) { + fKeyEventsNeeded = YES; + } + } fPAHNeedsToSelect = NO; } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDragSource.m Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2017, 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 @@ -432,12 +432,11 @@ NSWindow* window = [fView window]; NSInteger windowNumber = [window windowNumber]; - NSGraphicsContext* graphicsContext = [NSGraphicsContext graphicsContextWithWindow:window]; // Convert mouse coordinates to NS: NSPoint eventLocation = [fView convertPoint:NSMakePoint(fDragPos.x, fDragPos.y) toView:nil]; eventLocation.y = [[fView window] frame].size.height - eventLocation.y; - + // Convert fTriggerEventTimeStamp to NS - AWTEvent.h defines UTC(nsEvent) as ((jlong)[event timestamp] * 1000): NSTimeInterval timeStamp = fTriggerEventTimeStamp / 1000; @@ -452,14 +451,16 @@ } // Convert fModifiers (extModifiers) to NS: - NSUInteger modifiers = JavaModifiersToNsKeyModifiers(fModifiers, TRUE); + NSUInteger modifiers = JavaModifiersToNsKeyModifiers(fModifiers, TRUE); // Just a dummy value ... NSInteger eventNumber = 0; + // NSEvent.context is deprecated and unused + NSGraphicsContext* unusedPassNil = nil; // Make a native autoreleased dragging event: NSEvent* dragEvent = [NSEvent mouseEventWithType:mouseButtons location:eventLocation - modifierFlags:modifiers timestamp:timeStamp windowNumber:windowNumber context:graphicsContext + modifierFlags:modifiers timestamp:timeStamp windowNumber:windowNumber context:unusedPassNil eventNumber:eventNumber clickCount:fClickCount pressure:pressure]; return dragEvent; diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.m --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.m Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/CDropTarget.m Sat Sep 09 14:36:45 2017 +0200 @@ -663,13 +663,6 @@ if (sDraggingError == FALSE) { JNFCallVoidMethod(env, fDropTargetContextPeer, handleDropMessageMethod, fComponent, (jint) javaLocation.x, (jint) javaLocation.y, dropAction, actions, formats, ptr_to_jlong(self)); // AWT_THREADING Safe (event) } - - if (sDraggingError == FALSE) { - JNF_MEMBER_CACHE(flushEventsMethod, jc_CDropTargetContextPeer, "flushEvents", "(Ljava/awt/Component;)V"); - if (sDraggingError == FALSE) { - JNFCallVoidMethod(env, fDropTargetContextPeer, flushEventsMethod, fComponent); // AWT_THREADING Safe (AWTRunLoopMode) - } - } } else { // 8-19-03 Note: [Radar 3368754] // draggingExited: is not called after a drop - we must do that here ... but only in case diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java --- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageReader.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -472,6 +472,14 @@ text = new String(b, "UTF8"); } metadata.iTXt_text.add(text); + + // Check if the text chunk contains image creation time + if (keyword.equals(PNGMetadata.tEXt_creationTimeKey)) { + // Update Standard/Document/ImageCreationTime from text chunk + int index = metadata.iTXt_text.size() - 1; + metadata.decodeImageCreationTimeFromTextChunk( + metadata.iTXt_text.listIterator(index)); + } } private void parse_pHYs_chunk() throws IOException { @@ -555,6 +563,14 @@ byte[] b = new byte[chunkLength - keyword.length() - 1]; stream.readFully(b); metadata.tEXt_text.add(new String(b, "ISO-8859-1")); + + // Check if the text chunk contains image creation time + if (keyword.equals(PNGMetadata.tEXt_creationTimeKey)) { + // Update Standard/Document/ImageCreationTime from text chunk + int index = metadata.tEXt_text.size() - 1; + metadata.decodeImageCreationTimeFromTextChunk( + metadata.tEXt_text.listIterator(index)); + } } private void parse_tIME_chunk() throws IOException { @@ -644,6 +660,14 @@ byte[] b = new byte[chunkLength - keyword.length() - 2]; stream.readFully(b); metadata.zTXt_text.add(new String(inflate(b), "ISO-8859-1")); + + // Check if the text chunk contains image creation time + if (keyword.equals(PNGMetadata.tEXt_creationTimeKey)) { + // Update Standard/Document/ImageCreationTime from text chunk + int index = metadata.zTXt_text.size() - 1; + metadata.decodeImageCreationTimeFromTextChunk( + metadata.zTXt_text.listIterator(index)); + } } private void readMetadata() throws IIOException { @@ -713,8 +737,32 @@ switch (chunkType) { case IDAT_TYPE: // If chunk type is 'IDAT', we've reached the image data. - stream.skipBytes(-8); - imageStartPosition = stream.getStreamPosition(); + if (imageStartPosition == -1L) { + /* + * PNGs may contain multiple IDAT chunks containing + * a portion of image data. We store the position of + * the first IDAT chunk and continue with iteration + * of other chunks that follow image data. + */ + imageStartPosition = stream.getStreamPosition() - 8; + } + // Move to the CRC byte location. + stream.skipBytes(chunkLength); + break; + case IEND_TYPE: + /* + * If the chunk type is 'IEND', we've reached end of image. + * Seek to the first IDAT chunk for subsequent decoding. + */ + stream.seek(imageStartPosition); + + /* + * flushBefore discards the portion of the stream before + * the indicated position. Hence this should be used after + * we complete iteration over available chunks including + * those that appear after the IDAT. + */ + stream.flushBefore(stream.getStreamPosition()); break loop; case PLTE_TYPE: parse_PLTE_chunk(chunkLength); @@ -796,7 +844,6 @@ throw new IIOException("Failed to read a chunk of type " + chunkType); } - stream.flushBefore(stream.getStreamPosition()); } } catch (IOException e) { throw new IIOException("Error reading PNG metadata", e); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java --- a/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGMetadata.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -30,6 +30,14 @@ import java.awt.image.SampleModel; import java.util.ArrayList; import java.util.StringTokenizer; +import java.util.ListIterator; +import java.time.LocalDateTime; +import java.time.OffsetDateTime; +import java.time.ZoneId; +import java.time.ZoneOffset; +import java.time.format.DateTimeFormatter; +import java.time.format.DateTimeParseException; +import java.time.temporal.TemporalAccessor; import javax.imageio.ImageTypeSpecifier; import javax.imageio.metadata.IIOInvalidTreeException; import javax.imageio.metadata.IIOMetadata; @@ -212,7 +220,7 @@ public ArrayList tEXt_keyword = new ArrayList(); // 1-79 characters public ArrayList tEXt_text = new ArrayList(); - // tIME chunk + // tIME chunk. Gives the image modification time. public boolean tIME_present; public int tIME_year; public int tIME_month; @@ -221,6 +229,41 @@ public int tIME_minute; public int tIME_second; + // Specifies whether metadata contains Standard/Document/ImageCreationTime + public boolean creation_time_present; + + // Values that make up Standard/Document/ImageCreationTime + public int creation_time_year; + public int creation_time_month; + public int creation_time_day; + public int creation_time_hour; + public int creation_time_minute; + public int creation_time_second; + public ZoneOffset creation_time_offset; + + /* + * tEXt_creation_time_present- Specifies whether any text chunk (tEXt, iTXt, + * zTXt) exists with image creation time. The data structure corresponding + * to the last decoded text chunk with creation time is indicated by the + * iterator- tEXt_creation_time_iter. + * + * Any update to the text chunks with creation time is reflected on + * Standard/Document/ImageCreationTime after retrieving time from the text + * chunk. If there are multiple text chunks with creation time, the time + * retrieved from the last decoded text chunk will be used. A point to note + * is that, retrieval of time from text chunks is possible only if the + * encoded time in the chunk confirms to either the recommended RFC1123 + * format or ISO format. + * + * Similarly, any update to Standard/Document/ImageCreationTime is reflected + * on the last decoded text chunk's data structure with time encoded in + * RFC1123 format. By updating the text chunk's data structure, we also + * ensure that PNGImageWriter will write image creation time on the output. + */ + public boolean tEXt_creation_time_present; + private ListIterator tEXt_creation_time_iter = null; + public static final String tEXt_creationTimeKey = "Creation Time"; + // tRNS chunk // If external (non-PNG sourced) data has red = green = blue, // always store it as gray and promote when writing @@ -985,21 +1028,41 @@ } public IIOMetadataNode getStandardDocumentNode() { - if (!tIME_present) { - return null; + IIOMetadataNode document_node = null; + + // Check if image modification time exists + if (tIME_present) { + // Create new document node + document_node = new IIOMetadataNode("Document"); + + // Node to hold image modification time + IIOMetadataNode node = new IIOMetadataNode("ImageModificationTime"); + node.setAttribute("year", Integer.toString(tIME_year)); + node.setAttribute("month", Integer.toString(tIME_month)); + node.setAttribute("day", Integer.toString(tIME_day)); + node.setAttribute("hour", Integer.toString(tIME_hour)); + node.setAttribute("minute", Integer.toString(tIME_minute)); + node.setAttribute("second", Integer.toString(tIME_second)); + document_node.appendChild(node); } - IIOMetadataNode document_node = new IIOMetadataNode("Document"); - IIOMetadataNode node = null; // scratch node + // Check if image creation time exists + if (creation_time_present) { + if (document_node == null) { + // Create new document node + document_node = new IIOMetadataNode("Document"); + } - node = new IIOMetadataNode("ImageModificationTime"); - node.setAttribute("year", Integer.toString(tIME_year)); - node.setAttribute("month", Integer.toString(tIME_month)); - node.setAttribute("day", Integer.toString(tIME_day)); - node.setAttribute("hour", Integer.toString(tIME_hour)); - node.setAttribute("minute", Integer.toString(tIME_minute)); - node.setAttribute("second", Integer.toString(tIME_second)); - document_node.appendChild(node); + // Node to hold image creation time + IIOMetadataNode node = new IIOMetadataNode("ImageCreationTime"); + node.setAttribute("year", Integer.toString(creation_time_year)); + node.setAttribute("month", Integer.toString(creation_time_month)); + node.setAttribute("day", Integer.toString(creation_time_day)); + node.setAttribute("hour", Integer.toString(creation_time_hour)); + node.setAttribute("minute", Integer.toString(creation_time_minute)); + node.setAttribute("second", Integer.toString(creation_time_second)); + document_node.appendChild(node); + } return document_node; } @@ -1437,6 +1500,13 @@ String text = getAttribute(iTXt_node, "text"); iTXt_text.add(text); + // Check if the text chunk contains image creation time + if (keyword.equals(PNGMetadata.tEXt_creationTimeKey)) { + // Update Standard/Document/ImageCreationTime + int index = iTXt_text.size()-1; + decodeImageCreationTimeFromTextChunk( + iTXt_text.listIterator(index)); + } } // silently skip invalid text entry @@ -1564,6 +1634,13 @@ String text = getAttribute(tEXt_node, "value"); tEXt_text.add(text); + // Check if the text chunk contains image creation time + if (keyword.equals(PNGMetadata.tEXt_creationTimeKey)) { + // Update Standard/Document/ImageCreationTime + int index = tEXt_text.size()-1; + decodeImageCreationTimeFromTextChunk( + tEXt_text.listIterator(index)); + } tEXt_node = tEXt_node.getNextSibling(); } } else if (name.equals("tIME")) { @@ -1652,6 +1729,13 @@ String text = getAttribute(zTXt_node, "text"); zTXt_text.add(text); + // Check if the text chunk contains image creation time + if (keyword.equals(PNGMetadata.tEXt_creationTimeKey)) { + // Update Standard/Document/ImageCreationTime + int index = zTXt_text.size()-1; + decodeImageCreationTimeFromTextChunk( + zTXt_text.listIterator(index)); + } zTXt_node = zTXt_node.getNextSibling(); } } else if (name.equals("UnknownChunks")) { @@ -1952,7 +2036,22 @@ tIME_second = getIntAttribute(child, "second", 0, false); // } else if (childName.equals("SubimageInterpretation")) { -// } else if (childName.equals("ImageCreationTime")) { + } else if (childName.equals("ImageCreationTime")) { + // Extract the creation time values + int year = getIntAttribute(child, "year"); + int month = getIntAttribute(child, "month"); + int day = getIntAttribute(child, "day"); + int hour = getIntAttribute(child, "hour", 0, false); + int mins = getIntAttribute(child, "minute", 0, false); + int sec = getIntAttribute(child, "second", 0, false); + + /* + * Update Standard/Document/ImageCreationTime and encode + * the same in the last decoded text chunk with creation + * time + */ + initImageCreationTime(year, month, day, hour, mins, sec); + encodeImageCreationTimeToTextChunk(); } child = child.getNextSibling(); } @@ -2014,6 +2113,152 @@ } } + void initImageCreationTime(OffsetDateTime offsetDateTime) { + // Check for incoming arguments + if (offsetDateTime != null) { + // set values that make up Standard/Document/ImageCreationTime + creation_time_present = true; + creation_time_year = offsetDateTime.getYear(); + creation_time_month = offsetDateTime.getMonthValue(); + creation_time_day = offsetDateTime.getDayOfMonth(); + creation_time_hour = offsetDateTime.getHour(); + creation_time_minute = offsetDateTime.getMinute(); + creation_time_second = offsetDateTime.getSecond(); + creation_time_offset = offsetDateTime.getOffset(); + } + } + + void initImageCreationTime(int year, int month, int day, + int hour, int min,int second) { + /* + * Though LocalDateTime suffices the need to store Standard/Document/ + * ImageCreationTime, we require the zone offset to encode the same + * in the text chunk based on RFC1123 format. + */ + LocalDateTime locDT = LocalDateTime.of(year, month, day, hour, min, second); + ZoneOffset offset = ZoneId.systemDefault() + .getRules() + .getOffset(locDT); + OffsetDateTime offDateTime = OffsetDateTime.of(locDT,offset); + initImageCreationTime(offDateTime); + } + + void decodeImageCreationTimeFromTextChunk(ListIterator iterChunk) { + // Check for incoming arguments + if (iterChunk != null && iterChunk.hasNext()) { + /* + * Save the iterator to mark the last decoded text chunk with + * creation time. The contents of this chunk will be updated when + * user provides creation time by merging a standard tree with + * Standard/Document/ImageCreationTime. + */ + setCreationTimeChunk(iterChunk); + + // Parse encoded time and set Standard/Document/ImageCreationTime. + String encodedTime = getEncodedTime(); + initImageCreationTime(parseEncodedTime(encodedTime)); + } + } + + void encodeImageCreationTimeToTextChunk() { + // Check if Standard/Document/ImageCreationTime exists. + if (creation_time_present) { + // Check if a text chunk with creation time exists. + if (tEXt_creation_time_present == false) { + // No text chunk exists with image creation time. Add an entry. + this.tEXt_keyword.add(tEXt_creationTimeKey); + this.tEXt_text.add("Creation Time Place Holder"); + + // Update the iterator + int index = tEXt_text.size() - 1; + setCreationTimeChunk(tEXt_text.listIterator(index)); + } + + // Encode image creation time with RFC1123 formatter + OffsetDateTime offDateTime = OffsetDateTime.of(creation_time_year, + creation_time_month, creation_time_day, + creation_time_hour, creation_time_minute, + creation_time_second, 0, creation_time_offset); + DateTimeFormatter formatter = DateTimeFormatter.RFC_1123_DATE_TIME; + String encodedTime = offDateTime.format(formatter); + setEncodedTime(encodedTime); + } + } + + private void setCreationTimeChunk(ListIterator iter) { + // Check for iterator's valid state + if (iter != null && iter.hasNext()) { + tEXt_creation_time_iter = iter; + tEXt_creation_time_present = true; + } + } + + private void setEncodedTime(String encodedTime) { + if (tEXt_creation_time_iter != null + && tEXt_creation_time_iter.hasNext() + && encodedTime != null) { + // Set the value at the iterator and reset its state + tEXt_creation_time_iter.next(); + tEXt_creation_time_iter.set(encodedTime); + tEXt_creation_time_iter.previous(); + } + } + + private String getEncodedTime() { + String encodedTime = null; + if (tEXt_creation_time_iter != null + && tEXt_creation_time_iter.hasNext()) { + // Get the value at iterator and reset its state + encodedTime = tEXt_creation_time_iter.next(); + tEXt_creation_time_iter.previous(); + } + return encodedTime; + } + + private OffsetDateTime parseEncodedTime(String encodedTime) { + OffsetDateTime retVal = null; + boolean timeDecoded = false; + + /* + * PNG specification recommends that image encoders use RFC1123 format + * to represent time in String but doesn't mandate. Encoders could + * use any convenient format. Hence, we extract time provided the + * encoded time complies with either RFC1123 or ISO standards. + */ + try { + // Check if the encoded time complies with RFC1123 + retVal = OffsetDateTime.parse(encodedTime, + DateTimeFormatter.RFC_1123_DATE_TIME); + timeDecoded = true; + } catch (DateTimeParseException exception) { + // No Op. Encoded time did not comply with RFC1123 standard. + } + + if (timeDecoded == false) { + try { + // Check if the encoded time complies with ISO standard. + DateTimeFormatter formatter = DateTimeFormatter.ISO_DATE_TIME; + TemporalAccessor dt = formatter.parseBest(encodedTime, + OffsetDateTime::from, LocalDateTime::from); + + if (dt instanceof OffsetDateTime) { + // Encoded time contains date time and zone offset + retVal = (OffsetDateTime) dt; + } else if (dt instanceof LocalDateTime) { + /* + * Encoded time contains only date and time. Since zone + * offset information isn't available, we set to the default + */ + LocalDateTime locDT = (LocalDateTime) dt; + retVal = OffsetDateTime.of(locDT, ZoneOffset.UTC); + } + } catch (DateTimeParseException exception) { + // No Op. Encoded time did not comply with ISO standard. + } + } + return retVal; + } + // Reset all instance variables to their initial state public void reset() { IHDR_present = false; @@ -2035,7 +2280,12 @@ sRGB_present = false; tEXt_keyword = new ArrayList(); tEXt_text = new ArrayList(); + // tIME chunk with Image modification time tIME_present = false; + // Text chunk with Image creation time + tEXt_creation_time_present = false; + tEXt_creation_time_iter = null; + creation_time_present = false; tRNS_present = false; zTXt_keyword = new ArrayList(); zTXt_compressionMethod = new ArrayList(); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/com/sun/java/swing/Painter.java --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/Painter.java Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2005, 2013, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.java.swing; - -/** - * This class is preserved for backward compatibility with JDK 6. - * - * @deprecated Use {@link javax.swing.Painter} instead. - */ -@Deprecated -public interface Painter extends javax.swing.Painter { -} diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifLookAndFeel.java Sat Sep 09 14:36:45 2017 +0200 @@ -1246,6 +1246,7 @@ "RIGHT", "selectChild", "KP_RIGHT", "selectChild", "ENTER", "return", + "ctrl ENTER", "return", "SPACE", "return" }, diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/nimbus/AbstractRegionPainter.java --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/nimbus/AbstractRegionPainter.java Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2005, 2013, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.java.swing.plaf.nimbus; - -/** - * This class is preserved for backward compatibility with JDK 6. - * - * @deprecated Use {@link javax.swing.plaf.nimbus.AbstractRegionPainter} instead. - */ -@Deprecated -public abstract class AbstractRegionPainter extends javax.swing.plaf.nimbus.AbstractRegionPainter { -} diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/nimbus/NimbusLookAndFeel.java --- a/jdk/src/java.desktop/share/classes/com/sun/java/swing/plaf/nimbus/NimbusLookAndFeel.java Fri Sep 01 14:13:40 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2005, 2014, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.java.swing.plaf.nimbus; - -/** - * This class is preserved for backward compatibility with JDK 6. - * - * @deprecated Use {@link javax.swing.plaf.nimbus.NimbusLookAndFeel} instead. - */ -@Deprecated -@SuppressWarnings("serial") // Superclass not serializable -public class NimbusLookAndFeel extends javax.swing.plaf.nimbus.NimbusLookAndFeel { -} diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/DirectAudioDevice.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2017, 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 @@ -1351,18 +1351,14 @@ // pre-empted while another thread changes doIO and notifies, // before we wait (so we sleep in wait forever). synchronized(lock) { - if (!doIO) { + while (!doIO && thread == curThread) { try { lock.wait(); - } catch(InterruptedException ie) { - } finally { - if (thread != curThread) { - break; - } + } catch (InterruptedException ignored) { } } } - while (doIO) { + while (doIO && thread == curThread) { if (newFramePosition >= 0) { clipBytePosition = newFramePosition * frameSize; newFramePosition = -1; diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/java/awt/Desktop.java --- a/jdk/src/java.desktop/share/classes/java/awt/Desktop.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/java/awt/Desktop.java Sat Sep 09 14:36:45 2017 +0200 @@ -1002,6 +1002,15 @@ public void setDefaultMenuBar(final JMenuBar menuBar) { checkEventsProcessingPermission(); checkActionSupport(Action.APP_MENU_BAR); + + if (menuBar != null) { + Container parent = menuBar.getParent(); + if (parent != null) { + parent.remove(menuBar); + menuBar.updateUI(); + } + } + peer.setDefaultMenuBar(menuBar); } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/java/awt/EventDispatchThread.java --- a/jdk/src/java.desktop/share/classes/java/awt/EventDispatchThread.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/java/awt/EventDispatchThread.java Sat Sep 09 14:36:45 2017 +0200 @@ -161,6 +161,23 @@ } } + boolean filterAndCheckEvent(AWTEvent event) { + boolean eventOK = true; + synchronized (eventFilters) { + for (int i = eventFilters.size() - 1; i >= 0; i--) { + EventFilter f = eventFilters.get(i); + EventFilter.FilterAction accept = f.acceptEvent(event); + if (accept == EventFilter.FilterAction.REJECT) { + eventOK = false; + break; + } else if (accept == EventFilter.FilterAction.ACCEPT_IMMEDIATELY) { + break; + } + } + } + return eventOK && SunDragSourceContextPeer.checkEvent(event); + } + void pumpOneEventForFilters(int id) { AWTEvent event = null; boolean eventOK = false; @@ -172,20 +189,7 @@ event = (id == ANY_EVENT) ? eq.getNextEvent() : eq.getNextEvent(id); - eventOK = true; - synchronized (eventFilters) { - for (int i = eventFilters.size() - 1; i >= 0; i--) { - EventFilter f = eventFilters.get(i); - EventFilter.FilterAction accept = f.acceptEvent(event); - if (accept == EventFilter.FilterAction.REJECT) { - eventOK = false; - break; - } else if (accept == EventFilter.FilterAction.ACCEPT_IMMEDIATELY) { - break; - } - } - } - eventOK = eventOK && SunDragSourceContextPeer.checkEvent(event); + eventOK = filterAndCheckEvent(event); if (!eventOK) { event.consume(); } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/java/awt/EventQueue.java --- a/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/java/awt/EventQueue.java Sat Sep 09 14:36:45 2017 +0200 @@ -719,7 +719,9 @@ fwDispatcher.scheduleDispatch(new Runnable() { @Override public void run() { - dispatchEventImpl(event, src); + if (dispatchThread.filterAndCheckEvent(event)) { + dispatchEventImpl(event, src); + } } }); } @@ -1008,6 +1010,32 @@ return createSecondaryLoop(null, null, 0); } + private class FwSecondaryLoopWrapper implements SecondaryLoop { + final private SecondaryLoop loop; + final private EventFilter filter; + + public FwSecondaryLoopWrapper(SecondaryLoop loop, EventFilter filter) { + this.loop = loop; + this.filter = filter; + } + + @Override + public boolean enter() { + if (filter != null) { + dispatchThread.addEventFilter(filter); + } + return loop.enter(); + } + + @Override + public boolean exit() { + if (filter != null) { + dispatchThread.removeEventFilter(filter); + } + return loop.exit(); + } + } + SecondaryLoop createSecondaryLoop(Conditional cond, EventFilter filter, long interval) { pushPopLock.lock(); try { @@ -1016,7 +1044,7 @@ return nextQueue.createSecondaryLoop(cond, filter, interval); } if (fwDispatcher != null) { - return fwDispatcher.createSecondaryLoop(); + return new FwSecondaryLoopWrapper(fwDispatcher.createSecondaryLoop(), filter); } if (dispatchThread == null) { initDispatchThread(); @@ -1183,6 +1211,9 @@ AWTAccessor.getInvocationEventAccessor() .dispose((InvocationEvent)entry.event); } + if (entry.event instanceof SunDropTargetEvent) { + ((SunDropTargetEvent)entry.event).dispose(); + } if (prev == null) { queues[i].head = entry.next; } else { diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java --- a/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -54,7 +54,6 @@ */ public abstract class GraphicsEnvironment { - private static GraphicsEnvironment localEnv; /** * The headless state of the Toolkit and GraphicsEnvironment @@ -74,53 +73,60 @@ } /** - * Returns the local {@code GraphicsEnvironment}. - * @return the local {@code GraphicsEnvironment} + * Lazy initialization of local graphics environment using holder idiom. */ - public static synchronized GraphicsEnvironment getLocalGraphicsEnvironment() { - if (localEnv == null) { - localEnv = createGE(); + private static final class LocalGE { + + /** + * The instance of the local {@code GraphicsEnvironment}. + */ + static final GraphicsEnvironment INSTANCE = createGE(); + + /** + * Creates and returns the GraphicsEnvironment, according to the + * system property 'java.awt.graphicsenv'. + * + * @return the graphics environment + */ + private static GraphicsEnvironment createGE() { + GraphicsEnvironment ge; + String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null)); + try { +// long t0 = System.currentTimeMillis(); + Class geCls; + try { + // First we try if the bootstrap class loader finds the + // requested class. This way we can avoid to run in a privileged + // block. + geCls = Class.forName(nm); + } catch (ClassNotFoundException ex) { + // If the bootstrap class loader fails, we try again with the + // application class loader. + ClassLoader cl = ClassLoader.getSystemClassLoader(); + geCls = Class.forName(nm, true, cl); + } + ge = (GraphicsEnvironment)geCls.getConstructor().newInstance(); +// long t1 = System.currentTimeMillis(); +// System.out.println("GE creation took " + (t1-t0)+ "ms."); + if (isHeadless()) { + ge = new HeadlessGraphicsEnvironment(ge); + } + } catch (ClassNotFoundException e) { + throw new Error("Could not find class: "+nm); + } catch (ReflectiveOperationException | IllegalArgumentException e) { + throw new Error("Could not instantiate Graphics Environment: " + + nm); + } + return ge; } - - return localEnv; } /** - * Creates and returns the GraphicsEnvironment, according to the - * system property 'java.awt.graphicsenv'. - * - * @return the graphics environment + * Returns the local {@code GraphicsEnvironment}. + * @return the local {@code GraphicsEnvironment} */ - private static GraphicsEnvironment createGE() { - GraphicsEnvironment ge; - String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null)); - try { -// long t0 = System.currentTimeMillis(); - Class geCls; - try { - // First we try if the bootstrap class loader finds the - // requested class. This way we can avoid to run in a privileged - // block. - geCls = Class.forName(nm); - } catch (ClassNotFoundException ex) { - // If the bootstrap class loader fails, we try again with the - // application class loader. - ClassLoader cl = ClassLoader.getSystemClassLoader(); - geCls = Class.forName(nm, true, cl); - } - ge = (GraphicsEnvironment)geCls.getConstructor().newInstance(); -// long t1 = System.currentTimeMillis(); -// System.out.println("GE creation took " + (t1-t0)+ "ms."); - if (isHeadless()) { - ge = new HeadlessGraphicsEnvironment(ge); - } - } catch (ClassNotFoundException e) { - throw new Error("Could not find class: "+nm); - } catch (ReflectiveOperationException | IllegalArgumentException e) { - throw new Error("Could not instantiate Graphics Environment: " - + nm); - } - return ge; + public static GraphicsEnvironment getLocalGraphicsEnvironment() { + return LocalGE.INSTANCE; } /** diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java --- a/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/java/awt/geom/Path2D.java Sat Sep 09 14:36:45 2017 +0200 @@ -276,6 +276,17 @@ } @Override + public final void trimToSize() { + // trim arrays: + if (numTypes < pointTypes.length) { + this.pointTypes = Arrays.copyOf(pointTypes, numTypes); + } + if (numCoords < floatCoords.length) { + this.floatCoords = Arrays.copyOf(floatCoords, numCoords); + } + } + + @Override float[] cloneCoordsFloat(AffineTransform at) { // trim arrays: float ret[]; @@ -1151,6 +1162,17 @@ } @Override + public final void trimToSize() { + // trim arrays: + if (numTypes < pointTypes.length) { + this.pointTypes = Arrays.copyOf(pointTypes, numTypes); + } + if (numCoords < doubleCoords.length) { + this.doubleCoords = Arrays.copyOf(doubleCoords, numCoords); + } + } + + @Override float[] cloneCoordsFloat(AffineTransform at) { // trim arrays: float ret[] = new float[numCoords]; @@ -2481,6 +2503,15 @@ // compatibility so we cannot restrict it further. // REMIND: Can we do both somehow? + /** + * Trims the capacity of this Path2D instance to its current + * size. An application can use this operation to minimize the + * storage of a path. + * + * @since 10 + */ + public abstract void trimToSize(); + /* * Support fields and methods for serializing the subclasses. */ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/java/awt/image/BufferedImage.java --- a/jdk/src/java.desktop/share/classes/java/awt/image/BufferedImage.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/java/awt/image/BufferedImage.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, 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 @@ -1012,7 +1012,7 @@ * @see #getRGB(int, int) * @see #getRGB(int, int, int, int, int[], int, int) */ - public synchronized void setRGB(int x, int y, int rgb) { + public void setRGB(int x, int y, int rgb) { raster.setDataElements(x, y, colorModel.getDataElements(rgb, null)); } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/AttributeException.java --- a/jdk/src/java.desktop/share/classes/javax/print/AttributeException.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/AttributeException.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -28,27 +28,22 @@ import javax.print.attribute.Attribute; /** - * Interface AttributeException is a mixin interface which a subclass of - * {@link - * PrintException PrintException} can implement to report an error condition - * involving one or more printing attributes that a particular Print + * Interface {@code AttributeException} is a mixin interface which a subclass of + * {@link PrintException PrintException} can implement to report an error + * condition involving one or more printing attributes that a particular Print * Service instance does not support. Either the attribute is not supported at * all, or the attribute is supported but the particular specified value is not - * supported. The Print Service API does not define any print exception - * classes that implement interface AttributeException, that being left to the + * supported. The Print Service API does not define any print exception classes + * that implement interface {@code AttributeException}, that being left to the * Print Service implementor's discretion. - * */ - public interface AttributeException { - /** * Returns the array of printing attribute classes for which the Print - * Service instance does not support the attribute at all, or null if - * there are no such attributes. The objects in the returned array are - * classes that extend the base interface - * {@link javax.print.attribute.Attribute Attribute}. + * Service instance does not support the attribute at all, or {@code null} + * if there are no such attributes. The objects in the returned array are + * classes that extend the base interface {@link Attribute Attribute}. * * @return unsupported attribute classes */ @@ -57,10 +52,10 @@ /** * Returns the array of printing attributes for which the Print Service * instance supports the attribute but does not support that particular - * value of the attribute, or null if there are no such attribute values. + * value of the attribute, or {@code null} if there are no such attribute + * values. * * @return unsupported attribute values */ public Attribute[] getUnsupportedValues(); - - } +} diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/CancelablePrintJob.java --- a/jdk/src/java.desktop/share/classes/javax/print/CancelablePrintJob.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/CancelablePrintJob.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, 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 @@ -26,52 +26,47 @@ package javax.print; /** - * This interface is used by a printing application to cancel a - * print job. This interface extends {@link DocPrintJob}. A - * {@code DocPrintJob} implementation returned from a print - * service implements this interface if the print job can be - * cancelled. Before trying to cancel - * a print job, the client needs to test if the - * {@code DocPrintJob} object returned from the print service - * actually implements this interface. Clients should never assume - * that a {@code DocPrintJob} implements this interface. A - * print service might support cancellation only for certain types - * of print data and representation class names. This means that - * only some of the {@code DocPrintJob} objects returned from - * a service will implement this interface. + * This interface is used by a printing application to cancel a print job. This + * interface extends {@link DocPrintJob}. A {@code DocPrintJob} implementation + * returned from a print service implements this interface if the print job can + * be cancelled. Before trying to cancel a print job, the client needs to test + * if the {@code DocPrintJob} object returned from the print service actually + * implements this interface. Clients should never assume that a + * {@code DocPrintJob} implements this interface. A print service might support + * cancellation only for certain types of print data and representation class + * names. This means that only some of the {@code DocPrintJob} objects returned + * from a service will implement this interface. *

    - * Service implementors are encouraged to implement this optional interface - * and to deliver a javax.print.event.PrintJobEvent.JOB_CANCELLED event - * to any listeners if a job is successfully cancelled with an - * implementation of this interface. Services should also note that an - * implementation of this method may be made from a separate client thread - * than that which made the print request. Thus the implementation of - * this interface must be made thread safe. + * Service implementors are encouraged to implement this optional interface and + * to deliver a {@link javax.print.event.PrintJobEvent#JOB_CANCELED} event to + * any listeners if a job is successfully cancelled with an implementation of + * this interface. Services should also note that an implementation of this + * method may be made from a separate client thread than that which made the + * print request. Thus the implementation of this interface must be made thread + * safe. */ - public interface CancelablePrintJob extends DocPrintJob { /** * Stops further processing of a print job. *

    - * If a service supports this method it cannot be concluded that - * job cancellation will always succeed. A job may not be able to be - * cancelled once it has reached and passed some point in its processing. - * A successful cancellation means only that the entire job was not - * printed, some portion may already have printed when cancel returns. + * If a service supports this method it cannot be concluded that job + * cancellation will always succeed. A job may not be able to be cancelled + * once it has reached and passed some point in its processing. A successful + * cancellation means only that the entire job was not printed, some portion + * may already have printed when cancel returns. *

    - * The service will throw a PrintException if the cancellation did not - * succeed. A job which has not yet been submitted for printing should - * throw this exception. - * Cancelling an already successfully cancelled Print Job is not - * considered an error and will always succeed. + * The service will throw a {@code PrintException} if the cancellation did + * not succeed. A job which has not yet been submitted for printing should + * throw this exception. Cancelling an already successfully cancelled Print + * Job is not considered an error and will always succeed. *

    * Cancellation in some services may be a lengthy process, involving - * requests to a server and processing of its print queue. Clients - * may wish to execute cancel in a thread which does not affect - * application execution. - * @throws PrintException if the job could not be successfully cancelled. + * requests to a server and processing of its print queue. Clients may wish + * to execute cancel in a thread which does not affect application + * execution. + * + * @throws PrintException if the job could not be successfully cancelled */ public void cancel() throws PrintException; - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/Doc.java --- a/jdk/src/java.desktop/share/classes/javax/print/Doc.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/Doc.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -25,181 +25,165 @@ package javax.print; +import java.io.IOException; import java.io.InputStream; -import java.io.IOException; import java.io.Reader; import javax.print.attribute.DocAttributeSet; - /** - * Interface Doc specifies the interface for an object that supplies one piece - * of print data for a Print Job. "Doc" is a short, easy-to-pronounce term + * Interface {@code Doc} specifies the interface for an object that supplies one + * piece of print data for a Print Job. "Doc" is a short, easy-to-pronounce term * that means "a piece of print data." The client passes to the Print Job an - * object that implements interface Doc, and the Print Job calls methods on - * that object to obtain the print data. The Doc interface lets a Print Job: - *

      - *
    • - * Determine the format, or "doc flavor" (class {@link DocFlavor DocFlavor}), - * in which the print data is available. A doc flavor designates the print - * data format (a MIME type) and the representation class of the object - * from which the print data comes. - * - *
    • - * Obtain the print data representation object, which is an instance of the - * doc flavor's representation class. The Print Job can then obtain the actual - * print data from the representation object. - * - *
    • - * Obtain the printing attributes that specify additional characteristics of - * the doc or that specify processing instructions to be applied to the doc. - * Printing attributes are defined in package {@link javax.print.attribute - * javax.print.attribute}. The doc returns its printing attributes stored in - * an {@link javax.print.attribute.DocAttributeSet javax.print.attribute.DocAttributeSet}. - *
    - *

    - * Each method in an implementation of interface Doc is permitted always to - * return the same object each time the method is called. - * This has implications - * for a Print Job or other caller of a doc object whose print data + * object that implements interface {@code Doc}, and the Print Job calls methods + * on that object to obtain the print data. The {@code Doc} interface lets a + * Print Job: + *

      + *
    • Determine the format, or "doc flavor" (class + * {@link DocFlavor DocFlavor}), in which the print data is available. A doc + * flavor designates the print data format (a MIME type) and the + * representation class of the object from which the print data comes. + *
    • Obtain the print data representation object, which is an instance of + * the doc flavor's representation class. The Print Job can then obtain the + * actual print data from the representation object. + *
    • Obtain the printing attributes that specify additional characteristics + * of the doc or that specify processing instructions to be applied to the + * doc. Printing attributes are defined in package + * {@link javax.print.attribute}. The doc returns its printing attributes + * stored in an {@link DocAttributeSet javax.print.attribute.DocAttributeSet}. + *
    + * Each method in an implementation of interface {@code Doc} is permitted always + * to return the same object each time the method is called. This has + * implications for a Print Job or other caller of a doc object whose print data * representation object "consumes" the print data as the caller obtains the * print data, such as a print data representation object which is a stream. - * Once the Print Job has called {@link #getPrintData() - * getPrintData()} and obtained the stream, any further calls to - * {@link #getPrintData() getPrintData()} will return the same - * stream object upon which reading may already be in progress, not a new - * stream object that will re-read the print data from the beginning. Specifying - * a doc object to behave this way simplifies the implementation of doc objects, - * and is justified on the grounds that a particular doc is intended to convey - * print data only to one Print Job, not to several different Print Jobs. (To - * convey the same print data to several different Print Jobs, you have to - * create several different doc objects on top of the same print data source.) - *

    - * Interface Doc affords considerable implementation flexibility. The print data - * might already be in existence when the doc object is constructed. In this - * case the objects returned by the doc's methods can be supplied to the doc's - * constructor, be stored in the doc ahead of time, and simply be returned when - * called for. Alternatively, the print data might not exist yet when the doc - * object is constructed. In this case the doc object might provide a "lazy" + * Once the Print Job has called {@link #getPrintData() getPrintData()} and + * obtained the stream, any further calls to {@link #getPrintData() + * getPrintData()} will return the same stream object upon which reading may + * already be in progress, not a new stream object that will re-read the + * print data from the beginning. Specifying a doc object to behave this way + * simplifies the implementation of doc objects, and is justified on the grounds + * that a particular doc is intended to convey print data only to one Print Job, + * not to several different Print Jobs. (To convey the same print data to + * several different Print Jobs, you have to create several different doc + * objects on top of the same print data source.) + *

    + * Interface {@code Doc} affords considerable implementation flexibility. The + * print data might already be in existence when the doc object is constructed. + * In this case the objects returned by the doc's methods can be supplied to the + * doc's constructor, be stored in the doc ahead of time, and simply be returned + * when called for. Alternatively, the print data might not exist yet when the + * doc object is constructed. In this case the doc object might provide a "lazy" * implementation that generates the print data representation object (and/or * the print data) only when the Print Job calls for it (when the Print Job * calls the {@link #getPrintData() getPrintData()} method). - *

    + *

    * There is no restriction on the number of client threads that may be * simultaneously accessing the same doc. Therefore, all implementations of - * interface Doc must be designed to be multiple thread safe. + * interface {@code Doc} must be designed to be multiple thread safe. *

    * However there can only be one consumer of the print data obtained from a - * Doc. + * {@code Doc}. *

    - * If print data is obtained from the client as a stream, by calling Doc's - * {@code getReaderForText()} or {@code getStreamForBytes()} - * methods, or because the print data source is already an InputStream or - * Reader, then the print service should always close these streams for the - * client on all job completion conditions. With the following caveat. - * If the print data is itself a stream, the service will always close it. - * If the print data is otherwise something that can be requested as a stream, - * the service will only close the stream if it has obtained the stream before - * terminating. That is, just because a print service might request data as - * a stream does not mean that it will, with the implications that Doc + * If print data is obtained from the client as a stream, by calling + * {@code Doc}'s {@code getReaderForText()} or {@code getStreamForBytes()} + * methods, or because the print data source is already an {@code InputStream} + * or {@code Reader}, then the print service should always close these streams + * for the client on all job completion conditions. With the following caveat. + * If the print data is itself a stream, the service will always close it. If + * the print data is otherwise something that can be requested as a stream, the + * service will only close the stream if it has obtained the stream before + * terminating. That is, just because a print service might request data as a + * stream does not mean that it will, with the implications that {@code Doc} * implementors which rely on the service to close them should create such * streams only in response to a request from the service. - *


    */ public interface Doc { /** - * Determines the doc flavor in which this doc object will supply its - * piece of print data. + * Determines the doc flavor in which this doc object will supply its piece + * of print data. * - * @return Doc flavor. + * @return doc flavor */ public DocFlavor getDocFlavor(); /** * Obtains the print data representation object that contains this doc - * object's piece of print data in the format corresponding to the - * supported doc flavor. - * The {@code getPrintData()} method returns an instance of - * the representation class whose name is given by {@link - * #getDocFlavor() getDocFlavor()}.{@link - * DocFlavor#getRepresentationClassName() - * getRepresentationClassName()}, and the return value can be cast - * from class Object to that representation class. + * object's piece of print data in the format corresponding to the supported + * doc flavor. The {@code getPrintData()} method returns an instance of the + * representation class whose name is given by{@link #getDocFlavor() + * getDocFlavor()}.{@link DocFlavor#getRepresentationClassName() + * getRepresentationClassName()}, and the return value can be cast from + * class {@code Object} to that representation class. * - * @return Print data representation object. - * - * @exception IOException - * Thrown if the representation class is a stream and there was an I/O - * error while constructing the stream. + * @return print data representation object + * @throws IOException if the representation class is a stream and there was + * an I/O error while constructing the stream */ public Object getPrintData() throws IOException; /** * Obtains the set of printing attributes for this doc object. If the * returned attribute set includes an instance of a particular attribute - * X, the printer must use that attribute value for this doc, - * overriding any value of attribute X in the job's attribute set. - * If the returned attribute set does not include an instance - * of a particular attribute X or if null is returned, the printer - * must consult the job's attribute set to obtain the value for - * attribute X, and if not found there, the printer must use an + * X, the printer must use that attribute value for this doc, + * overriding any value of attribute X in the job's attribute set. If + * the returned attribute set does not include an instance of a particular + * attribute X or if {@code null} is returned, the printer must + * consult the job's attribute set to obtain the value for attribute + * X, and if not found there, the printer must use an * implementation-dependent default value. The returned attribute set is * unmodifiable. * - * @return Unmodifiable set of printing attributes for this doc, or null - * to obtain all attribute values from the job's attribute - * set. + * @return unmodifiable set of printing attributes for this doc, or + * {@code null} to obtain all attribute values from the job's + * attribute set */ public DocAttributeSet getAttributes(); /** - * Obtains a reader for extracting character print data from this doc. - * The Doc implementation is required to support this method if the - * DocFlavor has one of the following print data representation classes, - * and return null otherwise: - *
      - *
    • char[] - *
    • java.lang.String - *
    • java.io.Reader - *
    + * Obtains a reader for extracting character print data from this doc. The + * {@code Doc} implementation is required to support this method if the + * {@code DocFlavor} has one of the following print data representation + * classes, and return {@code null} otherwise: + *
      + *
    • char[] + *
    • java.lang.String + *
    • java.io.Reader + *
    * The doc's print data representation object is used to construct and - * return a Reader for reading the print data as a stream of characters - * from the print data representation object. - * However, if the print data representation object is itself a Reader, - * then the print data representation object is simply returned. + * return a {@code Reader} for reading the print data as a stream of + * characters from the print data representation object. However, if the + * print data representation object is itself a {@code Reader}, then the + * print data representation object is simply returned. * - * @return Reader for reading the print data characters from this doc. - * If a reader cannot be provided because this doc does not meet - * the criteria stated above, null is returned. - * - * @exception IOException - * Thrown if there was an I/O error while creating the reader. + * @return reader for reading the print data characters from this doc. If a + * reader cannot be provided because this doc does not meet the + * criteria stated above, {@code null} is returned. + * @throws IOException if there was an I/O error while creating the reader */ public Reader getReaderForText() throws IOException; /** - * Obtains an input stream for extracting byte print data from this - * doc. The Doc implementation is required to support this method if - * the DocFlavor has one of the following print data representation - * classes, and return null otherwise: - *
      - *
    • byte[] - *
    • java.io.InputStream - *
    + * Obtains an input stream for extracting byte print data from this doc. The + * {@code Doc} implementation is required to support this method if the + * {@code DocFlavor} has one of the following print data representation + * classes, and return {@code null} otherwise: + *
      + *
    • byte[] + *
    • java.io.InputStream + *
    * This doc's print data representation object is obtained, then an input * stream for reading the print data from the print data representation * object as a stream of bytes is created and returned. However, if the * print data representation object is itself an input stream, then the * print data representation object is simply returned. * - * @return Input stream for reading the print data bytes from this doc. If - * an input stream cannot be provided because this doc does not - * meet the criteria stated above, null is returned. - * - * @exception IOException - * Thrown if there was an I/O error while creating the input stream. + * @return input stream for reading the print data bytes from this doc. If + * an input stream cannot be provided because this doc does not meet + * the criteria stated above, {@code null} is returned. + * @throws IOException if there was an I/O error while creating the input + * stream */ public InputStream getStreamForBytes() throws IOException; - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/DocFlavor.java --- a/jdk/src/java.desktop/share/classes/javax/print/DocFlavor.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/DocFlavor.java Sat Sep 09 14:36:45 2017 +0200 @@ -30,447 +30,376 @@ import java.io.ObjectOutputStream; import java.io.Serializable; - /** - * Class {@code DocFlavor} encapsulates an object that specifies the - * format in which print data is supplied to a {@link DocPrintJob}. - * "Doc" is a short, easy-to-pronounce term that means "a piece of print data." - * The print data format, or "doc flavor", consists of two things: - *
      - *
    • - * MIME type. This is a Multipurpose Internet Mail Extensions (MIME) - * media type (as defined in RFC - * 2045 and RFC 2046) - * that specifies how the print data is to be interpreted. - * The charset of text data should be the IANA MIME-preferred name, or its - * canonical name if no preferred name is specified. Additionally a few - * historical names supported by earlier versions of the Java platform may - * be recognized. - * See - * character encodings for more information on the character encodings - * supported on the Java platform. + * Class {@code DocFlavor} encapsulates an object that specifies the format in + * which print data is supplied to a {@link DocPrintJob}. "Doc" is a short, + * easy-to-pronounce term that means "a piece of print data." The print data + * format, or "doc flavor", consists of two things: + *
        + *
      • MIME type. This is a Multipurpose Internet Mail Extensions + * (MIME) media type (as defined in + * RFC 2045 and + * RFC 2046) that specifies + * how the print data is to be interpreted. The charset of text data should be + * the IANA MIME-preferred name, or its canonical name if no preferred name is + * specified. Additionally a few historical names supported by earlier + * versions of the Java platform may be recognized. See + * character encodings + * for more information on the character encodings supported on the Java + * platform. + *
      • Representation class name. This specifies the fully-qualified + * name of the class of the object from which the actual print data comes, as + * returned by the {@link Class#getName() Class.getName()} method. (Thus the + * class name for {@code byte[]} is {@code "[B"}, for {@code char[]} it is + * {@code "[C"}.) + *
      + * A {@code DocPrintJob} obtains its print data by means of interface + * {@link Doc Doc}. A {@code Doc} object lets the {@code DocPrintJob} determine + * the doc flavor the client can supply. A {@code Doc} object also lets the + * {@code DocPrintJob} obtain an instance of the doc flavor's representation + * class, from which the {@code DocPrintJob} then obtains the actual print data. * - *
    • - * Representation class name. This specifies the fully-qualified name of - * the class of the object from which the actual print data comes, as returned - * by the {@link java.lang.Class#getName() Class.getName()} method. - * (Thus the class name for {@code byte[]} is {@code "[B"}, for - * {@code char[]} it is {@code "[C"}.) - *
    - *

    - * A {@code DocPrintJob} obtains its print data by means of interface - * {@link Doc Doc}. A {@code Doc} object lets the {@code DocPrintJob} - * determine the doc flavor the client can supply. A {@code Doc} object - * also lets the {@code DocPrintJob} obtain an instance of the doc flavor's - * representation class, from which the {@code DocPrintJob} then obtains - * the actual print data. - * - *


    - *

    Client Formatted Print Data

    - * There are two broad categories of print data, client formatted print data - * and service formatted print data. - *

    - * For client formatted print data, the client determines or knows the - * print data format. - * For example the client may have a JPEG encoded image, a URL for - * HTML code, or a disk file containing plain text in some encoding, - * possibly obtained from an external source, and - * requires a way to describe the data format to the print service. + *


    + *

    Client Formatted Print Data

    + * There are two broad categories of print data, client formatted print data and + * service formatted print data. + *

    + * For client formatted print data, the client determines or knows the + * print data format. For example the client may have a JPEG encoded image, a + * {@code URL} for HTML code, or a disk file containing plain text in some + * encoding, possibly obtained from an external source, and requires a way to + * describe the data format to the print service. *

    * The doc flavor's representation class is a conduit for the JPS - * {@code DocPrintJob} to obtain a sequence of characters or - * bytes from the client. The - * doc flavor's MIME type is one of the standard media types telling how to - * interpret the sequence of characters or bytes. For a list of standard media - * types, see the Internet Assigned Numbers Authority's (IANA's) Media Types - * Directory. Interface {@link Doc Doc} provides two utility operations, + * {@code DocPrintJob} to obtain a sequence of characters or bytes from the + * client. The doc flavor's MIME type is one of the standard media types telling + * how to interpret the sequence of characters or bytes. For a list of standard + * media types, see the Internet Assigned Numbers Authority's (IANA's) + * Media Types Directory + * . Interface {@link Doc Doc} provides two utility operations, * {@link Doc#getReaderForText() getReaderForText} and - * {@link Doc#getStreamForBytes() getStreamForBytes()}, to help a - * {@code Doc} object's client extract client formatted print data. - *

    + * {@link Doc#getStreamForBytes() getStreamForBytes()}, to help a {@code Doc} + * object's client extract client formatted print data. + *

    * For client formatted print data, the print data representation class is * typically one of the following (although other representation classes are * permitted): - *

      - *
    • - * Character array ({@code char[]}) -- The print data consists of the - * Unicode characters in the array. - * - *
    • - * {@code String} -- - * The print data consists of the Unicode characters in the string. - * - *
    • - * Character stream ({@link java.io.Reader java.io.Reader}) - * -- The print data consists of the Unicode characters read from the stream - * up to the end-of-stream. - * - *
    • - * Byte array ({@code byte[]}) -- The print data consists of the bytes in - * the array. The bytes are encoded in the character set specified by the doc - * flavor's MIME type. If the MIME type does not specify a character set, the - * default character set is US-ASCII. + *
        + *
      • Character array ({@code char[]}) -- The print data consists of the + * Unicode characters in the array. + *
      • {@code String} -- The print data consists of the Unicode characters in + * the string. + *
      • Character stream ({@link java.io.Reader java.io.Reader}) -- The print + * data consists of the Unicode characters read from the stream up to the + * end-of-stream. + *
      • Byte array ({@code byte[]}) -- The print data consists of the bytes in + * the array. The bytes are encoded in the character set specified by the doc + * flavor's MIME type. If the MIME type does not specify a character set, the + * default character set is US-ASCII. + *
      • Byte stream ({@link java.io.InputStream java.io.InputStream}) -- The + * print data consists of the bytes read from the stream up to the + * end-of-stream. The bytes are encoded in the character set specified by the + * doc flavor's MIME type. If the MIME type does not specify a character set, + * the default character set is US-ASCII. + *
      • Uniform Resource Locator ({@link java.net.URL URL}) -- The print data + * consists of the bytes read from the URL location. The bytes are encoded in + * the character set specified by the doc flavor's MIME type. If the MIME type + * does not specify a character set, the default character set is US-ASCII. + * When the representation class is a {@code URL}, the print service itself + * accesses and downloads the document directly from its {@code URL} address, + * without involving the client. The service may be some form of network print + * service which is executing in a different environment. This means you + * should not use a {@code URL} print data flavor to print a document at a + * restricted {@code URL} that the client can see but the printer cannot see. + * This also means you should not use a {@code URL} print data flavor to print + * a document stored in a local file that is not available at a {@code URL} + * accessible independently of the client. For example, a file that is not + * served up by an HTTP server or FTP server. To print such documents, let the + * client open an input stream on the {@code URL} or file and use an input + * stream data flavor. + *
      * - *
    • - * Byte stream ({@link java.io.InputStream java.io.InputStream}) -- - * The print data consists of the bytes read from the stream up to the - * end-of-stream. The bytes are encoded in the character set specified by the - * doc flavor's MIME type. If the MIME type does not specify a character set, - * the default character set is US-ASCII. - - *
    • - * Uniform Resource Locator ({@link java.net.URL URL}) - * -- The print data consists of the bytes read from the URL location. - * The bytes are encoded in the character set specified by the doc flavor's - * MIME type. If the MIME type does not specify a character set, the default - * character set is US-ASCII. - *

      - * When the representation class is a URL, the print service itself accesses - * and downloads the document directly from its URL address, without involving - * the client. The service may be some form of network print service which - * is executing in a different environment. - * This means you should not use a URL print data flavor to print a - * document at a restricted URL that the client can see but the printer cannot - * see. This also means you should not use a URL print data flavor to print a - * document stored in a local file that is not available at a URL - * accessible independently of the client. - * For example, a file that is not served up by an HTTP server or FTP server. - * To print such documents, let the client open an input stream on the URL - * or file and use an input stream data flavor. - *

    - * - *
    + *
    *

    Default and Platform Encodings

    - *

    * For byte print data where the doc flavor's MIME type does not include a * {@code charset} parameter, the Java Print Service instance assumes the * US-ASCII character set by default. This is in accordance with - * RFC 2046, which says the - * default character set is US-ASCII. Note that US-ASCII is a subset of - * UTF-8, so in the future this may be widened if a future RFC endorses - * UTF-8 as the default in a compatible manner. + * RFC 2046, which says the + * default character set is US-ASCII. Note that US-ASCII is a subset of UTF-8, + * so in the future this may be widened if a future RFC endorses UTF-8 as the + * default in a compatible manner. *

    - * Also note that this is different than the behaviour of the Java runtime - * when interpreting a stream of bytes as text data. That assumes the - * default encoding for the user's locale. Thus, when spooling a file in local - * encoding to a Java Print Service it is important to correctly specify - * the encoding. Developers working in the English locales should - * be particularly conscious of this, as their platform encoding corresponds - * to the default mime charset. By this coincidence that particular - * case may work without specifying the encoding of platform data. + * Also note that this is different than the behaviour of the Java runtime when + * interpreting a stream of bytes as text data. That assumes the default + * encoding for the user's locale. Thus, when spooling a file in local encoding + * to a Java Print Service it is important to correctly specify the encoding. + * Developers working in the English locales should be particularly conscious of + * this, as their platform encoding corresponds to the default mime charset. By + * this coincidence that particular case may work without specifying the + * encoding of platform data. *

    * Every instance of the Java virtual machine has a default character encoding * determined during virtual-machine startup and typically depends upon the - * locale and charset being used by the underlying operating system. - * In a distributed environment there is no guarantee that two VM share - * the same default encoding. Thus clients which want to stream platform - * encoded text data from the host platform to a Java Print Service instance - * must explicitly declare the charset and not rely on defaults. + * locale and charset being used by the underlying operating system. In a + * distributed environment there is no guarantee that two VM share the same + * default encoding. Thus clients which want to stream platform encoded text + * data from the host platform to a Java Print Service instance must explicitly + * declare the charset and not rely on defaults. *

    * The preferred form is the official IANA primary name for an encoding. - * Applications which stream text data should always specify the charset - * in the mime type, which necessitates obtaining the encoding of the host - * platform for data (eg files) stored in that platform's encoding. - * A CharSet which corresponds to this and is suitable for use in a - * mime-type for a DocFlavor can be obtained - * from {@link DocFlavor#hostEncoding DocFlavor.hostEncoding} - * This may not always be the primary IANA name but is guaranteed to be - * understood by this VM. - * For common flavors, the pre-defined *HOST DocFlavors may be used. + * Applications which stream text data should always specify the charset in the + * mime type, which necessitates obtaining the encoding of the host platform for + * data (eg files) stored in that platform's encoding. A {@code CharSet} which + * corresponds to this and is suitable for use in a mime-type for a + * {@code DocFlavor} can be obtained from + * {@link DocFlavor#hostEncoding DocFlavor.hostEncoding} This may not always be + * the primary IANA name but is guaranteed to be understood by this VM. For + * common flavors, the pre-defined *HOST {@code DocFlavors} may be used. *

    - * See - * character encodings for more information on the character encodings - * supported on the Java platform. - *


    - *

    Recommended DocFlavors

    - *

    - * The Java Print Service API does not define any mandatorily supported - * DocFlavors. - * However, here are some examples of MIME types that a Java Print Service - * instance might support for client formatted print data. - * Nested classes inside class DocFlavor declare predefined static - * constant DocFlavor objects for these example doc flavors; class DocFlavor's - * constructor can be used to create an arbitrary doc flavor. - *

      - *
    • Preformatted text - *
    TargetpropOrderClassBodyComplexTypeSimpleType
    TargetpropOrderClassBodyComplexTypeSimpleType
    Class{}[property]+ {@literal ->} elements[property]+ {@literal ->} elementscomplexcontent
    xs:all
    Classnon empty[property]+ {@literal ->} elements[property]+ {@literal ->} elementscomplexcontent
    xs:sequence
    ClassXno property {@literal ->} elementno property {@literal ->} elementcomplexcontent
    empty sequence
    ClassX1 [{@code @XmlValue} property] {@literal &&}
    [property]+ {@literal ->} attributes
    1 [{@code @XmlValue} property] {@literal &&}
    [property]+ {@literal ->} attributes
    simplecontent
    ClassX1 [{@code @XmlValue} property] {@literal &&}
    no properties {@literal ->} attribute
    1 [{@code @XmlValue} property] {@literal &&}
    no properties {@literal ->} attribute
    simpletype
    - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    MIME-Types and their descriptions
    MIME-TypeDescription
    {@code "text/plain"}Plain text in the default character set (US-ASCII)
    "text/plain; charset=xxx"Plain text in character set xxx
    {@code "text/html"}HyperText Markup Language in the default character set (US-ASCII)
    "text/html; charset=xxx"HyperText Markup Language in character set xxx
    - *

    - * In general, preformatted text print data is provided either in a character - * oriented representation class (character array, String, Reader) or in a - * byte oriented representation class (byte array, InputStream, URL). - * - *

  1. Preformatted page description language (PDL) documents + * See character + * encodings for more information on the character encodings supported on + * the Java platform. * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    MIME-Types and their descriptions
    MIME-TypeDescription
    {@code "application/pdf"}Portable Document Format document
    {@code "application/postscript"}PostScript document
    {@code "application/vnd.hp-PCL"}Printer Control Language document
    - *

    - * In general, preformatted PDL print data is provided in a byte oriented - * representation class (byte array, InputStream, URL). - * - *

  2. Preformatted images + *
    + *

    Recommended DocFlavors

    + * The Java Print Service API does not define any mandatorily supported + * {@code DocFlavors}. However, here are some examples of MIME types that a Java + * Print Service instance might support for client formatted print data. Nested + * classes inside class {@code DocFlavor} declare predefined static constant + * {@code DocFlavor} objects for these example doc flavors; class + * {@code DocFlavor}'s constructor can be used to create an arbitrary doc + * flavor. + *
      + *
    • Preformatted text + * + * + * + * + * + * + * + * + * + * + * + *
      MIME-Types and their descriptions
      MIME-Type + * Description + *
      {@code "text/plain"} + * Plain text in the default character set (US-ASCII) + *
      "text/plain; charset=xxx" + * Plain text in character set xxx + *
      {@code "text/html"} + * HyperText Markup Language in the default character set (US-ASCII) + *
      "text/html; charset=xxx" + * HyperText Markup Language in character set xxx + *
      + * In general, preformatted text print data is provided either in a character + * oriented representation class (character array, String, Reader) or in a + * byte oriented representation class (byte array, InputStream, URL). + *
    • Preformatted page description language (PDL) documents + * + * + * + * + * + * + * + * + * + * + *
      MIME-Types and their descriptions
      MIME-Type + * Description + *
      {@code "application/pdf"} + * Portable Document Format document + *
      {@code "application/postscript"} + * PostScript document + *
      {@code "application/vnd.hp-PCL"} + * Printer Control Language document + *
      + * In general, preformatted PDL print data is provided in a byte oriented + * representation class (byte array, {@code InputStream}, {@code URL}). + *
    • Preformatted images + * + * + * + * + * + * + * + * + * + * + *
      MIME-Types and their descriptions
      MIME-Type + * Description + *
      {@code "image/gif"} + * Graphics Interchange Format image + *
      {@code "image/jpeg"} + * Joint Photographic Experts Group image + *
      {@code "image/png"} + * Portable Network Graphics image + *
      + * In general, preformatted image print data is provided in a byte oriented + * representation class (byte array, {@code InputStream}, {@code URL}). + *
    • Preformatted autosense print data + * + * + * + * + * + * + * + * + *
      MIME-Types and their descriptions
      MIME-Type + * Description + *
      {@code "application/octet-stream"} + * The print data format is unspecified (just an octet stream) + *
      + * The printer decides how to interpret the print data; the way this + * "autosensing" works is implementation dependent. In general, preformatted + * autosense print data is provided in a byte oriented representation class + * (byte array, {@code InputStream}, {@code URL}). + *
    * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    MIME-Types and their descriptions
    MIME-TypeDescription
    {@code "image/gif"}Graphics Interchange Format image
    {@code "image/jpeg"}Joint Photographic Experts Group image
    {@code "image/png"}Portable Network Graphics image
    - *

    - * In general, preformatted image print data is provided in a byte oriented - * representation class (byte array, InputStream, URL). - * - *

  3. Preformatted autosense print data - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    MIME-Types and their descriptions
    MIME-TypeDescription
    {@code "application/octet-stream"}The print data format is unspecified (just an octet stream)
    - *

    - * The printer decides how to interpret the print data; the way this - * "autosensing" works is implementation dependent. In general, preformatted - * autosense print data is provided in a byte oriented representation class - * (byte array, InputStream, URL). - * - * - *


    - *

    Service Formatted Print Data

    - *

    - * For service formatted print data, the Java Print Service instance + *


    + *

    Service Formatted Print Data

    + * For service formatted print data, the Java Print Service instance * determines the print data format. The doc flavor's representation class * denotes an interface whose methods the {@code DocPrintJob} invokes to - * determine the content to be printed -- such as a renderable image - * interface or a Java printable interface. - * The doc flavor's MIME type is the special value - * {@code "application/x-java-jvm-local-objectref"} indicating the client - * will supply a reference to a Java object that implements the interface - * named as the representation class. - * This MIME type is just a placeholder; what's + * determine the content to be printed -- such as a renderable image interface + * or a Java printable interface. The doc flavor's MIME type is the special + * value {@code "application/x-java-jvm-local-objectref"} indicating the client + * will supply a reference to a Java object that implements the interface named + * as the representation class. This MIME type is just a placeholder; what's * important is the print data representation class. - *

    + *

    * For service formatted print data, the print data representation class is * typically one of the following (although other representation classes are - * permitted). Nested classes inside class DocFlavor declare predefined static - * constant DocFlavor objects for these example doc flavors; class DocFlavor's - * constructor can be used to create an arbitrary doc flavor. - *

      - *
    • - * Renderable image object -- The client supplies an object that implements - * interface - * {@link java.awt.image.renderable.RenderableImage RenderableImage}. The - * printer calls methods - * in that interface to obtain the image to be printed. - * - *
    • - * Printable object -- The client supplies an object that implements interface - * {@link java.awt.print.Printable Printable}. - * The printer calls methods in that interface to obtain the pages to be - * printed, one by one. - * For each page, the printer supplies a graphics context, and whatever the - * client draws in that graphics context gets printed. - * - *
    • - * Pageable object -- The client supplies an object that implements interface - * {@link java.awt.print.Pageable Pageable}. The printer calls - * methods in that interface to obtain the pages to be printed, one by one. - * For each page, the printer supplies a graphics context, and whatever - * the client draws in that graphics context gets printed. - *
    - * - *
    + * permitted). Nested classes inside class {@code DocFlavor} declare predefined + * static constant {@code DocFlavor} objects for these example doc flavors; + * class {@code DocFlavor}'s constructor can be used to create an arbitrary doc + * flavor. + *
      + *
    • Renderable image object -- The client supplies an object that + * implements interface + * {@link java.awt.image.renderable.RenderableImage RenderableImage}. The + * printer calls methods in that interface to obtain the image to be printed. + *
    • Printable object -- The client supplies an object that implements + * interface {@link java.awt.print.Printable Printable}. The printer calls + * methods in that interface to obtain the pages to be printed, one by one. + * For each page, the printer supplies a graphics context, and whatever the + * client draws in that graphics context gets printed. + *
    • Pageable object -- The client supplies an object that implements + * interface {@link java.awt.print.Pageable Pageable}. The printer calls + * methods in that interface to obtain the pages to be printed, one by one. + * For each page, the printer supplies a graphics context, and whatever the + * client draws in that graphics context gets printed. + *
    * - *
    - *

    Pre-defined Doc Flavors

    - * A Java Print Service instance is not required to support the - * following print data formats and print data representation classes. In - * fact, a developer using this class should never assume that a - * particular print service supports the document types corresponding to - * these pre-defined doc flavors. Always query the print service - * to determine what doc flavors it supports. However, - * developers who have print services that support these doc flavors are - * encouraged to refer to the predefined singleton instances created here. - *
      - *
    • - * Plain text print data provided through a byte stream. Specifically, the - * following doc flavors are recommended to be supported: - *
      ·   - * {@code ("text/plain", "java.io.InputStream")} - *
      ·   - * {@code ("text/plain; charset=us-ascii", "java.io.InputStream")} - *
      ·   - * {@code ("text/plain; charset=utf-8", "java.io.InputStream")} - * - *
    • - * Renderable image objects. Specifically, the following doc flavor is - * recommended to be supported: - *
      ·   - * {@code ("application/x-java-jvm-local-objectref", "java.awt.image.renderable.RenderableImage")} - *
    - *

    - * A Java Print Service instance is allowed to support any other doc flavors - * (or none) in addition to the above mandatory ones, at the implementation's + *


    + *

    Pre-defined Doc Flavors

    + * A Java Print Service instance is not required to support the + * following print data formats and print data representation classes. In fact, + * a developer using this class should never assume that a particular + * print service supports the document types corresponding to these pre-defined + * doc flavors. Always query the print service to determine what doc flavors it + * supports. However, developers who have print services that support these doc + * flavors are encouraged to refer to the predefined singleton instances created + * here. + *
      + *
    • Plain text print data provided through a byte stream. Specifically, the + * following doc flavors are recommended to be supported: + *
      ·   + * {@code ("text/plain", "java.io.InputStream")} + *
      ·   + * {@code ("text/plain; charset=us-ascii", "java.io.InputStream")} + *
      ·   + * {@code ("text/plain; charset=utf-8", "java.io.InputStream")} + *
    • Renderable image objects. Specifically, the following doc flavor is + * recommended to be supported: + *
      ·   + * {@code ("application/x-java-jvm-local-objectref", "java.awt.image.renderable.RenderableImage")} + *
    + * A Java Print Service instance is allowed to support any other doc flavors (or + * none) in addition to the above mandatory ones, at the implementation's * choice. - *

    + *

    * Support for the above doc flavors is desirable so a printing client can rely * on being able to print on any JPS printer, regardless of which doc flavors * the printer supports. If the printer doesn't support the client's preferred * doc flavor, the client can at least print plain text, or the client can * convert its data to a renderable image and print the image. - *

    + *

    * Furthermore, every Java Print Service instance must fulfill these * requirements for processing plain text print data: - *

      - *
    • - * The character pair carriage return-line feed (CR-LF) means - * "go to column 1 of the next line." - *
    • - * A carriage return (CR) character standing by itself means - * "go to column 1 of the next line." - *
    • - * A line feed (LF) character standing by itself means - * "go to column 1 of the next line." - *
    - *

    + *

      + *
    • The character pair carriage return-line feed (CR-LF) means "go to + * column 1 of the next line." + *
    • A carriage return (CR) character standing by itself means "go to column + * 1 of the next line." + *
    • A line feed (LF) character standing by itself means "go to column 1 of + * the next line." + *
    * The client must itself perform all plain text print data formatting not * addressed by the above requirements. * - *

    Design Rationale

    - *

    - * Class DocFlavor in package javax.print.data is similar to class - * {@link java.awt.datatransfer.DataFlavor DataFlavor}. Class - * {@code DataFlavor} - * is not used in the Java Print Service (JPS) API - * for three reasons which are all rooted in allowing the JPS API to be - * shared by other print services APIs which may need to run on Java profiles - * which do not include all of the Java Platform, Standard Edition. - *

      - *
    1. - * The JPS API is designed to be used in Java profiles which do not support - * AWT. - * - *
    2. - * The implementation of class {@code java.awt.datatransfer.DataFlavor} - * does not guarantee that equivalent data flavors will have the same - * serialized representation. DocFlavor does, and can be used in services - * which need this. + *

      Design Rationale

      + * Class {@code DocFlavor} in package {@code javax.print} is similar to class + * {@link java.awt.datatransfer.DataFlavor}. Class {@code DataFlavor} is not + * used in the Java Print Service (JPS) API for three reasons which are all + * rooted in allowing the JPS API to be shared by other print services APIs + * which may need to run on Java profiles which do not include all of the Java + * Platform, Standard Edition. + *
        + *
      1. The JPS API is designed to be used in Java profiles which do not + * support AWT. + *
      2. The implementation of class {@code java.awt.datatransfer.DataFlavor} + * does not guarantee that equivalent data flavors will have the same + * serialized representation. {@code DocFlavor} does, and can be used in + * services which need this. + *
      3. The implementation of class {@code java.awt.datatransfer.DataFlavor} + * includes a human presentable name as part of the serialized representation. + * This is not appropriate as part of a service matching constraint. + *
      + * Class {@code DocFlavor}'s serialized representation uses the following + * canonical form of a MIME type string. Thus, two doc flavors with MIME types + * that are not identical but that are equivalent (that have the same canonical + * form) may be considered equal. + *
        + *
      • The media type, media subtype, and parameters are retained, but all + * comments and whitespace characters are discarded. + *
      • The media type, media subtype, and parameter names are converted to + * lowercase. + *
      • The parameter values retain their original case, except a charset + * parameter value for a text media type is converted to lowercase. + *
      • Quote characters surrounding parameter values are removed. + *
      • Quoting backslash characters inside parameter values are removed. + *
      • The parameters are arranged in ascending order of parameter name. + *
      + * Class {@code DocFlavor}'s serialized representation also contains the + * fully-qualified class name of the representation class (a + * {@code String} object), rather than the representation class itself (a + * {@code Class} object). This allows a client to examine the doc flavors a Java + * Print Service instance supports without having to load the representation + * classes, which may be problematic for limited-resource clients. * - *
    3. - * The implementation of class {@code java.awt.datatransfer.DataFlavor} - * includes a human presentable name as part of the serialized representation. - * This is not appropriate as part of a service matching constraint. - *
    - *

    - * Class DocFlavor's serialized representation uses the following - * canonical form of a MIME type string. Thus, two doc flavors with MIME types - * that are not identical but that are equivalent (that have the same - * canonical form) may be considered equal. - *

      - *
    • The media type, media subtype, and parameters are retained, but all - * comments and whitespace characters are discarded. - *
    • The media type, media subtype, and parameter names are converted to - * lowercase. - *
    • The parameter values retain their original case, except a charset - * parameter value for a text media type is converted to lowercase. - *
    • Quote characters surrounding parameter values are removed. - *
    • Quoting backslash characters inside parameter values are removed. - *
    • The parameters are arranged in ascending order of parameter name. - *
    - *

    - * Class DocFlavor's serialized representation also contains the - * fully-qualified class name of the representation class - * (a String object), rather than the representation class itself - * (a Class object). This allows a client to examine the doc flavors a - * Java Print Service instance supports without having - * to load the representation classes, which may be problematic for - * limited-resource clients. - * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public class DocFlavor implements Serializable, Cloneable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -4512080796965449721L; /** - * A String representing the host operating system encoding. - * This will follow the conventions documented in + * A string representing the host operating system encoding. This will + * follow the conventions documented in * * RFC 2278: IANA Charset Registration Procedures * except where historical names are returned for compatibility with - * previous versions of the Java platform. - * The value returned from method is valid only for the VM which - * returns it, for use in a DocFlavor. - * This is the charset for all the "HOST" pre-defined DocFlavors in + * previous versions of the Java platform. The value returned from method is + * valid only for the VM which returns it, for use in a {@code DocFlavor}. + * This is the charset for all the "HOST" pre-defined {@code DocFlavors} in * the executing VM. */ public static final String hostEncoding; @@ -488,6 +417,7 @@ /** * Representation class name. + * * @serial */ private String myClassName; @@ -497,21 +427,17 @@ */ private transient String myStringValue = null; - /** * Constructs a new doc flavor object from the given MIME type and * representation class name. The given MIME type is converted into * canonical form and stored internally. * - * @param mimeType MIME media type string. - * @param className Fully-qualified representation class name. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code mimeType} is null or - * {@code className} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code mimeType} does not - * obey the syntax for a MIME media type string. + * @param mimeType MIME media type string + * @param className fully-qualified representation class name + * @throws NullPointerException if {@code mimeType} or {@code className} is + * {@code null} + * @throws IllegalArgumentException if {@code mimeType} does not obey the + * syntax for a MIME media type string */ public DocFlavor(String mimeType, String className) { if (className == null) { @@ -522,8 +448,9 @@ } /** - * Returns this doc flavor object's MIME type string based on the - * canonical form. Each parameter value is enclosed in quotes. + * Returns this doc flavor object's MIME type string based on the canonical + * form. Each parameter value is enclosed in quotes. + * * @return the mime type */ public String getMimeType() { @@ -532,6 +459,7 @@ /** * Returns this doc flavor object's media type (from the MIME type). + * * @return the media type */ public String getMediaType() { @@ -540,6 +468,7 @@ /** * Returns this doc flavor object's media subtype (from the MIME type). + * * @return the media sub-type */ public String getMediaSubtype() { @@ -547,19 +476,18 @@ } /** - * Returns a {@code String} representing a MIME - * parameter. - * Mime types may include parameters which are usually optional. - * The charset for text types is a commonly useful example. - * This convenience method will return the value of the specified - * parameter if one was specified in the mime type for this flavor. + * Returns a {@code String} representing a MIME parameter. Mime types may + * include parameters which are usually optional. The charset for text types + * is a commonly useful example. This convenience method will return the + * value of the specified parameter if one was specified in the mime type + * for this flavor. * - * @param paramName the name of the paramater. This name is internally - * converted to the canonical lower case format before performing - * the match. - * @return String representing a mime parameter, or - * null if that parameter is not in the mime type string. - * @exception NullPointerException if paramName is null. + * @param paramName the name of the parameter. This name is internally + * converted to the canonical lower case format before performing + * the match. + * @return a string representing a mime parameter, or {@code null} if that + * parameter is not in the mime type string + * @throws NullPointerException if paramName is {@code null} */ public String getParameter(String paramName) { return myMimeType.getParameterMap().get(paramName.toLowerCase()); @@ -567,7 +495,8 @@ /** * Returns the name of this doc flavor object's representation class. - * @return the name of the representation class. + * + * @return the name of the representation class */ public String getRepresentationClassName() { return myClassName; @@ -576,10 +505,9 @@ /** * Converts this {@code DocFlavor} to a string. * - * @return MIME type string based on the canonical form. Each parameter - * value is enclosed in quotes. - * A "class=" parameter is appended to the - * MIME type string to indicate the representation class name. + * @return MIME type string based on the canonical form. Each parameter + * value is enclosed in quotes. A "class=" parameter is appended to + * the MIME type string to indicate the representation class name. */ public String toString() { return getStringValue(); @@ -593,22 +521,21 @@ } /** - * Determines if this doc flavor object is equal to the given object. - * The two are equal if the given object is not null, is an instance - * of {@code DocFlavor}, has a MIME type equivalent to this doc - * flavor object's MIME type (that is, the MIME types have the same media - * type, media subtype, and parameters), and has the same representation - * class name as this doc flavor object. Thus, if two doc flavor objects' - * MIME types are the same except for comments, they are considered equal. - * However, two doc flavor objects with MIME types of "text/plain" and - * "text/plain; charset=US-ASCII" are not considered equal, even though - * they represent the same media type (because the default character - * set for plain text is US-ASCII). + * Determines if this doc flavor object is equal to the given object. The + * two are equal if the given object is not {@code null}, is an instance of + * {@code DocFlavor}, has a MIME type equivalent to this doc flavor object's + * MIME type (that is, the MIME types have the same media type, media + * subtype, and parameters), and has the same representation class name as + * this doc flavor object. Thus, if two doc flavor objects' MIME types are + * the same except for comments, they are considered equal. However, two doc + * flavor objects with MIME types of "text/plain" and "text/plain; + * charset=US-ASCII" are not considered equal, even though they represent + * the same media type (because the default character set for plain text is + * US-ASCII). * - * @param obj Object to test. - * - * @return True if this doc flavor object equals {@code obj}, false - * otherwise. + * @param obj {@code Object} to test + * @return {@code true} if this doc flavor object equals {@code obj}, + * {@code false} otherwise */ public boolean equals(Object obj) { return @@ -619,6 +546,8 @@ /** * Returns this doc flavor object's string value. + * + * @return the string value */ private String getStringValue() { if (myStringValue == null) { @@ -630,8 +559,9 @@ /** * Write the instance to a stream (ie serialize the object). * + * @param s the output stream * @throws IOException if I/O errors occur while writing to the underlying - * stream + * stream */ private void writeObject(ObjectOutputStream s) throws IOException { @@ -642,14 +572,15 @@ /** * Reconstitute an instance from a stream (that is, deserialize it). * + * @param s the input stream * @throws ClassNotFoundException if the class of a serialized object could - * not be found. + * not be found * @throws IOException if I/O errors occur while reading from the underlying - * stream - * @serialData - * The serialised form of a DocFlavor is the String naming the - * representation class followed by the String representing the canonical - * form of the mime type. + * stream + * @serialData The serialised form of a {@code DocFlavor} is the + * {@code String} naming the representation class followed by + * the {@code String} representing the canonical form of the + * mime type */ private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { @@ -659,167 +590,140 @@ } /** - * Class DocFlavor.BYTE_ARRAY provides predefined static constant - * DocFlavor objects for example doc flavors using a byte array + * Class {@code DocFlavor.BYTE_ARRAY} provides predefined static constant + * {@code DocFlavor} objects for example doc flavors using a byte array * ({@code byte[]}) as the print data representation class. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public static class BYTE_ARRAY extends DocFlavor { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -9065578006593857475L; /** - * Constructs a new doc flavor with the given MIME type and a print - * data representation class name of {@code "[B"} (byte array). - * - * @param mimeType MIME media type string. + * Constructs a new doc flavor with the given MIME type and a print data + * representation class name of {@code "[B"} (byte array). * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code mimeType} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code mimeType} does not - * obey the syntax for a MIME media type string. + * @param mimeType MIME media type string + * @throws NullPointerException if {@code mimeType} is {@code null} + * @throws IllegalArgumentException if {@code mimeType} does not obey + * the syntax for a MIME media type string */ public BYTE_ARRAY (String mimeType) { super (mimeType, "[B"); } /** - * Doc flavor with MIME type = {@code "text/plain"}, - * encoded in the host platform encoding. - * See {@link DocFlavor#hostEncoding hostEncoding} - * Print data representation class name = - * {@code "[B"} (byte array). + * Doc flavor with MIME type = {@code "text/plain"}, encoded in the host + * platform encoding. See {@link DocFlavor#hostEncoding hostEncoding}. + * Print data representation class name = {@code "[B"} (byte array). */ public static final BYTE_ARRAY TEXT_PLAIN_HOST = new BYTE_ARRAY ("text/plain; charset="+hostEncoding); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=utf-8"}, - * print data representation class name = {@code "[B"} (byte - * array). + * Doc flavor with MIME type = {@code "text/plain; charset=utf-8"}, + * print data representation class name = {@code "[B"} (byte array). */ public static final BYTE_ARRAY TEXT_PLAIN_UTF_8 = new BYTE_ARRAY ("text/plain; charset=utf-8"); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=utf-16"}, - * print data representation class name = {@code "[B"} (byte - * array). + * Doc flavor with MIME type = {@code "text/plain; charset=utf-16"}, + * print data representation class name = {@code "[B"} (byte array). */ public static final BYTE_ARRAY TEXT_PLAIN_UTF_16 = new BYTE_ARRAY ("text/plain; charset=utf-16"); - /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=utf-16be"} - * (big-endian byte ordering), - * print data representation class name = {@code "[B"} (byte - * array). + * Doc flavor with MIME type = {@code "text/plain; charset=utf-16be"} + * (big-endian byte ordering), print data representation class name = + * {@code "[B"} (byte array). */ public static final BYTE_ARRAY TEXT_PLAIN_UTF_16BE = new BYTE_ARRAY ("text/plain; charset=utf-16be"); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=utf-16le"} - * (little-endian byte ordering), - * print data representation class name = {@code "[B"} (byte - * array). + * Doc flavor with MIME type = {@code "text/plain; charset=utf-16le"} + * (little-endian byte ordering), print data representation class name = + * {@code "[B"} (byte array). */ public static final BYTE_ARRAY TEXT_PLAIN_UTF_16LE = new BYTE_ARRAY ("text/plain; charset=utf-16le"); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=us-ascii"}, - * print data representation class name = - * {@code "[B"} (byte array). + * Doc flavor with MIME type = {@code "text/plain; charset=us-ascii"}, + * print data representation class name = {@code "[B"} (byte array). */ public static final BYTE_ARRAY TEXT_PLAIN_US_ASCII = new BYTE_ARRAY ("text/plain; charset=us-ascii"); /** - * Doc flavor with MIME type = {@code "text/html"}, - * encoded in the host platform encoding. - * See {@link DocFlavor#hostEncoding hostEncoding} - * Print data representation class name = - * {@code "[B"} (byte array). + * Doc flavor with MIME type = {@code "text/html"}, encoded in the host + * platform encoding. See {@link DocFlavor#hostEncoding hostEncoding}. + * Print data representation class name = {@code "[B"} (byte array). */ public static final BYTE_ARRAY TEXT_HTML_HOST = new BYTE_ARRAY ("text/html; charset="+hostEncoding); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=utf-8"}, - * print data representation class name = {@code "[B"} (byte - * array). + * Doc flavor with MIME type = {@code "text/html; charset=utf-8"}, print + * data representation class name = {@code "[B"} (byte array). */ public static final BYTE_ARRAY TEXT_HTML_UTF_8 = new BYTE_ARRAY ("text/html; charset=utf-8"); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=utf-16"}, - * print data representation class name = {@code "[B"} (byte - * array). + * Doc flavor with MIME type = {@code "text/html; charset=utf-16"}, + * print data representation class name = {@code "[B"} (byte array). */ public static final BYTE_ARRAY TEXT_HTML_UTF_16 = new BYTE_ARRAY ("text/html; charset=utf-16"); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=utf-16be"} - * (big-endian byte ordering), - * print data representation class name = {@code "[B"} (byte - * array). + * Doc flavor with MIME type = {@code "text/html; charset=utf-16be"} + * (big-endian byte ordering), print data representation class name = + * {@code "[B"} (byte array). */ public static final BYTE_ARRAY TEXT_HTML_UTF_16BE = new BYTE_ARRAY ("text/html; charset=utf-16be"); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=utf-16le"} - * (little-endian byte ordering), - * print data representation class name = {@code "[B"} (byte - * array). + * Doc flavor with MIME type = {@code "text/html; charset=utf-16le"} + * (little-endian byte ordering), print data representation class name = + * {@code "[B"} (byte array). */ public static final BYTE_ARRAY TEXT_HTML_UTF_16LE = new BYTE_ARRAY ("text/html; charset=utf-16le"); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=us-ascii"}, - * print data representation class name = - * {@code "[B"} (byte array). + * Doc flavor with MIME type = {@code "text/html; charset=us-ascii"}, + * print data representation class name = {@code "[B"} (byte array). */ public static final BYTE_ARRAY TEXT_HTML_US_ASCII = new BYTE_ARRAY ("text/html; charset=us-ascii"); /** - * Doc flavor with MIME type = {@code "application/pdf"}, print - * data representation class name = {@code "[B"} (byte array). + * Doc flavor with MIME type = {@code "application/pdf"}, print data + * representation class name = {@code "[B"} (byte array). */ public static final BYTE_ARRAY PDF = new BYTE_ARRAY ("application/pdf"); /** - * Doc flavor with MIME type = {@code "application/postscript"}, - * print data representation class name = {@code "[B"} (byte - * array). + * Doc flavor with MIME type = {@code "application/postscript"}, print + * data representation class name = {@code "[B"} (byte array). */ public static final BYTE_ARRAY POSTSCRIPT = new BYTE_ARRAY ("application/postscript"); /** - * Doc flavor with MIME type = {@code "application/vnd.hp-PCL"}, - * print data representation class name = {@code "[B"} (byte - * array). + * Doc flavor with MIME type = {@code "application/vnd.hp-PCL"}, print + * data representation class name = {@code "[B"} (byte array). */ public static final BYTE_ARRAY PCL = new BYTE_ARRAY ("application/vnd.hp-PCL"); @@ -843,376 +747,337 @@ public static final BYTE_ARRAY PNG = new BYTE_ARRAY ("image/png"); /** - * Doc flavor with MIME type = - * {@code "application/octet-stream"}, - * print data representation class name = {@code "[B"} (byte - * array). The client must determine that data described - * using this DocFlavor is valid for the printer. + * Doc flavor with MIME type = {@code "application/octet-stream"}, print + * data representation class name = {@code "[B"} (byte array). The + * client must determine that data described using this + * {@code DocFlavor} is valid for the printer. */ public static final BYTE_ARRAY AUTOSENSE = new BYTE_ARRAY ("application/octet-stream"); - } /** - * Class DocFlavor.INPUT_STREAM provides predefined static constant - * DocFlavor objects for example doc flavors using a byte stream ({@link - * java.io.InputStream java.io.InputStream}) as the print - * data representation class. + * Class {@code DocFlavor.INPUT_STREAM} provides predefined static constant + * {@code DocFlavor} objects for example doc flavors using a byte stream + * ({@link java.io.InputStream java.io.InputStream}) as the print data + * representation class. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public static class INPUT_STREAM extends DocFlavor { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -7045842700749194127L; /** - * Constructs a new doc flavor with the given MIME type and a print - * data representation class name of - * {@code "java.io.InputStream"} (byte stream). - * - * @param mimeType MIME media type string. + * Constructs a new doc flavor with the given MIME type and a print data + * representation class name of {@code "java.io.InputStream"} (byte + * stream). * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code mimeType} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code mimeType} does not - * obey the syntax for a MIME media type string. + * @param mimeType MIME media type string + * @throws NullPointerException if {@code mimeType} is {@code null} + * @throws IllegalArgumentException if {@code mimeType} does not obey + * the syntax for a MIME media type string. */ public INPUT_STREAM (String mimeType) { super (mimeType, "java.io.InputStream"); } /** - * Doc flavor with MIME type = {@code "text/plain"}, - * encoded in the host platform encoding. - * See {@link DocFlavor#hostEncoding hostEncoding} - * Print data representation class name = - * {@code "java.io.InputStream"} (byte stream). + * Doc flavor with MIME type = {@code "text/plain"}, encoded in the host + * platform encoding. See {@link DocFlavor#hostEncoding hostEncoding}. + * Print data representation class name = {@code "java.io.InputStream"} + * (byte stream). */ public static final INPUT_STREAM TEXT_PLAIN_HOST = new INPUT_STREAM ("text/plain; charset="+hostEncoding); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=utf-8"}, - * print data representation class name = - * {@code "java.io.InputStream"} (byte stream). + * Doc flavor with MIME type = {@code "text/plain; charset=utf-8"}, + * print data representation class name = {@code "java.io.InputStream"} + * (byte stream). */ public static final INPUT_STREAM TEXT_PLAIN_UTF_8 = new INPUT_STREAM ("text/plain; charset=utf-8"); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=utf-16"}, - * print data representation class name = - * {@code "java.io.InputStream"} (byte stream). + * Doc flavor with MIME type = {@code "text/plain; charset=utf-16"}, + * print data representation class name = {@code "java.io.InputStream"} + * (byte stream). */ public static final INPUT_STREAM TEXT_PLAIN_UTF_16 = new INPUT_STREAM ("text/plain; charset=utf-16"); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=utf-16be"} - * (big-endian byte ordering), - * print data representation class name = + * Doc flavor with MIME type = {@code "text/plain; charset=utf-16be"} + * (big-endian byte ordering), print data representation class name = * {@code "java.io.InputStream"} (byte stream). */ public static final INPUT_STREAM TEXT_PLAIN_UTF_16BE = new INPUT_STREAM ("text/plain; charset=utf-16be"); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=utf-16le"} - * (little-endian byte ordering), - * print data representation class name = + * Doc flavor with MIME type = {@code "text/plain; charset=utf-16le"} + * (little-endian byte ordering), print data representation class name = * {@code "java.io.InputStream"} (byte stream). */ public static final INPUT_STREAM TEXT_PLAIN_UTF_16LE = new INPUT_STREAM ("text/plain; charset=utf-16le"); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=us-ascii"}, - * print data representation class name = - * {@code "java.io.InputStream"} (byte stream). + * Doc flavor with MIME type = {@code "text/plain; charset=us-ascii"}, + * print data representation class name = {@code "java.io.InputStream"} + * (byte stream). */ public static final INPUT_STREAM TEXT_PLAIN_US_ASCII = new INPUT_STREAM ("text/plain; charset=us-ascii"); /** - * Doc flavor with MIME type = {@code "text/html"}, - * encoded in the host platform encoding. - * See {@link DocFlavor#hostEncoding hostEncoding} - * Print data representation class name = - * {@code "java.io.InputStream"} (byte stream). + * Doc flavor with MIME type = {@code "text/html"}, encoded in the host + * platform encoding. See {@link DocFlavor#hostEncoding hostEncoding}. + * Print data representation class name = {@code "java.io.InputStream"} + * (byte stream). */ public static final INPUT_STREAM TEXT_HTML_HOST = new INPUT_STREAM ("text/html; charset="+hostEncoding); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=utf-8"}, - * print data representation class name = - * {@code "java.io.InputStream"} (byte stream). + * Doc flavor with MIME type = {@code "text/html; charset=utf-8"}, print + * data representation class name = {@code "java.io.InputStream"} (byte + * stream). */ public static final INPUT_STREAM TEXT_HTML_UTF_8 = new INPUT_STREAM ("text/html; charset=utf-8"); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=utf-16"}, - * print data representation class name = - * {@code "java.io.InputStream"} (byte stream). + * Doc flavor with MIME type = {@code "text/html; charset=utf-16"}, + * print data representation class name = {@code "java.io.InputStream"} + * (byte stream). */ public static final INPUT_STREAM TEXT_HTML_UTF_16 = new INPUT_STREAM ("text/html; charset=utf-16"); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=utf-16be"} - * (big-endian byte ordering), - * print data representation class name = + * Doc flavor with MIME type = {@code "text/html; charset=utf-16be"} + * (big-endian byte ordering), print data representation class name = * {@code "java.io.InputStream"} (byte stream). */ public static final INPUT_STREAM TEXT_HTML_UTF_16BE = new INPUT_STREAM ("text/html; charset=utf-16be"); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=utf-16le"} - * (little-endian byte ordering), - * print data representation class name = + * Doc flavor with MIME type = {@code "text/html; charset=utf-16le"} + * (little-endian byte ordering), print data representation class name = * {@code "java.io.InputStream"} (byte stream). */ public static final INPUT_STREAM TEXT_HTML_UTF_16LE = new INPUT_STREAM ("text/html; charset=utf-16le"); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=us-ascii"}, - * print data representation class name = - * {@code "java.io.InputStream"} (byte stream). + * Doc flavor with MIME type = {@code "text/html; charset=us-ascii"}, + * print data representation class name = {@code "java.io.InputStream"} + * (byte stream). */ public static final INPUT_STREAM TEXT_HTML_US_ASCII = new INPUT_STREAM ("text/html; charset=us-ascii"); - /** - * Doc flavor with MIME type = {@code "application/pdf"}, print - * data representation class name = {@code "java.io.InputStream"} - * (byte stream). + * Doc flavor with MIME type = {@code "application/pdf"}, print data + * representation class name = {@code "java.io.InputStream"} (byte + * stream). */ public static final INPUT_STREAM PDF = new INPUT_STREAM ("application/pdf"); /** - * Doc flavor with MIME type = {@code "application/postscript"}, - * print data representation class name = - * {@code "java.io.InputStream"} (byte stream). + * Doc flavor with MIME type = {@code "application/postscript"}, print + * data representation class name = {@code "java.io.InputStream"} (byte + * stream). */ public static final INPUT_STREAM POSTSCRIPT = new INPUT_STREAM ("application/postscript"); /** - * Doc flavor with MIME type = {@code "application/vnd.hp-PCL"}, - * print data representation class name = - * {@code "java.io.InputStream"} (byte stream). + * Doc flavor with MIME type = {@code "application/vnd.hp-PCL"}, print + * data representation class name = {@code "java.io.InputStream"} (byte + * stream). */ public static final INPUT_STREAM PCL = new INPUT_STREAM ("application/vnd.hp-PCL"); /** * Doc flavor with MIME type = {@code "image/gif"}, print data - * representation class name = - * {@code "java.io.InputStream"} (byte stream). + * representation class name = {@code "java.io.InputStream"} (byte + * stream). */ public static final INPUT_STREAM GIF = new INPUT_STREAM ("image/gif"); /** * Doc flavor with MIME type = {@code "image/jpeg"}, print data - * representation class name = - * {@code "java.io.InputStream"} (byte stream). + * representation class name = {@code "java.io.InputStream"} (byte + * stream). */ public static final INPUT_STREAM JPEG = new INPUT_STREAM ("image/jpeg"); /** * Doc flavor with MIME type = {@code "image/png"}, print data - * representation class name = - * {@code "java.io.InputStream"} (byte stream). + * representation class name = {@code "java.io.InputStream"} (byte + * stream). */ public static final INPUT_STREAM PNG = new INPUT_STREAM ("image/png"); /** - * Doc flavor with MIME type = - * {@code "application/octet-stream"}, - * print data representation class name = - * {@code "java.io.InputStream"} (byte stream). - * The client must determine that data described - * using this DocFlavor is valid for the printer. + * Doc flavor with MIME type = {@code "application/octet-stream"}, print + * data representation class name = {@code "java.io.InputStream"} (byte + * stream). The client must determine that data described using this + * {@code DocFlavor} is valid for the printer. */ public static final INPUT_STREAM AUTOSENSE = new INPUT_STREAM ("application/octet-stream"); - } /** - * Class DocFlavor.URL provides predefined static constant DocFlavor - * objects. - * For example doc flavors using a Uniform Resource Locator ({@link - * java.net.URL java.net.URL}) as the print data + * Class {@code DocFlavor.URL} provides predefined static constant + * {@code DocFlavor} objects. For example doc flavors using a Uniform + * Resource Locator ({@link java.net.URL java.net.URL}) as the print data * representation class. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public static class URL extends DocFlavor { + + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 2936725788144902062L; /** - * Constructs a new doc flavor with the given MIME type and a print - * data representation class name of {@code "java.net.URL"}. - * - * @param mimeType MIME media type string. + * Constructs a new doc flavor with the given MIME type and a print data + * representation class name of {@code "java.net.URL"}. * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code mimeType} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code mimeType} does not - * obey the syntax for a MIME media type string. + * @param mimeType MIME media type string + * @throws NullPointerException if {@code mimeType} is {@code null} + * @throws IllegalArgumentException if {@code mimeType} does not obey + * the syntax for a MIME media type string */ public URL (String mimeType) { super (mimeType, "java.net.URL"); } /** - * Doc flavor with MIME type = {@code "text/plain"}, - * encoded in the host platform encoding. - * See {@link DocFlavor#hostEncoding hostEncoding} - * Print data representation class name = - * {@code "java.net.URL"} (byte stream). + * Doc flavor with MIME type = {@code "text/plain"}, encoded in the host + * platform encoding. See {@link DocFlavor#hostEncoding hostEncoding}. + * Print data representation class name = {@code "java.net.URL"} (byte + * stream). */ public static final URL TEXT_PLAIN_HOST = new URL ("text/plain; charset="+hostEncoding); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=utf-8"}, - * print data representation class name = - * {@code "java.net.URL"} (byte stream). + * Doc flavor with MIME type = {@code "text/plain; charset=utf-8"}, + * print data representation class name = {@code "java.net.URL"} (byte + * stream). */ public static final URL TEXT_PLAIN_UTF_8 = new URL ("text/plain; charset=utf-8"); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=utf-16"}, - * print data representation class name = - * {@code java.net.URL""} (byte stream). + * Doc flavor with MIME type = {@code "text/plain; charset=utf-16"}, + * print data representation class name = {@code java.net.URL""} (byte + * stream). */ public static final URL TEXT_PLAIN_UTF_16 = new URL ("text/plain; charset=utf-16"); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=utf-16be"} - * (big-endian byte ordering), - * print data representation class name = + * Doc flavor with MIME type = {@code "text/plain; charset=utf-16be"} + * (big-endian byte ordering), print data representation class name = * {@code "java.net.URL"} (byte stream). */ public static final URL TEXT_PLAIN_UTF_16BE = new URL ("text/plain; charset=utf-16be"); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=utf-16le"} - * (little-endian byte ordering), - * print data representation class name = + * Doc flavor with MIME type = {@code "text/plain; charset=utf-16le"} + * (little-endian byte ordering), print data representation class name = * {@code "java.net.URL"} (byte stream). */ public static final URL TEXT_PLAIN_UTF_16LE = new URL ("text/plain; charset=utf-16le"); /** - * Doc flavor with MIME type = - * {@code "text/plain; charset=us-ascii"}, - * print data representation class name = - * {@code "java.net.URL"} (byte stream). + * Doc flavor with MIME type = {@code "text/plain; charset=us-ascii"}, + * print data representation class name = {@code "java.net.URL"} (byte + * stream). */ public static final URL TEXT_PLAIN_US_ASCII = new URL ("text/plain; charset=us-ascii"); /** - * Doc flavor with MIME type = {@code "text/html"}, - * encoded in the host platform encoding. - * See {@link DocFlavor#hostEncoding hostEncoding} - * Print data representation class name = - * {@code "java.net.URL"} (byte stream). + * Doc flavor with MIME type = {@code "text/html"}, encoded in the host + * platform encoding. See {@link DocFlavor#hostEncoding hostEncoding}. + * Print data representation class name = {@code "java.net.URL"} (byte + * stream). */ public static final URL TEXT_HTML_HOST = new URL ("text/html; charset="+hostEncoding); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=utf-8"}, - * print data representation class name = - * {@code "java.net.URL"} (byte stream). + * Doc flavor with MIME type = {@code "text/html; charset=utf-8"}, print + * data representation class name = {@code "java.net.URL"} (byte + * stream). */ public static final URL TEXT_HTML_UTF_8 = new URL ("text/html; charset=utf-8"); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=utf-16"}, - * print data representation class name = - * {@code "java.net.URL"} (byte stream). + * Doc flavor with MIME type = {@code "text/html; charset=utf-16"}, + * print data representation class name = {@code "java.net.URL"} (byte + * stream). */ public static final URL TEXT_HTML_UTF_16 = new URL ("text/html; charset=utf-16"); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=utf-16be"} - * (big-endian byte ordering), - * print data representation class name = + * Doc flavor with MIME type = {@code "text/html; charset=utf-16be"} + * (big-endian byte ordering), print data representation class name = * {@code "java.net.URL"} (byte stream). */ public static final URL TEXT_HTML_UTF_16BE = new URL ("text/html; charset=utf-16be"); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=utf-16le"} - * (little-endian byte ordering), - * print data representation class name = + * Doc flavor with MIME type = {@code "text/html; charset=utf-16le"} + * (little-endian byte ordering), print data representation class name = * {@code "java.net.URL"} (byte stream). */ public static final URL TEXT_HTML_UTF_16LE = new URL ("text/html; charset=utf-16le"); /** - * Doc flavor with MIME type = - * {@code "text/html; charset=us-ascii"}, - * print data representation class name = - * {@code "java.net.URL"} (byte stream). + * Doc flavor with MIME type = {@code "text/html; charset=us-ascii"}, + * print data representation class name = {@code "java.net.URL"} (byte + * stream). */ public static final URL TEXT_HTML_US_ASCII = new URL ("text/html; charset=us-ascii"); - /** - * Doc flavor with MIME type = {@code "application/pdf"}, print - * data representation class name = {@code "java.net.URL"}. + * Doc flavor with MIME type = {@code "application/pdf"}, print data + * representation class name = {@code "java.net.URL"}. */ public static final URL PDF = new URL ("application/pdf"); /** - * Doc flavor with MIME type = {@code "application/postscript"}, - * print data representation class name = {@code "java.net.URL"}. + * Doc flavor with MIME type = {@code "application/postscript"}, print + * data representation class name = {@code "java.net.URL"}. */ public static final URL POSTSCRIPT = new URL ("application/postscript"); /** - * Doc flavor with MIME type = {@code "application/vnd.hp-PCL"}, - * print data representation class name = {@code "java.net.URL"}. + * Doc flavor with MIME type = {@code "application/vnd.hp-PCL"}, print + * data representation class name = {@code "java.net.URL"}. */ public static final URL PCL = new URL ("application/vnd.hp-PCL"); @@ -1235,42 +1100,39 @@ public static final URL PNG = new URL ("image/png"); /** - * Doc flavor with MIME type = - * {@code "application/octet-stream"}, - * print data representation class name = {@code "java.net.URL"}. - * The client must determine that data described - * using this DocFlavor is valid for the printer. + * Doc flavor with MIME type = {@code "application/octet-stream"}, print + * data representation class name = {@code "java.net.URL"}. The client + * must determine that data described using this {@code DocFlavor} is + * valid for the printer. */ public static final URL AUTOSENSE = new URL ("application/octet-stream"); - } /** - * Class DocFlavor.CHAR_ARRAY provides predefined static constant - * DocFlavor objects for example doc flavors using a character array - * ({@code char[]}) as the print data representation class. As such, - * the character set is Unicode. + * Class {@code DocFlavor.CHAR_ARRAY} provides predefined static constant + * {@code DocFlavor} objects for example doc flavors using a character array + * ({@code char[]}) as the print data representation class. As such, the + * character set is Unicode. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public static class CHAR_ARRAY extends DocFlavor { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -8720590903724405128L; /** - * Constructs a new doc flavor with the given MIME type and a print - * data representation class name of - * {@code "[C"} (character array). + * Constructs a new doc flavor with the given MIME type and a print data + * representation class name of {@code "[C"} (character array). * - * @param mimeType MIME media type string. If it is a text media - * type, it is assumed to contain a - * {@code "charset=utf-16"} parameter. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code mimeType} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code mimeType} does not - * obey the syntax for a MIME media type string. + * @param mimeType MIME media type string. If it is a text media type, + * it is assumed to contain a {@code "charset=utf-16"} + * parameter. + * @throws NullPointerException if {@code mimeType} is {@code null} + * @throws IllegalArgumentException if {@code mimeType} does not obey + * the syntax for a MIME media type string */ public CHAR_ARRAY (String mimeType) { super (mimeType, "[C"); @@ -1278,47 +1140,46 @@ /** * Doc flavor with MIME type = {@code "text/plain; charset=utf-16"}, - * print data representation class name = - * {@code "[C"} (character array). + * print data representation class name = {@code "[C"} (character + * array). */ public static final CHAR_ARRAY TEXT_PLAIN = new CHAR_ARRAY ("text/plain; charset=utf-16"); /** * Doc flavor with MIME type = {@code "text/html; charset=utf-16"}, - * print data representation class name = - * {@code "[C"} (character array). + * print data representation class name = {@code "[C"} (character + * array). */ public static final CHAR_ARRAY TEXT_HTML = new CHAR_ARRAY ("text/html; charset=utf-16"); - } /** - * Class DocFlavor.STRING provides predefined static constant DocFlavor - * objects for example doc flavors using a string ({@link java.lang.String - * java.lang.String}) as the print data representation class. + * Class {@code DocFlavor.STRING} provides predefined static constant + * {@code DocFlavor} objects for example doc flavors using a string + * ({@link String java.lang.String}) as the print data representation class. * As such, the character set is Unicode. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public static class STRING extends DocFlavor { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 4414407504887034035L; /** - * Constructs a new doc flavor with the given MIME type and a print - * data representation class name of {@code "java.lang.String"}. + * Constructs a new doc flavor with the given MIME type and a print data + * representation class name of {@code "java.lang.String"}. * - * @param mimeType MIME media type string. If it is a text media - * type, it is assumed to contain a - * {@code "charset=utf-16"} parameter. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code mimeType} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code mimeType} does not - * obey the syntax for a MIME media type string. + * @param mimeType MIME media type string. If it is a text media type, + * it is assumed to contain a {@code "charset=utf-16"} + * parameter. + * @throws NullPointerException if {@code mimeType} is {@code null} + * @throws IllegalArgumentException if {@code mimeType} does not obey + * the syntax for a MIME media type string */ public STRING (String mimeType) { super (mimeType, "java.lang.String"); @@ -1326,47 +1187,45 @@ /** * Doc flavor with MIME type = {@code "text/plain; charset=utf-16"}, - * print data representation class name = - * {@code "java.lang.String"}. + * print data representation class name = {@code "java.lang.String"}. */ public static final STRING TEXT_PLAIN = new STRING ("text/plain; charset=utf-16"); /** * Doc flavor with MIME type = {@code "text/html; charset=utf-16"}, - * print data representation class name = - * {@code "java.lang.String"}. + * print data representation class name = {@code "java.lang.String"}. */ public static final STRING TEXT_HTML = new STRING ("text/html; charset=utf-16"); } /** - * Class DocFlavor.READER provides predefined static constant DocFlavor - * objects for example doc flavors using a character stream ({@link - * java.io.Reader java.io.Reader}) as the print data + * Class {@code DocFlavor.READER} provides predefined static constant + * {@code DocFlavor} objects for example doc flavors using a character + * stream ({@link java.io.Reader java.io.Reader}) as the print data * representation class. As such, the character set is Unicode. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public static class READER extends DocFlavor { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 7100295812579351567L; /** - * Constructs a new doc flavor with the given MIME type and a print - * data representation class name of\ - * {@code "java.io.Reader"} (character stream). + * Constructs a new doc flavor with the given MIME type and a print data + * representation class name of {@code "java.io.Reader"} (character + * stream). * - * @param mimeType MIME media type string. If it is a text media - * type, it is assumed to contain a - * {@code "charset=utf-16"} parameter. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code mimeType} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code mimeType} does not - * obey the syntax for a MIME media type string. + * @param mimeType MIME media type string. If it is a text media type, + * it is assumed to contain a {@code "charset=utf-16"} + * parameter. + * @throws NullPointerException if {@code mimeType} is {@code null} + * @throws IllegalArgumentException if {@code mimeType} does not obey + * the syntax for a MIME media type string */ public READER (String mimeType) { super (mimeType, "java.io.Reader"); @@ -1374,16 +1233,16 @@ /** * Doc flavor with MIME type = {@code "text/plain; charset=utf-16"}, - * print data representation class name = - * {@code "java.io.Reader"} (character stream). + * print data representation class name = {@code "java.io.Reader"} + * (character stream). */ public static final READER TEXT_PLAIN = new READER ("text/plain; charset=utf-16"); /** * Doc flavor with MIME type = {@code "text/html; charset=utf-16"}, - * print data representation class name = - * {@code "java.io.Reader"} (character stream). + * print data representation class name = {@code "java.io.Reader"} + * (character stream). */ public static final READER TEXT_HTML = new READER ("text/html; charset=utf-16"); @@ -1391,27 +1250,27 @@ } /** - * Class DocFlavor.SERVICE_FORMATTED provides predefined static constant - * DocFlavor objects for example doc flavors for service formatted print - * data. + * Class {@code DocFlavor.SERVICE_FORMATTED} provides predefined static + * constant {@code DocFlavor} objects for example doc flavors for service + * formatted print data. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public static class SERVICE_FORMATTED extends DocFlavor { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 6181337766266637256L; /** * Constructs a new doc flavor with a MIME type of - * {@code "application/x-java-jvm-local-objectref"} indicating - * service formatted print data and the given print data - * representation class name. + * {@code "application/x-java-jvm-local-objectref"} indicating service + * formatted print data and the given print data representation class + * name. * - * @param className Fully-qualified representation class name. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code className} is - * null. + * @param className fully-qualified representation class name + * @throws NullPointerException if {@code className} is {@code null} */ public SERVICE_FORMATTED (String className) { super ("application/x-java-jvm-local-objectref", className); @@ -1420,8 +1279,8 @@ /** * Service formatted print data doc flavor with print data * representation class name = - * {@code "java.awt.image.renderable.RenderableImage"} - * (renderable image object). + * {@code "java.awt.image.renderable.RenderableImage"} (renderable image + * object). */ public static final SERVICE_FORMATTED RENDERABLE_IMAGE = new SERVICE_FORMATTED("java.awt.image.renderable.RenderableImage"); @@ -1443,5 +1302,4 @@ new SERVICE_FORMATTED ("java.awt.print.Pageable"); } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/DocPrintJob.java --- a/jdk/src/java.desktop/share/classes/javax/print/DocPrintJob.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/DocPrintJob.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -29,146 +29,132 @@ import javax.print.attribute.PrintRequestAttributeSet; import javax.print.event.PrintJobAttributeListener; import javax.print.event.PrintJobListener; -import javax.print.PrintException; /** - * - * This interface represents a print job that can print a specified - * document with a set of job attributes. An object implementing - * this interface is obtained from a print service. - * + * This interface represents a print job that can print a specified document + * with a set of job attributes. An object implementing this interface is + * obtained from a print service. */ - public interface DocPrintJob { /** - * Determines the {@link PrintService} object to which this print job - * object is bound. + * Determines the {@link PrintService} object to which this print job object + * is bound. * - * @return {@code PrintService} object. - * + * @return {@code PrintService} object */ public PrintService getPrintService(); /** - * Obtains this Print Job's set of printing attributes. - * The returned attribute set object is unmodifiable. - * The returned attribute set object is a "snapshot" of this Print Job's - * attribute set at the time of the {@link #getAttributes()} method - * call; that is, the returned attribute set's object's contents will - * not be updated if this Print Job's attribute set's contents change - * in the future. To detect changes in attribute values, call - * {@code getAttributes()} again and compare the new attribute - * set to the previous attribute set; alternatively, register a - * listener for print job events. - * The returned value may be an empty set but should not be null. + * Obtains this Print Job's set of printing attributes. The returned + * attribute set object is unmodifiable. The returned attribute set object + * is a "snapshot" of this Print Job's attribute set at the time of the + * {@code getAttributes()} method call; that is, the returned attribute + * set's object's contents will not be updated if this Print Job's attribute + * set's contents change in the future. To detect changes in attribute + * values, call {@code getAttributes()} again and compare the new attribute + * set to the previous attribute set; alternatively, register a listener for + * print job events. The returned value may be an empty set but should not + * be {@code null}. + * * @return the print job attributes */ public PrintJobAttributeSet getAttributes(); /** - * Registers a listener for event occurring during this print job. - * If listener is null, no exception is thrown and no action is - * performed. - * If listener is already registered, it will be registered again. + * Registers a listener for event occurring during this print job. If + * listener is {@code null}, no exception is thrown and no action is + * performed. If listener is already registered, it will be registered + * again. + * + * @param listener the object implementing the listener interface * @see #removePrintJobListener - * - * @param listener The object implementing the listener interface - * */ public void addPrintJobListener(PrintJobListener listener); /** - * Removes a listener from this print job. - * This method performs no function, nor does it throw an exception, - * if the listener specified by the argument was not previously added - * to this component. If listener is null, no exception is thrown and - * no action is performed. If a listener was registered more than once - * only one of the registrations will be removed. + * Removes a listener from this print job. This method performs no function, + * nor does it throw an exception, if the listener specified by the argument + * was not previously added to this print job. If listener is {@code null}, + * no exception is thrown and no action is performed. If a listener was + * registered more than once only one of the registrations will be removed. + * + * @param listener the object implementing the listener interface * @see #addPrintJobListener - * - * @param listener The object implementing the listener interface */ public void removePrintJobListener(PrintJobListener listener); /** - * Registers a listener for changes in the specified attributes. - * If listener is null, no exception is thrown and no action is - * performed. - * To determine the attribute updates that may be reported by this job, - * a client can call {@code getAttributes()} and identify the - * subset that are interesting and likely to be reported to the - * listener. Clients expecting to be updated about changes in a - * specific job attribute should verify it is in that set, but - * updates about an attribute will be made only if it changes and this - * is detected by the job. Also updates may be subject to batching - * by the job. To minimize overhead in print job processing it is - * recommended to listen on only that subset of attributes which - * are likely to change. - * If the specified set is empty no attribute updates will be reported - * to the listener. - * If the attribute set is null, then this means to listen on all - * dynamic attributes that the job supports. This may result in no - * update notifications if a job can not report any attribute updates. + * Registers a listener for changes in the specified attributes. If listener + * is {@code null}, no exception is thrown and no action is performed. To + * determine the attribute updates that may be reported by this job, a + * client can call {@code getAttributes()} and identify the subset that are + * interesting and likely to be reported to the listener. Clients expecting + * to be updated about changes in a specific job attribute should verify it + * is in that set, but updates about an attribute will be made only if it + * changes and this is detected by the job. Also updates may be subject to + * batching by the job. To minimize overhead in print job processing it is + * recommended to listen on only that subset of attributes which are likely + * to change. If the specified set is empty no attribute updates will be + * reported to the listener. If the attribute set is {@code null}, then this + * means to listen on all dynamic attributes that the job supports. This may + * result in no update notifications if a job can not report any attribute + * updates. + *

    + * If listener is already registered, it will be registered again. * - * If listener is already registered, it will be registered again. + * @param listener the object implementing the listener interface + * @param attributes the attributes to listen on, or {@code null} to mean + * all attributes that can change, as determined by the job * @see #removePrintJobAttributeListener - * - * @param listener The object implementing the listener interface - * @param attributes The attributes to listen on, or null to mean - * all attributes that can change, as determined by the job. */ public void addPrintJobAttributeListener( PrintJobAttributeListener listener, PrintJobAttributeSet attributes); /** - * Removes an attribute listener from this print job. - * This method performs no function, nor does it throw an exception, - * if the listener specified by the argument was not previously added - * to this component. If the listener is null, no exception is thrown - * and no action is performed. - * If a listener is registered more than once, even for a different - * set of attributes, no guarantee is made which listener is removed. + * Removes an attribute listener from this print job. This method performs + * no function, nor does it throw an exception, if the listener specified by + * the argument was not previously added to this print job. If the listener + * is {@code null}, no exception is thrown and no action is performed. If a + * listener is registered more than once, even for a different set of + * attributes, no guarantee is made which listener is removed. + * + * @param listener the object implementing the listener interface * @see #addPrintJobAttributeListener - * - * @param listener The object implementing the listener interface - * */ public void removePrintJobAttributeListener( PrintJobAttributeListener listener); /** - * Prints a document with the specified job attributes. - * This method should only be called once for a given print job. - * Calling it again will not result in a new job being spooled to - * the printer. The service implementation will define policy - * for service interruption and recovery. + * Prints a document with the specified job attributes. This method should + * only be called once for a given print job. Calling it again will not + * result in a new job being spooled to the printer. The service + * implementation will define policy for service interruption and recovery. * When the print method returns, printing may not yet have completed as * printing may happen asynchronously, perhaps in a different thread. - * Application clients which want to monitor the success or failure - * should register a PrintJobListener. + * Application clients which want to monitor the success or failure should + * register a {@code PrintJobListener}. *

    * Print service implementors should close any print data streams (ie - * Reader or InputStream implementations) that they obtain - * from the client doc. Robust clients may still wish to verify this. - * An exception is always generated if a {@code DocFlavor} cannot - * be printed. - * - * @param doc The document to be printed. If must be a flavor - * supported by this PrintJob. + * {@code Reader} or {@code InputStream} implementations) that they obtain + * from the client doc. Robust clients may still wish to verify this. An + * exception is always generated if a {@code DocFlavor} cannot be printed. * - * @param attributes The job attributes to be applied to this print job. - * If this parameter is null then the default attributes are used. - * @throws PrintException The exception additionally may implement - * an interface that more precisely describes the cause of the - * exception - *

      - *
    • FlavorException. - * If the document has a flavor not supported by this print job. - *
    • AttributeException. - * If one or more of the attributes are not valid for this print job. - *
    + * @param doc the document to be printed. It must be a flavor supported by + * this PrintJob. + * @param attributes the job attributes to be applied to this print job. If + * this parameter is {@code null} then the default attributes are + * used. + * @throws PrintException the exception additionally may implement an + * interface that more precisely describes the cause of the + * exception + *
      + *
    • {@code FlavorException}. If the document has a flavor not + * supported by this print job. + *
    • {@code AttributeException}. If one or more of the + * attributes are not valid for this print job. + *
    */ public void print(Doc doc, PrintRequestAttributeSet attributes) throws PrintException; diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/FlavorException.java --- a/jdk/src/java.desktop/share/classes/javax/print/FlavorException.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/FlavorException.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -25,23 +25,20 @@ package javax.print; -import javax.print.DocFlavor; - /** - * Interface FlavorException is a mixin interface which a subclass of {@link - * PrintException PrintException} can implement to report an error condition - * involving a doc flavor or flavors (class {@link javax.print.DocFlavor - * DocFlavor}). The Print Service API does not define any print exception - * classes that implement interface FlavorException, that being left to the - * Print Service implementor's discretion. - * + * Interface {@code FlavorException} is a mixin interface which a subclass of + * {@link PrintException PrintException} can implement to report an error + * condition involving a doc flavor or flavors (class {@link DocFlavor}). The + * Print Service API does not define any print exception classes that implement + * interface {@code FlavorException}, that being left to the Print Service + * implementor's discretion. */ public interface FlavorException { /** * Returns the unsupported flavors. - * @return the unsupported doc flavors. + * + * @return the unsupported doc flavors */ public DocFlavor[] getUnsupportedFlavors(); - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/MimeType.java --- a/jdk/src/java.desktop/share/classes/javax/print/MimeType.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/MimeType.java Sat Sep 09 14:36:45 2017 +0200 @@ -26,7 +26,6 @@ package javax.print; import java.io.Serializable; - import java.util.AbstractMap; import java.util.AbstractSet; import java.util.Iterator; @@ -36,63 +35,63 @@ import java.util.Vector; /** - * Class MimeType encapsulates a Multipurpose Internet Mail Extensions (MIME) - * media type as defined in RFC - * 2045 and RFC 2046. A - * MIME type object is part of a {@link DocFlavor DocFlavor} object and - * specifies the format of the print data. - *

    - * Class MimeType is similar to the like-named - * class in package {@link java.awt.datatransfer java.awt.datatransfer}. Class - * java.awt.datatransfer.MimeType is not used in the Jini Print Service API - * for two reasons: - *

      - *
    1. - * Since not all Java profiles include the AWT, the Jini Print Service should - * not depend on an AWT class. - *
    2. - * The implementation of class java.awt.datatransfer.MimeType does not - * guarantee - * that equivalent MIME types will have the same serialized representation. - * Thus, since the Jini Lookup Service (JLUS) matches service attributes based - * on equality of serialized representations, JLUS searches involving MIME - * types encapsulated in class java.awt.datatransfer.MimeType may incorrectly - * fail to match. - *
    - *

    + * Class {@code MimeType} encapsulates a Multipurpose Internet Mail Extensions + * (MIME) media type as defined in + * RFC 2045 and + * RFC 2046. A MIME type + * object is part of a {@link DocFlavor DocFlavor} object and specifies the + * format of the print data. + *

    + * Class {@code MimeType} is similar to the like-named class in package + * {@link java.awt.datatransfer java.awt.datatransfer}. Class + * {@link java.awt.datatransfer.MimeType} is not used in the Jini Print Service + * API for two reasons: + *

      + *
    1. Since not all Java profiles include the AWT, the Jini Print Service + * should not depend on an AWT class. + *
    2. The implementation of class {@code java.awt.datatransfer.MimeType} does + * not guarantee that equivalent MIME types will have the same serialized + * representation. Thus, since the Jini Lookup Service (JLUS) matches service + * attributes based on equality of serialized representations, JLUS searches + * involving MIME types encapsulated in class + * {@code java.awt.datatransfer.MimeType} may incorrectly fail to match. + *
    * Class MimeType's serialized representation is based on the following * canonical form of a MIME type string. Thus, two MIME types that are not - * identical but that are equivalent (that have the same canonical form) will - * be considered equal by the JLUS's matching algorithm. - *
      - *
    • The media type, media subtype, and parameters are retained, but all - * comments and whitespace characters are discarded. - *
    • The media type, media subtype, and parameter names are converted to - * lowercase. - *
    • The parameter values retain their original case, except a charset - * parameter value for a text media type is converted to lowercase. - *
    • Quote characters surrounding parameter values are removed. - *
    • Quoting backslash characters inside parameter values are removed. - *
    • The parameters are arranged in ascending order of parameter name. - *
    + * identical but that are equivalent (that have the same canonical form) will be + * considered equal by the JLUS's matching algorithm. + *
      + *
    • The media type, media subtype, and parameters are retained, but all + * comments and whitespace characters are discarded. + *
    • The media type, media subtype, and parameter names are converted to + * lowercase. + *
    • The parameter values retain their original case, except a charset + * parameter value for a text media type is converted to lowercase. + *
    • Quote characters surrounding parameter values are removed. + *
    • Quoting backslash characters inside parameter values are removed. + *
    • The parameters are arranged in ascending order of parameter name. + *
    * - * @author Alan Kaminsky + * @author Alan Kaminsky */ class MimeType implements Serializable, Cloneable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -2785720609362367683L; /** - * Array of strings that hold pieces of this MIME type's canonical form. - * If the MIME type has n parameters, n >= 0, then the + * Array of strings that hold pieces of this MIME type's canonical form. If + * the MIME type has n parameters, n >= 0, then the * strings in the array are: - *
    Index 0 -- Media type. - *
    Index 1 -- Media subtype. - *
    Index 2i+2 -- Name of parameter i, - * i=0,1,...,n-1. - *
    Index 2i+3 -- Value of parameter i, - * i=0,1,...,n-1. - *
    Parameters are arranged in ascending order of parameter name. + *
    Index 0 -- Media type. + *
    Index 1 -- Media subtype. + *
    Index 2i+2 -- Name of parameter i, + * i=0,1,...,n-1. + *
    Index 2i+3 -- Value of parameter i, + * i=0,1,...,n-1. + *
    Parameters are arranged in ascending order of parameter name. * @serial */ private String[] myPieces; @@ -116,7 +115,17 @@ * Parameter map entry. */ private class ParameterMapEntry implements Map.Entry { + + /** + * The index of the entry. + */ private int myIndex; + + /** + * Constructs a new parameter map entry. + * + * @param theIndex the index of the entry + */ public ParameterMapEntry(int theIndex) { myIndex = theIndex; } @@ -144,6 +153,10 @@ * Parameter map entry set iterator. */ private class ParameterMapEntrySetIterator implements Iterator> { + + /** + * The current index of the iterator. + */ private int myIndex = 2; public boolean hasNext() { return myIndex < myPieces.length; @@ -187,16 +200,13 @@ } /** - * Construct a new MIME type object from the given string. The given - * string is converted into canonical form and stored internally. - * - * @param s MIME media type string. + * Construct a new MIME type object from the given string. The given string + * is converted into canonical form and stored internally. * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code s} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code s} does not obey the - * syntax for a MIME media type string. + * @param s MIME media type string + * @throws NullPointerException if {@code s} is {@code null} + * @throws IllegalArgumentException if {@code s} does not obey the syntax + * for a MIME media type string */ public MimeType(String s) { parse (s); @@ -205,6 +215,8 @@ /** * Returns this MIME type object's MIME type string based on the canonical * form. Each parameter value is enclosed in quotes. + * + * @return the mime type */ public String getMimeType() { return getStringValue(); @@ -212,6 +224,8 @@ /** * Returns this MIME type object's media type. + * + * @return the media type */ public String getMediaType() { return myPieces[0]; @@ -219,6 +233,8 @@ /** * Returns this MIME type object's media subtype. + * + * @return the media subtype */ public String getMediaSubtype() { return myPieces[1]; @@ -226,11 +242,11 @@ /** * Returns an unmodifiable map view of the parameters in this MIME type - * object. Each entry in the parameter map view consists of a parameter - * name String (key) mapping to a parameter value String. If this MIME - * type object has no parameters, an empty map is returned. + * object. Each entry in the parameter map view consists of a parameter name + * {@code String} (key) mapping to a parameter value {@code String}. If this + * MIME type object has no parameters, an empty map is returned. * - * @return Parameter map for this MIME type object. + * @return parameter map for this MIME type object */ public Map getParameterMap() { if (myParameterMap == null) { @@ -242,8 +258,8 @@ /** * Converts this MIME type object to a string. * - * @return MIME type string based on the canonical form. Each parameter - * value is enclosed in quotes. + * @return MIME type string based on the canonical form. Each parameter + * value is enclosed in quotes. */ public String toString() { return getStringValue(); @@ -258,19 +274,18 @@ /** * Determine if this MIME type object is equal to the given object. The two - * are equal if the given object is not null, is an instance of class - * net.jini.print.data.MimeType, and has the same canonical form as this - * MIME type object (that is, has the same type, subtype, and parameters). - * Thus, if two MIME type objects are the same except for comments, they are - * considered equal. However, "text/plain" and "text/plain; - * charset=us-ascii" are not considered equal, even though they represent - * the same media type (because the default character set for plain text is - * US-ASCII). + * are equal if the given object is not {@code null}, is an instance of + * class {@code javax.print.data.MimeType}, and has the same canonical form + * as this MIME type object (that is, has the same type, subtype, and + * parameters). Thus, if two MIME type objects are the same except for + * comments, they are considered equal. However, "text/plain" and + * "text/plain; charset=us-ascii" are not considered equal, even though they + * represent the same media type (because the default character set for + * plain text is US-ASCII). * - * @param obj Object to test. - * - * @return True if this MIME type object equals {@code obj}, false - * otherwise. + * @param obj {@code object} to test + * @return {@code true} if this MIME type object equals {@code obj}, + * {@code false} otherwise */ public boolean equals (Object obj) { return(obj != null && @@ -280,6 +295,8 @@ /** * Returns this MIME type's string value in canonical form. + * + * @return the MIME type's string value in canonical form */ private String getStringValue() { if (myStringValue == null) { @@ -300,8 +317,8 @@ return myStringValue; } -// Hidden classes, constants, and operations for parsing a MIME media type -// string. + // Hidden classes, constants, and operations for parsing a MIME media type + // string. // Lexeme types. private static final int TOKEN_LEXEME = 0; @@ -310,7 +327,9 @@ private static final int EOF_LEXEME = 3; private static final int ILLEGAL_LEXEME = 4; - // Class for a lexical analyzer. + /** + *Class for a lexical analyzer. + */ private static class LexicalAnalyzer { protected String mySource; protected int mySourceLength; @@ -459,18 +478,19 @@ break; } } - } - } /** - * Returns a lowercase version of the given string. The lowercase version - * is constructed by applying Character.toLowerCase() to each character of - * the given string, which maps characters to lowercase using the rules of - * Unicode. This mapping is the same regardless of locale, whereas the - * mapping of String.toLowerCase() may be different depending on the + * Returns a lowercase version of the given string. The lowercase version is + * constructed by applying {@code Character.toLowerCase()} to each character + * of the given string, which maps characters to lowercase using the rules + * of Unicode. This mapping is the same regardless of locale, whereas the + * mapping of {@code String.toLowerCase()} may be different depending on the * default locale. + * + * @param s the string + * @return the lowercase version of the string */ private static String toUnicodeLowerCase(String s) { int n = s.length(); @@ -483,6 +503,9 @@ /** * Returns a version of the given string with backslashes removed. + * + * @param s the string + * @return the string with backslashes removed */ private static String removeBackslashes(String s) { int n = s.length(); @@ -503,6 +526,10 @@ /** * Returns a version of the string surrounded by quotes and with interior * quotes preceded by a backslash. + * + * @param s the string + * @return the string surrounded by quotes and with interior quotes preceded + * by a backslash */ private static String addQuotes(String s) { int n = s.length(); @@ -524,20 +551,17 @@ /** * Parses the given string into canonical pieces and stores the pieces in * {@link #myPieces myPieces}. - *

    + *

    * Special rules applied: - *

      - *
    • If the media type is text, the value of a charset parameter is - * converted to lowercase. - *
    + *
      + *
    • If the media type is text, the value of a charset parameter is + * converted to lowercase. + *
    * - * @param s MIME media type string. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code s} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code s} does not obey the - * syntax for a MIME media type string. + * @param s MIME media type string + * @throws NullPointerException if {@code s} is {@code null} + * @throws IllegalArgumentException if {@code s} does not obey the syntax + * for a MIME media type string */ private void parse(String s) { // Initialize. diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/MultiDoc.java --- a/jdk/src/java.desktop/share/classes/javax/print/MultiDoc.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/MultiDoc.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -28,54 +28,52 @@ import java.io.IOException; /** - * Interface MultiDoc specifies the interface for an object that supplies more - * than one piece of print data for a Print Job. "Doc" is a short, + * Interface {@code MultiDoc} specifies the interface for an object that + * supplies more than one piece of print data for a Print Job. "Doc" is a short, * easy-to-pronounce term that means "a piece of print data," and a "multidoc" - * is a group of several docs. The client passes to the Print Job an object - * that implements interface MultiDoc, and the Print Job calls methods on - * that object to obtain the print data. - *

    - * Interface MultiDoc provides an abstraction similar to a "linked list" of - * docs. A multidoc object is like a node in the linked list, containing the + * is a group of several docs. The client passes to the Print Job an object that + * implements interface {@code MultiDoc}, and the Print Job calls methods on + * that object to obtain the print data. + *

    + * Interface {@code MultiDoc} provides an abstraction similar to a "linked list" + * of docs. A multidoc object is like a node in the linked list, containing the * current doc in the list and a pointer to the next node (multidoc) in the - * list. The Print Job can call the multidoc's {@link #getDoc() - * getDoc()} method to get the current doc. When it's ready to go - * on to the next doc, the Print Job can call the multidoc's {@link #next() - * next()} method to get the next multidoc, which contains the - * next doc. So Print Job code for accessing a multidoc might look like this: - *

    + * list. The Print Job can call the multidoc's {@link #getDoc() getDoc()} method
    + * to get the current doc. When it's ready to go on to the next doc, the Print
    + * Job can call the multidoc's {@link #next() next()} method to get the next
    + * multidoc, which contains the next doc. So Print Job code for accessing a
    + * multidoc might look like this:
    + *
    + * 
      *      void processMultiDoc(MultiDoc theMultiDoc) {
      *
      *          MultiDoc current = theMultiDoc;
    -
    + *
      *          while (current != null) {
      *              processDoc (current.getDoc());
      *              current = current.next();
      *          }
      *      }
    - * 
    - *

    - * Of course, interface MultiDoc can be implemented in any way that fulfills - * the contract; it doesn't have to use a linked list in the implementation. - *

    - * To get all the print data for a multidoc print job, a Print Service - * proxy could use either of two patterns: - *

      - *
    1. - * The interleaved pattern: Get the doc from the current multidoc. Get - * the print data representation object from the current doc. Get all the print - * data from the print data representation object. Get the next multidoc from - * the current multidoc, and repeat until there are no more. (The code example - * above uses the interleaved pattern.) - * - *
    2. - * The all-at-once pattern: Get the doc from the current multidoc, and - * save the doc in a list. Get the next multidoc from the current multidoc, and - * repeat until there are no more. Then iterate over the list of saved docs. Get - * the print data representation object from the current doc. Get all the print - * data from the print data representation object. Go to the next doc in the - * list, and repeat until there are no more. - *
    + *
    + * Of course, interface {@code MultiDoc} can be implemented in any way that + * fulfills the contract; it doesn't have to use a linked list in the + * implementation. + *

    + * To get all the print data for a multidoc print job, a Print Service proxy + * could use either of two patterns: + *

      + *
    1. The interleaved pattern: Get the doc from the current multidoc. + * Get the print data representation object from the current doc. Get all the + * print data from the print data representation object. Get the next multidoc + * from the current multidoc, and repeat until there are no more. (The code + * example above uses the interleaved pattern.) + *
    2. The all-at-once pattern: Get the doc from the current multidoc, + * and save the doc in a list. Get the next multidoc from the current + * multidoc, and repeat until there are no more. Then iterate over the list of + * saved docs. Get the print data representation object from the current doc. + * Get all the print data from the print data representation object. Go to the + * next doc in the list, and repeat until there are no more. + *
    * Now, consider a printing client that is generating print data on the fly and * does not have the resources to store more than one piece of print data at a * time. If the print service proxy used the all-at-once pattern to get the @@ -83,41 +81,37 @@ * to keep all the docs' print data around until the print service proxy comes * back and asks for them, which the client is not able to do. To work with such * a client, the print service proxy must use the interleaved pattern. - *

    + *

    * To address this problem, and to simplify the design of clients providing -* multiple docs to a Print Job, every Print Service proxy that supports - * multidoc print jobs is required to access a MultiDoc object using the - * interleaved pattern. That is, given a MultiDoc object, the print service - * proxy will call {@link #getDoc() getDoc()} one or more times - * until it successfully obtains the current Doc object. The print service proxy + * multiple docs to a Print Job, every Print Service proxy that supports + * multidoc print jobs is required to access a {@code MultiDoc} object using the + * interleaved pattern. That is, given a {@code MultiDoc} object, the print + * service proxy will call {@link #getDoc() getDoc()} one or more times until it + * successfully obtains the current {@code Doc} object. The print service proxy * will then obtain the current doc's print data, not proceeding until all the * print data is obtained or an unrecoverable error occurs. If it is able to - * continue, the print service proxy will then call {@link #next() - * next()} one or more times until it successfully obtains either - * the next MultiDoc object or an indication that there are no more. An - * implementation of interface MultiDoc can assume the print service proxy will - * follow this interleaved pattern; for any other pattern of usage, the MultiDoc - * implementation's behavior is unspecified. - *

    + * continue, the print service proxy will then call {@link #next() next()} one + * or more times until it successfully obtains either the next {@code MultiDoc} + * object or an indication that there are no more. An implementation of + * interface {@code MultiDoc} can assume the print service proxy will follow + * this interleaved pattern; for any other pattern of usage, the + * {@code MultiDoc} implementation's behavior is unspecified. + *

    * There is no restriction on the number of client threads that may be * simultaneously accessing the same multidoc. Therefore, all implementations of * interface MultiDoc must be designed to be multiple thread safe. In fact, a * client thread could be adding docs to the end of the (conceptual) list while * a Print Job thread is simultaneously obtaining docs from the beginning of the * list; provided the multidoc object synchronizes the threads properly, the two - * threads will not interfere with each other + * threads will not interfere with each other. */ - public interface MultiDoc { - /** * Obtain the current doc object. * - * @return Current doc object. - * - * @exception IOException - * Thrown if a error occurred reading the document. + * @return current doc object + * @throws IOException if an error occurred when reading the document */ public Doc getDoc() throws IOException; @@ -125,12 +119,9 @@ * Go to the multidoc object that contains the next doc object in the * sequence of doc objects. * - * @return Multidoc object containing the next doc object, or null if - * there are no further doc objects. - * - * @exception IOException - * Thrown if an error occurred locating the next document + * @return multidoc object containing the next doc object, or {@code null} + * if there are no further doc objects + * @throws IOException if an error occurred locating the next document */ public MultiDoc next() throws IOException; - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/MultiDocPrintJob.java --- a/jdk/src/java.desktop/share/classes/javax/print/MultiDocPrintJob.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/MultiDocPrintJob.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -28,39 +28,35 @@ import javax.print.attribute.PrintRequestAttributeSet; /** - * - * Obtained from a MultiDocPrintService, a MultiDocPrintJob can print a - * specified collection of documents as a single print job with a set of + * Obtained from a {@code MultiDocPrintService}, a {@code MultiDocPrintJob} can + * print a specified collection of documents as a single print job with a set of * job attributes. */ - public interface MultiDocPrintJob extends DocPrintJob { - /** - * Print a MultiDoc with the specified job attributes. - * This method should only be called once for a given print job. - * Calling it again will not result in a new job being spooled to - * the printer. The service implementation will define policy - * for service interruption and recovery. Application clients which - * want to monitor the success or failure should register a - * PrintJobListener. - * - * @param multiDoc The documents to be printed. ALL must be a flavor - * supported by the PrintJob {@literal &} PrintService. + /** + * Print a {@code MultiDoc} with the specified job attributes. This method + * should only be called once for a given print job. Calling it again will + * not result in a new job being spooled to the printer. The service + * implementation will define policy for service interruption and recovery. + * Application clients which want to monitor the success or failure should + * register a {@code PrintJobListener}. * - * @param attributes The job attributes to be applied to this print job. - * If this parameter is null then the default attributes are used. - * - * @throws PrintException The exception additionally may implement - * an interfaces which more precisely describes the cause of the exception - *

      - *
    • FlavorException. - * If the document has a flavor not supported by this print job. - *
    • AttributeException. - * If one or more of the attributes are not valid for this print job. - *
    + * @param multiDoc the documents to be printed. ALL must be a flavor + * supported by the PrintJob {@literal &} PrintService. + * @param attributes the job attributes to be applied to this print job. If + * this parameter is {@code null} then the default attributes are + * used. + * @throws PrintException the exception additionally may implement an + * interfaces which more precisely describes the cause of the + * exception + *
      + *
    • {@code FlavorException}. If the document has a flavor not + * supported by this print job. + *
    • {@code AttributeException}. If one or more of the + * attributes are not valid for this print job. + *
    */ public void print(MultiDoc multiDoc, PrintRequestAttributeSet attributes) throws PrintException; - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/MultiDocPrintService.java --- a/jdk/src/java.desktop/share/classes/javax/print/MultiDocPrintService.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/MultiDocPrintService.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -25,18 +25,18 @@ package javax.print; - - /** Interface MultiPrintService is the factory for a MultiDocPrintJob. - * A MultiPrintService - * describes the capabilities of a Printer and can be queried regarding - * a printer's supported attributes. - */ +/** + * Interface {@code MultiPrintService} is the factory for a + * {@code MultiDocPrintJob}. A {@code MultiPrintService} describes the + * capabilities of a printer and can be queried regarding a printer's supported + * attributes. + */ public interface MultiDocPrintService extends PrintService { /** * Create a job which can print a multiDoc. - * @return a MultiDocPrintJob + * + * @return a {@code MultiDocPrintJob} */ public MultiDocPrintJob createMultiDocPrintJob(); - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/PrintException.java --- a/jdk/src/java.desktop/share/classes/javax/print/PrintException.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/PrintException.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -26,13 +26,16 @@ package javax.print; /** - * Class PrintException encapsulates a printing-related error condition that - * occurred while using a Print Service instance. This base class - * furnishes only a string description of the error. Subclasses furnish more - * detailed information if applicable. - * + * Class {@code PrintException} encapsulates a printing-related error condition + * that occurred while using a Print Service instance. This base class furnishes + * only a string description of the error. Subclasses furnish more detailed + * information if applicable. */ public class PrintException extends Exception { + + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -5932531546705242471L; /** @@ -45,7 +48,7 @@ /** * Construct a print exception with the given detail message. * - * @param s Detail message, or null if no detail message. + * @param s detail message, or {@code null} if no detail message */ public PrintException (String s) { super (s); @@ -54,20 +57,20 @@ /** * Construct a print exception chaining the supplied exception. * - * @param e Chained exception. + * @param e chained exception */ public PrintException (Exception e) { super ( e); } /** - * Construct a print exception with the given detail message - * and chained exception. - * @param s Detail message, or null if no detail message. - * @param e Chained exception. + * Construct a print exception with the given detail message and chained + * exception. + * + * @param s detail message, or {@code null} if no detail message + * @param e chained exception */ public PrintException (String s, Exception e) { super (s, e); } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/PrintService.java --- a/jdk/src/java.desktop/share/classes/javax/print/PrintService.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/PrintService.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -25,22 +25,19 @@ package javax.print; -import java.util.Locale; - import javax.print.attribute.Attribute; import javax.print.attribute.AttributeSet; import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.PrintServiceAttributeSet; import javax.print.event.PrintServiceAttributeListener; - /** - * Interface PrintService is the factory for a DocPrintJob. A PrintService - * describes the capabilities of a Printer and can be queried regarding - * a printer's supported attributes. - *

    + * Interface {@code PrintService} is the factory for a {@code DocPrintJob}. A + * {@code PrintService} describes the capabilities of a printer and can be + * queried regarding a printer's supported attributes. + *

    * Example: - *

    {@code
    + *   
    {@code
      *   DocFlavor flavor = DocFlavor.INPUT_STREAM.POSTSCRIPT;
      *   PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
      *   aset.add(MediaSizeName.ISO_A4);
    @@ -56,299 +53,263 @@
      *        } catch (PrintException e) {
      *        }
      *   }
    - *   }
    + * }
    */ public interface PrintService { - /** Returns a String name for this print service which may be used - * by applications to request a particular print service. - * In a suitable context, such as a name service, this name must be - * unique. - * In some environments this unique name may be the same as the user - * friendly printer name defined as the - * {@link javax.print.attribute.standard.PrinterName PrinterName} - * attribute. - * @return name of the service. - */ + /** + * Returns a string name for this print service which may be used by + * applications to request a particular print service. In a suitable + * context, such as a name service, this name must be unique. In some + * environments this unique name may be the same as the user friendly + * printer name defined as the + * {@link javax.print.attribute.standard.PrinterName PrinterName} attribute. + * + * @return name of the service + */ public String getName(); /** - * Creates and returns a PrintJob capable of handling data from - * any of the supported document flavors. - * @return a DocPrintJob object + * Creates and returns a {@code PrintJob} capable of handling data from any + * of the supported document flavors. + * + * @return a {@code DocPrintJob} object */ public DocPrintJob createPrintJob(); /** - * Registers a listener for events on this PrintService. - * @param listener a PrintServiceAttributeListener, which - * monitors the status of a print service + * Registers a listener for events on this {@code PrintService}. + * + * @param listener a PrintServiceAttributeListener, which monitors the + * status of a print service * @see #removePrintServiceAttributeListener */ public void addPrintServiceAttributeListener( PrintServiceAttributeListener listener); /** - * Removes the print-service listener from this print service. - * This means the listener is no longer interested in - * {@code PrintService} events. - * @param listener a PrintServiceAttributeListener object + * Removes the print-service listener from this print service. This means + * the listener is no longer interested in {@code PrintService} events. + * + * @param listener a {@code PrintServiceAttributeListener} object * @see #addPrintServiceAttributeListener */ public void removePrintServiceAttributeListener( PrintServiceAttributeListener listener); /** - * Obtains this print service's set of printer description attributes - * giving this Print Service's status. The returned attribute set object - * is unmodifiable. The returned attribute set object is a "snapshot" of - * this Print Service's attribute set at the time of the - * {@code getAttributes()} method call: that is, the returned - * attribute set's contents will not be updated if this print - * service's attribute set's contents change in the future. To detect - * changes in attribute values, call {@code getAttributes()} again - * and compare the new attribute set to the previous attribute set; - * alternatively, register a listener for print service events. + * Obtains this print service's set of printer description attributes giving + * this Print Service's status. The returned attribute set object is + * unmodifiable. The returned attribute set object is a "snapshot" of this + * Print Service's attribute set at the time of the {@code getAttributes()} + * method call: that is, the returned attribute set's contents will + * not be updated if this print service's attribute set's contents + * change in the future. To detect changes in attribute values, call + * {@code getAttributes()} again and compare the new attribute set to the + * previous attribute set; alternatively, register a listener for print + * service events. * - * @return Unmodifiable snapshot of this Print Service's attribute set. - * May be empty, but not null. + * @return unmodifiable snapshot of this Print Service's attribute set. May + * be empty, but not {@code null}. */ public PrintServiceAttributeSet getAttributes(); /** - * Gets the value of the single specified service attribute. - * This may be useful to clients which only need the value of one - * attribute and want to minimize overhead. - * @param the type of the specified service attribute - * @param category the category of a PrintServiceAttribute supported - * by this service - may not be null. - * @return the value of the supported attribute or null if the - * attribute is not supported by this service. - * @exception NullPointerException if the category is null. - * @exception IllegalArgumentException - * (unchecked exception) if {@code category} is not a - * {@code Class} that implements interface - *{@link javax.print.attribute.PrintServiceAttribute PrintServiceAttribute}. + * Gets the value of the single specified service attribute. This may be + * useful to clients which only need the value of one attribute and want to + * minimize overhead. + * + * @param the type of the specified service attribute + * @param category the category of a {@code PrintServiceAttribute} + * supported by this service - may not be {@code null} + * @return the value of the supported attribute or {@code null} if the + * attribute is not supported by this service + * @throws NullPointerException if the category is {@code null} + * @throws IllegalArgumentException if {@code category} is not a + * {@code Class} that implements interface + * {@link PrintServiceAttribute PrintServiceAttribute} */ public T getAttribute(Class category); /** - * Determines the print data formats a client can specify when setting - * up a job for this {@code PrintService}. A print data format is - * designated by a "doc - * flavor" (class {@link javax.print.DocFlavor DocFlavor}) - * consisting of a MIME type plus a print data representation class. - *

    - * Note that some doc flavors may not be supported in combination - * with all attributes. Use {@code getUnsupportedAttributes(..)} - * to validate specific combinations. + * Determines the print data formats a client can specify when setting up a + * job for this {@code PrintService}. A print data format is designated by a + * "doc flavor" (class {@link DocFlavor DocFlavor}) consisting of a MIME + * type plus a print data representation class. + *

    + * Note that some doc flavors may not be supported in combination with all + * attributes. Use {@code getUnsupportedAttributes(..)} to validate specific + * combinations. * - * @return Array of supported doc flavors, should have at least - * one element. - * + * @return array of supported doc flavors, should have at least one element */ public DocFlavor[] getSupportedDocFlavors(); /** - * Determines if this print service supports a specific - * {@code DocFlavor}. This is a convenience method to determine - * if the {@code DocFlavor} would be a member of the result of - * {@code getSupportedDocFlavors()}. + * Determines if this print service supports a specific {@code DocFlavor}. + * This is a convenience method to determine if the {@code DocFlavor} would + * be a member of the result of {@code getSupportedDocFlavors()}. *

    - * Note that some doc flavors may not be supported in combination - * with all attributes. Use {@code getUnsupportedAttributes(..)} - * to validate specific combinations. + * Note that some doc flavors may not be supported in combination with all + * attributes. Use {@code getUnsupportedAttributes(..)} to validate specific + * combinations. * - * @param flavor the {@code DocFlavor} to query for support. - * @return {@code true} if this print service supports the - * specified {@code DocFlavor}; {@code false} otherwise. - * @exception NullPointerException - * (unchecked exception) Thrown if {@code flavor} is null. + * @param flavor the {@code DocFlavor} to query for support + * @return {@code true} if this print service supports the specified + * {@code DocFlavor}; {@code false} otherwise + * @throws NullPointerException if {@code flavor} is {@code null} */ public boolean isDocFlavorSupported(DocFlavor flavor); - /** - * Determines the printing attribute categories a client can specify - * when setting up a job for this print service. - * A printing attribute category is + * Determines the printing attribute categories a client can specify when + * setting up a job for this print service. A printing attribute category is * designated by a {@code Class} that implements interface - * {@link javax.print.attribute.Attribute Attribute}. This method returns - * just the attribute categories that are supported; it does not - * return the particular attribute values that are supported. - *

    - * This method returns all the printing attribute - * categories this print service supports for any possible job. - * Some categories may not be supported in a particular context (ie - * for a particular {@code DocFlavor}). - * Use one of the methods that include a {@code DocFlavor} to - * validate the request before submitting it, such as + * {@link Attribute Attribute}. This method returns just the attribute + * categories that are supported; it does not return the particular + * attribute values that are supported. + *

    + * This method returns all the printing attribute categories this print + * service supports for any possible job. Some categories may not be + * supported in a particular context (ie for a particular + * {@code DocFlavor}). Use one of the methods that include a + * {@code DocFlavor} to validate the request before submitting it, such as * {@code getSupportedAttributeValues(..)}. * - * @return Array of printing attribute categories that the client can - * specify as a doc-level or job-level attribute in a Print - * Request. Each element in the array is a {@link java.lang.Class - * Class} that implements interface {@link - * javax.print.attribute.Attribute Attribute}. - * The array is empty if no categories are supported. + * @return array of printing attribute categories that the client can + * specify as a doc-level or job-level attribute in a Print Request. + * Each element in the array is a {@link Class Class} that + * implements interface {@link Attribute Attribute}. The array is + * empty if no categories are supported. */ public Class[] getSupportedAttributeCategories(); /** - * Determines whether a client can specify the given printing - * attribute category when setting up a job for this print service. A - * printing attribute category is designated by a {@code Class} - * that implements interface {@link javax.print.attribute.Attribute - * Attribute}. This method tells whether the attribute category is - * supported; it does not tell whether a particular attribute value - * is supported. + * Determines whether a client can specify the given printing attribute + * category when setting up a job for this print service. A printing + * attribute category is designated by a {@code Class} that implements + * interface {@link Attribute Attribute}. This method + * tells whether the attribute category is supported; it does not + * tell whether a particular attribute value is supported. *

    - * Some categories may not be supported in a particular context (ie - * for a particular {@code DocFlavor}). - * Use one of the methods which include a {@code DocFlavor} to - * validate the request before submitting it, such as + * Some categories may not be supported in a particular context (ie for a + * particular {@code DocFlavor}). Use one of the methods which include a + * {@code DocFlavor} to validate the request before submitting it, such as * {@code getSupportedAttributeValues(..)}. - *

    - * This is a convenience method to determine if the category - * would be a member of the result of - * {@code getSupportedAttributeCategories()}. - * - * @param category Printing attribute category to test. It must be a - * {@code Class} that implements - * interface - * {@link javax.print.attribute.Attribute Attribute}. + *

    + * This is a convenience method to determine if the category would be a + * member of the result of {@code getSupportedAttributeCategories()}. * - * @return {@code true} if this print service supports - * specifying a doc-level or - * job-level attribute in {@code category} in a Print - * Request; {@code false} if it doesn't. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code category} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code category} is not a - * {@code Class} that implements interface - * {@link javax.print.attribute.Attribute Attribute}. + * @param category printing attribute category to test. It must be a + * {@code Class} that implements interface + * {@link Attribute Attribute}. + * @return {@code true} if this print service supports specifying a + * doc-level or job-level attribute in {@code category} in a Print + * Request; {@code false} if it doesn't + * @throws NullPointerException if {@code category} is {@code null} + * @throws IllegalArgumentException if {@code category} is not a + * {@code Class} that implements interface + * {@link Attribute Attribute} */ public boolean isAttributeCategorySupported(Class category); /** - * Determines this print service's default printing attribute value in - * the given category. A printing attribute value is an instance of - * a class that implements interface - * {@link javax.print.attribute.Attribute Attribute}. If a client sets - * up a print job and does not specify any attribute value in the - * given category, this Print Service will use the - * default attribute value instead. + * Determines this print service's default printing attribute value in the + * given category. A printing attribute value is an instance of a class that + * implements interface {@link Attribute Attribute}. If a client sets up a + * print job and does not specify any attribute value in the given category, + * this Print Service will use the default attribute value instead. *

    - * Some attributes may not be supported in a particular context (ie - * for a particular {@code DocFlavor}). - * Use one of the methods that include a {@code DocFlavor} to - * validate the request before submitting it, such as + * Some attributes may not be supported in a particular context (ie for a + * particular {@code DocFlavor}). Use one of the methods that include a + * {@code DocFlavor} to validate the request before submitting it, such as * {@code getSupportedAttributeValues(..)}. - *

    - * Not all attributes have a default value. For example the - * service will not have a defaultvalue for {@code RequestingUser} - * i.e. a null return for a supported category means there is no - * service default value for that category. Use the - * {@code isAttributeCategorySupported(Class)} method to - * distinguish these cases. + *

    + * Not all attributes have a default value. For example the service will not + * have a default value for {@code RequestingUser} i.e. a {@code null} + * return for a supported category means there is no service default value + * for that category. Use the {@code isAttributeCategorySupported(Class)} + * method to distinguish these cases. * - * @param category Printing attribute category for which the default - * attribute value is requested. It must be a {@link - * java.lang.Class Class} that implements interface - * {@link javax.print.attribute.Attribute - * Attribute}. - * - * @return Default attribute value for {@code category}, or null - * if this Print Service does not support specifying a doc-level or - * job-level attribute in {@code category} in a Print - * Request, or the service does not have a default value - * for this attribute. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code category} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code category} is not a - * {@link java.lang.Class Class} that implements interface {@link - * javax.print.attribute.Attribute Attribute}. + * @param category printing attribute category for which the default + * attribute value is requested. It must be a {@link Class Class} + * that implements interface {@link Attribute Attribute}. + * @return default attribute value for {@code category}, or {@code null} if + * this Print Service does not support specifying a doc-level or + * job-level attribute in {@code category} in a Print Request, or + * the service does not have a default value for this attribute + * @throws NullPointerException if {@code category} is {@code null} + * @throws IllegalArgumentException if {@code category} is not a + * {@link Class Class} that implements interface + * {@link Attribute Attribute} */ public Object getDefaultAttributeValue(Class category); /** - * Determines the printing attribute values a client can specify in - * the given category when setting up a job for this print service. A - * printing + * Determines the printing attribute values a client can specify in the + * given category when setting up a job for this print service. A printing * attribute value is an instance of a class that implements interface - * {@link javax.print.attribute.Attribute Attribute}. - *

    - * If {@code flavor} is null and {@code attributes} is null - * or is an empty set, this method returns all the printing attribute - * values this Print Service supports for any possible job. If - * {@code flavor} is not null or {@code attributes} is not - * an empty set, this method returns just the printing attribute values - * that are compatible with the given doc flavor and/or set of attributes. - * That is, a null return value may indicate that specifying this attribute - * is incompatible with the specified DocFlavor. - * Also if DocFlavor is not null it must be a flavor supported by this - * PrintService, else IllegalArgumentException will be thrown. - *

    - * If the {@code attributes} parameter contains an Attribute whose - * category is the same as the {@code category} parameter, the service - * must ignore this attribute in the AttributeSet. + * {@link Attribute Attribute}. *

    - * {@code DocAttribute}s which are to be specified on the - * {@code Doc} must be included in this set to accurately - * represent the context. + * If {@code flavor} is {@code null} and {@code attributes} is {@code null} + * or is an empty set, this method returns all the printing attribute values + * this Print Service supports for any possible job. If {@code flavor} is not + * {@code null} or {@code attributes} is not an empty set, this method + * returns just the printing attribute values that are compatible with the + * given doc flavor and/or set of attributes. That is, a {@code null} return + * value may indicate that specifying this attribute is incompatible with + * the specified DocFlavor. Also if {@code DocFlavor} is not {@code null} it + * must be a flavor supported by this {@code PrintService}, else + * {@code IllegalArgumentException} will be thrown. *

    - * This method returns an Object because different printing attribute - * categories indicate the supported attribute values in different ways. - * The documentation for each printing attribute in package {@link - * javax.print.attribute.standard javax.print.attribute.standard} + * If the {@code attributes} parameter contains an {@code Attribute} whose + * category is the same as the {@code category} parameter, the service must + * ignore this attribute in the {@code AttributeSet}. + *

    + * {@code DocAttribute}s which are to be specified on the {@code Doc} must + * be included in this set to accurately represent the context. + *

    + * This method returns an {@code Object} because different printing + * attribute categories indicate the supported attribute values in different + * ways. The documentation for each printing attribute in package + * {@link javax.print.attribute.standard javax.print.attribute.standard} * describes how each attribute indicates its supported values. Possible * ways of indicating support include: - *

      - *
    • - * Return a single instance of the attribute category to indicate that any - * value is legal -- used, for example, by an attribute whose value is an - * arbitrary text string. (The value of the returned attribute object is - * irrelevant.) - *
    • - * Return an array of one or more instances of the attribute category, - * containing the legal values -- used, for example, by an attribute with - * a list of enumerated values. The type of the array is an array of the - * specified attribute category type as returned by its - * {@code getCategory(Class)}. - *
    • - * Return a single object (of some class other than the attribute category) - * that indicates bounds on the legal values -- used, for example, by an - * integer-valued attribute that must lie within a certain range. - *
    + *
      + *
    • Return a single instance of the attribute category to indicate that + * any value is legal -- used, for example, by an attribute whose value is + * an arbitrary text string. (The value of the returned attribute object + * is irrelevant.) + *
    • Return an array of one or more instances of the attribute category, + * containing the legal values -- used, for example, by an attribute with + * a list of enumerated values. The type of the array is an array of the + * specified attribute category type as returned by its + * {@code getCategory(Class)}. + *
    • Return a single object (of some class other than the attribute + * category) that indicates bounds on the legal values -- used, for + * example, by an integer-valued attribute that must lie within a certain + * range. + *
    * - * @param category Printing attribute category to test. It must be a - * {@link java.lang.Class Class} that implements - * interface {@link - * javax.print.attribute.Attribute Attribute}. - * @param flavor Doc flavor for a supposed job, or null. - * @param attributes Set of printing attributes for a supposed job - * (both job-level attributes and document-level - * attributes), or null. - * - * @return Object indicating supported values for {@code category}, - * or null if this Print Service does not support specifying a - * doc-level or job-level attribute in {@code category} in - * a Print Request. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code category} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code category} is not a - * {@link java.lang.Class Class} that implements interface {@link - * javax.print.attribute.Attribute Attribute}, or - * {@code DocFlavor} is not supported by this service. + * @param category printing attribute category to test. It must be a + * {@link Class Class} that implements interface + * {@link Attribute Attribute}. + * @param flavor doc flavor for a supposed job, or {@code null} + * @param attributes set of printing attributes for a supposed job (both + * job-level attributes and document-level attributes), or + * {@code null} + * @return object indicating supported values for {@code category}, or + * {@code null} if this Print Service does not support specifying a + * doc-level or job-level attribute in {@code category} in a Print + * Request + * @throws NullPointerException if {@code category} is {@code null} + * @throws IllegalArgumentException if {@code category} is not a + * {@link Class Class} that implements interface + * {@link Attribute Attribute}, or {@code DocFlavor} is not + * supported by this service */ public Object getSupportedAttributeValues(Class category, @@ -356,133 +317,121 @@ AttributeSet attributes); /** - * Determines whether a client can specify the given printing - * attribute - * value when setting up a job for this Print Service. A printing - * attribute value is an instance of a class that implements interface - * {@link javax.print.attribute.Attribute Attribute}. - *

    - * If {@code flavor} is null and {@code attributes} is null or - * is an empty set, this method tells whether this Print Service supports + * Determines whether a client can specify the given printing attribute + * value when setting up a job for this Print Service. A printing attribute + * value is an instance of a class that implements interface + * {@link Attribute Attribute}. + *

    + * If {@code flavor} is {@code null} and {@code attributes} is {@code null} + * or is an empty set, this method tells whether this Print Service supports * the given printing attribute value for some possible combination of doc - * flavor and set of attributes. If {@code flavor} is not null or - * {@code attributes} is not an empty set, this method tells whether - * this Print Service supports the given printing attribute value in - * combination with the given doc flavor and/or set of attributes. + * flavor and set of attributes. If {@code flavor} is not {@code null} or + * {@code attributes} is not an empty set, this method tells whether this + * Print Service supports the given printing attribute value in combination + * with the given doc flavor and/or set of attributes. *

    - * Also if DocFlavor is not null it must be a flavor supported by this - * PrintService, else IllegalArgumentException will be thrown. + * Also if {@code DocFlavor} is not {@code null} it must be a flavor + * supported by this {@code PrintService}, else + * {@code IllegalArgumentException} will be thrown. *

    - * {@code DocAttribute}s which are to be specified on the - * {@code Doc} must be included in this set to accurately - * represent the context. + * {@code DocAttribute}s which are to be specified on the {@code Doc} must + * be included in this set to accurately represent the context. *

    - * This is a convenience method to determine if the value - * would be a member of the result of - * {@code getSupportedAttributeValues(...)}. + * This is a convenience method to determine if the value would be a member + * of the result of {@code getSupportedAttributeValues(...)}. * - * @param attrval Printing attribute value to test. - * @param flavor Doc flavor for a supposed job, or null. - * @param attributes Set of printing attributes for a supposed job - * (both job-level attributes and document-level - * attributes), or null. - * - * @return True if this Print Service supports specifying - * {@code attrval} as a doc-level or job-level attribute in a - * Print Request, false if it doesn't. - * - * @exception NullPointerException - * (unchecked exception) if {@code attrval} is null. - * @exception IllegalArgumentException if flavor is not supported by - * this PrintService. + * @param attrval printing attribute value to test + * @param flavor doc flavor for a supposed job, or {@code null} + * @param attributes set of printing attributes for a supposed job (both + * job-level attributes and document-level attributes), or + * {@code null} + * @return {@code true} if this Print Service supports specifying + * {@code attrval} as a doc-level or job-level attribute in a Print + * Request, {@code false} if it doesn't + * @throws NullPointerException if {@code attrval} is {@code null} + * @throws IllegalArgumentException if flavor is not supported by this + * {@code PrintService} */ public boolean isAttributeValueSupported(Attribute attrval, DocFlavor flavor, AttributeSet attributes); - /** - * Identifies the attributes that are unsupported for a print request - * in the context of a particular DocFlavor. - * This method is useful for validating a potential print job and - * identifying the specific attributes which cannot be supported. - * It is important to supply only a supported DocFlavor or an - * IllegalArgumentException will be thrown. If the - * return value from this method is null, all attributes are supported. + * Identifies the attributes that are unsupported for a print request in the + * context of a particular {@code DocFlavor}. This method is useful for + * validating a potential print job and identifying the specific attributes + * which cannot be supported. It is important to supply only a supported + * {@code DocFlavor} or an {@code IllegalArgumentException} will be thrown. + * If the return value from this method is {@code null}, all attributes are + * supported. *

    - * {@code DocAttribute}s which are to be specified on the - * {@code Doc} must be included in this set to accurately - * represent the context. + * {@code DocAttribute}s which are to be specified on the {@code Doc} must + * be included in this set to accurately represent the context. *

    - * If the return value is non-null, all attributes in the returned - * set are unsupported with this DocFlavor. The returned set does not - * distinguish attribute categories that are unsupported from + * If the return value is {@code non-null}, all attributes in the returned + * set are unsupported with this {@code DocFlavor}. The returned set does + * not distinguish attribute categories that are unsupported from * unsupported attribute values. *

    - * A supported print request can then be created by removing - * all unsupported attributes from the original attribute set, - * except in the case that the DocFlavor is unsupported. + * A supported print request can then be created by removing all unsupported + * attributes from the original attribute set, except in the case that the + * {@code DocFlavor} is unsupported. *

    - * If any attributes are unsupported only because they are in conflict - * with other attributes then it is at the discretion of the service - * to select the attribute(s) to be identified as the cause of the - * conflict. + * If any attributes are unsupported only because they are in conflict with + * other attributes then it is at the discretion of the service to select + * the attribute(s) to be identified as the cause of the conflict. *

    - * Use {@code isDocFlavorSupported()} to verify that a DocFlavor - * is supported before calling this method. + * Use {@code isDocFlavorSupported()} to verify that a {@code DocFlavor} is + * supported before calling this method. * - * @param flavor Doc flavor to test, or null - * @param attributes Set of printing attributes for a supposed job - * (both job-level attributes and document-level - * attributes), or null. - * - * @return null if this Print Service supports the print request - * specification, else the unsupported attributes. - * - * @exception IllegalArgumentException if {@code flavor} is - * not supported by this PrintService. + * @param flavor doc flavor to test, or {@code null} + * @param attributes set of printing attributes for a supposed job (both + * job-level attributes and document-level attributes), or + * {@code null} + * @return {@code null} if this Print Service supports the print request + * specification, else the unsupported attributes + * @throws IllegalArgumentException if {@code flavor} is not supported by + * this {@code PrintService} */ public AttributeSet getUnsupportedAttributes(DocFlavor flavor, AttributeSet attributes); /** - * Returns a factory for UI components which allow users to interact - * with the service in various roles. - * Services which do not provide any UI should return null. - * Print Services which do provide UI but want to be supported in - * an environment with no UI support should ensure that the factory - * is not initialised unless the application calls this method to - * obtain the factory. - * See {@code ServiceUIFactory} for more information. - * @return null or a factory for UI components. + * Returns a factory for UI components which allow users to interact with + * the service in various roles. Services which do not provide any UI should + * return {@code null}. Print Services which do provide UI but want to be + * supported in an environment with no UI support should ensure that the + * factory is not initialised unless the application calls this method to + * obtain the factory. See {@code ServiceUIFactory} for more information. + * + * @return {@code null} or a factory for UI components */ public ServiceUIFactory getServiceUIFactory(); /** - * Determines if two services are referring to the same underlying - * service. Objects encapsulating a print service may not exhibit - * equality of reference even though they refer to the same underlying - * service. + * Determines if two services are referring to the same underlying service. + * Objects encapsulating a print service may not exhibit equality of + * reference even though they refer to the same underlying service. *

    * Clients should call this method to determine if two services are * referring to the same underlying service. *

    - * Services must implement this method and return true only if the - * service objects being compared may be used interchangeably by the - * client. + * Services must implement this method and return {@code true} only if the + * service objects being compared may be used interchangeably by the client. * Services are free to return the same object reference to an underlying * service if that, but clients must not depend on equality of reference. - * @param obj the reference object with which to compare. - * @return true if this service is the same as the obj argument, - * false otherwise. + * + * @param obj the reference object with which to compare + * @return {@code true} if this service is the same as the obj argument, + * {@code false} otherwise */ public boolean equals(Object obj); /** * This method should be implemented consistently with * {@code equals(Object)}. - * @return hash code of this object. + * + * @return hash code of this object */ public int hashCode(); - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/PrintServiceLookup.java --- a/jdk/src/java.desktop/share/classes/javax/print/PrintServiceLookup.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/PrintServiceLookup.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,56 +23,69 @@ * questions. */ - package javax.print; import java.util.ArrayList; import java.util.Iterator; +import java.util.ServiceConfigurationError; +import java.util.ServiceLoader; + import javax.print.attribute.AttributeSet; import sun.awt.AppContext; -import java.util.ServiceLoader; -import java.util.ServiceConfigurationError; -/** Implementations of this class provide lookup services for - * print services (typically equivalent to printers) of a particular type. - *

    - * Multiple implementations may be installed concurrently. - * All implementations must be able to describe the located printers - * as instances of a PrintService. - * Typically implementations of this service class are located - * automatically in JAR files (see the SPI JAR file specification). - * These classes must be instantiable using a default constructor. - * Alternatively applications may explicitly register instances - * at runtime. - *

    - * Applications use only the static methods of this abstract class. - * The instance methods are implemented by a service provider in a subclass - * and the unification of the results from all installed lookup classes - * are reported by the static methods of this class when called by - * the application. - *

    - * A PrintServiceLookup implementor is recommended to check for the - * SecurityManager.checkPrintJobAccess() to deny access to untrusted code. - * Following this recommended policy means that untrusted code may not - * be able to locate any print services. Downloaded applets are the most - * common example of untrusted code. - *

    - * This check is made on a per lookup service basis to allow flexibility in - * the policy to reflect the needs of different lookup services. - *

    - * Services which are registered by registerService(PrintService) - * will not be included in lookup results if a security manager is - * installed and its checkPrintJobAccess() method denies access. - */ - +/** + * Implementations of this class provide lookup services for print services + * (typically equivalent to printers) of a particular type. + *

    + * Multiple implementations may be installed concurrently. All implementations + * must be able to describe the located printers as instances of a + * {@code PrintService}. Typically implementations of this service class are + * located automatically in JAR files (see the SPI JAR file specification). + * These classes must be instantiable using a default constructor. Alternatively + * applications may explicitly register instances at runtime. + *

    + * Applications use only the static methods of this abstract class. The instance + * methods are implemented by a service provider in a subclass and the + * unification of the results from all installed lookup classes are reported by + * the static methods of this class when called by the application. + *

    + * A {@code PrintServiceLookup} implementor is recommended to check for the + * {@code SecurityManager.checkPrintJobAccess()} to deny access to untrusted + * code. Following this recommended policy means that untrusted code may not be + * able to locate any print services. Downloaded applets are the most common + * example of untrusted code. + *

    + * This check is made on a per lookup service basis to allow flexibility in the + * policy to reflect the needs of different lookup services. + *

    + * Services which are registered by {@link #registerService(PrintService)} will + * not be included in lookup results if a security manager is installed and its + * {@code checkPrintJobAccess()} method denies access. + */ public abstract class PrintServiceLookup { + /** + * Contains a lists of services. + */ static class Services { + + /** + * The list of lookup services. + */ private ArrayList listOfLookupServices = null; + + /** + * The list of registered services. + */ private ArrayList registeredServices = null; } + /** + * Returns the services from the current appcontext. + * + * @return the services + */ private static Services getServicesForContext() { Services services = (Services)AppContext.getAppContext().get(Services.class); @@ -83,21 +96,40 @@ return services; } + /** + * Returns the list of lookup services. + * + * @return the list of lookup services + */ private static ArrayList getListOfLookupServices() { return getServicesForContext().listOfLookupServices; } + /** + * Initialize the list of lookup services. + * + * @return the list of lookup services + */ private static ArrayList initListOfLookupServices() { ArrayList listOfLookupServices = new ArrayList<>(); getServicesForContext().listOfLookupServices = listOfLookupServices; return listOfLookupServices; } - + /** + * Returns the list of registered services. + * + * @return the list of registered services + */ private static ArrayList getRegisteredServices() { return getServicesForContext().registeredServices; } + /** + * Initialize the list of registered services. + * + * @return the list of registered services + */ private static ArrayList initRegisteredServices() { ArrayList registeredServices = new ArrayList<>(); getServicesForContext().registeredServices = registeredServices; @@ -108,14 +140,13 @@ * Locates print services capable of printing the specified * {@link DocFlavor}. * - * @param flavor the flavor to print. If null, this constraint is not - * used. - * @param attributes attributes that the print service must support. - * If null this constraint is not used. - * - * @return array of matching {@code PrintService} objects - * representing print services that support the specified flavor - * attributes. If no services match, the array is zero-length. + * @param flavor the flavor to print. If {@code null}, this constraint is + * not used. + * @param attributes attributes that the print service must support. If + * {@code null} this constraint is not used. + * @return array of matching {@code PrintService} objects representing print + * services that support the specified flavor attributes. If no + * services match, the array is zero-length. */ public static final PrintService[] lookupPrintServices(DocFlavor flavor, @@ -124,26 +155,23 @@ return list.toArray(new PrintService[list.size()]); } - /** - * Locates MultiDoc print Services capable of printing MultiDocs - * containing all the specified doc flavors. - *

    This method is useful to help locate a service that can print - * a {@code MultiDoc} in which the elements may be different - * flavors. An application could perform this itself by multiple lookups - * on each {@code DocFlavor} in turn and collating the results, - * but the lookup service may be able to do this more efficiently. + * Locates {@code MultiDoc} print {@code Services} capable of printing + * {@code MultiDocs} containing all the specified doc flavors. + *

    + * This method is useful to help locate a service that can print a + * {@code MultiDoc} in which the elements may be different flavors. An + * application could perform this itself by multiple lookups on each + * {@code DocFlavor} in turn and collating the results, but the lookup + * service may be able to do this more efficiently. * - * @param flavors the flavors to print. If null or empty this - * constraint is not used. - * Otherwise return only multidoc print services that can print all - * specified doc flavors. - * @param attributes attributes that the print service must - * support. If null this constraint is not used. - * - * @return array of matching {@link MultiDocPrintService} objects. - * If no services match, the array is zero-length. - * + * @param flavors the flavors to print. If {@code null} or empty this + * constraint is not used. Otherwise return only multidoc print + * services that can print all specified doc flavors. + * @param attributes attributes that the print service must support. If + * {@code null} this constraint is not used. + * @return array of matching {@link MultiDocPrintService} objects. If no + * services match, the array is zero-length. */ public static final MultiDocPrintService[] lookupMultiDocPrintServices(DocFlavor[] flavors, @@ -152,28 +180,23 @@ return list.toArray(new MultiDocPrintService[list.size()]); } - /** - * Locates the default print service for this environment. - * This may return null. - * If multiple lookup services each specify a default, the - * chosen service is not precisely defined, but a - * platform native service, rather than an installed service, - * is usually returned as the default. If there is no clearly - * identifiable - * platform native default print service, the default is the first - * to be located in an implementation-dependent manner. + * Locates the default print service for this environment. This may return + * {@code null}. If multiple lookup services each specify a default, the + * chosen service is not precisely defined, but a platform native service, + * rather than an installed service, is usually returned as the default. If + * there is no clearly identifiable platform native default print service, + * the default is the first to be located in an implementation-dependent + * manner. *

    - * This may include making use of any preferences API that is available - * as part of the Java or native platform. - * This algorithm may be overridden by a user setting the property - * javax.print.defaultPrinter. - * A service specified must be discovered to be valid and currently - * available to be returned as the default. + * This may include making use of any preferences API that is available as + * part of the Java or native platform. This algorithm may be overridden by + * a user setting the property {@code javax.print.defaultPrinter}. A service + * specified must be discovered to be valid and currently available to be + * returned as the default. * - * @return the default PrintService. + * @return the default {@code PrintService} */ - public static final PrintService lookupDefaultPrintService() { Iterator psIterator = getAllLookupServices().iterator(); @@ -190,19 +213,16 @@ return null; } - /** - * Allows an application to explicitly register a class that - * implements lookup services. The registration will not persist - * across VM invocations. - * This is useful if an application needs to make a new service - * available that is not part of the installation. - * If the lookup service is already registered, or cannot be registered, - * the method returns false. + * Allows an application to explicitly register a class that implements + * lookup services. The registration will not persist across VM invocations. + * This is useful if an application needs to make a new service available + * that is not part of the installation. If the lookup service is already + * registered, or cannot be registered, the method returns {@code false}. * - * @param sp an implementation of a lookup service. - * @return {@code true} if the new lookup service is newly - * registered; {@code false} otherwise. + * @param sp an implementation of a lookup service + * @return {@code true} if the new lookup service is newly registered; + * {@code false} otherwise */ public static boolean registerServiceProvider(PrintServiceLookup sp) { synchronized (PrintServiceLookup.class) { @@ -220,29 +240,24 @@ getListOfLookupServices().add(sp); return true; } - } - /** - * Allows an application to directly register an instance of a - * class which implements a print service. - * The lookup operations for this service will be - * performed by the PrintServiceLookup class using the attribute - * values and classes reported by the service. - * This may be less efficient than a lookup - * service tuned for that service. - * Therefore registering a {@code PrintServiceLookup} instance - * instead is recommended. - * The method returns true if this service is not previously - * registered and is now successfully registered. - * This method should not be called with StreamPrintService instances. - * They will always fail to register and the method will return false. - * @param service an implementation of a print service. - * @return {@code true} if the service is newly - * registered; {@code false} otherwise. + * Allows an application to directly register an instance of a class which + * implements a print service. The lookup operations for this service will + * be performed by the {@code PrintServiceLookup} class using the attribute + * values and classes reported by the service. This may be less efficient + * than a lookup service tuned for that service. Therefore registering a + * {@code PrintServiceLookup} instance instead is recommended. The method + * returns {@code true} if this service is not previously registered and is + * now successfully registered. This method should not be called with + * {@code StreamPrintService} instances. They will always fail to register + * and the method will return {@code false}. + * + * @param service an implementation of a print service + * @return {@code true} if the service is newly registered; {@code false} + * otherwise */ - public static boolean registerService(PrintService service) { synchronized (PrintServiceLookup.class) { if (service == null || service instanceof StreamPrintService) { @@ -262,68 +277,72 @@ } } - - /** - * Locates services that can be positively confirmed to support - * the combination of attributes and DocFlavors specified. - * This method is not called directly by applications. - *

    - * Implemented by a service provider, used by the static methods - * of this class. - *

    - * The results should be the same as obtaining all the PrintServices - * and querying each one individually on its support for the - * specified attributes and flavors, but the process can be more - * efficient by taking advantage of the capabilities of lookup services - * for the print services. - * - * @param flavor of document required. If null it is ignored. - * @param attributes required to be supported. If null this - * constraint is not used. - * @return array of matching PrintServices. If no services match, the - * array is zero-length. - */ + /** + * Locates services that can be positively confirmed to support the + * combination of attributes and {@code DocFlavors} specified. This method + * is not called directly by applications. + *

    + * Implemented by a service provider, used by the static methods of this + * class. + *

    + * The results should be the same as obtaining all the {@code PrintServices} + * and querying each one individually on its support for the specified + * attributes and flavors, but the process can be more efficient by taking + * advantage of the capabilities of lookup services for the print services. + * + * @param flavor of document required. If {@code null} it is ignored. + * @param attributes required to be supported. If {@code null} this + * constraint is not used. + * @return array of matching {@code PrintServices}. If no services match, + * the array is zero-length. + */ public abstract PrintService[] getPrintServices(DocFlavor flavor, AttributeSet attributes); /** - * Not called directly by applications. - * Implemented by a service provider, used by the static methods - * of this class. - * @return array of all PrintServices known to this lookup service - * class. If none are found, the array is zero-length. + * Not called directly by applications. Implemented by a service provider, + * used by the static methods of this class. + * + * @return array of all {@code PrintServices} known to this lookup service + * class. If none are found, the array is zero-length. */ public abstract PrintService[] getPrintServices() ; - - /** - * Not called directly by applications. - *

    - * Implemented by a service provider, used by the static methods - * of this class. - *

    - * Locates MultiDoc print services which can be positively confirmed - * to support the combination of attributes and DocFlavors specified. - * - * @param flavors of documents required. If null or empty it is ignored. - * @param attributes required to be supported. If null this - * constraint is not used. - * @return array of matching PrintServices. If no services match, the - * array is zero-length. - */ + /** + * Not called directly by applications. + *

    + * Implemented by a service provider, used by the static methods of this + * class. + *

    + * Locates {@code MultiDoc} print services which can be positively confirmed + * to support the combination of attributes and {@code DocFlavors} + * specified. + * + * @param flavors of documents required. If {@code null} or empty it is + * ignored. + * @param attributes required to be supported. If {@code null} this + * constraint is not used. + * @return array of matching {@code PrintServices}. If no services match, + * the array is zero-length. + */ public abstract MultiDocPrintService[] getMultiDocPrintServices(DocFlavor[] flavors, AttributeSet attributes); /** - * Not called directly by applications. - * Implemented by a service provider, and called by the print lookup - * service - * @return the default PrintService for this lookup service. - * If there is no default, returns null. + * Not called directly by applications. Implemented by a service provider, + * and called by the print lookup service. + * + * @return the default {@code PrintService} for this lookup service. If + * there is no default, returns {@code null}. */ public abstract PrintService getDefaultPrintService(); + /** + * Returns all lookup services for this environment. + * + * @return all lookup services for this environment + */ private static ArrayList getAllLookupServices() { synchronized (PrintServiceLookup.class) { ArrayList listOfLookupServices = getListOfLookupServices(); @@ -362,6 +381,18 @@ } } + /** + * Locates print services capable of printing the specified + * {@link DocFlavor}. + * + * @param flavor the flavor to print. If {@code null}, this constraint is + * not used. + * @param attributes attributes that the print service must support. If + * {@code null} this constraint is not used. + * @return list of matching {@code PrintService} objects representing print + * services that support the specified flavor attributes. If no + * services match, the empty list is returned. + */ private static ArrayList getServices(DocFlavor flavor, AttributeSet attributes) { @@ -388,7 +419,9 @@ } catch (Exception e) { } } - /* add any directly registered services */ + /* + * add any directly registered services + */ ArrayList registeredServices = null; try { SecurityManager security = System.getSecurityManager(); @@ -418,6 +451,18 @@ return listOfServices; } + /** + * Locates {@code MultiDoc} print {@code Services} capable of printing + * {@code MultiDocs} containing all the specified doc flavors. + * + * @param flavors the flavors to print. If {@code null} or empty this + * constraint is not used. Otherwise return only multidoc print + * services that can print all specified doc flavors. + * @param attributes attributes that the print service must support. If + * {@code null} this constraint is not used. + * @return list of matching {@link MultiDocPrintService} objects. If no + * services match, the empty list is returned. + */ private static ArrayList getMultiDocServices(DocFlavor[] flavors, AttributeSet attributes) { @@ -438,7 +483,9 @@ } catch (Exception e) { } } - /* add any directly registered services */ + /* + * add any directly registered services + */ ArrayList registeredServices = null; try { SecurityManager security = System.getSecurityManager(); @@ -480,5 +527,4 @@ } return listOfServices; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java --- a/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -25,99 +25,93 @@ package javax.print; +import java.awt.Dialog; +import java.awt.Frame; import java.awt.GraphicsConfiguration; -import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.HeadlessException; -import java.awt.Dialog; -import java.awt.Frame; -import java.awt.Point; import java.awt.Rectangle; import java.awt.Window; -import java.awt.KeyboardFocusManager; + import javax.print.attribute.Attribute; import javax.print.attribute.AttributeSet; import javax.print.attribute.PrintRequestAttributeSet; import javax.print.attribute.standard.Destination; import javax.print.attribute.standard.Fidelity; + import sun.print.DialogOwner; - import sun.print.ServiceDialog; import sun.print.SunAlternateMedia; -/** This class is a collection of UI convenience methods which provide a +/** + * This class is a collection of UI convenience methods which provide a * graphical user dialog for browsing print services looked up through the Java * Print Service API. *

    * The dialogs follow a standard pattern of acting as a continue/cancel option - *for a user as well as allowing the user to select the print service to use - *and specify choices such as paper size and number of copies. + * for a user as well as allowing the user to select the print service to use + * and specify choices such as paper size and number of copies. *

    * The dialogs are designed to work with pluggable print services though the * public APIs of those print services. *

    * If a print service provides any vendor extensions these may be made - * accessible to the user through a vendor supplied tab panel Component. + * accessible to the user through a vendor supplied tab panel {@code Component}. * Such a vendor extension is encouraged to use Swing! and to support its - * accessibility APIs. - * The vendor extensions should return the settings as part of the - * AttributeSet. - * Applications which want to preserve the user settings should use those - * settings to specify the print job. - * Note that this class is not referenced by any other part of the Java - * Print Service and may not be included in profiles which cannot depend - * on the presence of the AWT packages. + * accessibility APIs. The vendor extensions should return the settings as part + * of the {@code AttributeSet}. Applications which want to preserve the user + * settings should use those settings to specify the print job. Note that this + * class is not referenced by any other part of the Java Print Service and may + * not be included in profiles which cannot depend on the presence of the AWT + * packages. */ - public class ServiceUI { - /** - * Presents a dialog to the user for selecting a print service (printer). - * It is displayed at the location specified by the application and - * is modal. + * Presents a dialog to the user for selecting a print service (printer). It + * is displayed at the location specified by the application and is modal. * If the specification is invalid or would make the dialog not visible it - * will be displayed at a location determined by the implementation. - * The dialog blocks its calling thread and is application modal. + * will be displayed at a location determined by the implementation. The + * dialog blocks its calling thread and is application modal. *

    * The dialog may include a tab panel with custom UI lazily obtained from - * the PrintService's ServiceUIFactory when the PrintService is browsed. - * The dialog will attempt to locate a MAIN_UIROLE first as a JComponent, - * then as a Panel. If there is no ServiceUIFactory or no matching role - * the custom tab will be empty or not visible. + * the {@code PrintService}'s {@code ServiceUIFactory} when the + * {@code PrintService} is browsed. The dialog will attempt to locate a + * {@code MAIN_UIROLE} first as a {@code JComponent}, then as a + * {@code Panel}. If there is no {@code ServiceUIFactory} or no matching + * role the custom tab will be empty or not visible. *

    * The dialog returns the print service selected by the user if the user - * OK's the dialog and null if the user cancels the dialog. + * OK's the dialog and {@code null} if the user cancels the dialog. *

    - * An application must pass in an array of print services to browse. - * The array must be non-null and non-empty. - * Typically an application will pass in only PrintServices capable - * of printing a particular document flavor. + * An application must pass in an array of print services to browse. The + * array must be {@code non-null} and non-empty. Typically an application + * will pass in only {@code PrintServices} capable of printing a particular + * document flavor. *

    - * An application may pass in a PrintService to be initially displayed. - * A non-null parameter must be included in the array of browsable - * services. - * If this parameter is null a service is chosen by the implementation. + * An application may pass in a {@code PrintService} to be initially + * displayed. A {@code non-null} parameter must be included in the array of + * browsable services. If this parameter is {@code null} a service is chosen + * by the implementation. *

    - * An application may optionally pass in the flavor to be printed. - * If this is non-null choices presented to the user can be better - * validated against those supported by the services. - * An application must pass in a PrintRequestAttributeSet for returning - * user choices. - * On calling the PrintRequestAttributeSet may be empty, or may contain + * An application may optionally pass in the flavor to be printed. If this + * is {@code non-null} choices presented to the user can be better validated + * against those supported by the services. An application must pass in a + * {@code PrintRequestAttributeSet} for returning user choices. On calling + * the {@code PrintRequestAttributeSet} may be empty, or may contain * application-specified values. *

    - * These are used to set the initial settings for the initially - * displayed print service. Values which are not supported by the print - * service are ignored. As the user browses print services, attributes - * and values are copied to the new display. If a user browses a - * print service which does not support a particular attribute-value, the - * default for that service is used as the new value to be copied. + * These are used to set the initial settings for the initially displayed + * print service. Values which are not supported by the print service are + * ignored. As the user browses print services, attributes and values are + * copied to the new display. If a user browses a print service which does + * not support a particular attribute-value, the default for that service is + * used as the new value to be copied. *

    * If the user cancels the dialog, the returned attributes will not reflect * any changes made by the user. - * - * A typical basic usage of this method may be : + *

    + * A typical basic usage of this method may be: *

    {@code
          * PrintService[] services = PrintServiceLookup.lookupPrintServices(
          *                            DocFlavor.INPUT_STREAM.JPEG, null);
    @@ -133,24 +127,25 @@
          * }
          * }
    * - * @param gc used to select screen. null means primary or default screen. - * @param x location of dialog including border in screen coordinates - * relative to the origin of {@code gc}. - * @param y location of dialog including border in screen coordinates - * relative to the origin of {@code gc}. - * @param services to be browsable, must be non-null. - * @param defaultService initial PrintService to display. - * @param flavor the flavor to be printed, or null. - * @param attributes on input is the initial application supplied - * preferences. This cannot be null but may be empty. - * On output the attributes reflect changes made by the user. - * @return print service selected by the user, or null if the user - * cancelled the dialog. - * @throws HeadlessException if GraphicsEnvironment.isHeadless() - * returns true. - * @throws IllegalArgumentException if services is null or empty, - * or attributes is null, or the initial PrintService is not in the - * list of browsable services. + * @param gc used to select screen, {@code null} means primary or default + * screen + * @param x location of dialog including border in screen coordinates + * relative to the origin of {@code gc} + * @param y location of dialog including border in screen coordinates + * relative to the origin of {@code gc} + * @param services to be browsable, must be {@code non-null} + * @param defaultService initial {@code PrintService} to display + * @param flavor the flavor to be printed, or {@code null} + * @param attributes on input is the initial application supplied + * preferences. This cannot be {@code null} but may be empty. On + * output the attributes reflect changes made by the user. + * @return print service selected by the user, or {@code null} if the user + * cancelled the dialog + * @throws HeadlessException if {@code GraphicsEnvironment.isHeadless()} + * returns {@code true} + * @throws IllegalArgumentException if services is {@code null} or empty, or + * attributes is {@code null}, or the initial {@code PrintService} + * is not in the list of browsable services */ @SuppressWarnings("deprecation") public static PrintService printDialog(GraphicsConfiguration gc, @@ -220,8 +215,8 @@ // check if dialog exceed window bounds at left or bottom // Then position the dialog by moving it by the amount it exceeds // the window bounds - // If it results in dialog moving beyond the window bounds at top/left - // then position it at window top/left + // If it results in dialog moving beyond the window bounds at + // top/left then position it at window top/left if (dlgBounds.x + dlgBounds.width > gcBounds.x + gcBounds.width) { if ((gcBounds.x + gcBounds.width - dlgBounds.width) > gcBounds.x) { x = (gcBounds.x + gcBounds.width) - dlgBounds.width; @@ -315,8 +310,8 @@ */ /** - * Removes any attributes from the given AttributeSet that are - * unsupported by the given PrintService/DocFlavor combination. + * Removes any attributes from the given {@code AttributeSet} that are + * unsupported by the given {@code PrintService/DocFlavor} combination. */ private static void removeUnsupportedAttributes(PrintService ps, DocFlavor flavor, diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/ServiceUIFactory.java --- a/jdk/src/java.desktop/share/classes/javax/print/ServiceUIFactory.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/ServiceUIFactory.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -26,21 +26,20 @@ package javax.print; /** - * Services may optionally provide UIs which allow different styles - * of interaction in different roles. - * One role may be end-user browsing and setting of print options. - * Another role may be administering the print service. + * Services may optionally provide UIs which allow different styles of + * interaction in different roles. One role may be end-user browsing and setting + * of print options. Another role may be administering the print service. *

    * Although the Print Service API does not presently provide standardised - * support for administering a print service, monitoring of the print - * service is possible and a UI may provide for private update mechanisms. + * support for administering a print service, monitoring of the print service is + * possible and a UI may provide for private update mechanisms. *

    * The basic design intent is to allow applications to lazily locate and - * initialize services only when needed without any API dependencies - * except in an environment in which they are used. + * initialize services only when needed without any API dependencies except in + * an environment in which they are used. *

    - * Swing UIs are preferred as they provide a more consistent {@literal L&F} - * and can support accessibility APIs. + * Swing UIs are preferred as they provide a more consistent {@literal L&F} and + * can support accessibility APIs. *

    * Example usage: *

    @@ -55,34 +54,29 @@
      *  }
      * 
    */ - public abstract class ServiceUIFactory { /** - * Denotes a UI implemented as a Swing component. - * The value of the String is the fully qualified classname : - * "javax.swing.JComponent". + * Denotes a UI implemented as a Swing component. The value of the string is + * the fully qualified classname : "javax.swing.JComponent". */ public static final String JCOMPONENT_UI = "javax.swing.JComponent"; /** - * Denotes a UI implemented as an AWT panel. - * The value of the String is the fully qualified classname : - * "java.awt.Panel" + * Denotes a UI implemented as an AWT panel. The value of the string is the + * fully qualified classname : "java.awt.Panel" */ public static final String PANEL_UI = "java.awt.Panel"; /** - * Denotes a UI implemented as an AWT dialog. - * The value of the String is the fully qualified classname : - * "java.awt.Dialog" + * Denotes a UI implemented as an AWT dialog. The value of the string is the + * fully qualified classname : "java.awt.Dialog" */ public static final String DIALOG_UI = "java.awt.Dialog"; /** - * Denotes a UI implemented as a Swing dialog. - * The value of the String is the fully qualified classname : - * "javax.swing.JDialog" + * Denotes a UI implemented as a Swing dialog. The value of the string is + * the fully qualified classname : "javax.swing.JDialog" */ public static final String JDIALOG_UI = "javax.swing.JDialog"; @@ -102,41 +96,38 @@ public static final int MAIN_UIROLE = 3; /** - * Not a valid role but role id's greater than this may be used - * for private roles supported by a service. Knowledge of the - * function performed by this role is required to make proper use - * of it. + * Not a valid role but role id's greater than this may be used for private + * roles supported by a service. Knowledge of the function performed by this + * role is required to make proper use of it. */ public static final int RESERVED_UIROLE = 99; + /** - * Get a UI object which may be cast to the requested UI type - * by the application and used in its user interface. + * Get a UI object which may be cast to the requested UI type by the + * application and used in its user interface. * - * @param role requested. Must be one of the standard roles or - * a private role supported by this factory. - * @param ui type in which the role is requested. - * @return the UI role or null if the requested UI role is not available - * from this factory - * @throws IllegalArgumentException if the role or ui is neither - * one of the standard ones, nor a private one - * supported by the factory. + * @param role requested. Must be one of the standard roles or a private + * role supported by this factory. + * @param ui type in which the role is requested + * @return the UI role or {@code null} if the requested UI role is not + * available from this factory + * @throws IllegalArgumentException if the role or ui is neither one of the + * standard ones, nor a private one supported by the factory */ public abstract Object getUI(int role, String ui) ; /** - * Given a UI role obtained from this factory obtain the UI - * types available from this factory which implement this role. - * The returned Strings should refer to the static variables defined - * in this class so that applications can use equality of reference - * ("=="). - * @param role to be looked up. + * Given a UI role obtained from this factory obtain the UI types available + * from this factory which implement this role. The returned {@code Strings} + * should refer to the static variables defined in this class so that + * applications can use equality of reference ("=="). + * + * @param role to be looked up * @return the UI types supported by this class for the specified role, - * null if no UIs are available for the role. - * @throws IllegalArgumentException is the role is a non-standard - * role not supported by this factory. + * {@code null} if no UIs are available for the role + * @throws IllegalArgumentException is the role is a non-standard role not + * supported by this factory */ public abstract String[] getUIClassNamesForRole(int role) ; - - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/SimpleDoc.java --- a/jdk/src/java.desktop/share/classes/javax/print/SimpleDoc.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/SimpleDoc.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, 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 @@ -27,60 +27,76 @@ import java.io.ByteArrayInputStream; import java.io.CharArrayReader; -import java.io.StringReader; +import java.io.IOException; import java.io.InputStream; -import java.io.IOException; import java.io.Reader; +import java.io.StringReader; + import javax.print.attribute.AttributeSetUtilities; import javax.print.attribute.DocAttributeSet; /** - * This class is an implementation of interface {@code Doc} that can - * be used in many common printing requests. - * It can handle all of the presently defined "pre-defined" doc flavors - * defined as static variables in the DocFlavor class. + * This class is an implementation of interface {@code Doc} that can be used in + * many common printing requests. It can handle all of the presently defined + * "pre-defined" doc flavors defined as static variables in the + * {@code DocFlavor} class. *

    * In particular this class implements certain required semantics of the - * Doc specification as follows: + * {@code Doc} specification as follows: *

      - *
    • constructs a stream for the service if requested and appropriate. - *
    • ensures the same object is returned for each call on a method. - *
    • ensures multiple threads can access the Doc - *
    • performs some validation of that the data matches the doc flavor. + *
    • constructs a stream for the service if requested and appropriate. + *
    • ensures the same object is returned for each call on a method. + *
    • ensures multiple threads can access the {@code Doc} + *
    • performs some validation of that the data matches the doc flavor. *
    - * Clients who want to re-use the doc object in other jobs, - * or need a MultiDoc will not want to use this class. + * Clients who want to re-use the doc object in other jobs, or need a + * {@code MultiDoc} will not want to use this class. *

    - * If the print data is a stream, or a print job requests data as a - * stream, then {@code SimpleDoc} does not monitor if the service - * properly closes the stream after data transfer completion or job - * termination. - * Clients may prefer to use provide their own implementation of doc that - * adds a listener to monitor job completion and to validate that - * resources such as streams are freed (ie closed). + * If the print data is a stream, or a print job requests data as a stream, then + * {@code SimpleDoc} does not monitor if the service properly closes the stream + * after data transfer completion or job termination. Clients may prefer to use + * provide their own implementation of doc that adds a listener to monitor job + * completion and to validate that resources such as streams are freed (ie + * closed). */ - public final class SimpleDoc implements Doc { + /** + * The doc flavor in which this doc will supply its piece of print data. + */ private DocFlavor flavor; + + /** + * The set of printing attributes for this doc. + */ private DocAttributeSet attributes; + + /** + * The print data. + */ private Object printData; + + /** + * The reader for extracting character print data from this doc. + */ private Reader reader; + + /** + * The input stream for extracting byte print data from this doc. + */ private InputStream inStream; /** - * Constructs a {@code SimpleDoc} with the specified - * print data, doc flavor and doc attribute set. - * @param printData the print data object - * @param flavor the {@code DocFlavor} object - * @param attributes a {@code DocAttributeSet}, which can - * be {@code null} - * @throws IllegalArgumentException if {@code flavor} or - * {@code printData} is {@code null}, or the - * {@code printData} does not correspond - * to the specified doc flavor--for example, the data is - * not of the type specified as the representation in the - * {@code DocFlavor}. + * Constructs a {@code SimpleDoc} with the specified print data, doc flavor + * and doc attribute set. + * + * @param printData the print data object + * @param flavor the {@code DocFlavor} object + * @param attributes a {@code DocAttributeSet}, which can be {@code null} + * @throws IllegalArgumentException if {@code flavor} or {@code printData} + * is {@code null}, or the {@code printData} does not correspond to + * the specified doc flavor--for example, the data is not of the + * type specified as the representation in the {@code DocFlavor} */ public SimpleDoc(Object printData, DocFlavor flavor, DocAttributeSet attributes) { @@ -110,11 +126,11 @@ this.printData = printData; } - /** - * Determines the doc flavor in which this doc object will supply its - * piece of print data. + /** + * Determines the doc flavor in which this doc object will supply its piece + * of print data. * - * @return Doc flavor. + * @return doc flavor */ public DocFlavor getDocFlavor() { return flavor; @@ -123,67 +139,60 @@ /** * Obtains the set of printing attributes for this doc object. If the * returned attribute set includes an instance of a particular attribute - * X, the printer must use that attribute value for this doc, - * overriding any value of attribute X in the job's attribute set. - * If the returned attribute set does not include an instance - * of a particular attribute X or if null is returned, the printer - * must consult the job's attribute set to obtain the value for - * attribute X, and if not found there, the printer must use an + * X, the printer must use that attribute value for this doc, + * overriding any value of attribute X in the job's attribute set. If + * the returned attribute set does not include an instance of a particular + * attribute X or if {@code null} is returned, the printer must + * consult the job's attribute set to obtain the value for attribute + * X, and if not found there, the printer must use an * implementation-dependent default value. The returned attribute set is * unmodifiable. * - * @return Unmodifiable set of printing attributes for this doc, or null - * to obtain all attribute values from the job's attribute - * set. + * @return unmodifiable set of printing attributes for this doc, or + * {@code null} to obtain all attribute values from the job's + * attribute set */ public DocAttributeSet getAttributes() { return attributes; } - /* + /** * Obtains the print data representation object that contains this doc - * object's piece of print data in the format corresponding to the - * supported doc flavor. - * The {@code getPrintData()} method returns an instance of - * the representation class whose name is given by - * {@link DocFlavor#getRepresentationClassName() getRepresentationClassName}, - * and the return value can be cast - * from class Object to that representation class. + * object's piece of print data in the format corresponding to the supported + * doc flavor. The {@code getPrintData()} method returns an instance of the + * representation class whose name is given by {@link #getDocFlavor() + * getDocFlavor()}.{@link DocFlavor#getRepresentationClassName() + * getRepresentationClassName()}, and the return value can be cast from + * class {@code Object} to that representation class. * - * @return Print data representation object. - * - * @exception IOException if the representation class is a stream and - * there was an I/O error while constructing the stream. + * @return print data representation object + * @throws IOException if the representation class is a stream and there was + * an I/O error while constructing the stream */ public Object getPrintData() throws IOException { return printData; } /** - * Obtains a reader for extracting character print data from this doc. - * The {@code Doc} implementation is required to support this - * method if the {@code DocFlavor} has one of the following print - * data representation classes, and return {@code null} - * otherwise: - *

      - *
    • {@code char[]} - *
    • {@code java.lang.String} - *
    • {@code java.io.Reader} - *
    + * Obtains a reader for extracting character print data from this doc. The + * {@code Doc} implementation is required to support this method if the + * {@code DocFlavor} has one of the following print data representation + * classes, and return {@code null} otherwise: + *
      + *
    • {@code char[]} + *
    • {@code java.lang.String} + *
    • {@code java.io.Reader} + *
    * The doc's print data representation object is used to construct and - * return a {@code Reader} for reading the print data as a stream - * of characters from the print data representation object. - * However, if the print data representation object is itself a - * {@code Reader} then the print data representation object is - * simply returned. + * return a {@code Reader} for reading the print data as a stream of + * characters from the print data representation object. However, if the + * print data representation object is itself a {@code Reader} then the + * print data representation object is simply returned. * - * @return a {@code Reader} for reading the print data - * characters from this doc. - * If a reader cannot be provided because this doc does not meet - * the criteria stated above, {@code null} is returned. - * - * @exception IOException if there was an I/O error while creating - * the reader. + * @return a {@code Reader} for reading the print data characters from this + * doc. If a reader cannot be provided because this doc does not + * meet the criteria stated above, {@code null} is returned. + * @throws IOException if there was an I/O error while creating the reader */ public Reader getReaderForText() throws IOException { @@ -207,31 +216,25 @@ } /** - * Obtains an input stream for extracting byte print data from - * this doc. - * The {@code Doc} implementation is required to support this - * method if the {@code DocFlavor} has one of the following print - * data representation classes; otherwise this method - * returns {@code null}: - *
      - *
    • {@code byte[]} - *
    • {@code java.io.InputStream} - *
    - * The doc's print data representation object is obtained. Then, an - * input stream for reading the print data - * from the print data representation object as a stream of bytes is - * created and returned. - * However, if the print data representation object is itself an - * input stream then the print data representation object is simply - * returned. + * Obtains an input stream for extracting byte print data from this doc. The + * {@code Doc} implementation is required to support this method if the + * {@code DocFlavor} has one of the following print data representation + * classes; otherwise this method returns {@code null}: + *
      + *
    • {@code byte[]} + *
    • {@code java.io.InputStream} + *
    + * The doc's print data representation object is obtained. Then, an input + * stream for reading the print data from the print data representation + * object as a stream of bytes is created and returned. However, if the + * print data representation object is itself an input stream then the print + * data representation object is simply returned. * - * @return an {@code InputStream} for reading the print data - * bytes from this doc. If an input stream cannot be - * provided because this doc does not meet - * the criteria stated above, {@code null} is returned. - * - * @exception IOException - * if there was an I/O error while creating the input stream. + * @return an {@code InputStream} for reading the print data bytes from this + * doc. If an input stream cannot be provided because this doc does + * not meet the criteria stated above, {@code null} is returned. + * @throws IOException if there was an I/O error while creating the input + * stream */ public InputStream getStreamForBytes() throws IOException { @@ -250,5 +253,4 @@ } return inStream; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/StreamPrintService.java --- a/jdk/src/java.desktop/share/classes/javax/print/StreamPrintService.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/StreamPrintService.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -28,43 +28,47 @@ import java.io.OutputStream; /** - * This class extends {@link PrintService} and represents a - * print service that prints data in different formats to a - * client-provided output stream. - * This is principally intended for services where - * the output format is a document type suitable for viewing - * or archiving. - * The output format must be declared as a mime type. - * This is equivalent to an output document flavor where the - * representation class is always "java.io.OutputStream" - * An instance of the {@code StreamPrintService} class is - * obtained from a {@link StreamPrintServiceFactory} instance. + * This class extends {@link PrintService} and represents a print service that + * prints data in different formats to a client-provided output stream. This is + * principally intended for services where the output format is a document type + * suitable for viewing or archiving. The output format must be declared as a + * mime type. This is equivalent to an output document flavor where the + * representation class is always "java.io.OutputStream" An instance of the + * {@code StreamPrintService} class is obtained from a + * {@link StreamPrintServiceFactory} instance. *

    * Note that a {@code StreamPrintService} is different from a * {@code PrintService}, which supports a - * {@link javax.print.attribute.standard.Destination Destination} - * attribute. A {@code StreamPrintService} always requires an output - * stream, whereas a {@code PrintService} optionally accepts a - * {@code Destination}. A {@code StreamPrintService} - * has no default destination for its formatted output. - * Additionally a {@code StreamPrintService} is expected to generate -output in - * a format useful in other contexts. - * StreamPrintService's are not expected to support the Destination attribute. + * {@link javax.print.attribute.standard.Destination Destination} attribute. A + * {@code StreamPrintService} always requires an output stream, whereas a + * {@code PrintService} optionally accepts a {@code Destination}. A + * {@code StreamPrintService} has no default destination for its formatted + * output. Additionally a {@code StreamPrintService} is expected to generate + * output in a format useful in other contexts. {@code StreamPrintService}'s are + * not expected to support the {@code Destination} attribute. */ - public abstract class StreamPrintService implements PrintService { + /** + * The output stream to which this service will send formatted print data. + */ private OutputStream outStream; + + /** + * Whether or not this {@code StreamPrintService} has been disposed. + */ private boolean disposed = false; + /** + * Constructs a {@code StreamPrintService} object. + */ private StreamPrintService() { }; /** - * Constructs a StreamPrintService object. + * Constructs a {@code StreamPrintService} object. * - * @param out stream to which to send formatted print data. + * @param out stream to which to send formatted print data */ protected StreamPrintService(OutputStream out) { this.outStream = out; @@ -73,42 +77,44 @@ /** * Gets the output stream. * - * @return the stream to which this service will send formatted print data. + * @return the stream to which this service will send formatted print data */ public OutputStream getOutputStream() { return outStream; } /** - * Returns the document format emitted by this print service. - * Must be in mimetype format, compatible with the mime type - * components of DocFlavors @see DocFlavor. - * @return mime type identifying the output format. + * Returns the document format emitted by this print service. Must be in + * mimetype format, compatible with the mime type components of + * {@code DocFlavors} + * + * @return mime type identifying the output format + * @see DocFlavor */ public abstract String getOutputFormat(); /** - * Disposes this {@code StreamPrintService}. - * If a stream service cannot be re-used, it must be disposed - * to indicate this. Typically the client will call this method. - * Services which write data which cannot meaningfully be appended to - * may also dispose the stream. This does not close the stream. It - * just marks it as not for further use by this service. + * Disposes this {@code StreamPrintService}. If a stream service cannot be + * re-used, it must be disposed to indicate this. Typically the client will + * call this method. Services which write data which cannot meaningfully be + * appended to may also dispose the stream. This does not close the stream. + * It just marks it as not for further use by this service. */ public void dispose() { disposed = true; } /** - * Returns a {@code boolean} indicating whether or not - * this {@code StreamPrintService} has been disposed. - * If this object has been disposed, will return true. - * Used by services and client applications to recognize streams - * to which no further data should be written. - * @return if this {@code StreamPrintService} has been disposed + * Returns a {@code boolean} indicating whether or not this + * {@code StreamPrintService} has been disposed. If this object has been + * disposed, will return {@code true}. Used by services and client + * applications to recognize streams to which no further data should be + * written. + * + * @return {@code true} if this {@code StreamPrintService} has been + * disposed; {@code false} otherwise */ public boolean isDisposed() { return disposed; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/StreamPrintServiceFactory.java --- a/jdk/src/java.desktop/share/classes/javax/print/StreamPrintServiceFactory.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/StreamPrintServiceFactory.java Sat Sep 09 14:36:45 2017 +0200 @@ -26,40 +26,48 @@ package javax.print; import java.io.OutputStream; - import java.util.ArrayList; import java.util.Iterator; +import java.util.ServiceConfigurationError; +import java.util.ServiceLoader; -import javax.print.DocFlavor; +import javax.print.attribute.PrintRequestAttributeSet; import sun.awt.AppContext; -import java.util.ServiceLoader; -import java.util.ServiceConfigurationError; /** * A {@code StreamPrintServiceFactory} is the factory for - * {@link StreamPrintService} instances, - * which can print to an output stream in a particular - * document format described as a mime type. - * A typical output document format may be Postscript(TM). + * {@link StreamPrintService} instances, which can print to an output stream in + * a particular document format described as a mime type. A typical output + * document format may be Postscript(TM). *

    - * This class is implemented by a service and located by the - * implementation using the {@link java.util.ServiceLoader} facility. + * This class is implemented by a service and located by the implementation + * using the {@link ServiceLoader} facility. *

    * Applications locate instances of this class by calling the * {@link #lookupStreamPrintServiceFactories(DocFlavor, String)} method. *

    - * Applications can use a {@code StreamPrintService} obtained from a - * factory in place of a {@code PrintService} which represents a - * physical printer device. + * Applications can use a {@code StreamPrintService} obtained from a factory in + * place of a {@code PrintService} which represents a physical printer device. */ - public abstract class StreamPrintServiceFactory { + /** + * Contains a list of factories. + */ static class Services { + + /** + * The list of factories which will be stored per appcontext. + */ private ArrayList listOfFactories = null; } + /** + * Returns the services from the current appcontext. + * + * @return the services + */ private static Services getServices() { Services services = (Services)AppContext.getAppContext().get(Services.class); @@ -70,10 +78,20 @@ return services; } + /** + * Returns the list of factories. + * + * @return the list of factories + */ private static ArrayList getListOfFactories() { return getServices().listOfFactories; } + /** + * Initialize the list of factories. + * + * @return the list of factories + */ private static ArrayList initListOfFactories() { ArrayList listOfFactories = new ArrayList<>(); getServices().listOfFactories = listOfFactories; @@ -81,26 +99,26 @@ } /** - * Locates factories for print services that can be used with - * a print job to output a stream of data in the - * format specified by {@code outputMimeType}. + * Locates factories for print services that can be used with a print job to + * output a stream of data in the format specified by + * {@code outputMimeType}. *

    - * The {@code outputMimeType} parameter describes the document type that - * you want to create, whereas the {@code flavor} parameter describes the - * format in which the input data will be provided by the application - * to the {@code StreamPrintService}. + * The {@code outputMimeType} parameter describes the document type that you + * want to create, whereas the {@code flavor} parameter describes the format + * in which the input data will be provided by the application to the + * {@code StreamPrintService}. *

    - * Although null is an acceptable value to use in the lookup of stream - * printing services, it's typical to search for a particular - * desired format, such as Postscript(TM). + * Although {@code null} is an acceptable value to use in the lookup of + * stream printing services, it's typical to search for a particular desired + * format, such as Postscript(TM). * - * @param flavor of the input document type - null means match all - * types. - * @param outputMimeType representing the required output format, used to - * identify suitable stream printer factories. A value of null means - * match all formats. - * @return matching factories for stream print service instance, - * empty if no suitable factories could be located. + * @param flavor of the input document type - {@code null} means match all + * types + * @param outputMimeType representing the required output format, used to + * identify suitable stream printer factories. A value of + * {@code null} means match all formats. + * @return matching factories for stream print service instance, empty if no + * suitable factories could be located */ public static StreamPrintServiceFactory[] lookupStreamPrintServiceFactories(DocFlavor flavor, @@ -110,55 +128,56 @@ return list.toArray(new StreamPrintServiceFactory[list.size()]); } - /** Queries the factory for the document format that is emitted - * by printers obtained from this factory. + /** + * Queries the factory for the document format that is emitted by printers + * obtained from this factory. * - * @return the output format described as a mime type. + * @return the output format described as a mime type */ public abstract String getOutputFormat(); /** - * Queries the factory for the document flavors that can be accepted - * by printers obtained from this factory. - * @return array of supported doc flavors. + * Queries the factory for the document flavors that can be accepted by + * printers obtained from this factory. + * + * @return array of supported doc flavors */ public abstract DocFlavor[] getSupportedDocFlavors(); /** - * Returns a {@code StreamPrintService} that can print to - * the specified output stream. - * The output stream is created and managed by the application. - * It is the application's responsibility to close the stream and - * to ensure that this Printer is not reused. - * The application should not close this stream until any print job - * created from the printer is complete. Doing so earlier may generate - * a {@code PrinterException} and an event indicating that the - * job failed. + * Returns a {@code StreamPrintService} that can print to the specified + * output stream. The output stream is created and managed by the + * application. It is the application's responsibility to close the stream + * and to ensure that this {@code Printer} is not reused. The application + * should not close this stream until any print job created from the printer + * is complete. Doing so earlier may generate a {@code PrinterException} and + * an event indicating that the job failed. *

    - * Whereas a {@code PrintService} connected to a physical printer - * can be reused, - * a {@code StreamPrintService} connected to a stream cannot. - * The underlying {@code StreamPrintService} may be disposed by - * the print system with - * the {@link StreamPrintService#dispose() dispose} method - * before returning from the - * {@link DocPrintJob#print(Doc, javax.print.attribute.PrintRequestAttributeSet) print} - * method of {@code DocPrintJob} so that the print system knows - * this printer is no longer usable. - * This is equivalent to a physical printer going offline - permanently. - * Applications may supply a null print stream to create a queryable - * service. It is not valid to create a PrintJob for such a stream. - * Implementations which allocate resources on construction should examine - * the stream and may wish to only allocate resources if the stream is - * non-null. + * Whereas a {@code PrintService} connected to a physical printer can be + * reused, a {@code StreamPrintService} connected to a stream cannot. The + * underlying {@code StreamPrintService} may be disposed by the print system + * with the {@link StreamPrintService#dispose() dispose} method before + * returning from the + * {@link DocPrintJob#print(Doc, PrintRequestAttributeSet) print} method of + * {@code DocPrintJob} so that the print system knows this printer is no + * longer usable. This is equivalent to a physical printer going offline - + * permanently. Applications may supply a {@code null} print stream to + * create a queryable service. It is not valid to create a {@code PrintJob} + * for such a stream. Implementations which allocate resources on + * construction should examine the stream and may wish to only allocate + * resources if the stream is {@code non-null}. * - * @param out destination stream for generated output. - * @return a PrintService which will generate the format specified by the - * DocFlavor supported by this Factory. + * @param out destination stream for generated output + * @return a {@code PrintService} which will generate the format specified + * by the {@code DocFlavor} supported by this factory */ public abstract StreamPrintService getPrintService(OutputStream out); - + /** + * Returns all factories for print services. + * + * @return all factories + */ private static ArrayList getAllFactories() { synchronized (StreamPrintServiceFactory.class) { @@ -198,6 +217,15 @@ } } + /** + * Checks if the array of {@code flavors} contains the {@code flavor} + * object. + * + * @param flavor the flavor + * @param flavors the array of flavors + * @return {@code true} if {@code flavors} contains the {@code flavor} + * object; {@code false} otherwise + */ private static boolean isMember(DocFlavor flavor, DocFlavor[] flavors) { for (int f=0; f + * Locates factories for print services that can be used with a print job to + * output a stream of data in the format specified by + * {@code outputMimeType}. + * + * @param flavor of the input document type - {@code null} means match all + * types + * @param outType representing the required output format, used to identify + * suitable stream printer factories. A value of {@code null} means + * match all formats. + * @return matching factories for stream print service instance, empty if no + * suitable factories could be located + */ private static ArrayList getFactories(DocFlavor flavor, String outType) { if (flavor == null && outType == null) { @@ -227,5 +270,4 @@ return list; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/URIException.java --- a/jdk/src/java.desktop/share/classes/javax/print/URIException.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/URIException.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -28,46 +28,45 @@ import java.net.URI; /** - * Interface URIException is a mixin interface which a subclass of {@link - * PrintException PrintException} can implement to report an error condition - * involving a URI address. The Print Service API does not define any print - * exception classes that implement interface URIException, that being left to - * the Print Service implementor's discretion. - * + * Interface {@code URIException} is a mixin interface which a subclass of + * {@link PrintException PrintException} can implement to report an error + * condition involving a {@code URI} address. The Print Service API does not + * define any print exception classes that implement interface + * {@code URIException}, that being left to the Print Service implementor's + * discretion. */ - public interface URIException { /** - * Indicates that the printer cannot access the URI address. - * For example, the printer might report this error if it goes to get - * the print data and cannot even establish a connection to the - * URI address. + * Indicates that the printer cannot access the {@code URI} address. For + * example, the printer might report this error if it goes to get the print + * data and cannot even establish a connection to the {@code URI} address. */ public static final int URIInaccessible = 1; /** - * Indicates that the printer does not support the URI - * scheme ("http", "ftp", etc.) in the URI address. + * Indicates that the printer does not support the {@code URI} scheme + * ("http", "ftp", etc.) in the {@code URI} address. */ public static final int URISchemeNotSupported = 2; /** - * Indicates any kind of problem not specifically identified - * by the other reasons. + * Indicates any kind of problem not specifically identified by the other + * reasons. */ public static final int URIOtherProblem = -1; /** - * Return the URI. - * @return the URI that is the cause of this exception. + * Returns the {@code URI}. + * + * @return the {@code URI} that is the cause of this exception */ public URI getUnsupportedURI(); /** - * Return the reason for the event. - * @return one of the predefined reasons enumerated in this interface. + * Returns the reason of this exception. + * + * @return one of the predefined reasons enumerated in this interface */ public int getReason(); - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/Attribute.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/Attribute.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/Attribute.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -28,35 +28,34 @@ import java.io.Serializable; /** - * Interface Attribute is the base interface implemented by any and every - * printing attribute class to indicate that the class represents a + * Interface {@code Attribute} is the base interface implemented by any and + * every printing attribute class to indicate that the class represents a * printing attribute. All printing attributes are serializable. * - * @author David Mendenhall - * @author Alan Kaminsky + * @author David Mendenhall + * @author Alan Kaminsky */ public interface Attribute extends Serializable { - /** - * Get the printing attribute class which is to be used as the "category" - * for this printing attribute value when it is added to an attribute set. - * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. - */ - public Class getCategory(); + /** + * Get the printing attribute class which is to be used as the "category" + * for this printing attribute value when it is added to an attribute set. + * + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} + */ + public Class getCategory(); - /** - * Get the name of the category of which this attribute value is an - * instance. - *

    - * Note: This method is intended to provide a default, nonlocalized - * string for the attribute's category. If two attribute objects return the - * same category from the {@code getCategory()} method, they should - * return the same name from the {@code getName()} method. - * - * @return Attribute category name. - */ - public String getName(); - + /** + * Get the name of the category of which this attribute value is an + * instance. + *

    + * Note: This method is intended to provide a default, nonlocalized + * string for the attribute's category. If two attribute objects return the + * same category from the {@code getCategory()} method, they should return + * the same name from the {@code getName()} method. + * + * @return attribute category name + */ + public String getName(); } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/AttributeSet.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/AttributeSet.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/AttributeSet.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -26,284 +26,240 @@ package javax.print.attribute; /** - * Interface AttributeSet specifies the interface for a set of printing + * Interface {@code AttributeSet} specifies the interface for a set of printing * attributes. A printing attribute is an object whose class implements * interface {@link Attribute Attribute}. - *

    - * An attribute set contains a group of attribute values, - * where duplicate values are not allowed in the set. - * Furthermore, each value in an attribute set is - * a member of some category, and at most one value in any particular - * category is allowed in the set. For an attribute set, the values are {@link - * Attribute Attribute} objects, and the categories are {@link java.lang.Class - * Class} objects. An attribute's category is the class (or interface) at the - * root of the class hierarchy for that kind of attribute. Note that an - * attribute object's category may be a superclass of the attribute object's - * class rather than the attribute object's class itself. An attribute - * object's - * category is determined by calling the {@link Attribute#getCategory() - * getCategory()} method defined in interface {@link Attribute - * Attribute}. - *

    - * The interfaces of an AttributeSet resemble those of the Java Collections - * API's java.util.Map interface, but is more restrictive in the types - * it will accept, and combines keys and values into an Attribute. - *

    - * Attribute sets are used in several places in the Print Service API. In - * each context, only certain kinds of attributes are allowed to appear in the + *

    + * An attribute set contains a group of attribute values, where duplicate + * values are not allowed in the set. Furthermore, each value in an attribute + * set is a member of some category, and at most one value in any + * particular category is allowed in the set. For an attribute set, the values + * are {@link Attribute Attribute} objects, and the categories are + * {@link Class Class} objects. An attribute's category is the class (or + * interface) at the root of the class hierarchy for that kind of attribute. + * Note that an attribute object's category may be a superclass of the attribute + * object's class rather than the attribute object's class itself. An attribute + * object's category is determined by calling the + * {@link Attribute#getCategory() getCategory()} method defined in interface + * {@link Attribute Attribute}. + *

    + * The interfaces of an {@code AttributeSet} resemble those of the Java + * Collections API's {@code java.util.Map} interface, but is more restrictive in + * the types it will accept, and combines keys and values into an + * {@code Attribute}. + *

    + * Attribute sets are used in several places in the Print Service API. In each + * context, only certain kinds of attributes are allowed to appear in the * attribute set, as determined by the tagging interfaces which the attribute - * class implements -- {@link DocAttribute DocAttribute}, {@link - * PrintRequestAttribute PrintRequestAttribute}, {@link PrintJobAttribute - * PrintJobAttribute}, and {@link PrintServiceAttribute - * PrintServiceAttribute}. + * class implements -- {@link DocAttribute DocAttribute}, + * {@link PrintRequestAttribute PrintRequestAttribute}, + * {@link PrintJobAttribute PrintJobAttribute}, and + * {@link PrintServiceAttribute PrintServiceAttribute}. * There are four specializations of an attribute set that are restricted to - * contain just one of the four kinds of attribute -- {@link DocAttributeSet - * DocAttributeSet}, {@link PrintRequestAttributeSet - * PrintRequestAttributeSet}, - * {@link PrintJobAttributeSet PrintJobAttributeSet}, and {@link - * PrintServiceAttributeSet PrintServiceAttributeSet}, respectively. Note that - * many attribute classes implement more than one tagging interface and so may - * appear in more than one context. - *

      - *
    • - * A {@link DocAttributeSet DocAttributeSet}, containing {@link DocAttribute - * DocAttribute}s, specifies the characteristics of an individual doc and the - * print job settings to be applied to an individual doc. - * - *
    • - * A {@link PrintRequestAttributeSet PrintRequestAttributeSet}, containing - * {@link PrintRequestAttribute PrintRequestAttribute}s, specifies the - * settings - * to be applied to a whole print job and to all the docs in the print job. - * - *
    • - * A {@link PrintJobAttributeSet PrintJobAttributeSet}, containing {@link - * PrintJobAttribute PrintJobAttribute}s, reports the status of a print job. - * - *
    • - * A {@link PrintServiceAttributeSet PrintServiceAttributeSet}, containing - * {@link PrintServiceAttribute PrintServiceAttribute}s, reports the status of - * a Print Service instance. - *
    - *

    + * contain just one of the four kinds of attribute -- + * {@link DocAttributeSet DocAttributeSet}, + * {@link PrintRequestAttributeSet PrintRequestAttributeSet}, + * {@link PrintJobAttributeSet PrintJobAttributeSet}, and + * {@link PrintServiceAttributeSet PrintServiceAttributeSet}, respectively. Note + * that many attribute classes implement more than one tagging interface and so + * may appear in more than one context. + *

      + *
    • A {@link DocAttributeSet DocAttributeSet}, containing + * {@link DocAttribute DocAttribute}s, specifies the characteristics of an + * individual doc and the print job settings to be applied to an individual + * doc. + *
    • A {@link PrintRequestAttributeSet PrintRequestAttributeSet}, containing + * {@link PrintRequestAttribute PrintRequestAttribute}s, specifies the + * settings to be applied to a whole print job and to all the docs in the + * print job. + *
    • A {@link PrintJobAttributeSet PrintJobAttributeSet}, containing + * {@link PrintJobAttribute PrintJobAttribute}s, reports the status of a print + * job. + *
    • A {@link PrintServiceAttributeSet PrintServiceAttributeSet}, containing + * {@link PrintServiceAttribute PrintServiceAttribute}s, reports the status of + * a Print Service instance. + *
    * In some contexts, the client is only allowed to examine an attribute set's * contents but not change them (the set is read-only). In other places, the * client is allowed both to examine and to change an attribute set's contents * (the set is read-write). For a read-only attribute set, calling a mutating - * operation throws an UnmodifiableSetException. - *

    + * operation throws an {@code UnmodifiableSetException}. + *

    * The Print Service API provides one implementation of interface - * AttributeSet, class {@link HashAttributeSet HashAttributeSet}. - * A client can use class {@link - * HashAttributeSet HashAttributeSet} or provide its own implementation of - * interface AttributeSet. The Print Service API also provides - * implementations of interface AttributeSet's subinterfaces -- classes {@link - * HashDocAttributeSet HashDocAttributeSet}, - * {@link HashPrintRequestAttributeSet - * HashPrintRequestAttributeSet}, {@link HashPrintJobAttributeSet - * HashPrintJobAttributeSet}, and {@link HashPrintServiceAttributeSet - * HashPrintServiceAttributeSet}. + * {@code AttributeSet}, class {@link HashAttributeSet HashAttributeSet}. A + * client can use class {@link HashAttributeSet HashAttributeSet} or provide its + * own implementation of interface {@code AttributeSet}. The Print Service API + * also provides implementations of interface {@code AttributeSet}'s + * subinterfaces -- classes + * {@link HashDocAttributeSet HashDocAttributeSet}, + * {@link HashPrintRequestAttributeSet HashPrintRequestAttributeSet}, + * {@link HashPrintJobAttributeSet HashPrintJobAttributeSet}, and + * {@link HashPrintServiceAttributeSet HashPrintServiceAttributeSet}. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public interface AttributeSet { - /** * Returns the attribute value which this attribute set contains in the - * given attribute category. Returns {@code null} if this attribute set - * does not contain any attribute value in the given attribute category. - * - * @param category Attribute category whose associated attribute value - * is to be returned. It must be a - * {@link java.lang.Class Class} - * that implements interface {@link Attribute - * Attribute}. + * given attribute category. Returns {@code null} if this attribute set does + * not contain any attribute value in the given attribute category. * - * @return The attribute value in the given attribute category contained - * in this attribute set, or {@code null} if this attribute set - * does not contain any attribute value in the given attribute - * category. - * - * @throws NullPointerException - * (unchecked exception) Thrown if the {@code category} is null. - * @throws ClassCastException - * (unchecked exception) Thrown if the {@code category} is not a - * {@link java.lang.Class Class} that implements interface {@link - * Attribute Attribute}. + * @param category attribute category whose associated attribute value is + * to be returned. It must be a {@link Class Class} that implements + * interface {@link Attribute Attribute}. + * @return the attribute value in the given attribute category contained in + * this attribute set, or {@code null} if this attribute set does + * not contain any attribute value in the given attribute category + * @throws NullPointerException if the {@code category} is {@code null} + * @throws ClassCastException if the {@code category} is not a + * {@link Class Class} that implements interface + * {@link Attribute Attribute} */ public Attribute get(Class category); /** - * Adds the specified attribute to this attribute set if it is not - * already present, first removing any existing value in the same - * attribute category as the specified attribute value. - * - * @param attribute Attribute value to be added to this attribute set. + * Adds the specified attribute to this attribute set if it is not already + * present, first removing any existing value in the same attribute category + * as the specified attribute value. * - * @return {@code true} if this attribute set changed as a result of the - * call, i.e., the given attribute value was not already a member - * of this attribute set. - * - * @throws NullPointerException - * (unchecked exception) Thrown if the {@code attribute} is null. - * @throws UnmodifiableSetException - * (unchecked exception) Thrown if this attribute set does not support - * the {@code add()} operation. + * @param attribute attribute value to be added to this attribute set + * @return {@code true} if this attribute set changed as a result of the + * call, i.e., the given attribute value was not already a member of + * this attribute set + * @throws NullPointerException if the {@code attribute} is {@code null} + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code add()} operation */ public boolean add(Attribute attribute); - /** * Removes any attribute for this category from this attribute set if - * present. If {@code category} is null, then - * {@code remove()} does nothing and returns {@code false}. - * - * @param category Attribute category to be removed from this - * attribute set. + * present. If {@code category} is {@code null}, then {@code remove()} does + * nothing and returns {@code false}. * - * @return {@code true} if this attribute set changed as a result of the + * @param category attribute category to be removed from this attribute set + * @return {@code true} if this attribute set changed as a result of the * call, i.e., the given attribute value had been a member of this - * attribute set. - * - * @throws UnmodifiableSetException - * (unchecked exception) Thrown if this attribute set does not support - * the {@code remove()} operation. + * attribute set + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code remove()} operation */ public boolean remove(Class category); /** - * Removes the specified attribute from this attribute set if - * present. If {@code attribute} is null, then - * {@code remove()} does nothing and returns {@code false}. - * - * @param attribute Attribute value to be removed from this attribute set. + * Removes the specified attribute from this attribute set if present. If + * {@code attribute} is {@code null}, then {@code remove()} does nothing and + * returns {@code false}. * - * @return {@code true} if this attribute set changed as a result of the + * @param attribute attribute value to be removed from this attribute set + * @return {@code true} if this attribute set changed as a result of the * call, i.e., the given attribute value had been a member of this - * attribute set. - * - * @throws UnmodifiableSetException - * (unchecked exception) Thrown if this attribute set does not support - * the {@code remove()} operation. + * attribute set + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code remove()} operation */ public boolean remove(Attribute attribute); /** - * Returns {@code true} if this attribute set contains an - * attribute for the specified category. + * Returns {@code true} if this attribute set contains an attribute for the + * specified category. * - * @param category whose presence in this attribute set is - * to be tested. - * - * @return {@code true} if this attribute set contains an attribute - * value for the specified category. + * @param category whose presence in this attribute set is to be tested + * @return {@code true} if this attribute set contains an attribute value + * for the specified category */ public boolean containsKey(Class category); /** - * Returns {@code true} if this attribute set contains the given - * attribute value. + * Returns {@code true} if this attribute set contains the given attribute + * value. * - * @param attribute Attribute value whose presence in this - * attribute set is to be tested. - * - * @return {@code true} if this attribute set contains the given - * attribute value. + * @param attribute attribute value whose presence in this attribute set is + * to be tested + * @return {@code true} if this attribute set contains the given attribute + * value */ public boolean containsValue(Attribute attribute); /** - * Adds all of the elements in the specified set to this attribute. - * The outcome is the same as if the = - * {@link #add(Attribute) add(Attribute)} + * Adds all of the elements in the specified set to this attribute. The + * outcome is the same as if the = {@link #add(Attribute) add(Attribute)} * operation had been applied to this attribute set successively with each - * element from the specified set. - * The behavior of the {@code addAll(AttributeSet)} - * operation is unspecified if the specified set is modified while - * the operation is in progress. - *

    - * If the {@code addAll(AttributeSet)} operation throws an exception, - * the effect on this attribute set's state is implementation dependent; - * elements from the specified set before the point of the exception may - * or may not have been added to this attribute set. + * element from the specified set. The behavior of the + * {@code addAll(AttributeSet)} operation is unspecified if the specified + * set is modified while the operation is in progress. + *

    + * If the {@code addAll(AttributeSet)} operation throws an exception, the + * effect on this attribute set's state is implementation dependent; + * elements from the specified set before the point of the exception may or + * may not have been added to this attribute set. * - * @param attributes whose elements are to be added to this attribute - * set. - * - * @return {@code true} if this attribute set changed as a result of the - * call. - * - * @throws UnmodifiableSetException - * (Unchecked exception) Thrown if this attribute set does not support - * the {@code addAll(AttributeSet)} method. - * @throws NullPointerException - * (Unchecked exception) Thrown if some element in the specified - * set is null. - * + * @param attributes whose elements are to be added to this attribute set + * @return {@code true} if this attribute set changed as a result of the + * call + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code addAll(AttributeSet)} method + * @throws NullPointerException if some element in the specified set is + * {@code null} * @see #add(Attribute) */ public boolean addAll(AttributeSet attributes); /** - * Returns the number of attributes in this attribute set. If this - * attribute set contains more than {@code Integer.MAX_VALUE} elements, - * returns {@code Integer.MAX_VALUE}. + * Returns the number of attributes in this attribute set. If this attribute + * set contains more than {@code Integer.MAX_VALUE} elements, returns + * {@code Integer.MAX_VALUE}. * - * @return The number of attributes in this attribute set. + * @return the number of attributes in this attribute set */ public int size(); /** * Returns an array of the attributes contained in this set. - * @return the Attributes contained in this set as an array, zero length - * if the AttributeSet is empty. + * + * @return the {@code Attributes} contained in this set as an array, zero + * length if the {@code AttributeSet} is empty */ public Attribute[] toArray(); - /** * Removes all attributes from this attribute set. * - * @throws UnmodifiableSetException - * (unchecked exception) Thrown if this attribute set does not support - * the {@code clear()} operation. + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code clear()} operation */ public void clear(); /** - * Returns true if this attribute set contains no attributes. + * Returns {@code true} if this attribute set contains no attributes. * - * @return true if this attribute set contains no attributes. + * @return {@code true} if this attribute set contains no attributes */ public boolean isEmpty(); /** * Compares the specified object with this attribute set for equality. - * Returns {@code true} if the given object is also an attribute set and - * the two attribute sets contain the same attribute category-attribute - * value mappings. This ensures that the - * {@code equals()} method works properly across different - * implementations of the AttributeSet interface. + * Returns {@code true} if the given object is also an attribute set and the + * two attribute sets contain the same attribute category-attribute value + * mappings. This ensures that the {@code equals()} method works properly + * across different implementations of the {@code AttributeSet} interface. * - * @param object to be compared for equality with this attribute set. - * - * @return {@code true} if the specified object is equal to this - * attribute set. + * @param object to be compared for equality with this attribute set + * @return {@code true} if the specified object is equal to this attribute + * set */ public boolean equals(Object object); /** * Returns the hash code value for this attribute set. The hash code of an - * attribute set is defined to be the sum of the hash codes of each entry - * in the AttributeSet. - * This ensures that {@code t1.equals(t2)} implies that - * {@code t1.hashCode()==t2.hashCode()} for any two attribute sets + * attribute set is defined to be the sum of the hash codes of each entry in + * the {@code AttributeSet}. This ensures that {@code t1.equals(t2)} implies + * that {@code t1.hashCode()==t2.hashCode()} for any two attribute sets * {@code t1} and {@code t2}, as required by the general contract of - * {@link java.lang.Object#hashCode() Object.hashCode()}. + * {@link Object#hashCode() Object.hashCode()}. * - * @return The hash code value for this attribute set. + * @return the hash code value for this attribute set */ public int hashCode(); - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/AttributeSetUtilities.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/AttributeSetUtilities.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/AttributeSetUtilities.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,65 +23,75 @@ * questions. */ - package javax.print.attribute; import java.io.Serializable; /** - * Class AttributeSetUtilities provides static methods for manipulating - * AttributeSets. + * Class {@code AttributeSetUtilities} provides static methods for manipulating + * {@code AttributeSets}. *

      - *
    • Methods for creating unmodifiable and synchronized views of attribute - * sets. - *
    • operations useful for building - * implementations of interface {@link AttributeSet AttributeSet} + *
    • Methods for creating unmodifiable and synchronized views of attribute + * sets. + *
    • operations useful for building implementations of interface + * {@link AttributeSet AttributeSet} *
    - *

    - * An unmodifiable view U of an AttributeSet S provides a - * client with "read-only" access to S. Query operations on U - * "read through" to S; thus, changes in S are reflected in - * U. However, any attempt to modify U, - * results in an UnmodifiableSetException. - * The unmodifiable view object U will be serializable if the - * attribute set object S is serializable. - *

    - * A synchronized view V of an attribute set S provides a - * client with synchronized (multiple thread safe) access to S. Each - * operation of V is synchronized using V itself as the lock - * object and then merely invokes the corresponding operation of S. In - * order to guarantee mutually exclusive access, it is critical that all - * access to S is accomplished through V. The synchronized view - * object V will be serializable if the attribute set object S - * is serializable. - *

    - * As mentioned in the package description of javax.print, a null reference - * parameter to methods is - * incorrect unless explicitly documented on the method as having a meaningful - * interpretation. Usage to the contrary is incorrect coding and may result in - * a run time exception either immediately - * or at some later time. IllegalArgumentException and NullPointerException - * are examples of typical and acceptable run time exceptions for such cases. + * An unmodifiable view U of an {@code AttributeSet} S + * provides a client with "read-only" access to S. Query operations on + * U "read through" to S; thus, changes in S are reflected + * in U. However, any attempt to modify U, results in an + * {@code UnmodifiableSetException}. The unmodifiable view object U will + * be serializable if the attribute set object S is serializable. + *

    + * A synchronized view V of an attribute set S provides a + * client with synchronized (multiple thread safe) access to S. Each + * operation of V is synchronized using V itself as the lock + * object and then merely invokes the corresponding operation of S. In + * order to guarantee mutually exclusive access, it is critical that all access + * to S is accomplished through V. The synchronized view object + * V will be serializable if the attribute set object S is + * serializable. + *

    + * As mentioned in the package description of {@code javax.print}, a + * {@code null} reference parameter to methods is incorrect unless explicitly + * documented on the method as having a meaningful interpretation. Usage to the + * contrary is incorrect coding and may result in a run time exception either + * immediately or at some later time. {@code IllegalArgumentException} and + * {@code NullPointerException} are examples of typical and acceptable run time + * exceptions for such cases. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class AttributeSetUtilities { - /* Suppress default constructor, ensuring non-instantiability. + /** + * Suppress default constructor, ensuring non-instantiability. */ private AttributeSetUtilities() { } /** - * @serial include - */ + * Unmodifiable view of {@code AttributeSet}. + * + * @serial include + */ private static class UnmodifiableAttributeSet implements AttributeSet, Serializable { + + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -6131802583863447813L; + /** + * The attribute set. + */ private AttributeSet attrset; - /* Unmodifiable view of the underlying attribute set. + /** + * Constructs unmodifiable view of the underlying attribute set. + * + * @param attributeSet the attribute set */ public UnmodifiableAttributeSet(AttributeSet attributeSet) { @@ -139,17 +149,27 @@ public int hashCode() { return attrset.hashCode(); } - } /** - * @serial include - */ + * Unmodifiable view of {@code DocAttributeSet}. + * + * @serial include + */ private static class UnmodifiableDocAttributeSet extends UnmodifiableAttributeSet implements DocAttributeSet, Serializable { + + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -6349408326066898956L; + /** + * Constructs a new unmodifiable doc attribute set. + * + * @param attributeSet the doc attribute set + */ public UnmodifiableDocAttributeSet(DocAttributeSet attributeSet) { super (attributeSet); @@ -157,13 +177,25 @@ } /** - * @serial include - */ + * Unmodifiable view of {@code PrintRequestAttributeSet}. + * + * @serial include + */ private static class UnmodifiablePrintRequestAttributeSet extends UnmodifiableAttributeSet implements PrintRequestAttributeSet, Serializable { + + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 7799373532614825073L; + + /** + * Constructs a new unmodifiable print request attribute set. + * + * @param attributeSet the print request attribute set + */ public UnmodifiablePrintRequestAttributeSet (PrintRequestAttributeSet attributeSet) { @@ -172,13 +204,24 @@ } /** - * @serial include - */ + * Unmodifiable view of {@code PrintJobAttributeSet}. + * + * @serial include + */ private static class UnmodifiablePrintJobAttributeSet extends UnmodifiableAttributeSet implements PrintJobAttributeSet, Serializable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -8002245296274522112L; + + /** + * Constructs a new unmodifiable print job attribute set. + * + * @param attributeSet the print job attribute set + */ public UnmodifiablePrintJobAttributeSet (PrintJobAttributeSet attributeSet) { @@ -187,13 +230,24 @@ } /** - * @serial include - */ + * Unmodifiable view of {@code PrintServiceAttributeSet}. + * + * @serial include + */ private static class UnmodifiablePrintServiceAttributeSet extends UnmodifiableAttributeSet implements PrintServiceAttributeSet, Serializable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -7112165137107826819L; + + /** + * Constructs a new unmodifiable print service attribute set. + * + * @param attributeSet the print service attribute set + */ public UnmodifiablePrintServiceAttributeSet (PrintServiceAttributeSet attributeSet) { @@ -204,12 +258,9 @@ /** * Creates an unmodifiable view of the given attribute set. * - * @param attributeSet Underlying attribute set. - * - * @return Unmodifiable view of {@code attributeSet}. - * - * @exception NullPointerException - * Thrown if {@code attributeSet} is null. Null is never a + * @param attributeSet underlying attribute set + * @return unmodifiable view of {@code attributeSet} + * @throws NullPointerException if {@code attributeSet} is {@code null} */ public static AttributeSet unmodifiableView(AttributeSet attributeSet) { if (attributeSet == null) { @@ -222,12 +273,9 @@ /** * Creates an unmodifiable view of the given doc attribute set. * - * @param attributeSet Underlying doc attribute set. - * - * @return Unmodifiable view of {@code attributeSet}. - * - * @exception NullPointerException - * Thrown if {@code attributeSet} is null. + * @param attributeSet underlying doc attribute set + * @return unmodifiable view of {@code attributeSet} + * @throws NullPointerException if {@code attributeSet} is {@code null} */ public static DocAttributeSet unmodifiableView (DocAttributeSet attributeSet) { @@ -240,12 +288,9 @@ /** * Creates an unmodifiable view of the given print request attribute set. * - * @param attributeSet Underlying print request attribute set. - * - * @return Unmodifiable view of {@code attributeSet}. - * - * @exception NullPointerException - * Thrown if {@code attributeSet} is null. + * @param attributeSet underlying print request attribute set + * @return unmodifiable view of {@code attributeSet} + * @throws NullPointerException if {@code attributeSet} is {@code null} */ public static PrintRequestAttributeSet unmodifiableView(PrintRequestAttributeSet attributeSet) { @@ -258,12 +303,9 @@ /** * Creates an unmodifiable view of the given print job attribute set. * - * @param attributeSet Underlying print job attribute set. - * - * @return Unmodifiable view of {@code attributeSet}. - * - * @exception NullPointerException - * Thrown if {@code attributeSet} is null. + * @param attributeSet underlying print job attribute set + * @return unmodifiable view of {@code attributeSet} + * @throws NullPointerException if {@code attributeSet} is {@code null} */ public static PrintJobAttributeSet unmodifiableView(PrintJobAttributeSet attributeSet) { @@ -276,12 +318,9 @@ /** * Creates an unmodifiable view of the given print service attribute set. * - * @param attributeSet Underlying print service attribute set. - * - * @return Unmodifiable view of {@code attributeSet}. - * - * @exception NullPointerException - * Thrown if {@code attributeSet} is null. + * @param attributeSet underlying print service attribute set + * @return unmodifiable view of {@code attributeSet} + * @throws NullPointerException if {@code attributeSet} is {@code null} */ public static PrintServiceAttributeSet unmodifiableView(PrintServiceAttributeSet attributeSet) { @@ -292,14 +331,28 @@ } /** - * @serial include - */ + * Synchronized view of {@code AttributeSet}. + * + * @serial include + */ private static class SynchronizedAttributeSet implements AttributeSet, Serializable { + + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 8365731020128564925L; + /** + * The attribute set. + */ private AttributeSet attrset; + /** + * Constructs a new synchronized attribute set. + * + * @param attributeSet the attribute set + */ public SynchronizedAttributeSet(AttributeSet attributeSet) { attrset = attributeSet; } @@ -358,26 +411,48 @@ } /** - * @serial include - */ + * Synchronized view of {@code DocAttributeSet}. + * + * @serial include + */ private static class SynchronizedDocAttributeSet extends SynchronizedAttributeSet implements DocAttributeSet, Serializable { + + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 6455869095246629354L; + /** + * Constructs a new synchronized doc attribute set. + * + * @param attributeSet the doc attribute set + */ public SynchronizedDocAttributeSet(DocAttributeSet attributeSet) { super(attributeSet); } } /** - * @serial include - */ + * Synchronized view of {@code PrintRequestAttributeSet}. + * + * @serial include + */ private static class SynchronizedPrintRequestAttributeSet extends SynchronizedAttributeSet implements PrintRequestAttributeSet, Serializable { + + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 5671237023971169027L; + /** + * Constructs a new synchronized print request attribute set. + * + * @param attributeSet the print request attribute set + */ public SynchronizedPrintRequestAttributeSet (PrintRequestAttributeSet attributeSet) { super(attributeSet); @@ -385,13 +460,24 @@ } /** - * @serial include - */ + * Synchronized view of {@code PrintJobAttributeSet}. + * + * @serial include + */ private static class SynchronizedPrintJobAttributeSet extends SynchronizedAttributeSet implements PrintJobAttributeSet, Serializable { + + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 2117188707856965749L; + /** + * Constructs a new synchronized print job attribute set. + * + * @param attributeSet the print job attribute set + */ public SynchronizedPrintJobAttributeSet (PrintJobAttributeSet attributeSet) { super(attributeSet); @@ -399,13 +485,24 @@ } /** - * @serial include - */ + * Synchronized view of {@code PrintServiceAttributeSet}. + * + * @serial include + */ private static class SynchronizedPrintServiceAttributeSet extends SynchronizedAttributeSet implements PrintServiceAttributeSet, Serializable { + + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -2830705374001675073L; + /** + * Constructs a new synchronized print service attribute set. + * + * @param attributeSet the print service attribute set + */ public SynchronizedPrintServiceAttributeSet (PrintServiceAttributeSet attributeSet) { super(attributeSet); @@ -415,12 +512,9 @@ /** * Creates a synchronized view of the given attribute set. * - * @param attributeSet Underlying attribute set. - * - * @return Synchronized view of {@code attributeSet}. - * - * @exception NullPointerException - * Thrown if {@code attributeSet} is null. + * @param attributeSet underlying attribute set + * @return synchronized view of {@code attributeSet} + * @throws NullPointerException if {@code attributeSet} is {@code null} */ public static AttributeSet synchronizedView (AttributeSet attributeSet) { @@ -433,12 +527,9 @@ /** * Creates a synchronized view of the given doc attribute set. * - * @param attributeSet Underlying doc attribute set. - * - * @return Synchronized view of {@code attributeSet}. - * - * @exception NullPointerException - * Thrown if {@code attributeSet} is null. + * @param attributeSet underlying doc attribute set + * @return synchronized view of {@code attributeSet} + * @throws NullPointerException if {@code attributeSet} is {@code null} */ public static DocAttributeSet synchronizedView(DocAttributeSet attributeSet) { @@ -451,12 +542,9 @@ /** * Creates a synchronized view of the given print request attribute set. * - * @param attributeSet Underlying print request attribute set. - * - * @return Synchronized view of {@code attributeSet}. - * - * @exception NullPointerException - * Thrown if {@code attributeSet} is null. + * @param attributeSet underlying print request attribute set + * @return synchronized view of {@code attributeSet} + * @throws NullPointerException if {@code attributeSet} is {@code null} */ public static PrintRequestAttributeSet synchronizedView(PrintRequestAttributeSet attributeSet) { @@ -469,12 +557,9 @@ /** * Creates a synchronized view of the given print job attribute set. * - * @param attributeSet Underlying print job attribute set. - * - * @return Synchronized view of {@code attributeSet}. - * - * @exception NullPointerException - * Thrown if {@code attributeSet} is null. + * @param attributeSet underlying print job attribute set + * @return synchronized view of {@code attributeSet} + * @throws NullPointerException if {@code attributeSet} is {@code null} */ public static PrintJobAttributeSet synchronizedView(PrintJobAttributeSet attributeSet) { @@ -487,9 +572,9 @@ /** * Creates a synchronized view of the given print service attribute set. * - * @param attributeSet Underlying print service attribute set. - * - * @return Synchronized view of {@code attributeSet}. + * @param attributeSet underlying print service attribute set + * @return synchronized view of {@code attributeSet} + * @throws NullPointerException if {@code attributeSet} is {@code null} */ public static PrintServiceAttributeSet synchronizedView(PrintServiceAttributeSet attributeSet) { @@ -499,26 +584,19 @@ return new SynchronizedPrintServiceAttributeSet(attributeSet); } - /** - * Verify that the given object is a {@link java.lang.Class Class} that - * implements the given interface, which is assumed to be interface {@link - * Attribute Attribute} or a subinterface thereof. - * - * @param object Object to test. - * @param interfaceName Interface the object must implement. + * Verify that the given object is a {@link Class Class} that implements the + * given interface, which is assumed to be interface + * {@link Attribute Attribute} or a subinterface thereof. * - * @return If {@code object} is a {@link java.lang.Class Class} - * that implements {@code interfaceName}, - * {@code object} is returned downcast to type {@link - * java.lang.Class Class}; otherwise an exception is thrown. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code object} is null. - * @exception ClassCastException - * (unchecked exception) Thrown if {@code object} is not a - * {@link java.lang.Class Class} that implements - * {@code interfaceName}. + * @param object {@code Object} to test + * @param interfaceName interface the object must implement + * @return if {@code object} is a {@link Class Class} that implements + * {@code interfaceName}, {@code object} is returned downcast to + * type {@link Class Class}; otherwise an exception is thrown + * @throws NullPointerException if {@code object} is {@code null} + * @throws ClassCastException if {@code object} is not a + * {@link Class Class} that implements {@code interfaceName} */ public static Class verifyAttributeCategory(Object object, Class interfaceName) { @@ -537,19 +615,14 @@ * is assumed to be interface {@link Attribute Attribute} or a subinterface * thereof. * - * @param object Object to test. - * @param interfaceName Interface of which the object must be an instance. - * - * @return If {@code object} is an instance of - * {@code interfaceName}, {@code object} is returned - * downcast to type {@link Attribute Attribute}; otherwise an - * exception is thrown. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code object} is null. - * @exception ClassCastException - * (unchecked exception) Thrown if {@code object} is not an - * instance of {@code interfaceName}. + * @param object {@code Object} to test + * @param interfaceName interface of which the object must be an instance + * @return if {@code object} is an instance of {@code interfaceName}, + * {@code object} is returned downcast to type + * {@link Attribute Attribute}; otherwise an exception is thrown + * @throws NullPointerException if {@code object} is {@code null} + * @throws ClassCastException if {@code object} is not an instance of + * {@code interfaceName} */ public static Attribute verifyAttributeValue(Object object, Class interfaceName) { @@ -565,19 +638,16 @@ } /** - * Verify that the given attribute category object is equal to the - * category of the given attribute value object. If so, this method - * returns doing nothing. If not, this method throws an exception. - * - * @param category Attribute category to test. - * @param attribute Attribute value to test. + * Verify that the given attribute category object is equal to the category + * of the given attribute value object. If so, this method returns doing + * nothing. If not, this method throws an exception. * - * @exception NullPointerException - * (unchecked exception) Thrown if the {@code category} is - * null or if the {@code attribute} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if the {@code category} is not - * equal to the category of the {@code attribute}. + * @param category attribute category to test + * @param attribute attribute value to test + * @throws NullPointerException if the {@code category} or {@code attribute} + * are {@code null} + * @throws IllegalArgumentException if the {@code category} is not equal to + * the category of the {@code attribute} */ public static void verifyCategoryForValue(Class category, Attribute attribute) { diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/DateTimeSyntax.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/DateTimeSyntax.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/DateTimeSyntax.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,47 +23,48 @@ * questions. */ - package javax.print.attribute; import java.io.Serializable; - import java.util.Date; /** - * Class DateTimeSyntax is an abstract base class providing the common + * Class {@code DateTimeSyntax} is an abstract base class providing the common * implementation of all attributes whose value is a date and time. - *

    + *

    * Under the hood, a date-time attribute is stored as a value of class - * {@code java.util.Date}. You can get a date-time attribute's Date value by - * calling {@link #getValue() getValue()}. A date-time attribute's - * Date value is established when it is constructed (see {@link - * #DateTimeSyntax(Date) DateTimeSyntax(Date)}). Once - * constructed, a date-time attribute's value is immutable. - *

    + * {@code java.util.Date}. You can get a date-time attribute's {@code Date} + * value by calling {@link #getValue() getValue()}. A date-time attribute's + * {@code Date} value is established when it is constructed (see + * {@link #DateTimeSyntax(Date) DateTimeSyntax(Date)}). Once constructed, a + * date-time attribute's value is immutable. + *

    * To construct a date-time attribute from separate values of the year, month, - * day, hour, minute, and so on, use a {@code java.util.Calendar} - * object to construct a {@code java.util.Date} object, then use the - * {@code java.util.Date} object to construct the date-time attribute. - * To convert - * a date-time attribute to separate values of the year, month, day, hour, - * minute, and so on, create a {@code java.util.Calendar} object and - * set it to the {@code java.util.Date} from the date-time attribute. Class - * DateTimeSyntax stores its value in the form of a {@code java.util.Date} - * rather than a {@code java.util.Calendar} because it typically takes - * less memory to store and less time to compare a {@code java.util.Date} - * than a {@code java.util.Calendar}. + * day, hour, minute, and so on, use a {@code java.util.Calendar} object to + * construct a {@code java.util.Date} object, then use the + * {@code java.util.Date} object to construct the date-time attribute. To + * convert a date-time attribute to separate values of the year, month, day, + * hour, minute, and so on, create a {@code java.util.Calendar} object and set + * it to the {@code java.util.Date} from the date-time attribute. Class + * {@code DateTimeSyntax} stores its value in the form of a + * {@code java.util.Date} rather than a {@code java.util.Calendar} because it + * typically takes less memory to store and less time to compare a + * {@code java.util.Date} than a {@code java.util.Calendar}. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public abstract class DateTimeSyntax implements Serializable, Cloneable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -1400819079791208582L; // Hidden data members. /** * This date-time attribute's {@code java.util.Date} value. + * * @serial */ private Date value; @@ -71,13 +72,11 @@ // Hidden constructors. /** - * Construct a new date-time attribute with the given - * {@code java.util.Date} value. + * Construct a new date-time attribute with the given {@code java.util.Date} + * value. * - * @param value {@code java.util.Date} value. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code theValue} is null. + * @param value {@code java.util.Date} value + * @throws NullPointerException if {@code value} is {@code null} */ protected DateTimeSyntax(Date value) { if (value == null) { @@ -89,9 +88,9 @@ // Exported operations. /** - * Returns this date-time attribute's {@code java.util.Date} - * value. - * @return the Date. + * Returns this date-time attribute's {@code java.util.Date} value. + * + * @return the {@code Date} */ public Date getValue() { return new Date (value.getTime()); @@ -102,20 +101,16 @@ /** * Returns whether this date-time attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class DateTimeSyntax. - *
    3. - * This date-time attribute's {@code java.util.Date} value and - * {@code object}'s {@code java.util.Date} value are - * equal.
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code DateTimeSyntax}. + *
    3. This date-time attribute's {@code java.util.Date} value and + * {@code object}'s {@code java.util.Date} value are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this date-time - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this date-time + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return (object != null && @@ -132,13 +127,11 @@ } /** - * Returns a string value corresponding to this date-time attribute. - * The string value is just this attribute's - * {@code java.util.Date} value + * Returns a string value corresponding to this date-time attribute. The + * string value is just this attribute's {@code java.util.Date} value * converted to a string. */ public String toString() { return "" + value; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/DocAttribute.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/DocAttribute.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/DocAttribute.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,25 +23,22 @@ * questions. */ - package javax.print.attribute; /** - * Interface DocAttribute is a tagging interface which a printing attribute - * class implements to indicate the attribute denotes a setting for a doc. - * ("Doc" is a short, easy-to-pronounce term that means "a piece of print - * data.") The client may include a DocAttribute in a {@code Doc}'s - * attribute set to specify a characteristic of - * that doc. If an attribute implements {@link PrintRequestAttribute - * PrintRequestAttribute} as well as DocAttribute, the client may include the - * attribute in a attribute set which specifies a print job - * to specify a characteristic for all the docs in that job. + * Interface {@code DocAttribute} is a tagging interface which a printing + * attribute class implements to indicate the attribute denotes a setting for a + * doc. ("Doc" is a short, easy-to-pronounce term that means "a piece of print + * data.") The client may include a {@code DocAttribute} in a {@code Doc}'s + * attribute set to specify a characteristic of that doc. If an attribute + * implements {@link PrintRequestAttribute PrintRequestAttribute} as well as + * {@code DocAttribute}, the client may include the attribute in a attribute set + * which specifies a print job to specify a characteristic for all the docs in + * that job. * + * @author Alan Kaminsky * @see DocAttributeSet * @see PrintRequestAttributeSet - * - * @author Alan Kaminsky */ public interface DocAttribute extends Attribute { - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/DocAttributeSet.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/DocAttributeSet.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/DocAttributeSet.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,88 +23,70 @@ * questions. */ - package javax.print.attribute; /** - * Interface DocAttributeSet specifies the interface for a set of doc - * attributes, i.e. printing attributes that implement interface {@link - * DocAttribute DocAttribute}. In the Print Service API, the client uses a - * DocAttributeSet to specify the characteristics of an individual doc and - * the print job settings to be applied to an individual doc. - *

    - * A DocAttributeSet is just an {@link AttributeSet AttributeSet} whose + * Interface {@code DocAttributeSet} specifies the interface for a set of doc + * attributes, i.e. printing attributes that implement interface + * {@link DocAttribute DocAttribute}. In the Print Service API, the client uses + * a {@code DocAttributeSet} to specify the characteristics of an individual doc + * and the print job settings to be applied to an individual doc. + *

    + * A {@code DocAttributeSet} is just an {@link AttributeSet AttributeSet} whose * constructors and mutating operations guarantee an additional invariant, - * namely that all attribute values in the DocAttributeSet must be instances - * of interface {@link DocAttribute DocAttribute}. - * The {@link #add(Attribute) add(Attribute)}, and - * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations - * are respecified below to guarantee this additional invariant. + * namely that all attribute values in the {@code DocAttributeSet} must be + * instances of interface {@link DocAttribute DocAttribute}. The + * {@link #add(Attribute) add(Attribute)}, and + * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations are respecified + * below to guarantee this additional invariant. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public interface DocAttributeSet extends AttributeSet { - /** * Adds the specified attribute value to this attribute set if it is not - * already present, first removing any existing value in the same - * attribute category as the specified attribute value (optional - * operation). - * - * @param attribute Attribute value to be added to this attribute set. - * - * @return {@code true} if this attribute set changed as a result of - * the call, i.e., the given attribute value was not already a - * member of this attribute set. + * already present, first removing any existing value in the same attribute + * category as the specified attribute value (optional operation). * - * @throws UnmodifiableSetException - * (unchecked exception) Thrown if this attribute set does not - * support the {@code add()} operation. - * @throws ClassCastException - * (unchecked exception) Thrown if the {@code attribute} is - * not an instance of interface - * {@link DocAttribute DocAttribute}. - * @throws NullPointerException - * (unchecked exception) Thrown if the {@code attribute} is null. + * @param attribute attribute value to be added to this attribute set + * @return {@code true} if this attribute set changed as a result of the + * call, i.e., the given attribute value was not already a member of + * this attribute set + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code add()} operation + * @throws ClassCastException if the {@code attribute} is not an instance of + * interface {@link DocAttribute DocAttribute} + * @throws NullPointerException if the {@code attribute} is {@code null} */ public boolean add(Attribute attribute); /** - * Adds all of the elements in the specified set to this attribute. - * The outcome is the same as if the - * {@link #add(Attribute) add(Attribute)} - * operation had been applied to this attribute set successively with - * each element from the specified set. If none of the categories in the - * specified set are the same as any categories in this attribute set, - * the {@code addAll()} operation effectively modifies this attribute - * set so that its value is the union of the two sets. - *

    - * The behavior of the {@code addAll()} operation is unspecified if - * the specified set is modified while the operation is in progress. - *

    - * If the {@code addAll()} operation throws an exception, the effect - * on this attribute set's state is implementation dependent; elements - * from the specified set before the point of the exception may or - * may not have been added to this attribute set. + * Adds all of the elements in the specified set to this attribute. The + * outcome is the same as if the {@link #add(Attribute) add(Attribute)} + * operation had been applied to this attribute set successively with each + * element from the specified set. If none of the categories in the + * specified set are the same as any categories in this attribute set, the + * {@code addAll()} operation effectively modifies this attribute set so + * that its value is the union of the two sets. + *

    + * The behavior of the {@code addAll()} operation is unspecified if the + * specified set is modified while the operation is in progress. + *

    + * If the {@code addAll()} operation throws an exception, the effect on this + * attribute set's state is implementation dependent; elements from the + * specified set before the point of the exception may or may not have been + * added to this attribute set. * - * @param attributes whose elements are to be added to this attribute - * set. - * - * @return {@code true} if this attribute set changed as a result of - * the call. - * - * @throws UnmodifiableSetException - * (Unchecked exception) Thrown if this attribute set does not - * support the {@code addAll()} method. - * @throws ClassCastException - * (Unchecked exception) Thrown if some element in the specified - * set is not an instance of interface {@link DocAttribute - * DocAttribute}. - * @throws NullPointerException - * (Unchecked exception) Thrown if the specified set is null. - * + * @param attributes whose elements are to be added to this attribute set + * @return {@code true} if this attribute set changed as a result of the + * call + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code addAll()} method + * @throws ClassCastException if some element in the specified set is not an + * instance of interface {@link DocAttribute DocAttribute} + * @throws NullPointerException if the specified set is {@code null} * @see #add(Attribute) */ - public boolean addAll(AttributeSet attributes); + public boolean addAll(AttributeSet attributes); } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/EnumSyntax.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/EnumSyntax.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/EnumSyntax.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,7 +23,6 @@ * questions. */ - package javax.print.attribute; import java.io.InvalidObjectException; @@ -31,11 +30,13 @@ import java.io.Serializable; /** - * Class EnumSyntax is an abstract base class providing the common + * Class {@code EnumSyntax} is an abstract base class providing the common * implementation of all "type safe enumeration" objects. An enumeration class - * (which extends class EnumSyntax) provides a group of enumeration values - * (objects) that are singleton instances of the enumeration class; for example: - *

    + * (which extends class {@code EnumSyntax}) provides a group of enumeration
    + * values (objects) that are singleton instances of the enumeration class; for
    + * example:
    + *
    + * 
      *     public class Bach extends EnumSyntax {
      *         public static final Bach JOHANN_SEBASTIAN     = new Bach(0);
      *         public static final Bach WILHELM_FRIEDEMANN   = new Bach(1);
    @@ -67,51 +68,54 @@
      *             return enumValueTable;
      *         }
      *     }
    - * 
    - * You can then write code that uses the {@code ==} and {@code !=} - * operators to test enumeration values; for example: - *
    + * 
    + * You can then write code that uses the {@code ==} and {@code !=} operators to + * test enumeration values; for example: + *
      *     Bach theComposer;
      *     . . .
      *     if (theComposer == Bach.JOHANN_SEBASTIAN) {
      *         System.out.println ("The greatest composer of all time!");
      *     }
    - * 
    - * The {@code equals()} method for an enumeration class just does a test - * for identical objects ({@code ==}). - *

    - * You can convert an enumeration value to a string by calling {@link - * #toString() toString()}. The string is obtained from a table - * supplied by the enumeration class. - *

    + *

    + * The {@code equals()} method for an enumeration class just does a test for + * identical objects ({@code ==}). + *

    + * You can convert an enumeration value to a string by calling + * {@link #toString() toString()}. The string is obtained from a table supplied + * by the enumeration class. + *

    * Under the hood, an enumeration value is just an integer, a different integer * for each enumeration value within an enumeration class. You can get an - * enumeration value's integer value by calling {@link #getValue() - * getValue()}. An enumeration value's integer value is established - * when it is constructed (see {@link #EnumSyntax(int) - * EnumSyntax(int)}). Since the constructor is protected, the only - * possible enumeration values are the singleton objects declared in the - * enumeration class; additional enumeration values cannot be created at run - * time. - *

    + * enumeration value's integer value by calling {@link #getValue() getValue()}. + * An enumeration value's integer value is established when it is constructed + * (see {@link #EnumSyntax(int) EnumSyntax(int)}). Since the constructor is + * protected, the only possible enumeration values are the singleton objects + * declared in the enumeration class; additional enumeration values cannot be + * created at run time. + *

    * You can define a subclass of an enumeration class that extends it with * additional enumeration values. The subclass's enumeration values' integer * values need not be distinct from the superclass's enumeration values' integer - * values; the {@code ==}, {@code !=}, {@code equals()}, and - * {@code toString()} methods will still work properly even if the subclass - * uses some of the same integer values as the superclass. However, the - * application in which the enumeration class and subclass are used may need to - * have distinct integer values in the superclass and subclass. + * values; the {@code ==}, {@code !=}, {@code equals()}, and {@code toString()} + * methods will still work properly even if the subclass uses some of the same + * integer values as the superclass. However, the application in which the + * enumeration class and subclass are used may need to have distinct integer + * values in the superclass and subclass. * - * @author David Mendenhall - * @author Alan Kaminsky + * @author David Mendenhall + * @author Alan Kaminsky */ public abstract class EnumSyntax implements Serializable, Cloneable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -2739521845085831642L; /** * This enumeration value's integer value. + * * @serial */ private int value; @@ -119,7 +123,7 @@ /** * Construct a new enumeration value with the given integer value. * - * @param value Integer value. + * @param value Integer value */ protected EnumSyntax(int value) { this.value = value; @@ -127,6 +131,7 @@ /** * Returns this enumeration value's integer value. + * * @return the value */ public int getValue() { @@ -167,22 +172,20 @@ * During object input, convert this deserialized enumeration instance to * the proper enumeration value defined in the enumeration attribute class. * - * @return The enumeration singleton value stored at index - * i-L in the enumeration value table returned by - * {@link #getEnumValueTable() getEnumValueTable()}, - * where i is this enumeration value's integer value and - * L is the value returned by {@link #getOffset() - * getOffset()}. - * + * @return The enumeration singleton value stored at index i-L + * in the enumeration value table returned by + * {@link #getEnumValueTable() getEnumValueTable()}, where i + * is this enumeration value's integer value and L is the + * value returned by {@link #getOffset() getOffset()} * @throws ObjectStreamException if the stream can't be deserialised - * @throws InvalidObjectException - * Thrown if the enumeration value table is null, this enumeration - * value's integer value does not correspond to an element in the - * enumeration value table, or the corresponding element in the - * enumeration value table is null. (Note: {@link - * java.io.InvalidObjectException InvalidObjectException} is a subclass - * of {@link java.io.ObjectStreamException ObjectStreamException}, which - * {@code readResolve()} is declared to throw.) + * @throws InvalidObjectException if the enumeration value table is + * {@code null}, this enumeration value's integer value does not + * correspond to an element in the enumeration value table, or the + * corresponding element in the enumeration value table is + * {@code null}. (Note: + * {@link InvalidObjectException InvalidObjectException} is a + * subclass of {@link ObjectStreamException ObjectStreamException}, + * which {@code readResolve()} is declared to throw.) */ protected Object readResolve() throws ObjectStreamException { @@ -218,20 +221,21 @@ /** * Returns the string table for this enumeration value's enumeration class. * The enumeration class's integer values are assumed to lie in the range - * L..L+N-1, where L is the value returned by - * {@link #getOffset() getOffset()} and N is the length - * of the string table. The element in the string table at index - * i-L is the value returned by {@link #toString() - * toString()} for the enumeration value whose integer value - * is i. If an integer within the above range is not used by any - * enumeration value, leave the corresponding table element null. - *

    - * The default implementation returns null. If the enumeration class (a - * subclass of class EnumSyntax) does not override this method to return a - * non-null string table, and the subclass does not override the {@link - * #toString() toString()} method, the base class {@link - * #toString() toString()} method will return just a string + * L..L+N-1, where L is the value returned by + * {@link #getOffset() getOffset()} and N is the length of the string + * table. The element in the string table at index i-L is the + * value returned by {@link #toString() toString()} for the enumeration + * value whose integer value is i. If an integer within the above + * range is not used by any enumeration value, leave the corresponding table + * element {@code null}. + *

    + * The default implementation returns {@code null}. If the enumeration class + * (a subclass of class {@code EnumSyntax}) does not override this method to + * return a {@code non-null} string table, and the subclass does not + * override the {@link #toString() toString()} method, the base class + * {@link #toString() toString()} method will return just a string * representation of this enumeration value's integer value. + * * @return the string table */ protected String[] getStringTable() { @@ -241,23 +245,24 @@ /** * Returns the enumeration value table for this enumeration value's * enumeration class. The enumeration class's integer values are assumed to - * lie in the range L..L+N-1, where L is the - * value returned by {@link #getOffset() getOffset()} and - * N is the length of the enumeration value table. The element in the - * enumeration value table at index i-L is the enumeration - * value object whose integer value is i; the {@link #readResolve() - * readResolve()} method needs this to preserve singleton - * semantics during deserialization of an enumeration instance. If an - * integer within the above range is not used by any enumeration value, - * leave the corresponding table element null. - *

    - * The default implementation returns null. If the enumeration class (a - * subclass of class EnumSyntax) does not override this method to return - * a non-null enumeration value table, and the subclass does not override - * the {@link #readResolve() readResolve()} method, the base - * class {@link #readResolve() readResolve()} method will throw - * an exception whenever an enumeration instance is deserialized from an - * object input stream. + * lie in the range L..L+N-1, where L is the + * value returned by {@link #getOffset() getOffset()} and N is the + * length of the enumeration value table. The element in the enumeration + * value table at index i-L is the enumeration value object + * whose integer value is i; the {@link #readResolve() readResolve()} + * method needs this to preserve singleton semantics during deserialization + * of an enumeration instance. If an integer within the above range is not + * used by any enumeration value, leave the corresponding table element + * {@code null}. + *

    + * The default implementation returns {@code null}. If the enumeration class + * (a subclass of class EnumSyntax) does not override this method to return + * a {@code non-null} enumeration value table, and the subclass does not + * override the {@link #readResolve() readResolve()} method, the base class + * {@link #readResolve() readResolve()} method will throw an exception + * whenever an enumeration instance is deserialized from an object input + * stream. + * * @return the value table */ protected EnumSyntax[] getEnumValueTable() { @@ -267,14 +272,14 @@ /** * Returns the lowest integer value used by this enumeration value's * enumeration class. - *

    + *

    * The default implementation returns 0. If the enumeration class (a - * subclass of class EnumSyntax) uses integer values starting at other than - * 0, override this method in the subclass. - * @return the offset of the lowest enumeration value. + * subclass of class {@code EnumSyntax}) uses integer values starting at + * other than 0, override this method in the subclass. + * + * @return the offset of the lowest enumeration value */ protected int getOffset() { return 0; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/HashAttributeSet.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/HashAttributeSet.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/HashAttributeSet.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -32,37 +32,42 @@ import java.util.HashMap; /** - * Class HashAttributeSet provides an {@code AttributeSet} + * Class {@code HashAttributeSet} provides an {@code AttributeSet} * implementation with characteristics of a hash map. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public class HashAttributeSet implements AttributeSet, Serializable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 5311560590283707917L; /** * The interface of which all members of this attribute set must be an - * instance. It is assumed to be interface {@link Attribute Attribute} - * or a subinterface thereof. + * instance. It is assumed to be interface {@link Attribute Attribute} or a + * subinterface thereof. + * * @serial */ private Class myInterface; - /* - * A HashMap used by the implementation. - * The serialised form doesn't include this instance variable. + /** + * A {@code HashMap} used by the implementation. The serialised form doesn't + * include this instance variable. */ private transient HashMap, Attribute> attrMap = new HashMap<>(); /** - * Write the instance to a stream (ie serialize the object) + * Write the instance to a stream (ie serialize the object). * - * @serialData - * The serialized form of an attribute set explicitly writes the - * number of attributes in the set, and each of the attributes. - * This does not guarantee equality of serialized forms since - * the order in which the attributes are written is not defined. + * @param s the output stream + * @throws IOException if an I/O exception has occurred + * @serialData The serialized form of an attribute set explicitly writes the + * number of attributes in the set, and each of the attributes. + * This does not guarantee equality of serialized forms since + * the order in which the attributes are written is not defined. */ private void writeObject(ObjectOutputStream s) throws IOException { @@ -76,6 +81,10 @@ /** * Reconstitute an instance from a stream that is, deserialize it). + * + * @param s the input stream + * @throws ClassNotFoundException if the class is not found + * @throws IOException if an I/O exception has occurred */ private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { @@ -98,59 +107,51 @@ } /** - * Construct a new attribute set, - * initially populated with the given attribute. + * Construct a new attribute set, initially populated with the given + * attribute. * - * @param attribute Attribute value to add to the set. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code attribute} is null. + * @param attribute attribute value to add to the set + * @throws NullPointerException if {@code attribute} is {@code null} */ public HashAttributeSet(Attribute attribute) { this (attribute, Attribute.class); } /** - * Construct a new attribute set, - * initially populated with the values from the - * given array. The new attribute set is populated by - * adding the elements of {@code attributes} array to the set in - * sequence, starting at index 0. Thus, later array elements may replace - * earlier array elements if the array contains duplicate attribute - * values or attribute categories. + * Construct a new attribute set, initially populated with the values from + * the given array. The new attribute set is populated by adding the + * elements of {@code attributes} array to the set in sequence, starting at + * index 0. Thus, later array elements may replace earlier array elements if + * the array contains duplicate attribute values or attribute categories. * - * @param attributes Array of attribute values to add to the set. - * If null, an empty attribute set is constructed. - * - * @exception NullPointerException - * (unchecked exception) Thrown if any element of - * {@code attributes} is null. + * @param attributes array of attribute values to add to the set. If + * {@code null}, an empty attribute set is constructed. + * @throws NullPointerException if any element of {@code attributes} is + * {@code null} */ public HashAttributeSet(Attribute[] attributes) { this (attributes, Attribute.class); } /** - * Construct a new attribute set, - * initially populated with the values from the given set. + * Construct a new attribute set, initially populated with the values from + * the given set. * - * @param attributes Set of attributes from which to initialise this set. - * If null, an empty attribute set is constructed. - * + * @param attributes set of attributes from which to initialise this set. + * If {@code null}, an empty attribute set is constructed. */ public HashAttributeSet(AttributeSet attributes) { this (attributes, Attribute.class); } /** - * Construct a new, empty attribute set, where the members of - * the attribute set are restricted to the given interface. + * Construct a new, empty attribute set, where the members of the attribute + * set are restricted to the given interface. * - * @param interfaceName The interface of which all members of this - * attribute set must be an instance. It is assumed to - * be interface {@link Attribute Attribute} or a - * subinterface thereof. - * @exception NullPointerException if interfaceName is null. + * @param interfaceName the interface of which all members of this + * attribute set must be an instance. It is assumed to be interface + * {@link Attribute Attribute} or a subinterface thereof. + * @throws NullPointerException if {@code interfaceName} is {@code null} */ protected HashAttributeSet(Class interfaceName) { if (interfaceName == null) { @@ -164,18 +165,14 @@ * attribute, where the members of the attribute set are restricted to the * given interface. * - * @param attribute Attribute value to add to the set. - * @param interfaceName The interface of which all members of this - * attribute set must be an instance. It is assumed to - * be interface {@link Attribute Attribute} or a - * subinterface thereof. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code attribute} is null. - * @exception NullPointerException if interfaceName is null. - * @exception ClassCastException - * (unchecked exception) Thrown if {@code attribute} is not an - * instance of {@code interfaceName}. + * @param attribute attribute value to add to the set + * @param interfaceName the interface of which all members of this + * attribute set must be an instance. It is assumed to be interface + * {@link Attribute Attribute} or a subinterface thereof. + * @throws NullPointerException if {@code attribute} or + * {@code interfaceName} are {@code null} + * @throws ClassCastException if {@code attribute} is not an instance of + * {@code interfaceName} */ protected HashAttributeSet(Attribute attribute, Class interfaceName) { if (interfaceName == null) { @@ -186,29 +183,22 @@ } /** - * Construct a new attribute set, where the members of the attribute - * set are restricted to the given interface. - * The new attribute set is populated - * by adding the elements of {@code attributes} array to the set in - * sequence, starting at index 0. Thus, later array elements may replace - * earlier array elements if the array contains duplicate attribute - * values or attribute categories. + * Construct a new attribute set, where the members of the attribute set are + * restricted to the given interface. The new attribute set is populated by + * adding the elements of {@code attributes} array to the set in sequence, + * starting at index 0. Thus, later array elements may replace earlier array + * elements if the array contains duplicate attribute values or attribute + * categories. * - * @param attributes Array of attribute values to add to the set. If - * null, an empty attribute set is constructed. - * @param interfaceName The interface of which all members of this - * attribute set must be an instance. It is assumed to - * be interface {@link Attribute Attribute} or a - * subinterface thereof. - * - * @exception NullPointerException - * (unchecked exception) Thrown if any element of - * {@code attributes} is null. - * @exception NullPointerException if interfaceName is null. - * @exception ClassCastException - * (unchecked exception) Thrown if any element of - * {@code attributes} is not an instance of - * {@code interfaceName}. + * @param attributes array of attribute values to add to the set. If + * {@code null}, an empty attribute set is constructed. + * @param interfaceName the interface of which all members of this + * attribute set must be an instance. It is assumed to be interface + * {@link Attribute Attribute} or a subinterface thereof. + * @throws NullPointerException if {@code interfaceName} is {@code null}, or + * if any element of {@code attributes} is {@code null} + * @throws ClassCastException if any element of {@code attributes} is not an + * instance of {@code interfaceName} */ protected HashAttributeSet(Attribute[] attributes, Class interfaceName) { if (interfaceName == null) { @@ -222,21 +212,17 @@ } /** - * Construct a new attribute set, initially populated with the - * values from the given set where the members of the attribute - * set are restricted to the given interface. + * Construct a new attribute set, initially populated with the values from + * the given set where the members of the attribute set are restricted to + * the given interface. * * @param attributes set of attribute values to initialise the set. If - * null, an empty attribute set is constructed. - * @param interfaceName The interface of which all members of this - * attribute set must be an instance. It is assumed to - * be interface {@link Attribute Attribute} or a - * subinterface thereof. - * - * @exception ClassCastException - * (unchecked exception) Thrown if any element of - * {@code attributes} is not an instance of - * {@code interfaceName}. + * {@code null}, an empty attribute set is constructed. + * @param interfaceName The interface of which all members of this + * attribute set must be an instance. It is assumed to be interface + * {@link Attribute Attribute} or a subinterface thereof. + * @throws ClassCastException if any element of {@code attributes} is not an + * instance of {@code interfaceName} */ protected HashAttributeSet(AttributeSet attributes, Class interfaceName) { myInterface = interfaceName; @@ -251,26 +237,19 @@ /** * Returns the attribute value which this attribute set contains in the - * given attribute category. Returns {@code null} if this attribute set - * does not contain any attribute value in the given attribute category. - * - * @param category Attribute category whose associated attribute value - * is to be returned. It must be a - * {@link java.lang.Class Class} - * that implements interface {@link Attribute - * Attribute}. + * given attribute category. Returns {@code null} if this attribute set does + * not contain any attribute value in the given attribute category. * - * @return The attribute value in the given attribute category contained - * in this attribute set, or {@code null} if this attribute set - * does not contain any attribute value in the given attribute - * category. - * - * @throws NullPointerException - * (unchecked exception) Thrown if the {@code category} is null. - * @throws ClassCastException - * (unchecked exception) Thrown if the {@code category} is not a - * {@link java.lang.Class Class} that implements interface {@link - * Attribute Attribute}. + * @param category attribute category whose associated attribute value is + * to be returned. It must be a {@link Class Class} that implements + * interface {@link Attribute Attribute}. + * @return the attribute value in the given attribute category contained in + * this attribute set, or {@code null} if this attribute set does + * not contain any attribute value in the given attribute category + * @throws NullPointerException if the {@code category} is {@code null} + * @throws ClassCastException if the {@code category} is not a + * {@link Class Class} that implements interface + * {@link Attribute Attribute} */ public Attribute get(Class category) { return attrMap.get(AttributeSetUtilities. @@ -279,21 +258,17 @@ } /** - * Adds the specified attribute to this attribute set if it is not - * already present, first removing any existing in the same - * attribute category as the specified attribute value. - * - * @param attribute Attribute value to be added to this attribute set. + * Adds the specified attribute to this attribute set if it is not already + * present, first removing any existing in the same attribute category as + * the specified attribute value. * - * @return {@code true} if this attribute set changed as a result of the - * call, i.e., the given attribute value was not already a - * member of this attribute set. - * - * @throws NullPointerException - * (unchecked exception) Thrown if the {@code attribute} is null. - * @throws UnmodifiableSetException - * (unchecked exception) Thrown if this attribute set does not support - * the {@code add()} operation. + * @param attribute attribute value to be added to this attribute set + * @return {@code true} if this attribute set changed as a result of the + * call, i.e., the given attribute value was not already a member of + * this attribute set + * @throws NullPointerException if the {@code attribute} is {@code null} + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code add()} operation */ public boolean add(Attribute attribute) { Object oldAttribute = @@ -305,19 +280,15 @@ /** * Removes any attribute for this category from this attribute set if - * present. If {@code category} is null, then - * {@code remove()} does nothing and returns {@code false}. - * - * @param category Attribute category to be removed from this - * attribute set. + * present. If {@code category} is {@code null}, then {@code remove()} does + * nothing and returns {@code false}. * - * @return {@code true} if this attribute set changed as a result of the + * @param category attribute category to be removed from this attribute set + * @return {@code true} if this attribute set changed as a result of the * call, i.e., the given attribute category had been a member of - * this attribute set. - * - * @throws UnmodifiableSetException - * (unchecked exception) Thrown if this attribute set does not - * support the {@code remove()} operation. + * this attribute set + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code remove()} operation */ public boolean remove(Class category) { return @@ -328,19 +299,16 @@ } /** - * Removes the specified attribute from this attribute set if - * present. If {@code attribute} is null, then - * {@code remove()} does nothing and returns {@code false}. - * - * @param attribute Attribute value to be removed from this attribute set. + * Removes the specified attribute from this attribute set if present. If + * {@code attribute} is {@code null}, then {@code remove()} does nothing and + * returns {@code false}. * - * @return {@code true} if this attribute set changed as a result of the - * call, i.e., the given attribute value had been a member of - * this attribute set. - * - * @throws UnmodifiableSetException - * (unchecked exception) Thrown if this attribute set does not - * support the {@code remove()} operation. + * @param attribute attribute value to be removed from this attribute set + * @return {@code true} if this attribute set changed as a result of the + * call, i.e., the given attribute value had been a member of this + * attribute set + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code remove()} operation */ public boolean remove(Attribute attribute) { return @@ -349,14 +317,12 @@ } /** - * Returns {@code true} if this attribute set contains an - * attribute for the specified category. + * Returns {@code true} if this attribute set contains an attribute for the + * specified category. * - * @param category whose presence in this attribute set is - * to be tested. - * - * @return {@code true} if this attribute set contains an attribute - * value for the specified category. + * @param category whose presence in this attribute set is to be tested + * @return {@code true} if this attribute set contains an attribute value + * for the specified category */ public boolean containsKey(Class category) { return @@ -367,14 +333,12 @@ } /** - * Returns {@code true} if this attribute set contains the given - * attribute. + * Returns {@code true} if this attribute set contains the given attribute. * - * @param attribute value whose presence in this attribute set is - * to be tested. - * - * @return {@code true} if this attribute set contains the given - * attribute value. + * @param attribute value whose presence in this attribute set is to be + * tested + * @return {@code true} if this attribute set contains the given attribute + * value */ public boolean containsValue(Attribute attribute) { return @@ -384,33 +348,25 @@ } /** - * Adds all of the elements in the specified set to this attribute. - * The outcome is the same as if the - * {@link #add(Attribute) add(Attribute)} - * operation had been applied to this attribute set successively with - * each element from the specified set. - * The behavior of the {@code addAll(AttributeSet)} - * operation is unspecified if the specified set is modified while - * the operation is in progress. - *

    - * If the {@code addAll(AttributeSet)} operation throws an exception, - * the effect on this attribute set's state is implementation dependent; - * elements from the specified set before the point of the exception may - * or may not have been added to this attribute set. + * Adds all of the elements in the specified set to this attribute. The + * outcome is the same as if the {@link #add(Attribute) add(Attribute)} + * operation had been applied to this attribute set successively with each + * element from the specified set. The behavior of the + * {@code addAll(AttributeSet)} operation is unspecified if the specified + * set is modified while the operation is in progress. + *

    + * If the {@code addAll(AttributeSet)} operation throws an exception, the + * effect on this attribute set's state is implementation dependent; + * elements from the specified set before the point of the exception may or + * may not have been added to this attribute set. * - * @param attributes whose elements are to be added to this attribute - * set. - * - * @return {@code true} if this attribute set changed as a result of the - * call. - * - * @throws UnmodifiableSetException - * (Unchecked exception) Thrown if this attribute set does not - * support the {@code addAll(AttributeSet)} method. - * @throws NullPointerException - * (Unchecked exception) Thrown if some element in the specified - * set is null, or the set is null. - * + * @param attributes whose elements are to be added to this attribute set + * @return {@code true} if this attribute set changed as a result of the + * call + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code addAll(AttributeSet)} method + * @throws NullPointerException if some element in the specified set is + * {@code null}, or the set is {@code null} * @see #add(Attribute) */ public boolean addAll(AttributeSet attributes) { @@ -428,20 +384,21 @@ } /** - * Returns the number of attributes in this attribute set. If this - * attribute set contains more than {@code Integer.MAX_VALUE} elements, - * returns {@code Integer.MAX_VALUE}. + * Returns the number of attributes in this attribute set. If this attribute + * set contains more than {@code Integer.MAX_VALUE} elements, returns + * {@code Integer.MAX_VALUE}. * - * @return The number of attributes in this attribute set. + * @return the number of attributes in this attribute set */ public int size() { return attrMap.size(); } /** + * Returns an array of the attributes contained in this set. * - * @return the Attributes contained in this set as an array, zero length - * if the AttributeSet is empty. + * @return the attributes contained in this set as an array, zero length if + * the {@code AttributeSet} is empty */ public Attribute[] toArray() { Attribute []attrs = new Attribute[size()]; @@ -449,22 +406,20 @@ return attrs; } - /** * Removes all attributes from this attribute set. * - * @throws UnmodifiableSetException - * (unchecked exception) Thrown if this attribute set does not support - * the {@code clear()} operation. + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code clear()} operation */ public void clear() { attrMap.clear(); } - /** - * Returns true if this attribute set contains no attributes. + /** + * Returns {@code true} if this attribute set contains no attributes. * - * @return true if this attribute set contains no attributes. + * @return {@code true} if this attribute set contains no attributes */ public boolean isEmpty() { return attrMap.isEmpty(); @@ -472,18 +427,15 @@ /** * Compares the specified object with this attribute set for equality. - * Returns {@code true} if the given object is also an attribute set and - * the two attribute sets contain the same attribute category-attribute - * value mappings. This ensures that the - * {@code equals()} method works properly across different - * implementations of the AttributeSet interface. + * Returns {@code true} if the given object is also an attribute set and the + * two attribute sets contain the same attribute category-attribute value + * mappings. This ensures that the {@code equals()} method works properly + * across different implementations of the {@code AttributeSet} interface. * - * @param object to be compared for equality with this attribute set. - * - * @return {@code true} if the specified object is equal to this - * attribute set. + * @param object to be compared for equality with this attribute set + * @return {@code true} if the specified object is equal to this attribute + * set */ - public boolean equals(Object object) { if (object == null || !(object instanceof AttributeSet)) { return false; @@ -504,15 +456,14 @@ } /** - * Returns the hash code value for this attribute set. - * The hash code of an attribute set is defined to be the sum - * of the hash codes of each entry in the AttributeSet. - * This ensures that {@code t1.equals(t2)} implies that - * {@code t1.hashCode()==t2.hashCode()} for any two attribute sets + * Returns the hash code value for this attribute set. The hash code of an + * attribute set is defined to be the sum of the hash codes of each entry in + * the {@code AttributeSet}. This ensures that {@code t1.equals(t2)} implies + * that {@code t1.hashCode()==t2.hashCode()} for any two attribute sets * {@code t1} and {@code t2}, as required by the general contract of - * {@link java.lang.Object#hashCode() Object.hashCode()}. + * {@link Object#hashCode() Object.hashCode()}. * - * @return The hash code value for this attribute set. + * @return the hash code value for this attribute set */ public int hashCode() { int hcode = 0; @@ -522,5 +473,4 @@ } return hcode; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/HashDocAttributeSet.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/HashDocAttributeSet.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/HashDocAttributeSet.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,22 +23,24 @@ * questions. */ - package javax.print.attribute; import java.io.Serializable; /** - * Class HashDocAttributeSet provides an attribute set which - * inherits its implementation from class {@link HashAttributeSet - * HashAttributeSet} and enforces the semantic restrictions of interface {@link - * DocAttributeSet DocAttributeSet}. + * Class {@code HashDocAttributeSet} provides an attribute set which inherits + * its implementation from class {@link HashAttributeSet HashAttributeSet} and + * enforces the semantic restrictions of interface + * {@link DocAttributeSet DocAttributeSet}. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public class HashDocAttributeSet extends HashAttributeSet implements DocAttributeSet, Serializable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -1128534486061432528L; /** @@ -49,53 +51,43 @@ } /** - * Construct a new hash doc attribute set, - * initially populated with the given value. + * Construct a new hash doc attribute set, initially populated with the + * given value. * - * @param attribute Attribute value to add to the set. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code attribute} is null. + * @param attribute attribute value to add to the set + * @throws NullPointerException if {@code attribute} is {@code null} */ public HashDocAttributeSet(DocAttribute attribute) { super (attribute, DocAttribute.class); } /** - * Construct a new hash doc attribute set, - * initially populated with the values from the given array. - * The new attribute set is populated by - * adding the elements of {@code attributes} array to the set in - * sequence, starting at index 0. Thus, later array elements may replace - * earlier array elements if the array contains duplicate attribute - * values or attribute categories. + * Construct a new hash doc attribute set, initially populated with the + * values from the given array. The new attribute set is populated by adding + * the elements of {@code attributes} array to the set in sequence, starting + * at index 0. Thus, later array elements may replace earlier array elements + * if the array contains duplicate attribute values or attribute categories. * - * @param attributes Array of attribute values to add to the set. - * If null, an empty attribute set is constructed. - * - * @exception NullPointerException - * (unchecked exception) - * Thrown if any element of {@code attributes} is null. + * @param attributes array of attribute values to add to the set. If + * {@code null}, an empty attribute set is constructed. + * @throws NullPointerException if any element of {@code attributes} is + * {@code null} */ public HashDocAttributeSet(DocAttribute[] attributes) { super (attributes, DocAttribute.class); } /** - * Construct a new attribute set, initially populated with the - * values from the given set where the members of the attribute set - * are restricted to the {@code DocAttribute} interface. + * Construct a new attribute set, initially populated with the values from + * the given set where the members of the attribute set are restricted to + * the {@code DocAttribute} interface. * * @param attributes set of attribute values to initialise the set. If - * null, an empty attribute set is constructed. - * - * @exception ClassCastException - * (unchecked exception) Thrown if any element of - * {@code attributes} is not an instance of - * {@code DocAttribute}. + * {@code null}, an empty attribute set is constructed. + * @throws ClassCastException if any element of {@code attributes} is not an + * instance of {@code DocAttribute} */ public HashDocAttributeSet(DocAttributeSet attributes) { super(attributes, DocAttribute.class); } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintJobAttributeSet.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,22 +23,24 @@ * questions. */ - package javax.print.attribute; import java.io.Serializable; /** - * Class HashPrintJobAttributeSet provides an attribute set - * which inherits its implementation from class {@link HashAttributeSet - * HashAttributeSet} and enforces the semantic restrictions of interface - * {@link PrintJobAttributeSet PrintJobAttributeSet}. + * Class {@code HashPrintJobAttributeSet} provides an attribute set which + * inherits its implementation from class + * {@link HashAttributeSet HashAttributeSet} and enforces the semantic + * restrictions of interface {@link PrintJobAttributeSet PrintJobAttributeSet}. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public class HashPrintJobAttributeSet extends HashAttributeSet implements PrintJobAttributeSet, Serializable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -4204473656070350348L; /** @@ -49,49 +51,42 @@ } /** - * Construct a new hash print job attribute set, - * initially populated with the given value. + * Construct a new hash print job attribute set, initially populated with + * the given value. * - * @param attribute Attribute value to add to the set. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code attribute} is null. + * @param attribute attribute value to add to the set + * @throws NullPointerException if {@code attribute} is {@code null} */ public HashPrintJobAttributeSet(PrintJobAttribute attribute) { super(attribute, PrintJobAttribute.class); } /** - * Construct a new hash print job attribute set, - * initially populated with the values from the given array. - * The new attribute set is populated - * by adding the elements of {@code attributes} array to the set in - * sequence, starting at index 0. Thus, later array elements may replace - * earlier array elements if the array contains duplicate attribute - * values or attribute categories. + * Construct a new hash print job attribute set, initially populated with + * the values from the given array. The new attribute set is populated by + * adding the elements of {@code attributes} array to the set in sequence, + * starting at index 0. Thus, later array elements may replace earlier array + * elements if the array contains duplicate attribute values or attribute + * categories. * - * @param attributes Array of attribute values to add to the set. - * If null, an empty attribute set is constructed. - * - * @exception NullPointerException (unchecked exception) - * Thrown if any element of {@code attributes} is null. + * @param attributes array of attribute values to add to the set. If + * {@code null}, an empty attribute set is constructed. + * @throws NullPointerException if any element of {@code attributes} is + * {@code null} */ public HashPrintJobAttributeSet(PrintJobAttribute[] attributes) { super (attributes, PrintJobAttribute.class); } /** - * Construct a new attribute set, initially populated with the - * values from the given set where the members of the attribute set - * are restricted to the {@code PrintJobAttribute} interface. + * Construct a new attribute set, initially populated with the values from + * the given set where the members of the attribute set are restricted to + * the {@code PrintJobAttribute} interface. * * @param attributes set of attribute values to initialise the set. If - * null, an empty attribute set is constructed. - * - * @exception ClassCastException - * (unchecked exception) Thrown if any element of - * {@code attributes} is not an instance of - * {@code PrintJobAttribute}. + * {@code null}, an empty attribute set is constructed. + * @throws ClassCastException if any element of {@code attributes} is not an + * instance of {@code PrintJobAttribute} */ public HashPrintJobAttributeSet(PrintJobAttributeSet attributes) { super(attributes, PrintJobAttribute.class); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintRequestAttributeSet.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,22 +23,24 @@ * questions. */ - package javax.print.attribute; import java.io.Serializable; /** - * Class HashPrintRequestAttributeSet inherits its implementation from - * class {@link HashAttributeSet HashAttributeSet} and enforces the - * semantic restrictions of interface + * Class {@code HashPrintRequestAttributeSet} inherits its implementation from + * class {@link HashAttributeSet HashAttributeSet} and enforces the semantic + * restrictions of interface * {@link PrintRequestAttributeSet PrintRequestAttributeSet}. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public class HashPrintRequestAttributeSet extends HashAttributeSet implements PrintRequestAttributeSet, Serializable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 2364756266107751933L; /** @@ -49,55 +51,44 @@ } /** - * Construct a new print request attribute set, - * initially populated with the given value. + * Construct a new print request attribute set, initially populated with the + * given value. * - * @param attribute Attribute value to add to the set. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code attribute} is null. + * @param attribute attribute value to add to the set + * @throws NullPointerException if {@code attribute} is {@code null} */ public HashPrintRequestAttributeSet(PrintRequestAttribute attribute) { super (attribute, PrintRequestAttribute.class); } /** - * Construct a new print request attribute set, initially populated with - * the values from the given array. The new attribute set is populated - * by adding the elements of {@code attributes} array to the set in - * sequence, starting at index 0. Thus, later array elements may replace - * earlier array elements if the array contains duplicate attribute - * values or attribute categories. + * Construct a new print request attribute set, initially populated with the + * values from the given array. The new attribute set is populated by adding + * the elements of {@code attributes} array to the set in sequence, starting + * at index 0. Thus, later array elements may replace earlier array elements + * if the array contains duplicate attribute values or attribute categories. * - * @param attributes Array of attribute values to add to the set. - * If null, an empty attribute set is constructed. - * - * @exception NullPointerException - * (unchecked exception) - * Thrown if any element of {@code attributes} is null. + * @param attributes array of attribute values to add to the set. If + * {@code null}, an empty attribute set is constructed. + * @throws NullPointerException if any element of {@code attributes} is + * {@code null} */ public HashPrintRequestAttributeSet(PrintRequestAttribute[] attributes) { super (attributes, PrintRequestAttribute.class); } - /** - * Construct a new attribute set, initially populated with the - * values from the given set where the members of the attribute set - * are restricted to the {@code (PrintRequestAttributeSe} interface. + * Construct a new attribute set, initially populated with the values from + * the given set where the members of the attribute set are restricted to + * the {@code (PrintRequestAttributeSe} interface. * * @param attributes set of attribute values to initialise the set. If - * null, an empty attribute set is constructed. - * - * @exception ClassCastException - * (unchecked exception) Thrown if any element of - * {@code attributes} is not an instance of - * {@code (PrintRequestAttributeSe}. + * {@code null}, an empty attribute set is constructed. + * @throws ClassCastException if any element of {@code attributes} is not an + * instance of {@code PrintRequestAttributeSe} */ public HashPrintRequestAttributeSet(PrintRequestAttributeSet attributes) { super(attributes, PrintRequestAttribute.class); } - - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/HashPrintServiceAttributeSet.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -28,16 +28,20 @@ import java.io.Serializable; /** - * Class HashPrintServiceAttributeSet provides an attribute set - * which inherits its implementation from class {@link HashAttributeSet - * HashAttributeSet} and enforces the semantic restrictions of interface + * Class {@code HashPrintServiceAttributeSet} provides an attribute set which + * inherits its implementation from class + * {@link HashAttributeSet HashAttributeSet} and enforces the semantic + * restrictions of interface * {@link PrintServiceAttributeSet PrintServiceAttributeSet}. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public class HashPrintServiceAttributeSet extends HashAttributeSet implements PrintServiceAttributeSet, Serializable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 6642904616179203070L; /** @@ -47,52 +51,42 @@ super (PrintServiceAttribute.class); } - /** - * Construct a new hash print service attribute set, - * initially populated with the given value. + * Construct a new hash print service attribute set, initially populated + * with the given value. * - * @param attribute Attribute value to add to the set. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code attribute} is null. + * @param attribute attribute value to add to the set + * @throws NullPointerException if {@code attribute} is {@code null} */ public HashPrintServiceAttributeSet(PrintServiceAttribute attribute) { super (attribute, PrintServiceAttribute.class); } /** - * Construct a new print service attribute set, initially populated with - * the values from the given array. The new attribute set is populated - * by adding the elements of {@code attributes} array to the set in - * sequence, starting at index 0. Thus, later array elements may replace - * earlier array elements if the array contains duplicate attribute - * values or attribute categories. + * Construct a new print service attribute set, initially populated with the + * values from the given array. The new attribute set is populated by adding + * the elements of {@code attributes} array to the set in sequence, starting + * at index 0. Thus, later array elements may replace earlier array elements + * if the array contains duplicate attribute values or attribute categories. * - * @param attributes Array of attribute values to add to the set. - * If null, an empty attribute set is constructed. - * - * @exception NullPointerException - * (unchecked exception) - * Thrown if any element of {@code attributes} is null. + * @param attributes array of attribute values to add to the set. If + * {@code null}, an empty attribute set is constructed. + * @throws NullPointerException if any element of {@code attributes} is + * {@code null} */ public HashPrintServiceAttributeSet(PrintServiceAttribute[] attributes) { super (attributes, PrintServiceAttribute.class); } - /** - * Construct a new attribute set, initially populated with the - * values from the given set where the members of the attribute set - * are restricted to the {@code PrintServiceAttribute} interface. + * Construct a new attribute set, initially populated with the values from + * the given set where the members of the attribute set are restricted to + * the {@code PrintServiceAttribute} interface. * * @param attributes set of attribute values to initialise the set. If - * null, an empty attribute set is constructed. - * - * @exception ClassCastException - * (unchecked exception) Thrown if any element of - * {@code attributes} is not an instance of - * {@code PrintServiceAttribute}. + * {@code null}, an empty attribute set is constructed. + * @throws ClassCastException if any element of {@code attributes} is not an + * instance of {@code PrintServiceAttribute} */ public HashPrintServiceAttributeSet(PrintServiceAttributeSet attributes) { diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/IntegerSyntax.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/IntegerSyntax.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/IntegerSyntax.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -28,25 +28,28 @@ import java.io.Serializable; /** - * Class IntegerSyntax is an abstract base class providing the common + * Class {@code IntegerSyntax} is an abstract base class providing the common * implementation of all attributes with integer values. - *

    + *

    * Under the hood, an integer attribute is just an integer. You can get an - * integer attribute's integer value by calling {@link #getValue() - * getValue()}. An integer attribute's integer value is - * established when it is constructed (see {@link #IntegerSyntax(int) - * IntegerSyntax(int)}). Once constructed, an integer attribute's - * value is immutable. + * integer attribute's integer value by calling {@link #getValue() getValue()}. + * An integer attribute's integer value is established when it is constructed + * (see {@link #IntegerSyntax(int) IntegerSyntax(int)}). Once constructed, an + * integer attribute's value is immutable. * - * @author David Mendenhall - * @author Alan Kaminsky + * @author David Mendenhall + * @author Alan Kaminsky */ public abstract class IntegerSyntax implements Serializable, Cloneable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 3644574816328081943L; /** * This integer attribute's integer value. + * * @serial */ private int value; @@ -54,7 +57,7 @@ /** * Construct a new integer attribute with the given integer value. * - * @param value Integer value. + * @param value Integer value */ protected IntegerSyntax(int value) { this.value = value; @@ -64,14 +67,11 @@ * Construct a new integer attribute with the given integer value, which * must lie within the given range. * - * @param value Integer value. - * @param lowerBound Lower bound. - * @param upperBound Upper bound. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than - * {@code lowerBound} or greater than - * {@code upperBound}. + * @param value Integer value + * @param lowerBound Lower bound + * @param upperBound Upper bound + * @throws IllegalArgumentException if {@code value} is less than + * {@code lowerBound} or greater than {@code upperBound} */ protected IntegerSyntax(int value, int lowerBound, int upperBound) { if (lowerBound > value || value > upperBound) { @@ -84,6 +84,7 @@ /** * Returns this integer attribute's integer value. + * * @return the integer value */ public int getValue() { @@ -93,20 +94,16 @@ /** * Returns whether this integer attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class IntegerSyntax. - *
    3. - * This integer attribute's value and {@code object}'s value are - * equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code IntegerSyntax}. + *
    3. This integer attribute's value and {@code object}'s value are + * equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this integer - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this integer + * attribute, {@code false} otherwise */ public boolean equals(Object object) { diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/PrintJobAttribute.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintJobAttribute.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintJobAttribute.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -26,19 +26,18 @@ package javax.print.attribute; /** - * PrintJobAttribute is a tagging interface which a printing attribute + * {@code PrintJobAttribute} is a tagging interface which a printing attribute * class implements to indicate the attribute describes the status of a Print - * Job or some other characteristic of a Print Job. A Print Service - * instance adds a number of PrintJobAttributes to a Print Job's attribute set - * to report the Print Job's status. If an attribute implements {@link - * PrintRequestAttribute PrintRequestAttribute} as well as PrintJobAttribute, - * the client may include the attribute in a attribute set to - * specify the attribute's value for the Print Job. + * Job or some other characteristic of a Print Job. A Print Service instance + * adds a number of {@code PrintJobAttributes} to a Print Job's attribute set to + * report the Print Job's status. If an attribute implements + * {@link PrintRequestAttribute PrintRequestAttribute} as well as + * {@code PrintJobAttribute}, the client may include the attribute in a + * attribute set to specify the attribute's value for the Print Job. * + * @author Alan Kaminsky * @see PrintRequestAttributeSet * @see PrintJobAttributeSet - * - * @author Alan Kaminsky */ public interface PrintJobAttribute extends Attribute { } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/PrintJobAttributeSet.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintJobAttributeSet.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintJobAttributeSet.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,85 +23,69 @@ * questions. */ - package javax.print.attribute; /** - * Interface PrintJobAttributeSet specifies the interface for a set of print - * job attributes, i.e. printing attributes that implement interface {@link - * PrintJobAttribute PrintJobAttribute}. In the Print Service API, a - * service uses a PrintJobAttributeSet to report the status of a print job. - *

    - * A PrintJobAttributeSet is just an {@link AttributeSet AttributeSet} whose - * constructors and mutating operations guarantee an additional invariant, - * namely that all attribute values in the PrintJobAttributeSet must be - * instances of interface {@link PrintJobAttribute PrintJobAttribute}. - * The {@link #add(Attribute) add(Attribute)}, and - * {@link #addAll(AttributeSet) >addAll(AttributeSet)} operations - * are respecified below to guarantee this additional invariant. + * Interface {@code PrintJobAttributeSet} specifies the interface for a set of + * print job attributes, i.e. printing attributes that implement interface + * {@link PrintJobAttribute PrintJobAttribute}. In the Print Service API, a + * service uses a {@code PrintJobAttributeSet} to report the status of a print + * job. + *

    + * A {@code PrintJobAttributeSet} is just an {@link AttributeSet AttributeSet} + * whose constructors and mutating operations guarantee an additional invariant, + * namely that all attribute values in the {@code PrintJobAttributeSet} must be + * instances of interface {@link PrintJobAttribute PrintJobAttribute}. The + * {@link #add(Attribute) add(Attribute)}, and + * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations are respecified + * below to guarantee this additional invariant. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public interface PrintJobAttributeSet extends AttributeSet { /** * Adds the specified attribute value to this attribute set if it is not - * already present, first removing any existing value in the same - * attribute category as the specified attribute value (optional - * operation). - * - * @param attribute Attribute value to be added to this attribute set. - * - * @return {@code true} if this attribute set changed as a result of - * the call, i.e., the given attribute value was not already a - * member of this attribute set. + * already present, first removing any existing value in the same attribute + * category as the specified attribute value (optional operation). * - * @throws UnmodifiableSetException - * (unchecked exception) Thrown if this attribute set does not - * support the {@code add()} operation. - * @throws ClassCastException - * (unchecked exception) Thrown if the {@code attribute} is - * not an instance of interface - * {@link PrintJobAttribute PrintJobAttribute}. - * @throws NullPointerException - * (unchecked exception) Thrown if the {@code attribute} is null. + * @param attribute attribute value to be added to this attribute set + * @return {@code true} if this attribute set changed as a result of the + * call, i.e., the given attribute value was not already a member of + * this attribute set + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code add()} operation + * @throws ClassCastException if the {@code attribute} is not an instance of + * interface {@link PrintJobAttribute PrintJobAttribute} + * @throws NullPointerException if the {@code attribute} is {@code null} */ public boolean add(Attribute attribute); /** - * Adds all of the elements in the specified set to this attribute. - * The outcome is the same as if the - * {@link #add(Attribute) add(Attribute)} - * operation had been applied to this attribute set successively with - * each element from the specified set. If none of the categories in the - * specified set are the same as any categories in this attribute set, - * the {@code addAll()} operation effectively modifies this attribute - * set so that its value is the union of the two sets. - *

    - * The behavior of the {@code addAll()} operation is unspecified if - * the specified set is modified while the operation is in progress. - *

    - * If the {@code addAll()} operation throws an exception, the effect - * on this attribute set's state is implementation dependent; elements - * from the specified set before the point of the exception may or - * may not have been added to this attribute set. + * Adds all of the elements in the specified set to this attribute. The + * outcome is the same as if the {@link #add(Attribute) add(Attribute)} + * operation had been applied to this attribute set successively with each + * element from the specified set. If none of the categories in the + * specified set are the same as any categories in this attribute set, the + * {@code addAll()} operation effectively modifies this attribute set so + * that its value is the union of the two sets. + *

    + * The behavior of the {@code addAll()} operation is unspecified if the + * specified set is modified while the operation is in progress. + *

    + * If the {@code addAll()} operation throws an exception, the effect on this + * attribute set's state is implementation dependent; elements from the + * specified set before the point of the exception may or may not have been + * added to this attribute set. * - * @param attributes whose elements are to be added to this attribute - * set. - * - * @return {@code true} if this attribute set changed as a result of - * the call. - * - * @throws UnmodifiableSetException - * (Unchecked exception) Thrown if this attribute set does not - * support the {@code addAll()} method. - * @throws ClassCastException - * (Unchecked exception) Thrown if some element in the specified - * set is not an instance of interface {@link PrintJobAttribute - * PrintJobAttribute}. - * @throws NullPointerException - * (Unchecked exception) Thrown if the specified set is null. - * + * @param attributes whose elements are to be added to this attribute set + * @return {@code true} if this attribute set changed as a result of the + * call + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code addAll()} method + * @throws ClassCastException if some element in the specified set is not an + * instance of interface {@link PrintJobAttribute PrintJobAttribute} + * @throws NullPointerException if the specified set is {@code null} * @see #add(Attribute) */ public boolean addAll(AttributeSet attributes); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/PrintRequestAttribute.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintRequestAttribute.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintRequestAttribute.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,28 +23,25 @@ * questions. */ - package javax.print.attribute; /** - * Interface PrintRequestAttribute is a tagging interface which a printing - * attribute class implements to indicate the attribute denotes a + * Interface {@code PrintRequestAttribute} is a tagging interface which a + * printing attribute class implements to indicate the attribute denotes a * requested setting for a print job. *

    - * Attributes which are tagged with PrintRequestAttribute and are also tagged - * as PrintJobAttribute, represent the subset of job attributes which - * can be part of the specification of a job request. + * Attributes which are tagged with {@code PrintRequestAttribute} and are also + * tagged as {@code PrintJobAttribute}, represent the subset of job attributes + * which can be part of the specification of a job request. *

    - * If an attribute implements {@link DocAttribute DocAttribute} - * as well as PrintRequestAttribute, the client may include the - * attribute in a {@code Doc}'s attribute set to specify - * a job setting which pertains just to that doc. + * If an attribute implements {@link DocAttribute DocAttribute} as well as + * {@code PrintRequestAttribute}, the client may include the attribute in a + * {@code Doc}'s attribute set to specify a job setting which pertains just to + * that doc. * + * @author Alan Kaminsky * @see DocAttributeSet * @see PrintRequestAttributeSet - * - * @author Alan Kaminsky */ - public interface PrintRequestAttribute extends Attribute { } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/PrintRequestAttributeSet.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintRequestAttributeSet.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintRequestAttributeSet.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,88 +23,72 @@ * questions. */ - package javax.print.attribute; /** - * Interface PrintRequestAttributeSet specifies the interface for a set of - * print request attributes, i.e. printing attributes that implement interface - * {@link PrintRequestAttribute PrintRequestAttribute}. - * The client uses a PrintRequestAttributeSet to specify the settings to be - * applied to a whole print job and to all the docs in the print job. - *

    - * PrintRequestAttributeSet is just an {@link AttributeSet AttributeSet} whose - * constructors and mutating operations guarantee an additional invariant, - * namely that all attribute values in the PrintRequestAttributeSet must be - * instances of interface {@link PrintRequestAttribute PrintRequestAttribute}. - * The {@link #add(Attribute) add(Attribute)}, and - * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations - * are respecified below to guarantee this additional invariant. + * Interface {@code PrintRequestAttributeSet} specifies the interface for a set + * of print request attributes, i.e. printing attributes that implement + * interface {@link PrintRequestAttribute PrintRequestAttribute}. The client + * uses a {@code PrintRequestAttributeSet} to specify the settings to be applied + * to a whole print job and to all the docs in the print job. + *

    + * {@code PrintRequestAttributeSet} is just an {@link AttributeSet AttributeSet} + * whose constructors and mutating operations guarantee an additional invariant, + * namely that all attribute values in the {@code PrintRequestAttributeSet} must + * be instances of interface + * {@link PrintRequestAttribute PrintRequestAttribute}. The + * {@link #add(Attribute) add(Attribute)}, and + * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations are respecified + * below to guarantee this additional invariant. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public interface PrintRequestAttributeSet extends AttributeSet { /** * Adds the specified attribute value to this attribute set if it is not - * already present, first removing any existing value in the same - * attribute category as the specified attribute value (optional - * operation). - * - * @param attribute Attribute value to be added to this attribute set. - * - * @return {@code true} if this attribute set changed as a result of - * the call, i.e., the given attribute value was not already a - * member of this attribute set. + * already present, first removing any existing value in the same attribute + * category as the specified attribute value (optional operation). * - * @throws UnmodifiableSetException - * (unchecked exception) Thrown if this attribute set does not - * support the {@code add()} operation. - * @throws ClassCastException - * (unchecked exception) Thrown if the {@code attribute} is - * not an instance of interface - * {@link PrintRequestAttribute PrintRequestAttribute}. - * @throws NullPointerException - * (unchecked exception) Thrown if the {@code attribute} is null. + * @param attribute attribute value to be added to this attribute set + * @return {@code true} if this attribute set changed as a result of the + * call, i.e., the given attribute value was not already a member of + * this attribute set + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code add()} operation + * @throws ClassCastException if the {@code attribute} is not an instance of + * interface {@link PrintRequestAttribute PrintRequestAttribute} + * @throws NullPointerException if the {@code attribute} is {@code null} */ public boolean add(Attribute attribute); /** - * Adds all of the elements in the specified set to this attribute. - * The outcome is the same as if the - * {@link #add(Attribute) add(Attribute)} - * operation had been applied to this attribute set successively with - * each element from the specified set. If none of the categories in the - * specified set are the same as any categories in this attribute set, - * the {@code addAll()} operation effectively modifies this attribute - * set so that its value is the union of the two sets. - *

    - * The behavior of the {@code addAll()} operation is unspecified if - * the specified set is modified while the operation is in progress. - *

    - * If the {@code addAll()} operation throws an exception, the effect - * on this attribute set's state is implementation dependent; elements - * from the specified set before the point of the exception may or - * may not have been added to this attribute set. + * Adds all of the elements in the specified set to this attribute. The + * outcome is the same as if the {@link #add(Attribute) add(Attribute)} + * operation had been applied to this attribute set successively with each + * element from the specified set. If none of the categories in the + * specified set are the same as any categories in this attribute set, the + * {@code addAll()} operation effectively modifies this attribute set so + * that its value is the union of the two sets. + *

    + * The behavior of the {@code addAll()} operation is unspecified if the + * specified set is modified while the operation is in progress. + *

    + * If the {@code addAll()} operation throws an exception, the effect on this + * attribute set's state is implementation dependent; elements from the + * specified set before the point of the exception may or may not have been + * added to this attribute set. * - * @param attributes whose elements are to be added to this attribute - * set. - * - * @return {@code true} if this attribute set changed as a result of - * the call. - * - * @throws UnmodifiableSetException - * (Unchecked exception) Thrown if this attribute set does not - * support the {@code addAll()} method. - * @throws ClassCastException - * (Unchecked exception) Thrown if some element in the specified - * set is not an instance of interface {@link PrintRequestAttribute - * PrintRequestAttribute}. - * @throws NullPointerException - * (Unchecked exception) Thrown if the specified set is null. - * + * @param attributes whose elements are to be added to this attribute set + * @return {@code true} if this attribute set changed as a result of the + * call + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code addAll()} method + * @throws ClassCastException if some element in the specified set is not an + * instance of interface + * {@link PrintRequestAttribute PrintRequestAttribute} + * @throws NullPointerException if the specified set is {@code null} * @see #add(Attribute) */ public boolean addAll(AttributeSet attributes); - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/PrintServiceAttribute.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintServiceAttribute.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintServiceAttribute.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -26,15 +26,14 @@ package javax.print.attribute; /** - * Interface PrintServiceAttribute is a tagging interface which a printing - * attribute class implements to indicate the attribute describes the status - * of a Print Service or some other characteristic of a Print Service. A Print - * Service instance adds a number of PrintServiceAttributes to a Print - * service's attribute set to report the Print Service's status. + * Interface {@code PrintServiceAttribute} is a tagging interface which a + * printing attribute class implements to indicate the attribute describes the + * status of a Print Service or some other characteristic of a Print Service. A + * Print Service instance adds a number of {@code PrintServiceAttributes} to a + * Print service's attribute set to report the Print Service's status. * + * @author Alan Kaminsky * @see PrintServiceAttributeSet - * - * @author Alan Kaminsky */ public interface PrintServiceAttribute extends Attribute { } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/PrintServiceAttributeSet.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintServiceAttributeSet.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/PrintServiceAttributeSet.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,90 +23,71 @@ * questions. */ - package javax.print.attribute; /** - * Interface PrintServiceAttributeSet specifies the interface for a set of - * print job attributes, i.e. printing attributes that implement interface - * {@link - * PrintServiceAttribute PrintServiceAttribute}. In the Print Service API, - * the Print Service instance uses a PrintServiceAttributeSet to report the - * status of the print service. - *

    - * A PrintServiceAttributeSet is just an {@link AttributeSet AttributeSet} - * whose constructors and mutating operations guarantee an additional - * invariant, - * namely that all attribute values in the PrintServiceAttributeSet must be - * instances of interface {@link PrintServiceAttribute PrintServiceAttribute}. - * The {@link #add(Attribute) add(Attribute)}, and - * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations - * are respecified below to guarantee this additional invariant. + * Interface {@code PrintServiceAttributeSet} specifies the interface for a set + * of print job attributes, i.e. printing attributes that implement interface + * {@link PrintServiceAttribute PrintServiceAttribute}. In the Print Service + * API, the Print Service instance uses a {@code PrintServiceAttributeSet} to + * report the status of the print service. + *

    + * A {@code PrintServiceAttributeSet} is just an + * {@link AttributeSet AttributeSet} whose constructors and mutating operations + * guarantee an additional invariant, namely that all attribute values in the + * {@code PrintServiceAttributeSet} must be instances of interface + * {@link PrintServiceAttribute PrintServiceAttribute}. The + * {@link #add(Attribute) add(Attribute)}, and + * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations are respecified + * below to guarantee this additional invariant. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public interface PrintServiceAttributeSet extends AttributeSet { - - /** * Adds the specified attribute value to this attribute set if it is not - * already present, first removing any existing value in the same - * attribute category as the specified attribute value (optional - * operation). - * - * @param attribute Attribute value to be added to this attribute set. - * - * @return {@code true} if this attribute set changed as a result of - * the call, i.e., the given attribute value was not already a - * member of this attribute set. + * already present, first removing any existing value in the same attribute + * category as the specified attribute value (optional operation). * - * @throws UnmodifiableSetException - * (unchecked exception) Thrown if this attribute set does not - * support the {@code add()} operation. - * @throws ClassCastException - * (unchecked exception) Thrown if the {@code attribute} is - * not an instance of interface - * {@link PrintServiceAttribute PrintServiceAttribute}. - * @throws NullPointerException - * (unchecked exception) Thrown if the {@code attribute} is null. + * @param attribute attribute value to be added to this attribute set + * @return {@code true} if this attribute set changed as a result of the + * call, i.e., the given attribute value was not already a member of + * this attribute set + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code add()} operation + * @throws ClassCastException if the {@code attribute} is not an instance of + * interface {@link PrintServiceAttribute PrintServiceAttribute} + * @throws NullPointerException if the {@code attribute} is {@code null} */ public boolean add(Attribute attribute); /** - * Adds all of the elements in the specified set to this attribute. - * The outcome is the same as if the - * {@link #add(Attribute) add(Attribute)} - * operation had been applied to this attribute set successively with - * each element from the specified set. If none of the categories in the - * specified set are the same as any categories in this attribute set, - * the {@code addAll()} operation effectively modifies this attribute - * set so that its value is the union of the two sets. - *

    - * The behavior of the {@code addAll()} operation is unspecified if - * the specified set is modified while the operation is in progress. - *

    - * If the {@code addAll()} operation throws an exception, the effect - * on this attribute set's state is implementation dependent; elements - * from the specified set before the point of the exception may or - * may not have been added to this attribute set. + * Adds all of the elements in the specified set to this attribute. The + * outcome is the same as if the {@link #add(Attribute) add(Attribute)} + * operation had been applied to this attribute set successively with each + * element from the specified set. If none of the categories in the + * specified set are the same as any categories in this attribute set, the + * {@code addAll()} operation effectively modifies this attribute set so + * that its value is the union of the two sets. + *

    + * The behavior of the {@code addAll()} operation is unspecified if the + * specified set is modified while the operation is in progress. + *

    + * If the {@code addAll()} operation throws an exception, the effect on this + * attribute set's state is implementation dependent; elements from the + * specified set before the point of the exception may or may not have been + * added to this attribute set. * - * @param attributes whose elements are to be added to this attribute - * set. - * - * @return {@code true} if this attribute set changed as a result of - * the call. - * - * @throws UnmodifiableSetException - * (Unchecked exception) Thrown if this attribute set does not - * support the {@code addAll()} method. - * @throws ClassCastException - * (Unchecked exception) Thrown if some element in the specified - * set is not an instance of interface {@link PrintServiceAttribute - * PrintServiceAttribute}. - * @throws NullPointerException - * (Unchecked exception) Thrown if the specified set is null. - * + * @param attributes whose elements are to be added to this attribute set + * @return {@code true} if this attribute set changed as a result of the + * call + * @throws UnmodifiableSetException if this attribute set does not support + * the {@code addAll()} method + * @throws ClassCastException if some element in the specified set is not an + * instance of interface + * {@link PrintServiceAttribute PrintServiceAttribute} + * @throws NullPointerException if the specified set is {@code null} * @see #add(Attribute) */ public boolean addAll(AttributeSet attributes); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/ResolutionSyntax.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/ResolutionSyntax.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/ResolutionSyntax.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,29 +23,27 @@ * questions. */ - package javax.print.attribute; import java.io.Serializable; /** - * Class ResolutionSyntax is an abstract base class providing the common + * Class {@code ResolutionSyntax} is an abstract base class providing the common * implementation of all attributes denoting a printer resolution. - *

    + *

    * A resolution attribute's value consists of two items, the cross feed * direction resolution and the feed direction resolution. A resolution * attribute may be constructed by supplying the two values and indicating the * units in which the values are measured. Methods are provided to return a * resolution attribute's values, indicating the units in which the values are * to be returned. The two most common resolution units are dots per inch (dpi) - * and dots per centimeter (dpcm), and exported constants {@link #DPI - * DPI} and {@link #DPCM DPCM} are provided for - * indicating those units. - *

    + * and dots per centimeter (dpcm), and exported constants {@link #DPI DPI} and + * {@link #DPCM DPCM} are provided for indicating those units. + *

    * Once constructed, a resolution attribute's value is immutable. - *

    - * Design - *

    + *

    + * Design + *

    * A resolution attribute's cross feed direction resolution and feed direction * resolution values are stored internally using units of dots per 100 inches * (dphi). Storing the values in dphi rather than, say, metric units allows @@ -57,43 +55,47 @@ * resolution attribute's values are created in one units and retrieved in * different units; for example, 600 dpi will be rounded to 236 dpcm, whereas * the true value (to five figures) is 236.22 dpcm. - *

    + *

    * Storing the values internally in common units of dphi lets two resolution * attributes be compared without regard to the units in which they were * created; for example, 300 dpcm will compare equal to 762 dpi, as they both - * are stored as 76200 dphi. In particular, a lookup service can - * match resolution attributes based on equality of their serialized - * representations regardless of the units in which they were created. Again, - * using integers for internal storage allows precise equality comparisons to be - * done, which would not be guaranteed if a floating point representation were - * used. - *

    - * The exported constant {@link #DPI DPI} is actually the - * conversion factor by which to multiply a value in dpi to get the value in - * dphi. Likewise, the exported constant {@link #DPCM DPCM} is the - * conversion factor by which to multiply a value in dpcm to get the value in - * dphi. A client can specify a resolution value in units other than dpi or dpcm - * by supplying its own conversion factor. However, since the internal units of - * dphi was chosen with supporting only the external units of dpi and dpcm in - * mind, there is no guarantee that the conversion factor for the client's units - * will be an exact integer. If the conversion factor isn't an exact integer, - * resolution values in the client's units won't be stored precisely. + * are stored as 76200 dphi. In particular, a lookup service can match + * resolution attributes based on equality of their serialized representations + * regardless of the units in which they were created. Again, using integers for + * internal storage allows precise equality comparisons to be done, which would + * not be guaranteed if a floating point representation were used. + *

    + * The exported constant {@link #DPI DPI} is actually the conversion factor by + * which to multiply a value in dpi to get the value in dphi. Likewise, the + * exported constant {@link #DPCM DPCM} is the conversion factor by which to + * multiply a value in dpcm to get the value in dphi. A client can specify a + * resolution value in units other than dpi or dpcm by supplying its own + * conversion factor. However, since the internal units of dphi was chosen with + * supporting only the external units of dpi and dpcm in mind, there is no + * guarantee that the conversion factor for the client's units will be an exact + * integer. If the conversion factor isn't an exact integer, resolution values + * in the client's units won't be stored precisely. * - * @author David Mendenhall - * @author Alan Kaminsky + * @author David Mendenhall + * @author Alan Kaminsky */ public abstract class ResolutionSyntax implements Serializable, Cloneable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 2706743076526672017L; /** * Cross feed direction resolution in units of dots per 100 inches (dphi). + * * @serial */ private int crossFeedResolution; /** * Feed direction resolution in units of dots per 100 inches (dphi). + * * @serial */ private int feedResolution; @@ -105,26 +107,20 @@ public static final int DPI = 100; /** - * Value to indicate units of dots per centimeter (dpcm). It is actually - * the conversion factor by which to multiply dpcm to yield dphi (254). + * Value to indicate units of dots per centimeter (dpcm). It is actually the + * conversion factor by which to multiply dpcm to yield dphi (254). */ public static final int DPCM = 254; - /** * Construct a new resolution attribute from the given items. * - * @param crossFeedResolution - * Cross feed direction resolution. - * @param feedResolution - * Feed direction resolution. - * @param units - * Unit conversion factor, e.g. {@link #DPI DPI} or - * {@link #DPCM DPCM}. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code crossFeedResolution < 1} - * or {@code feedResolution < 1} or {@code units < 1}. + * @param crossFeedResolution cross feed direction resolution + * @param feedResolution feed direction resolution + * @param units unit conversion factor, e.g. {@link #DPI DPI} or + * {@link #DPCM DPCM} + * @throws IllegalArgumentException if {@code crossFeedResolution < 1} or + * {@code feedResolution < 1} or {@code units < 1} */ public ResolutionSyntax(int crossFeedResolution, int feedResolution, int units) { @@ -147,16 +143,11 @@ * Convert a value from dphi to some other units. The result is rounded to * the nearest integer. * - * @param dphi - * Value (dphi) to convert. - * @param units - * Unit conversion factor, e.g. {@link #DPI DPI} or - * {@link #DPCM DPCM}. - * - * @return The value of {@code dphi} converted to the desired units. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units} < 1. + * @param dphi value (dphi) to convert + * @param units unit conversion factor, e.g. {@link #DPI DPI} or + * {@link #DPCM DPCM} + * @return the value of {@code dphi} converted to the desired units + * @throws IllegalArgumentException if {@code units < 1} */ private static int convertFromDphi(int dphi, int units) { if (units < 1) { @@ -167,18 +158,14 @@ } /** - * Get this resolution attribute's resolution values in the given units. - * The values are rounded to the nearest integer. + * Get this resolution attribute's resolution values in the given units. The + * values are rounded to the nearest integer. * - * @param units - * Unit conversion factor, e.g. {@link #DPI DPI} or - * {@link #DPCM DPCM}. - * - * @return A two-element array with the cross feed direction resolution - * at index 0 and the feed direction resolution at index 1. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #DPI DPI} or + * {@link #DPCM DPCM} + * @return a two-element array with the cross feed direction resolution at + * index 0 and the feed direction resolution at index 1 + * @throws IllegalArgumentException if {@code units < 1} */ public int[] getResolution(int units) { return new int[] { getCrossFeedResolution(units), @@ -190,14 +177,10 @@ * Returns this resolution attribute's cross feed direction resolution in * the given units. The value is rounded to the nearest integer. * - * @param units - * Unit conversion factor, e.g. {@link #DPI DPI} or - * {@link #DPCM DPCM}. - * - * @return Cross feed direction resolution. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #DPI DPI} or + * {@link #DPCM DPCM} + * @return cross feed direction resolution + * @throws IllegalArgumentException if {@code units < 1} */ public int getCrossFeedResolution(int units) { return convertFromDphi (crossFeedResolution, units); @@ -207,14 +190,10 @@ * Returns this resolution attribute's feed direction resolution in the * given units. The value is rounded to the nearest integer. * - * @param units - * Unit conversion factor, e.g. {@link #DPI DPI} or {@link - * #DPCM DPCM}. - * - * @return Feed direction resolution. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #DPI DPI} or + * {@link #DPCM DPCM} + * @return feed direction resolution + * @throws IllegalArgumentException if {@code units < 1} */ public int getFeedResolution(int units) { return convertFromDphi (feedResolution, units); @@ -222,22 +201,18 @@ /** * Returns a string version of this resolution attribute in the given units. - * The string takes the form "CxF U", - * where C is the cross feed direction resolution, F is the - * feed direction resolution, and U is the units name. The values are + * The string takes the form "CxF U", + * where C is the cross feed direction resolution, F is the + * feed direction resolution, and U is the units name. The values are * rounded to the nearest integer. * - * @param units - * Unit conversion factor, e.g. {@link #DPI CODE>DPI} or {@link - * #DPCM DPCM}. - * @param unitsName - * Units name string, e.g. {@code "dpi"} or {@code "dpcm"}. If - * null, no units name is appended to the result. - * - * @return String version of this resolution attribute. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #DPI CODE>DPI} or + * {@link #DPCM DPCM} + * @param unitsName units name string, e.g. {@code "dpi"} or + * {@code "dpcm"}. If {@code null}, no units name is appended to the + * result. + * @return string version of this resolution attribute + * @throws IllegalArgumentException if {@code units < 1} */ public String toString(int units, String unitsName) { StringBuilder result = new StringBuilder(); @@ -251,54 +226,43 @@ return result.toString(); } - /** - * Determine whether this resolution attribute's value is less than or - * equal to the given resolution attribute's value. This is true if all - * of the following conditions are true: - *

      - *
    • - * This attribute's cross feed direction resolution is less than or equal to - * the {@code other} attribute's cross feed direction resolution. - *
    • - * This attribute's feed direction resolution is less than or equal to the - * {@code other} attribute's feed direction resolution. - *
    + * Determine whether this resolution attribute's value is less than or equal + * to the given resolution attribute's value. This is true if all of the + * following conditions are true: + *
      + *
    • This attribute's cross feed direction resolution is less than or + * equal to the {@code other} attribute's cross feed direction resolution. + *
    • This attribute's feed direction resolution is less than or equal to + * the {@code other} attribute's feed direction resolution. + *
    * - * @param other Resolution attribute to compare with. - * - * @return True if this resolution attribute is less than or equal to the - * {@code other} resolution attribute, false otherwise. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code other} is null. + * @param other resolution attribute to compare with + * @return {@code true} if this resolution attribute is less than or equal + * to the {@code other} resolution attribute, {@code false} + * otherwise + * @throws NullPointerException if {@code other} is {@code null} */ public boolean lessThanOrEquals(ResolutionSyntax other) { return (this.crossFeedResolution <= other.crossFeedResolution && this.feedResolution <= other.feedResolution); } - /** * Returns whether this resolution attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: - *
      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class ResolutionSyntax. - *
    3. - * This attribute's cross feed direction resolution is equal to - * {@code object}'s cross feed direction resolution. - *
    4. - * This attribute's feed direction resolution is equal to - * {@code object}'s feed direction resolution. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code ResolutionSyntax}. + *
    3. This attribute's cross feed direction resolution is equal to + * {@code object}'s cross feed direction resolution. + *
    4. This attribute's feed direction resolution is equal to + * {@code object}'s feed direction resolution. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this resolution - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this resolution + * attribute, {@code false} otherwise */ public boolean equals(Object object) { @@ -320,8 +284,8 @@ /** * Returns a string version of this resolution attribute. The string takes - * the form "CxF dphi", where C is the - * cross feed direction resolution and F is the feed direction + * the form "CxF dphi", where C is the + * cross feed direction resolution and F is the feed direction * resolution. The values are reported in the internal units of dphi. */ public String toString() { @@ -333,25 +297,23 @@ return result.toString(); } - /** * Returns this resolution attribute's cross feed direction resolution in * units of dphi. (For use in a subclass.) * - * @return Cross feed direction resolution. + * @return cross feed direction resolution */ protected int getCrossFeedResolutionDphi() { return crossFeedResolution; } /** - * Returns this resolution attribute's feed direction resolution in units - * of dphi. (For use in a subclass.) + * Returns this resolution attribute's feed direction resolution in units of + * dphi. (For use in a subclass.) * - * @return Feed direction resolution. + * @return feed direction resolution */ protected int getFeedResolutionDphi() { return feedResolution; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/SetOfIntegerSyntax.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/SetOfIntegerSyntax.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/SetOfIntegerSyntax.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,82 +23,82 @@ * questions. */ - package javax.print.attribute; import java.io.Serializable; import java.util.Vector; /** - * Class SetOfIntegerSyntax is an abstract base class providing the common - * implementation of all attributes whose value is a set of nonnegative + * Class {@code SetOfIntegerSyntax} is an abstract base class providing the + * common implementation of all attributes whose value is a set of nonnegative * integers. This includes attributes whose value is a single range of integers * and attributes whose value is a set of ranges of integers. - *

    - * You can construct an instance of SetOfIntegerSyntax by giving it in "string - * form." The string consists of zero or more comma-separated integer groups. - * Each integer group consists of either one integer, two integers separated by - * a hyphen ({@code -}), or two integers separated by a colon - * ({@code :}). Each integer consists of one or more decimal digits - * ({@code 0} through {@code 9}). Whitespace characters cannot - * appear within an integer but are otherwise ignored. For example: - * {@code ""}, {@code "1"}, {@code "5-10"}, {@code "1:2, 4"}. - *

    - * You can also construct an instance of SetOfIntegerSyntax by giving it in - * "array form." Array form consists of an array of zero or more integer groups - * where each integer group is a length-1 or length-2 array of - * {@code int}s; for example, {@code int[0][]}, - * {@code int[][]{{1}}}, {@code int[][]{{5,10}}}, - * {@code int[][]{{1,2},{4}}}. - *

    + *

    + * You can construct an instance of {@code SetOfIntegerSyntax} by giving it in + * "string form." The string consists of zero or more comma-separated integer + * groups. Each integer group consists of either one integer, two integers + * separated by a hyphen ({@code -}), or two integers separated by a colon + * ({@code :}). Each integer consists of one or more decimal digits ({@code 0} + * through {@code 9}). Whitespace characters cannot appear within an integer but + * are otherwise ignored. For example: {@code ""}, {@code "1"}, {@code "5-10"}, + * {@code "1:2, 4"}. + *

    + * You can also construct an instance of {@code SetOfIntegerSyntax} by giving it + * in "array form." Array form consists of an array of zero or more integer + * groups where each integer group is a length-1 or length-2 array of + * {@code int}s; for example, {@code int[0][]}, {@code int[][]{{1}}}, + * {@code int[][]{{5,10}}}, {@code int[][]{{1,2},{4}}}. + *

    * In both string form and array form, each successive integer group gives a * range of integers to be included in the set. The first integer in each group * gives the lower bound of the range; the second integer in each group gives * the upper bound of the range; if there is only one integer in the group, the * upper bound is the same as the lower bound. If the upper bound is less than - * the lower bound, it denotes a null range (no values). If the upper bound is - * equal to the lower bound, it denotes a range consisting of a single value. If - * the upper bound is greater than the lower bound, it denotes a range + * the lower bound, it denotes a {@code null} range (no values). If the upper + * bound is equal to the lower bound, it denotes a range consisting of a single + * value. If the upper bound is greater than the lower bound, it denotes a range * consisting of more than one value. The ranges may appear in any order and are * allowed to overlap. The union of all the ranges gives the set's contents. - * Once a SetOfIntegerSyntax instance is constructed, its value is immutable. - *

    - * The SetOfIntegerSyntax object's value is actually stored in "canonical - * array form." This is the same as array form, except there are no null ranges; - * the members of the set are represented in as few ranges as possible (i.e., - * overlapping ranges are coalesced); the ranges appear in ascending order; and - * each range is always represented as a length-two array of {@code int}s - * in the form {lower bound, upper bound}. An empty set is represented as a - * zero-length array. - *

    - * Class SetOfIntegerSyntax has operations to return the set's members in - * canonical array form, to test whether a given integer is a member of the + * Once a {@code SetOfIntegerSyntax} instance is constructed, its value is + * immutable. + *

    + * The {@code SetOfIntegerSyntax} object's value is actually stored in + * "canonical array form." This is the same as array form, except there + * are no {@code null} ranges; the members of the set are represented in as few + * ranges as possible (i.e., overlapping ranges are coalesced); the ranges + * appear in ascending order; and each range is always represented as a + * length-two array of {@code int}s in the form {lower bound, upper bound}. An + * empty set is represented as a zero-length array. + *

    + * Class {@code SetOfIntegerSyntax} has operations to return the set's members + * in canonical array form, to test whether a given integer is a member of the * set, and to iterate through the members of the set. * - * @author David Mendenhall - * @author Alan Kaminsky + * @author David Mendenhall + * @author Alan Kaminsky */ public abstract class SetOfIntegerSyntax implements Serializable, Cloneable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 3666874174847632203L; /** * This set's members in canonical array form. + * * @serial */ private int[][] members; - /** - * Construct a new set-of-integer attribute with the given members in - * string form. + * Construct a new set-of-integer attribute with the given members in string + * form. * - * @param members Set members in string form. If null, an empty set is - * constructed. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code members} does not - * obey the proper syntax. + * @param members set members in string form. If {@code null}, an empty set + * is constructed. + * @throws IllegalArgumentException if {@code members} does not obey the + * proper syntax */ protected SetOfIntegerSyntax(String members) { this.members = parse (members); @@ -106,6 +106,9 @@ /** * Parse the given string, returning canonical array form. + * + * @param members the string + * @return the canonical array form */ private static int[][] parse(String members) { // Create vector to hold int[] elements, each element being one range @@ -238,8 +241,8 @@ } /** - * Accumulate the given range (lb .. ub) into the canonical array form - * into the given vector of int[] objects. + * Accumulate the given range (lb .. ub) into the canonical array form into + * the given vector of int[] objects. */ private static void accumulate(Vector ranges, int lb,int ub) { // Make sure range is non-null. @@ -257,12 +260,12 @@ int[] rangeb = ranges.elementAt (j+1); int lbb = rangeb[0]; int ubb = rangeb[1]; - - /* If the two ranges overlap or are adjacent, coalesce them. - * The two ranges overlap if the larger lower bound is less - * than or equal to the smaller upper bound. The two ranges - * are adjacent if the larger lower bound is one greater - * than the smaller upper bound. + /* + * If the two ranges overlap or are adjacent, coalesce them. The + * two ranges overlap if the larger lower bound is less than or + * equal to the smaller upper bound. The two ranges are adjacent + * if the larger lower bound is one greater than the smaller + * upper bound. */ if (Math.max(lba, lbb) - Math.min(uba, ubb) <= 1) { // The coalesced range is from the smaller lower bound to @@ -279,9 +282,10 @@ ranges.setElementAt (rangeb, j); ranges.setElementAt (rangea, j+1); } else { - /* If the two ranges don't overlap and aren't adjacent and - * aren't out of order, we're done early. - */ + /* + * If the two ranges don't overlap and aren't adjacent and + * aren't out of order, we're done early. + */ break; } } @@ -296,20 +300,16 @@ } /** - * Construct a new set-of-integer attribute with the given members in - * array form. - * - * @param members Set members in array form. If null, an empty set is - * constructed. + * Construct a new set-of-integer attribute with the given members in array + * form. * - * @exception NullPointerException - * (Unchecked exception) Thrown if any element of - * {@code members} is null. - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if any element of - * {@code members} is not a length-one or length-two array or if - * any non-null range in {@code members} has a lower bound less - * than zero. + * @param members set members in array form. If {@code null}, an empty set + * is constructed. + * @throws NullPointerException if any element of {@code members} is + * {@code null} + * @throws IllegalArgumentException if any element of {@code members} is not + * a length-one or length-two array or if any {@code non-null} range + * in {@code members} has a lower bound less than zero */ protected SetOfIntegerSyntax(int[][] members) { this.members = parse (members); @@ -353,11 +353,8 @@ /** * Construct a new set-of-integer attribute containing a single integer. * - * @param member Set member. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code member} is less than - * zero. + * @param member set member + * @throws IllegalArgumentException if {@code member} is negative */ protected SetOfIntegerSyntax(int member) { if (member < 0) { @@ -371,12 +368,10 @@ * integers. If the lower bound is greater than the upper bound (a null * range), an empty set is constructed. * - * @param lowerBound Lower bound of the range. - * @param upperBound Upper bound of the range. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if the range is non-null and - * {@code lowerBound} is less than zero. + * @param lowerBound Lower bound of the range + * @param upperBound Upper bound of the range + * @throws IllegalArgumentException if the range is {@code non-null} and + * {@code lowerBound} is less than zero */ protected SetOfIntegerSyntax(int lowerBound, int upperBound) { if (lowerBound <= upperBound && lowerBound < 0) { @@ -387,13 +382,12 @@ new int[0][]; } - /** * Obtain this set-of-integer attribute's members in canonical array form. * The returned array is "safe;" the client may alter it without affecting * this set-of-integer attribute. * - * @return This set-of-integer attribute's members in canonical array form. + * @return this set-of-integer attribute's members in canonical array form */ public int[][] getMembers() { int n = members.length; @@ -407,10 +401,9 @@ /** * Determine if this set-of-integer attribute contains the given value. * - * @param x Integer value. - * - * @return True if this set-of-integer attribute contains the value - * {@code x}, false otherwise. + * @param x the Integer value + * @return {@code true} if this set-of-integer attribute contains the value + * {@code x}, {@code false} otherwise */ public boolean contains(int x) { // Do a linear search to find the range that contains x, if any. @@ -429,10 +422,9 @@ * Determine if this set-of-integer attribute contains the given integer * attribute's value. * - * @param attribute Integer attribute. - * - * @return True if this set-of-integer attribute contains - * {@code theAttribute}'s value, false otherwise. + * @param attribute the Integer attribute + * @return {@code true} if this set-of-integer attribute contains + * {@code attribute}'s value, {@code false} otherwise */ public boolean contains(IntegerSyntax attribute) { return contains (attribute.getValue()); @@ -446,20 +438,19 @@ * values, {@code -1} will never appear in the set.) You can use the * {@code next()} method to iterate through the integer values in a * set-of-integer attribute in ascending order, like this: - *

    +     * 
          *     SetOfIntegerSyntax attribute = . . .;
          *     int i = -1;
          *     while ((i = attribute.next (i)) != -1)
          *         {
          *         foo (i);
          *         }
    -     * 
    - * - * @param x Integer value. + *
    * - * @return The smallest integer in this set-of-integer attribute that is - * greater than {@code x}, or {@code -1} if no integer in - * this set-of-integer attribute is greater than {@code x}. + * @param x the Integer value + * @return the smallest integer in this set-of-integer attribute that is + * greater than {@code x}, or {@code -1} if no integer in this + * set-of-integer attribute is greater than {@code x}. */ public int next(int x) { // Do a linear search to find the range that contains x, if any. @@ -478,20 +469,16 @@ * Returns whether this set-of-integer attribute is equivalent to the passed * in object. To be equivalent, all of the following conditions must be * true: - *
      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class SetOfIntegerSyntax. - *
    3. - * This set-of-integer attribute's members and {@code object}'s - * members are the same. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code SetOfIntegerSyntax}. + *
    3. This set-of-integer attribute's members and {@code object}'s + * members are the same. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this - * set-of-integer attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this + * set-of-integer attribute, {@code false} otherwise */ public boolean equals(Object object) { if (object != null && object instanceof SetOfIntegerSyntax) { @@ -533,9 +520,9 @@ * Returns a string value corresponding to this set-of-integer attribute. * The string value is a zero-length string if this set is empty. Otherwise, * the string value is a comma-separated list of the ranges in the canonical - * array form, where each range is represented as "i" if + * array form, where each range is represented as "i" if * the lower bound equals the upper bound or - * "i-j" otherwise. + * "i-j" otherwise. */ public String toString() { StringBuilder result = new StringBuilder(); @@ -552,5 +539,4 @@ } return result.toString(); } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/Size2DSyntax.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/Size2DSyntax.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/Size2DSyntax.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,75 +23,78 @@ * questions. */ - package javax.print.attribute; import java.io.Serializable; /** - * Class Size2DSyntax is an abstract base class providing the common + * Class {@code Size2DSyntax} is an abstract base class providing the common * implementation of all attributes denoting a size in two dimensions. - *

    - * A two-dimensional size attribute's value consists of two items, the X - * dimension and the Y dimension. A two-dimensional size attribute may be - * constructed by supplying the two values and indicating the units in which the - * values are measured. Methods are provided to return a two-dimensional size - * attribute's values, indicating the units in which the values are to be + *

    + * A two-dimensional size attribute's value consists of two items, the {@code X} + * dimension and the {@code Y} dimension. A two-dimensional size attribute may + * be constructed by supplying the two values and indicating the units in which + * the values are measured. Methods are provided to return a two-dimensional + * size attribute's values, indicating the units in which the values are to be * returned. The two most common size units are inches (in) and millimeters - * (mm), and exported constants {@link #INCH INCH} and {@link #MM - * MM} are provided for indicating those units. - *

    + * (mm), and exported constants {@link #INCH INCH} and {@link #MM MM} are + * provided for indicating those units. + *

    * Once constructed, a two-dimensional size attribute's value is immutable. - *

    - * Design - *

    - * A two-dimensional size attribute's X and Y dimension values are stored - * internally as integers in units of micrometers (µm), where 1 micrometer - * = 10-6 meter = 1/1000 millimeter = 1/25400 inch. This permits - * dimensions to be represented exactly to a precision of 1/1000 mm (= 1 + *

    + * Design + *

    + * A two-dimensional size attribute's {@code X} and {@code Y} dimension values + * are stored internally as integers in units of micrometers (µm), where 1 + * micrometer = 10-6 meter = 1/1000 millimeter = 1/25400 inch. This + * permits dimensions to be represented exactly to a precision of 1/1000 mm (= 1 * µm) or 1/100 inch (= 254 µm). If fractional inches are expressed in * negative powers of two, this permits dimensions to be represented exactly to * a precision of 1/8 inch (= 3175 µm) but not 1/16 inch (because 1/16 inch * does not equal an integral number of µm). - *

    + *

    * Storing the dimensions internally in common units of µm lets two size * attributes be compared without regard to the units in which they were * created; for example, 8.5 in will compare equal to 215.9 mm, as they both are - * stored as 215900 µm. For example, a lookup service can - * match resolution attributes based on equality of their serialized - * representations regardless of the units in which they were created. Using - * integers for internal storage allows precise equality comparisons to be done, - * which would not be guaranteed if an internal floating point representation - * were used. Note that if you're looking for U.S. letter sized media in metric - * units, you have to search for a media size of 215.9 x 279.4 mm; rounding off - * to an integral 216 x 279 mm will not match. - *

    - * The exported constant {@link #INCH INCH} is actually the - * conversion factor by which to multiply a value in inches to get the value in - * µm. Likewise, the exported constant {@link #MM MM} is the - * conversion factor by which to multiply a value in mm to get the value in - * µm. A client can specify a resolution value in units other than inches - * or mm by supplying its own conversion factor. However, since the internal - * units of µm was chosen with supporting only the external units of inch - * and mm in mind, there is no guarantee that the conversion factor for the - * client's units will be an exact integer. If the conversion factor isn't an - * exact integer, resolution values in the client's units won't be stored - * precisely. + * stored as 215900 µm. For example, a lookup service can match resolution + * attributes based on equality of their serialized representations regardless + * of the units in which they were created. Using integers for internal storage + * allows precise equality comparisons to be done, which would not be guaranteed + * if an internal floating point representation were used. Note that if you're + * looking for {@code U.S. letter} sized media in metric units, you have to + * search for a media size of 215.9 x 279.4 mm; rounding off to an integral + * 216 x 279 mm will not match. + *

    + * The exported constant {@link #INCH INCH} is actually the conversion factor by + * which to multiply a value in inches to get the value in µm. Likewise, + * the exported constant {@link #MM MM} is the conversion factor by which to + * multiply a value in mm to get the value in µm. A client can specify a + * resolution value in units other than inches or mm by supplying its own + * conversion factor. However, since the internal units of µm was chosen + * with supporting only the external units of inch and mm in mind, there is no + * guarantee that the conversion factor for the client's units will be an exact + * integer. If the conversion factor isn't an exact integer, resolution values + * in the client's units won't be stored precisely. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public abstract class Size2DSyntax implements Serializable, Cloneable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 5584439964938660530L; /** - * X dimension in units of micrometers (µm). + * {@code X} dimension in units of micrometers (µm). + * * @serial */ private int x; /** - * Y dimension in units of micrometers (µm). + * {@code Y} dimension in units of micrometers (µm). + * * @serial */ private int y; @@ -108,20 +111,16 @@ */ public static final int MM = 1000; - /** * Construct a new two-dimensional size attribute from the given * floating-point values. * - * @param x X dimension. - * @param y Y dimension. - * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or - * {@code units < 1}. + * @param x {@code X} dimension + * @param y {@code Y} dimension + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or + * {@code units < 1} */ protected Size2DSyntax(float x, float y, int units) { if (x < 0.0f) { @@ -141,15 +140,12 @@ * Construct a new two-dimensional size attribute from the given integer * values. * - * @param x X dimension. - * @param y Y dimension. - * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} - * or {@code units < 1}. + * @param x {@code X} dimension + * @param y {@code Y} dimension + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or + * {@code units < 1} */ protected Size2DSyntax(int x, int y, int units) { if (x < 0) { @@ -169,16 +165,11 @@ * Convert a value from micrometers to some other units. The result is * returned as a floating-point number. * - * @param x - * Value (micrometers) to convert. - * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. - * - * @return The value of {@code x} converted to the desired units. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units} < 1. + * @param x value (micrometers) to convert + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @return the value of {@code x} converted to the desired units + * @throws IllegalArgumentException if {@code units < 1} */ private static float convertFromMicrometers(int x, int units) { if (units < 1) { @@ -191,46 +182,37 @@ * Get this two-dimensional size attribute's dimensions in the given units * as floating-point values. * - * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or {@link #MM MM}. - * - * @return A two-element array with the X dimension at index 0 and the Y - * dimension at index 1. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @return a two-element array with the {@code X} dimension at index 0 and + * the {@code Y} dimension at index 1 + * @throws IllegalArgumentException if {@code units < 1} */ public float[] getSize(int units) { return new float[] {getX(units), getY(units)}; } /** - * Returns this two-dimensional size attribute's X dimension in the given - * units as a floating-point value. + * Returns this two-dimensional size attribute's {@code X} dimension in the + * given units as a floating-point value. * - * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or {@link #MM MM}. - * - * @return X dimension. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @return {@code X} dimension + * @throws IllegalArgumentException if {@code units < 1} */ public float getX(int units) { return convertFromMicrometers(x, units); } /** - * Returns this two-dimensional size attribute's Y dimension in the given - * units as a floating-point value. + * Returns this two-dimensional size attribute's {@code Y} dimension in the + * given units as a floating-point value. * - * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or {@link #MM MM}. - * - * @return Y dimension. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @return {@code Y} dimension + * @throws IllegalArgumentException if {@code units < 1} */ public float getY(int units) { return convertFromMicrometers(y, units); @@ -238,22 +220,17 @@ /** * Returns a string version of this two-dimensional size attribute in the - * given units. The string takes the form "XxY - * U", where X is the X dimension, Y is the Y - * dimension, and U is the units name. The values are displayed in - * floating point. - * - * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or {@link #MM MM}. + * given units. The string takes the form "XxY + * U", where X is the {@code X} dimension, Y is + * the {@code Y} dimension, and U is the units name. The values are + * displayed in floating point. * - * @param unitsName - * Units name string, e.g. {@code in} or {@code mm}. If - * null, no units name is appended to the result. - * - * @return String version of this two-dimensional size attribute. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @param unitsName units name string, e.g. {@code in} or {@code mm}. If + * {@code null}, no units name is appended to the result + * @return {@code String} version of this two-dimensional size attribute + * @throws IllegalArgumentException if {@code units < 1} */ public String toString(int units, String unitsName) { StringBuilder result = new StringBuilder(); @@ -271,23 +248,18 @@ * Returns whether this two-dimensional size attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions must * be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class Size2DSyntax. - *
    3. - * This attribute's X dimension is equal to {@code object}'s X - * dimension. - *
    4. - * This attribute's Y dimension is equal to {@code object}'s Y - * dimension. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code Size2DSyntax} + *
    3. This attribute's {@code X} dimension is equal to {@code object}'s + * {@code X} dimension. + *
    4. This attribute's {@code Y} dimension is equal to {@code object}'s + * {@code Y} dimension. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this - * two-dimensional size attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this + * two-dimensional size attribute, {@code false} otherwise */ public boolean equals(Object object) { return(object != null && @@ -306,9 +278,9 @@ /** * Returns a string version of this two-dimensional size attribute. The - * string takes the form "XxY um", where - * X is the X dimension and Y is the Y dimension. - * The values are reported in the internal units of micrometers. + * string takes the form "XxY um", where X + * is the {@code X} dimension and Y is the {@code Y} dimension. The + * values are reported in the internal units of micrometers. */ public String toString() { StringBuilder result = new StringBuilder(); @@ -320,23 +292,22 @@ } /** - * Returns this two-dimensional size attribute's X dimension in units of - * micrometers (µm). (For use in a subclass.) + * Returns this two-dimensional size attribute's {@code X} dimension in + * units of micrometers (µm). (For use in a subclass.) * - * @return X dimension (µm). + * @return {@code X} dimension (µm) */ protected int getXMicrometers(){ return x; } /** - * Returns this two-dimensional size attribute's Y dimension in units of - * micrometers (µm). (For use in a subclass.) + * Returns this two-dimensional size attribute's {@code Y} dimension in + * units of micrometers (µm). (For use in a subclass.) * - * @return Y dimension (µm). + * @return {@code Y} dimension (µm) */ protected int getYMicrometers() { return y; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/SupportedValuesAttribute.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/SupportedValuesAttribute.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/SupportedValuesAttribute.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,21 +23,20 @@ * questions. */ - package javax.print.attribute; /** - * Interface SupportedValuesAttribute is a tagging interface which a printing - * attribute class implements to indicate the attribute describes the supported - * values for another attribute. For example, if a Print Service instance - * supports the {@link javax.print.attribute.standard.Copies Copies} - * attribute, the Print Service instance will have a {@link - * javax.print.attribute.standard.CopiesSupported CopiesSupported} attribute, - * which is a SupportedValuesAttribute giving the legal values a client may - * specify for the {@link javax.print.attribute.standard.Copies Copies} - * attribute. + * Interface {@code SupportedValuesAttribute} is a tagging interface which a + * printing attribute class implements to indicate the attribute describes the + * supported values for another attribute. For example, if a Print Service + * instance supports the {@link javax.print.attribute.standard.Copies Copies} + * attribute, the Print Service instance will have a + * {@link javax.print.attribute.standard.CopiesSupported CopiesSupported} + * attribute, which is a {@code SupportedValuesAttribute} giving the legal + * values a client may specify for the + * {@link javax.print.attribute.standard.Copies Copies} attribute. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public interface SupportedValuesAttribute extends Attribute { } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/TextSyntax.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/TextSyntax.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/TextSyntax.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,48 +23,50 @@ * questions. */ - package javax.print.attribute; import java.io.Serializable; import java.util.Locale; /** - * Class TextSyntax is an abstract base class providing the common + * Class {@code TextSyntax} is an abstract base class providing the common * implementation of all attributes whose value is a string. The text attribute * includes a locale to indicate the natural language. Thus, a text attribute * always represents a localized string. Once constructed, a text attribute's * value is immutable. * - * @author David Mendenhall - * @author Alan Kaminsky + * @author David Mendenhall + * @author Alan Kaminsky */ public abstract class TextSyntax implements Serializable, Cloneable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -8130648736378144102L; /** * String value of this text attribute. + * * @serial */ private String value; /** * Locale of this text attribute. + * * @serial */ private Locale locale; /** - * Constructs a TextAttribute with the specified string and locale. + * Constructs a {@code TextAttribute} with the specified string and locale. * - * @param value Text string. - * @param locale Natural language of the text string. null - * is interpreted to mean the default locale for as returned - * by {@code Locale.getDefault()} - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code value} is null. + * @param value text string + * @param locale natural language of the text string. {@code null} is + * interpreted to mean the default locale for as returned by + * {@code Locale.getDefault()} + * @throws NullPointerException if {@code value} is {@code null} */ protected TextSyntax(String value, Locale locale) { this.value = verify (value); @@ -87,7 +89,8 @@ /** * Returns this text attribute's text string. - * @return the text string. + * + * @return the text string */ public String getValue() { return value; @@ -95,6 +98,7 @@ /** * Returns this text attribute's text string's natural language (locale). + * * @return the locale */ public Locale getLocale() { @@ -104,7 +108,7 @@ /** * Returns a hashcode for this text attribute. * - * @return A hashcode value for this object. + * @return a hashcode value for this object */ public int hashCode() { return value.hashCode() ^ locale.hashCode(); @@ -113,23 +117,17 @@ /** * Returns whether this text attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: - *
      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class TextSyntax. - *
    3. - * This text attribute's underlying string and {@code object}'s - * underlying string are equal. - *
    4. - * This text attribute's locale and {@code object}'s locale are - * equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code TextSyntax}. + *
    3. This text attribute's underlying string and {@code object}'s + * underlying string are equal. + *
    4. This text attribute's locale and {@code object}'s locale are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this text - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this text + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return(object != null && @@ -139,13 +137,12 @@ } /** - * Returns a String identifying this text attribute. The String is - * the attribute's underlying text string. + * Returns a {@code String} identifying this text attribute. The + * {@code String} is the attribute's underlying text string. * - * @return A String identifying this object. + * @return a {@code String} identifying this object */ public String toString(){ return value; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/URISyntax.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/URISyntax.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/URISyntax.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -23,36 +23,37 @@ * questions. */ - package javax.print.attribute; import java.io.Serializable; import java.net.URI; /** - * Class URISyntax is an abstract base class providing the common - * implementation of all attributes whose value is a Uniform Resource - * Identifier (URI). Once constructed, a URI attribute's value is immutable. + * Class {@code URISyntax} is an abstract base class providing the common + * implementation of all attributes whose value is a Uniform Resource Identifier + * (URI). Once constructed, a {@code URI} attribute's value is immutable. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public abstract class URISyntax implements Serializable, Cloneable { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -7842661210486401678L; /** - * URI value of this URI attribute. + * {@code URI} value of this {@code URI} attribute. + * * @serial */ private URI uri; /** - * Constructs a URI attribute with the specified URI. + * Constructs a {@code URI} attribute with the specified {@code URI}. * - * @param uri URI. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code uri} is null. + * @param uri the {@code URI} + * @throws NullPointerException if {@code uri} is {@code null} */ protected URISyntax(URI uri) { this.uri = verify (uri); @@ -66,40 +67,36 @@ } /** - * Returns this URI attribute's URI value. - * @return the URI. + * Returns this {@code URI} attribute's {@code URI} value. + * + * @return the {@code URI} */ public URI getURI() { return uri; } /** - * Returns a hashcode for this URI attribute. + * Returns a hashcode for this {@code URI} attribute. * - * @return A hashcode value for this object. + * @return a hashcode value for this object */ public int hashCode() { return uri.hashCode(); } /** - * Returns whether this URI attribute is equivalent to the passed in - * object. - * To be equivalent, all of the following conditions must be true: - *
      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class URISyntax. - *
    3. - * This URI attribute's underlying URI and {@code object}'s - * underlying URI are equal. - *
    + * Returns whether this {@code URI} attribute is equivalent to the passed in + * object. To be equivalent, all of the following conditions must be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code URISyntax}. + *
    3. This {@code URI} attribute's underlying {@code URI} and + * {@code object}'s underlying {@code URI} are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this URI - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this {@code URI} + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return(object != null && @@ -108,13 +105,13 @@ } /** - * Returns a String identifying this URI attribute. The String is the - * string representation of the attribute's underlying URI. + * Returns a {@code String} identifying this {@code URI} attribute. The + * {@code String} is the string representation of the attribute's underlying + * {@code URI}. * - * @return A String identifying this object. + * @return a {@code String} identifying this object */ public String toString() { return uri.toString(); } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/UnmodifiableSetException.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/UnmodifiableSetException.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/UnmodifiableSetException.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, 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 @@ -26,26 +26,31 @@ package javax.print.attribute; /** - * Thrown to indicate that the requested operation cannot be performed - * because the set is unmodifiable. + * Thrown to indicate that the requested operation cannot be performed because + * the set is unmodifiable. * - * @author Phil Race - * @since 1.4 + * @author Phil Race + * @since 1.4 */ public class UnmodifiableSetException extends RuntimeException { + + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 2255250308571511731L; /** - * Constructs an UnsupportedOperationException with no detail message. + * Constructs an {@code UnsupportedOperationException} with no detail + * message. */ public UnmodifiableSetException() { } /** - * Constructs an UnmodifiableSetException with the specified - * detail message. + * Constructs an {@code UnmodifiableSetException} with the specified detail + * message. * - * @param message the detail message + * @param message the detail message */ public UnmodifiableSetException(String message) { super(message); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/package-info.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/package-info.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/package-info.java Sat Sep 09 14:36:45 2017 +0200 @@ -39,19 +39,20 @@ * The print data and the processing instructions are separate entities. This * means that: *
      - *
    • You can print the same print data at different times using different - * processing instructions.
      For example, you can print a slide - * presentation on US letter-sized white paper, double-sided, stapled, 20 - * copies to make handouts for a talk; and you could print the same slide - * presentation on US letter-sized transparencies, single-sided, one copy to - * make the actual slides for the talk.
    • - *
    • You can use the same processing instructions at different times to - * print different data. For example, you could set your default processing - * instructions to: US letter-sized paper, double sided, stapled. Whenever - * you print a job, it prints with these settings, unless you explicitly - * override them.
    • + *
    • You can print the same print data at different times using different + * processing instructions. + *
      + * For example, you can print a slide presentation on US letter-sized white + * paper, double-sided, stapled, 20 copies to make handouts for a talk; and + * you could print the same slide presentation on US letter-sized + * transparencies, single-sided, one copy to make the actual slides for the + * talk. + *
    • You can use the same processing instructions at different times to + * print different data. For example, you could set your default processing + * instructions to: US letter-sized paper, double sided, stapled. Whenever you + * print a job, it prints with these settings, unless you explicitly override + * them. *
    - *

    * The processing instruction does not specify how the print job processes the * request; each processing instruction is only a description of the results of * a print job. The print job determines the manner in which it achieves the @@ -97,18 +98,18 @@ * The Java Print Service API defines these different kinds of attributes with * five subinterfaces of {@code Attribute}: *

      - *
    • DocAttribute specifies a - * characteristic of an individual document and the print job settings to be - * applied to an individual document.
    • - *
    • PrintRequestAttribute - * specifies a setting applied to a whole print job and to all the documents - * in the print job.
    • - *
    • PrintJobAttribute reports the - * status of a print job.
    • - *
    • PrintServiceAttribute - * reports the status of a print service.
    • - *
    • SupportedValuesAttribute - * gives the supported values for another attribute.
    • + *
    • DocAttribute specifies a characteristic + * of an individual document and the print job settings to be applied to an + * individual document. + *
    • PrintRequestAttribute + * specifies a setting applied to a whole print job and to all the documents + * in the print job. + *
    • PrintJobAttribute reports the + * status of a print job. + *
    • PrintServiceAttribute reports + * the status of a print service. + *
    • SupportedValuesAttribute + * gives the supported values for another attribute. *
    * Each attribute class implements one or more of these tagging subinterfaces to * indicate where the attribute can be used in the API. If an attribute class @@ -123,40 +124,39 @@ * The Java Print Service API defines a group of standard attribute classes * modeled upon the attributes in the Internet Printing Protocol (IPP) version * 1.1. The standard attribute classes are in the subpackage - * javax.print.attribute.standard to keep the actual attribute classes + * {@code javax.print.attribute.standard} to keep the actual attribute classes * conceptually separate from the generic apparatus defined in package - * javax.print.attribute. + * {@code javax.print.attribute}. * *

    Attribute Sets

    * A client usually needs to provide more than one processing instruction when - * submitting a print job. For example, the client might need to specify a - * media size of A4 and a landscape orientation. To send more than one - * processing instruction, the client collects the attributes into an attribute - * set, which the Java Print Service API represents with the + * submitting a print job. For example, the client might need to specify a media + * size of A4 and a landscape orientation. To send more than one processing + * instruction, the client collects the attributes into an attribute set, which + * the Java Print Service API represents with the * AttributeSet interface. *

    * The {@code AttributeSet} interface is similar to the * Map interface: it provides a map of * key to values, in which each key is unique and can contain no more than one * value. However, the {@code AttributeSet} interface is designed to - * specifically support the needs of the Java Print Service API. An {@code - * AttributeSet} requires that: + * specifically support the needs of the Java Print Service API. An + * {@code AttributeSet} requires that: *

      - *
    1. Each key in an {@code AttributeSet} corresponds to a category, and - * the value of the key can only be one of the attribute values that belong - * to the category represented by the key. Thus, unlike a {@code Map}, an - * {@code AttributeSet} restricts the possible values of a key: an attribute - * category cannot be set to an attribute value that does not belong to that - * category.
    2. - *
    3. No two attributes from the same category can exist in the same set. - * For example, an attribute collection must not contain both a "one-sided" - * attribute and a "two-sided" attribute because these two attributes give - * the printer conflicting instructions.
    4. - *
    5. Only attributes implementing the {@code Attribute} interface can be - * added to the set.
    6. + *
    7. Each key in an {@code AttributeSet} corresponds to a category, and the + * value of the key can only be one of the attribute values that belong to the + * category represented by the key. Thus, unlike a {@code Map}, an + * {@code AttributeSet} restricts the possible values of a key: an attribute + * category cannot be set to an attribute value that does not belong to that + * category. + *
    8. No two attributes from the same category can exist in the same set. For + * example, an attribute collection must not contain both a "one-sided" + * attribute and a "two-sided" attribute because these two attributes give the + * printer conflicting instructions. + *
    9. Only attributes implementing the {@code Attribute} interface can be + * added to the set. *
    - *

    - * The javax.print.attribute package includes + * The {@code javax.print.attribute} package includes * HashAttributeSet as a concrete * implementation of the attribute set interface. {@code HashAttributeSet} * provides an attribute set based on a hash map. You can use this @@ -167,18 +167,15 @@ * that are restricted to contain just one of the four kinds of attributes, as * discussed in the Attribute Roles section: *

    * Notice that only four kinds of attribute sets are listed here, but there are * five kinds of attributes. Interface - * SupportedValuesAttribute - * denotes an attribute that gives the supported values for another attribute. + * SupportedValuesAttribute denotes + * an attribute that gives the supported values for another attribute. * Supported-values attributes are never aggregated into attribute sets, so * there is no attribute set subinterface defined for them. *

    @@ -189,17 +186,15 @@ * For a read-only attribute set, calling a mutating operation throws an * {@code UnmodifiableSetException}. *

    - * Package javax.print.attribute includes one concrete implementation of each of - * the attribute set subinterfaces: + * Package {@code javax.print.attribute} includes one concrete implementation of + * each of the attribute set subinterfaces: *

    * All of these classes extend * HashAttributeSet and enforce the @@ -211,12 +206,11 @@ * enumerated value. The Java Print Service API does not use primitive data * types, such as int, to represent attribute values for these reasons: *
      - *
    • Primitive data types are not type-safe. For example, a compiler - * should not allow a "copies" attribute value to be used for a "sides" - * attribute.
    • - *
    • Some attributes must be represented as a record of several values. - * One example is printer resolution, which requires two numbers, such as - * 600 and 300 representing 600 x 300 dpi.
    • + *
    • Primitive data types are not type-safe. For example, a compiler should + * not allow a "copies" attribute value to be used for a "sides" attribute. + *
    • Some attributes must be represented as a record of several values. One + * example is printer resolution, which requires two numbers, such as 600 and + * 300 representing 600 x 300 dpi. *
    * For type-safety and to represent all attributes uniformly, the Java Print * Service API defines each attribute category as a class, such as class @@ -240,27 +234,27 @@ * represent each abstract syntax, and these classes are used as the parent of * standard attributes whenever possible. The abstract syntax classes are: *
      - *
    • EnumSyntax provides a type-safe - * enumeration in which enumerated values are represented as singleton - * objects. Each enumeration singleton is an instance of the enumeration - * class that wraps a hidden int value.
    • - *
    • IntegerSyntax is the abstract syntax - * for integer-valued attributes.
    • - *
    • TextSyntax is the abstract syntax for - * text-valued attributes, and includes a locale giving the text string's - * natural language.
    • - *
    • SetOfIntegerSyntax is the - * abstract syntax for attributes representing a range or set of integers - *
    • ResolutionSyntax is the abstract - * syntax for attributes representing resolution values, such as 600x300 - * dpi.
    • - *
    • Size2DSyntax is the abstract syntax - * for attributes representing a two-dimensional size, such as a paper size - * of 8.5 x 11 inches.
    • - *
    • DateTimeSyntax is the abstract - * syntax for attributes whose value is a date and time.
    • - *
    • URISyntax is the abstract syntax for - * attributes whose value is a Uniform Resource Indicator.
    • + *
    • EnumSyntax provides a type-safe + * enumeration in which enumerated values are represented as singleton + * objects. Each enumeration singleton is an instance of the enumeration class + * that wraps a hidden int value. + *
    • IntegerSyntax is the abstract syntax + * for integer-valued attributes. + *
    • TextSyntax is the abstract syntax for + * text-valued attributes, and includes a locale giving the text string's + * natural language. + *
    • SetOfIntegerSyntax is the + * abstract syntax for attributes representing a range or set of integers + *
    • ResolutionSyntax is the abstract + * syntax for attributes representing resolution values, such as 600x300 + * dpi. + *
    • Size2DSyntax is the abstract syntax for + * attributes representing a two-dimensional size, such as a paper size of + * 8.5 x 11 inches. + *
    • DateTimeSyntax is the abstract syntax + * for attributes whose value is a date and time. + *
    • URISyntax is the abstract syntax for + * attributes whose value is a Uniform Resource Indicator. *
    * The abstract syntax classes are independent of the attributes that use them. * In fact, applications that have nothing to do with printing can use the @@ -304,12 +298,10 @@ *

    Attribute Vendors

    * The Java Print Service API is designed so that vendors can: *
      - *
    • define new vendor-specific values for any standard attribute defined - * in javax.print.attribute.standard - * .
    • - *
    • define new attribute categories representing the vendor printer's - * proprietary capabilities not already supported by the standard - * attributes.
    • + *
    • define new vendor-specific values for any standard attribute defined in + * javax.print.attribute.standard. + *
    • define new attribute categories representing the vendor printer's + * proprietary capabilities not already supported by the standard attributes. *
    * To define a new value for an attribute, a client can construct instances of * such attributes with arbitrary values at runtime. However, an enumerated @@ -364,12 +356,12 @@ * } * *

    - * Please note: In the javax.print APIs, a null reference parameter to methods - * is incorrect unless explicitly documented on the method as having a - * meaningful interpretation. Usage to the contrary is incorrect coding and may - * result in a run time exception either immediately or at some later time. - * IllegalArgumentException and NullPointerException are examples of typical and - * acceptable run time exceptions for such cases. + * Please note: In the {@code javax.print} APIs, a {@code null} reference + * parameter to methods is incorrect unless explicitly documented on the method + * as having a meaningful interpretation. Usage to the contrary is incorrect + * coding and may result in a run time exception either immediately or at some + * later time. {@code IllegalArgumentException} and {@code NullPointerException} + * are examples of typical and acceptable run time exceptions for such cases. * * @since 1.4 */ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Chromaticity.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Chromaticity.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Chromaticity.java Sat Sep 09 14:36:45 2017 +0200 @@ -22,75 +22,57 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; -import javax.print.attribute.DocAttribute; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class Chromaticity is a printing attribute class, an enumeration, that - * specifies monochrome or color printing. This is used by a print client + * Class {@code Chromaticity} is a printing attribute class, an enumeration, + * that specifies monochrome or color printing. This is used by a print client * to specify how the print data should be generated or processed. It is not * descriptive of the color capabilities of the device. Query the service's * {@link ColorSupported ColorSupported} attribute to determine if the device * can be verified to support color printing. - *

    + *

    * The table below shows the effects of specifying a Chromaticity attribute of - * {@link #MONOCHROME MONOCHROME} or {@link #COLOR COLOR} - * for a monochrome or color document. - * + * {@link #MONOCHROME MONOCHROME} or {@link #COLOR COLOR} for a monochrome or + * color document. * - * + * * - * - * - * - * - * + * + * * - * - * - * - * - * - * - * - * - * - * + * + * + * - *
    Shows effects of specifying MONOCHROME or COLOR Chromaticity - * attributesShows effects of specifying {@code MONOCHROME} or {@code COLOR} + * Chromaticity attributes
    - * Chromaticity
    Attribute - *
    - * Effect on
    Monochrome Document - *
    - * Effect on
    Color Document - *
    Chromaticity
    Attribute + *
    Effect on
    Monochrome Document + *
    Effect on
    Color Document *
    - * {@link #MONOCHROME MONOCHROME} - * - * Printed as is, in monochrome - * - * Printed in monochrome, with colors converted to shades of gray - *
    - * {@link #COLOR COLOR} - * - * Printed as is, in monochrome - * - * Printed as is, in color - *
    {@link #MONOCHROME MONOCHROME} + * Printed as is, in monochrome + * Printed in monochrome, with colors converted to shades of gray + *
    {@link #COLOR COLOR} + * Printed as is, in monochrome + * Printed as is, in color *
    - *

    - * IPP Compatibility: Chromaticity is not an IPP attribute at present. + * + *

    + * IPP Compatibility: Chromaticity is not an IPP attribute at present. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class Chromaticity extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 4660543931355214012L; /** @@ -103,32 +85,37 @@ */ public static final Chromaticity COLOR = new Chromaticity(1); - /** * Construct a new chromaticity enumeration value with the given integer * value. * - * @param value Integer value. + * @param value Integer value */ protected Chromaticity(int value) { super(value); } + /** + * The string table for class {@code Chromaticity}. + */ private static final String[] myStringTable = {"monochrome", "color"}; + /** + * The enumeration value table for class {@code Chromaticity}. + */ private static final Chromaticity[] myEnumValueTable = {MONOCHROME, COLOR}; /** - * Returns the string table for class Chromaticity. + * Returns the string table for class {@code Chromaticity}. */ protected String[] getStringTable() { return myStringTable; } /** - * Returns the enumeration value table for class Chromaticity. + * Returns the enumeration value table for class {@code Chromaticity}. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; @@ -137,11 +124,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class Chromaticity, the category is the class Chromaticity itself. + *

    + * For class {@code Chromaticity}, the category is the class + * {@code Chromaticity} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return Chromaticity.class; @@ -150,13 +138,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class Chromaticity, the category name is {@code "chromaticity"}. + *

    + * For class {@code Chromaticity}, the category name is + * {@code "chromaticity"}. * - * @return Attribute category name. + * @return attribute category name */ - public final String getName() { - return "chromaticity"; - } - - } + public final String getName() { + return "chromaticity"; + } +} diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/ColorSupported.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/ColorSupported.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/ColorSupported.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,35 +30,39 @@ import javax.print.attribute.PrintServiceAttribute; /** - * Class ColorSupported is a printing attribute class, an enumeration, that - * identifies whether the device is capable of any type of color printing at - * all, including highlight color as well as full process color. All document + * Class {@code ColorSupported} is a printing attribute class, an enumeration, + * that identifies whether the device is capable of any type of color printing + * at all, including highlight color as well as full process color. All document * instructions having to do with color are embedded within the print data (none * are attributes attached to the job outside the print data). - *

    + *

    * Note: End users are able to determine the nature and details of the color - * support by querying the {@link PrinterMoreInfoManufacturer - * PrinterMoreInfoManufacturer} attribute. - *

    - * Don't confuse the ColorSupported attribute with the {@link Chromaticity - * Chromaticity} attribute. {@link Chromaticity Chromaticity} is an attribute - * the client can specify for a job to tell the printer whether to print a - * document in monochrome or color, possibly causing the printer to print a - * color document in monochrome. ColorSupported is a printer description - * attribute that tells whether the printer can print in color regardless of how - * the client specifies to print any particular document. - *

    - * IPP Compatibility: The IPP boolean value is "true" for SUPPORTED and - * "false" for NOT_SUPPORTED. The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. + * support by querying the + * {@link PrinterMoreInfoManufacturer PrinterMoreInfoManufacturer} attribute. + *

    + * Don't confuse the {@code ColorSupported} attribute with the + * {@link Chromaticity Chromaticity} attribute. + * {@link Chromaticity Chromaticity} is an attribute the client can specify for + * a job to tell the printer whether to print a document in monochrome or color, + * possibly causing the printer to print a color document in monochrome. + * {@code ColorSupported} is a printer description attribute that tells whether + * the printer can print in color regardless of how the client specifies to + * print any particular document. + *

    + * IPP Compatibility: The IPP boolean value is "true" for SUPPORTED and + * "false" for NOT_SUPPORTED. The category name returned by {@code getName()} is + * the IPP attribute name. The enumeration's integer value is the IPP enum + * value. The {@code toString()} method returns the IPP string representation of + * the attribute value. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class ColorSupported extends EnumSyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -2700555589688535545L; /** @@ -66,36 +71,42 @@ public static final ColorSupported NOT_SUPPORTED = new ColorSupported(0); /** - * The printer is capable of some type of color printing, such as - * highlight color or full process color. + * The printer is capable of some type of color printing, such as highlight + * color or full process color. */ public static final ColorSupported SUPPORTED = new ColorSupported(1); /** - * Construct a new color supported enumeration value with the given - * integer value. + * Construct a new color supported enumeration value with the given integer + * value. * - * @param value Integer value. + * @param value Integer value */ protected ColorSupported(int value) { super (value); } + /** + * The string table for class {@code ColorSupported}. + */ private static final String[] myStringTable = {"not-supported", "supported"}; + /** + * The enumeration value table for class {@code ColorSupported}. + */ private static final ColorSupported[] myEnumValueTable = {NOT_SUPPORTED, SUPPORTED}; /** - * Returns the string table for class ColorSupported. + * Returns the string table for class {@code ColorSupported}. */ protected String[] getStringTable() { return myStringTable; } /** - * Returns the enumeration value table for class ColorSupported. + * Returns the enumeration value table for class {@code ColorSupported}. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; @@ -104,11 +115,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class ColorSupported, the category is class ColorSupported itself. + *

    + * For class {@code ColorSupported}, the category is class + * {@code ColorSupported} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return ColorSupported.class; @@ -117,13 +129,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class ColorSupported, the category name is {@code "color-supported"}. + *

    + * For class {@code ColorSupported}, the category name is + * {@code "color-supported"} * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "color-supported"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Compression.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Compression.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Compression.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,29 +22,33 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; -import javax.print.attribute.DocAttribute; /** - * Class Compression is a printing attribute class, an enumeration, that - * specifies how print data is compressed. Compression is an attribute of the - * print data (the doc), not of the Print Job. If a Compression attribute is not - * specified for a doc, the printer assumes the doc's print data is uncompressed - * (i.e., the default Compression value is always {@link #NONE - * NONE}). - *

    - * IPP Compatibility: The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. + * Class {@code Compression} is a printing attribute class, an enumeration, that + * specifies how print data is compressed. {@code Compression} is an attribute + * of the print data (the doc), not of the Print Job. If a {@code Compression} + * attribute is not specified for a doc, the printer assumes the doc's print + * data is uncompressed (i.e., the default Compression value is always + * {@link #NONE NONE}). + *

    + * IPP Compatibility: The category name returned by {@code getName()} is + * the IPP attribute name. The enumeration's integer value is the IPP enum + * value. The {@code toString()} method returns the IPP string representation of + * the attribute value. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public class Compression extends EnumSyntax implements DocAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -5716748913324997674L; /** @@ -59,7 +63,7 @@ /** * GNU zip compression technology described in - * RFC 1952. + * RFC 1952. */ public static final Compression GZIP = new Compression(2); @@ -72,32 +76,37 @@ * Construct a new compression enumeration value with the given integer * value. * - * @param value Integer value. + * @param value Integer value */ protected Compression(int value) { super(value); } - + /** + * The string table for class {@code Compression}. + */ private static final String[] myStringTable = {"none", "deflate", "gzip", "compress"}; + /** + * The enumeration value table for class {@code Compression}. + */ private static final Compression[] myEnumValueTable = {NONE, DEFLATE, GZIP, COMPRESS}; /** - * Returns the string table for class Compression. + * Returns the string table for class {@code Compression}. */ protected String[] getStringTable() { return myStringTable.clone(); } /** - * Returns the enumeration value table for class Compression. + * Returns the enumeration value table for class {@code Compression}. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); @@ -106,12 +115,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class Compression and any vendor-defined subclasses, the category is - * class Compression itself. + *

    + * For class {@code Compression} and any vendor-defined subclasses, the + * category is class {@code Compression} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return Compression.class; @@ -120,14 +129,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class Compression and any vendor-defined subclasses, the category - * name is {@code "compression"}. + *

    + * For class {@code Compression} and any vendor-defined subclasses, the + * category name is {@code "compression"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "compression"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Copies.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Copies.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Copies.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,64 +22,60 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class Copies is an integer valued printing attribute class that specifies the - * number of copies to be printed. - *

    + * Class {@code Copies} is an integer valued printing attribute class that + * specifies the number of copies to be printed. + *

    * On many devices the supported number of collated copies will be limited by * the number of physical output bins on the device, and may be different from * the number of uncollated copies which can be supported. - *

    - * The effect of a Copies attribute with a value of n on a multidoc print - * job (a job with multiple documents) depends on the (perhaps defaulted) value - * of the {@link MultipleDocumentHandling MultipleDocumentHandling} attribute: - *

      - *
    • - * SINGLE_DOCUMENT -- The result will be n copies of a single output - * document comprising all the input docs. - * - *
    • - * SINGLE_DOCUMENT_NEW_SHEET -- The result will be n copies of a single - * output document comprising all the input docs, and the first impression of - * each input doc will always start on a new media sheet. + *

      + * The effect of a {@code Copies} attribute with a value of n on a + * multidoc print job (a job with multiple documents) depends on the (perhaps + * defaulted) value of the + * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute: + *

        + *
      • {@code SINGLE_DOCUMENT} -- The result will be n copies of a + * single output document comprising all the input docs. + *
      • {@code SINGLE_DOCUMENT_NEW_SHEET} -- The result will be n copies + * of a single output document comprising all the input docs, and the first + * impression of each input doc will always start on a new media sheet. + *
      • {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The result will be + * n copies of the first input document, followed by n copies of + * the second input document, . . . followed by n copies of the last + * input document. + *
      • {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The result will be the + * first input document, the second input document, . . . the last input + * document, the group of documents being repeated n times. + *
      + *

      + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * - *

    • - * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The result will be n copies of - * the first input document, followed by n copies of the second input - * document, . . . followed by n copies of the last input document. - * - *
    • - * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The result will be the first input - * document, the second input document, . . . the last input document, the group - * of documents being repeated n times. - *
    - *

    - * IPP Compatibility: The integer value gives the IPP integer value. The - * category name returned by {@code getName()} gives the IPP attribute - * name. - * - * @author David Mendenhall - * @author Alan Kamihensky + * @author David Mendenhall + * @author Alan Kamihensky */ public final class Copies extends IntegerSyntax implements PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -6426631521680023833L; /** * Construct a new copies attribute with the given integer value. * - * @param value Integer value. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 1. + * @param value Integer value + * @throws IllegalArgumentException if {@code value < 1} */ public Copies(int value) { super (value, 1, Integer.MAX_VALUE); @@ -88,20 +84,15 @@ /** * Returns whether this copies attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class Copies. - *
    3. - * This copies attribute's value and {@code object}'s value are - * equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code Copies}. + *
    3. This copies attribute's value and {@code object}'s value are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this copies - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this copies + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return super.equals (object) && object instanceof Copies; @@ -110,11 +101,11 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class Copies, the category is class Copies itself. + *

    + * For class {@code Copies}, the category is class {@code Copies} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return Copies.class; @@ -123,13 +114,12 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class Copies, the category name is {@code "copies"}. + *

    + * For class {@code Copies}, the category name is {@code "copies"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "copies"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/CopiesSupported.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/CopiesSupported.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/CopiesSupported.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,33 +30,34 @@ import javax.print.attribute.SupportedValuesAttribute; /** - * Class CopiesSupported is a printing attribute class, a set of integers, that - * gives the supported values for a {@link Copies Copies} attribute. It is - * restricted to a single contiguous range of integers; multiple non-overlapping - * ranges are not allowed. - *

    - * IPP Compatibility: The CopiesSupported attribute's canonical array + * Class {@code CopiesSupported} is a printing attribute class, a set of + * integers, that gives the supported values for a {@link Copies Copies} + * attribute. It is restricted to a single contiguous range of integers; + * multiple non-overlapping ranges are not allowed. + *

    + * IPP Compatibility: The CopiesSupported attribute's canonical array * form gives the lower and upper bound for the range of copies to be included - * in an IPP "copies-supported" attribute. See class {@link - * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an - * explanation of canonical array form. The category name returned by - * {@code getName()} gives the IPP attribute name. + * in an IPP "copies-supported" attribute. See class + * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of canonical + * array form. The category name returned by {@code getName()} gives the IPP + * attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class CopiesSupported extends SetOfIntegerSyntax implements SupportedValuesAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 6927711687034846001L; /** * Construct a new copies supported attribute containing a single integer. - * That is, only the one value of Copies is supported. + * That is, only the one value of {@code Copies} is supported. * - * @param member Set member. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code member} is less than 1. + * @param member set member + * @throws IllegalArgumentException if {@code member < 1} */ public CopiesSupported(int member) { super (member); @@ -66,16 +68,14 @@ /** * Construct a new copies supported attribute containing a single range of - * integers. That is, only those values of Copies in the one range are - * supported. + * integers. That is, only those values of {@code Copies} in the one range + * are supported. * - * @param lowerBound Lower bound of the range. - * @param upperBound Upper bound of the range. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if a null range is specified or if a - * non-null range is specified with {@code lowerBound} less than - * 1. + * @param lowerBound Lower bound of the range + * @param upperBound Upper bound of the range + * @throws IllegalArgumentException if a {@code null} range is specified or + * if a {@code non-null} range is specified with {@code lowerBound} + * less than 1 */ public CopiesSupported(int lowerBound, int upperBound) { super(lowerBound, upperBound); @@ -91,20 +91,16 @@ * Returns whether this copies supported attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions must * be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class CopiesSupported. - *
    3. - * This copies supported attribute's members and {@code object}'s - * members are the same. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code CopiesSupported}. + *
    3. This copies supported attribute's members and {@code object}'s + * members are the same. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this copies - * supported attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this copies + * supported attribute, {@code false} otherwise */ public boolean equals(Object object) { return super.equals (object) && object instanceof CopiesSupported; @@ -113,12 +109,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class CopiesSupported, the category - * is class CopiesSupported itself. + *

    + * For class {@code CopiesSupported}, the category is class + * {@code CopiesSupported} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return CopiesSupported.class; @@ -127,14 +123,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class CopiesSupported, the category - * name is {@code "copies-supported"}. + *

    + * For class {@code CopiesSupported}, the category name is + * {@code "copies-supported"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "copies-supported"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtCompleted.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtCompleted.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtCompleted.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,47 +22,50 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; +import java.util.Calendar; import java.util.Date; + import javax.print.attribute.Attribute; import javax.print.attribute.DateTimeSyntax; import javax.print.attribute.PrintJobAttribute; /** - * Class DateTimeAtCompleted is a printing attribute class, a date-time + * Class {@code DateTimeAtCompleted} is a printing attribute class, a date-time * attribute, that indicates the date and time at which the Print Job completed * (or was canceled or aborted). - *

    - * To construct a DateTimeAtCompleted attribute from separate values of the - * year, month, day, hour, minute, and so on, use a {@link java.util.Calendar - * Calendar} object to construct a {@link java.util.Date Date} object, then use - * the {@link java.util.Date Date} object to construct the DateTimeAtCompleted - * attribute. To convert a DateTimeAtCompleted attribute to separate values of - * the year, month, day, hour, minute, and so on, create a {@link - * java.util.Calendar Calendar} object and set it to the {@link java.util.Date - * Date} from the DateTimeAtCompleted attribute. - *

    - * IPP Compatibility: The information needed to construct an IPP + *

    + * To construct a {@code DateTimeAtCompleted} attribute from separate values of + * the year, month, day, hour, minute, and so on, use a + * {@link Calendar Calendar} object to construct a {@link Date Date} object, + * then use the {@link Date Date} object to construct the DateTimeAtCompleted + * attribute. To convert a {@code DateTimeAtCompleted} attribute to separate + * values of the year, month, day, hour, minute, and so on, create a + * {@link Calendar Calendar} object and set it to the {@link Date Date} from the + * {@code DateTimeAtCompleted} attribute. + *

    + * IPP Compatibility: The information needed to construct an IPP * "date-time-at-completed" attribute can be obtained as described above. The - * category name returned by {@code getName()} gives the IPP attribute - * name. + * category name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class DateTimeAtCompleted extends DateTimeSyntax implements PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 6497399708058490000L; /** - * Construct a new date-time at completed attribute with the given {@link - * java.util.Date Date} value. + * Construct a new date-time at completed attribute with the given + * {@link Date Date} value. * - * @param dateTime {@link java.util.Date Date} value. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code dateTime} is null. + * @param dateTime {@link Date Date} value + * @throws NullPointerException if {@code dateTime} is {@code null} */ public DateTimeAtCompleted(Date dateTime) { super (dateTime); @@ -72,38 +75,34 @@ * Returns whether this date-time at completed attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class DateTimeAtCompleted. - *
    3. - * This date-time at completed attribute's {@link java.util.Date Date} value - * and {@code object}'s {@link java.util.Date Date} value are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code DateTimeAtCompleted}. + *
    3. This date-time at completed attribute's {@link Date Date} + * value and {@code object}'s {@link Date Date} value are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this date-time - * at completed attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this date-time at + * completed attribute, {@code false} otherwise */ public boolean equals(Object object) { return(super.equals (object) && object instanceof DateTimeAtCompleted); } -// Exported operations inherited and implemented from interface Attribute. + // Exported operations inherited and implemented from interface Attribute. /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class DateTimeAtCompleted, the category is class - * DateTimeAtCompleted itself. - * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. - */ + *

    + * For class {@code DateTimeAtCompleted}, the category is class + * {@code DateTimeAtCompleted} itself. + * + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} + */ public final Class getCategory() { return DateTimeAtCompleted.class; } @@ -111,14 +110,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class DateTimeAtCompleted, the category name is + *

    + * For class {@code DateTimeAtCompleted}, the category name is * {@code "date-time-at-completed"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "date-time-at-completed"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtCreation.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtCreation.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtCreation.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,70 +22,69 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; +import java.util.Calendar; import java.util.Date; + import javax.print.attribute.Attribute; import javax.print.attribute.DateTimeSyntax; import javax.print.attribute.PrintJobAttribute; /** - * Class DateTimeAtCreation is a printing attribute class, a date-time + * Class {@code DateTimeAtCreation} is a printing attribute class, a date-time * attribute, that indicates the date and time at which the Print Job was * created. - *

    - * To construct a DateTimeAtCreation attribute from separate values of the year, - * month, day, hour, minute, and so on, use a {@link java.util.Calendar - * Calendar} object to construct a {@link java.util.Date Date} object, then use - * the {@link java.util.Date Date} object to construct the DateTimeAtCreation - * attribute. To convert a DateTimeAtCreation attribute to separate values of - * the year, month, day, hour, minute, and so on, create a {@link - * java.util.Calendar Calendar} object and set it to the {@link java.util.Date - * Date} from the DateTimeAtCreation attribute. - *

    - * IPP Compatibility: The information needed to construct an IPP + *

    + * To construct a {@code DateTimeAtCreation} attribute from separate values of + * the year, month, day, hour, minute, and so on, use a + * {@link Calendar Calendar} object to construct a {@link Date Date} object, + * then use the {@link Date Date} object to construct the DateTimeAtCreation + * attribute. To convert a {@code DateTimeAtCreation} attribute to separate + * values of the year, month, day, hour, minute, and so on, create a + * {@link Calendar Calendar} object and set it to the {@link Date Date} from the + * {@code DateTimeAtCreation} attribute. + *

    + * IPP Compatibility: The information needed to construct an IPP * "date-time-at-creation" attribute can be obtained as described above. The - * category name returned by {@code getName()} gives the IPP attribute - * name. + * category name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class DateTimeAtCreation extends DateTimeSyntax implements PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -2923732231056647903L; /** - * Construct a new date-time at creation attribute with the given {@link - * java.util.Date Date} value. + * Construct a new date-time at creation attribute with the given + * {@link Date Date} value. * - * @param dateTime {@link java.util.Date Date} value. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code dateTime} is null. + * @param dateTime {@link Date Date} value + * @throws NullPointerException if {@code dateTime} is {@code null} */ public DateTimeAtCreation(Date dateTime) { super (dateTime); } /** - * Returns whether this date-time at creation attribute is equivalent to - * the passed in object. To be equivalent, all of the following conditions - * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class DateTimeAtCreation. - *
    3. - * This date-time at creation attribute's {@link java.util.Date Date} value - * and {@code object}'s {@link java.util.Date Date} value are equal. - *
    + * Returns whether this date-time at creation attribute is equivalent to the + * passed in object. To be equivalent, all of the following conditions must + * be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code DateTimeAtCreation}. + *
    3. This date-time at creation attribute's {@link Date Date} + * value and {@code object}'s {@link Date Date} value are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this date-time - * at creation attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this date-time at + * creation attribute, {@code false} otherwise */ public boolean equals(Object object) { return(super.equals (object) && @@ -95,12 +94,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class DateTimeAtCreation, the category is class - * DateTimeAtCreation itself. + *

    + * For class {@code DateTimeAtCreation}, the category is class + * {@code DateTimeAtCreation} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return DateTimeAtCreation.class; @@ -109,14 +108,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class DateTimeAtCreation, the category name is + *

    + * For class {@code DateTimeAtCreation}, the category name is * {@code "date-time-at-creation"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "date-time-at-creation"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtProcessing.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtProcessing.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DateTimeAtProcessing.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,47 +22,50 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; +import java.util.Calendar; import java.util.Date; + import javax.print.attribute.Attribute; import javax.print.attribute.DateTimeSyntax; import javax.print.attribute.PrintJobAttribute; /** - * Class DateTimeAtProcessing is a printing attribute class, a date-time + * Class {@code DateTimeAtProcessing} is a printing attribute class, a date-time * attribute, that indicates the date and time at which the Print Job first * began processing. - *

    - * To construct a DateTimeAtProcessing attribute from separate values of the - * year, month, day, hour, minute, and so on, use a {@link java.util.Calendar - * Calendar} object to construct a {@link java.util.Date Date} object, then use - * the {@link java.util.Date Date} object to construct the DateTimeAtProcessing - * attribute. To convert a DateTimeAtProcessing attribute to separate values of - * the year, month, day, hour, minute, and so on, create a {@link - * java.util.Calendar Calendar} object and set it to the {@link java.util.Date - * Date} from the DateTimeAtProcessing attribute. - *

    - * IPP Compatibility: The information needed to construct an IPP + *

    + * To construct a {@code DateTimeAtProcessing} attribute from separate values of + * the year, month, day, hour, minute, and so on, use a + * {@link Calendar Calendar} object to construct a {@link Date Date} object, + * then use the {@link Date Date} object to construct the DateTimeAtProcessing + * attribute. To convert a {@code DateTimeAtProcessing} attribute to separate + * values of the year, month, day, hour, minute, and so on, create a + * {@link Calendar Calendar} object and set it to the {@link Date Date} from the + * {@code DateTimeAtProcessing} attribute. + *

    + * IPP Compatibility: The information needed to construct an IPP * "date-time-at-processing" attribute can be obtained as described above. The - * category name returned by {@code getName()} gives the IPP attribute - * name. + * category name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class DateTimeAtProcessing extends DateTimeSyntax implements PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -3710068197278263244L; /** - * Construct a new date-time at processing attribute with the given {@link - * java.util.Date Date} value. + * Construct a new date-time at processing attribute with the given + * {@link Date Date} value. * - * @param dateTime {@link java.util.Date Date} value. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code dateTime} is null. + * @param dateTime {@link Date Date} value + * @throws NullPointerException if {@code dateTime} is {@code null} */ public DateTimeAtProcessing(Date dateTime) { super (dateTime); @@ -72,21 +75,17 @@ * Returns whether this date-time at processing attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class DateTimeAtProcessing. - *
    3. - * This date-time at processing attribute's {@link java.util.Date Date} - * value and {@code object}'s {@link java.util.Date Date} value - * are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class + * {@code DateTimeAtProcessing}. + *
    3. This date-time at processing attribute's {@link Date Date} + * value and {@code object}'s {@link Date Date} value are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this date-time - * at processing attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this date-time at + * processing attribute, {@code false} otherwise */ public boolean equals(Object object) { return(super.equals (object) && @@ -96,12 +95,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class DateTimeAtProcessing, the category is class - * DateTimeAtProcessing itself. + *

    + * For class {@code DateTimeAtProcessing}, the category is class + * {@code DateTimeAtProcessing} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return DateTimeAtProcessing.class; @@ -110,14 +109,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class DateTimeAtProcessing, the category name is + *

    + * For class {@code DateTimeAtProcessing}, the category name is * {@code "date-time-at-processing"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "date-time-at-processing"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Destination.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Destination.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Destination.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,72 +22,70 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; +import java.io.File; import java.net.URI; import javax.print.attribute.Attribute; -import javax.print.attribute.URISyntax; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.URISyntax; /** - * Class Destination is a printing attribute class, a URI, that is used to - * indicate an alternate destination for the spooled printer formatted - * data. Many PrintServices will not support the notion of a destination - * other than the printer device, and so will not support this attribute. + * Class {@code Destination} is a printing attribute class, a {@code URI}, that + * is used to indicate an alternate destination for the spooled printer + * formatted data. Many {@code PrintServices} will not support the notion of a + * destination other than the printer device, and so will not support this + * attribute. *

    - * A common use for this attribute will be applications which want - * to redirect output to a local disk file : eg."file:out.prn". - * Note that proper construction of "file:" scheme URI instances should - * be performed using the {@code toURI()} method of class - * {@link java.io.File File}. - * See the documentation on that class for more information. + * A common use for this attribute will be applications which want to redirect + * output to a local disk file : eg."file:out.prn". Note that proper + * construction of "file:" scheme {@code URI} instances should be performed + * using the {@code toURI()} method of class {@link File File}. See the + * documentation on that class for more information. *

    - * If a destination URI is specified in a PrintRequest and it is not - * accessible for output by the PrintService, a PrintException will be thrown. - * The PrintException may implement URIException to provide a more specific - * cause. - *

    - * IPP Compatibility: Destination is not an IPP attribute. + * If a destination {@code URI} is specified in a PrintRequest and it is not + * accessible for output by the {@code PrintService}, a {@code PrintException} + * will be thrown. The {@code PrintException} may implement {@code URIException} + * to provide a more specific cause. + *

    + * IPP Compatibility: Destination is not an IPP attribute. * - * @author Phil Race. + * @author Phil Race */ public final class Destination extends URISyntax implements PrintJobAttribute, PrintRequestAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 6776739171700415321L; /** - * Constructs a new destination attribute with the specified URI. + * Constructs a new destination attribute with the specified {@code URI}. * - * @param uri URI. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code uri} is null. + * @param uri {@code URI} + * @throws NullPointerException if {@code uri} is {@code null} */ public Destination(URI uri) { super (uri); } /** - * Returns whether this destination attribute is equivalent to the - * passed in object. To be equivalent, all of the following conditions - * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class Destination. - *
    3. - * This destination attribute's URI and {@code object}'s URI - * are equal. - *
    + * Returns whether this destination attribute is equivalent to the passed in + * object. To be equivalent, all of the following conditions must be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code Destination}. + *
    3. This destination attribute's {@code URI} and {@code object}'s + * {@code URI} are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this destination - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this destination + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && @@ -97,11 +95,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class Destination, the category is class Destination itself. + *

    + * For class {@code Destination}, the category is class {@code Destination} + * itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return Destination.class; @@ -110,13 +109,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class Destination, the category name is {@code "spool-data-destination"}. + *

    + * For class {@code Destination}, the category name is + * {@code "spool-data-destination"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "spool-data-destination"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DialogTypeSelection.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DialogTypeSelection.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DialogTypeSelection.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2017, 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 @@ -25,107 +25,112 @@ package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; -import javax.print.attribute.Attribute; import javax.print.attribute.PrintRequestAttribute; /** - * Class DialogTypeSelection is a printing attribute class, an enumeration, - * that indicates the user dialog type to be used for specifying - * printing options. - * If {@code NATIVE} is specified, then where available, a native - * platform dialog is displayed. - * If {@code COMMON} is specified, a cross-platform print dialog is displayed. - * - * This option to specify a native dialog for use with an IPP attribute - * set provides a standard way to reflect back of the setting and option - * changes made by a user to the calling application, and integrates - * the native dialog into the Java printing APIs. - * But note that some options and settings in a native dialog may not - * necessarily map to IPP attributes as they may be non-standard platform, - * or even printer specific options. - *

    - * IPP Compatibility: This is not an IPP attribute. + * Class {@code DialogTypeSelection} is a printing attribute class, an + * enumeration, that indicates the user dialog type to be used for specifying + * printing options. If {@code NATIVE} is specified, then where available, a + * native platform dialog is displayed. If {@code COMMON} is specified, a + * cross-platform print dialog is displayed. + *

    + * This option to specify a native dialog for use with an IPP attribute set + * provides a standard way to reflect back of the setting and option changes + * made by a user to the calling application, and integrates the native dialog + * into the Java printing APIs. But note that some options and settings in a + * native dialog may not necessarily map to IPP attributes as they may be + * non-standard platform, or even printer specific options. + *

    + * IPP Compatibility: This is not an IPP attribute. * * @since 1.7 */ public final class DialogTypeSelection extends EnumSyntax implements PrintRequestAttribute { + /** + * Use serialVersionUID from JDK 1.7 for interoperability. + */ private static final long serialVersionUID = 7518682952133256029L; /** - * + * The native platform print dialog should be used. */ public static final DialogTypeSelection NATIVE = new DialogTypeSelection(0); /** - * + * The cross-platform print dialog should be used. */ public static final DialogTypeSelection COMMON = new DialogTypeSelection(1); /** - * Constructs a new dialog type selection enumeration value with the - * given integer value. + * Constructs a new dialog type selection enumeration value with the given + * integer value. * - * @param value Integer value. + * @param value Integer value */ protected DialogTypeSelection(int value) { super(value); } + /** + * The string table for class {@code DialogTypeSelection}. + */ private static final String[] myStringTable = { "native", "common"}; - + /** + * The enumeration value table for class + * {@code DialogTypeSelection}. + */ private static final DialogTypeSelection[] myEnumValueTable = { NATIVE, COMMON }; /** - * Returns the string table for class DialogTypeSelection. + * Returns the string table for class {@code DialogTypeSelection}. */ protected String[] getStringTable() { return myStringTable; } /** - * Returns the enumeration value table for class DialogTypeSelection. + * Returns the enumeration value table for class + * {@code DialogTypeSelection}. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } - - /** + /** * Gets the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class DialogTypeSelection the category is class - * DialogTypeSelection itself. + *

    + * For class {@code DialogTypeSelection} the category is class + * {@code DialogTypeSelection} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return DialogTypeSelection.class; } - /** * Gets the name of the category of which this attribute value is an * instance. - *

    - * For class DialogTypeSelection the category name is + *

    + * For class {@code DialogTypeSelection} the category name is * {@code "dialog-type-selection"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "dialog-type-selection"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DocumentName.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DocumentName.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/DocumentName.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,71 +22,67 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; import javax.print.attribute.TextSyntax; -import javax.print.attribute.DocAttribute; /** - * Class DocumentName is a printing attribute class, a text attribute, that - * specifies the name of a document. DocumentName is an attribute of the print - * data (the doc), not of the Print Job. A document's name is an arbitrary - * string defined by the client. - * However if a JobName is not specified, the DocumentName should be used - * instead, which implies that supporting specification of DocumentName - * requires reporting of JobName and vice versa. - * See {@link JobName JobName} for more information. - *

    - * IPP Compatibility: The string value gives the IPP name value. The + * Class {@code DocumentName} is a printing attribute class, a text attribute, + * that specifies the name of a document. {@code DocumentName} is an attribute + * of the print data (the doc), not of the Print Job. A document's name is an + * arbitrary string defined by the client. However if a JobName is not + * specified, the {@code DocumentName} should be used instead, which implies + * that supporting specification of {@code DocumentName} requires reporting of + * JobName and vice versa. See {@link JobName JobName} for more information. + *

    + * IPP Compatibility: The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class DocumentName extends TextSyntax implements DocAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 7883105848533280430L; /** - * Constructs a new document name attribute with the given document name - * and locale. + * Constructs a new document name attribute with the given document name and + * locale. * - * @param documentName Document name. - * @param locale Natural language of the text string. null - * is interpreted to mean the default locale as returned - * by {@code Locale.getDefault()} - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code documentName} is null. + * @param documentName document name + * @param locale natural language of the text string. {@code null} is + * interpreted to mean the default locale as returned by + * {@code Locale.getDefault()} + * @throws NullPointerException if {@code documentName} is {@code null} */ public DocumentName(String documentName, Locale locale) { super (documentName, locale); } /** - * Returns whether this document name attribute is equivalent to the - * passed in object. - * To be equivalent, all of the following conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class DocumentName. - *
    3. - * This document name attribute's underlying string and - * {@code object}'s underlying string are equal. - *
    4. - * This document name attribute's locale and {@code object}'s locale - * are equal. - *
    + * Returns whether this document name attribute is equivalent to the passed + * in object. To be equivalent, all of the following conditions must be + * true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code DocumentName}. + *
    3. This document name attribute's underlying string and + * {@code object}'s underlying string are equal. + *
    4. This document name attribute's locale and {@code object}'s locale + * are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this document - * name attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this document + * name attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && object instanceof DocumentName); @@ -95,11 +91,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class DocumentName, the category is class DocumentName itself. + *

    + * For class {@code DocumentName}, the category is class + * {@code DocumentName} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return DocumentName.class; @@ -108,13 +105,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class DocumentName, the category name is {@code "document-name"}. + *

    + * For class {@code DocumentName}, the category name is + * {@code "document-name"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "document-name"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Fidelity.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Fidelity.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Fidelity.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -30,27 +31,27 @@ import javax.print.attribute.PrintRequestAttribute; /** - * Class Fidelity is a printing attribute class, an enumeration, - * that indicates whether total fidelity to client supplied print request - * attributes is required. - * If FIDELITY_TRUE is specified and a service cannot print the job exactly - * as specified it must reject the job. - * If FIDELITY_FALSE is specified a reasonable attempt to print the job is - * acceptable. If not supplied the default is FIDELITY_FALSE. - * - *

    - * IPP Compatibility: The IPP boolean value is "true" for FIDELITY_TRUE - * and "false" for FIDELITY_FALSE. The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. - * See RFC 2911 Section 15.1 for - * a fuller description of the IPP fidelity attribute. - * + * Class {@code Fidelity} is a printing attribute class, an enumeration, that + * indicates whether total fidelity to client supplied print request attributes + * is required. If {@code FIDELITY_TRUE} is specified and a service cannot print + * the job exactly as specified it must reject the job. If + * {@code FIDELITY_FALSE} is specified a reasonable attempt to print the job is + * acceptable. If not supplied the default is {@code FIDELITY_FALSE}. + *

    + * IPP Compatibility: The IPP boolean value is "true" for + * {@code FIDELITY_TRUE} and "false" for {@code FIDELITY_FALSE}. The category + * name returned by {@code getName()} is the IPP attribute name. The + * enumeration's integer value is the IPP enum value. The {@code toString()} + * method returns the IPP string representation of the attribute value. See + * RFC 2911 Section 15.1 for a + * fuller description of the IPP fidelity attribute. */ public final class Fidelity extends EnumSyntax implements PrintJobAttribute, PrintRequestAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 6320827847329172308L; /** @@ -60,53 +61,60 @@ FIDELITY_TRUE = new Fidelity(0); /** - * The printer should make reasonable attempts to print the job, - * even if it cannot print it exactly as specified. + * The printer should make reasonable attempts to print the job, even if it + * cannot print it exactly as specified. */ public static final Fidelity FIDELITY_FALSE = new Fidelity(1); /** - * Construct a new fidelity enumeration value with the - * given integer value. + * Construct a new fidelity enumeration value with the given integer value. * - * @param value Integer value. + * @param value Integer value */ protected Fidelity(int value) { super (value); } + /** + * The string table for class {@code Fidelity}. + */ private static final String[] myStringTable = { "true", "false" }; - + /** + * The enumeration value table for class {@code Fidelity}. + */ private static final Fidelity[] myEnumValueTable = { FIDELITY_TRUE, FIDELITY_FALSE }; /** - * Returns the string table for class Fidelity. + * Returns the string table for class {@code Fidelity}. */ protected String[] getStringTable() { return myStringTable; } /** - * Returns the enumeration value table for class Fidelity. + * Returns the enumeration value table for class {@code Fidelity}. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; - } /** + } + + /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class Fidelity the category is class Fidelity itself. + *

    + * For class {@code Fidelity} the category is class + * {@code Fidelity} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return Fidelity.class; @@ -115,14 +123,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class Fidelity the category name is + *

    + * For class {@code Fidelity} the category name is * {@code "ipp-attribute-fidelity"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "ipp-attribute-fidelity"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Finishings.java Sat Sep 09 14:36:45 2017 +0200 @@ -22,209 +22,134 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; -import javax.print.attribute.DocAttribute; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class Finishings is a printing attribute class, an enumeration, that - * identifies whether the printer applies a finishing operation of some kind - * of binding to each copy of each printed document in the job. For multidoc - * print jobs (jobs with multiple documents), the - * {@link MultipleDocumentHandling - * MultipleDocumentHandling} attribute determines what constitutes a "copy" - * for purposes of finishing. - *

    + * Class {@code Finishings} is a printing attribute class, an enumeration, that + * identifies whether the printer applies a finishing operation of some kind of + * binding to each copy of each printed document in the job. For multidoc print + * jobs (jobs with multiple documents), the + * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute + * determines what constitutes a "copy" for purposes of finishing. + *

    * Standard Finishings values are: * * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Standard Finishings values
    - *   - * - * {@link #NONE NONE} - * - * {@link #STAPLE STAPLE} - * - * {@link #EDGE_STITCH EDGE_STITCH} - *
    - *   - * - * {@link #BIND BIND} - * - * {@link #SADDLE_STITCH SADDLE_STITCH} - * - * {@link #COVER COVER} - * - *   - *
    - *

    - * The following Finishings values are more specific; they indicate a + * + *   + * {@link #NONE NONE} + * {@link #STAPLE STAPLE} + * {@link #EDGE_STITCH EDGE_STITCH} + * + *   + * {@link #BIND BIND} + * {@link #SADDLE_STITCH SADDLE_STITCH} + * {@link #COVER COVER} + *   + * + *

    + * The following {@code Finishings} values are more specific; they indicate a * corner or an edge as if the document were a portrait document: * * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
    Specific Finishings values
    - *   - * - * {@link #STAPLE_TOP_LEFT STAPLE_TOP_LEFT} - * - * {@link #EDGE_STITCH_LEFT EDGE_STITCH_LEFT} - * - * {@link #STAPLE_DUAL_LEFT STAPLE_DUAL_LEFT} - * - *   - *
    - *   - * - * {@link #STAPLE_BOTTOM_LEFT STAPLE_BOTTOM_LEFT} - * - * {@link #EDGE_STITCH_TOP EDGE_STITCH_TOP} - * - * {@link #STAPLE_DUAL_TOP STAPLE_DUAL_TOP} - * - *   - *
    - *   - * - * {@link #STAPLE_TOP_RIGHT STAPLE_TOP_RIGHT} - * - * {@link #EDGE_STITCH_RIGHT EDGE_STITCH_RIGHT} - * - * {@link #STAPLE_DUAL_RIGHT STAPLE_DUAL_RIGHT} - * - *   - *
    - *   - * - * {@link #STAPLE_BOTTOM_RIGHT STAPLE_BOTTOM_RIGHT} - * - * {@link #EDGE_STITCH_BOTTOM EDGE_STITCH_BOTTOM} - * - * {@link #STAPLE_DUAL_BOTTOM STAPLE_DUAL_BOTTOM} - * - *   - *
    - *

    - * The STAPLE_XXX values are specified with respect to the - * document as if the document were a portrait document. If the document is - * actually a landscape or a reverse-landscape document, the client supplies the + * + *   + * {@link #STAPLE_TOP_LEFT STAPLE_TOP_LEFT} + * {@link #EDGE_STITCH_LEFT EDGE_STITCH_LEFT} + * {@link #STAPLE_DUAL_LEFT STAPLE_DUAL_LEFT} + *   + * + *   + * {@link #STAPLE_BOTTOM_LEFT STAPLE_BOTTOM_LEFT} + * {@link #EDGE_STITCH_TOP EDGE_STITCH_TOP} + * {@link #STAPLE_DUAL_TOP STAPLE_DUAL_TOP} + *   + * + *   + * {@link #STAPLE_TOP_RIGHT STAPLE_TOP_RIGHT} + * {@link #EDGE_STITCH_RIGHT EDGE_STITCH_RIGHT} + * {@link #STAPLE_DUAL_RIGHT STAPLE_DUAL_RIGHT} + *   + * + *   + * {@link #STAPLE_BOTTOM_RIGHT STAPLE_BOTTOM_RIGHT} + * {@link #EDGE_STITCH_BOTTOM EDGE_STITCH_BOTTOM} + * {@link #STAPLE_DUAL_BOTTOM STAPLE_DUAL_BOTTOM} + *   + * + *

    + * The STAPLE_XXX values are specified with respect to the document as if + * the document were a portrait document. If the document is actually a + * landscape or a reverse-landscape document, the client supplies the * appropriate transformed value. For example, to position a staple in the upper * left hand corner of a landscape document when held for reading, the client - * supplies the STAPLE_BOTTOM_LEFT value (since landscape is - * defined as a +90 degree rotation from portrait, i.e., anti-clockwise). On the - * other hand, to position a staple in the upper left hand corner of a + * supplies the {@code STAPLE_BOTTOM_LEFT} value (since landscape is defined as + * a +90 degree rotation from portrait, i.e., anti-clockwise). On the other + * hand, to position a staple in the upper left hand corner of a * reverse-landscape document when held for reading, the client supplies the - * STAPLE_TOP_RIGHT value (since reverse-landscape is defined as a - * -90 degree rotation from portrait, i.e., clockwise). - *

    + * {@code STAPLE_TOP_RIGHT} value (since reverse-landscape is defined as a -90 + * degree rotation from portrait, i.e., clockwise). + *

    * The angle (vertical, horizontal, angled) of each staple with respect to the * document depends on the implementation which may in turn depend on the value * of the attribute. - *

    - * The effect of a Finishings attribute on a multidoc print job (a job + *

    + * The effect of a {@code Finishings} attribute on a multidoc print job (a job * with multiple documents) depends on whether all the docs have the same * binding specified or whether different docs have different bindings - * specified, and on the (perhaps defaulted) value of the {@link - * MultipleDocumentHandling MultipleDocumentHandling} attribute. - *

      - *
    • - * If all the docs have the same binding specified, then any value of {@link - * MultipleDocumentHandling MultipleDocumentHandling} makes sense, and the - * printer's processing depends on the {@link MultipleDocumentHandling - * MultipleDocumentHandling} value: - *
        - *
      • - * SINGLE_DOCUMENT -- All the input docs will be bound together as one output - * document with the specified binding. - * - *
      • - * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be bound together as one - * output document with the specified binding, and the first impression of each - * input doc will always start on a new media sheet. - * - *
      • - * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound - * separately with the specified binding. - * - *
      • - * SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately - * with the specified binding. - *
      + * specified, and on the (perhaps defaulted) value of the + * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute. + *
        + *
      • If all the docs have the same binding specified, then any value of + * {@link MultipleDocumentHandling MultipleDocumentHandling} makes sense, and + * the printer's processing depends on the + * {@link MultipleDocumentHandling MultipleDocumentHandling} value: + *
          + *
        • {@code SINGLE_DOCUMENT} -- All the input docs will be bound together + * as one output document with the specified binding. + *
        • {@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be bound + * together as one output document with the specified binding, and the first + * impression of each input doc will always start on a new media sheet. + *
        • {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- Each input doc will + * be bound separately with the specified binding. + *
        • {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- Each input doc will be + * bound separately with the specified binding. + *
        + *
      • If different docs have different bindings specified, then only two + * values of {@link MultipleDocumentHandling MultipleDocumentHandling} make + * sense, and the printer reports an error when the job is submitted if any + * other value is specified: + *
          + *
        • {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- Each input doc will + * be bound separately with its own specified binding. + *
        • {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- Each input doc will be + * bound separately with its own specified binding. + *
        + *
      + *

      + * IPP Compatibility: Class Finishings encapsulates some of the IPP enum + * values that can be included in an IPP "finishings" attribute, which is a set + * of enums. The category name returned by {@code getName()} is the IPP + * attribute name. The enumeration's integer value is the IPP enum value. The + * {@code toString()} method returns the IPP string representation of the + * attribute value. In IPP Finishings is a multi-value attribute, this API + * currently allows only one binding to be specified. * - *

    • - * If different docs have different bindings specified, then only two values of - * {@link MultipleDocumentHandling MultipleDocumentHandling} make sense, and the - * printer reports an error when the job is submitted if any other value is - * specified: - *
        - *
      • - * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will be bound - * separately with its own specified binding. - * - *
      • - * SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input doc will be bound separately - * with its own specified binding. - *
      - *
    - *

    - * IPP Compatibility: Class Finishings encapsulates some of the - * IPP enum values that can be included in an IPP "finishings" attribute, which - * is a set of enums. The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. - * In IPP Finishings is a multi-value attribute, this API currently allows - * only one binding to be specified. - * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public class Finishings extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -627840419548391754L; /** @@ -241,21 +166,21 @@ /** * This value is specified when it is desired to select a non-printed (or * pre-printed) cover for the document. This does not supplant the - * specification of a printed cover (on cover stock medium) by the - * document itself. + * specification of a printed cover (on cover stock medium) by the document + * itself. */ public static final Finishings COVER = new Finishings(6); /** - * This value indicates that a binding is to be applied to the document; - * the type and placement of the binding is site-defined. + * This value indicates that a binding is to be applied to the document; the + * type and placement of the binding is site-defined. */ public static final Finishings BIND = new Finishings(7); /** * Bind the document(s) with one or more staples (wire stitches) along the - * middle fold. The exact number and placement of the staples and the - * middle fold is implementation- and/or site-defined. + * middle fold. The exact number and placement of the staples and the middle + * fold is implementation- and/or site-defined. */ public static final Finishings SADDLE_STITCH = new Finishings(8); @@ -275,8 +200,7 @@ new Finishings(20); /** - * Bind the document(s) with one or more staples in the bottom left - * corner. + * Bind the document(s) with one or more staples in the bottom left corner. */ public static final Finishings STAPLE_BOTTOM_LEFT = new Finishings(21); @@ -288,8 +212,7 @@ new Finishings(22); /** - * Bind the document(s) with one or more staples in the bottom right - * corner. + * Bind the document(s) with one or more staples in the bottom right corner. */ public static final Finishings STAPLE_BOTTOM_RIGHT = new Finishings(23); @@ -327,15 +250,15 @@ new Finishings(27); /** - * Bind the document(s) with two staples (wire stitches) along the left - * edge assuming a portrait document (see above). + * Bind the document(s) with two staples (wire stitches) along the left edge + * assuming a portrait document (see above). */ public static final Finishings STAPLE_DUAL_LEFT = new Finishings(28); /** - * Bind the document(s) with two staples (wire stitches) along the top - * edge assuming a portrait document (see above). + * Bind the document(s) with two staples (wire stitches) along the top edge + * assuming a portrait document (see above). */ public static final Finishings STAPLE_DUAL_TOP = new Finishings(29); @@ -358,12 +281,15 @@ * Construct a new finishings binding enumeration value with the given * integer value. * - * @param value Integer value. + * @param value Integer value */ protected Finishings(int value) { super(value); } + /** + * The string table for class {@code Finishings}. + */ private static final String[] myStringTable = {"none", "staple", @@ -396,6 +322,9 @@ "staple-dual-bottom" }; + /** + * The enumeration value table for class {@code Finishings}. + */ private static final Finishings[] myEnumValueTable = {NONE, STAPLE, @@ -429,21 +358,21 @@ }; /** - * Returns the string table for class Finishings. + * Returns the string table for class {@code Finishings}. */ protected String[] getStringTable() { return myStringTable.clone(); } /** - * Returns the enumeration value table for class Finishings. + * Returns the enumeration value table for class {@code Finishings}. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } /** - * Returns the lowest integer value used by class Finishings. + * Returns the lowest integer value used by class {@code Finishings}. */ protected int getOffset() { return 3; @@ -452,12 +381,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class Finishings and any vendor-defined subclasses, the - * category is class Finishings itself. + *

    + * For class {@code Finishings} and any vendor-defined subclasses, the + * category is class {@code Finishings} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return Finishings.class; @@ -466,14 +395,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class Finishings and any vendor-defined subclasses, the + *

    + * For class {@code Finishings} and any vendor-defined subclasses, the * category name is {@code "finishings"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "finishings"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobHoldUntil.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobHoldUntil.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobHoldUntil.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,116 +22,118 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; +import java.util.Calendar; import java.util.Date; + import javax.print.attribute.Attribute; import javax.print.attribute.DateTimeSyntax; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class JobHoldUntil is a printing attribute class, a date-time attribute, that - * specifies the exact date and time at which the job must become a candidate - * for printing. - *

    + * Class {@code JobHoldUntil} is a printing attribute class, a date-time + * attribute, that specifies the exact date and time at which the job must + * become a candidate for printing. + *

    * If the value of this attribute specifies a date-time that is in the future, * the printer should add the {@link JobStateReason JobStateReason} value of - * JOB_HOLD_UNTIL_SPECIFIED to the job's {@link JobStateReasons JobStateReasons} - * attribute, must move the job to the PENDING_HELD state, and must not schedule - * the job for printing until the specified date-time arrives. - *

    - * When the specified date-time arrives, the printer must remove the {@link - * JobStateReason JobStateReason} value of JOB_HOLD_UNTIL_SPECIFIED from the - * job's {@link JobStateReasons JobStateReasons} attribute, if present. If there - * are no other job state reasons that keep the job in the PENDING_HELD state, - * the printer must consider the job as a candidate for processing by moving the - * job to the PENDING state. - *

    + * {@code JOB_HOLD_UNTIL_SPECIFIED} to the job's + * {@link JobStateReasons JobStateReasons} attribute, must move the job to the + * {@code PENDING_HELD} state, and must not schedule the job for printing until + * the specified date-time arrives. + *

    + * When the specified date-time arrives, the printer must remove the + * {@link JobStateReason JobStateReason} value of + * {@code JOB_HOLD_UNTIL_SPECIFIED} from the job's + * {@link JobStateReasons JobStateReasons} attribute, if present. If there are + * no other job state reasons that keep the job in the {@code PENDING_HELD} + * state, the printer must consider the job as a candidate for processing by + * moving the job to the PENDING state. + *

    * If the specified date-time has already passed, the job must be a candidate * for processing immediately. Thus, one way to make the job immediately become - * a candidate for processing is to specify a JobHoldUntil attribute constructed - * like this (denoting a date-time of January 1, 1970, 00:00:00 GMT): - *

    + * a candidate for processing is to specify a {@code JobHoldUntil} attribute
    + * constructed like this
    + * (denoting a date-time of January 1, 1970, 00:00:00 GMT):
    + * 
      *     JobHoldUntil immediately = new JobHoldUntil (new Date (0L));
    - * 
    - *

    + *

    + *

    * If the client does not supply this attribute in a Print Request and the * printer supports this attribute, the printer must use its - * (implementation-dependent) default JobHoldUntil value at job submission time - * (unlike most job template attributes that are used if necessary at job - * processing time). - *

    - * To construct a JobHoldUntil attribute from separate values of the year, - * month, day, hour, minute, and so on, use a {@link java.util.Calendar - * Calendar} object to construct a {@link java.util.Date Date} object, then use - * the {@link java.util.Date Date} object to construct the JobHoldUntil - * attribute. To convert a JobHoldUntil attribute to separate values of the - * year, month, day, hour, minute, and so on, create a {@link java.util.Calendar - * Calendar} object and set it to the {@link java.util.Date Date} from the - * JobHoldUntil attribute. - *

    - * IPP Compatibility: Although IPP supports a "job-hold-until" attribute + * (implementation-dependent) default {@code JobHoldUntil} value at job + * submission time (unlike most job template attributes that are used if + * necessary at job processing time). + *

    + * To construct a {@code JobHoldUntil} attribute from separate values of the + * year, month, day, hour, minute, and so on, use a {@link Calendar Calendar} + * object to construct a {@link Date Date} object, then use the + * {@link Date Date} object to construct the {@code JobHoldUntil} attribute. To + * convert a {@code JobHoldUntil} attribute to separate values of the year, + * month, day, hour, minute, and so on, create a {@link Calendar Calendar} + * object and set it to the {@link Date Date} from the {@code JobHoldUntil} + * attribute. + *

    + * IPP Compatibility: Although IPP supports a "job-hold-until" attribute * specified as a keyword, IPP does not at this time support a "job-hold-until" * attribute specified as a date and time. However, the date and time can be * converted to one of the standard IPP keywords with some loss of precision; - * for example, a JobHoldUntil value with today's date and 9:00pm local time - * might be converted to the standard IPP keyword "night". The category name - * returned by {@code getName()} gives the IPP attribute name. + * for example, a {@code JobHoldUntil} value with today's date and 9:00pm local + * time might be converted to the standard IPP keyword "night". The category + * name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class JobHoldUntil extends DateTimeSyntax implements PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -1664471048860415024L; - /** * Construct a new job hold until date-time attribute with the given - * {@link java.util.Date Date} value. + * {@link Date Date} value. * - * @param dateTime {@link java.util.Date Date} value. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code dateTime} is null. + * @param dateTime {@link Date Date} value + * @throws NullPointerException if {@code dateTime} is {@code null} */ public JobHoldUntil(Date dateTime) { super (dateTime); } /** - * Returns whether this job hold until attribute is equivalent to the - * passed in object. To be equivalent, all of the following conditions - * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobHoldUntil. - *
    3. - * This job hold until attribute's {@link java.util.Date Date} value and - * {@code object}'s {@link java.util.Date Date} value are equal. - *
    + * Returns whether this job hold until attribute is equivalent to the passed + * in object. To be equivalent, all of the following conditions must be + * true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code JobHoldUntil}. + *
    3. This job hold until attribute's {@link Date Date} value and + * {@code object}'s {@link Date Date} value are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job hold - * until attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job hold + * until attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && object instanceof JobHoldUntil); } - /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobHoldUntil, the category is class JobHoldUntil itself. + *

    + * For class {@code JobHoldUntil}, the category is class + * {@code JobHoldUntil} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobHoldUntil.class; @@ -140,13 +142,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobHoldUntil, the category name is {@code "job-hold-until"}. + *

    + * For class {@code JobHoldUntil}, the category name is + * {@code "job-hold-until"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-hold-until"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressions.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressions.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressions.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,70 +22,71 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class JobImpressions is an integer valued printing attribute class that - * specifies the total size in number of impressions of the document(s) being - * submitted. An "impression" is the image (possibly many print-stream pages in - * different configurations) imposed onto a single media page. - *

    - * The JobImpressions attribute describes the size of the job. This attribute is - * not intended to be a counter; it is intended to be useful routing and - * scheduling information if known. The printer may try to compute the - * JobImpressions attribute's value if it is not supplied in the Print Request. - * Even if the client does supply a value for the JobImpressions attribute in - * the Print Request, the printer may choose to change the value if the printer - * is able to compute a value which is more accurate than the client supplied - * value. The printer may be able to determine the correct value for the - * JobImpressions attribute either right at job submission time or at any later - * point in time. - *

    - * As with {@link JobKOctets JobKOctets}, the JobImpressions value must not - * include the multiplicative factors contributed by the number of copies + * Class {@code JobImpressions} is an integer valued printing attribute class + * that specifies the total size in number of impressions of the document(s) + * being submitted. An "impression" is the image (possibly many print-stream + * pages in different configurations) imposed onto a single media page. + *

    + * The {@code JobImpressions} attribute describes the size of the job. This + * attribute is not intended to be a counter; it is intended to be useful + * routing and scheduling information if known. The printer may try to compute + * the {@code JobImpressions} attribute's value if it is not supplied in the + * Print Request. Even if the client does supply a value for the + * {@code JobImpressions} attribute in the Print Request, the printer may choose + * to change the value if the printer is able to compute a value which is more + * accurate than the client supplied value. The printer may be able to determine + * the correct value for the {@code JobImpressions} attribute either right at + * job submission time or at any later point in time. + *

    + * As with {@link JobKOctets JobKOctets}, the {@code JobImpressions} value must + * not include the multiplicative factors contributed by the number of copies * specified by the {@link Copies Copies} attribute, independent of whether the * device can process multiple copies without making multiple passes over the * job or document data and independent of whether the output is collated or * not. Thus the value is independent of the implementation and reflects the * size of the document(s) measured in impressions independent of the number of * copies. - *

    - * As with {@link JobKOctets JobKOctets}, the JobImpressions value must also not - * include the multiplicative factor due to a copies instruction embedded in the - * document data. If the document data actually includes replications of the - * document data, this value will include such replication. In other words, this - * value is always the number of impressions in the source document data, rather - * than a measure of the number of impressions to be produced by the job. - *

    - * IPP Compatibility: The integer value gives the IPP integer value. The - * category name returned by {@code getName()} gives the IPP attribute - * name. + *

    + * As with {@link JobKOctets JobKOctets}, the {@code JobImpressions} value must + * also not include the multiplicative factor due to a copies instruction + * embedded in the document data. If the document data actually includes + * replications of the document data, this value will include such replication. + * In other words, this value is always the number of impressions in the source + * document data, rather than a measure of the number of impressions to be + * produced by the job. + *

    + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * + * @author Alan Kaminsky * @see JobImpressionsSupported * @see JobImpressionsCompleted * @see JobKOctets * @see JobMediaSheets - * - * @author Alan Kaminsky */ public final class JobImpressions extends IntegerSyntax implements PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 8225537206784322464L; - /** * Construct a new job impressions attribute with the given integer value. * - * @param value Integer value. + * @param value Integer value + * @throws IllegalArgumentException if {@code value} is negative * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 0. */ public JobImpressions(int value) { super(value, 0, Integer.MAX_VALUE); @@ -95,20 +96,16 @@ * Returns whether this job impressions attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions must * be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobImpressions. - *
    3. - * This job impressions attribute's value and {@code object}'s value - * are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code JobImpressions}. + *
    3. This job impressions attribute's value and {@code object}'s value + * are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job - * impressions attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job + * impressions attribute, {@code false} otherwise */ public boolean equals(Object object) { return super.equals (object) && object instanceof JobImpressions; @@ -117,11 +114,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobImpressions, the category is class JobImpressions itself. + *

    + * For class {@code JobImpressions}, the category is class + * {@code JobImpressions} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobImpressions.class; @@ -130,14 +128,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobImpressions, the category name is + *

    + * For class {@code JobImpressions}, the category name is * {@code "job-impressions"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-impressions"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressionsCompleted.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressionsCompleted.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressionsCompleted.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,68 +30,66 @@ import javax.print.attribute.PrintJobAttribute; /** - * Class JobImpressionsCompleted is an integer valued printing attribute class - * that specifies the number of impressions completed for the job so far. For - * printing devices, the impressions completed includes interpreting, marking, - * and stacking the output. - *

    - * The JobImpressionsCompleted attribute describes the progress of the job. This - * attribute is intended to be a counter. That is, the JobImpressionsCompleted - * value for a job that has not started processing must be 0. When the job's - * {@link JobState JobState} is PROCESSING or PROCESSING_STOPPED, the - * JobImpressionsCompleted value is intended to increase as the job is + * Class {@code JobImpressionsCompleted} is an integer valued printing attribute + * class that specifies the number of impressions completed for the job so far. + * For printing devices, the impressions completed includes interpreting, + * marking, and stacking the output. + *

    + * The {@code JobImpressionsCompleted} attribute describes the progress of the + * job. This attribute is intended to be a counter. That is, the + * {@code JobImpressionsCompleted} value for a job that has not started + * processing must be 0. When the job's {@link JobState JobState} is + * {@code PROCESSING} or {@code PROCESSING_STOPPED}, the + * {@code JobImpressionsCompleted} value is intended to increase as the job is * processed; it indicates the amount of the job that has been processed at the * time the Print Job's attribute set is queried or at the time a print job - * event is reported. When the job enters the COMPLETED, CANCELED, or ABORTED - * states, the JobImpressionsCompleted value is the final value for the job. - *

    - * IPP Compatibility: The integer value gives the IPP integer value. The - * category name returned by {@code getName()} gives the IPP attribute - * name. + * event is reported. When the job enters the {@code COMPLETED}, + * {@code CANCELED}, or {@code ABORTED} states, the + * {@code JobImpressionsCompleted} value is the final value for the job. + *

    + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * + * @author Alan Kaminsky * @see JobImpressions * @see JobImpressionsSupported * @see JobKOctetsProcessed * @see JobMediaSheetsCompleted - * - * @author Alan Kaminsky */ public final class JobImpressionsCompleted extends IntegerSyntax implements PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 6722648442432393294L; /** * Construct a new job impressions completed attribute with the given * integer value. * - * @param value Integer value. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 0. + * @param value Integer value + * @throws IllegalArgumentException if {@code value} is negative */ public JobImpressionsCompleted(int value) { super (value, 0, Integer.MAX_VALUE); } /** - * Returns whether this job impressions completed attribute is equivalent - * tp the passed in object. To be equivalent, all of the following - * conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobImpressionsCompleted. - *
    3. - * This job impressions completed attribute's value and - * {@code object}'s value are equal. - *
    + * Returns whether this job impressions completed attribute is equivalent tp + * the passed in object. To be equivalent, all of the following conditions + * must be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class + * {@code JobImpressionsCompleted}. + *
    3. This job impressions completed attribute's value and + * {@code object}'s value are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job - * impressions completed attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job + * impressions completed attribute, {@code false} otherwise */ public boolean equals(Object object) { return(super.equals (object) && @@ -100,12 +99,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobImpressionsCompleted, the category is class - * JobImpressionsCompleted itself. + *

    + * For class {@code JobImpressionsCompleted}, the category is class + * {@code JobImpressionsCompleted} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobImpressionsCompleted.class; @@ -114,14 +113,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobImpressionsCompleted, the category name is + *

    + * For class {@code JobImpressionsCompleted}, the category name is * {@code "job-impressions-completed"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-impressions-completed"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressionsSupported.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressionsSupported.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobImpressionsSupported.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,40 +30,40 @@ import javax.print.attribute.SupportedValuesAttribute; /** - * Class JobImpressionsSupported is a printing attribute class, a set of - * integers, that gives the supported values for a {@link JobImpressions - * JobImpressions} attribute. It is restricted to a single contiguous range of - * integers; multiple non-overlapping ranges are not allowed. This gives the - * lower and upper bounds of the total sizes of print jobs in number of - * impressions that the printer will accept. - *

    - * IPP Compatibility: The JobImpressionsSupported attribute's canonical - * array form gives the lower and upper bound for the range of values to be - * included in an IPP "job-impressions-supported" attribute. See class {@link - * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an - * explanation of canonical array form. The category name returned by - * {@code getName()} gives the IPP attribute name. + * Class {@code JobImpressionsSupported} is a printing attribute class, a set of + * integers, that gives the supported values for a + * {@link JobImpressions JobImpressions} attribute. It is restricted to a single + * contiguous range of integers; multiple non-overlapping ranges are not + * allowed. This gives the lower and upper bounds of the total sizes of print + * jobs in number of impressions that the printer will accept. + *

    + * IPP Compatibility: The {@code JobImpressionsSupported} attribute's + * canonical array form gives the lower and upper bound for the range of values + * to be included in an IPP "job-impressions-supported" attribute. See class + * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of canonical + * array form. The category name returned by {@code getName()} gives the IPP + * attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class JobImpressionsSupported extends SetOfIntegerSyntax implements SupportedValuesAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -4887354803843173692L; - /** * Construct a new job impressions supported attribute containing a single - * range of integers. That is, only those values of JobImpressions in the - * one range are supported. + * range of integers. That is, only those values of {@code JobImpressions} + * in the one range are supported. * - * @param lowerBound Lower bound of the range. - * @param upperBound Upper bound of the range. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if a null range is specified or if a - * non-null range is specified with {@code lowerBound} less than - * 0. + * @param lowerBound lower bound of the range + * @param upperBound upper bound of the range + * @throws IllegalArgumentException if a {@code null} range is specified or + * if a {@code non-null} range is specified with {@code lowerBound} + * less than zero */ public JobImpressionsSupported(int lowerBound, int upperBound) { super (lowerBound, upperBound); @@ -74,25 +75,21 @@ } } - /** - * Returns whether this job impressions supported attribute is equivalent - * to the passed in object. To be equivalent, all of the following - * conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobImpressionsSupported. - *
    3. - * This job impressions supported attribute's members and - * {@code object}'s members are the same. - *
    + * Returns whether this job impressions supported attribute is equivalent to + * the passed in object. To be equivalent, all of the following conditions + * must be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class + * {@code JobImpressionsSupported}. + *
    3. This job impressions supported attribute's members and + * {@code object}'s members are the same. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job - * impressions supported attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job + * impressions supported attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && @@ -102,12 +99,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobImpressionsSupported, the category is class - * JobImpressionsSupported itself. + *

    + * For class {@code JobImpressionsSupported}, the category is class + * {@code JobImpressionsSupported} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobImpressionsSupported.class; @@ -116,14 +113,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobImpressionsSupported, the category name is + *

    + * For class {@code JobImpressionsSupported}, the category name is * {@code "job-impressions-supported"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-impressions-supported"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctets.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctets.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctets.java Sat Sep 09 14:36:45 2017 +0200 @@ -22,126 +22,119 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class JobKOctets is an integer valued printing attribute class that specifies - * the total size of the document(s) in K octets, i.e., in units of 1024 octets - * requested to be processed in the job. The value must be rounded up, so that a - * job between 1 and 1024 octets must be indicated as being 1K octets, 1025 to - * 2048 must be 2K octets, etc. For a multidoc print job (a job with multiple - * documents), the JobKOctets value is computed by adding up the individual - * documents' sizes in octets, then rounding up to the next K octets value. - *

    - * The JobKOctets attribute describes the size of the job. This attribute is not - * intended to be a counter; it is intended to be useful routing and scheduling - * information if known. The printer may try to compute the JobKOctets - * attribute's value if it is not supplied in the Print Request. Even if the - * client does supply a value for the JobKOctets attribute in the Print Request, - * the printer may choose to change the value if the printer is able to compute - * a value which is more accurate than the client supplied value. The printer - * may be able to determine the correct value for the JobKOctets attribute - * either right at job submission time or at any later point in time. - *

    - * The JobKOctets value must not include the multiplicative factors contributed - * by the number of copies specified by the {@link Copies Copies} attribute, - * independent of whether the device can process multiple copies without making - * multiple passes over the job or document data and independent of whether the - * output is collated or not. Thus the value is independent of the - * implementation and indicates the size of the document(s) measured in K octets - * independent of the number of copies. - *

    - * The JobKOctets value must also not include the multiplicative factor due to a - * copies instruction embedded in the document data. If the document data - * actually includes replications of the document data, this value will include - * such replication. In other words, this value is always the size of the source - * document data, rather than a measure of the hardcopy output to be produced. - *

    + * Class {@code JobKOctets} is an integer valued printing attribute class that + * specifies the total size of the document(s) in K octets, i.e., in units of + * 1024 octets requested to be processed in the job. The value must be rounded + * up, so that a job between 1 and 1024 octets must be indicated as being 1K + * octets, 1025 to 2048 must be 2K octets, etc. For a multidoc print job (a job + * with multiple documents), the {@code JobKOctets} value is computed by adding + * up the individual documents' sizes in octets, then rounding up to the next K + * octets value. + *

    + * The {@code JobKOctets} attribute describes the size of the job. This + * attribute is not intended to be a counter; it is intended to be useful + * routing and scheduling information if known. The printer may try to compute + * the {@code JobKOctets} attribute's value if it is not supplied in the Print + * Request. Even if the client does supply a value for the {@code JobKOctets} + * attribute in the Print Request, the printer may choose to change the value if + * the printer is able to compute a value which is more accurate than the client + * supplied value. The printer may be able to determine the correct value for + * the {@code JobKOctets} attribute either right at job submission time or at + * any later point in time. + *

    + * The {@code JobKOctets} value must not include the multiplicative factors + * contributed by the number of copies specified by the {@link Copies Copies} + * attribute, independent of whether the device can process multiple copies + * without making multiple passes over the job or document data and independent + * of whether the output is collated or not. Thus the value is independent of + * the implementation and indicates the size of the document(s) measured in K + * octets independent of the number of copies. + *

    + * The {@code JobKOctets} value must also not include the multiplicative factor + * due to a copies instruction embedded in the document data. If the document + * data actually includes replications of the document data, this value will + * include such replication. In other words, this value is always the size of + * the source document data, rather than a measure of the hardcopy output to be + * produced. + *

    * The size of a doc is computed based on the print data representation class as - * specified by the doc's {@link javax.print.DocFlavor DocFlavor}, as - * shown in the table below. - * + * specified by the doc's {@link javax.print.DocFlavor DocFlavor}, as shown in + * the table below. * * * - * - * - * - * + * + * * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + * + * + * - *
    Table showing computation of doc sizes
    Representation ClassDocument Size
    Representation Class + * Document Size *
    byte[]Length of the byte array
    java.io.InputStreamNumber of bytes read from the stream
    char[]Length of the character array x 2
    java.lang.StringLength of the string x 2
    java.io.ReaderNumber of characters read from the stream x 2
    java.net.URLNumber of bytes read from the file at the given URL address
    java.awt.image.renderable.RenderableImageImplementation dependent*
    java.awt.print.PrintableImplementation dependent*
    java.awt.print.PageableImplementation dependent*
    {@code byte[]} + * Length of the byte array + *
    {@code java.io.InputStream} + * Number of bytes read from the stream + *
    {@code char[]} + * Length of the character array x 2 + *
    {@code java.lang.String} + * Length of the string x 2 + *
    {@code java.io.Reader} + * Number of characters read from the stream x 2 + *
    {@code java.net.URL} + * Number of bytes read from the file at the given {@code URL} address + *
    {@code java.awt.image.renderable.RenderableImage} + * Implementation dependent* + *
    {@code java.awt.print.Printable} + * Implementation dependent* + *
    {@code java.awt.print.Pageable} + * Implementation dependent* *
    - *

    + * + *

    * * In these cases the Print Service itself generates the print data sent - * to the printer. If the Print Service supports the JobKOctets attribute, for - * these cases the Print Service itself must calculate the size of the print - * data, replacing any JobKOctets value the client specified. - *

    - * IPP Compatibility: The integer value gives the IPP integer value. The - * category name returned by {@code getName()} gives the IPP attribute - * name. + * to the printer. If the Print Service supports the {@code JobKOctets} + * attribute, for these cases the Print Service itself must calculate the size + * of the print data, replacing any {@code JobKOctets} value the client + * specified. + *

    + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * + * @author Alan Kaminsky * @see JobKOctetsSupported * @see JobKOctetsProcessed * @see JobImpressions * @see JobMediaSheets - * - * @author Alan Kaminsky */ public final class JobKOctets extends IntegerSyntax implements PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -8959710146498202869L; /** * Construct a new job K octets attribute with the given integer value. * - * @param value Integer value. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 0. + * @param value Integer value + * @throws IllegalArgumentException if {@code value} is negative */ public JobKOctets(int value) { super (value, 0, Integer.MAX_VALUE); @@ -151,20 +144,16 @@ * Returns whether this job K octets attribute is equivalent to the passed * in object. To be equivalent, all of the following conditions must be * true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobKOctets. - *
    3. - * This job K octets attribute's value and {@code object}'s value - * are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code JobKOctets}. + *
    3. This job K octets attribute's value and {@code object}'s value are + * equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job K - * octets attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job K octets + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return super.equals(object) && object instanceof JobKOctets; @@ -173,11 +162,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobKOctets, the category is class JobKOctets itself. + *

    + * For class {@code JobKOctets}, the category is class + * {@code JobKOctets} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobKOctets.class; @@ -186,13 +176,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobKOctets, the category name is {@code "job-k-octets"}. + *

    + * For class {@code JobKOctets}, the category name is + * {@code "job-k-octets"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-k-octets"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctetsProcessed.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctetsProcessed.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctetsProcessed.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,57 +30,57 @@ import javax.print.attribute.PrintJobAttribute; /** - * Class JobKOctetsProcessed is an integer valued printing attribute class that - * specifies the total number of print data octets processed so far in K octets, - * i.e., in units of 1024 octets. The value must be rounded up, so that a job - * between 1 and 1024 octets inclusive must be indicated as being 1K octets, - * 1025 to 2048 inclusive must be 2K, etc. For a multidoc print job (a job with - * multiple documents), the JobKOctetsProcessed value is computed by adding up - * the individual documents' number of octets processed so far, then rounding up - * to the next K octets value. - *

    - * The JobKOctetsProcessed attribute describes the progress of the job. This - * attribute is intended to be a counter. That is, the JobKOctetsProcessed value - * for a job that has not started processing must be 0. When the job's {@link - * JobState JobState} is PROCESSING or PROCESSING_STOPPED, the - * JobKOctetsProcessed value is intended to increase as the job is processed; it - * indicates the amount of the job that has been processed at the time the Print - * Job's attribute set is queried or at the time a print job event is reported. - * When the job enters the COMPLETED, CANCELED, or ABORTED states, the - * JobKOctetsProcessed value is the final value for the job. - *

    + * Class {@code JobKOctetsProcessed} is an integer valued printing attribute + * class that specifies the total number of print data octets processed so far + * in K octets, i.e., in units of 1024 octets. The value must be rounded up, so + * that a job between 1 and 1024 octets inclusive must be indicated as being 1K + * octets, 1025 to 2048 inclusive must be 2K, etc. For a multidoc print job (a + * job with multiple documents), the JobKOctetsProcessed value is computed by + * adding up the individual documents' number of octets processed so far, then + * rounding up to the next K octets value. + *

    + * The {@code JobKOctetsProcessed} attribute describes the progress of the job. + * This attribute is intended to be a counter. That is, the JobKOctetsProcessed + * value for a job that has not started processing must be 0. When the job's + * {@link JobState JobState} is {@code PROCESSING} or + * {@code PROCESSING_STOPPED}, the {@code JobKOctetsProcessed} value is intended + * to increase as the job is processed; it indicates the amount of the job that + * has been processed at the time the Print Job's attribute set is queried or at + * the time a print job event is reported. When the job enters the + * {@code COMPLETED}, {@code CANCELED}, or {@code ABORTED} states, the + * {@code JobKOctetsProcessed} value is the final value for the job. + *

    * For implementations where multiple copies are produced by the interpreter * with only a single pass over the data, the final value of the - * JobKOctetsProcessed attribute must be equal to the value of the {@link - * JobKOctets JobKOctets} attribute. For implementations where multiple copies - * are produced by the interpreter by processing the data for each copy, the - * final value must be a multiple of the value of the {@link JobKOctets - * JobKOctets} attribute. - *

    - * IPP Compatibility: The integer value gives the IPP integer value. The - * category name returned by {@code getName()} gives the IPP attribute - * name. + * JobKOctetsProcessed attribute must be equal to the value of the + * {@link JobKOctets JobKOctets} attribute. For implementations where multiple + * copies are produced by the interpreter by processing the data for each copy, + * the final value must be a multiple of the value of the + * {@link JobKOctets JobKOctets} attribute. + *

    + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * + * @author Alan Kaminsky * @see JobKOctets * @see JobKOctetsSupported * @see JobImpressionsCompleted * @see JobMediaSheetsCompleted - * - * @author Alan Kaminsky */ public final class JobKOctetsProcessed extends IntegerSyntax implements PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -6265238509657881806L; /** * Construct a new job K octets processed attribute with the given integer * value. * - * @param value Integer value. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 0. + * @param value Integer value + * @throws IllegalArgumentException if {@code value} is negative */ public JobKOctetsProcessed(int value) { super (value, 0, Integer.MAX_VALUE); @@ -89,20 +90,16 @@ * Returns whether this job K octets processed attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobKOctetsProcessed. - *
    3. - * This job K octets processed attribute's value and - * {@code object}'s value are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code JobKOctetsProcessed}. + *
    3. This job K octets processed attribute's value and {@code object}'s + * value are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job K - * octets processed attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job K octets + * processed attribute, {@code false} otherwise */ public boolean equals(Object object) { return(super.equals (object) && @@ -112,12 +109,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobKOctetsProcessed, the category is class - * JobKOctetsProcessed itself. + *

    + * For class {@code JobKOctetsProcessed}, the category is class + * {@code JobKOctetsProcessed} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobKOctetsProcessed.class; @@ -126,14 +123,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobKOctetsProcessed, the category name is + *

    + * For class {@code JobKOctetsProcessed}, the category name is * {@code "job-k-octets-processed"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-k-octets-processed"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctetsSupported.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctetsSupported.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobKOctetsSupported.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,25 +30,28 @@ import javax.print.attribute.SupportedValuesAttribute; /** - * Class JobKOctetsSupported is a printing attribute class, a set of integers, - * that gives the supported values for a {@link JobKOctets JobKOctets} + * Class {@code JobKOctetsSupported} is a printing attribute class, a set of + * integers, that gives the supported values for a {@link JobKOctets JobKOctets} * attribute. It is restricted to a single contiguous range of integers; * multiple non-overlapping ranges are not allowed. This gives the lower and * upper bounds of the total sizes of print jobs in units of K octets (1024 * octets) that the printer will accept. - *

    - * IPP Compatibility: The JobKOctetsSupported attribute's canonical array - * form gives the lower and upper bound for the range of values to be included - * in an IPP "job-k-octets-supported" attribute. See class {@link - * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an - * explanation of canonical array form. The category name returned by - * {@code getName()} gives the IPP attribute name. + *

    + * IPP Compatibility: The {@code JobKOctetsSupported} attribute's + * canonical array form gives the lower and upper bound for the range of values + * to be included in an IPP "job-k-octets-supported" attribute. See class + * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of canonical + * array form. The category name returned by {@code getName()} gives the IPP + * attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class JobKOctetsSupported extends SetOfIntegerSyntax implements SupportedValuesAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -2867871140549897443L; /** @@ -55,13 +59,11 @@ * range of integers. That is, only those values of JobKOctets in the one * range are supported. * - * @param lowerBound Lower bound of the range. - * @param upperBound Upper bound of the range. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if a null range is specified or if a - * non-null range is specified with {@code lowerBound} less than - * 0. + * @param lowerBound Lower bound of the range + * @param upperBound Upper bound of the range + * @throws IllegalArgumentException if a {@code null} range is specified or + * if a {@code non-null} range is specified with {@code lowerBound} + * less than zero */ public JobKOctetsSupported(int lowerBound, int upperBound) { super (lowerBound, upperBound); @@ -77,20 +79,16 @@ * Returns whether this job K octets supported attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobKOctetsSupported. - *
    3. - * This job K octets supported attribute's members and - * {@code object}'s members are the same. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code JobKOctetsSupported}. + *
    3. This job K octets supported attribute's members and + * {@code object}'s members are the same. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job K - * octets supported attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job K octets + * supported attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && @@ -100,12 +98,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobKOctetsSupported, the category is class - * JobKOctetsSupported itself. + *

    + * For class {@code JobKOctetsSupported}, the category is class + * {@code JobKOctetsSupported} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobKOctetsSupported.class; @@ -114,14 +112,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobKOctetsSupported, the category name is + *

    + * For class {@code JobKOctetsSupported}, the category name is * {@code "job-k-octets-supported"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-k-octets-supported"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheets.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheets.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheets.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,63 +22,62 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class JobMediaSheets is an integer valued printing attribute class that - * specifies the total number of media sheets to be produced for this job. - *

    - * The JobMediaSheets attribute describes the size of the job. This attribute is - * not intended to be a counter; it is intended to be useful routing and - * scheduling information if known. The printer may try to compute the - * JobMediaSheets attribute's value if it is not supplied in the Print Request. - * Even if the client does supply a value for the JobMediaSheets attribute in - * the Print Request, the printer may choose to change the value if the printer - * is able to compute a value which is more accurate than the client supplied - * value. The printer may be able to determine the correct value for the - * JobMediaSheets attribute either right at job submission time or at any later - * point in time. - *

    - * Unlike the {@link JobKOctets JobKOctets} and {@link JobImpressions - * JobImpressions} attributes, the JobMediaSheets value must include the - * multiplicative factors contributed by the number of copies specified by the - * {@link Copies Copies} attribute and a "number of copies" instruction embedded - * in the document data, if any. This difference allows the system administrator - * to control the lower and upper bounds of both (1) the size of the document(s) - * with {@link JobKOctetsSupported JobKOctetsSupported} and {@link - * JobImpressionsSupported JobImpressionsSupported} and (2) the size of the job - * with {@link JobMediaSheetsSupported JobMediaSheetsSupported}. - *

    - * IPP Compatibility: The integer value gives the IPP integer value. The - * category name returned by {@code getName()} gives the IPP attribute - * name. + * Class {@code JobMediaSheets} is an integer valued printing attribute class + * that specifies the total number of media sheets to be produced for this job. + *

    + * The {@code JobMediaSheets} attribute describes the size of the job. This + * attribute is not intended to be a counter; it is intended to be useful + * routing and scheduling information if known. The printer may try to compute + * the {@code JobMediaSheets} attribute's value if it is not supplied in the + * Print Request. Even if the client does supply a value for the + * {@code JobMediaSheets} attribute in the Print Request, the printer may choose + * to change the value if the printer is able to compute a value which is more + * accurate than the client supplied value. The printer may be able to determine + * the correct value for the {@code JobMediaSheets} attribute either right at + * job submission time or at any later point in time. + *

    + * Unlike the {@link JobKOctets JobKOctets} and + * {@link JobImpressions JobImpressions} attributes, the {@code JobMediaSheets} + * value must include the multiplicative factors contributed by the number of + * copies specified by the {@link Copies Copies} attribute and a "number of + * copies" instruction embedded in the document data, if any. This difference + * allows the system administrator to control the lower and upper bounds of both + * (1) the size of the document(s) with + * {@link JobKOctetsSupported JobKOctetsSupported} and + * {@link JobImpressionsSupported JobImpressionsSupported} and (2) the size of + * the job with {@link JobMediaSheetsSupported JobMediaSheetsSupported}. + *

    + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * + * @author Alan Kaminsky * @see JobMediaSheetsSupported * @see JobMediaSheetsCompleted * @see JobKOctets * @see JobImpressions - * - * @author Alan Kaminsky */ public class JobMediaSheets extends IntegerSyntax implements PrintRequestAttribute, PrintJobAttribute { - + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 408871131531979741L; /** - * Construct a new job media sheets attribute with the given integer - * value. + * Construct a new job media sheets attribute with the given integer value. * - * @param value Integer value. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 0. + * @param value Integer value + * @throws IllegalArgumentException if {@code value} is negative */ public JobMediaSheets(int value) { super (value, 0, Integer.MAX_VALUE); @@ -88,20 +87,16 @@ * Returns whether this job media sheets attribute is equivalent to the * passed in object. To be equivalent, all of the following conditions must * be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobMediaSheets. - *
    3. - * This job media sheets attribute's value and {@code object}'s - * value are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code JobMediaSheets}. + *
    3. This job media sheets attribute's value and {@code object}'s value + * are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job media - * sheets attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job media + * sheets attribute, {@code false} otherwise */ public boolean equals(Object object) { return super.equals(object) && object instanceof JobMediaSheets; @@ -110,12 +105,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobMediaSheets and any vendor-defined subclasses, the category - * is class JobMediaSheets itself. + *

    + * For class {@code JobMediaSheets} and any vendor-defined subclasses, the + * category is class {@code JobMediaSheets} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobMediaSheets.class; @@ -124,14 +119,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobMediaSheets and any vendor-defined subclasses, the + *

    + * For class {@code JobMediaSheets} and any vendor-defined subclasses, the * category name is {@code "job-media-sheets"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-media-sheets"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheetsCompleted.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheetsCompleted.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheetsCompleted.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,46 +30,46 @@ import javax.print.attribute.PrintJobAttribute; /** - * Class JobMediaSheetsCompleted is an integer valued printing attribute class - * that specifies the number of media sheets which have completed marking and - * stacking for the entire job so far, whether those sheets have been processed - * on one side or on both. - *

    - * The JobMediaSheetsCompleted attribute describes the progress of the job. This - * attribute is intended to be a counter. That is, the JobMediaSheetsCompleted - * value for a job that has not started processing must be 0. When the job's - * {@link JobState JobState} is PROCESSING or PROCESSING_STOPPED, the - * JobMediaSheetsCompleted value is intended to increase as the job is + * Class {@code JobMediaSheetsCompleted} is an integer valued printing attribute + * class that specifies the number of media sheets which have completed marking + * and stacking for the entire job so far, whether those sheets have been + * processed on one side or on both. + *

    + * The {@code JobMediaSheetsCompleted} attribute describes the progress of the + * job. This attribute is intended to be a counter. That is, the + * {@code JobMediaSheetsCompleted} value for a job that has not started + * processing must be 0. When the job's {@link JobState JobState} is + * {@code PROCESSING} or {@code PROCESSING_STOPPED}, the + * {@code JobMediaSheetsCompleted} value is intended to increase as the job is * processed; it indicates the amount of the job that has been processed at the * time the Print Job's attribute set is queried or at the time a print job - * event is reported. When the job enters the COMPLETED, CANCELED, or ABORTED - * states, the JobMediaSheetsCompleted value is the final value for the job. - *

    - * IPP Compatibility: The integer value gives the IPP integer value. The - * category name returned by {@code getName()} gives the IPP attribute - * name. + * event is reported. When the job enters the {@code COMPLETED}, + * {@code CANCELED}, or {@code ABORTED} states, the + * {@code JobMediaSheetsCompleted} value is the final value for the job. + *

    + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * + * @author Alan Kaminsky * @see JobMediaSheets * @see JobMediaSheetsSupported * @see JobKOctetsProcessed * @see JobImpressionsCompleted - * - * @author Alan Kaminsky */ public final class JobMediaSheetsCompleted extends IntegerSyntax implements PrintJobAttribute { - + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 1739595973810840475L; /** * Construct a new job media sheets completed attribute with the given * integer value. * - * @param value Integer value. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 0. + * @param value Integer value + * @throws IllegalArgumentException if {@code value} is negative */ public JobMediaSheetsCompleted(int value) { super (value, 0, Integer.MAX_VALUE); @@ -78,20 +79,17 @@ * Returns whether this job media sheets completed attribute is equivalent * to the passed in object. To be equivalent, all of the following * conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobMediaSheetsCompleted. - *
    3. - * This job media sheets completed attribute's value and - * {@code object}'s value are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class + * {@code JobMediaSheetsCompleted}. + *
    3. This job media sheets completed attribute's value and + * {@code object}'s value are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job media - * sheets completed attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job media + * sheets completed attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && @@ -101,12 +99,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobMediaSheetsCompleted, the category is class - * JobMediaSheetsCompleted itself. + *

    + * For class {@code JobMediaSheetsCompleted}, the category is class + * {@code JobMediaSheetsCompleted} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobMediaSheetsCompleted.class; @@ -115,11 +113,11 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobMediaSheetsCompleted, the category name is + *

    + * For class {@code JobMediaSheetsCompleted}, the category name is * {@code "job-media-sheets-completed"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-media-sheets-completed"; diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheetsSupported.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheetsSupported.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMediaSheetsSupported.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,39 +30,40 @@ import javax.print.attribute.SupportedValuesAttribute; /** - * Class JobMediaSheetsSupported is a printing attribute class, a set of - * integers, that gives the supported values for a {@link JobMediaSheets - * JobMediaSheets} attribute. It is restricted to a single contiguous range of - * integers; multiple non-overlapping ranges are not allowed. This gives the - * lower and upper bounds of the total sizes of print jobs in number of media - * sheets that the printer will accept. - *

    - * IPP Compatibility: The JobMediaSheetsSupported attribute's canonical - * array form gives the lower and upper bound for the range of values to be - * included in an IPP "job-media-sheets-supported" attribute. See class {@link - * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an - * explanation of canonical array form. The category name returned by - * {@code getName()} gives the IPP attribute name. + * Class {@code JobMediaSheetsSupported} is a printing attribute class, a set of + * integers, that gives the supported values for a + * {@link JobMediaSheets JobMediaSheets} attribute. It is restricted to a single + * contiguous range of integers; multiple non-overlapping ranges are not + * allowed. This gives the lower and upper bounds of the total sizes of print + * jobs in number of media sheets that the printer will accept. + *

    + * IPP Compatibility: The {@code JobMediaSheetsSupported} attribute's + * canonical array form gives the lower and upper bound for the range of values + * to be included in an IPP "job-media-sheets-supported" attribute. See class + * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of canonical + * array form. The category name returned by {@code getName()} gives the IPP + * attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class JobMediaSheetsSupported extends SetOfIntegerSyntax implements SupportedValuesAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 2953685470388672940L; /** * Construct a new job media sheets supported attribute containing a single - * range of integers. That is, only those values of JobMediaSheets in the - * one range are supported. + * range of integers. That is, only those values of {@code JobMediaSheets} + * in the one range are supported. * - * @param lowerBound Lower bound of the range. - * @param upperBound Upper bound of the range. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if a null range is specified or if a - * non-null range is specified with {@code lowerBound} less than - * 0. + * @param lowerBound lower bound of the range + * @param upperBound upper bound of the range + * @throws IllegalArgumentException if a {@code null} range is specified or + * if a {@code non-null} range is specified with {@code lowerBound} + * less than zero */ public JobMediaSheetsSupported(int lowerBound, int upperBound) { super (lowerBound, upperBound); @@ -77,20 +79,17 @@ * Returns whether this job media sheets supported attribute is equivalent * to the passed in object. To be equivalent, all of the following * conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobMediaSheetsSupported. - *
    3. - * This job media sheets supported attribute's members and - * {@code object}'s members are the same. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class + * {@code JobMediaSheetsSupported}. + *
    3. This job media sheets supported attribute's members and + * {@code object}'s members are the same. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job media - * sheets supported attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job media + * sheets supported attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && @@ -100,12 +99,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobMediaSheetsSupported, the - * category is class JobMediaSheetsSupported itself. + *

    + * For class {@code JobMediaSheetsSupported}, the category is class + * {@code JobMediaSheetsSupported} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobMediaSheetsSupported.class; @@ -114,14 +113,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobMediaSheetsSupported, the - * category name is {@code "job-media-sheets-supported"}. + *

    + * For class {@code JobMediaSheetsSupported}, the category name is + * {@code "job-media-sheets-supported"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-media-sheets-supported"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMessageFromOperator.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMessageFromOperator.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobMessageFromOperator.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,50 +22,53 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.TextSyntax; -import javax.print.attribute.PrintJobAttribute; /** - * Class JobMessageFromOperator is a printing attribute class, a text attribute, - * that provides a message from an operator, system administrator, or + * Class {@code JobMessageFromOperator} is a printing attribute class, a text + * attribute, that provides a message from an operator, system administrator, or * "intelligent" process to indicate to the end user the reasons for * modification or other management action taken on a job. - *

    + *

    * A Print Job's attribute set includes zero instances or one instance of a - * JobMessageFromOperator attribute, not more than one instance. A new - * JobMessageFromOperator attribute replaces an existing JobMessageFromOperator - * attribute, if any. In other words, JobMessageFromOperator is not intended to - * be a history log. If it wishes, the client can detect changes to a Print - * Job's JobMessageFromOperator attribute and maintain the client's own history - * log of the JobMessageFromOperator attribute values. - *

    - * IPP Compatibility: The string value gives the IPP name value. The + * {@code JobMessageFromOperator} attribute, not more than one instance. A new + * {@code JobMessageFromOperator} attribute replaces an existing + * {@code JobMessageFromOperator} attribute, if any. In other words, + * {@code JobMessageFromOperator} is not intended to be a history log. If it + * wishes, the client can detect changes to a Print Job's + * {@code JobMessageFromOperator} attribute and maintain the client's own + * history log of the {@code JobMessageFromOperator} attribute values. + *

    + * IPP Compatibility: The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class JobMessageFromOperator extends TextSyntax implements PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -4620751846003142047L; /** * Constructs a new job message from operator attribute with the given * message and locale. * - * @param message Message. - * @param locale Natural language of the text string. null - * is interpreted to mean the default locale as returned - * by {@code Locale.getDefault()} - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code message} is null. + * @param message the message + * @param locale Natural language of the text string. {@code null} is + * interpreted to mean the default locale as returned by + * {@code Locale.getDefault()} + * @throws NullPointerException if {@code message} is {@code null} */ public JobMessageFromOperator(String message, Locale locale) { super (message, locale); @@ -75,23 +78,19 @@ * Returns whether this job message from operator attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobMessageFromOperator. - *
    3. - * This job message from operator attribute's underlying string and - * {@code object}'s underlying string are equal. - *
    4. - * This job message from operator attribute's locale and - * {@code object}'s locale are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class + * {@code JobMessageFromOperator}. + *
    3. This job message from operator attribute's underlying string and + * {@code object}'s underlying string are equal. + *
    4. This job message from operator attribute's locale and + * {@code object}'s locale are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job - * message from operator attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job message + * from operator attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && @@ -101,12 +100,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobMessageFromOperator, the - * category is class JobMessageFromOperator itself. + *

    + * For class {@code JobMessageFromOperator}, the category is class + * {@code JobMessageFromOperator} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobMessageFromOperator.class; @@ -115,14 +114,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobMessageFromOperator, the - * category name is {@code "job-message-from-operator"}. + *

    + * For class {@code JobMessageFromOperator}, the category name is + * {@code "job-message-from-operator"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-message-from-operator"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobName.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobName.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobName.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,50 +22,53 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; -import javax.print.attribute.TextSyntax; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.TextSyntax; /** - * Class JobName is a printing attribute class, a text attribute, that specifies - * the name of a print job. A job's name is an arbitrary string defined by the - * client. It does not need to be unique between different jobs. A Print Job's - * JobName attribute is set to the value supplied by the client in the Print - * Request's attribute set. If, however, the client does not supply a JobName - * attribute in the Print Request, the printer, when it creates the Print Job, - * must generate a JobName. The printer should generate the value of the Print - * Job's JobName attribute from the first of the following sources that produces - * a value: (1) the {@link DocumentName DocumentName} attribute of the first (or - * only) doc in the job, (2) the URL of the first (or only) doc in the job, if - * the doc's print data representation object is a URL, or (3) any other piece - * of Print Job specific and/or document content information. - *

    - * IPP Compatibility: The string value gives the IPP name value. The + * Class {@code JobName} is a printing attribute class, a text attribute, that + * specifies the name of a print job. A job's name is an arbitrary string + * defined by the client. It does not need to be unique between different jobs. + * A Print Job's {@code JobName} attribute is set to the value supplied by the + * client in the Print Request's attribute set. If, however, the client does not + * supply a {@code JobName} attribute in the Print Request, the printer, when it + * creates the Print Job, must generate a {@code JobName}. The printer should + * generate the value of the Print Job's {@code JobName} attribute from the + * first of the following sources that produces a value: (1) the + * {@link DocumentName DocumentName} attribute of the first (or only) doc in the + * job, (2) the {@code URL} of the first (or only) doc in the job, if the doc's + * print data representation object is a {@code URL}, or (3) any other piece of + * Print Job specific and/or document content information. + *

    + * IPP Compatibility: The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class JobName extends TextSyntax implements PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 4660359192078689545L; /** * Constructs a new job name attribute with the given job name and locale. * - * @param jobName Job name. - * @param locale Natural language of the text string. null - * is interpreted to mean the default locale as returned - * by {@code Locale.getDefault()} - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code jobName} is null. + * @param jobName job name + * @param locale natural language of the text string. {@code null} is + * interpreted to mean the default locale as returned by + * {@code Locale.getDefault()} + * @throws NullPointerException if {@code jobName} is {@code null} */ public JobName(String jobName, Locale locale) { super (jobName, locale); @@ -74,23 +77,18 @@ /** * Returns whether this job name attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobName. - *
    3. - * This job name attribute's underlying string and {@code object}'s - * underlying string are equal. - *
    4. - * This job name attribute's locale and {@code object}'s locale are - * equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code JobName}. + *
    3. This job name attribute's underlying string and {@code object}'s + * underlying string are equal. + *
    4. This job name attribute's locale and {@code object}'s locale are + * equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job name - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job name + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && object instanceof JobName); @@ -99,11 +97,11 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobName, the category is class JobName itself. + *

    + * For class {@code JobName}, the category is class {@code JobName} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobName.class; @@ -112,13 +110,12 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobName, the category name is {@code "job-name"}. + *

    + * For class {@code JobName}, the category name is {@code "job-name"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-name"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobOriginatingUserName.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobOriginatingUserName.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobOriginatingUserName.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,50 +22,50 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.TextSyntax; -import javax.print.attribute.PrintJobAttribute; /** - * Class JobOriginatingUserName is a printing attribute class, a text - * attribute, that contains the name of the end user that submitted the - * print job. If possible, the printer sets this attribute to the most - * authenticated printable user name that it can obtain from the - * authentication service that authenticated the submitted Print Request. - * If such is not available, the printer uses the value of the - * {@link RequestingUserName RequestingUserName} - * attribute supplied by the client in the Print Request's attribute set. - * If no authentication service is available, and the client did not supply - * a {@link RequestingUserName RequestingUserName} attribute, - * the printer sets the JobOriginatingUserName attribute to an empty - * (zero-length) string. - *

    - * IPP Compatibility: The string value gives the IPP name value. The + * Class {@code JobOriginatingUserName} is a printing attribute class, a text + * attribute, that contains the name of the end user that submitted the print + * job. If possible, the printer sets this attribute to the most authenticated + * printable user name that it can obtain from the authentication service that + * authenticated the submitted Print Request. If such is not available, the + * printer uses the value of the {@link RequestingUserName RequestingUserName} + * attribute supplied by the client in the Print Request's attribute set. If no + * authentication service is available, and the client did not supply a + * {@link RequestingUserName RequestingUserName} attribute, the printer sets the + * JobOriginatingUserName attribute to an empty (zero-length) string. + *

    + * IPP Compatibility: The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class JobOriginatingUserName extends TextSyntax implements PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -8052537926362933477L; /** - * Constructs a new job originating user name attribute with the given - * user name and locale. + * Constructs a new job originating user name attribute with the given user + * name and locale. * - * @param userName User name. - * @param locale Natural language of the text string. null - * is interpreted to mean the default locale as returned - * by {@code Locale.getDefault()} - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code userName} is null. + * @param userName user name + * @param locale natural language of the text string. {@code null} is + * interpreted to mean the default locale as returned by + * {@code Locale.getDefault()} + * @throws NullPointerException if {@code userName} is {@code null} */ public JobOriginatingUserName(String userName, Locale locale) { super (userName, locale); @@ -75,23 +75,19 @@ * Returns whether this job originating user name attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobOriginatingUserName. - *
    3. - * This job originating user name attribute's underlying string and - * {@code object}'s underlying string are equal. - *
    4. - * This job originating user name attribute's locale and - * {@code object}'s locale are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class + * {@code JobOriginatingUserName}. + *
    3. This job originating user name attribute's underlying string and + * {@code object}'s underlying string are equal. + *
    4. This job originating user name attribute's locale and + * {@code object}'s locale are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job - * originating user name attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job + * originating user name attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && @@ -101,12 +97,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobOriginatingUserName, the - * category is class JobOriginatingUserName itself. + *

    + * For class {@code JobOriginatingUserName}, the category is class + * {@code JobOriginatingUserName} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobOriginatingUserName.class; @@ -115,14 +111,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobOriginatingUserName, the - * category name is {@code "job-originating-user-name"}. + *

    + * For class {@code JobOriginatingUserName}, the category name is + * {@code "job-originating-user-name"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-originating-user-name"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobPriority.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobPriority.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobPriority.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,54 +22,55 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class JobPriority is an integer valued printing attribute class that + * Class {@code JobPriority} is an integer valued printing attribute class that * specifies a print job's priority. - *

    - * If a JobPriority attribute is specified for a Print Job, it specifies a - * priority for scheduling the job. A higher value specifies a higher priority. - * The value 1 indicates the lowest possible priority. The value 100 indicates - * the highest possible priority. Among those jobs that are ready to print, a - * printer must print all jobs with a priority value of n before printing - * those with a priority value of n-1 for all n. - *

    - * If the client does not specify a JobPriority attribute for a Print Job and - * the printer does support the JobPriority attribute, the printer must use an - * implementation-defined default JobPriority value. - *

    + *

    + * If a {@code JobPriority} attribute is specified for a Print Job, it specifies + * a priority for scheduling the job. A higher value specifies a higher + * priority. The value 1 indicates the lowest possible priority. The value 100 + * indicates the highest possible priority. Among those jobs that are ready to + * print, a printer must print all jobs with a priority value of n before + * printing those with a priority value of n-1 for all n. + *

    + * If the client does not specify a {@code JobPriority} attribute for a Print + * Job and the printer does support the JobPriority attribute, the printer must + * use an implementation-defined default JobPriority value. + *

    * The client can always specify any job priority value from 1 to 100 for a job. - * However, a Print Service instance may support fewer than 100 different - * job priority levels. If this is the case, the Print Service instance + * However, a Print Service instance may support fewer than 100 different job + * priority levels. If this is the case, the Print Service instance * automatically maps the client-specified job priority value to one of the * supported job priority levels, dividing the 100 job priority values equally * among the available job priority levels. - *

    - * IPP Compatibility: The integer value gives the IPP integer value. The - * category name returned by {@code getName()} gives the IPP attribute - * name. + *

    + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class JobPriority extends IntegerSyntax implements PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -4599900369040602769L; /** * Construct a new job priority attribute with the given integer value. * - * @param value Integer value. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 1 - * or greater than 100. + * @param value Integer value + * @throws IllegalArgumentException if {@code value} is less than 1 or + * greater than 100 */ public JobPriority(int value) { super (value, 1, 100); @@ -79,20 +80,16 @@ * Returns whether this job priority attribute is equivalent to the passed * in object. To be equivalent, all of the following conditions must be * true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobPriority. - *
    3. - * This job priority attribute's value and {@code object}'s value - * are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code JobPriority}. + *
    3. This job priority attribute's value and {@code object}'s value are + * equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job - * priority attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job priority + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && object instanceof JobPriority); @@ -101,11 +98,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobPriority, the category is class JobPriority itself. + *

    + * For class {@code JobPriority}, the category is class + * {@code JobPriority} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobPriority.class; @@ -114,13 +112,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobPriority, the category name is {@code "job-priority"}. + *

    + * For class {@code JobPriority}, the category name is + * {@code "job-priority"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-priority"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobPrioritySupported.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobPrioritySupported.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobPrioritySupported.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,39 +30,38 @@ import javax.print.attribute.SupportedValuesAttribute; /** - * Class JobPrioritySupported is an integer valued printing attribute class - * that specifies whether a Print Service instance supports the {@link - * JobPriority JobPriority} attribute and the number of different job priority - * levels supported. - *

    - * The client can always specify any {@link JobPriority JobPriority} value - * from 1 to 100 for a job. However, the Print Service instance may support - * fewer than 100 different job priority levels. If this is the case, the - * Print Service instance automatically maps the client-specified job priority - * value to one of the supported job priority levels, dividing the 100 job - * priority values equally among the available job priority levels. - *

    - * IPP Compatibility: The integer value gives the IPP integer value. - * The category name returned by {@code getName()} gives the IPP - * attribute name. + * Class {@code JobPrioritySupported} is an integer valued printing attribute + * class that specifies whether a Print Service instance supports the + * {@link JobPriority JobPriority} attribute and the number of different job + * priority levels supported. + *

    + * The client can always specify any {@link JobPriority JobPriority} value from + * 1 to 100 for a job. However, the Print Service instance may support fewer + * than 100 different job priority levels. If this is the case, the Print + * Service instance automatically maps the client-specified job priority value + * to one of the supported job priority levels, dividing the 100 job priority + * values equally among the available job priority levels. + *

    + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class JobPrioritySupported extends IntegerSyntax implements SupportedValuesAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 2564840378013555894L; - /** * Construct a new job priority supported attribute with the given integer * value. * - * @param value Number of different job priority levels supported. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 1 - * or greater than 100. + * @param value number of different job priority levels supported + * @throws IllegalArgumentException if {@code value} is less than 1 or + * greater than 100 */ public JobPrioritySupported(int value) { super (value, 1, 100); @@ -71,20 +71,17 @@ * Returns whether this job priority supported attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class JobPrioritySupported. - *
    3. - * This job priority supported attribute's value and - * {@code object}'s value are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class + * {@code JobPrioritySupported}. + *
    3. This job priority supported attribute's value and {@code object}'s + * value are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this job - * priority supported attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this job priority + * supported attribute, {@code false} otherwise */ public boolean equals (Object object) { @@ -92,16 +89,15 @@ object instanceof JobPrioritySupported); } - /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobPrioritySupported, the - * category is class JobPrioritySupported itself. + *

    + * For class {@code JobPrioritySupported}, the category is class + * {@code JobPrioritySupported} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobPrioritySupported.class; @@ -110,14 +106,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobPrioritySupported, the - * category name is {@code "job-priority-supported"}. + *

    + * For class {@code JobPrioritySupported}, the category name is + * {@code "job-priority-supported"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-priority-supported"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobSheets.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobSheets.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobSheets.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,39 +22,40 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; -import java.util.Locale; - import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class JobSheets is a printing attribute class, an enumeration, that + * Class {@code JobSheets} is a printing attribute class, an enumeration, that * determines which job start and end sheets, if any, must be printed with a - * job. Class JobSheets declares keywords for standard job sheets values. - * Implementation- or site-defined names for a job sheets attribute may also be - * created by defining a subclass of class JobSheets. - *

    - * The effect of a JobSheets attribute on multidoc print jobs (jobs with - * multiple documents) may be affected by the {@link MultipleDocumentHandling - * MultipleDocumentHandling} job attribute, depending on the meaning of the - * particular JobSheets value. - *

    - * IPP Compatibility: The category name returned by - * {@code getName()} is the IPP attribute name. The - * enumeration's integer value is the IPP enum value. The - * {@code toString()} method returns the IPP string representation of - * the attribute value. For a subclass, the attribute value must be - * localized to give the IPP name and natural language values. + * job. Class {@code JobSheets} declares keywords for standard job sheets + * values. Implementation- or site-defined names for a job sheets attribute may + * also be created by defining a subclass of class {@code JobSheets}. + *

    + * The effect of a {@code JobSheets} attribute on multidoc print jobs (jobs with + * multiple documents) may be affected by the + * {@link MultipleDocumentHandling MultipleDocumentHandling} job attribute, + * depending on the meaning of the particular {@code JobSheets} value. + *

    + * IPP Compatibility: The category name returned by {@code getName()} is + * the IPP attribute name. The enumeration's integer value is the IPP enum + * value. The {@code toString()} method returns the IPP string representation of + * the attribute value. For a subclass, the attribute value must be localized to + * give the IPP name and natural language values. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public class JobSheets extends EnumSyntax implements PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -4735258056132519759L; /** @@ -63,9 +64,8 @@ public static final JobSheets NONE = new JobSheets(0); /** - * One or more site specific standard job sheets are printed. e.g. a - * single start sheet is printed, or both start and end sheets are - * printed. + * One or more site specific standard job sheets are printed. e.g. a single + * start sheet is printed, or both start and end sheets are printed. */ public static final JobSheets STANDARD = new JobSheets(1); @@ -73,31 +73,37 @@ * Construct a new job sheets enumeration value with the given integer * value. * - * @param value Integer value. + * @param value Integer value */ protected JobSheets(int value) { super (value); } + /** + * The string table for class {@code JobSheets}. + */ private static final String[] myStringTable = { "none", "standard" }; + /** + * The enumeration value table for class {@code JobSheets}. + */ private static final JobSheets[] myEnumValueTable = { NONE, STANDARD }; /** - * Returns the string table for class JobSheets. + * Returns the string table for class {@code JobSheets}. */ protected String[] getStringTable() { return myStringTable.clone(); } /** - * Returns the enumeration value table for class JobSheets. + * Returns the enumeration value table for class {@code JobSheets}. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); @@ -106,12 +112,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobSheets and any vendor-defined subclasses, the category is - * class JobSheets itself. + *

    + * For class {@code JobSheets} and any vendor-defined subclasses, the + * category is class {@code JobSheets} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobSheets.class; @@ -120,14 +126,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobSheets and any vendor-defined subclasses, the category - * name is {@code "job-sheets"}. + *

    + * For class {@code JobSheets} and any vendor-defined subclasses, the + * category name is {@code "job-sheets"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-sheets"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobState.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobState.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobState.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -30,24 +30,27 @@ import javax.print.attribute.PrintJobAttribute; /** - * JobState is a printing attribute class, an enumeration, that identifies - * the current state of a print job. Class JobState defines standard job state - * values. A Print Service implementation only needs to report those job - * states which are appropriate for the particular implementation; it does not - * have to report every defined job state. The {@link JobStateReasons - * JobStateReasons} attribute augments the JobState attribute to give more - * detailed information about the job in the given job state. - *

    - * IPP Compatibility: The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. + * {@code JobState} is a printing attribute class, an enumeration, that + * identifies the current state of a print job. Class {@code JobState} defines + * standard job state values. A Print Service implementation only needs to + * report those job states which are appropriate for the particular + * implementation; it does not have to report every defined job state. The + * {@link JobStateReasons JobStateReasons} attribute augments the + * {@code JobState} attribute to give more detailed information about the job in + * the given job state. + *

    + * IPP Compatibility: The category name returned by {@code getName()} is + * the IPP attribute name. The enumeration's integer value is the IPP enum + * value. The {@code toString()} method returns the IPP string representation of + * the attribute value. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ - public class JobState extends EnumSyntax implements PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 400465010094018920L; /** @@ -62,61 +65,57 @@ /** * The job is not a candidate for processing for any number of reasons but - * will return to the PENDING state as soon as the reasons are no longer - * present. The job's {@link JobStateReasons JobStateReasons} attribute must - * indicate why the job is no longer a candidate for processing. + * will return to the {@code PENDING} state as soon as the reasons are no + * longer present. The job's {@link JobStateReasons JobStateReasons} + * attribute must indicate why the job is no longer a candidate for + * processing. */ public static final JobState PENDING_HELD = new JobState(4); /** * The job is processing. One or more of the following activities is * occurring: - *

      - *
    1. - * The job is using, or is attempting to use, one or more purely software - * processes that are analyzing, creating, or interpreting a PDL, etc. - * - *
    2. - * The job is using, or is attempting to use, one or more hardware - * devices that are interpreting a PDL, making marks on a medium, and/or - * performing finishing, such as stapling, etc. - * - *
    3. - * The printer has made the job ready for printing, but the output - * device is not yet printing it, either because the job hasn't reached the - * output device or because the job is queued in the output device or some - * other spooler, awaiting the output device to print it. - *
    - *

    - * When the job is in the PROCESSING state, the entire job state includes - * the detailed status represented in the printer's {@link PrinterState - * PrinterState} and {@link PrinterStateReasons PrinterStateReasons} - * attributes. - *

    + *

      + *
    1. The job is using, or is attempting to use, one or more purely + * software processes that are analyzing, creating, or interpreting a PDL, + * etc. + *
    2. The job is using, or is attempting to use, one or more hardware + * devices that are interpreting a PDL, making marks on a medium, and/or + * performing finishing, such as stapling, etc. + *
    3. The printer has made the job ready for printing, but the output + * device is not yet printing it, either because the job hasn't reached + * the output device or because the job is queued in the output device or + * some other spooler, awaiting the output device to print it. + *
    + * When the job is in the {@code PROCESSING} state, the entire job state + * includes the detailed status represented in the printer's + * {@link PrinterState PrinterState} and + * {@link PrinterStateReasons PrinterStateReasons} attributes. + *

    * Implementations may, though they need not, include additional values in * the job's {@link JobStateReasons JobStateReasons} attribute to indicate - * the progress of the job, such as adding the JOB_PRINTING value to + * the progress of the job, such as adding the {@code JOB_PRINTING} value to * indicate when the output device is actually making marks on paper and/or - * the PROCESSING_TO_STOP_POINT value to indicate that the printer is in the - * process of canceling or aborting the job. + * the {@code PROCESSING_TO_STOP_POINT} value to indicate that the printer + * is in the process of canceling or aborting the job. */ public static final JobState PROCESSING = new JobState (5); /** * The job has stopped while processing for any number of reasons and will - * return to the PROCESSING state as soon as the reasons are no longer - * present. - *

    + * return to the {@code PROCESSING} state as soon as the reasons are no + * longer present. + *

    * The job's {@link JobStateReasons JobStateReasons} attribute may indicate * why the job has stopped processing. For example, if the output device is - * stopped, the PRINTER_STOPPED value may be included in the job's {@link - * JobStateReasons JobStateReasons} attribute. - *

    - * Note: When an output device is stopped, the device usually + * stopped, the {@code PRINTER_STOPPED} value may be included in the job's + * {@link JobStateReasons JobStateReasons} attribute. + *

    + * Note: When an output device is stopped, the device usually * indicates its condition in human readable form locally at the device. A * client can obtain more complete device status remotely by querying the - * printer's {@link PrinterState PrinterState} and {@link - * PrinterStateReasons PrinterStateReasons} attributes. + * printer's {@link PrinterState PrinterState} and + * {@link PrinterStateReasons PrinterStateReasons} attributes. */ public static final JobState PROCESSING_STOPPED = new JobState (6); @@ -125,24 +124,27 @@ * canceling the job, and all job status attributes have reached their final * values for the job. While the printer is canceling the job, the job * remains in its current state, but the job's {@link JobStateReasons - * JobStateReasons} attribute should contain the PROCESSING_TO_STOP_POINT - * value and one of the CANCELED_BY_USER, CANCELED_BY_OPERATOR, or - * CANCELED_AT_DEVICE values. When the job moves to the CANCELED state, the - * PROCESSING_TO_STOP_POINT value, if present, must be removed, but the - * CANCELED_BY_xxx value, if present, must remain. + * JobStateReasons} attribute should contain the + * {@code PROCESSING_TO_STOP_POINT} value and one of the + * {@code CANCELED_BY_USER}, {@code CANCELED_BY_OPERATOR}, or + * {@code CANCELED_AT_DEVICE} values. When the job moves to the + * {@code CANCELED} state, the {@code PROCESSING_TO_STOP_POINT} value, if + * present, must be removed, but the CANCELED_BY_xxx value, if + * present, must remain. */ public static final JobState CANCELED = new JobState (7); /** * The job has been aborted by the system (usually while the job was in the - * PROCESSING or PROCESSING_STOPPED state), the printer has completed - * aborting the job, and all job status attributes have reached their final - * values for the job. While the printer is aborting the job, the job - * remains in its current state, but the job's {@link JobStateReasons - * JobStateReasons} attribute should contain the PROCESSING_TO_STOP_POINT - * and ABORTED_BY_SYSTEM values. When the job moves to the ABORTED state, - * the PROCESSING_TO_STOP_POINT value, if present, must be removed, but the - * ABORTED_BY_SYSTEM value, if present, must remain. + * {@code PROCESSING} or {@code PROCESSING_STOPPED} state), the printer has + * completed aborting the job, and all job status attributes have reached + * their final values for the job. While the printer is aborting the job, + * the job remains in its current state, but the job's + * {@link JobStateReasons JobStateReasons} attribute should contain the + * {@code PROCESSING_TO_STOP_POINT} and {@code ABORTED_BY_SYSTEM} values. + * When the job moves to the {@code ABORTED} state, the + * {@code PROCESSING_TO_STOP_POINT} value, if present, must be removed, but + * the {@code ABORTED_BY_SYSTEM} value, if present, must remain. */ public static final JobState ABORTED = new JobState (8); @@ -150,10 +152,10 @@ * The job has completed successfully or with warnings or errors after * processing, all of the job media sheets have been successfully stacked in * the appropriate output bin(s), and all job status attributes have reached - * their final values for the job. The job's {@link JobStateReasons - * JobStateReasons} attribute should contain one of these values: - * COMPLETED_SUCCESSFULLY, COMPLETED_WITH_WARNINGS, or - * COMPLETED_WITH_ERRORS. + * their final values for the job. The job's + * {@link JobStateReasons JobStateReasons} attribute should contain one of + * these values: {@code COMPLETED_SUCCESSFULLY}, + * {@code COMPLETED_WITH_WARNINGS}, or {@code COMPLETED_WITH_ERRORS}. */ public static final JobState COMPLETED = new JobState (9); @@ -162,12 +164,15 @@ /** * Construct a new job state enumeration value with the given integer value. * - * @param value Integer value. + * @param value Integer value */ protected JobState(int value) { super (value); } + /** + * The string table for class {@code JobState}. + */ private static final String[] myStringTable = {"unknown", null, @@ -180,6 +185,9 @@ "aborted", "completed"}; + /** + * The enumeration value table for class {@code JobState}. + */ private static final JobState[] myEnumValueTable = {UNKNOWN, null, @@ -193,14 +201,14 @@ COMPLETED}; /** - * Returns the string table for class JobState. + * Returns the string table for class {@code JobState}. */ protected String[] getStringTable() { return myStringTable; } /** - * Returns the enumeration value table for class JobState. + * Returns the enumeration value table for class {@code JobState}. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; @@ -209,12 +217,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobState and any vendor-defined subclasses, the category is - * class JobState itself. + *

    + * For class {@code JobState} and any vendor-defined subclasses, the + * category is class {@code JobState} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobState.class; @@ -223,14 +231,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobState and any vendor-defined subclasses, the category - * name is {@code "job-state"}. + *

    + * For class {@code JobState} and any vendor-defined subclasses, the + * category name is {@code "job-state"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-state"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobStateReason.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobStateReason.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobStateReason.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,40 +22,45 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; -import javax.print.attribute.Attribute; /** - * Class JobStateReason is a printing attribute class, an enumeration, that - * provides additional information about the job's current state, i.e., + * Class {@code JobStateReason} is a printing attribute class, an enumeration, + * that provides additional information about the job's current state, i.e., * information that augments the value of the job's {@link JobState JobState} - * attribute. Class JobStateReason defines standard job state reason values. A - * Print Service implementation only needs to report those job state + * attribute. Class {@code JobStateReason} defines standard job state reason + * values. A Print Service implementation only needs to report those job state * reasons which are appropriate for the particular implementation; it does not * have to report every defined job state reason. - *

    - * Instances of JobStateReason do not appear in a Print Job's attribute set - * directly. Rather, a {@link JobStateReasons JobStateReasons} attribute appears - * in the Print Job's attribute set. The {@link JobStateReasons JobStateReasons} - * attribute contains zero, one, or more than one JobStateReason objects which - * pertain to the Print Job's status. The printer adds a JobStateReason object - * to the Print Job's {@link JobStateReasons JobStateReasons} attribute when the - * corresponding condition becomes true of the Print Job, and the printer - * removes the JobStateReason object again when the corresponding condition - * becomes false, regardless of whether the Print Job's overall {@link JobState - * JobState} also changed. - *

    - * IPP Compatibility: The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. + *

    + * Instances of {@code JobStateReason} do not appear in a Print Job's attribute + * set directly. Rather, a {@link JobStateReasons JobStateReasons} attribute + * appears in the Print Job's attribute set. The + * {@link JobStateReasons JobStateReasons} attribute contains zero, one, or more + * than one {@code JobStateReason} objects which pertain to the Print Job's + * status. The printer adds a JobStateReason object to the Print Job's + * {@link JobStateReasons JobStateReasons} attribute when the corresponding + * condition becomes true of the Print Job, and the printer removes the + * {@code JobStateReason} object again when the corresponding condition becomes + * false, regardless of whether the Print Job's overall + * {@link JobState JobState} also changed. + *

    + * IPP Compatibility: The category name returned by {@code getName()} is + * the IPP attribute name. The enumeration's integer value is the IPP enum + * value. The {@code toString()} method returns the IPP string representation of + * the attribute value. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public class JobStateReason extends EnumSyntax implements Attribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -8765894420449009168L; /** @@ -67,27 +72,29 @@ /** * The printer has created the Print Job, but the printer is expecting - * additional print data before it can move the job into the PROCESSING - * state. If a printer starts processing before it has received all data, - * the printer removes the JOB_DATA_INSUFFICIENT reason, but the - * JOB_INCOMING reason remains. If a printer starts processing after it - * has received all data, the printer removes the JOB_DATA_INSUFFICIENT - * and JOB_INCOMING reasons at the same time. + * additional print data before it can move the job into the + * {@code PROCESSING} state. If a printer starts processing before it has + * received all data, the printer removes the {@code JOB_DATA_INSUFFICIENT} + * reason, but the {@code JOB_INCOMING} reason remains. If a printer starts + * processing after it has received all data, the printer removes the + * {@code JOB_DATA_INSUFFICIENT} and {@code JOB_INCOMING} reasons at the + * same time. */ public static final JobStateReason JOB_DATA_INSUFFICIENT = new JobStateReason(1); /** - * The Printer could not access one or more documents passed by reference - * (i.e., the print data representation object is a URL). This reason is - * intended to cover any file access problem,including file does not exist - * and access denied because of an access control problem. Whether the - * printer aborts the job and moves the job to the ABORTED job state or - * prints all documents that are accessible and moves the job to the - * COMPLETED job state and adds the COMPLETED_WITH_ERRORS reason to the - * job's {@link JobStateReasons JobStateReasons} attribute depends on - * implementation and/or site policy. This value should be supported if - * the printer supports doc flavors with URL print data representation + * The printer could not access one or more documents passed by reference + * (i.e., the print data representation object is a {@code URL}). This + * reason is intended to cover any file access problem,including file does + * not exist and access denied because of an access control problem. Whether + * the printer aborts the job and moves the job to the {@code ABORTED} job + * state or prints all documents that are accessible and moves the job to + * the {@code COMPLETED} job state and adds the + * {@code COMPLETED_WITH_ERRORS} reason to the job's + * {@link JobStateReasons JobStateReasons} attribute depends on + * implementation and/or site policy. This value should be supported if the + * printer supports doc flavors with {@code URL} print data representation * objects. */ public static final JobStateReason @@ -112,9 +119,8 @@ /** * The value of the job's {@link JobHoldUntil JobHoldUntil} attribute was - * specified with a date-time that is still in the future. The job must - * not be a candidate for processing until this reason is removed and - * there are + * specified with a date-time that is still in the future. The job must not + * be a candidate for processing until this reason is removed and there are * no other reasons to hold the job. This value should be supported if the * {@link JobHoldUntil JobHoldUntil} job template attribute is supported. */ @@ -123,63 +129,64 @@ /** * At least one of the resources needed by the job, such as media, fonts, - * resource objects, etc., is not ready on any of the physical printers - * for which the job is a candidate. This condition may be detected - * when the job is accepted, or subsequently while the job is pending - * or processing, depending on implementation. - * The job may remain in its current state or - * be moved to the PENDING_HELD state, depending on implementation and/or - * job scheduling policy. + * resource objects, etc., is not ready on any of the physical printers for + * which the job is a candidate. This condition may be detected when the job + * is accepted, or subsequently while the job is pending or processing, + * depending on implementation. The job may remain in its current state or + * be moved to the {@code PENDING_HELD} state, depending on implementation + * and/or job scheduling policy. */ public static final JobStateReason RESOURCES_ARE_NOT_READY = new JobStateReason(6); /** * The value of the printer's {@link PrinterStateReasons - * PrinterStateReasons} attribute contains a {@link PrinterStateReason - * PrinterStateReason} value of STOPPED_PARTLY. + * PrinterStateReasons} attribute contains a + * {@link PrinterStateReason PrinterStateReason} value of + * {@code STOPPED_PARTLY}. */ public static final JobStateReason PRINTER_STOPPED_PARTLY = new JobStateReason(7); /** - * The value of the printer's {@link PrinterState PrinterState} attribute - * ia STOPPED. + * The value of the printer's {@link PrinterState PrinterState} attribute ia + * {@code STOPPED}. */ public static final JobStateReason PRINTER_STOPPED = new JobStateReason(8); /** - * The job is in the PROCESSING state, but more specifically, the printer - * ia interpreting the document data. + * The job is in the {@code PROCESSING} state, but more specifically, the + * printer ia interpreting the document data. */ public static final JobStateReason JOB_INTERPRETING = new JobStateReason(9); /** - * The job is in the PROCESSING state, but more specifically, the printer - * has queued the document data. + * The job is in the {@code PROCESSING} state, but more specifically, the + * printer has queued the document data. */ public static final JobStateReason JOB_QUEUED = new JobStateReason(10); /** - * The job is in the PROCESSING state, but more specifically, the printer - * is interpreting document data and producing another electronic + * The job is in the {@code PROCESSING} state, but more specifically, the + * printer is interpreting document data and producing another electronic * representation. */ public static final JobStateReason JOB_TRANSFORMING = new JobStateReason(11); /** - * The job is in the PENDING_HELD, PENDING, or PROCESSING state, but more - * specifically, the printer has completed enough processing of the document - * to be able to start marking and the job is waiting for the marker. - * Systems that require human intervention to release jobs put the job into - * the PENDING_HELD job state. Systems that automatically select a job to - * use the marker put the job into the PENDING job state or keep the job - * in the PROCESSING job state while waiting for the marker, depending on + * The job is in the {@code PENDING_HELD}, {@code PENDING}, or + * {@code PROCESSING} state, but more specifically, the printer has + * completed enough processing of the document to be able to start marking + * and the job is waiting for the marker. Systems that require human + * intervention to release jobs put the job into the {@code PENDING_HELD} + * job state. Systems that automatically select a job to use the marker put + * the job into the {@code PENDING} job state or keep the job in the + * {@code PROCESSING} job state while waiting for the marker, depending on * implementation. All implementations put the job into (or back into) the - * PROCESSING state when marking does begin. + * {@code PROCESSING} state when marking does begin. */ public static final JobStateReason JOB_QUEUED_FOR_MARKER = new JobStateReason(12); @@ -189,8 +196,9 @@ * which spend a great deal of time processing (1) when no marking is * happening and then want to show that marking is now happening or (2) when * the job is in the process of being canceled or aborted while the job - * remains in the PROCESSING state, but the marking has not yet stopped so - * that impression or sheet counts are still increasing for the job. + * remains in the {@code PROCESSING} state, but the marking has not yet + * stopped so that impression or sheet counts are still increasing for the + * job. */ public static final JobStateReason JOB_PRINTING = new JobStateReason(13); @@ -229,9 +237,9 @@ /** * The job was aborted by the system. Either the job (1) is in the process * of being aborted, (2) has been aborted by the system and placed in the - * ABORTED state, or (3) has been aborted by the system and placed in the - * PENDING_HELD state, so that a user or operator can manually try the job - * again. This value should be supported. + * {@code ABORTED} state, or (3) has been aborted by the system and placed + * in the {@code PENDING_HELD} state, so that a user or operator can + * manually try the job again. This value should be supported. */ public static final JobStateReason ABORTED_BY_SYSTEM = new JobStateReason(17); @@ -250,7 +258,7 @@ * The job was aborted by the system because the printer encountered an * error in the document data while decompressing it. If the printer posts * this reason, the document data has already passed any tests that would - * have led to the UNSUPPORTED_COMPRESSION job state reason. + * have led to the {@code UNSUPPORTED_COMPRESSION} job state reason. */ public static final JobStateReason COMPRESSION_ERROR = new JobStateReason(19); @@ -259,8 +267,8 @@ * The job was aborted by the system because the document data's document * format (doc flavor) is not among those supported by the printer. If the * client specifies a doc flavor with a MIME type of - * {@code "application/octet-stream"}, the printer may abort the job if - * the printer cannot determine the document data's actual format through + * {@code "application/octet-stream"}, the printer may abort the job if the + * printer cannot determine the document data's actual format through * auto-sensing (even if the printer supports the document format if * specified explicitly). This value must be supported, since a doc flavor * is required to be specified for each doc. @@ -272,7 +280,7 @@ * The job was aborted by the system because the printer encountered an * error in the document data while processing it. If the printer posts this * reason, the document data has already passed any tests that would have - * led to the UNSUPPORTED_DOCUMENT_FORMAT job state reason. + * led to the {@code UNSUPPORTED_DOCUMENT_FORMAT} job state reason. */ public static final JobStateReason DOCUMENT_FORMAT_ERROR = new JobStateReason(21); @@ -281,22 +289,23 @@ * The requester has canceled the job or the printer has aborted the job, * but the printer is still performing some actions on the job until a * specified stop point occurs or job termination/cleanup is completed. - *

    + *

    * If the implementation requires some measurable time to cancel the job in - * the PROCESSING or PROCESSING_STOPPED job states, the printer must use - * this reason to indicate that the printer is still performing some actions - * on the job while the job remains in the PROCESSING or PROCESSING_STOPPED - * state. After all the job's job description attributes have stopped - * incrementing, the printer moves the job from the PROCESSING state to the - * CANCELED or ABORTED job states. + * the {@code PROCESSING} or {@code PROCESSING_STOPPED} job states, the + * printer must use this reason to indicate that the printer is still + * performing some actions on the job while the job remains in the + * {@code PROCESSING} or {@code PROCESSING_STOPPED} state. After all the + * job's job description attributes have stopped incrementing, the printer + * moves the job from the PROCESSING state to the {@code CANCELED} or + * {@code ABORTED} job states. */ public static final JobStateReason PROCESSING_TO_STOP_POINT = new JobStateReason(22); /** - * The printer is off-line and accepting no jobs. All PENDING jobs are put - * into the PENDING_HELD state. This situation could be true if the - * service's or document transform's input is impaired or broken. + * The printer is off-line and accepting no jobs. All {@code PENDING} jobs + * are put into the {@code PENDING_HELD} state. This situation could be true + * if the service's or document transform's input is impaired or broken. */ public static final JobStateReason SERVICE_OFF_LINE = new JobStateReason(23); @@ -323,11 +332,11 @@ /** * This job is retained and is currently able to be restarted. If - * JOB_RESTARTABLE is contained in the job's {@link JobStateReasons - * JobStateReasons} attribute, then the printer must accept a request to - * restart that job. This value should be supported if restarting jobs is - * supported. [The capability for restarting jobs is not in the Java - * Print Service API at present.] + * {@code JOB_RESTARTABLE} is contained in the job's + * {@link JobStateReasons JobStateReasons} attribute, then the printer must + * accept a request to restart that job. This value should be supported if + * restarting jobs is supported. [The capability for restarting jobs is + * not in the Java Print Service API at present.] */ public static final JobStateReason JOB_RESTARTABLE = new JobStateReason(27); @@ -335,24 +344,27 @@ /** * The job has been forwarded to a device or print system that is unable to * send back status. The printer sets the job's {@link JobState JobState} - * attribute to COMPLETED and adds the QUEUED_IN_DEVICE reason to the job's - * {@link JobStateReasons JobStateReasons} attribute to indicate that the - * printer has no additional information about the job and never will have - * any better information. + * attribute to {@code COMPLETED} and adds the {@code QUEUED_IN_DEVICE} + * reason to the job's {@link JobStateReasons JobStateReasons} attribute to + * indicate that the printer has no additional information about the job and + * never will have any better information. */ public static final JobStateReason QUEUED_IN_DEVICE = new JobStateReason(28); /** - * Construct a new job state reason enumeration value with the given - * integer value. + * Construct a new job state reason enumeration value with the given integer + * value. * - * @param value Integer value. + * @param value Integer value */ protected JobStateReason(int value) { super (value); } + /** + * The string table for class {@code JobStateReason}. + */ private static final String[] myStringTable = { "job-incoming", "job-data-insufficient", @@ -384,6 +396,9 @@ "job-restartable", "queued-in-device"}; + /** + * The enumeration value table for class {@code JobStateReason}. + */ private static final JobStateReason[] myEnumValueTable = { JOB_INCOMING, JOB_DATA_INSUFFICIENT, @@ -416,29 +431,28 @@ QUEUED_IN_DEVICE}; /** - * Returns the string table for class JobStateReason. + * Returns the string table for class {@code JobStateReason}. */ protected String[] getStringTable() { return myStringTable.clone(); } /** - * Returns the enumeration value table for class JobStateReason. + * Returns the enumeration value table for class {@code JobStateReason}. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } - /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobStateReason and any vendor-defined subclasses, the - * category is class JobStateReason itself. + *

    + * For class {@code JobStateReason} and any vendor-defined subclasses, the + * category is class {@code JobStateReason} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobStateReason.class; @@ -447,14 +461,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobStateReason and any vendor-defined subclasses, the + *

    + * For class {@code JobStateReason} and any vendor-defined subclasses, the * category name is {@code "job-state-reason"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-state-reason"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobStateReasons.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobStateReasons.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/JobStateReasons.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.Collection; @@ -31,43 +32,47 @@ import javax.print.attribute.PrintJobAttribute; /** - * Class JobStateReasons is a printing attribute class, a set of enumeration - * values, that provides additional information about the job's current state, - * i.e., information that augments the value of the job's {@link JobState - * JobState} attribute. - *

    + * Class {@code JobStateReasons} is a printing attribute class, a set of + * enumeration values, that provides additional information about the job's + * current state, i.e., information that augments the value of the job's + * {@link JobState JobState} attribute. + *

    * Instances of {@link JobStateReason JobStateReason} do not appear in a Print - * Job's attribute set directly. Rather, a JobStateReasons attribute appears in - * the Print Job's attribute set. The JobStateReasons attribute contains zero, - * one, or more than one {@link JobStateReason JobStateReason} objects which - * pertain to the Print Job's status. The printer adds a {@link JobStateReason - * JobStateReason} object to the Print Job's JobStateReasons attribute when the - * corresponding condition becomes true of the Print Job, and the printer - * removes the {@link JobStateReason JobStateReason} object again when the - * corresponding condition becomes false, regardless of whether the Print Job's - * overall {@link JobState JobState} also changed. - *

    - * Class JobStateReasons inherits its implementation from class {@link - * java.util.HashSet java.util.HashSet}. Unlike most printing attributes which - * are immutable once constructed, class JobStateReasons is designed to be - * mutable; you can add {@link JobStateReason JobStateReason} objects to an - * existing JobStateReasons object and remove them again. However, like class - * {@link java.util.HashSet java.util.HashSet}, class JobStateReasons is not - * multiple thread safe. If a JobStateReasons object will be used by multiple - * threads, be sure to synchronize its operations (e.g., using a synchronized - * set view obtained from class {@link java.util.Collections - * java.util.Collections}). - *

    - * IPP Compatibility: The string value returned by each individual {@link - * JobStateReason JobStateReason} object's {@code toString()} method gives - * the IPP keyword value. The category name returned by {@code getName()} + * Job's attribute set directly. Rather, a {@code JobStateReasons} attribute + * appears in the Print Job's attribute set. The {@code JobStateReasons} + * attribute contains zero, one, or more than one + * {@link JobStateReason JobStateReason} objects which pertain to the Print + * Job's status. The printer adds a {@link JobStateReason JobStateReason} object + * to the Print Job's JobStateReasons attribute when the corresponding condition + * becomes true of the Print Job, and the printer removes the + * {@link JobStateReason JobStateReason} object again when the corresponding + * condition becomes false, regardless of whether the Print Job's overall + * {@link JobState JobState} also changed. + *

    + * Class {@code JobStateReasons} inherits its implementation from class + * {@link HashSet java.util.HashSet}. Unlike most printing attributes + * which are immutable once constructed, class {@code JobStateReasons} is + * designed to be mutable; you can add {@link JobStateReason JobStateReason} + * objects to an existing {@code JobStateReasons} object and remove them again. + * However, like class {@link HashSet java.util.HashSet}, class + * {@code JobStateReasons} is not multiple thread safe. If a + * {@code JobStateReasons} object will be used by multiple threads, be sure to + * synchronize its operations (e.g., using a synchronized set view obtained + * from class {@link java.util.Collections java.util.Collections}). + *

    + * IPP Compatibility: The string value returned by each individual + * {@link JobStateReason JobStateReason} object's {@code toString()} method + * gives the IPP keyword value. The category name returned by {@code getName()} * gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class JobStateReasons extends HashSet implements PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 8849088261264331812L; /** @@ -82,9 +87,8 @@ * Construct a new, empty job state reasons attribute; the underlying hash * set has the given initial capacity and the default load factor. * - * @param initialCapacity Initial capacity. - * @throws IllegalArgumentException if the initial capacity is less - * than zero. + * @param initialCapacity initial capacity + * @throws IllegalArgumentException if the initial capacity is negative */ public JobStateReasons(int initialCapacity) { super (initialCapacity); @@ -94,10 +98,9 @@ * Construct a new, empty job state reasons attribute; the underlying hash * set has the given initial capacity and load factor. * - * @param initialCapacity Initial capacity. - * @param loadFactor Load factor. - * @throws IllegalArgumentException if the initial capacity is less - * than zero. + * @param initialCapacity initial capacity + * @param loadFactor load factor + * @throws IllegalArgumentException if the initial capacity is negative */ public JobStateReasons(int initialCapacity, float loadFactor) { super (initialCapacity, loadFactor); @@ -107,23 +110,18 @@ * Construct a new job state reasons attribute that contains the same * {@link JobStateReason JobStateReason} objects as the given collection. * The underlying hash set's initial capacity and load factor are as - * specified in the superclass constructor {@link - * java.util.HashSet#HashSet(java.util.Collection) - * HashSet(Collection)}. - * - * @param collection Collection to copy. + * specified in the superclass constructor + * {@link HashSet#HashSet(Collection) HashSet(Collection)}. * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code collection} is null or - * if any element in {@code collection} is null. - * @throws ClassCastException - * (unchecked exception) Thrown if any element in - * {@code collection} is not an instance of class {@link - * JobStateReason JobStateReason}. + * @param collection collection to copy + * @throws NullPointerException if {@code collection} is {@code null} or if + * any element in {@code collection} is {@code null} + * @throws ClassCastException if any element in {@code collection} is not an + * instance of class {@link JobStateReason JobStateReason} */ - public JobStateReasons(Collection collection) { - super (collection); - } + public JobStateReasons(Collection collection) { + super (collection); + } /** * Adds the specified element to this job state reasons attribute if it is @@ -132,16 +130,12 @@ * attribute already contains the specified element, the call leaves this * job state reasons attribute unchanged and returns {@code false}. * - * @param o Element to be added to this job state reasons attribute. - * - * @return {@code true} if this job state reasons attribute did not - * already contain the specified element. - * - * @throws NullPointerException - * (unchecked exception) Thrown if the specified element is null. - * @throws ClassCastException - * (unchecked exception) Thrown if the specified element is not an - * instance of class {@link JobStateReason JobStateReason}. + * @param o element to be added to this job state reasons attribute + * @return {@code true} if this job state reasons attribute did not already + * contain the specified element + * @throws NullPointerException if the specified element is {@code null} + * @throws ClassCastException if the specified element is not an instance of + * class {@link JobStateReason JobStateReason} * @since 1.5 */ public boolean add(JobStateReason o) { @@ -154,11 +148,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class JobStateReasons, the category is class JobStateReasons itself. + *

    + * For class {@code JobStateReasons}, the category is class + * JobStateReasons itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return JobStateReasons.class; @@ -167,14 +162,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class JobStateReasons, the category - * name is {@code "job-state-reasons"}. + *

    + * For class JobStateReasons, the category name is + * {@code "job-state-reasons"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "job-state-reasons"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Media.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Media.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Media.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,48 +22,51 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class Media is a printing attribute class that specifies the - * medium on which to print. + * Class {@code Media} is a printing attribute class that specifies the medium + * on which to print. *

    * Media may be specified in different ways. *

      - *
    • it may be specified by paper source - eg paper tray - *
    • it may be specified by a standard size - eg "A4" - *
    • it may be specified by a name - eg "letterhead" + *
    • it may be specified by paper source - eg paper tray + *
    • it may be specified by a standard size - eg "A4" + *
    • it may be specified by a name - eg "letterhead" *
    - * Each of these corresponds to the IPP "media" attribute. - * The current API does not support describing media by characteristics - * (eg colour, opacity). - * This may be supported in a later revision of the specification. + * Each of these corresponds to the IPP "media" attribute. The current API does + * not support describing media by characteristics (eg colour, opacity). This + * may be supported in a later revision of the specification. *

    - * A Media object is constructed with a value which represents - * one of the ways in which the Media attribute can be specified. + * A {@code Media} object is constructed with a value which represents one of + * the ways in which the Media attribute can be specified. *

    - * IPP Compatibility: The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. + * IPP Compatibility: The category name returned by {@code getName()} is + * the IPP attribute name. The enumeration's integer value is the IPP enum + * value. The {@code toString()} method returns the IPP string representation of + * the attribute value. * * @author Phil Race */ public abstract class Media extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -2823970704630722439L; /** * Constructs a new media attribute specified by name. * - * @param value a value + * @param value a value */ protected Media(int value) { super (value); @@ -72,19 +75,16 @@ /** * Returns whether this media attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is of the same subclass of Media as this object. - *
    3. - * The values are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is of the same subclass of {@code Media} as this + * object. + *
    3. The values are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this media - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this media + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return(object != null && object instanceof Media && @@ -95,12 +95,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class Media and any vendor-defined subclasses, the category is - * class Media itself. + *

    + * For class {@code Media} and any vendor-defined subclasses, the category + * is class {@code Media} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return Media.class; @@ -109,14 +109,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class Media and any vendor-defined subclasses, the category name is - * {@code "media"}. + *

    + * For class {@code Media} and any vendor-defined subclasses, the category + * name is {@code "media"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "media"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaName.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaName.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaName.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,37 +22,40 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; -import java.util.Locale; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; /** - * Class MediaName is a subclass of Media, a printing attribute class (an - * enumeration) that specifies the media for a print job as a name. - *

    - * This attribute can be used instead of specifying MediaSize or MediaTray. + * Class {@code MediaName} is a subclass of {@code Media}, a printing attribute + * class (an enumeration) that specifies the media for a print job as a name. + *

    + * This attribute can be used instead of specifying {@code MediaSize} or + * {@code MediaTray}. *

    - * Class MediaName currently declares a few standard media names. - * Implementation- or site-defined names for a media name attribute may also - * be created by defining a subclass of class MediaName. - *

    - * IPP Compatibility: MediaName is a representation class for + * Class {@code MediaName} currently declares a few standard media names. + * Implementation- or site-defined names for a media name attribute may also be + * created by defining a subclass of class {@code MediaName}. + *

    + * IPP Compatibility: {@code MediaName} is a representation class for * values of the IPP "media" attribute which names media. - * */ public class MediaName extends Media implements Attribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 4653117714524155448L; /** - * white letter paper. + * white letter paper. */ public static final MediaName NA_LETTER_WHITE = new MediaName(0); /** - * letter transparency. + * letter transparency. */ public static final MediaName NA_LETTER_TRANSPARENT = new MediaName(1); @@ -61,23 +64,24 @@ */ public static final MediaName ISO_A4_WHITE = new MediaName(2); - /** - * A4 transparency. + * A4 transparency. */ public static final MediaName ISO_A4_TRANSPARENT= new MediaName(3); - /** * Constructs a new media name enumeration value with the given integer * value. * - * @param value Integer value. + * @param value Integer value */ protected MediaName(int value) { super (value); } + /** + * The string table for class {@code MediaTray}. + */ private static final String[] myStringTable = { "na-letter-white", "na-letter-transparent", @@ -85,6 +89,9 @@ "iso-a4-transparent" }; + /** + * The enumeration value table for class {@code MediaTray}. + */ private static final MediaName[] myEnumValueTable = { NA_LETTER_WHITE, NA_LETTER_TRANSPARENT, @@ -93,8 +100,9 @@ }; /** - * Returns the string table for class MediaTray. - * @return the String table. + * Returns the string table for class {@code MediaTray}. + * + * @return the string table */ protected String[] getStringTable() { @@ -102,11 +110,11 @@ } /** - * Returns the enumeration value table for class MediaTray. - * @return the enumeration value table. + * Returns the enumeration value table for class {@code MediaTray}. + * + * @return the enumeration value table */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaPrintableArea.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaPrintableArea.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaPrintableArea.java Sat Sep 09 14:36:45 2017 +0200 @@ -22,9 +22,11 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.DocFlavor; +import javax.print.PrintService; import javax.print.attribute.Attribute; import javax.print.attribute.AttributeSet; import javax.print.attribute.DocAttribute; @@ -32,60 +34,67 @@ import javax.print.attribute.PrintRequestAttribute; /** - * Class MediaPrintableArea is a printing attribute used to distinguish + * Class {@code MediaPrintableArea} is a printing attribute used to distinguish * the printable and non-printable areas of media. *

    * The printable area is specified to be a rectangle, within the overall * dimensions of a media. *

    - * Most printers cannot print on the entire surface of the media, due - * to printer hardware limitations. This class can be used to query - * the acceptable values for a supposed print job, and to request an area - * within the constraints of the printable area to be used in a print job. + * Most printers cannot print on the entire surface of the media, due to printer + * hardware limitations. This class can be used to query the acceptable values + * for a supposed print job, and to request an area within the constraints of + * the printable area to be used in a print job. *

    * To query for the printable area, a client must supply a suitable context. - * Without specifying at the very least the size of the media being used - * no meaningful value for printable area can be obtained. + * Without specifying at the very least the size of the media being used no + * meaningful value for printable area can be obtained. *

    - * The attribute is not described in terms of the distance from the edge - * of the paper, in part to emphasise that this attribute is not independent - * of a particular media, but must be described within the context of a - * choice of other attributes. Additionally it is usually more convenient - * for a client to use the printable area. + * The attribute is not described in terms of the distance from the edge of the + * paper, in part to emphasise that this attribute is not independent of a + * particular media, but must be described within the context of a choice of + * other attributes. Additionally it is usually more convenient for a client to + * use the printable area. *

    - * The hardware's minimum margins is not just a property of the printer, - * but may be a function of the media size, orientation, media type, and - * any specified finishings. - * {@code PrintService} provides the method to query the supported - * values of an attribute in a suitable context : - * See {@link javax.print.PrintService#getSupportedAttributeValues(Class,DocFlavor, AttributeSet) PrintService.getSupportedAttributeValues()} + * The hardware's minimum margins is not just a property of the printer, but may + * be a function of the media size, orientation, media type, and any specified + * finishings. {@code PrintService} provides the method to query the supported + * values of an attribute in a suitable context : See + * {@link PrintService#getSupportedAttributeValues(Class, DocFlavor, AttributeSet) + * PrintService.getSupportedAttributeValues()} *

    - * The rectangular printable area is defined thus: - * The (x,y) origin is positioned at the top-left of the paper in portrait - * mode regardless of the orientation specified in the requesting context. - * For example a printable area for A4 paper in portrait or landscape - * orientation will have height {@literal >} width. + * The rectangular printable area is defined thus: The (x,y) origin is + * positioned at the top-left of the paper in portrait mode regardless of the + * orientation specified in the requesting context. For example a printable area + * for A4 paper in portrait or landscape orientation will have height + * {@literal >} width. *

    - * A printable area attribute's values are stored - * internally as integers in units of micrometers (µm), where 1 micrometer - * = 10-6 meter = 1/1000 millimeter = 1/25400 inch. This permits - * dimensions to be represented exactly to a precision of 1/1000 mm (= 1 - * µm) or 1/100 inch (= 254 µm). If fractional inches are expressed in - - * negative powers of two, this permits dimensions to be represented exactly to - * a precision of 1/8 inch (= 3175 µm) but not 1/16 inch (because 1/16 inch - - * does not equal an integral number of µm). + * A printable area attribute's values are stored internally as integers in + * units of micrometers (µm), where 1 micrometer = 10-6 meter = + * 1/1000 millimeter = 1/25400 inch. This permits dimensions to be represented + * exactly to a precision of 1/1000 mm (= 1 µm) or 1/100 inch (= 254 + * µm). If fractional inches are expressed in negative powers of two, this + * permits dimensions to be represented exactly to a precision of 1/8 inch + * (= 3175 µm) but not 1/16 inch (because 1/16 inch does not equal an + * integral number of µm). *

    - * IPP Compatibility: MediaPrintableArea is not an IPP attribute. + * IPP Compatibility: MediaPrintableArea is not an IPP attribute. */ - public final class MediaPrintableArea implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { + /** + * Printable {@code x}, {@code y}, {@code width} and {@code height}. + */ private int x, y, w, h; + + /** + * The units in which the values are expressed. + */ private int units; + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -1597171464050795793L; /** @@ -101,18 +110,17 @@ public static final int MM = 1000; /** - * Constructs a MediaPrintableArea object from floating point values. - * @param x printable x - * @param y printable y - * @param w printable width - * @param h printable height - * @param units in which the values are expressed. - * - * @exception IllegalArgumentException - * Thrown if {@code x < 0} or {@code y < 0} - * or {@code w <= 0} or {@code h <= 0} or - * {@code units < 1}. - */ + * Constructs a {@code MediaPrintableArea} object from floating point + * values. + * + * @param x printable x + * @param y printable y + * @param w printable width + * @param h printable height + * @param units in which the values are expressed + * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or + * {@code w <= 0} or {@code h <= 0} or {@code units < 1} + */ public MediaPrintableArea(float x, float y, float w, float h, int units) { if ((x < 0.0) || (y < 0.0) || (w <= 0.0) || (h <= 0.0) || (units < 1)) { @@ -127,18 +135,16 @@ } /** - * Constructs a MediaPrintableArea object from integer values. - * @param x printable x - * @param y printable y - * @param w printable width - * @param h printable height - * @param units in which the values are expressed. - * - * @exception IllegalArgumentException - * Thrown if {@code x < 0} or {@code y < 0} - * or {@code w <= 0} or {@code h <= 0} or - * {@code units < 1}. - */ + * Constructs a {@code MediaPrintableArea} object from integer values. + * + * @param x printable x + * @param y printable y + * @param w printable width + * @param h printable height + * @param units in which the values are expressed + * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or + * {@code w <= 0} or {@code h <= 0} or {@code units < 1} + */ public MediaPrintableArea(int x, int y, int w, int h, int units) { if ((x < 0) || (y < 0) || (w <= 0) || (h <= 0) || (units < 1)) { @@ -153,15 +159,13 @@ /** * Get the printable area as an array of 4 values in the order - * x, y, w, h. The values returned are in the given units. - * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. + * {@code x, y, w, h}. The values returned are in the given units. * - * @return printable area as array of x, y, w, h in the specified units. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @return printable area as array of {@code x, y, w, h} in the specified + * units + * @throws IllegalArgumentException if {@code units < 1} */ public float[] getPrintableArea(int units) { return new float[] { getX(units), getY(units), @@ -169,86 +173,70 @@ } /** - * Get the x location of the origin of the printable area in the - * specified units. - * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. - * - * @return x location of the origin of the printable area in the + * Get the {@code x} location of the origin of the printable area in the * specified units. * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @return {@code x} location of the origin of the printable area in the + * specified units + * @throws IllegalArgumentException if {@code units < 1} */ - public float getX(int units) { + public float getX(int units) { return convertFromMicrometers(x, units); - } + } /** - * Get the y location of the origin of the printable area in the - * specified units. - * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. - * - * @return y location of the origin of the printable area in the + * Get the {@code y} location of the origin of the printable area in the * specified units. * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @return {@code y} location of the origin of the printable area in the + * specified units + * @throws IllegalArgumentException if {@code units < 1} */ - public float getY(int units) { + public float getY(int units) { return convertFromMicrometers(y, units); - } + } /** - * Get the width of the printable area in the specified units. - * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. - * - * @return width of the printable area in the specified units. + * Get the {@code width} of the printable area in the specified units. * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @return {@code width} of the printable area in the specified units + * @throws IllegalArgumentException if {@code units < 1} */ - public float getWidth(int units) { + public float getWidth(int units) { return convertFromMicrometers(w, units); - } + } /** - * Get the height of the printable area in the specified units. - * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. - * - * @return height of the printable area in the specified units. + * Get the {@code height} of the printable area in the specified units. * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @return {@code height} of the printable area in the specified units + * @throws IllegalArgumentException if {@code units < 1} */ - public float getHeight(int units) { + public float getHeight(int units) { return convertFromMicrometers(h, units); - } + } /** * Returns whether this media margins attribute is equivalent to the passed - * in object. - * To be equivalent, all of the following conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class MediaPrintableArea. - *
    3. - * The origin and dimensions are the same. - *
    + * in object. To be equivalent, all of the following conditions must be + * true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code MediaPrintableArea}. + *
    3. The origin and dimensions are the same. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this media margins - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this media + * margins attribute, {@code false} otherwise */ public boolean equals(Object object) { boolean ret = false; @@ -264,12 +252,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class MediaPrintableArea, the category is - * class MediaPrintableArea itself. + *

    + * For class {@code MediaPrintableArea}, the category is class + * {@code MediaPrintableArea} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return MediaPrintableArea.class; @@ -278,32 +266,28 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class MediaPrintableArea, - * the category name is {@code "media-printable-area"}. - *

    This is not an IPP V1.1 attribute. + *

    + * For class {@code MediaPrintableArea}, the category name is + * {@code "media-printable-area"}. + *

    + * This is not an IPP V1.1 attribute. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "media-printable-area"; } /** - * Returns a string version of this rectangular size attribute in the - * given units. + * Returns a string version of this rectangular size attribute in the given + * units. * - * @param units - * Unit conversion factor, e.g. {@link #INCH INCH} or - * {@link #MM MM}. - * @param unitsName - * Units name string, e.g. {@code "in"} or {@code "mm"}. If - * null, no units name is appended to the result. - * - * @return String version of this two-dimensional size attribute. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code units < 1}. + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @param unitsName units name string, e.g. {@code "in"} or {@code "mm"}. + * If {@code null}, no units name is appended to the result + * @return string version of this two-dimensional size attribute + * @throws IllegalArgumentException if {@code units < 1} */ public String toString(int units, String unitsName) { if (unitsName == null) { @@ -328,6 +312,14 @@ return x + 37*y + 43*w + 47*h; } + /** + * Converts the {@code x} from micrometers to {@code units}. + * + * @param x the value + * @param units unit conversion factor, e.g. {@link #INCH INCH} or + * {@link #MM MM} + * @return the value of {@code x} in the specified units + */ private static float convertFromMicrometers(int x, int units) { if (units < 1) { throw new IllegalArgumentException("units is < 1"); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaSize.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaSize.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaSize.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,37 +22,44 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.HashMap; import java.util.Vector; +import javax.print.attribute.Attribute; import javax.print.attribute.Size2DSyntax; -import javax.print.attribute.Attribute; /** - * Class MediaSize is a two-dimensional size valued printing attribute class - * that indicates the dimensions of the medium in a portrait orientation, with - * the X dimension running along the bottom edge and the Y dimension running - * along the left edge. Thus, the Y dimension must be greater than or equal to - * the X dimension. Class MediaSize declares many standard media size - * values, organized into nested classes for ISO, JIS, North American, - * engineering, and other media. - *

    - * MediaSize is not yet used to specify media. Its current role is - * as a mapping for named media (see {@link MediaSizeName MediaSizeName}). - * Clients can use the mapping method - * {@code MediaSize.getMediaSizeForName(MediaSizeName)} - * to find the physical dimensions of the MediaSizeName instances - * enumerated in this API. This is useful for clients which need this - * information to format {@literal &} paginate printing. + * Class {@code MediaSize} is a two-dimensional size valued printing attribute + * class that indicates the dimensions of the medium in a portrait orientation, + * with the {@code X} dimension running along the bottom edge and the {@code Y} + * dimension running along the left edge. Thus, the {@code Y} dimension must be + * greater than or equal to the {@code X} dimension. Class {@code MediaSize} + * declares many standard media size values, organized into nested classes for + * ISO, JIS, North American, engineering, and other media. + *

    + * {@code MediaSize} is not yet used to specify media. Its current role is as a + * mapping for named media (see {@link MediaSizeName MediaSizeName}). Clients + * can use the mapping method + * {@code MediaSize.getMediaSizeForName(MediaSizeName)} to find the physical + * dimensions of the {@code MediaSizeName} instances enumerated in this API. + * This is useful for clients which need this information to format {@literal &} + * paginate printing. * - * @author Phil Race, Alan Kaminsky + * @author Phil Race, Alan Kaminsky */ public class MediaSize extends Size2DSyntax implements Attribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -1967958664615414771L; + /** + * The media name. + */ private MediaSizeName mediaName; private static HashMap mediaMap = new HashMap<>(100, 10); @@ -63,15 +70,12 @@ * Construct a new media size attribute from the given floating-point * values. * - * @param x X dimension. - * @param y Y dimension. - * @param units - * Unit conversion factor, e.g. {@code Size2DSyntax.INCH} or - * {@code Size2DSyntax.MM}. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or - * {@code units < 1} or {@code x > y}. + * @param x {@code X} dimension + * @param y {@code Y} dimension + * @param units unit conversion factor, e.g. {@code Size2DSyntax.INCH} or + * {@code Size2DSyntax.MM} + * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or + * {@code units < 1} or {@code x > y} */ public MediaSize(float x, float y,int units) { super (x, y, units); @@ -84,15 +88,12 @@ /** * Construct a new media size attribute from the given integer values. * - * @param x X dimension. - * @param y Y dimension. - * @param units - * Unit conversion factor, e.g. {@code Size2DSyntax.INCH} or - * {@code Size2DSyntax.MM}. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or - * {@code units < 1} or {@code x > y}. + * @param x {@code X} dimension + * @param y {@code Y} dimension + * @param units unit conversion factor, e.g. {@code Size2DSyntax.INCH} or + * {@code Size2DSyntax.MM} + * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or + * {@code units < 1} or {@code x > y} */ public MediaSize(int x, int y,int units) { super (x, y, units); @@ -102,20 +103,17 @@ sizeVector.add(this); } - /** + /** * Construct a new media size attribute from the given floating-point * values. * - * @param x X dimension. - * @param y Y dimension. - * @param units - * Unit conversion factor, e.g. {@code Size2DSyntax.INCH} or - * {@code Size2DSyntax.MM}. - * @param media a media name to associate with this MediaSize - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or - * {@code units < 1} or {@code x > y}. + * @param x {@code X} dimension + * @param y {@code Y} dimension + * @param units unit conversion factor, e.g. {@code Size2DSyntax.INCH} or + * {@code Size2DSyntax.MM} + * @param media a media name to associate with this {@code MediaSize} + * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or + * {@code units < 1} or {@code x > y} */ public MediaSize(float x, float y,int units, MediaSizeName media) { super (x, y, units); @@ -132,16 +130,13 @@ /** * Construct a new media size attribute from the given integer values. * - * @param x X dimension. - * @param y Y dimension. - * @param units - * Unit conversion factor, e.g. {@code Size2DSyntax.INCH} or - * {@code Size2DSyntax.MM}. - * @param media a media name to associate with this MediaSize - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code x < 0} or {@code y < 0} or - * {@code units < 1} or {@code x > y}. + * @param x {@code X} dimension + * @param y {@code Y} dimension + * @param units unit conversion factor, e.g. {@code Size2DSyntax.INCH} or + * {@code Size2DSyntax.MM} + * @param media a media name to associate with this {@code MediaSize} + * @throws IllegalArgumentException if {@code x < 0} or {@code y < 0} or + * {@code units < 1} or {@code x > y} */ public MediaSize(int x, int y,int units, MediaSizeName media) { super (x, y, units); @@ -158,44 +153,43 @@ /** * Get the media name, if any, for this size. * - * @return the name for this media size, or null if no name was - * associated with this size (an anonymous size). + * @return the name for this media size, or {@code null} if no name was + * associated with this size (an anonymous size) */ public MediaSizeName getMediaSizeName() { return mediaName; } /** - * Get the MediaSize for the specified named media. + * Get the {@code MediaSize} for the specified named media. * - * @param media the name of the media for which the size is sought - * @return size of the media, or null if this media is not associated - * with any size. + * @param media the name of the media for which the size is sought + * @return size of the media, or {@code null} if this media is not + * associated with any size */ public static MediaSize getMediaSizeForName(MediaSizeName media) { return mediaMap.get(media); } /** - * The specified dimensions are used to locate a matching MediaSize - * instance from amongst all the standard MediaSize instances. - * If there is no exact match, the closest match is used. + * The specified dimensions are used to locate a matching {@code MediaSize} + * instance from amongst all the standard {@code MediaSize} instances. If + * there is no exact match, the closest match is used. *

    - * The MediaSize is in turn used to locate the MediaSizeName object. - * This method may return null if the closest matching MediaSize - * has no corresponding Media instance. + * The {@code MediaSize} is in turn used to locate the {@code MediaSizeName} + * object. This method may return {@code null} if the closest matching + * {@code MediaSize} has no corresponding {@code Media} instance. *

    - * This method is useful for clients which have only dimensions and - * want to find a Media which corresponds to the dimensions. - * @param x X dimension - * @param y Y dimension. - * @param units - * Unit conversion factor, e.g. {@code Size2DSyntax.INCH} or - * {@code Size2DSyntax.MM} - * @return MediaSizeName matching these dimensions, or null. - * @exception IllegalArgumentException if {@code x <= 0}, - * {@code y <= 0}, or {@code units < 1}. + * This method is useful for clients which have only dimensions and want to + * find a {@code Media} which corresponds to the dimensions. * + * @param x {@code X} dimension + * @param y {@code Y} dimension + * @param units unit conversion factor, e.g. {@code Size2DSyntax.INCH} or + * {@code Size2DSyntax.MM} + * @return {@code MediaSizeName} matching these dimensions, or {@code null} + * @throws IllegalArgumentException if {@code x <= 0}, {@code y <= 0}, or + * {@code units < 1} */ public static MediaSizeName findMedia(float x, float y, int units) { @@ -232,26 +226,20 @@ } /** - * Returns whether this media size attribute is equivalent to the passed - * in object. - * To be equivalent, all of the following conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class MediaSize. - *
    3. - * This media size attribute's X dimension is equal to - * {@code object}'s X dimension. - *
    4. - * This media size attribute's Y dimension is equal to - * {@code object}'s Y dimension. - *
    + * Returns whether this media size attribute is equivalent to the passed in + * object. To be equivalent, all of the following conditions must be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code MediaSize}. + *
    3. This media size attribute's {@code X} dimension is equal to + * {@code object}'s {@code X} dimension. + *
    4. This media size attribute's {@code Y} dimension is equal to + * {@code object}'s {@code Y} dimension. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this media size - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this media size + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && object instanceof MediaSize); @@ -260,12 +248,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class MediaSize and any vendor-defined subclasses, the category is - * class MediaSize itself. + *

    + * For class {@code MediaSize} and any vendor-defined subclasses, the + * category is class {@code MediaSize} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return MediaSize.class; @@ -274,151 +262,178 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class MediaSize and any vendor-defined subclasses, the category - * name is {@code "media-size"}. + *

    + * For class {@code MediaSize} and any vendor-defined subclasses, the + * category name is {@code "media-size"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "media-size"; } /** - * Class MediaSize.ISO includes {@link MediaSize MediaSize} values for ISO - * media. + * Class {@code MediaSize.ISO} includes {@link MediaSize MediaSize} values + * for ISO media. */ public static final class ISO { + /** * Specifies the ISO A0 size, 841 mm by 1189 mm. */ public static final MediaSize A0 = new MediaSize(841, 1189, Size2DSyntax.MM, MediaSizeName.ISO_A0); + /** * Specifies the ISO A1 size, 594 mm by 841 mm. */ public static final MediaSize A1 = new MediaSize(594, 841, Size2DSyntax.MM, MediaSizeName.ISO_A1); + /** * Specifies the ISO A2 size, 420 mm by 594 mm. */ public static final MediaSize A2 = new MediaSize(420, 594, Size2DSyntax.MM, MediaSizeName.ISO_A2); + /** * Specifies the ISO A3 size, 297 mm by 420 mm. */ public static final MediaSize A3 = new MediaSize(297, 420, Size2DSyntax.MM, MediaSizeName.ISO_A3); + /** * Specifies the ISO A4 size, 210 mm by 297 mm. */ public static final MediaSize A4 = new MediaSize(210, 297, Size2DSyntax.MM, MediaSizeName.ISO_A4); + /** * Specifies the ISO A5 size, 148 mm by 210 mm. */ public static final MediaSize A5 = new MediaSize(148, 210, Size2DSyntax.MM, MediaSizeName.ISO_A5); + /** * Specifies the ISO A6 size, 105 mm by 148 mm. */ public static final MediaSize A6 = new MediaSize(105, 148, Size2DSyntax.MM, MediaSizeName.ISO_A6); + /** * Specifies the ISO A7 size, 74 mm by 105 mm. */ public static final MediaSize A7 = new MediaSize(74, 105, Size2DSyntax.MM, MediaSizeName.ISO_A7); + /** * Specifies the ISO A8 size, 52 mm by 74 mm. */ public static final MediaSize A8 = new MediaSize(52, 74, Size2DSyntax.MM, MediaSizeName.ISO_A8); + /** * Specifies the ISO A9 size, 37 mm by 52 mm. */ public static final MediaSize A9 = new MediaSize(37, 52, Size2DSyntax.MM, MediaSizeName.ISO_A9); + /** * Specifies the ISO A10 size, 26 mm by 37 mm. */ public static final MediaSize A10 = new MediaSize(26, 37, Size2DSyntax.MM, MediaSizeName.ISO_A10); + /** * Specifies the ISO B0 size, 1000 mm by 1414 mm. */ public static final MediaSize B0 = new MediaSize(1000, 1414, Size2DSyntax.MM, MediaSizeName.ISO_B0); + /** * Specifies the ISO B1 size, 707 mm by 1000 mm. */ public static final MediaSize B1 = new MediaSize(707, 1000, Size2DSyntax.MM, MediaSizeName.ISO_B1); + /** * Specifies the ISO B2 size, 500 mm by 707 mm. */ public static final MediaSize B2 = new MediaSize(500, 707, Size2DSyntax.MM, MediaSizeName.ISO_B2); + /** * Specifies the ISO B3 size, 353 mm by 500 mm. */ public static final MediaSize B3 = new MediaSize(353, 500, Size2DSyntax.MM, MediaSizeName.ISO_B3); + /** * Specifies the ISO B4 size, 250 mm by 353 mm. */ public static final MediaSize B4 = new MediaSize(250, 353, Size2DSyntax.MM, MediaSizeName.ISO_B4); + /** * Specifies the ISO B5 size, 176 mm by 250 mm. */ public static final MediaSize B5 = new MediaSize(176, 250, Size2DSyntax.MM, MediaSizeName.ISO_B5); + /** * Specifies the ISO B6 size, 125 mm by 176 mm. */ public static final MediaSize B6 = new MediaSize(125, 176, Size2DSyntax.MM, MediaSizeName.ISO_B6); + /** * Specifies the ISO B7 size, 88 mm by 125 mm. */ public static final MediaSize B7 = new MediaSize(88, 125, Size2DSyntax.MM, MediaSizeName.ISO_B7); + /** * Specifies the ISO B8 size, 62 mm by 88 mm. */ public static final MediaSize B8 = new MediaSize(62, 88, Size2DSyntax.MM, MediaSizeName.ISO_B8); + /** * Specifies the ISO B9 size, 44 mm by 62 mm. */ public static final MediaSize B9 = new MediaSize(44, 62, Size2DSyntax.MM, MediaSizeName.ISO_B9); + /** * Specifies the ISO B10 size, 31 mm by 44 mm. */ public static final MediaSize B10 = new MediaSize(31, 44, Size2DSyntax.MM, MediaSizeName.ISO_B10); + /** * Specifies the ISO C3 size, 324 mm by 458 mm. */ public static final MediaSize C3 = new MediaSize(324, 458, Size2DSyntax.MM, MediaSizeName.ISO_C3); + /** * Specifies the ISO C4 size, 229 mm by 324 mm. */ public static final MediaSize C4 = new MediaSize(229, 324, Size2DSyntax.MM, MediaSizeName.ISO_C4); + /** * Specifies the ISO C5 size, 162 mm by 229 mm. */ public static final MediaSize C5 = new MediaSize(162, 229, Size2DSyntax.MM, MediaSizeName.ISO_C5); + /** * Specifies the ISO C6 size, 114 mm by 162 mm. */ public static final MediaSize C6 = new MediaSize(114, 162, Size2DSyntax.MM, MediaSizeName.ISO_C6); + /** * Specifies the ISO Designated Long size, 110 mm by 220 mm. */ @@ -434,8 +449,8 @@ } /** - * Class MediaSize.JIS includes {@link MediaSize MediaSize} values for JIS - * (Japanese) media. * + * Class {@code MediaSize.JIS} includes {@link MediaSize MediaSize} values + * for JIS (Japanese) media. */ public static final class JIS { @@ -444,152 +459,188 @@ */ public static final MediaSize B0 = new MediaSize(1030, 1456, Size2DSyntax.MM, MediaSizeName.JIS_B0); + /** * Specifies the JIS B1 size, 728 mm by 1030 mm. */ public static final MediaSize B1 = new MediaSize(728, 1030, Size2DSyntax.MM, MediaSizeName.JIS_B1); + /** * Specifies the JIS B2 size, 515 mm by 728 mm. */ public static final MediaSize B2 = new MediaSize(515, 728, Size2DSyntax.MM, MediaSizeName.JIS_B2); + /** * Specifies the JIS B3 size, 364 mm by 515 mm. */ public static final MediaSize B3 = new MediaSize(364, 515, Size2DSyntax.MM, MediaSizeName.JIS_B3); + /** * Specifies the JIS B4 size, 257 mm by 364 mm. */ public static final MediaSize B4 = new MediaSize(257, 364, Size2DSyntax.MM, MediaSizeName.JIS_B4); + /** * Specifies the JIS B5 size, 182 mm by 257 mm. */ public static final MediaSize B5 = new MediaSize(182, 257, Size2DSyntax.MM, MediaSizeName.JIS_B5); + /** * Specifies the JIS B6 size, 128 mm by 182 mm. */ public static final MediaSize B6 = new MediaSize(128, 182, Size2DSyntax.MM, MediaSizeName.JIS_B6); + /** * Specifies the JIS B7 size, 91 mm by 128 mm. */ public static final MediaSize B7 = new MediaSize(91, 128, Size2DSyntax.MM, MediaSizeName.JIS_B7); + /** * Specifies the JIS B8 size, 64 mm by 91 mm. */ public static final MediaSize B8 = new MediaSize(64, 91, Size2DSyntax.MM, MediaSizeName.JIS_B8); + /** * Specifies the JIS B9 size, 45 mm by 64 mm. */ public static final MediaSize B9 = new MediaSize(45, 64, Size2DSyntax.MM, MediaSizeName.JIS_B9); + /** * Specifies the JIS B10 size, 32 mm by 45 mm. */ public static final MediaSize B10 = new MediaSize(32, 45, Size2DSyntax.MM, MediaSizeName.JIS_B10); + /** * Specifies the JIS Chou ("long") #1 envelope size, 142 mm by 332 mm. */ public static final MediaSize CHOU_1 = new MediaSize(142, 332, Size2DSyntax.MM); + /** * Specifies the JIS Chou ("long") #2 envelope size, 119 mm by 277 mm. */ public static final MediaSize CHOU_2 = new MediaSize(119, 277, Size2DSyntax.MM); + /** * Specifies the JIS Chou ("long") #3 envelope size, 120 mm by 235 mm. */ public static final MediaSize CHOU_3 = new MediaSize(120, 235, Size2DSyntax.MM); + /** * Specifies the JIS Chou ("long") #4 envelope size, 90 mm by 205 mm. */ public static final MediaSize CHOU_4 = new MediaSize(90, 205, Size2DSyntax.MM); + /** * Specifies the JIS Chou ("long") #30 envelope size, 92 mm by 235 mm. */ public static final MediaSize CHOU_30 = new MediaSize(92, 235, Size2DSyntax.MM); + /** * Specifies the JIS Chou ("long") #40 envelope size, 90 mm by 225 mm. */ public static final MediaSize CHOU_40 = new MediaSize(90, 225, Size2DSyntax.MM); + /** * Specifies the JIS Kaku ("square") #0 envelope size, 287 mm by 382 mm. */ public static final MediaSize KAKU_0 = new MediaSize(287, 382, Size2DSyntax.MM); + /** * Specifies the JIS Kaku ("square") #1 envelope size, 270 mm by 382 mm. */ public static final MediaSize KAKU_1 = new MediaSize(270, 382, Size2DSyntax.MM); + /** * Specifies the JIS Kaku ("square") #2 envelope size, 240 mm by 332 mm. */ public static final MediaSize KAKU_2 = new MediaSize(240, 332, Size2DSyntax.MM); + /** * Specifies the JIS Kaku ("square") #3 envelope size, 216 mm by 277 mm. */ public static final MediaSize KAKU_3 = new MediaSize(216, 277, Size2DSyntax.MM); + /** * Specifies the JIS Kaku ("square") #4 envelope size, 197 mm by 267 mm. */ public static final MediaSize KAKU_4 = new MediaSize(197, 267, Size2DSyntax.MM); + /** * Specifies the JIS Kaku ("square") #5 envelope size, 190 mm by 240 mm. */ public static final MediaSize KAKU_5 = new MediaSize(190, 240, Size2DSyntax.MM); + /** * Specifies the JIS Kaku ("square") #6 envelope size, 162 mm by 229 mm. */ public static final MediaSize KAKU_6 = new MediaSize(162, 229, Size2DSyntax.MM); + /** * Specifies the JIS Kaku ("square") #7 envelope size, 142 mm by 205 mm. */ public static final MediaSize KAKU_7 = new MediaSize(142, 205, Size2DSyntax.MM); + /** * Specifies the JIS Kaku ("square") #8 envelope size, 119 mm by 197 mm. */ public static final MediaSize KAKU_8 = new MediaSize(119, 197, Size2DSyntax.MM); + /** - * Specifies the JIS Kaku ("square") #20 envelope size, 229 mm by 324 mm. + * Specifies the JIS Kaku ("square") #20 envelope size, 229 mm by 324 + * mm. */ public static final MediaSize KAKU_20 = new MediaSize(229, 324, Size2DSyntax.MM); + /** * Specifies the JIS Kaku ("square") A4 envelope size, 228 mm by 312 mm. */ public static final MediaSize KAKU_A4 = new MediaSize(228, 312, Size2DSyntax.MM); + /** * Specifies the JIS You ("Western") #1 envelope size, 120 mm by 176 mm. */ public static final MediaSize YOU_1 = new MediaSize(120, 176, Size2DSyntax.MM); + /** * Specifies the JIS You ("Western") #2 envelope size, 114 mm by 162 mm. */ public static final MediaSize YOU_2 = new MediaSize(114, 162, Size2DSyntax.MM); + /** * Specifies the JIS You ("Western") #3 envelope size, 98 mm by 148 mm. */ public static final MediaSize YOU_3 = new MediaSize(98, 148, Size2DSyntax.MM); + /** * Specifies the JIS You ("Western") #4 envelope size, 105 mm by 235 mm. */ public static final MediaSize YOU_4 = new MediaSize(105, 235, Size2DSyntax.MM); + /** * Specifies the JIS You ("Western") #5 envelope size, 95 mm by 217 mm. */ public static final MediaSize YOU_5 = new MediaSize(95, 217, Size2DSyntax.MM); + /** * Specifies the JIS You ("Western") #6 envelope size, 98 mm by 190 mm. */ public static final MediaSize YOU_6 = new MediaSize(98, 190, Size2DSyntax.MM); + /** * Specifies the JIS You ("Western") #7 envelope size, 92 mm by 165 mm. */ public static final MediaSize YOU_7 = new MediaSize(92, 165, Size2DSyntax.MM); + /** * Hide all constructors. */ @@ -598,8 +649,8 @@ } /** - * Class MediaSize.NA includes {@link MediaSize MediaSize} values for North - * American media. + * Class {@code MediaSize.NA} includes {@link MediaSize MediaSize} values + * for North American media. */ public static final class NA { @@ -609,59 +660,67 @@ public static final MediaSize LETTER = new MediaSize(8.5f, 11.0f, Size2DSyntax.INCH, MediaSizeName.NA_LETTER); + /** * Specifies the North American legal size, 8.5 inches by 14 inches. */ public static final MediaSize LEGAL = new MediaSize(8.5f, 14.0f, Size2DSyntax.INCH, MediaSizeName.NA_LEGAL); + /** * Specifies the North American 5 inch by 7 inch paper. */ public static final MediaSize NA_5X7 = new MediaSize(5, 7, Size2DSyntax.INCH, MediaSizeName.NA_5X7); + /** * Specifies the North American 8 inch by 10 inch paper. */ public static final MediaSize NA_8X10 = new MediaSize(8, 10, Size2DSyntax.INCH, MediaSizeName.NA_8X10); + /** - * Specifies the North American Number 9 business envelope size, - * 3.875 inches by 8.875 inches. + * Specifies the North American Number 9 business envelope size, 3.875 + * inches by 8.875 inches. */ public static final MediaSize NA_NUMBER_9_ENVELOPE = new MediaSize(3.875f, 8.875f, Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_9_ENVELOPE); + /** - * Specifies the North American Number 10 business envelope size, - * 4.125 inches by 9.5 inches. + * Specifies the North American Number 10 business envelope size, 4.125 + * inches by 9.5 inches. */ public static final MediaSize NA_NUMBER_10_ENVELOPE = new MediaSize(4.125f, 9.5f, Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_10_ENVELOPE); + /** - * Specifies the North American Number 11 business envelope size, - * 4.5 inches by 10.375 inches. + * Specifies the North American Number 11 business envelope size, 4.5 + * inches by 10.375 inches. */ public static final MediaSize NA_NUMBER_11_ENVELOPE = new MediaSize(4.5f, 10.375f, Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_11_ENVELOPE); + /** - * Specifies the North American Number 12 business envelope size, - * 4.75 inches by 11 inches. + * Specifies the North American Number 12 business envelope size, 4.75 + * inches by 11 inches. */ public static final MediaSize NA_NUMBER_12_ENVELOPE = new MediaSize(4.75f, 11.0f, Size2DSyntax.INCH, MediaSizeName.NA_NUMBER_12_ENVELOPE); + /** - * Specifies the North American Number 14 business envelope size, - * 5 inches by 11.5 inches. + * Specifies the North American Number 14 business envelope size, 5 + * inches by 11.5 inches. */ public static final MediaSize NA_NUMBER_14_ENVELOPE = @@ -674,42 +733,49 @@ public static final MediaSize NA_6X9_ENVELOPE = new MediaSize(6.0f, 9.0f, Size2DSyntax.INCH, MediaSizeName.NA_6X9_ENVELOPE); + /** * Specifies the North American 7 inch by 9 inch envelope size. */ public static final MediaSize NA_7X9_ENVELOPE = new MediaSize(7.0f, 9.0f, Size2DSyntax.INCH, MediaSizeName.NA_7X9_ENVELOPE); + /** * Specifies the North American 9 inch by 11 inch envelope size. */ public static final MediaSize NA_9x11_ENVELOPE = new MediaSize(9.0f, 11.0f, Size2DSyntax.INCH, MediaSizeName.NA_9X11_ENVELOPE); + /** * Specifies the North American 9 inch by 12 inch envelope size. */ public static final MediaSize NA_9x12_ENVELOPE = new MediaSize(9.0f, 12.0f, Size2DSyntax.INCH, MediaSizeName.NA_9X12_ENVELOPE); + /** * Specifies the North American 10 inch by 13 inch envelope size. */ public static final MediaSize NA_10x13_ENVELOPE = new MediaSize(10.0f, 13.0f, Size2DSyntax.INCH, MediaSizeName.NA_10X13_ENVELOPE); + /** * Specifies the North American 10 inch by 14 inch envelope size. */ public static final MediaSize NA_10x14_ENVELOPE = new MediaSize(10.0f, 14.0f, Size2DSyntax.INCH, MediaSizeName.NA_10X14_ENVELOPE); + /** * Specifies the North American 10 inch by 15 inch envelope size. */ public static final MediaSize NA_10X15_ENVELOPE = new MediaSize(10.0f, 15.0f, Size2DSyntax.INCH, MediaSizeName.NA_10X15_ENVELOPE); + /** * Hide all constructors. */ @@ -718,8 +784,8 @@ } /** - * Class MediaSize.Engineering includes {@link MediaSize MediaSize} values - * for engineering media. + * Class {@code MediaSize.Engineering} includes {@link MediaSize MediaSize} + * values for engineering media. */ public static final class Engineering { @@ -729,30 +795,35 @@ public static final MediaSize A = new MediaSize(8.5f, 11.0f, Size2DSyntax.INCH, MediaSizeName.A); + /** * Specifies the engineering B size, 11 inch by 17 inch. */ public static final MediaSize B = new MediaSize(11.0f, 17.0f, Size2DSyntax.INCH, MediaSizeName.B); + /** * Specifies the engineering C size, 17 inch by 22 inch. */ public static final MediaSize C = new MediaSize(17.0f, 22.0f, Size2DSyntax.INCH, MediaSizeName.C); + /** * Specifies the engineering D size, 22 inch by 34 inch. */ public static final MediaSize D = new MediaSize(22.0f, 34.0f, Size2DSyntax.INCH, MediaSizeName.D); + /** * Specifies the engineering E size, 34 inch by 44 inch. */ public static final MediaSize E = new MediaSize(34.0f, 44.0f, Size2DSyntax.INCH, MediaSizeName.E); + /** * Hide all constructors. */ @@ -761,16 +832,18 @@ } /** - * Class MediaSize.Other includes {@link MediaSize MediaSize} values for - * miscellaneous media. + * Class {@code MediaSize.Other} includes {@link MediaSize MediaSize} values + * for miscellaneous media. */ public static final class Other { + /** * Specifies the executive size, 7.25 inches by 10.5 inches. */ public static final MediaSize EXECUTIVE = new MediaSize(7.25f, 10.5f, Size2DSyntax.INCH, MediaSizeName.EXECUTIVE); + /** * Specifies the ledger size, 11 inches by 17 inches. */ @@ -780,6 +853,7 @@ /** * Specifies the tabloid size, 11 inches by 17 inches. + * * @since 1.5 */ public static final MediaSize @@ -792,48 +866,56 @@ public static final MediaSize INVOICE = new MediaSize(5.5f, 8.5f, Size2DSyntax.INCH, MediaSizeName.INVOICE); + /** * Specifies the folio size, 8.5 inches by 13 inches. */ public static final MediaSize FOLIO = new MediaSize(8.5f, 13.0f, Size2DSyntax.INCH, MediaSizeName.FOLIO); + /** * Specifies the quarto size, 8.5 inches by 10.83 inches. */ public static final MediaSize QUARTO = new MediaSize(8.5f, 10.83f, Size2DSyntax.INCH, MediaSizeName.QUARTO); + /** * Specifies the Italy envelope size, 110 mm by 230 mm. */ public static final MediaSize ITALY_ENVELOPE = new MediaSize(110, 230, Size2DSyntax.MM, MediaSizeName.ITALY_ENVELOPE); + /** * Specifies the Monarch envelope size, 3.87 inch by 7.5 inch. */ public static final MediaSize MONARCH_ENVELOPE = new MediaSize(3.87f, 7.5f, Size2DSyntax.INCH, MediaSizeName.MONARCH_ENVELOPE); + /** * Specifies the Personal envelope size, 3.625 inch by 6.5 inch. */ public static final MediaSize PERSONAL_ENVELOPE = new MediaSize(3.625f, 6.5f, Size2DSyntax.INCH, MediaSizeName.PERSONAL_ENVELOPE); + /** * Specifies the Japanese postcard size, 100 mm by 148 mm. */ public static final MediaSize JAPANESE_POSTCARD = new MediaSize(100, 148, Size2DSyntax.MM, MediaSizeName.JAPANESE_POSTCARD); + /** * Specifies the Japanese Double postcard size, 148 mm by 200 mm. */ public static final MediaSize JAPANESE_DOUBLE_POSTCARD = new MediaSize(148, 200, Size2DSyntax.MM, MediaSizeName.JAPANESE_DOUBLE_POSTCARD); + /** * Hide all constructors. */ @@ -841,8 +923,9 @@ } } - /* force loading of all the subclasses so that the instances - * are created and inserted into the hashmap. + /* + * force loading of all the subclasses so that the instances are created and + * inserted into the hashmap. */ static { MediaSize ISOA4 = ISO.A4; diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaSizeName.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaSizeName.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaSizeName.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,161 +22,192 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; -import java.util.Locale; - import javax.print.attribute.EnumSyntax; -import javax.print.attribute.Attribute; /** - * Class MediaSizeName is a subclass of Media. - *

    - * This attribute can be used instead of specifying MediaName or MediaTray. + * Class {@code MediaSizeName} is a subclass of {@code Media}. + *

    + * This attribute can be used instead of specifying {@code MediaName} or + * {@code MediaTray}. *

    - * Class MediaSizeName currently declares a few standard media - * name values. - *

    - * IPP Compatibility: MediaSizeName is a representation class for - * values of the IPP "media" attribute which names media sizes. - * The names of the media sizes correspond to those in the IPP 1.1 RFC - * RFC 2911 - * + * Class {@code MediaSizeName} currently declares a few standard media name + * values. + *

    + * IPP Compatibility: {@code MediaSizeName} is a representation class for + * values of the IPP "media" attribute which names media sizes. The names of the + * media sizes correspond to those in the IPP 1.1 RFC + * RFC 2911 */ public class MediaSizeName extends Media { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 2778798329756942747L; /** * A0 size. */ public static final MediaSizeName ISO_A0 = new MediaSizeName(0); + /** * A1 size. */ public static final MediaSizeName ISO_A1 = new MediaSizeName(1); + /** * A2 size. */ public static final MediaSizeName ISO_A2 = new MediaSizeName(2); + /** * A3 size. */ public static final MediaSizeName ISO_A3 = new MediaSizeName(3); + /** * A4 size. */ public static final MediaSizeName ISO_A4 = new MediaSizeName(4); + /** * A5 size. */ public static final MediaSizeName ISO_A5 = new MediaSizeName(5); + /** * A6 size. */ public static final MediaSizeName ISO_A6 = new MediaSizeName(6); + /** * A7 size. */ public static final MediaSizeName ISO_A7 = new MediaSizeName(7); + /** * A8 size. */ public static final MediaSizeName ISO_A8 = new MediaSizeName(8); + /** * A9 size. */ public static final MediaSizeName ISO_A9 = new MediaSizeName(9); + /** * A10 size. */ public static final MediaSizeName ISO_A10 = new MediaSizeName(10); - /** + /** * ISO B0 size. */ public static final MediaSizeName ISO_B0 = new MediaSizeName(11); + /** * ISO B1 size. */ public static final MediaSizeName ISO_B1 = new MediaSizeName(12); + /** * ISO B2 size. */ public static final MediaSizeName ISO_B2 = new MediaSizeName(13); + /** * ISO B3 size. */ public static final MediaSizeName ISO_B3 = new MediaSizeName(14); + /** * ISO B4 size. */ public static final MediaSizeName ISO_B4 = new MediaSizeName(15); + /** * ISO B5 size. */ public static final MediaSizeName ISO_B5 = new MediaSizeName(16); + /** * ISO B6 size. */ public static final MediaSizeName ISO_B6 = new MediaSizeName(17); + /** * ISO B7 size. */ public static final MediaSizeName ISO_B7 = new MediaSizeName(18); + /** * ISO B8 size. */ public static final MediaSizeName ISO_B8 = new MediaSizeName(19); + /** * ISO B9 size. */ public static final MediaSizeName ISO_B9 = new MediaSizeName(20); + /** * ISO B10 size. */ public static final MediaSizeName ISO_B10 = new MediaSizeName(21); - /** + /** * JIS B0 size. */ public static final MediaSizeName JIS_B0 = new MediaSizeName(22); + /** * JIS B1 size. */ public static final MediaSizeName JIS_B1 = new MediaSizeName(23); + /** * JIS B2 size. */ public static final MediaSizeName JIS_B2 = new MediaSizeName(24); + /** * JIS B3 size. */ public static final MediaSizeName JIS_B3 = new MediaSizeName(25); + /** * JIS B4 size. */ public static final MediaSizeName JIS_B4 = new MediaSizeName(26); + /** * JIS B5 size. */ public static final MediaSizeName JIS_B5 = new MediaSizeName(27); + /** * JIS B6 size. */ public static final MediaSizeName JIS_B6 = new MediaSizeName(28); + /** * JIS B7 size. */ public static final MediaSizeName JIS_B7 = new MediaSizeName(29); + /** * JIS B8 size. */ public static final MediaSizeName JIS_B8 = new MediaSizeName(30); + /** * JIS B9 size. */ public static final MediaSizeName JIS_B9 = new MediaSizeName(31); + /** * JIS B10 size. */ @@ -186,198 +217,216 @@ * ISO C0 size. */ public static final MediaSizeName ISO_C0 = new MediaSizeName(33); + /** * ISO C1 size. */ public static final MediaSizeName ISO_C1 = new MediaSizeName(34); + /** * ISO C2 size. */ public static final MediaSizeName ISO_C2 = new MediaSizeName(35); + /** * ISO C3 size. */ public static final MediaSizeName ISO_C3 = new MediaSizeName(36); + /** * ISO C4 size. */ public static final MediaSizeName ISO_C4 = new MediaSizeName(37); + /** * ISO C5 size. */ public static final MediaSizeName ISO_C5 = new MediaSizeName(38); + /** - * letter size. + * letter size. */ public static final MediaSizeName ISO_C6 = new MediaSizeName(39); + /** - * letter size. + * letter size. */ public static final MediaSizeName NA_LETTER = new MediaSizeName(40); /** - * legal size . + * legal size. */ public static final MediaSizeName NA_LEGAL = new MediaSizeName(41); /** - * executive size . + * executive size. */ public static final MediaSizeName EXECUTIVE = new MediaSizeName(42); /** - * ledger size . + * ledger size. */ public static final MediaSizeName LEDGER = new MediaSizeName(43); /** - * tabloid size . + * tabloid size. */ public static final MediaSizeName TABLOID = new MediaSizeName(44); /** - * invoice size . + * invoice size. */ public static final MediaSizeName INVOICE = new MediaSizeName(45); /** - * folio size . + * folio size. */ public static final MediaSizeName FOLIO = new MediaSizeName(46); /** - * quarto size . + * quarto size. */ public static final MediaSizeName QUARTO = new MediaSizeName(47); /** - * Japanese Postcard size. + * Japanese Postcard size. */ public static final MediaSizeName JAPANESE_POSTCARD = new MediaSizeName(48); - /** - * Japanese Double Postcard size. + + /** + * Japanese Double Postcard size. */ public static final MediaSizeName JAPANESE_DOUBLE_POSTCARD = new MediaSizeName(49); /** - * A size . + * A size. */ public static final MediaSizeName A = new MediaSizeName(50); /** - * B size . + * B size. */ public static final MediaSizeName B = new MediaSizeName(51); /** - * C size . + * C size. */ public static final MediaSizeName C = new MediaSizeName(52); /** - * D size . + * D size. */ public static final MediaSizeName D = new MediaSizeName(53); /** - * E size . + * E size. */ public static final MediaSizeName E = new MediaSizeName(54); /** - * ISO designated long size . + * ISO designated long size. */ public static final MediaSizeName ISO_DESIGNATED_LONG = new MediaSizeName(55); /** - * Italy envelope size . + * Italy envelope size. */ public static final MediaSizeName ITALY_ENVELOPE = new MediaSizeName(56); // DESIGNATED_LONG? /** - * monarch envelope size . + * monarch envelope size. */ public static final MediaSizeName MONARCH_ENVELOPE = new MediaSizeName(57); + /** - * personal envelope size . + * personal envelope size. */ public static final MediaSizeName PERSONAL_ENVELOPE = new MediaSizeName(58); + /** - * number 9 envelope size . + * number 9 envelope size. */ public static final MediaSizeName NA_NUMBER_9_ENVELOPE = new MediaSizeName(59); + /** - * number 10 envelope size . + * number 10 envelope size. */ public static final MediaSizeName NA_NUMBER_10_ENVELOPE = new MediaSizeName(60); + /** - * number 11 envelope size . + * number 11 envelope size. */ public static final MediaSizeName NA_NUMBER_11_ENVELOPE = new MediaSizeName(61); + /** - * number 12 envelope size . + * number 12 envelope size. */ public static final MediaSizeName NA_NUMBER_12_ENVELOPE = new MediaSizeName(62); + /** - * number 14 envelope size . + * number 14 envelope size. */ public static final MediaSizeName NA_NUMBER_14_ENVELOPE = new MediaSizeName(63); - /** - * 6x9 North American envelope size. + + /** + * 6x9 North American envelope size. */ public static final MediaSizeName NA_6X9_ENVELOPE = new MediaSizeName(64); - /** - * 7x9 North American envelope size. + + /** + * 7x9 North American envelope size. */ public static final MediaSizeName NA_7X9_ENVELOPE = new MediaSizeName(65); - /** - * 9x11 North American envelope size. + + /** + * 9x11 North American envelope size. */ public static final MediaSizeName NA_9X11_ENVELOPE = new MediaSizeName(66); + /** - * 9x12 North American envelope size. + * 9x12 North American envelope size. */ public static final MediaSizeName NA_9X12_ENVELOPE = new MediaSizeName(67); /** - * 10x13 North American envelope size . + * 10x13 North American envelope size. */ public static final MediaSizeName NA_10X13_ENVELOPE = new MediaSizeName(68); /** - * 10x14North American envelope size . + * 10x14North American envelope size. */ public static final MediaSizeName NA_10X14_ENVELOPE = new MediaSizeName(69); /** - * 10x15 North American envelope size. + * 10x15 North American envelope size. */ public static final MediaSizeName NA_10X15_ENVELOPE = new MediaSizeName(70); /** - * 5x7 North American paper. + * 5x7 North American paper. */ public static final MediaSizeName NA_5X7 = new MediaSizeName(71); /** - * 8x10 North American paper. + * 8x10 North American paper. */ public static final MediaSizeName NA_8X10 = new MediaSizeName(72); @@ -386,12 +435,15 @@ * Construct a new media size enumeration value with the given integer * value. * - * @param value Integer value. + * @param value Integer value */ protected MediaSizeName(int value) { super (value); } + /** + * The string table for class {@code MediaSizeName}. + */ private static final String[] myStringTable = { "iso-a0", "iso-a1", @@ -468,6 +520,9 @@ "na-8x10", }; + /** + * The enumeration value table for class {@code MediaSizeName}. + */ private static final MediaSizeName[] myEnumValueTable = { ISO_A0, ISO_A1, @@ -544,9 +599,8 @@ NA_8X10, }; - /** - * Returns the string table for class MediaSizeName. + * Returns the string table for class {@code MediaSizeName}. */ protected String[] getStringTable() { @@ -554,11 +608,9 @@ } /** - * Returns the enumeration value table for class MediaSizeName. + * Returns the enumeration value table for class {@code MediaSizeName}. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } - - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaTray.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaTray.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MediaTray.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,29 +22,30 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; -import java.util.Locale; - import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; - /** - * Class MediaTray is a subclass of Media. - * Class MediaTray is a printing attribute class, an enumeration, that - * specifies the media tray or bin for the job. - * This attribute can be used instead of specifying MediaSize or MediaName. + * Class {@code MediaTray} is a subclass of {@code Media}. Class + * {@code MediaTray} is a printing attribute class, an enumeration, that + * specifies the media tray or bin for the job. This attribute can be used + * instead of specifying {@code MediaSize} or {@code MediaName}. *

    - * Class MediaTray declares keywords for standard media kind values. - * Implementation- or site-defined names for a media kind attribute may also - * be created by defining a subclass of class MediaTray. - *

    - * IPP Compatibility: MediaTray is a representation class for + * Class {@code MediaTray} declares keywords for standard media kind values. + * Implementation- or site-defined names for a media kind attribute may also be + * created by defining a subclass of class {@code MediaTray}. + *

    + * IPP Compatibility: {@code MediaTray} is a representation class for * values of the IPP "media" attribute which name paper trays. */ public class MediaTray extends Media implements Attribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -982503611095214703L; /** @@ -91,12 +92,15 @@ * Construct a new media tray enumeration value with the given integer * value. * - * @param value Integer value. + * @param value Integer value */ protected MediaTray(int value) { super (value); } + /** + * The string table for class {@code MediaTray}. + */ private static final String[] myStringTable ={ "top", "middle", @@ -108,6 +112,9 @@ "side" }; + /** + * The enumeration value table for class {@code MediaTray}. + */ private static final MediaTray[] myEnumValueTable = { TOP, MIDDLE, @@ -120,7 +127,7 @@ }; /** - * Returns the string table for class MediaTray. + * Returns the string table for class {@code MediaTray}. */ protected String[] getStringTable() { @@ -128,11 +135,9 @@ } /** - * Returns the enumeration value table for class MediaTray. + * Returns the enumeration value table for class {@code MediaTray}. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } - - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/MultipleDocumentHandling.java Sat Sep 09 14:36:45 2017 +0200 @@ -22,178 +22,162 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class MultipleDocumentHandling is a printing attribute class, an enumeration, - * that controls finishing operations and the placement of one or more - * print-stream pages into impressions and onto media sheets. When the value of - * the {@link Copies Copies} attribute exceeds 1, MultipleDocumentHandling also - * controls the order in which the copies that result from processing the - * documents are produced. This attribute is relevant only for a multidoc print - * job consisting of two or more individual docs. - *

    - * Briefly, MultipleDocumentHandling determines the relationship between the - * multiple input (electronic) documents fed into a multidoc print job and the - * output (physical) document or documents produced by the multidoc print job. + * Class {@code MultipleDocumentHandling} is a printing attribute class, an + * enumeration, that controls finishing operations and the placement of one or + * more print-stream pages into impressions and onto media sheets. When the + * value of the {@link Copies Copies} attribute exceeds 1, + * {@code MultipleDocumentHandling} also controls the order in which the copies + * that result from processing the documents are produced. This attribute is + * relevant only for a multidoc print job consisting of two or more individual + * docs. + *

    + * Briefly, {@code MultipleDocumentHandling} determines the relationship between + * the multiple input (electronic) documents fed into a multidoc print job and + * the output (physical) document or documents produced by the multidoc print + * job. * There are two possibilities: - *

      - *
    • - * The multiple input documents are combined into a single output document. - * Finishing operations ({@link Finishings Finishings}), - * are performed on this single output - * document. The {@link Copies Copies} attribute tells how many copies of this - * single output document to produce. The MultipleDocumentHandling values - * SINGLE_DOCUMENT and SINGLE_DOCUMENT_NEW_SHEET specify two variations of - * this possibility. - * - *
    • - * The multiple input documents remain separate output documents. Finishing - * operations ({@link Finishings Finishings}), - * are performed on each output document - * separately. The {@link Copies Copies} attribute tells how many copies of each - * separate output document to produce. The MultipleDocumentHandling values - * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and SEPARATE_DOCUMENTS_COLLATED_COPIES - * specify two variations of this possibility. - *
    - *

    - * In the detailed explanations below, if "{@code a}" represents an - * instance of document data, then the result of processing the data in - * document "{@code a}" is a sequence of media sheets represented by - * "{@code a(*)}". - *

    - * The standard MultipleDocumentHandling values are: - *

      - *
    • - * {@link #SINGLE_DOCUMENT - * SINGLE_DOCUMENT}. If a print job has multiple - * documents -- say, the document data is called {@code a} and - * {@code b} -- then the result of processing all the document data - * ({@code a} and then {@code b}) must be treated as a single sequence - * of media sheets for finishing operations; that is, finishing would be - * performed on the concatenation of the sequences {@code a(*),b(*)}. The - * printer must not force the data in each document instance to be formatted - * onto a new print-stream page, nor to start a new impression on a new media - * sheet. If more than one copy is made, the ordering of the sets of media - * sheets resulting from processing the document data must be - * {@code a(*),b(*),a(*),b(*),...}, and the printer object must force - * each copy ({@code a(*),b(*)}) to start on a new media sheet. - * - *
    • - * {@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES - * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES}. If a print job - * has multiple documents -- say, the document data is called {@code a} and - * {@code b} -- then the result of processing the data in each document - * instance must be treated as a single sequence of media sheets for finishing - * operations; that is, the sets {@code a(*)} and {@code b(*)} would - * each be finished separately. The printer must force each copy of the result - * of processing the data in a single document to start on a new media sheet. - * If more than one copy is made, the ordering of the sets of media sheets - * resulting from processing the document data must be - * {@code a(*),a(*),...,b(*),b(*)...}. - * - *
    • - * {@link #SEPARATE_DOCUMENTS_COLLATED_COPIES - * SEPARATE_DOCUMENTS_COLLATED_COPIES}. If a print job - * has multiple documents -- say, the document data is called {@code a} and - * {@code b} -- then the result of processing the data in each document - * instance must be treated as a single sequence of media sheets for finishing - * operations; that is, the sets {@code a(*)} and {@code b(*)} would - * each be finished separately. The printer must force each copy of the result - * of processing the data in a single document to start on a new media sheet. - * If more than one copy is made, the ordering of the sets of media sheets - * resulting from processing the document data must be - * {@code a(*),b(*),a(*),b(*),...}. - * - *
    • - * {@link #SINGLE_DOCUMENT_NEW_SHEET - * SINGLE_DOCUMENT_NEW_SHEET}. Same as SINGLE_DOCUMENT, - * except that the printer must ensure that the first impression of each - * document instance in the job is placed on a new media sheet. This value - * allows multiple documents to be stapled together with a single staple where - * each document starts on a new sheet. - *
    - *

    - * SINGLE_DOCUMENT is the same as SEPARATE_DOCUMENTS_COLLATED_COPIES with - * respect to ordering of print-stream pages, but not media sheet generation, - * since SINGLE_DOCUMENT will put the first page of the next document on the - * back side of a sheet if an odd number of pages have been produced so far - * for the job, while SEPARATE_DOCUMENTS_COLLATED_COPIES always forces the + *

      + *
    • The multiple input documents are combined into a single output + * document. Finishing operations ({@link Finishings Finishings}), are + * performed on this single output document. The {@link Copies Copies} + * attribute tells how many copies of this single output document to produce. + * The {@code MultipleDocumentHandling} values {@code SINGLE_DOCUMENT} and + * {@code SINGLE_DOCUMENT_NEW_SHEET} specify two variations of this + * possibility. + *
    • The multiple input documents remain separate output documents. + * Finishing operations ({@link Finishings Finishings}), are performed on each + * output document separately. The {@link Copies Copies} attribute tells how + * many copies of each separate output document to produce. The + * {@code MultipleDocumentHandling} values + * {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} and + * {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} specify two variations of this + * possibility. + *
    + * In the detailed explanations below, if "{@code a}" represents an instance of + * document data, then the result of processing the data in document "{@code a}" + * is a sequence of media sheets represented by "{@code a(*)}". + *

    + * The standard {@code MultipleDocumentHandling} values are: + *

      + *
    • {@link #SINGLE_DOCUMENT SINGLE_DOCUMENT}. If a + * print job has multiple documents -- say, the document data is called + * {@code a} and {@code b} -- then the result of processing all the document + * data ({@code a} and then {@code b}) must be treated as a single sequence of + * media sheets for finishing operations; that is, finishing would be + * performed on the concatenation of the sequences {@code a(*),b(*)}. The + * printer must not force the data in each document instance to be formatted + * onto a new print-stream page, nor to start a new impression on a new media + * sheet. If more than one copy is made, the ordering of the sets of media + * sheets resulting from processing the document data must be + * {@code a(*),b(*),a(*),b(*),...}, and the printer object must force each + * copy ({@code a(*),b(*)}) to start on a new media sheet. + *
    • {@link #SEPARATE_DOCUMENTS_UNCOLLATED_COPIES + * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES}. If a print job has multiple + * documents -- say, the document data is called {@code a} and {@code b} -- + * then the result of processing the data in each document instance must be + * treated as a single sequence of media sheets for finishing operations; that + * is, the sets {@code a(*)} and {@code b(*)} would each be finished + * separately. The printer must force each copy of the result of processing + * the data in a single document to start on a new media sheet. If more than + * one copy is made, the ordering of the sets of media sheets resulting from + * processing the document data must be {@code a(*),a(*),...,b(*),b(*)...}. + *
    • {@link #SEPARATE_DOCUMENTS_COLLATED_COPIES + * SEPARATE_DOCUMENTS_COLLATED_COPIES}. If a print job has multiple + * documents -- say, the document data is called {@code a} and {@code b} -- + * then the result of processing the data in each document instance must be + * treated as a single sequence of media sheets for finishing operations; that + * is, the sets {@code a(*)} and {@code b(*)} would each be finished + * separately. The printer must force each copy of the result of processing + * the data in a single document to start on a new media sheet. If more than + * one copy is made, the ordering of the sets of media sheets resulting from + * processing the document data must be {@code a(*),b(*),a(*),b(*),...}. + *
    • {@link #SINGLE_DOCUMENT_NEW_SHEET + * SINGLE_DOCUMENT_NEW_SHEET}. Same as SINGLE_DOCUMENT, except that the + * printer must ensure that the first impression of each document instance in + * the job is placed on a new media sheet. This value allows multiple + * documents to be stapled together with a single staple where each document + * starts on a new sheet. + *
    + *

    + * {@code SINGLE_DOCUMENT} is the same as + * {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} with respect to ordering of + * print-stream pages, but not media sheet generation, since + * {@code SINGLE_DOCUMENT} will put the first page of the next document on the + * back side of a sheet if an odd number of pages have been produced so far for + * the job, while {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} always forces the * next document or document copy on to a new sheet. - *

    + *

    * In addition, if a {@link Finishings Finishings} attribute of * {@link Finishings#STAPLE STAPLE} is specified, then: - *

      - *
    • - * With SINGLE_DOCUMENT, documents {@code a} and {@code b} are - * stapled together as a single document with no regard to new sheets. - * - *
    • - * With SINGLE_DOCUMENT_NEW_SHEET, documents {@code a} and {@code b} - * are stapled together as a single document, but document {@code b} - * starts on a new sheet. + *
        + *
      • With {@code SINGLE_DOCUMENT}, documents {@code a} and {@code b} are + * stapled together as a single document with no regard to new sheets. + *
      • With {@code SINGLE_DOCUMENT_NEW_SHEET}, documents {@code a} and + * {@code b} are stapled together as a single document, but document {@code b} + * starts on a new sheet. + *
      • With {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} and + * {@code SEPARATE_DOCUMENTS_COLLATED_COPIES}, documents {@code a} and + * {@code b} are stapled separately. + *
      + * Note: None of these values provide means to produce uncollated sheets + * within a document, i.e., where multiple copies of sheet n are produced + * before sheet n+1 of the same document. To specify that, see the + * {@link SheetCollate SheetCollate} attribute. + *

      + * IPP Compatibility: The category name returned by {@code getName()} is + * the IPP attribute name. The enumeration's integer value is the IPP enum + * value. The {@code toString()} method returns the IPP string representation of + * the attribute value. * - *

    • - * With SEPARATE_DOCUMENTS_UNCOLLATED_COPIES and - * SEPARATE_DOCUMENTS_COLLATED_COPIES, documents {@code a} and - * {@code b} are stapled separately. - *
    - *

    - * Note: None of these values provide means to produce uncollated - * sheets within a document, i.e., where multiple copies of sheet n - * are produced before sheet n+1 of the same document. - * To specify that, see the {@link SheetCollate SheetCollate} attribute. - *

    - * IPP Compatibility: The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. - * - * @see Copies - * @see Finishings - * @see NumberUp - * @see PageRanges - * @see SheetCollate - * @see Sides - * - * @author David Mendenhall - * @author Alan Kaminsky + * @author David Mendenhall + * @author Alan Kaminsky + * @see Copies + * @see Finishings + * @see NumberUp + * @see PageRanges + * @see SheetCollate + * @see Sides */ public class MultipleDocumentHandling extends EnumSyntax implements PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 8098326460746413466L; - /** - * Single document -- see above for further - * information. + * Single document -- see above for further information. */ public static final MultipleDocumentHandling SINGLE_DOCUMENT = new MultipleDocumentHandling (0); /** * Separate documents uncollated copies -- see above for - * further information. + * further information. */ public static final MultipleDocumentHandling SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = new MultipleDocumentHandling (1); /** * Separate documents collated copies -- see above for - * further information. + * further information. */ public static final MultipleDocumentHandling SEPARATE_DOCUMENTS_COLLATED_COPIES = new MultipleDocumentHandling (2); /** - * Single document new sheet -- see above for - * further information. + * Single document new sheet -- see above for further + * information. */ public static final MultipleDocumentHandling SINGLE_DOCUMENT_NEW_SHEET = new MultipleDocumentHandling (3); @@ -203,12 +187,15 @@ * Construct a new multiple document handling enumeration value with the * given integer value. * - * @param value Integer value. + * @param value Integer value */ protected MultipleDocumentHandling(int value) { super (value); } + /** + * The string table for class {@code MultipleDocumentHandling}. + */ private static final String[] myStringTable = { "single-document", "separate-documents-uncollated-copies", @@ -216,6 +203,9 @@ "single-document-new-sheet" }; + /** + * The enumeration value table for class {@code MultipleDocumentHandling}. + */ private static final MultipleDocumentHandling[] myEnumValueTable = { SINGLE_DOCUMENT, SEPARATE_DOCUMENTS_UNCOLLATED_COPIES, @@ -224,14 +214,15 @@ }; /** - * Returns the string table for class MultipleDocumentHandling. + * Returns the string table for class {@code MultipleDocumentHandling}. */ protected String[] getStringTable() { return myStringTable.clone(); } /** - * Returns the enumeration value table for class MultipleDocumentHandling. + * Returns the enumeration value table for class + * {@code MultipleDocumentHandling}. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); @@ -240,12 +231,13 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class MultipleDocumentHandling and any vendor-defined subclasses, - * the category is class MultipleDocumentHandling itself. + *

    + * For class {@code MultipleDocumentHandling} and any vendor-defined + * subclasses, the category is class {@code MultipleDocumentHandling} + * itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return MultipleDocumentHandling.class; @@ -254,14 +246,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class MultipleDocumentHandling and any vendor-defined subclasses, - * the category name is {@code "multiple-document-handling"}. + *

    + * For class {@code MultipleDocumentHandling} and any vendor-defined + * subclasses, the category name is {@code "multiple-document-handling"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "multiple-document-handling"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberOfDocuments.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberOfDocuments.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberOfDocuments.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,31 +30,30 @@ import javax.print.attribute.PrintJobAttribute; /** - * Class NumberOfDocuments is an integer valued printing attribute that + * Class {@code NumberOfDocuments} is an integer valued printing attribute that * indicates the number of individual docs the printer has accepted for this * job, regardless of whether the docs' print data has reached the printer or * not. - *

    - * IPP Compatibility: The integer value gives the IPP integer value. The - * category name returned by {@code getName()} gives the IPP attribute - * name. + *

    + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class NumberOfDocuments extends IntegerSyntax implements PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 7891881310684461097L; - /** * Construct a new number of documents attribute with the given integer * value. * - * @param value Integer value. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 0. + * @param value Integer value + * @throws IllegalArgumentException if {@code value} is negative */ public NumberOfDocuments(int value) { super (value, 0, Integer.MAX_VALUE); @@ -61,22 +61,18 @@ /** * Returns whether this number of documents attribute is equivalent to the - * passed in object. To be equivalent, all of the following conditions - * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class NumberOfDocuments. - *
    3. - * This number of documents attribute's value and {@code object}'s - * value are equal. - *
    + * passed in object. To be equivalent, all of the following conditions must + * be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code NumberOfDocuments}. + *
    3. This number of documents attribute's value and {@code object}'s + * value are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this number of - * documents attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this number of + * documents attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && @@ -86,12 +82,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class NumberOfDocuments, the - * category is class NumberOfDocuments itself. + *

    + * For class {@code NumberOfDocuments}, the category is class + * {@code NumberOfDocuments} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return NumberOfDocuments.class; @@ -100,14 +96,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class NumberOfDocuments, the - * category name is {@code "number-of-documents"}. + *

    + * For class {@code NumberOfDocuments}, the category name is + * {@code "number-of-documents"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "number-of-documents"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberOfInterveningJobs.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberOfInterveningJobs.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberOfInterveningJobs.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,30 +30,30 @@ import javax.print.attribute.PrintJobAttribute; /** - * Class NumberOfInterveningJobs is an integer valued printing attribute that - * indicates the number of jobs that are ahead of this job in the relative - * chronological order of expected time to complete (i.e., the current - * scheduled order). - *

    - * IPP Compatibility: The integer value gives the IPP integer value. - * The category name returned by {@code getName()} gives the IPP - * attribute name. + * Class {@code NumberOfInterveningJobs} is an integer valued printing attribute + * that indicates the number of jobs that are ahead of this job in the relative + * chronological order of expected time to complete (i.e., the current scheduled + * order). + *

    + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class NumberOfInterveningJobs extends IntegerSyntax implements PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 2568141124844982746L; /** * Construct a new number of intervening jobs attribute with the given * integer value. * - * @param value Integer value. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 0. + * @param value Integer value + * @throws IllegalArgumentException if {@code value} is negative */ public NumberOfInterveningJobs(int value) { super(value, 0, Integer.MAX_VALUE); @@ -62,20 +63,17 @@ * Returns whether this number of intervening jobs attribute is equivalent * to the passed in object. To be equivalent, all of the following * conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class NumberOfInterveningJobs. - *
    3. - * This number of intervening jobs attribute's value and - * {@code object}'s value are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class + * {@code NumberOfInterveningJobs}. + *
    3. This number of intervening jobs attribute's value and + * {@code object}'s value are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this number of - * intervening jobs attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this number of + * intervening jobs attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && @@ -85,12 +83,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class NumberOfInterveningJobs, the - * category is class NumberOfInterveningJobs itself. + *

    + * For class {@code NumberOfInterveningJobs}, the category is class + * {@code NumberOfInterveningJobs} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return NumberOfInterveningJobs.class; @@ -99,14 +97,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class NumberOfInterveningJobs, the - * category name is {@code "number-of-intervening-jobs"}. + *

    + * For class {@code NumberOfInterveningJobs}, the category name is + * {@code "number-of-intervening-jobs"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "number-of-intervening-jobs"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberUp.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberUp.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberUp.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,120 +22,107 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; import javax.print.attribute.IntegerSyntax; -import javax.print.attribute.DocAttribute; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class NumberUp is an integer valued printing attribute class that specifies - * the number of print-stream pages to impose upon a single side of an - * instance of a selected medium. That is, if the NumberUp value is n, - * the printer must place n print-stream pages on a single side of - * an instance of the - * selected medium. To accomplish this, the printer may add some sort of - * translation, scaling, or rotation. This attribute primarily controls the - * translation, scaling and rotation of print-stream pages. - *

    - * The effect of a NumberUp attribute on a multidoc print job (a job with - * multiple documents) depends on whether all the docs have the same number up - * values specified or whether different docs have different number up values - * specified, and on the (perhaps defaulted) value of the {@link - * MultipleDocumentHandling MultipleDocumentHandling} attribute. - *

      - *
    • - * If all the docs have the same number up value n specified, then any - * value of {@link MultipleDocumentHandling MultipleDocumentHandling} makes - * sense, and the printer's processing depends on the {@link - * MultipleDocumentHandling MultipleDocumentHandling} value: - *
        - *
      • - * SINGLE_DOCUMENT -- All the input docs will be combined together into one - * output document. Each media impression will consist of nm - * print-stream pages from the output document. - * - *
      • - * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together - * into one output document. Each media impression will consist of n - * print-stream pages from the output document. However, the first impression of - * each input doc will always start on a new media sheet; this means the last - * impression of an input doc may have fewer than n print-stream pages - * on it. - * - *
      • - * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate. - * Each media impression will consist of n print-stream pages from the - * input doc. Since the input docs are separate, the first impression of each - * input doc will always start on a new media sheet; this means the last - * impression of an input doc may have fewer than n print-stream pages on - * it. + * Class {@code NumberUp} is an integer valued printing attribute class that + * specifies the number of print-stream pages to impose upon a single side of an + * instance of a selected medium. That is, if the NumberUp value is n, + * the printer must place n print-stream pages on a single side of an + * instance of the selected medium. To accomplish this, the printer may add some + * sort of translation, scaling, or rotation. This attribute primarily controls + * the translation, scaling and rotation of print-stream pages. + *

        + * The effect of a {@code NumberUp} attribute on a multidoc print job (a job + * with multiple documents) depends on whether all the docs have the same number + * up values specified or whether different docs have different number up values + * specified, and on the (perhaps defaulted) value of the + * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute. + *

          + *
        • If all the docs have the same number up value n specified, then + * any value of {@link MultipleDocumentHandling MultipleDocumentHandling} + * makes sense, and the printer's processing depends on the + * {@link MultipleDocumentHandling MultipleDocumentHandling} value: + *
            + *
          • {@code SINGLE_DOCUMENT} -- All the input docs will be combined + * together into one output document. Each media impression will consist of + * nm print-stream pages from the output document. + *
          • {@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be + * combined together into one output document. Each media impression will + * consist of n print-stream pages from the output document. However, + * the first impression of each input doc will always start on a new media + * sheet; this means the last impression of an input doc may have fewer than + * n print-stream pages on it. + *
          • {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The input docs will + * remain separate. Each media impression will consist of n + * print-stream pages from the input doc. Since the input docs are separate, + * the first impression of each input doc will always start on a new media + * sheet; this means the last impression of an input doc may have fewer than + * n print-stream pages on it. + *
          • {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The input docs will + * remain separate. Each media impression will consist of n + * print-stream pages from the input doc. Since the input docs are separate, + * the first impression of each input doc will always start on a new media + * sheet; this means the last impression of an input doc may have fewer than + * n print-stream pages on it. + *
          + *
            + *
          • {@code SINGLE_DOCUMENT} -- All the input docs will be combined + * together into one output document. Each media impression will consist of + * ni print-stream pages from the output document, where + * i is the number of the input doc corresponding to that point in + * the output document. When the next input doc has a different number up + * value from the previous input doc, the first print-stream page of the + * next input doc goes at the start of the next media impression, possibly + * leaving fewer than the full number of print-stream pages on the previous + * media impression. + *
          • {@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be + * combined together into one output document. Each media impression will + * consist of n print-stream pages from the output document. However, + * the first impression of each input doc will always start on a new media + * sheet; this means the last impression of an input doc may have fewer than + * n print-stream pages on it. + *
          • {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The input docs will + * remain separate. For input doc i, each media impression will + * consist of ni print-stream pages from the input doc. + * Since the input docs are separate, the first impression of each input doc + * will always start on a new media sheet; this means the last impression of + * an input doc may have fewer than ni print-stream pages + * on it. + *
          • {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The input docs will + * remain separate. For input doc i, each media impression will + * consist of ni print-stream pages from the input doc. + * Since the input docs are separate, the first impression of each input doc + * will always start on a new media sheet; this means the last impression of + * an input doc may have fewer than ni print-stream pages + * on it. + *
          + *
        + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * - *
      • - * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate. - * Each media impression will consist of n print-stream pages from the - * input doc. Since the input docs are separate, the first impression of each - * input doc will always start on a new media sheet; this means the last - * impression of an input doc may have fewer than n print-stream pages - * on it. - *
      - *
        - *
      • - * SINGLE_DOCUMENT -- All the input docs will be combined together into one - * output document. Each media impression will consist of ni - * print-stream pages from the output document, where i is the number of - * the input doc corresponding to that point in the output document. When the - * next input doc has a different number up value from the previous input doc, - * the first print-stream page of the next input doc goes at the start of the - * next media impression, possibly leaving fewer than the full number of - * print-stream pages on the previous media impression. - * - *
      • - * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together - * into one output document. Each media impression will consist of n - * print-stream pages from the output document. However, the first impression of - * each input doc will always start on a new media sheet; this means the last - * impression of an input doc may have fewer than n print-stream pages - * on it. - * - *
      • - * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate. - * For input doc i, each media impression will consist of - * ni print-stream pages from the input doc. Since the input - * docs are separate, the first impression of each input doc will always start - * on a new media sheet; this means the last impression of an input doc may have - * fewer than ni print-stream pages on it. - * - *
      • - * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate. - * For input doc i, each media impression will consist of - * ni print-stream pages from the input doc. Since the input - * docs are separate, the first impression of each input doc will always start - * on a new media sheet; this means the last impression of an input doc may - * have fewer than ni print-stream pages on it. - *
      - *
    - * IPP Compatibility: The integer value gives the IPP integer value. - * The category name returned by {@code getName()} gives the IPP - * attribute name. - * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class NumberUp extends IntegerSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -3040436486786527811L; - /** * Construct a new number up attribute with the given integer value. * - * @param value Integer value. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 1. + * @param value Integer value + * @throws IllegalArgumentException if {@code value < 1} */ public NumberUp(int value) { super (value, 1, Integer.MAX_VALUE); @@ -144,20 +131,16 @@ /** * Returns whether this number up attribute is equivalent to the passed in * object. To be equivalent, all of the following conditions must be true: - *
      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class NumberUp. - *
    3. - * This number up attribute's value and {@code object}'s value are - * equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code NumberUp}. + *
    3. This number up attribute's value and {@code object}'s value are + * equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this number up - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this number up + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && object instanceof NumberUp); @@ -166,11 +149,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class NumberUp, the category is class NumberUp itself. + *

    + * For class {@code NumberUp}, the category is class {@code NumberUp} + * itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return NumberUp.class; @@ -179,13 +163,12 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class NumberUp, the category name is {@code "number-up"}. + *

    + * For class {@code NumberUp}, the category name is {@code "number-up"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "number-up"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberUpSupported.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberUpSupported.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/NumberUpSupported.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,41 +30,39 @@ import javax.print.attribute.SupportedValuesAttribute; /** - * Class NumberUpSupported is a printing attribute class, a set of integers, - * that gives the supported values for a {@link NumberUp NumberUp} attribute. - *

    - * IPP Compatibility: The NumberUpSupported attribute's canonical array + * Class {@code NumberUpSupported} is a printing attribute class, a set of + * integers, that gives the supported values for a {@link NumberUp NumberUp} + * attribute. + *

    + * IPP Compatibility: The NumberUpSupported attribute's canonical array * form gives the lower and upper bound for each range of number-up to be - * included in an IPP "number-up-supported" attribute. See class {@link - * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an - * explanation of canonical array form. The category name returned by - * {@code getName()} gives the IPP attribute name. + * included in an IPP "number-up-supported" attribute. See class + * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of canonical + * array form. The category name returned by {@code getName()} gives the IPP + * attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class NumberUpSupported extends SetOfIntegerSyntax implements SupportedValuesAttribute { - private static final long serialVersionUID = -1041573395759141805L; - + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ + private static final long serialVersionUID = -1041573395759141805L; /** - * Construct a new number up supported attribute with the given members. - * The supported values for NumberUp are specified in "array form;" see - * class - * {@link javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} - * for an explanation of array form. - * - * @param members Set members in array form. + * Construct a new number up supported attribute with the given members. The + * supported values for NumberUp are specified in "array form;" see class + * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for + * an explanation of array form. * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code members} is null or - * any element of {@code members} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if any element of - * {@code members} is not a length-one or length-two array. Also - * thrown if {@code members} is a zero-length array or if any - * member of the set is less than 1. + * @param members set members in array form + * @throws NullPointerException if {@code members} is {@code null} or any + * element of {@code members} is {@code null} + * @throws IllegalArgumentException if any element of {@code members} is not + * a length-one or length-two array. Also if {@code members} is a + * zero-length array or if any member of the set is less than 1. */ public NumberUpSupported(int[][] members) { super (members); @@ -86,13 +85,10 @@ /** * Construct a new number up supported attribute containing a single - * integer. That is, only the one value of NumberUp is supported. - * - * @param member Set member. + * integer. That is, only the one value of {@code NumberUp} is supported. * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code member} is less than - * 1. + * @param member set member + * @throws IllegalArgumentException if {@code member < 1} */ public NumberUpSupported(int member) { super (member); @@ -103,16 +99,14 @@ /** * Construct a new number up supported attribute containing a single range - * of integers. That is, only those values of NumberUp in the one range are - * supported. + * of integers. That is, only those values of {@code NumberUp} in the one + * range are supported. * - * @param lowerBound Lower bound of the range. - * @param upperBound Upper bound of the range. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if a null range is specified or if a - * non-null range is specified with {@code lowerBound} less than - * 1. + * @param lowerBound lower bound of the range + * @param upperBound upper bound of the range + * @throws IllegalArgumentException if a {@code null} range is specified or + * if a {@code non-null} range is specified with {@code lowerBound} + * less than 1 */ public NumberUpSupported(int lowerBound, int upperBound) { super (lowerBound, upperBound); @@ -126,22 +120,18 @@ /** * Returns whether this number up supported attribute is equivalent to the - * passed in object. To be equivalent, all of the following conditions - * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class NumberUpSupported. - *
    3. - * This number up supported attribute's members and {@code object}'s - * members are the same. - *
    + * passed in object. To be equivalent, all of the following conditions must + * be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code NumberUpSupported}. + *
    3. This number up supported attribute's members and {@code object}'s + * members are the same. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this number up - * supported attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this number up + * supported attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && @@ -151,12 +141,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class NumberUpSupported, the - * category is class NumberUpSupported itself. + *

    + * For class {@code NumberUpSupported}, the category is class + * {@code NumberUpSupported} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return NumberUpSupported.class; @@ -165,14 +155,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class NumberUpSupported, the - * category name is {@code "number-up-supported"}. + *

    + * For class {@code NumberUpSupported}, the category name is + * {@code "number-up-supported"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "number-up-supported"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/OrientationRequested.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/OrientationRequested.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/OrientationRequested.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,48 +22,51 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; -import javax.print.attribute.DocAttribute; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class OrientationRequested is a printing attribute class, an enumeration, - * that indicates the desired orientation for printed print-stream pages; it - * does not describe the orientation of the client-supplied print-stream - * pages. - *

    - * For some document formats (such as {@code "application/postscript"}), - * the desired orientation of the print-stream pages is specified within the - * document data. This information is generated by a device driver prior to - * the submission of the print job. Other document formats (such as - * {@code "text/plain"}) do not include the notion of desired orientation - * within the document data. In the latter case it is possible for the printer - * to bind the desired orientation to the document data after it has been - * submitted. It is expected that a printer would only support the - * OrientationRequested attribute for some document formats (e.g., + * Class {@code OrientationRequested} is a printing attribute class, an + * enumeration, that indicates the desired orientation for printed print-stream + * pages; it does not describe the orientation of the client-supplied + * print-stream pages. + *

    + * For some document formats (such as {@code "application/postscript"}), the + * desired orientation of the print-stream pages is specified within the + * document data. This information is generated by a device driver prior to the + * submission of the print job. Other document formats (such as + * {@code "text/plain"}) do not include the notion of desired orientation within + * the document data. In the latter case it is possible for the printer to bind + * the desired orientation to the document data after it has been submitted. It + * is expected that a printer would only support the + * {@code OrientationRequested} attribute for some document formats (e.g., * {@code "text/plain"} or {@code "text/html"}) but not others (e.g. - * {@code "application/postscript"}). This is no different from any other - * job template attribute, since a print job can always impose constraints - * among the values of different job template attributes. - * However, a special mention - * is made here since it is very likely that a printer will support the - * OrientationRequested attribute for only a subset of the supported document - * formats. - *

    - * IPP Compatibility: The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. + * {@code "application/postscript"}). This is no different from any other job + * template attribute, since a print job can always impose constraints among the + * values of different job template attributes. However, a special mention is + * made here since it is very likely that a printer will support the + * {@code OrientationRequested} attribute for only a subset of the supported + * document formats. + *

    + * IPP Compatibility: The category name returned by {@code getName()} is + * the IPP attribute name. The enumeration's integer value is the IPP enum + * value. The {@code toString()} method returns the IPP string representation of + * the attribute value. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class OrientationRequested extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -4447437289862822276L; /** @@ -73,11 +76,10 @@ PORTRAIT = new OrientationRequested(3); /** - * The content will be imaged across the long edge of the medium. - * Landscape is defined to be a rotation of the print-stream page to be - * imaged by +90 degrees with respect to the medium - * (i.e. anti-clockwise) from the - * portrait orientation. Note: The +90 direction was chosen because + * The content will be imaged across the long edge of the medium. Landscape + * is defined to be a rotation of the print-stream page to be imaged by +90 + * degrees with respect to the medium (i.e. anti-clockwise) from the + * portrait orientation. Note: The +90 direction was chosen because * simple finishing on the long edge is the same edge whether portrait or * landscape. */ @@ -85,13 +87,13 @@ LANDSCAPE = new OrientationRequested(4); /** - * The content will be imaged across the long edge of the medium, but in - * the opposite manner from landscape. Reverse-landscape is defined to be - * a rotation of the print-stream page to be imaged by -90 degrees with + * The content will be imaged across the long edge of the medium, but in the + * opposite manner from landscape. Reverse-landscape is defined to be a + * rotation of the print-stream page to be imaged by -90 degrees with * respect to the medium (i.e. clockwise) from the portrait orientation. - * Note: The REVERSE_LANDSCAPE value was added because some - * applications rotate landscape -90 degrees from portrait, rather than - * +90 degrees. + * Note: The REVERSE_LANDSCAPE value was added because some + * applications rotate landscape -90 degrees from portrait, rather than +90 + * degrees. */ public static final OrientationRequested REVERSE_LANDSCAPE = new OrientationRequested(5); @@ -100,14 +102,14 @@ * The content will be imaged across the short edge of the medium, but in * the opposite manner from portrait. Reverse-portrait is defined to be a * rotation of the print-stream page to be imaged by 180 degrees with - * respect to the medium from the portrait orientation. Note: The - * REVERSE_PORTRAIT value was added for use with the {@link - * Finishings Finishings} attribute in cases where the - * opposite edge is desired for finishing a portrait document on simple - * finishing devices that have only one finishing position. Thus a - * {@code "text/plain"} portrait document can be stapled "on the - * right" by a simple finishing device as is common use with some - * Middle Eastern languages such as Hebrew. + * respect to the medium from the portrait orientation. Note: The + * REVERSE_PORTRAIT value was added for use with the + * {@link Finishings Finishings} attribute in cases where the opposite edge + * is desired for finishing a portrait document on simple finishing devices + * that have only one finishing position. Thus a {@code "text/plain"} + * portrait document can be stapled "on the right" by a simple finishing + * device as is common use with some Middle Eastern languages such as + * Hebrew. */ public static final OrientationRequested REVERSE_PORTRAIT = new OrientationRequested(6); @@ -116,12 +118,15 @@ * Construct a new orientation requested enumeration value with the given * integer value. * - * @param value Integer value. + * @param value Integer value */ protected OrientationRequested(int value) { super(value); } + /** + * The string table for class {@code OrientationRequested}. + */ private static final String[] myStringTable = { "portrait", "landscape", @@ -129,6 +134,9 @@ "reverse-portrait" }; + /** + * The enumeration value table for class {@code OrientationRequested}. + */ private static final OrientationRequested[] myEnumValueTable = { PORTRAIT, LANDSCAPE, @@ -137,21 +145,23 @@ }; /** - * Returns the string table for class OrientationRequested. + * Returns the string table for class {@code OrientationRequested}. */ protected String[] getStringTable() { return myStringTable; } /** - * Returns the enumeration value table for class OrientationRequested. + * Returns the enumeration value table for class + * {@code OrientationRequested}. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } /** - * Returns the lowest integer value used by class OrientationRequested. + * Returns the lowest integer value used by class + * {@code OrientationRequested}. */ protected int getOffset() { return 3; @@ -160,12 +170,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class OrientationRequested, the - * category is class OrientationRequested itself. + *

    + * For class {@code OrientationRequested}, the category is class + * {@code OrientationRequested} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return OrientationRequested.class; @@ -174,14 +184,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class OrientationRequested, the - * category name is {@code "orientation-requested"}. + *

    + * For class {@code OrientationRequested}, the category name is + * {@code "orientation-requested"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "orientation-requested"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/OutputDeviceAssigned.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/OutputDeviceAssigned.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/OutputDeviceAssigned.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,46 +22,48 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.TextSyntax; -import javax.print.attribute.PrintJobAttribute; /** - * Class OutputDeviceAssigned is a printing attribute class, a text attribute, - * that identifies the output device to which the service has assigned this - * job. If an output device implements an embedded Print Service instance, the - * printer need not set this attribute. If a print server implements a - * Print Service instance, the value may be empty (zero- length string) or not - * returned until the service assigns an output device to the job. This - * attribute is particularly useful when a single service supports multiple - * devices (so called "fan-out"). - *

    - * IPP Compatibility: The string value gives the IPP name value. The + * Class {@code OutputDeviceAssigned} is a printing attribute class, a text + * attribute, that identifies the output device to which the service has + * assigned this job. If an output device implements an embedded Print Service + * instance, the printer need not set this attribute. If a print server + * implements a Print Service instance, the value may be empty (zero- length + * string) or not returned until the service assigns an output device to the + * job. This attribute is particularly useful when a single service supports + * multiple devices (so called "fan-out"). + *

    + * IPP Compatibility: The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class OutputDeviceAssigned extends TextSyntax implements PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 5486733778854271081L; /** * Constructs a new output device assigned attribute with the given device * name and locale. * - * @param deviceName Device name. - * @param locale Natural language of the text string. null - * is interpreted to mean the default locale as returned - * by {@code Locale.getDefault()} - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code deviceName} is null. + * @param deviceName device name + * @param locale natural language of the text string. {@code null} is + * interpreted to mean the default locale as returned by + * {@code Locale.getDefault()} + * @throws NullPointerException if {@code deviceName} is {@code null} */ public OutputDeviceAssigned(String deviceName, Locale locale) { @@ -74,23 +76,19 @@ * Returns whether this output device assigned attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class OutputDeviceAssigned. - *
    3. - * This output device assigned attribute's underlying string and - * {@code object}'s underlying string are equal. - *
    4. - * This output device assigned attribute's locale and - * {@code object}'s locale are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class + * {@code OutputDeviceAssigned}. + *
    3. This output device assigned attribute's underlying string and + * {@code object}'s underlying string are equal. + *
    4. This output device assigned attribute's locale and {@code object}'s + * locale are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this output - * device assigned attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this output + * device assigned attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && @@ -100,12 +98,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class OutputDeviceAssigned, the - * category is class OutputDeviceAssigned itself. + *

    + * For class {@code OutputDeviceAssigned}, the category is class + * {@code OutputDeviceAssigned} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return OutputDeviceAssigned.class; @@ -114,14 +112,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class OutputDeviceAssigned, the - * category name is {@code "output-device-assigned"}. + *

    + * For class {@code OutputDeviceAssigned}, the category name is + * {@code "output-device-assigned"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "output-device-assigned"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PDLOverrideSupported.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PDLOverrideSupported.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PDLOverrideSupported.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,27 +30,29 @@ import javax.print.attribute.PrintServiceAttribute; /** - * Class PDLOverrideSupported is a printing attribute class, an enumeration, - * that expresses the printer's ability to attempt to override processing - * instructions embedded in documents' print data with processing instructions - * specified as attributes outside the print data. - *

    - * IPP Compatibility: The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. + * Class {@code PDLOverrideSupported} is a printing attribute class, an + * enumeration, that expresses the printer's ability to attempt to override + * processing instructions embedded in documents' print data with processing + * instructions specified as attributes outside the print data. + *

    + * IPP Compatibility: The category name returned by {@code getName()} is + * the IPP attribute name. The enumeration's integer value is the IPP enum + * value. The {@code toString()} method returns the IPP string representation of + * the attribute value. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public class PDLOverrideSupported extends EnumSyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -4393264467928463934L; /** * The printer makes no attempt to make the external job attribute values - * take precedence over embedded instructions in the documents' print - * data. + * take precedence over embedded instructions in the documents' print data. */ public static final PDLOverrideSupported NOT_ATTEMPTED = new PDLOverrideSupported(0); @@ -62,36 +65,42 @@ public static final PDLOverrideSupported ATTEMPTED = new PDLOverrideSupported(1); - /** * Construct a new PDL override supported enumeration value with the given * integer value. * - * @param value Integer value. + * @param value Integer value */ protected PDLOverrideSupported(int value) { super (value); } + /** + * The string table for class {@code PDLOverrideSupported}. + */ private static final String[] myStringTable = { "not-attempted", "attempted" }; + /** + * The enumeration value table for class {@code PDLOverrideSupported}. + */ private static final PDLOverrideSupported[] myEnumValueTable = { NOT_ATTEMPTED, ATTEMPTED }; /** - * Returns the string table for class PDLOverrideSupported. + * Returns the string table for class {@code PDLOverrideSupported}. */ protected String[] getStringTable() { return myStringTable.clone(); } /** - * Returns the enumeration value table for class PDLOverrideSupported. + * Returns the enumeration value table for class + * {@code PDLOverrideSupported}. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); @@ -100,12 +109,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PDLOverrideSupported and any vendor-defined subclasses, the - * category is class PDLOverrideSupported itself. + *

    + * For class {@code PDLOverrideSupported} and any vendor-defined subclasses, + * the category is class {@code PDLOverrideSupported} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PDLOverrideSupported.class; @@ -114,14 +123,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PDLOverrideSupported and any vendor-defined subclasses, the - * category name is {@code "pdl-override-supported"}. + *

    + * For class {@code PDLOverrideSupported} and any vendor-defined subclasses, + * the category name is {@code "pdl-override-supported"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "pdl-override-supported"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PageRanges.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PageRanges.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PageRanges.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -26,106 +26,93 @@ package javax.print.attribute.standard; import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.SetOfIntegerSyntax; -import javax.print.attribute.DocAttribute; -import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class PageRanges is a printing attribute class, a set of integers, that - * identifies the range(s) of print-stream pages that the Printer object uses - * for each copy of each document which are to be printed. Nothing is printed - * for any pages identified that do not exist in the document(s). The attribute - * is associated with print-stream pages, not application-numbered pages - * (for example, the page numbers found in the headers and or footers for - * certain word processing applications). - *

    + * Class {@code PageRanges} is a printing attribute class, a set of integers, + * that identifies the range(s) of print-stream pages that the Printer object + * uses for each copy of each document which are to be printed. Nothing is + * printed for any pages identified that do not exist in the document(s). The + * attribute is associated with print-stream pages, not + * application-numbered pages (for example, the page numbers found in the + * headers and or footers for certain word processing applications). + *

    * In most cases, the exact pages to be printed will be generated by a device * driver and this attribute would not be required. However, when printing an * archived document which has already been formatted, the end user may elect to * print just a subset of the pages contained in the document. In this case, if - * a page range of "n-m" is specified, the first page - * to be printed will be page n. All subsequent pages of the document - * will be printed through and including page m. - *

    - * If a PageRanges attribute is not specified for a print job, all pages of - * the document will be printed. In other words, the default value for the - * PageRanges attribute is always {@code {{1, Integer.MAX_VALUE}}}. - *

    - * The effect of a PageRanges attribute on a multidoc print job (a job with - * multiple documents) depends on whether all the docs have the same page ranges - * specified or whether different docs have different page ranges specified, and - * on the (perhaps defaulted) value of the {@link MultipleDocumentHandling - * MultipleDocumentHandling} attribute. - *

      - *
    • - * If all the docs have the same page ranges specified, then any value of {@link - * MultipleDocumentHandling MultipleDocumentHandling} makes sense, and the - * printer's processing depends on the {@link MultipleDocumentHandling - * MultipleDocumentHandling} value: - *
        - *
      • - * SINGLE_DOCUMENT -- All the input docs will be combined together into one - * output document. The specified page ranges of that output document will be - * printed. + * a page range of "n-m" is specified, the first page + * to be printed will be page n. All subsequent pages of the document + * will be printed through and including page m. + *

        + * If a {@code PageRanges} attribute is not specified for a print job, all pages + * of the document will be printed. In other words, the default value for the + * {@code PageRanges} attribute is always {@code {{1, Integer.MAX_VALUE}}}. + *

        + * The effect of a {@code PageRanges} attribute on a multidoc print job (a job + * with multiple documents) depends on whether all the docs have the same page + * ranges specified or whether different docs have different page ranges + * specified, and on the (perhaps defaulted) value of the + * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute. + *

          + *
        • If all the docs have the same page ranges specified, then any value of + * {@link MultipleDocumentHandling MultipleDocumentHandling} makes sense, and + * the printer's processing depends on the + * {@link MultipleDocumentHandling MultipleDocumentHandling} value: + *
            + *
          • {@code SINGLE_DOCUMENT} -- All the input docs will be combined + * together into one output document. The specified page ranges of that + * output document will be printed. + *
          • {@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be + * combined together into one output document, and the first impression of + * each input doc will always start on a new media sheet. The specified page + * ranges of that output document will be printed. + *
          • {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- For each separate + * input doc, the specified page ranges will be printed. + *
          • {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- For each separate input + * doc, the specified page ranges will be printed. + *
          + *
            + *
          • {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- For each separate + * input doc, its own specified page ranges will be printed. + *
          • {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- For each separate input + * doc, its own specified page ranges will be printed. + *
          + *
        + *

        + * IPP Compatibility: The PageRanges attribute's canonical array form + * gives the lower and upper bound for each range of pages to be included in and + * IPP "page-ranges" attribute. See class + * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of canonical + * array form. The category name returned by {@code getName()} gives the IPP + * attribute name. * - *

      • - * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together - * into one output document, and the first impression of each input doc will - * always start on a new media sheet. The specified page ranges of that output - * document will be printed. - * - *
      • - * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- For each separate input doc, the - * specified page ranges will be printed. - * - *
      • - * SEPARATE_DOCUMENTS_COLLATED_COPIES -- For each separate input doc, the - * specified page ranges will be printed. - *
      - *
        - *
      • - * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- For each separate input doc, its own - * specified page ranges will be printed.. - * - *
      • - * SEPARATE_DOCUMENTS_COLLATED_COPIES -- For each separate input doc, its own - * specified page ranges will be printed.. - *
      - *
    - *

    - * IPP Compatibility: The PageRanges attribute's canonical array form - * gives the lower and upper bound for each range of pages to be included in - * and IPP "page-ranges" attribute. See class {@link - * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an - * explanation of canonical array form. The category name returned by - * {@code getName()} gives the IPP attribute name. - * - * @author David Mendenhall - * @author Alan Kaminsky + * @author David Mendenhall + * @author Alan Kaminsky */ public final class PageRanges extends SetOfIntegerSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 8639895197656148392L; - /** - * Construct a new page ranges attribute with the given members. The - * members are specified in "array form;" see class {@link - * javax.print.attribute.SetOfIntegerSyntax SetOfIntegerSyntax} for an - * explanation of array form. - * - * @param members Set members in array form. + * Construct a new page ranges attribute with the given members. The members + * are specified in "array form;" see class + * {@link SetOfIntegerSyntax SetOfIntegerSyntax} for an explanation of array + * form. * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code members} is null or - * any element of {@code members} is null. - * @exception IllegalArgumentException - * (unchecked exception) Thrown if any element of - * {@code members} is not a length-one or length-two array. Also - * thrown if {@code members} is a zero-length array or if any - * member of the set is less than 1. + * @param members set members in array form + * @throws NullPointerException if {@code members} is {@code null} or any + * element of {@code members} is {@code null} + * @throws IllegalArgumentException if any element of {@code members} is not + * a length-one or length-two array. Also if {@code members} is a + * zero-length array or if any member of the set is less than 1. */ public PageRanges(int[][] members) { super (members); @@ -134,24 +121,18 @@ } myPageRanges(); } + /** - * Construct a new page ranges attribute with the given members in - * string form. - * See class {@link javax.print.attribute.SetOfIntegerSyntax - * SetOfIntegerSyntax} - * for explanation of the syntax. - * - * @param members Set members in string form. + * Construct a new page ranges attribute with the given members in string + * form. See class {@link SetOfIntegerSyntax SetOfIntegerSyntax} for + * explanation of the syntax. * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code members} is null or - * any element of {@code members} is null. - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code members} does not - * obey the proper syntax. Also - * thrown if the constructed set-of-integer is a - * zero-length array or if any - * member of the set is less than 1. + * @param members set members in string form + * @throws NullPointerException if {@code members} is {@code null} or any + * element of {@code members} is {@code null} + * @throws IllegalArgumentException if {@code members} does not obey the + * proper syntax. Also if the constructed set-of-integer is a + * zero-length array or if any member of the set is less than 1. */ public PageRanges(String members) { super(members); @@ -161,6 +142,9 @@ myPageRanges(); } + /** + * Validates the page ranges. + */ private void myPageRanges() { int[][] myMembers = getMembers(); int n = myMembers.length; @@ -179,11 +163,8 @@ * Construct a new page ranges attribute containing a single integer. That * is, only the one page is to be printed. * - * @param member Set member. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code member} is less than - * 1. + * @param member set member + * @throws IllegalArgumentException if {@code member < 1} */ public PageRanges(int member) { super (member); @@ -196,13 +177,11 @@ * Construct a new page ranges attribute containing a single range of * integers. That is, only those pages in the one range are to be printed. * - * @param lowerBound Lower bound of the range. - * @param upperBound Upper bound of the range. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if a null range is specified or if a - * non-null range is specified with {@code lowerBound} less than - * 1. + * @param lowerBound lower bound of the range + * @param upperBound upper bound of the range + * @throws IllegalArgumentException if a {@code null} range is specified or + * if a {@code non-null} range is specified with {@code lowerBound} + * less than 1 */ public PageRanges(int lowerBound, int upperBound) { super (lowerBound, upperBound); @@ -214,23 +193,18 @@ } /** - * Returns whether this page ranges attribute is equivalent to the passed - * in object. To be equivalent, all of the following conditions must be - * true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class PageRanges. - *
    3. - * This page ranges attribute's members and {@code object}'s members - * are the same. - *
    + * Returns whether this page ranges attribute is equivalent to the passed in + * object. To be equivalent, all of the following conditions must be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code PageRanges}. + *
    3. This page ranges attribute's members and {@code object}'s members + * are the same. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this page ranges - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this page ranges + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PageRanges); @@ -239,11 +213,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PageRanges, the category is class PageRanges itself. + *

    + * For class {@code PageRanges}, the category is class + * {@code PageRanges} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PageRanges.class; @@ -252,13 +227,12 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PageRanges, the category name is {@code "page-ranges"}. + *

    + * For class {@code PageRanges}, the category name is {@code "page-ranges"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "page-ranges"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PagesPerMinute.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PagesPerMinute.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PagesPerMinute.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,32 +30,31 @@ import javax.print.attribute.PrintServiceAttribute; /** - * Class PagesPerMinute is an integer valued printing attribute that indicates - * the nominal number of pages per minute to the nearest whole number which may - * be generated by this printer (e.g., simplex, black-and-white). This attribute - * is informative, not a service guarantee. Generally, it is the value used in - * the marketing literature to describe the device. A value of 0 indicates a - * device that takes more than two minutes to process a page. - *

    - * IPP Compatibility: The integer value gives the IPP integer value. The - * category name returned by {@code getName()} gives the IPP attribute - * name. + * Class {@code PagesPerMinute} is an integer valued printing attribute that + * indicates the nominal number of pages per minute to the nearest whole number + * which may be generated by this printer (e.g., simplex, black-and-white). This + * attribute is informative, not a service guarantee. Generally, it is the value + * used in the marketing literature to describe the device. A value of 0 + * indicates a device that takes more than two minutes to process a page. + *

    + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class PagesPerMinute extends IntegerSyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -6366403993072862015L; /** - * Construct a new pages per minute attribute with the given integer - * value. + * Construct a new pages per minute attribute with the given integer value. * - * @param value Integer value. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 0. + * @param value Integer value + * @throws IllegalArgumentException if {@code value} is negative */ public PagesPerMinute(int value) { super(value, 0, Integer.MAX_VALUE); @@ -62,22 +62,18 @@ /** * Returns whether this pages per minute attribute is equivalent to the - * passed in object. To be equivalent, all of the following conditions - * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class PagesPerMinute. - *
    3. - * This pages per minute attribute's value and {@code object}'s - * value are equal. - *
    + * passed in object. To be equivalent, all of the following conditions must + * be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code PagesPerMinute}. + *
    3. This pages per minute attribute's value and {@code object}'s value + * are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this pages per - * minute attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this pages per + * minute attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && @@ -87,11 +83,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PagesPerMinute, the category is class PagesPerMinute itself. + *

    + * For class {@code PagesPerMinute}, the category is class + * {@code PagesPerMinute} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PagesPerMinute.class; @@ -100,14 +97,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PagesPerMinute, the - * category name is {@code "pages-per-minute"}. + *

    + * For class {@code PagesPerMinute}, the category name is + * {@code "pages-per-minute"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "pages-per-minute"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PagesPerMinuteColor.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PagesPerMinuteColor.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PagesPerMinuteColor.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,43 +30,44 @@ import javax.print.attribute.PrintServiceAttribute; /** - * Class PagesPerMinuteColor is an integer valued printing attribute that - * indicates the nominal number of pages per minute to the nearest whole number - * which may be generated by this printer when printing color (e.g., simplex, - * color). For purposes of this attribute, "color" means the same as for the - * {@link ColorSupported ColorSupported} attribute, namely, the device is - * capable of any type of color printing at all, including highlight color as + * Class {@code PagesPerMinuteColor} is an integer valued printing attribute + * that indicates the nominal number of pages per minute to the nearest whole + * number which may be generated by this printer when printing color (e.g., + * simplex, color). For purposes of this attribute, "color" means the same as + * for the {@link ColorSupported ColorSupported} attribute, namely, the device + * is capable of any type of color printing at all, including highlight color as * well as full process color. This attribute is informative, not a service * guarantee. Generally, it is the value used in the marketing literature to * describe the color capabilities of this device. A value of 0 indicates a * device that takes more than two minutes to process a page. If a color device * has several color modes, it may use the pages-per- minute value for this * attribute that corresponds to the mode that produces the highest number. - *

    - * A black and white only printer must not include the PagesPerMinuteColor - * attribute in its attribute set or service registration. If this attribute is - * present, then the {@link ColorSupported ColorSupported} printer description - * attribute must also be present and have a value of SUPPORTED. - *

    - * IPP Compatibility: The integer value gives the IPP integer value. The - * category name returned by {@code getName()} gives the IPP attribute - * name. + *

    + * A black and white only printer must not include the + * {@code PagesPerMinuteColor} attribute in its attribute set or service + * registration. If this attribute is present, then the + * {@link ColorSupported ColorSupported} printer description attribute must also + * be present and have a value of {@code SUPPORTED}. + *

    + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class PagesPerMinuteColor extends IntegerSyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ static final long serialVersionUID = 1684993151687470944L; /** * Construct a new pages per minute color attribute with the given integer * value. * - * @param value Integer value. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 0. + * @param value Integer value + * @throws IllegalArgumentException if {@code value} is negative */ public PagesPerMinuteColor(int value) { super(value, 0, Integer.MAX_VALUE); @@ -75,20 +77,16 @@ * Returns whether this pages per minute color attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class PagesPerMinuteColor. - *
    3. - * This pages per minute attribute's value and {@code object}'s - * value are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code PagesPerMinuteColor}. + *
    3. This pages per minute attribute's value and {@code object}'s value + * are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this pages per - * minute color attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this pages per + * minute color attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && @@ -98,12 +96,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PagesPerMinuteColor, the - * category is class PagesPerMinuteColor itself. + *

    + * For class {@code PagesPerMinuteColor}, the category is class + * {@code PagesPerMinuteColor} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PagesPerMinuteColor.class; @@ -112,14 +110,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PagesPerMinuteColor, the - * category name is {@code "pages-per-minute-color"}. + *

    + * For class {@code PagesPerMinuteColor}, the category name is + * {@code "pages-per-minute-color"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "pages-per-minute-color"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PresentationDirection.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PresentationDirection.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PresentationDirection.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -30,81 +31,84 @@ import javax.print.attribute.PrintRequestAttribute; /** - * Class PresentationDirection is a printing attribute class, an enumeration, - * that is used in conjunction with the {@link NumberUp NumberUp} attribute to - * indicate the layout of multiple print-stream pages to impose upon a - * single side of an instance of a selected medium. - * This is useful to mirror the text layout conventions of different scripts. - * For example, English is "toright-tobottom", Hebrew is "toleft-tobottom" - * and Japanese is usually "tobottom-toleft". - *

    - * IPP Compatibility: This attribute is not an IPP 1.1 - * attribute; it is an attribute in the Production Printing Extension - * (PDF) - * of IPP 1.1. The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. + * Class {@code PresentationDirection} is a printing attribute class, an + * enumeration, that is used in conjunction with the {@link NumberUp NumberUp} + * attribute to indicate the layout of multiple print-stream pages to impose + * upon a single side of an instance of a selected medium. This is useful to + * mirror the text layout conventions of different scripts. For example, English + * is "toright-tobottom", Hebrew is "toleft-tobottom" and Japanese is usually + * "tobottom-toleft". + *

    + * IPP Compatibility: This attribute is not an IPP 1.1 attribute; it is + * an attribute in the Production Printing Extension + * (PDF) of IPP + * 1.1. The category name returned by {@code getName()} is the IPP attribute + * name. The enumeration's integer value is the IPP enum value. The + * {@code toString()} method returns the IPP string representation of the + * attribute value. * - * @author Phil Race. + * @author Phil Race */ public final class PresentationDirection extends EnumSyntax implements PrintJobAttribute, PrintRequestAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 8294728067230931780L; /** - * Pages are laid out in columns starting at the top left, - * proceeding towards the bottom {@literal &} right. + * Pages are laid out in columns starting at the top left, proceeding + * towards the bottom {@literal &} right. */ public static final PresentationDirection TOBOTTOM_TORIGHT = new PresentationDirection(0); /** - * Pages are laid out in columns starting at the top right, - * proceeding towards the bottom {@literal &} left. + * Pages are laid out in columns starting at the top right, proceeding + * towards the bottom {@literal &} left. */ public static final PresentationDirection TOBOTTOM_TOLEFT = new PresentationDirection(1); /** - * Pages are laid out in columns starting at the bottom left, - * proceeding towards the top {@literal &} right. + * Pages are laid out in columns starting at the bottom left, proceeding + * towards the top {@literal &} right. */ public static final PresentationDirection TOTOP_TORIGHT = new PresentationDirection(2); /** - * Pages are laid out in columns starting at the bottom right, - * proceeding towards the top {@literal &} left. + * Pages are laid out in columns starting at the bottom right, proceeding + * towards the top {@literal &} left. */ public static final PresentationDirection TOTOP_TOLEFT = new PresentationDirection(3); /** - * Pages are laid out in rows starting at the top left, - * proceeding towards the right {@literal &} bottom. + * Pages are laid out in rows starting at the top left, proceeding towards + * the right {@literal &} bottom. */ public static final PresentationDirection TORIGHT_TOBOTTOM = new PresentationDirection(4); /** - * Pages are laid out in rows starting at the bottom left, - * proceeding towards the right {@literal &} top. + * Pages are laid out in rows starting at the bottom left, proceeding + * towards the right {@literal &} top. */ public static final PresentationDirection TORIGHT_TOTOP = new PresentationDirection(5); /** - * Pages are laid out in rows starting at the top right, - * proceeding towards the left {@literal &} bottom. + * Pages are laid out in rows starting at the top right, proceeding towards + * the left {@literal &} bottom. */ public static final PresentationDirection TOLEFT_TOBOTTOM = new PresentationDirection(6); /** - * Pages are laid out in rows starting at the bottom right, - * proceeding towards the left {@literal &} top. + * Pages are laid out in rows starting at the bottom right, proceeding + * towards the left {@literal &} top. */ public static final PresentationDirection TOLEFT_TOTOP = new PresentationDirection(7); @@ -113,12 +117,15 @@ * Construct a new presentation direction enumeration value with the given * integer value. * - * @param value Integer value. + * @param value Integer value */ private PresentationDirection(int value) { super (value); } + /** + * The string table for class {@code PresentationDirection}. + */ private static final String[] myStringTable = { "tobottom-toright", "tobottom-toleft", @@ -130,6 +137,9 @@ "toleft-totop", }; + /** + * The enumeration value table for class {@code PresentationDirection}. + */ private static final PresentationDirection[] myEnumValueTable = { TOBOTTOM_TORIGHT, TOBOTTOM_TOLEFT, @@ -142,14 +152,15 @@ }; /** - * Returns the string table for class PresentationDirection. + * Returns the string table for class {@code PresentationDirection}. */ protected String[] getStringTable() { return myStringTable; } /** - * Returns the enumeration value table for class PresentationDirection. + * Returns the enumeration value table for class + * {@code PresentationDirection}. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; @@ -158,12 +169,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PresentationDirection - * the category is class PresentationDirection itself. + *

    + * For class {@code PresentationDirection} the category is class + * {@code PresentationDirection} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PresentationDirection.class; @@ -172,14 +183,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PresentationDirection - * the category name is {@code "presentation-direction"}. + *

    + * For class {@code PresentationDirection} the category name is + * {@code "presentation-direction"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "presentation-direction"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrintQuality.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrintQuality.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrintQuality.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,30 +22,35 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; -import javax.print.attribute.DocAttribute; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class PrintQuality is a printing attribute class, an enumeration, + * Class {@code PrintQuality} is a printing attribute class, an enumeration, * that specifies the print quality that the printer uses for the job. - *

    - * IPP Compatibility: The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. + *

    + * IPP Compatibility: The category name returned by {@code getName()} is + * the IPP attribute name. The enumeration's integer value is the IPP enum + * value. The {@code toString()} method returns the IPP string representation of + * the attribute value. * - * @author David Mendenhall - * @author Alan Kaminsky + * @author David Mendenhall + * @author Alan Kaminsky */ public class PrintQuality extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -3072341285225858365L; + /** * Lowest quality available on the printer. */ @@ -65,18 +70,24 @@ * Construct a new print quality enumeration value with the given integer * value. * - * @param value Integer value. + * @param value Integer value */ protected PrintQuality(int value) { super (value); } + /** + * The string table for class {@code PrintQuality}. + */ private static final String[] myStringTable = { "draft", "normal", "high" }; + /** + * The enumeration value table for class {@code PrintQuality}. + */ private static final PrintQuality[] myEnumValueTable = { DRAFT, NORMAL, @@ -84,21 +95,21 @@ }; /** - * Returns the string table for class PrintQuality. + * Returns the string table for class {@code PrintQuality}. */ protected String[] getStringTable() { return myStringTable.clone(); } /** - * Returns the enumeration value table for class PrintQuality. + * Returns the enumeration value table for class {@code PrintQuality}. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } /** - * Returns the lowest integer value used by class PrintQuality. + * Returns the lowest integer value used by class {@code PrintQuality}. */ protected int getOffset() { return 3; @@ -107,12 +118,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrintQuality and any vendor-defined subclasses, the category is - * class PrintQuality itself. + *

    + * For class {@code PrintQuality} and any vendor-defined subclasses, the + * category is class {@code PrintQuality} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrintQuality.class; @@ -121,14 +132,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrintQuality and any vendor-defined subclasses, the category - * name is {@code "print-quality"}. + *

    + * For class {@code PrintQuality} and any vendor-defined subclasses, the + * category name is {@code "print-quality"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "print-quality"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterInfo.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterInfo.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterInfo.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,45 +22,47 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.TextSyntax; -import javax.print.attribute.PrintServiceAttribute; /** - * Class PrinterInfo is a printing attribute class, a text attribute, that - * provides descriptive information about a printer. This could include things - * like: {@code "This printer can be used for printing color transparencies for - * HR presentations"}, or {@code "Out of courtesy for others, please - * print only small (1-5 page) jobs at this printer"}, or even + * Class {@code PrinterInfo} is a printing attribute class, a text attribute, + * that provides descriptive information about a printer. This could include + * things like: {@code "This printer can be used for printing color + * transparencies for HR presentations"}, or {@code "Out of courtesy for others, + * please print only small (1-5 page) jobs at this printer"}, or even * {@code "This printer is going away on July 1, 1997, please find a new * printer"}. - *

    - * IPP Compatibility: The string value gives the IPP name value. The - * locale gives the IPP natural language. The category name returned by - * {@code getName()} gives the IPP attribute name. + *

    + * IPP Compatibility: The string value gives the IPP name value. The + * locale gives the IPP natural language. The category name returned by {@code + * getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class PrinterInfo extends TextSyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 7765280618777599727L; /** - * Constructs a new printer info attribute with the given information - * string and locale. + * Constructs a new printer info attribute with the given information string + * and locale. * - * @param info Printer information string. - * @param locale Natural language of the text string. null - * is interpreted to mean the default locale as returned - * by {@code Locale.getDefault()} - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code info} is null. + * @param info printer information string + * @param locale natural language of the text string. {@code null} is + * interpreted to mean the default locale as returned by + * {@code Locale.getDefault()} + * @throws NullPointerException if {@code info} is {@code null} */ public PrinterInfo(String info, Locale locale) { super (info, locale); @@ -70,23 +72,18 @@ * Returns whether this printer info attribute is equivalent to the passed * in object. To be equivalent, all of the following conditions must be * true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class PrinterInfo. - *
    3. - * This printer info attribute's underlying string and - * {@code object}'s underlying string are equal. - *
    4. - * This printer info attribute's locale and {@code object}'s - * locale are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code PrinterInfo}. + *
    3. This printer info attribute's underlying string and + * {@code object}'s underlying string are equal. + *
    4. This printer info attribute's locale and {@code object}'s locale + * are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this printer - * info attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this printer info + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PrinterInfo); @@ -95,11 +92,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrinterInfo, the category is class PrinterInfo itself. + *

    + * For class {@code PrinterInfo}, the category is class + * {@code PrinterInfo} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrinterInfo.class; @@ -108,13 +106,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrinterInfo, the category name is {@code "printer-info"}. + *

    + * For class {@code PrinterInfo}, the category name is + * {@code "printer-info"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "printer-info"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterIsAcceptingJobs.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterIsAcceptingJobs.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterIsAcceptingJobs.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,26 +30,30 @@ import javax.print.attribute.PrintServiceAttribute; /** - * Class PrinterIsAcceptingJobs is a printing attribute class, an enumeration, - * that indicates whether the printer is currently able to accept jobs. This - * value is independent of the {@link PrinterState PrinterState} and {@link - * PrinterStateReasons PrinterStateReasons} attributes because its value does - * not affect the current job; rather it affects future jobs. If the value is - * NOT_ACCEPTING_JOBS, the printer will reject jobs even when the {@link - * PrinterState PrinterState} is IDLE. If value is ACCEPTING_JOBS, the Printer - * will accept jobs even when the {@link PrinterState PrinterState} is STOPPED. - *

    - * IPP Compatibility: The IPP boolean value is "true" for ACCEPTING_JOBS - * and "false" for NOT_ACCEPTING_JOBS. The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. + * Class {@code PrinterIsAcceptingJobs} is a printing attribute class, an + * enumeration, that indicates whether the printer is currently able to accept + * jobs. This value is independent of the {@link PrinterState PrinterState} and + * {@link PrinterStateReasons PrinterStateReasons} attributes because its value + * does not affect the current job; rather it affects future jobs. If the value + * is {@code NOT_ACCEPTING_JOBS}, the printer will reject jobs even when the + * {@link PrinterState PrinterState} is {@code IDLE}. If value is + * {@code ACCEPTING_JOBS}, the Printer will accept jobs even when the + * {@link PrinterState PrinterState} is {@code STOPPED}. + *

    + * IPP Compatibility: The IPP boolean value is "true" for + * {@code ACCEPTING_JOBS} and "false" for {@code NOT_ACCEPTING_JOBS}. The + * category name returned by {@code getName()} is the IPP attribute name. The + * enumeration's integer value is the IPP enum value. The {@code toString()} + * method returns the IPP string representation of the attribute value. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class PrinterIsAcceptingJobs extends EnumSyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -5052010680537678061L; /** @@ -67,31 +72,38 @@ * Construct a new printer is accepting jobs enumeration value with the * given integer value. * - * @param value Integer value. + * @param value Integer value */ protected PrinterIsAcceptingJobs(int value) { super (value); } + /** + * The string table for class {@code PrinterIsAcceptingJobs}. + */ private static final String[] myStringTable = { "not-accepting-jobs", "accepting-jobs" }; + /** + * The enumeration value table for class {@code PrinterIsAcceptingJobs}. + */ private static final PrinterIsAcceptingJobs[] myEnumValueTable = { NOT_ACCEPTING_JOBS, ACCEPTING_JOBS }; /** - * Returns the string table for class PrinterIsAcceptingJobs. + * Returns the string table for class {@code PrinterIsAcceptingJobs}. */ protected String[] getStringTable() { return myStringTable; } /** - * Returns the enumeration value table for class PrinterIsAcceptingJobs. + * Returns the enumeration value table for class + * {@code PrinterIsAcceptingJobs}. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; @@ -100,12 +112,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrinterIsAcceptingJobs, the - * category is class PrinterIsAcceptingJobs itself. + *

    + * For class {@code PrinterIsAcceptingJobs}, the category is class + * {@code PrinterIsAcceptingJobs} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrinterIsAcceptingJobs.class; @@ -114,14 +126,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrinterIsAcceptingJobs, the - * category name is {@code "printer-is-accepting-jobs"}. + *

    + * For class {@code PrinterIsAcceptingJobs}, the category name is + * {@code "printer-is-accepting-jobs"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "printer-is-accepting-jobs"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterLocation.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterLocation.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterLocation.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,41 +22,43 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.TextSyntax; -import javax.print.attribute.PrintServiceAttribute; /** - * Class PrinterLocation is a printing attribute class, a text attribute, that - * identifies the location of the device. This could include things like: - * {@code "in Room 123A, second floor of building XYZ"}. - *

    - * IPP Compatibility: The string value gives the IPP name value. The + * Class {@code PrinterLocation} is a printing attribute class, a text + * attribute, that identifies the location of the device. This could include + * things like: {@code "in Room 123A, second floor of building XYZ"}. + *

    + * IPP Compatibility: The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class PrinterLocation extends TextSyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -1598610039865566337L; /** * Constructs a new printer location attribute with the given location and * locale. * - * @param location Printer location. - * @param locale Natural language of the text string. null - * is interpreted to mean the default locale as returned - * by {@code Locale.getDefault()} - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code location} is null. + * @param location printer location + * @param locale natural language of the text string. {@code null} is + * interpreted to mean the default locale as returned by + * {@code Locale.getDefault()} + * @throws NullPointerException if {@code location} is {@code null} */ public PrinterLocation(String location, Locale locale) { super (location, locale); @@ -64,25 +66,20 @@ /** * Returns whether this printer location attribute is equivalent to the - * passed in object. To be equivalent, all of the following conditions - * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class PrinterLocation. - *
    3. - * This printer location attribute's underlying string and - * {@code object}'s underlying string are equal. - *
    4. - * This printer location attribute's locale and {@code object}'s - * locale are equal. - *
    + * passed in object. To be equivalent, all of the following conditions must + * be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code PrinterLocation}. + *
    3. This printer location attribute's underlying string and + * {@code object}'s underlying string are equal. + *
    4. This printer location attribute's locale and {@code object}'s + * locale are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this printer - * location attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this printer + * location attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PrinterLocation); @@ -91,12 +88,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrinterLocation, the - * category is class PrinterLocation itself. + *

    + * For class {@code PrinterLocation}, the category is class + * {@code PrinterLocation} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrinterLocation.class; @@ -105,14 +102,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrinterLocation, the - * category name is {@code "printer-location"}. + *

    + * For class {@code PrinterLocation}, the category name is + * {@code "printer-location"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "printer-location"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMakeAndModel.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMakeAndModel.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMakeAndModel.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,39 +22,42 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.Locale; + import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.TextSyntax; -import javax.print.attribute.PrintServiceAttribute; /** - * Class PrinterMakeAndModel is a printing attribute class, a text attribute, - * that the make and model of the printer. - *

    - * IPP Compatibility: The string value gives the IPP name value. The + * Class {@code PrinterMakeAndModel} is a printing attribute class, a text + * attribute, that the make and model of the printer. + *

    + * IPP Compatibility: The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class PrinterMakeAndModel extends TextSyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 4580461489499351411L; /** - * Constructs a new printer make and model attribute with the given make - * and model string and locale. + * Constructs a new printer make and model attribute with the given make and + * model string and locale. * - * @param makeAndModel Printer make and model string. - * @param locale Natural language of the text string. null - * is interpreted to mean the default locale as returned - * by {@code Locale.getDefault()} - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code makeAndModel} is null. + * @param makeAndModel printer make and model string + * @param locale natural language of the text string. {@code null} is + * interpreted to mean the default locale as returned by + * {@code Locale.getDefault()} + * @throws NullPointerException if {@code makeAndModel} is {@code null} */ public PrinterMakeAndModel(String makeAndModel, Locale locale) { super (makeAndModel, locale); @@ -64,23 +67,18 @@ * Returns whether this printer make and model attribute is equivalent to * the passed in object. To be equivalent, all of the following conditions * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class PrinterMakeAndModel. - *
    3. - * This printer make and model attribute's underlying string and - * {@code object}'s underlying string are equal. - *
    4. - * This printer make and model attribute's locale and - * {@code object}'s locale are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code PrinterMakeAndModel}. + *
    3. This printer make and model attribute's underlying string and + * {@code object}'s underlying string are equal. + *
    4. This printer make and model attribute's locale and {@code object}'s + * locale are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this printer - * make and model attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this printer make + * and model attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && @@ -90,12 +88,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrinterMakeAndModel, the - * category is class PrinterMakeAndModel itself. + *

    + * For class {@code PrinterMakeAndModel}, the category is class + * {@code PrinterMakeAndModel} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrinterMakeAndModel.class; @@ -104,14 +102,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrinterMakeAndModel, the - * category name is {@code "printer-make-and-model"}. + *

    + * For class {@code PrinterMakeAndModel}, the category name is + * {@code "printer-make-and-model"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "printer-make-and-model"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMessageFromOperator.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMessageFromOperator.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMessageFromOperator.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,54 +22,54 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.TextSyntax; -import javax.print.attribute.PrintServiceAttribute; /** - * Class PrinterMessageFromOperator is a printing attribute class, a text - * attribute, that provides a message from an operator, system administrator, - * or "intelligent" process to indicate to the end user information about or - * status of the printer, such as why it is unavailable or when it is - * expected to be available. - *

    - * A Print Service's attribute set includes zero instances or one instance of - * a - * PrinterMessageFromOperator attribute, not more than one instance. A new - * PrinterMessageFromOperator attribute replaces an existing - * PrinterMessageFromOperator attribute, if any. In other words, - * PrinterMessageFromOperator is not intended to be a history log. - * If it wishes, the client can detect changes to a Print Service's - * PrinterMessageFromOperator - * attribute and maintain the client's own history log of the - * PrinterMessageFromOperator attribute values. - *

    - * IPP Compatibility: The string value gives the IPP name value. The + * Class {@code PrinterMessageFromOperator} is a printing attribute class, a + * text attribute, that provides a message from an operator, system + * administrator, or "intelligent" process to indicate to the end user + * information about or status of the printer, such as why it is unavailable or + * when it is expected to be available. + *

    + * A Print Service's attribute set includes zero instances or one instance of a + * {@code PrinterMessageFromOperator} attribute, not more than one instance. A + * new {@code PrinterMessageFromOperator} attribute replaces an existing + * {@code PrinterMessageFromOperator} attribute, if any. In other words, + * {@code PrinterMessageFromOperator} is not intended to be a history log. If it + * wishes, the client can detect changes to a Print Service's + * {@code PrinterMessageFromOperator} attribute and maintain the client's own + * history log of the {@code PrinterMessageFromOperator} attribute values. + *

    + * IPP Compatibility: The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class PrinterMessageFromOperator extends TextSyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ static final long serialVersionUID = -4486871203218629318L; /** - * Constructs a new printer message from operator attribute with the - * given message and locale. + * Constructs a new printer message from operator attribute with the given + * message and locale. * - * @param message Message. - * @param locale Natural language of the text string. null - * is interpreted to mean the default locale as returned - * by {@code Locale.getDefault()} - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code message} is null. + * @param message the message + * @param locale natural language of the text string. {@code null} is + * interpreted to mean the default locale as returned by + * {@code Locale.getDefault()} + * @throws NullPointerException if {@code message} is {@code null} */ public PrinterMessageFromOperator(String message, Locale locale) { super (message, locale); @@ -79,24 +79,19 @@ * Returns whether this printer message from operator attribute is * equivalent to the passed in object. To be equivalent, all of the * following conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class - * PrinterMessageFromOperator. - *
    3. - * This printer message from operator attribute's underlying string and - * {@code object}'s underlying string are equal. - *
    4. - * This printer message from operator attribute's locale and - * {@code object}'s locale are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class + * {@code PrinterMessageFromOperator}. + *
    3. This printer message from operator attribute's underlying string + * and {@code object}'s underlying string are equal. + *
    4. This printer message from operator attribute's locale and + * {@code object}'s locale are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this printer - * message from operator attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this printer + * message from operator attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && @@ -106,12 +101,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrinterMessageFromOperator, - * the category is class PrinterMessageFromOperator itself. + *

    + * For class {@code PrinterMessageFromOperator}, the category is class + * {@code PrinterMessageFromOperator} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrinterMessageFromOperator.class; @@ -120,14 +115,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrinterMessageFromOperator, - * the category name is {@code "printer-message-from-operator"}. + *

    + * For class {@code PrinterMessageFromOperator}, the category name is + * {@code "printer-message-from-operator"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "printer-message-from-operator"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMoreInfo.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMoreInfo.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMoreInfo.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,48 +22,50 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.net.URI; import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.URISyntax; -import javax.print.attribute.PrintServiceAttribute; /** - * Class PrinterMoreInfo is a printing attribute class, a URI, that is used to - * obtain more information about this specific printer. For example, this - * could be an HTTP type URI referencing an HTML page accessible to a web - * browser. The information obtained from this URI is intended for end user - * consumption. Features outside the scope of the Print Service API can be - * accessed from this URI. - * The information is intended to be specific to this printer instance and - * site specific services (e.g. job pricing, services offered, end user - * assistance). - *

    - * In contrast, the {@link PrinterMoreInfoManufacturer - * PrinterMoreInfoManufacturer} attribute is used to find out more information - * about this general kind of printer rather than this specific printer. - *

    - * IPP Compatibility: The string form returned by - * {@code toString()} gives the IPP uri value. - * The category name returned by {@code getName()} + * Class {@code PrinterMoreInfo} is a printing attribute class, a {@code URI}, + * that is used to obtain more information about this specific printer. For + * example, this could be an HTTP type {@code URI} referencing an HTML page + * accessible to a web browser. The information obtained from this {@code URI} + * is intended for end user consumption. Features outside the scope of the Print + * Service API can be accessed from this {@code URI}. The information is + * intended to be specific to this printer instance and site specific services + * (e.g. job pricing, services offered, end user assistance). + *

    + * In contrast, the + * {@link PrinterMoreInfoManufacturer PrinterMoreInfoManufacturer} attribute is + * used to find out more information about this general kind of printer rather + * than this specific printer. + *

    + * IPP Compatibility: The string form returned by {@code toString()} + * gives the IPP uri value. The category name returned by {@code getName()} * gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class PrinterMoreInfo extends URISyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 4555850007675338574L; /** - * Constructs a new printer more info attribute with the specified URI. + * Constructs a new printer more info attribute with the specified + * {@code URI}. * - * @param uri URI. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code uri} is null. + * @param uri {@code URI} + * @throws NullPointerException if {@code uri} is {@code null} */ public PrinterMoreInfo(URI uri) { super (uri); @@ -71,22 +73,18 @@ /** * Returns whether this printer more info attribute is equivalent to the - * passed in object. To be equivalent, all of the following conditions - * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class PrinterMoreInfo. - *
    3. - * This printer more info attribute's URI and {@code object}'s URI - * are equal. - *
    + * passed in object. To be equivalent, all of the following conditions must + * be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code PrinterMoreInfo}. + *
    3. This printer more info attribute's {@code URI} and {@code object}'s + * {@code URI} are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this printer - * more info attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this printer more + * info attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && @@ -96,11 +94,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrinterMoreInfo, the category is class PrinterMoreInfo itself. + *

    + * For class {@code PrinterMoreInfo}, the category is class + * {@code PrinterMoreInfo} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrinterMoreInfo.class; @@ -109,14 +108,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrinterMoreInfo, the - * category name is {@code "printer-more-info"}. + *

    + * For class {@code PrinterMoreInfo}, the category name is + * {@code "printer-more-info"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "printer-more-info"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,49 +22,49 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.net.URI; import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.URISyntax; -import javax.print.attribute.PrintServiceAttribute; /** - * Class PrinterMoreInfoManufacturer is a printing attribute class, a URI, - * that is used to obtain more information about this type of device. - * The information obtained from this URI is intended for end user - * consumption. Features outside the scope of the Print Service API - * can be accessed from this URI (e.g., - * latest firmware, upgrades, service proxies, optional features available, - * details on color support). The information is intended to be germane to - * this kind of printer without regard to site specific modifications or - * services. - *

    - * In contrast, the {@link PrinterMoreInfo PrinterMoreInfo} attribute is used - * to find out more information about this specific printer rather than this + * Class {@code PrinterMoreInfoManufacturer} is a printing attribute class, a + * {@code URI}, that is used to obtain more information about this type of + * device. The information obtained from this {@code URI} is intended for end + * user consumption. Features outside the scope of the Print Service API can be + * accessed from this {@code URI} (e.g., latest firmware, upgrades, service + * proxies, optional features available, details on color support). The + * information is intended to be germane to this kind of printer without regard + * to site specific modifications or services. + *

    + * In contrast, the {@link PrinterMoreInfo PrinterMoreInfo} attribute is used to + * find out more information about this specific printer rather than this * general kind of printer. - *

    - * IPP Compatibility: The string form returned by - * {@code toString()} gives the IPP uri value. - * The category name returned by {@code getName()} + *

    + * IPP Compatibility: The string form returned by {@code toString()} + * gives the IPP uri value. The category name returned by {@code getName()} * gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class PrinterMoreInfoManufacturer extends URISyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 3323271346485076608L; /** * Constructs a new printer more info manufacturer attribute with the - * specified URI. + * specified {@code URI}. * - * @param uri URI. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code uri} is null. + * @param uri {@code URI} + * @throws NullPointerException if {@code uri} is {@code null} */ public PrinterMoreInfoManufacturer(URI uri) { super (uri); @@ -74,21 +74,17 @@ * Returns whether this printer more info manufacturer attribute is * equivalent to the passed in object. To be equivalent, all of the * following conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class - * PrinterMoreInfoManufacturer. - *
    3. - * This printer more info manufacturer attribute's URI and - * {@code object}'s URI are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class + * {@code PrinterMoreInfoManufacturer}. + *
    3. This printer more info manufacturer attribute's {@code URI} and + * {@code object}'s {@code URI} are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this printer - * more info manufacturer attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this printer more + * info manufacturer attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && @@ -98,12 +94,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrinterMoreInfoManufacturer, the category is - * class PrinterMoreInfoManufacturer itself. + *

    + * For class {@code PrinterMoreInfoManufacturer}, the category is class + * {@code PrinterMoreInfoManufacturer} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrinterMoreInfoManufacturer.class; @@ -112,14 +108,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrinterMoreInfoManufacturer, the category name is + *

    + * For class {@code PrinterMoreInfoManufacturer}, the category name is * {@code "printer-more-info-manufacturer"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "printer-more-info-manufacturer"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterName.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterName.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterName.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,43 +22,45 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.TextSyntax; -import javax.print.attribute.PrintServiceAttribute; /** - * Class PrinterName is a printing attribute class, a text attribute, that - * specifies the name of a printer. It is a name that is more end-user friendly - * than a URI. An administrator determines a printer's name and sets this - * attribute to that name. This name may be the last part of the printer's URI - * or it may be unrelated. In non-US-English locales, a name may contain - * characters that are not allowed in a URI. - *

    - * IPP Compatibility: The string value gives the IPP name value. The + * Class {@code PrinterName} is a printing attribute class, a text attribute, + * that specifies the name of a printer. It is a name that is more end-user + * friendly than a {@code URI}. An administrator determines a printer's name and + * sets this attribute to that name. This name may be the last part of the + * printer's {@code URI} or it may be unrelated. In non-US-English locales, a + * name may contain characters that are not allowed in a {@code URI}. + *

    + * IPP Compatibility: The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class PrinterName extends TextSyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 299740639137803127L; /** * Constructs a new printer name attribute with the given name and locale. * - * @param printerName Printer name. - * @param locale Natural language of the text string. null - * is interpreted to mean the default locale as returned - * by {@code Locale.getDefault()} - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code printerName} is null. + * @param printerName printer name + * @param locale natural language of the text string. {@code null} is + * interpreted to mean the default locale as returned by + * {@code Locale.getDefault()} + * @throws NullPointerException if {@code printerName} is {@code null} */ public PrinterName(String printerName, Locale locale) { super (printerName, locale); @@ -68,23 +70,18 @@ * Returns whether this printer name attribute is equivalent to the passed * in object. To be equivalent, all of the following conditions must be * true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class PrinterName. - *
    3. - * This printer name attribute's underlying string and - * {@code object}'s underlying string are equal. - *
    4. - * This printer name attribute's locale and {@code object}'s locale - * are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code PrinterName}. + *
    3. This printer name attribute's underlying string and + * {@code object}'s underlying string are equal. + *
    4. This printer name attribute's locale and {@code object}'s locale + * are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this printer - * name attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this printer name + * attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PrinterName); @@ -93,12 +90,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrinterName, the category is - * class PrinterName itself. + *

    + * For class {@code PrinterName}, the category is class + * {@code PrinterName} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrinterName.class; @@ -107,14 +104,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrinterName, the category - * name is {@code "printer-name"}. + *

    + * For class {@code PrinterName}, the category name is + * {@code "printer-name"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "printer-name"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterResolution.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterResolution.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterResolution.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,71 +22,66 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.ResolutionSyntax; -import javax.print.attribute.DocAttribute; -import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class PrinterResolution is a printing attribute class that specifies an - * exact resolution supported by a printer or to be used for a print job. + * Class {@code PrinterResolution} is a printing attribute class that specifies + * an exact resolution supported by a printer or to be used for a print job. * This attribute assumes that printers have a small set of device resolutions * at which they can operate rather than a continuum. *

    - * PrinterResolution is used in multiple ways: - *

      - *
    1. - * When a client searches looking for a printer that supports the client's - * desired resolution exactly (no more, no less), the client specifies - * an instance of class PrinterResolution indicating the exact resolution the - * client wants. Only printers supporting that exact resolution will match the - * search. + * {@code PrinterResolution} is used in multiple ways: + *
        + *
      1. When a client searches looking for a printer that supports the client's + * desired resolution exactly (no more, no less), the client specifies an + * instance of class {@code PrinterResolution} indicating the exact resolution + * the client wants. Only printers supporting that exact resolution will match + * the search. + *
      2. When a client needs to print a job using the client's desired + * resolution exactly (no more, no less), the client specifies an instance of + * class {@code PrinterResolution} as an attribute of the Print Job. This will + * fail if the Print Job doesn't support that exact resolution, and + * {@code Fidelity} is set to true. + *
      + * If a client wants to locate a printer supporting a resolution greater than + * some required minimum, then it may be necessary to exclude this attribute + * from a lookup request and to directly query the set of supported resolutions, + * and specify the one that most closely meets the client's requirements. In + * some cases this may be more simply achieved by specifying a + * {@code PrintQuality} attribute which often controls resolution. + *

      + * IPP Compatibility: The information needed to construct an IPP + * {@code "printer-resolution"} attribute can be obtained by calling methods on + * the PrinterResolution object. The category name returned by {@code getName()} + * gives the IPP attribute name. * - *

    2. - * When a client needs to print a job using the client's desired resolution - * exactly (no more, no less), the client specifies an instance of class - * PrinterResolution as an attribute of the Print Job. This will fail if the - * Print Job doesn't support that exact resolution, and Fidelity is set to - * true. - *
    - * If a client wants to locate a printer supporting a resolution - * greater than some required minimum, then it may be necessary to exclude - * this attribute from a lookup request and to directly query the set of - * supported resolutions, and specify the one that most closely meets - * the client's requirements. - * In some cases this may be more simply achieved by specifying a - * PrintQuality attribute which often controls resolution. - *

    - * IPP Compatibility: The information needed to construct an IPP - * {@code "printer-resolution"} attribute can be obtained by calling - * methods on the PrinterResolution object. The category name returned by - * {@code getName()} gives the IPP attribute name. - * - * @author David Mendenhall - * @author Alan Kaminsky + * @author David Mendenhall + * @author Alan Kaminsky */ public final class PrinterResolution extends ResolutionSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 13090306561090558L; /** * Construct a new printer resolution attribute from the given items. * - * @param crossFeedResolution - * Cross feed direction resolution. - * @param feedResolution - * Feed direction resolution. - * @param units - * Unit conversion factor, e.g. {@code ResolutionSyntax.DPI} - * or {@code ResolutionSyntax.DPCM}. - * - * @exception IllegalArgumentException - * (unchecked exception) Thrown if {@code crossFeedResolution < 1} or - * {@code feedResolution < 1} or {@code units < 1}. + * @param crossFeedResolution cross feed direction resolution + * @param feedResolution feed direction resolution + * @param units unit conversion factor, e.g. {@code ResolutionSyntax.DPI} + * or {@code ResolutionSyntax.DPCM} + * @throws IllegalArgumentException if {@code crossFeedResolution < 1} or + * {@code feedResolution < 1} or {@code units < 1} */ public PrinterResolution(int crossFeedResolution, int feedResolution, int units) { @@ -95,25 +90,20 @@ /** * Returns whether this printer resolution attribute is equivalent to the - * passed in object. To be equivalent, all of the following conditions - * must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class PrinterResolution. - *
    3. - * This attribute's cross feed direction resolution is equal to - * {@code object}'s cross feed direction resolution. - *
    4. - * This attribute's feed direction resolution is equal to - * {@code object}'s feed direction resolution. - *
    + * passed in object. To be equivalent, all of the following conditions must + * be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code PrinterResolution}. + *
    3. This attribute's cross feed direction resolution is equal to + * {@code object}'s cross feed direction resolution. + *
    4. This attribute's feed direction resolution is equal to + * {@code object}'s feed direction resolution. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this printer - * resolution attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this printer + * resolution attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && @@ -123,27 +113,27 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrinterResolution, the category is class PrinterResolution itself. + *

    + * For class {@code PrinterResolution}, the category is class + * {@code PrinterResolution} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrinterResolution.class; - } + } /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrinterResolution, the - * category name is {@code "printer-resolution"}. + *

    + * For class {@code PrinterResolution}, the category name is + * {@code "printer-resolution"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "printer-resolution"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterState.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterState.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterState.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,25 +30,28 @@ import javax.print.attribute.PrintServiceAttribute; /** - * Class PrinterState is a printing attribute class, an enumeration, that - * identifies the current state of a printer. Class PrinterState defines - * standard printer state values. A Print Service implementation only needs - * to report those printer states which are appropriate for the particular + * Class {@code PrinterState} is a printing attribute class, an enumeration, + * that identifies the current state of a printer. Class {@code PrinterState} + * defines standard printer state values. A Print Service implementation only + * needs to report those printer states which are appropriate for the particular * implementation; it does not have to report every defined printer state. The * {@link PrinterStateReasons PrinterStateReasons} attribute augments the - * PrinterState attribute to give more detailed information about the printer - * in given printer state. - *

    - * IPP Compatibility: The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. + * {@code PrinterState} attribute to give more detailed information about the + * printer in given printer state. + *

    + * IPP Compatibility: The category name returned by {@code getName()} is + * the IPP attribute name. The enumeration's integer value is the IPP enum + * value. The {@code toString()} method returns the IPP string representation of + * the attribute value. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class PrinterState extends EnumSyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -649578618346507718L; /** @@ -61,8 +65,7 @@ public static final PrinterState IDLE = new PrinterState(3); /** - * Indicates that jobs are processing; - * new jobs will wait before processing. + * Indicates that jobs are processing; new jobs will wait before processing. */ public static final PrinterState PROCESSING = new PrinterState(4); @@ -75,12 +78,15 @@ * Construct a new printer state enumeration value with the given integer * value. * - * @param value Integer value. + * @param value Integer value */ protected PrinterState(int value) { super (value); } + /** + * The string table for class {@code PrinterState}. + */ private static final String[] myStringTable = { "unknown", null, @@ -90,6 +96,9 @@ "stopped" }; + /** + * The enumeration value table for class {@code PrinterState}. + */ private static final PrinterState[] myEnumValueTable = { UNKNOWN, null, @@ -100,14 +109,14 @@ }; /** - * Returns the string table for class PrinterState. + * Returns the string table for class {@code PrinterState}. */ protected String[] getStringTable() { return myStringTable; } /** - * Returns the enumeration value table for class PrinterState. + * Returns the enumeration value table for class {@code PrinterState}. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; @@ -116,11 +125,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrinterState, the category is class PrinterState itself. + *

    + * For class {@code PrinterState}, the category is class + * {@code PrinterState} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrinterState.class; @@ -129,13 +139,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrinterState, the category name is {@code "printer-state"}. + *

    + * For class {@code PrinterState}, the category name is + * {@code "printer-state"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "printer-state"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterStateReason.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterStateReason.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterStateReason.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,50 +22,51 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; -import javax.print.attribute.Attribute; /** - * Class PrinterStateReason is a printing attribute class, an enumeration, - * that provides additional information about the printer's current state, - * i.e., information that augments the value of the printer's - * {@link PrinterState PrinterState} attribute. - * Class PrinterStateReason defines standard printer - * state reason values. A Print Service implementation only needs to report - * those printer state reasons which are appropriate for the particular - * implementation; it does not have to report every defined printer state - * reason. - *

    - * Instances of PrinterStateReason do not appear in a Print Service's - * attribute set directly. - * Rather, a {@link PrinterStateReasons PrinterStateReasons} - * attribute appears in the Print Service's attribute set. The {@link - * PrinterStateReasons PrinterStateReasons} attribute contains zero, one, or - * more than one PrinterStateReason objects which pertain to the - * Print Service's status, and each PrinterStateReason object is - * associated with a {@link Severity Severity} level of REPORT (least severe), - * WARNING, or ERROR (most severe). The printer adds a PrinterStateReason - * object to the Print Service's + * Class {@code PrinterStateReason} is a printing attribute class, an + * enumeration, that provides additional information about the printer's current + * state, i.e., information that augments the value of the printer's + * {@link PrinterState PrinterState} attribute. Class PrinterStateReason defines + * standard printer state reason values. A Print Service implementation only + * needs to report those printer state reasons which are appropriate for the + * particular implementation; it does not have to report every defined printer + * state reason. + *

    + * Instances of {@code PrinterStateReason} do not appear in a Print Service's + * attribute set directly. Rather, a + * {@link PrinterStateReasons PrinterStateReasons} attribute appears in the + * Print Service's attribute set. The + * {@link PrinterStateReasons PrinterStateReasons} attribute contains zero, one, + * or more than one {@code PrinterStateReason} objects which pertain to the + * Print Service's status, and each PrinterStateReason object is associated with + * a {@link Severity Severity} level of {@code REPORT} (least severe), + * {@code WARNING}, or {@code ERROR} (most severe). The printer adds a + * {@code PrinterStateReason} object to the Print Service's * {@link PrinterStateReasons PrinterStateReasons} attribute when the - * corresponding condition becomes true of the printer, and the printer - * removes the PrinterStateReason object again when the corresponding - * condition becomes false, regardless of whether the Print Service's overall + * corresponding condition becomes true of the printer, and the printer removes + * the {@code PrinterStateReason} object again when the corresponding condition + * becomes false, regardless of whether the Print Service's overall * {@link PrinterState PrinterState} also changed. - *

    - * IPP Compatibility: - * The string values returned by each individual {@link PrinterStateReason} and - * associated {@link Severity} object's {@code toString()} - * methods, concatenated together with a hyphen ({@code "-"}) in - * between, gives the IPP keyword value for a {@link PrinterStateReasons}. - * The category name returned by {@code getName()} gives the IPP - * attribute name. + *

    + * IPP Compatibility: The string values returned by each individual + * {@link PrinterStateReason} and associated {@link Severity} object's + * {@code toString()} methods, concatenated together with a hyphen ({@code "-"}) + * in between, gives the IPP keyword value for a {@link PrinterStateReasons}. + * The category name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public class PrinterStateReason extends EnumSyntax implements Attribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -1623720656201472593L; /** @@ -87,51 +88,48 @@ /** * Someone has paused the printer, but the device(s) are taking an - * appreciable time to stop. Later, when all output has stopped, - * the {@link PrinterState PrinterState} becomes STOPPED, - * and the PAUSED value replaces - * the MOVING_TO_PAUSED value in the {@link PrinterStateReasons - * PrinterStateReasons} attribute. This value must be supported if the - * printer can be paused and the implementation takes significant time to - * pause a device in certain circumstances. + * appreciable time to stop. Later, when all output has stopped, the + * {@link PrinterState PrinterState} becomes {@code STOPPED}, and the + * {@code PAUSED} value replaces the {@code MOVING_TO_PAUSED} value in the + * {@link PrinterStateReasons PrinterStateReasons} attribute. This value + * must be supported if the printer can be paused and the implementation + * takes significant time to pause a device in certain circumstances. */ public static final PrinterStateReason MOVING_TO_PAUSED = new PrinterStateReason(3); /** - * Someone has paused the printer and the printer's {@link PrinterState - * PrinterState} is STOPPED. In this state, a printer must not produce - * printed output, but it must perform other operations requested by a - * client. If a printer had been printing a job when the printer was - * paused, - * the Printer must resume printing that job when the printer is no longer - * paused and leave no evidence in the printed output of such a pause. - * This value must be supported if the printer can be paused. + * Someone has paused the printer and the printer's + * {@link PrinterState PrinterState} is {@code STOPPED}. In this state, a + * printer must not produce printed output, but it must perform other + * operations requested by a client. If a printer had been printing a job + * when the printer was paused, the {@code Printer} must resume printing + * that job when the printer is no longer paused and leave no evidence in + * the printed output of such a pause. This value must be supported if the + * printer can be paused. */ public static final PrinterStateReason PAUSED = new PrinterStateReason(4); /** - * Someone has removed a printer from service, and the device may be - * powered down or physically removed. - * In this state, a printer must not produce - * printed output, and unless the printer is realized by a print server - * that is still active, the printer must perform no other operations - * requested by a client. - * If a printer had been printing a job when it was shut down, + * Someone has removed a printer from service, and the device may be powered + * down or physically removed. In this state, a printer must not produce + * printed output, and unless the printer is realized by a print server that + * is still active, the printer must perform no other operations requested + * by a client. If a printer had been printing a job when it was shut down, * the printer need not resume printing that job when the printer is no * longer shut down. If the printer resumes printing such a job, it may * leave evidence in the printed output of such a shutdown, e.g. the part * printed before the shutdown may be printed a second time after the * shutdown. - */ + */ public static final PrinterStateReason SHUTDOWN = new PrinterStateReason(5); /** * The printer has scheduled a job on the output device and is in the - * process of connecting to a shared network output device (and might not - * be able to actually start printing the job for an arbitrarily long time + * process of connecting to a shared network output device (and might not be + * able to actually start printing the job for an arbitrarily long time * depending on the usage of the output device by other servers on the * network). */ @@ -146,14 +144,13 @@ TIMED_OUT = new PrinterStateReason(7); /** - * The printer is in the process of stopping the device and will be - * stopped in a while. - * When the device is stopped, the printer will change the - * {@link PrinterState PrinterState} to STOPPED. The STOPPING reason is - * never an error, even for a printer with a single output device. When an - * output device ceases accepting jobs, the printer's {@link - * PrinterStateReasons PrinterStateReasons} will have this reason while - * the output device completes printing. + * The printer is in the process of stopping the device and will be stopped + * in a while. When the device is stopped, the printer will change the + * {@link PrinterState PrinterState} to {@code STOPPED}. The + * {@code STOPPING} reason is never an error, even for a printer with a + * single output device. When an output device ceases accepting jobs, the + * printer's {@link PrinterStateReasons PrinterStateReasons} will have this + * reason while the output device completes printing. */ public static final PrinterStateReason STOPPING = new PrinterStateReason(8); @@ -161,10 +158,9 @@ /** * When a printer controls more than one output device, this reason * indicates that one or more output devices are stopped. If the reason's - * severity is a report, fewer than half of the output devices are - * stopped. - * If the reason's severity is a warning, half or more but fewer than - * all of the output devices are stopped. + * severity is a report, fewer than half of the output devices are stopped. + * If the reason's severity is a warning, half or more but fewer than all of + * the output devices are stopped. */ public static final PrinterStateReason STOPPED_PARTLY = new PrinterStateReason(9); @@ -182,12 +178,10 @@ TONER_EMPTY = new PrinterStateReason(11); /** - * The limit of persistent storage allocated for spooling has been - * reached. + * The limit of persistent storage allocated for spooling has been reached. * The printer is temporarily unable to accept more jobs. The printer will - * remove this reason when it is able to accept more jobs. - * This value should be used by a non-spooling printer that only - * accepts one or a small number + * remove this reason when it is able to accept more jobs. This value should + * be used by a non-spooling printer that only accepts one or a small number * jobs at a time or a spooling printer that has filled the spool space. */ public static final PrinterStateReason @@ -236,8 +230,7 @@ OUTPUT_TRAY_MISSING = new PrinterStateReason(19); /** - * One or more output areas are almost full - * (e.g. tray, stacker, collator). + * One or more output areas are almost full (e.g. tray, stacker, collator). */ public static final PrinterStateReason OUTPUT_AREA_ALMOST_FULL = new PrinterStateReason(20); @@ -317,15 +310,18 @@ INTERPRETER_RESOURCE_UNAVAILABLE = new PrinterStateReason(32); /** - * Construct a new printer state reason enumeration value with - * the given integer value. + * Construct a new printer state reason enumeration value with the given + * integer value. * - * @param value Integer value. + * @param value Integer value */ protected PrinterStateReason(int value) { super (value); } + /** + * The string table for class {@code PrinterStateReason}. + */ private static final String[] myStringTable = { "other", "media-needed", @@ -362,6 +358,9 @@ "interpreter-resource-unavailable" }; + /** + * The enumeration value table for class {@code PrinterStateReason}. + */ private static final PrinterStateReason[] myEnumValueTable = { OTHER, MEDIA_NEEDED, @@ -399,29 +398,28 @@ }; /** - * Returns the string table for class PrinterStateReason. + * Returns the string table for class {@code PrinterStateReason}. */ protected String[] getStringTable() { return myStringTable.clone(); } /** - * Returns the enumeration value table for class PrinterStateReason. + * Returns the enumeration value table for class {@code PrinterStateReason}. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); } - /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrinterStateReason and any vendor-defined subclasses, the - * category is class PrinterStateReason itself. + *

    + * For class {@code PrinterStateReason} and any vendor-defined subclasses, + * the category is class {@code PrinterStateReason} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrinterStateReason.class; @@ -430,14 +428,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrinterStateReason and any vendor-defined subclasses, the - * category name is {@code "printer-state-reason"}. + *

    + * For class {@code PrinterStateReason} and any vendor-defined subclasses, + * the category name is {@code "printer-state-reason"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "printer-state-reason"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterStateReasons.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterStateReasons.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterStateReasons.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,69 +22,72 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.AbstractSet; +import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.NoSuchElementException; -import java.util.HashMap; import java.util.Set; import javax.print.attribute.Attribute; import javax.print.attribute.PrintServiceAttribute; /** - * Class PrinterStateReasons is a printing attribute class, a set of - * enumeration values, that provides additional information about the - * printer's current state, i.e., information that augments the value of the - * printer's {@link PrinterState PrinterState} attribute. - *

    - * Instances of {@link PrinterStateReason PrinterStateReason} do not appear in - * a Print Service's attribute set directly. Rather, a PrinterStateReasons + * Class {@code PrinterStateReasons} is a printing attribute class, a set of + * enumeration values, that provides additional information about the printer's + * current state, i.e., information that augments the value of the printer's + * {@link PrinterState PrinterState} attribute. + *

    + * Instances of {@link PrinterStateReason PrinterStateReason} do not appear in a + * Print Service's attribute set directly. Rather, a {@code PrinterStateReasons} * attribute appears in the Print Service's attribute set. The - * PrinterStateReasons attribute contains zero, one, or more than one {@link - * PrinterStateReason PrinterStateReason} objects which pertain to the Print - * Service's status, and each {@link PrinterStateReason PrinterStateReason} - * object is associated with a {@link Severity Severity} level of REPORT - * (least severe), WARNING, or ERROR (most severe). The printer adds a {@link - * PrinterStateReason PrinterStateReason} object to the Print Service's - * PrinterStateReasons attribute when the corresponding condition becomes true - * of the printer, and the printer removes the {@link PrinterStateReason - * PrinterStateReason} object again when the corresponding condition becomes - * false, regardless of whether the Print Service's overall - * {@link PrinterState PrinterState} also changed. - *

    - * Class PrinterStateReasons inherits its implementation from class {@link - * java.util.HashMap java.util.HashMap}. Each entry in the map consists of a + * {@code PrinterStateReasons} attribute contains zero, one, or more than one + * {@link PrinterStateReason PrinterStateReason} objects which pertain to the + * Print Service's status, and each + * {@link PrinterStateReason PrinterStateReason} object is associated with a + * {@link Severity Severity} level of {@code REPORT} (least severe), + * {@code WARNING}, or {@code ERROR} (most severe). The printer adds a + * {@link PrinterStateReason PrinterStateReason} object to the Print Service's + * {@code PrinterStateReasons} attribute when the corresponding condition + * becomes true of the printer, and the printer removes the + * {@link PrinterStateReason PrinterStateReason} object again when the + * corresponding condition becomes false, regardless of whether the Print + * Service's overall {@link PrinterState PrinterState} also changed. + *

    + * Class PrinterStateReasons inherits its implementation from class + * {@link HashMap java.util.HashMap}. Each entry in the map consists of a * {@link PrinterStateReason PrinterStateReason} object (key) mapping to a * {@link Severity Severity} object (value): - *

    + *

    * Unlike most printing attributes which are immutable once constructed, class - * PrinterStateReasons is designed to be mutable; you can add {@link - * PrinterStateReason PrinterStateReason} objects to an existing - * PrinterStateReasons object and remove them again. However, like class - * {@link java.util.HashMap java.util.HashMap}, class PrinterStateReasons is - * not multiple thread safe. If a PrinterStateReasons object will be used by + * {@code PrinterStateReasons} is designed to be mutable; you can add + * {@link PrinterStateReason PrinterStateReason} objects to an existing + * {@code PrinterStateReasons} object and remove them again. However, like class + * {@link HashMap java.util.HashMap}, class {@code PrinterStateReasons} is not + * multiple thread safe. If a {@code PrinterStateReasons} object will be used by * multiple threads, be sure to synchronize its operations (e.g., using a * synchronized map view obtained from class {@link java.util.Collections * java.util.Collections}). - *

    - * IPP Compatibility: The string values returned by each individual + *

    + * IPP Compatibility: The string values returned by each individual * {@link PrinterStateReason PrinterStateReason} object's and the associated - * {@link Severity Severity} object's {@code toString()} methods, - * concatenated - * together with a hyphen ({@code "-"}) in between, gives the IPP keyword - * value. The category name returned by {@code getName()} gives the IPP - * attribute name. + * {@link Severity Severity} object's {@code toString()} methods, concatenated + * together with a hyphen ({@code "-"}) in between, gives the IPP keyword value. + * The category name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class PrinterStateReasons extends HashMap implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -3731791085163619457L; /** @@ -96,13 +99,11 @@ } /** - * super a new, empty printer state reasons attribute; the underlying + * Construct a new, empty printer state reasons attribute; the underlying * hash map has the given initial capacity and the default load factor. * - * @param initialCapacity Initial capacity. - * - * @throws IllegalArgumentException if the initial capacity is less - * than zero. + * @param initialCapacity initial capacity + * @throws IllegalArgumentException if the initial capacity is negative */ public PrinterStateReasons(int initialCapacity) { super (initialCapacity); @@ -112,11 +113,9 @@ * Construct a new, empty printer state reasons attribute; the underlying * hash map has the given initial capacity and load factor. * - * @param initialCapacity Initial capacity. - * @param loadFactor Load factor. - * - * @throws IllegalArgumentException if the initial capacity is less - * than zero. + * @param initialCapacity initial capacity + * @param loadFactor load factor + * @throws IllegalArgumentException if the initial capacity is negative */ public PrinterStateReasons(int initialCapacity, float loadFactor) { super (initialCapacity, loadFactor); @@ -127,19 +126,15 @@ * {@link PrinterStateReason PrinterStateReason}-to-{@link Severity * Severity} mappings as the given map. The underlying hash map's initial * capacity and load factor are as specified in the superclass constructor - * {@link java.util.HashMap#HashMap(java.util.Map) - * HashMap(Map)}. - * - * @param map Map to copy. + * {@link HashMap#HashMap(Map) HashMap(Map)}. * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code map} is null or if any - * key or value in {@code map} is null. - * @throws ClassCastException - * (unchecked exception) Thrown if any key in {@code map} is not - * an instance of class {@link PrinterStateReason PrinterStateReason} or - * if any value in {@code map} is not an instance of class - * {@link Severity Severity}. + * @param map map to copy + * @throws NullPointerException if {@code map} is {@code null} or if any key + * or value in {@code map} is {@code null} + * @throws ClassCastException if any key in {@code map} is not an instance + * of class {@link PrinterStateReason PrinterStateReason} or if any + * value in {@code map} is not an instance of class + * {@link Severity Severity} */ public PrinterStateReasons(Map map) { this(); @@ -149,27 +144,23 @@ /** * Adds the given printer state reason to this printer state reasons - * attribute, associating it with the given severity level. If this - * printer state reasons attribute previously contained a mapping for the - * given printer state reason, the old value is replaced. - * - * @param reason Printer state reason. This must be an instance of - * class {@link PrinterStateReason PrinterStateReason}. - * @param severity Severity of the printer state reason. This must be - * an instance of class {@link Severity Severity}. + * attribute, associating it with the given severity level. If this printer + * state reasons attribute previously contained a mapping for the given + * printer state reason, the old value is replaced. * - * @return Previous severity associated with the given printer state - * reason, or {@code null} if the given printer state reason was - * not present. - * - * @throws NullPointerException - * (unchecked exception) Thrown if {@code reason} is null or - * {@code severity} is null. - * @throws ClassCastException - * (unchecked exception) Thrown if {@code reason} is not an - * instance of class {@link PrinterStateReason PrinterStateReason} or if - * {@code severity} is not an instance of class {@link Severity - * Severity}. + * @param reason printer state reason. This must be an instance of class + * {@link PrinterStateReason PrinterStateReason} + * @param severity severity of the printer state reason. This must be an + * instance of class {@link Severity Severity} + * @return previous severity associated with the given printer state reason, + * or {@code null} if the given printer state reason was not + * present + * @throws NullPointerException if {@code reason} is {@code null} or + * {@code severity} is {@code null} + * @throws ClassCastException if {@code reason} is not an instance of class + * {@link PrinterStateReason PrinterStateReason} or if + * {@code severity} is not an instance of class + * {@link Severity Severity} * @since 1.5 */ public Severity put(PrinterStateReason reason, Severity severity) { @@ -185,12 +176,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrinterStateReasons, the - * category is class PrinterStateReasons itself. + *

    + * For class {@code PrinterStateReasons}, the category is class + * {@code PrinterStateReasons} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrinterStateReasons.class; @@ -199,11 +190,11 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrinterStateReasons, the - * category name is {@code "printer-state-reasons"}. + *

    + * For class {@code PrinterStateReasons}, the category name is + * {@code "printer-state-reasons"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "printer-state-reasons"; @@ -211,24 +202,21 @@ /** * Obtain an unmodifiable set view of the individual printer state reason - * attributes at the given severity level in this PrinterStateReasons - * attribute. Each element in the set view is a {@link PrinterStateReason - * PrinterStateReason} object. The only elements in the set view are the - * {@link PrinterStateReason PrinterStateReason} objects that map to the - * given severity value. The set view is backed by this - * PrinterStateReasons attribute, so changes to this PrinterStateReasons - * attribute are reflected in the set view. - * The set view does not support element insertion or - * removal. The set view's iterator does not support element removal. + * attributes at the given severity level in this + * {@code PrinterStateReasons} attribute. Each element in the set view is a + * {@link PrinterStateReason PrinterStateReason} object. The only elements + * in the set view are the {@link PrinterStateReason PrinterStateReason} + * objects that map to the given severity value. The set view is backed by + * this {@code PrinterStateReasons} attribute, so changes to this + * {@code PrinterStateReasons} attribute are reflected in the set view. The + * set view does not support element insertion or removal. The set view's + * iterator does not support element removal. * - * @param severity Severity level. - * - * @return Set view of the individual {@link PrinterStateReason - * PrinterStateReason} attributes at the given {@link Severity - * Severity} level. - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code severity} is null. + * @param severity severity level + * @return set view of the individual + * {@link PrinterStateReason PrinterStateReason} attributes at the + * given {@link Severity Severity} level + * @throws NullPointerException if {@code severity} is {@code null} */ public Set printerStateReasonSet(Severity severity) { if (severity == null) { @@ -305,5 +293,4 @@ throw new UnsupportedOperationException(); } } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterURI.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterURI.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/PrinterURI.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2017, 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 @@ -22,41 +22,41 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.net.URI; -import java.util.Locale; import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; import javax.print.attribute.URISyntax; -import javax.print.attribute.PrintServiceAttribute; /** - * Class PrinterURI is a printing attribute class, a URI, that specifies the - * globally unique name of a printer. If it has such a name, an administrator - * determines a printer's URI and sets this attribute to that name. - *

    - * IPP Compatibility: This implements the - * IPP printer-uri attribute. The string form returned by - * {@code toString()} gives the IPP printer-uri value. - * The category name returned by {@code getName()} - * gives the IPP attribute name. + * Class {@code PrinterURI} is a printing attribute class, a {@code URI}, that + * specifies the globally unique name of a printer. If it has such a name, an + * administrator determines a printer's {@code URI} and sets this attribute to + * that name. + *

    + * IPP Compatibility: This implements the IPP printer-uri attribute. The + * string form returned by {@code toString()} gives the IPP printer-uri value. + * The category name returned by {@code getName()} gives the IPP attribute name. * - * @author Robert Herriot + * @author Robert Herriot */ - public final class PrinterURI extends URISyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 7923912792485606497L; /** - * Constructs a new PrinterURI attribute with the specified URI. + * Constructs a new {@code PrinterURI} attribute with the specified + * {@code URI}. * - * @param uri URI of the printer - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code uri} is null. + * @param uri {@code URI} of the printer + * @throws NullPointerException if {@code uri} is {@code null} */ public PrinterURI(URI uri) { super (uri); @@ -66,34 +66,30 @@ * Returns whether this printer name attribute is equivalent to the passed * in object. To be equivalent, all of the following conditions must be * true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class PrinterURI. - *
    3. - * This PrinterURI attribute's underlying URI and - * {@code object}'s underlying URI are equal. - *
    + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code PrinterURI}. + *
    3. This {@code PrinterURI} attribute's underlying {@code URI} and + * {@code object}'s underlying {@code URI} are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this PrinterURI - * attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this + * {@code PrinterURI} attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && object instanceof PrinterURI); } - /** + /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class PrinterURI and any vendor-defined subclasses, the category is - * class PrinterURI itself. + *

    + * For class {@code PrinterURI} and any vendor-defined subclasses, the + * category is class {@code PrinterURI} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return PrinterURI.class; @@ -102,14 +98,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class PrinterURI and any vendor-defined subclasses, the category - * name is {@code "printer-uri"}. + *

    + * For class {@code PrinterURI} and any vendor-defined subclasses, the + * category name is {@code "printer-uri"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "printer-uri"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/QueuedJobCount.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/QueuedJobCount.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/QueuedJobCount.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; @@ -29,29 +30,29 @@ import javax.print.attribute.PrintServiceAttribute; /** - * Class QueuedJobCount is an integer valued printing attribute that indicates - * the number of jobs in the printer whose {@link JobState JobState} is either - * PENDING, PENDING_HELD, PROCESSING, or PROCESSING_STOPPED. - *

    - * IPP Compatibility: The integer value gives the IPP integer value. - * The category name returned by {@code getName()} gives the IPP - * attribute name. + * Class {@code QueuedJobCount} is an integer valued printing attribute that + * indicates the number of jobs in the printer whose {@link JobState JobState} + * is either {@code PENDING}, {@code PENDING_HELD}, {@code PROCESSING}, or + * {@code PROCESSING_STOPPED}. + *

    + * IPP Compatibility: The integer value gives the IPP integer value. The + * category name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class QueuedJobCount extends IntegerSyntax implements PrintServiceAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 7499723077864047742L; /** - * Construct a new queued job count attribute with the given integer - * value. + * Construct a new queued job count attribute with the given integer value. * - * @param value Integer value. - * - * @exception IllegalArgumentException - * (Unchecked exception) Thrown if {@code value} is less than 0. + * @param value Integer value + * @throws IllegalArgumentException if {@code value} is negative */ public QueuedJobCount(int value) { super (value, 0, Integer.MAX_VALUE); @@ -59,22 +60,18 @@ /** * Returns whether this queued job count attribute is equivalent to the - * passed in object. To be equivalent, all of the following conditions - * mus be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class QueuedJobCount. - *
    3. - * This queued job count attribute's value and {@code object}'s - * value are equal. - *
    + * passed in object. To be equivalent, all of the following conditions mus + * be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code QueuedJobCount}. + *
    3. This queued job count attribute's value and {@code object}'s value + * are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this queued job - * count attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this queued job + * count attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals (object) && @@ -84,11 +81,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class QueuedJobCount, the category is class QueuedJobCount itself. + *

    + * For class {@code QueuedJobCount}, the category is class + * {@code QueuedJobCount} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return QueuedJobCount.class; @@ -97,14 +95,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class QueuedJobCount, the - * category name is {@code "queued-job-count"}. + *

    + * For class {@code QueuedJobCount}, the category name is + * {@code "queued-job-count"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "queued-job-count"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/ReferenceUriSchemesSupported.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,45 +22,50 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; -import javax.print.attribute.Attribute; /** - * Class ReferenceUriSchemesSupported is a printing attribute class - * an enumeration, that indicates a "URI scheme," such as "http:" or "ftp:", - * that a printer can use to retrieve print data stored at a URI location. - * If a printer supports doc flavors with a print data representation class of + * Class {@code ReferenceUriSchemesSupported} is a printing attribute class an + * enumeration, that indicates a "URI scheme," such as "http:" or "ftp:", that a + * printer can use to retrieve print data stored at a {@code URI} location. If a + * printer supports doc flavors with a print data representation class of * {@code "java.net.URL"}, the printer uses instances of class - * ReferenceUriSchemesSupported to advertise the URI schemes it can accept. - * The acceptable URI schemes are included as service attributes in the - * lookup service; this lets clients search the - * for printers that can get print data using a certain URI scheme. The - * acceptable URI schemes can also be queried using the capability methods in - * interface {@code PrintService}. However, - * ReferenceUriSchemesSupported attributes are used solely for determining - * acceptable URI schemes, they are never included in a doc's, - * print request's, print job's, or print service's attribute set. - *

    + * {@code ReferenceUriSchemesSupported} to advertise the {@code URI} schemes it + * can accept. The acceptable {@code URI} schemes are included as service + * attributes in the lookup service; this lets clients search the for printers + * that can get print data using a certain {@code URI} scheme. The acceptable + * {@code URI} schemes can also be queried using the capability methods in + * interface {@code PrintService}. However, {@code ReferenceUriSchemesSupported} + * attributes are used solely for determining acceptable {@code URI} schemes, + * they are never included in a doc's, print request's, print job's, or print + * service's attribute set. + *

    * The Internet Assigned Numbers Authority maintains the - * official - * list of URI schemes. + * official list of + * URI schemes. *

    - * Class ReferenceUriSchemesSupported defines enumeration values for widely - * used URI schemes. A printer that supports additional URI schemes - * can define them in a subclass of class ReferenceUriSchemesSupported. - *

    - * IPP Compatibility: The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. + * Class {@code ReferenceUriSchemesSupported} defines enumeration values for + * widely used {@code URI} schemes. A printer that supports additional + * {@code URI} schemes can define them in a subclass of class + * {@code ReferenceUriSchemesSupported}. + *

    + * IPP Compatibility: The category name returned by {@code getName()} is + * the IPP attribute name. The enumeration's integer value is the IPP enum + * value. The {@code toString()} method returns the IPP string representation of + * the attribute value. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public class ReferenceUriSchemesSupported extends EnumSyntax implements Attribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -8989076942813442805L; /** @@ -105,15 +110,18 @@ public static final ReferenceUriSchemesSupported FILE = new ReferenceUriSchemesSupported(7); /** - * Construct a new reference URI scheme enumeration value with the given - * integer value. + * Construct a new reference {@code URI} scheme enumeration value with the + * given integer value. * - * @param value Integer value. + * @param value Integer value */ protected ReferenceUriSchemesSupported(int value) { super (value); } + /** + * The string table for class {@code ReferenceUriSchemesSupported}. + */ private static final String[] myStringTable = { "ftp", "http", @@ -125,6 +133,10 @@ "file", }; + /** + * The enumeration value table for class + * {@code ReferenceUriSchemesSupported}. + */ private static final ReferenceUriSchemesSupported[] myEnumValueTable = { FTP, HTTP, @@ -137,7 +149,7 @@ }; /** - * Returns the string table for class ReferenceUriSchemesSupported. + * Returns the string table for class {@code ReferenceUriSchemesSupported}. */ protected String[] getStringTable() { return myStringTable.clone(); @@ -145,7 +157,7 @@ /** * Returns the enumeration value table for class - * ReferenceUriSchemesSupported. + * {@code ReferenceUriSchemesSupported}. */ protected EnumSyntax[] getEnumValueTable() { return (EnumSyntax[])myEnumValueTable.clone(); @@ -154,12 +166,13 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class ReferenceUriSchemesSupported and any vendor-defined - * subclasses, the category is class ReferenceUriSchemesSupported itself. + *

    + * For class {@code ReferenceUriSchemesSupported} and any vendor-defined + * subclasses, the category is class {@code ReferenceUriSchemesSupported} + * itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return ReferenceUriSchemesSupported.class; @@ -168,15 +181,14 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class ReferenceUriSchemesSupported and any vendor-defined + *

    + * For class {@code ReferenceUriSchemesSupported} and any vendor-defined * subclasses, the category name is * {@code "reference-uri-schemes-supported"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "reference-uri-schemes-supported"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/RequestingUserName.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/RequestingUserName.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/RequestingUserName.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,77 +22,73 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import java.util.Locale; import javax.print.attribute.Attribute; +import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.TextSyntax; -import javax.print.attribute.PrintRequestAttribute; /** - * Class RequestingUserName is a printing attribute class, a text attribute, - * that specifies the name of the end user that submitted the print job. A - * requesting user name is an arbitrary string defined by the client. The - * printer does not put the client-specified RequestingUserName attribute into - * the Print Job's attribute set; rather, the printer puts in a {@link - * JobOriginatingUserName JobOriginatingUserName} attribute. - * This means that services which support specifying a username with this - * attribute should also report a JobOriginatingUserName in the job's - * attribute set. Note that many print services may have a way to independently - * authenticate the user name, and so may state support for a - * requesting user name, but in practice will then report the user name - * authenticated by the service rather than that specified via this - * attribute. - *

    - * IPP Compatibility: The string value gives the IPP name value. The + * Class {@code RequestingUserName} is a printing attribute class, a text + * attribute, that specifies the name of the end user that submitted the print + * job. A requesting user name is an arbitrary string defined by the client. The + * printer does not put the client-specified {@code RequestingUserName} + * attribute into the Print Job's attribute set; rather, the printer puts in a + * {@link JobOriginatingUserName JobOriginatingUserName} attribute. This means + * that services which support specifying a username with this attribute should + * also report a {@code JobOriginatingUserName} in the job's attribute set. Note + * that many print services may have a way to independently authenticate the + * user name, and so may state support for a requesting user name, but in + * practice will then report the user name authenticated by the service rather + * than that specified via this attribute. + *

    + * IPP Compatibility: The string value gives the IPP name value. The * locale gives the IPP natural language. The category name returned by * {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class RequestingUserName extends TextSyntax implements PrintRequestAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -2683049894310331454L; /** - * Constructs a new requesting user name attribute with the given user - * name and locale. + * Constructs a new requesting user name attribute with the given user name + * and locale. * - * @param userName User name. - * @param locale Natural language of the text string. null - * is interpreted to mean the default locale as returned - * by {@code Locale.getDefault()} - * - * @exception NullPointerException - * (unchecked exception) Thrown if {@code userName} is null. + * @param userName user name + * @param locale natural language of the text string. {@code null} is + * interpreted to mean the default locale as returned by + * {@code Locale.getDefault()} + * @throws NullPointerException if {@code userName} is {@code null} */ public RequestingUserName(String userName, Locale locale) { super (userName, locale); } /** - * Returns whether this requesting user name attribute is equivalent to - * the passed in object. To be equivalent, all of the following - * conditions must be true: - *

      - *
    1. - * {@code object} is not null. - *
    2. - * {@code object} is an instance of class RequestingUserName. - *
    3. - * This requesting user name attribute's underlying string and - * {@code object}'s underlying string are equal. - *
    4. - * This requesting user name attribute's locale and - * {@code object}'s locale are equal. - *
    + * Returns whether this requesting user name attribute is equivalent to the + * passed in object. To be equivalent, all of the following conditions must + * be true: + *
      + *
    1. {@code object} is not {@code null}. + *
    2. {@code object} is an instance of class {@code RequestingUserName}. + *
    3. This requesting user name attribute's underlying string and + * {@code object}'s underlying string are equal. + *
    4. This requesting user name attribute's locale and {@code object}'s + * locale are equal. + *
    * - * @param object Object to compare to. - * - * @return True if {@code object} is equivalent to this requesting - * user name attribute, false otherwise. + * @param object {@code Object} to compare to + * @return {@code true} if {@code object} is equivalent to this requesting + * user name attribute, {@code false} otherwise */ public boolean equals(Object object) { return (super.equals(object) && @@ -102,12 +98,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class RequestingUserName, the - * category is class RequestingUserName itself. + *

    + * For class {@code RequestingUserName}, the category is class + * {@code RequestingUserName} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return RequestingUserName.class; @@ -116,14 +112,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class RequestingUserName, the - * category name is {@code "requesting-user-name"}. + *

    + * For class {@code RequestingUserName}, the category name is + * {@code "requesting-user-name"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "requesting-user-name"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Severity.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Severity.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Severity.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,54 +22,53 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; +import javax.print.attribute.Attribute; import javax.print.attribute.EnumSyntax; -import javax.print.attribute.Attribute; /** - * Class Severity is a printing attribute class, an enumeration, that denotes - * the severity of a {@link PrinterStateReason PrinterStateReason} attribute. - *

    - * Instances of Severity do not appear in a Print Service's attribute set - * directly. Rather, a {@link PrinterStateReasons PrinterStateReasons} + * Class {@code Severity} is a printing attribute class, an enumeration, that + * denotes the severity of a {@link PrinterStateReason PrinterStateReason} + * attribute. + *

    + * Instances of {@code Severity} do not appear in a Print Service's attribute + * set directly. Rather, a {@link PrinterStateReasons PrinterStateReasons} * attribute appears in the Print Service's attribute set. - * The {@link PrinterStateReasons - * PrinterStateReasons} attribute contains zero, one, or more than one {@link - * PrinterStateReason PrinterStateReason} objects which pertain to the Print - * Service's status, and each {@link PrinterStateReason PrinterStateReason} - * object is associated with a Severity level of REPORT (least severe), - * WARNING, or ERROR (most severe). - * The printer adds a {@link PrinterStateReason - * PrinterStateReason} object to the Print Service's + * The {@link PrinterStateReasons PrinterStateReasons} attribute contains zero, + * one, or more than one {@link PrinterStateReason PrinterStateReason} objects + * which pertain to the Print Service's status, and each + * {@link PrinterStateReason PrinterStateReason} object is associated with a + * Severity level of {@code REPORT} (least severe), {@code WARNING}, or + * {@code ERROR} (most severe). The printer adds a + * {@link PrinterStateReason PrinterStateReason} object to the Print Service's * {@link PrinterStateReasons PrinterStateReasons} attribute when the - * corresponding condition becomes true - * of the printer, and the printer removes the {@link PrinterStateReason - * PrinterStateReason} object again when the corresponding condition becomes - * false, regardless of whether the Print Service's overall - * {@link PrinterState PrinterState} also changed. - *

    - * IPP Compatibility: - * {@code Severity.toString()} returns either "error", "warning", or - * "report". The string values returned by - * each individual {@link PrinterStateReason} and - * associated {@link Severity} object's {@code toString()} - * methods, concatenated together with a hyphen ({@code "-"}) in - * between, gives the IPP keyword value for a {@link PrinterStateReasons}. - * The category name returned by {@code getName()} gives the IPP - * attribute name. + * corresponding condition becomes true of the printer, and the printer removes + * the {@link PrinterStateReason PrinterStateReason} object again when the + * corresponding condition becomes false, regardless of whether the Print + * Service's overall {@link PrinterState PrinterState} also changed. + *

    + * IPP Compatibility: {@code Severity.toString()} returns either "error", + * "warning", or "report". The string values returned by each individual + * {@link PrinterStateReason} and associated {@link Severity} object's + * {@code toString()} methods, concatenated together with a hyphen ({@code "-"}) + * in between, gives the IPP keyword value for a {@link PrinterStateReasons}. + * The category name returned by {@code getName()} gives the IPP attribute name. * - * @author Alan Kaminsky + * @author Alan Kaminsky */ public final class Severity extends EnumSyntax implements Attribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 8781881462717925380L; /** * Indicates that the {@link PrinterStateReason PrinterStateReason} is a - * "report" (least severe). An implementation may choose to omit some or - * all reports. - * Some reports specify finer granularity about the printer state; + * "report" (least severe). An implementation may choose to omit some or all + * reports. Some reports specify finer granularity about the printer state; * others serve as a precursor to a warning. A report must contain nothing * that could affect the printed output. */ @@ -78,36 +77,41 @@ /** * Indicates that the {@link PrinterStateReason PrinterStateReason} is a * "warning." An implementation may choose to omit some or all warnings. - * Warnings serve as a precursor to an error. A warning must contain - * nothing that prevents a job from completing, though in some cases the - * output may be of lower quality. + * Warnings serve as a precursor to an error. A warning must contain nothing + * that prevents a job from completing, though in some cases the output may + * be of lower quality. */ public static final Severity WARNING = new Severity (1); /** * Indicates that the {@link PrinterStateReason PrinterStateReason} is an - * "error" (most severe). An implementation must include all errors. - * If this attribute contains one or more errors, the printer's - * {@link PrinterState PrinterState} must be STOPPED. + * "error" (most severe). An implementation must include all errors. If this + * attribute contains one or more errors, the printer's + * {@link PrinterState PrinterState} must be {@code STOPPED}. */ public static final Severity ERROR = new Severity (2); /** - * Construct a new severity enumeration value with the given integer - * value. + * Construct a new severity enumeration value with the given integer value. * - * @param value Integer value. + * @param value Integer value */ protected Severity(int value) { super (value); } + /** + * The string table for class {@code Severity}. + */ private static final String[] myStringTable = { "report", "warning", "error" }; + /** + * The enumeration value table for class {@code Severity}. + */ private static final Severity[] myEnumValueTable = { REPORT, WARNING, @@ -115,28 +119,28 @@ }; /** - * Returns the string table for class Severity. + * Returns the string table for class {@code Severity}. */ protected String[] getStringTable() { return myStringTable; } /** - * Returns the enumeration value table for class Severity. + * Returns the enumeration value table for class {@code Severity}. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; } - /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class Severity, the category is class Severity itself. + *

    + * For class {@code Severity}, the category is class + * {@code Severity} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return Severity.class; @@ -145,13 +149,12 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class Severit, the category name is {@code "severity"}. + *

    + * For class {@code Severity}, the category name is {@code "severity"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "severity"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/SheetCollate.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/SheetCollate.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/SheetCollate.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,146 +22,134 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; -import javax.print.attribute.DocAttribute; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class SheetCollate is a printing attribute class, an enumeration, that - * specifies whether or not the media sheets of each copy of each printed + * Class {@code SheetCollate} is a printing attribute class, an enumeration, + * that specifies whether or not the media sheets of each copy of each printed * document in a job are to be in sequence, when multiple copies of the document - * are specified by the {@link Copies Copies} attribute. When SheetCollate is - * COLLATED, each copy of each document is printed with the print-stream sheets - * in sequence. When SheetCollate is UNCOLLATED, each print-stream sheet is - * printed a number of times equal to the value of the {@link Copies Copies} - * attribute in succession. For example, suppose a document produces two media - * sheets as output, {@link Copies Copies} is 6, and SheetCollate is UNCOLLATED; - * in this case six copies of the first media sheet are printed followed by - * six copies of the second media sheet. - *

    + * are specified by the {@link Copies Copies} attribute. When + * {@code SheetCollate} is {@code COLLATED}, each copy of each document is + * printed with the print-stream sheets in sequence. When {@code SheetCollate} + * is {@code UNCOLLATED}, each print-stream sheet is printed a number of times + * equal to the value of the {@link Copies Copies} attribute in succession. For + * example, suppose a document produces two media sheets as output, + * {@link Copies Copies} is 6, and {@code SheetCollate} is UNCOLLATED; in this + * case six copies of the first media sheet are printed followed by six copies + * of the second media sheet. + *

    * Whether the effect of sheet collation is achieved by placing copies of a * document in multiple output bins or in the same output bin with - * implementation defined document separation is implementation dependent. - * Also whether it is achieved by making multiple passes over the job or by - * using an output sorter is implementation dependent. - *

    - * If a printer does not support the SheetCollate attribute (meaning the client - * cannot specify any particular sheet collation), the printer must behave as - * though SheetCollate were always set to COLLATED. - *

    - * The SheetCollate attribute interacts with the {@link MultipleDocumentHandling - * MultipleDocumentHandling} attribute. The {@link MultipleDocumentHandling - * MultipleDocumentHandling} attribute describes the collation of entire - * documents, and the SheetCollate attribute describes the semantics of - * collating individual pages within a document. - *

    - * The effect of a SheetCollate attribute on a multidoc print job (a job with - * multiple documents) depends on whether all the docs have the same sheet - * collation specified or whether different docs have different sheet - * collations specified, and on the (perhaps defaulted) value of the {@link - * MultipleDocumentHandling MultipleDocumentHandling} attribute. - *

      - *
    • - * If all the docs have the same sheet collation specified, then the following - * combinations of SheetCollate and {@link MultipleDocumentHandling - * MultipleDocumentHandling} are permitted, and the printer reports an error - * when the job is submitted if any other combination is specified: - *
        - *
      • - * SheetCollate = COLLATED, {@link MultipleDocumentHandling - * MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be - * combined into one output document. Multiple copies of the output document - * will be produced with pages in collated order, i.e. pages 1, 2, 3, . . ., - * 1, 2, 3, . . . - * - *
      • - * SheetCollate = COLLATED, {@link MultipleDocumentHandling - * MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input docs - * will be combined into one output document, and the first impression of each - * input doc will always start on a new media sheet. Multiple copies of the - * output document will be produced with pages in collated order, i.e. pages - * 1, 2, 3, . . ., 1, 2, 3, . . . - * - *
      • - * SheetCollate = COLLATED, {@link MultipleDocumentHandling - * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each - * input doc will remain a separate output document. Multiple copies of each - * output document (call them A, B, . . .) will be produced with each document's - * pages in collated order, but the documents themselves in uncollated order, - * i.e. pages A1, A2, A3, . . ., A1, A2, A3, . . ., B1, B2, B3, . . ., B1, B2, - * B3, . . . + * implementation defined document separation is implementation dependent. Also + * whether it is achieved by making multiple passes over the job or by using an + * output sorter is implementation dependent. + *

        + * If a printer does not support the {@code SheetCollate} attribute (meaning the + * client cannot specify any particular sheet collation), the printer must + * behave as though {@code SheetCollate} were always set to {@code COLLATED}. + *

        + * The {@code SheetCollate} attribute interacts with the + * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute. The + * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute describes + * the collation of entire documents, and the {@code SheetCollate} attribute + * describes the semantics of collating individual pages within a document. + *

        + * The effect of a {@code SheetCollate} attribute on a multidoc print job (a job + * with multiple documents) depends on whether all the docs have the same sheet + * collation specified or whether different docs have different sheet collations + * specified, and on the (perhaps defaulted) value of the + * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute. + *

          + *
        • If all the docs have the same sheet collation specified, then the + * following combinations of {@code SheetCollate} and + * {@link MultipleDocumentHandling MultipleDocumentHandling} are permitted, + * and the printer reports an error when the job is submitted if any other + * combination is specified: + *
            + *
          • SheetCollate = COLLATED, {@link MultipleDocumentHandling + * MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be + * combined into one output document. Multiple copies of the output document + * will be produced with pages in collated order, i.e. pages 1, 2, 3, . . ., + * 1, 2, 3, . . . + *
          • SheetCollate = COLLATED, {@link MultipleDocumentHandling + * MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input + * docs will be combined into one output document, and the first impression + * of each input doc will always start on a new media sheet. Multiple copies + * of the output document will be produced with pages in collated order, + * i.e. pages 1, 2, 3, . . ., 1, 2, 3, . . . + *
          • SheetCollate = COLLATED, {@link MultipleDocumentHandling + * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each + * input doc will remain a separate output document. Multiple copies of each + * output document (call them A, B, . . .) will be produced with each + * document's pages in collated order, but the documents themselves in + * uncollated order, i.e. pages A1, A2, A3, . . ., A1, A2, A3, . . ., B1, + * B2, B3, . . ., B1, B2, B3, . . . + *
          • SheetCollate = COLLATED, {@link MultipleDocumentHandling + * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each + * input doc will remain a separate output document. Multiple copies of each + * output document (call them A, B, . . .) will be produced with each + * document's pages in collated order, with the documents themselves also in + * collated order, i.e. pages A1, A2, A3, . . ., B1, B2, B3, . . ., A1, A2, + * A3, . . ., B1, B2, B3, . . . + *
          • SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling + * MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be + * combined into one output document. Multiple copies of the output document + * will be produced with pages in uncollated order, i.e. pages 1, 1, . . ., + * 2, 2, . . ., 3, 3, . . . + *
          • SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling + * MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input + * docs will be combined into one output document, and the first impression + * of each input doc will always start on a new media sheet. Multiple copies + * of the output document will be produced with pages in uncollated order, + * i.e. pages 1, 1, . . ., 2, 2, . . ., 3, 3, . . . + *
          • SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling + * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each + * input doc will remain a separate output document. Multiple copies of each + * output document (call them A, B, . . .) will be produced with each + * document's pages in uncollated order, with the documents themselves also + * in uncollated order, i.e. pages A1, A1, . . ., A2, A2, . . ., A3, A3, . . + * ., B1, B1, . . ., B2, B2, . . ., B3, B3, . . . + *
          + *
        • If different docs have different sheet collations specified, then only + * one value of {@link MultipleDocumentHandling MultipleDocumentHandling} is + * permitted, and the printer reports an error when the job is submitted if + * any other value is specified: + *
            + *
          • {@link MultipleDocumentHandling MultipleDocumentHandling} = + * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will remain a + * separate output document. Multiple copies of each output document (call + * them A, B, . . .) will be produced with each document's pages in collated + * or uncollated order as the corresponding input doc's SheetCollate + * attribute specifies, and with the documents themselves in uncollated + * order. If document A had SheetCollate = UNCOLLATED and document B had + * SheetCollate = COLLATED, the following pages would be produced: A1, A1, . + * . ., A2, A2, . . ., A3, A3, . . ., B1, B2, B3, . . ., B1, B2, B3, . . . + *
          + *
        + *

        + * IPP Compatibility: SheetCollate is not an IPP attribute at present. * - *

      • - * SheetCollate = COLLATED, {@link MultipleDocumentHandling - * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_COLLATED_COPIES -- Each input - * doc will remain a separate output document. Multiple copies of each output - * document (call them A, B, . . .) will be produced with each document's pages - * in collated order, with the documents themselves also in collated order, i.e. - * pages A1, A2, A3, . . ., B1, B2, B3, . . ., A1, A2, A3, . . ., B1, B2, B3, - * . . . - * - *
      • - * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling - * MultipleDocumentHandling} = SINGLE_DOCUMENT -- All the input docs will be - * combined into one output document. Multiple copies of the output document - * will be produced with pages in uncollated order, i.e. pages 1, 1, . . ., - * 2, 2, . . ., 3, 3, . . . - * - *
      • - * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling - * MultipleDocumentHandling} = SINGLE_DOCUMENT_NEW_SHEET -- All the input docs - * will be combined into one output document, and the first impression of each - * input doc will always start on a new media sheet. Multiple copies of the - * output document will be produced with pages in uncollated order, i.e. pages - * 1, 1, . . ., 2, 2, . . ., 3, 3, . . . - * - *
      • - * SheetCollate = UNCOLLATED, {@link MultipleDocumentHandling - * MultipleDocumentHandling} = SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each - * input doc will remain a separate output document. Multiple copies of each - * output document (call them A, B, . . .) will be produced with each document's - * pages in uncollated order, with the documents themselves also in uncollated - * order, i.e. pages A1, A1, . . ., A2, A2, . . ., A3, A3, . . ., B1, B1, . . ., - * B2, B2, . . ., B3, B3, . . . - *
      - * - *
    • - * If different docs have different sheet collations specified, then only one - * value of {@link MultipleDocumentHandling MultipleDocumentHandling} is - * permitted, and the printer reports an error when the job is submitted if any - * other value is specified: - *
        - *
      • - * {@link MultipleDocumentHandling MultipleDocumentHandling} = - * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- Each input doc will remain a separate - * output document. Multiple copies of each output document (call them A, B, - * . . .) will be produced with each document's pages in collated or uncollated - * order as the corresponding input doc's SheetCollate attribute specifies, and - * with the documents themselves in uncollated order. If document A had - * SheetCollate = UNCOLLATED and document B had SheetCollate = COLLATED, the - * following pages would be produced: A1, A1, . . ., A2, A2, . . ., A3, A3, - * . . ., B1, B2, B3, . . ., B1, B2, B3, . . . - *
      - *
    - *

    - * IPP Compatibility: SheetCollate is not an IPP attribute at present. - * - * @see MultipleDocumentHandling - * - * @author Alan Kaminsky + * @author Alan Kaminsky + * @see MultipleDocumentHandling */ public final class SheetCollate extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 7080587914259873003L; /** - * Sheets within a document appear in uncollated order when multiple - * copies are printed. + * Sheets within a document appear in uncollated order when multiple copies + * are printed. */ public static final SheetCollate UNCOLLATED = new SheetCollate(0); @@ -175,31 +163,37 @@ * Construct a new sheet collate enumeration value with the given integer * value. * - * @param value Integer value. + * @param value Integer value */ protected SheetCollate(int value) { super (value); } + /** + * The string table for class {@code SheetCollate}. + */ private static final String[] myStringTable = { "uncollated", "collated" }; + /** + * The enumeration value table for class {@code SheetCollate}. + */ private static final SheetCollate[] myEnumValueTable = { UNCOLLATED, COLLATED }; /** - * Returns the string table for class SheetCollate. + * Returns the string table for class {@code SheetCollate}. */ protected String[] getStringTable() { return myStringTable; } /** - * Returns the enumeration value table for class SheetCollate. + * Returns the enumeration value table for class {@code SheetCollate}. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; @@ -208,11 +202,12 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class SheetCollate, the category is class SheetCollate itself. + *

    + * For class {@code SheetCollate}, the category is class + * {@code SheetCollate} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return SheetCollate.class; @@ -221,13 +216,13 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class SheetCollate, the category name is {@code "sheet-collate"}. + *

    + * For class {@code SheetCollate}, the category name is + * {@code "sheet-collate"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "sheet-collate"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Sides.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Sides.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Sides.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -22,104 +22,96 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package javax.print.attribute.standard; import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; import javax.print.attribute.EnumSyntax; -import javax.print.attribute.DocAttribute; +import javax.print.attribute.PrintJobAttribute; import javax.print.attribute.PrintRequestAttribute; -import javax.print.attribute.PrintJobAttribute; /** - * Class Sides is a printing attribute class, an enumeration, that specifies - * how print-stream pages are to be imposed upon the sides of an instance of a - * selected medium, i.e., an impression. - *

    - * The effect of a Sides attribute on a multidoc print job (a job with multiple - * documents) depends on whether all the docs have the same sides values - * specified or whether different docs have different sides values specified, - * and on the (perhaps defaulted) value of the {@link MultipleDocumentHandling - * MultipleDocumentHandling} attribute. - *

      - *
    • - * If all the docs have the same sides value n specified, then any value - * of {@link MultipleDocumentHandling MultipleDocumentHandling} makes sense, - * and the printer's processing depends on the {@link MultipleDocumentHandling - * MultipleDocumentHandling} value: - *
        - *
      • - * SINGLE_DOCUMENT -- All the input docs will be combined together into one - * output document. Each media sheet will consist of n impressions from - * the output document. - * - *
      • - * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together - * into one output document. Each media sheet will consist of n - * impressions from the output document. However, the first impression of each - * input doc will always start on a new media sheet; this means the last media - * sheet of an input doc may have only one impression on it. - * - *
      • - * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate. - * Each media sheet will consist of n impressions from the input doc. - * Since the input docs are separate, the first impression of each input doc - * will always start on a new media sheet; this means the last media sheet of - * an input doc may have only one impression on it. - * - *
      • - * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate. - * Each media sheet will consist of n impressions from the input doc. - * Since the input docs are separate, the first impression of each input doc - * will always start on a new media sheet; this means the last media sheet of - * an input doc may have only one impression on it. - *
      + * Class {@code Sides} is a printing attribute class, an enumeration, that + * specifies how print-stream pages are to be imposed upon the sides of an + * instance of a selected medium, i.e., an impression. + *

      + * The effect of a {@code Sides} attribute on a multidoc print job (a job with + * multiple documents) depends on whether all the docs have the same sides + * values specified or whether different docs have different sides values + * specified, and on the (perhaps defaulted) value of the + * {@link MultipleDocumentHandling MultipleDocumentHandling} attribute. + *

        + *
      • If all the docs have the same sides value n specified, then any + * value of {@link MultipleDocumentHandling MultipleDocumentHandling} makes + * sense, and the printer's processing depends on the + * {@link MultipleDocumentHandling MultipleDocumentHandling} value: + *
          + *
        • {@code SINGLE_DOCUMENT} -- All the input docs will be combined + * together into one output document. Each media sheet will consist of + * n impressions from the output document. + *
        • {@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be + * combined together into one output document. Each media sheet will consist + * of n impressions from the output document. However, the first + * impression of each input doc will always start on a new media sheet; this + * means the last media sheet of an input doc may have only one impression + * on it. + *
        • {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The input docs will + * remain separate. Each media sheet will consist of n impressions + * from the input doc. Since the input docs are separate, the first + * impression of each input doc will always start on a new media sheet; this + * means the last media sheet of an input doc may have only one impression + * on it. + *
        • {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The input docs will + * remain separate. Each media sheet will consist of n impressions + * from the input doc. Since the input docs are separate, the first + * impression of each input doc will always start on a new media sheet; this + * means the last media sheet of an input doc may have only one impression + * on it. + *
        + *
          + *
        • {@code SINGLE_DOCUMENT} -- All the input docs will be combined + * together into one output document. Each media sheet will consist of + * ni impressions from the output document, where i + * is the number of the input doc corresponding to that point in the output + * document. When the next input doc has a different sides value from the + * previous input doc, the first print-stream page of the next input doc + * goes at the start of the next media sheet, possibly leaving only one + * impression on the previous media sheet. + *
        • {@code SINGLE_DOCUMENT_NEW_SHEET} -- All the input docs will be + * combined together into one output document. Each media sheet will consist + * of n impressions from the output document. However, the first + * impression of each input doc will always start on a new media sheet; this + * means the last impression of an input doc may have only one impression on + * it. + *
        • {@code SEPARATE_DOCUMENTS_UNCOLLATED_COPIES} -- The input docs will + * remain separate. For input doc i, each media sheet will consist of + * ni impressions from the input doc. Since the input docs + * are separate, the first impression of each input doc will always start on + * a new media sheet; this means the last media sheet of an input doc may + * have only one impression on it. + *
        • {@code SEPARATE_DOCUMENTS_COLLATED_COPIES} -- The input docs will + * remain separate. For input doc i, each media sheet will consist of + * ni impressions from the input doc. Since the input docs + * are separate, the first impression of each input doc will always start on + * a new media sheet; this means the last media sheet of an input doc may + * have only one impression on it. + *
        + *
      + *

      + * IPP Compatibility: The category name returned by {@code getName()} is + * the IPP attribute name. The enumeration's integer value is the IPP enum + * value. The {@code toString()} method returns the IPP string representation of + * the attribute value. * - *

        - *
      • - * SINGLE_DOCUMENT -- All the input docs will be combined together into one - * output document. Each media sheet will consist of ni - * impressions from the output document, where i is the number of the - * input doc corresponding to that point in the output document. When the next - * input doc has a different sides value from the previous input doc, the first - * print-stream page of the next input doc goes at the start of the next media - * sheet, possibly leaving only one impression on the previous media sheet. - * - *
      • - * SINGLE_DOCUMENT_NEW_SHEET -- All the input docs will be combined together - * into one output document. Each media sheet will consist of n - * impressions from the output document. However, the first impression of each - * input doc will always start on a new media sheet; this means the last - * impression of an input doc may have only one impression on it. - * - *
      • - * SEPARATE_DOCUMENTS_UNCOLLATED_COPIES -- The input docs will remain separate. - * For input doc i, each media sheet will consist of ni - * impressions from the input doc. Since the input docs are separate, the first - * impression of each input doc will always start on a new media sheet; this - * means the last media sheet of an input doc may have only one impression on - * it. - * - *
      • - * SEPARATE_DOCUMENTS_COLLATED_COPIES -- The input docs will remain separate. - * For input doc i, each media sheet will consist of ni - * impressions from the input doc. Since the input docs are separate, the first - * impression of each input doc will always start on a new media sheet; this - * means the last media sheet of an input doc may have only one impression on - * it. - *
      - *
    - *

    - * IPP Compatibility: The category name returned by - * {@code getName()} is the IPP attribute name. The enumeration's - * integer value is the IPP enum value. The {@code toString()} method - * returns the IPP string representation of the attribute value. - * - * @author Alan Kaminsky + * @author Alan Kaminsky */ - public final class Sides extends EnumSyntax implements DocAttribute, PrintRequestAttribute, PrintJobAttribute { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -6890309414893262822L; /** @@ -130,49 +122,55 @@ /** * Imposes each consecutive pair of print-stream pages upon front and back - * sides of consecutive media sheets, such that the orientation of each - * pair of print-stream pages on the medium would be correct for the - * reader as if for binding on the long edge. This imposition is also - * known as "duplex" (see {@link #DUPLEX DUPLEX}). + * sides of consecutive media sheets, such that the orientation of each pair + * of print-stream pages on the medium would be correct for the reader as if + * for binding on the long edge. This imposition is also known as "duplex" + * (see {@link #DUPLEX DUPLEX}). */ public static final Sides TWO_SIDED_LONG_EDGE = new Sides(1); /** * Imposes each consecutive pair of print-stream pages upon front and back - * sides of consecutive media sheets, such that the orientation of each - * pair of print-stream pages on the medium would be correct for the - * reader as if for binding on the short edge. This imposition is also - * known as "tumble" (see {@link #TUMBLE TUMBLE}). + * sides of consecutive media sheets, such that the orientation of each pair + * of print-stream pages on the medium would be correct for the reader as if + * for binding on the short edge. This imposition is also known as "tumble" + * (see {@link #TUMBLE TUMBLE}). */ public static final Sides TWO_SIDED_SHORT_EDGE = new Sides(2); /** - * An alias for "two sided long edge" (see {@link #TWO_SIDED_LONG_EDGE - * TWO_SIDED_LONG_EDGE}). + * An alias for "two sided long edge" (see + * {@link #TWO_SIDED_LONG_EDGE TWO_SIDED_LONG_EDGE}). */ public static final Sides DUPLEX = TWO_SIDED_LONG_EDGE; /** - * An alias for "two sided short edge" (see {@link #TWO_SIDED_SHORT_EDGE - * TWO_SIDED_SHORT_EDGE}). + * An alias for "two sided short edge" (see + * {@link #TWO_SIDED_SHORT_EDGE TWO_SIDED_SHORT_EDGE}). */ public static final Sides TUMBLE = TWO_SIDED_SHORT_EDGE; /** * Construct a new sides enumeration value with the given integer value. * - * @param value Integer value. + * @param value Integer value */ protected Sides(int value) { super (value); } + /** + * The string table for class {@code Sides}. + */ private static final String[] myStringTable = { "one-sided", "two-sided-long-edge", "two-sided-short-edge" }; + /** + * The enumeration value table for class {@code Sides}. + */ private static final Sides[] myEnumValueTable = { ONE_SIDED, TWO_SIDED_LONG_EDGE, @@ -180,14 +178,14 @@ }; /** - * Returns the string table for class Sides. + * Returns the string table for class {@code Sides}. */ protected String[] getStringTable() { return myStringTable; } /** - * Returns the enumeration value table for class Sides. + * Returns the enumeration value table for class {@code Sides}. */ protected EnumSyntax[] getEnumValueTable() { return myEnumValueTable; @@ -196,11 +194,11 @@ /** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. - *

    - * For class Sides, the category is class Sides itself. + *

    + * For class {@code Sides}, the category is class {@code Sides} itself. * - * @return Printing attribute class (category), an instance of class - * {@link java.lang.Class java.lang.Class}. + * @return printing attribute class (category), an instance of class + * {@link Class java.lang.Class} */ public final Class getCategory() { return Sides.class; @@ -209,13 +207,12 @@ /** * Get the name of the category of which this attribute value is an * instance. - *

    - * For class Sides, the category name is {@code "sides"}. + *

    + * For class {@code Sides}, the category name is {@code "sides"}. * - * @return Attribute category name. + * @return attribute category name */ public final String getName() { return "sides"; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/attribute/standard/package-info.java --- a/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/package-info.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/attribute/standard/package-info.java Sat Sep 09 14:36:45 2017 +0200 @@ -24,8 +24,8 @@ */ /** - * Package javax.print.attribute.standard contains classes for specific printing - * attributes. The parent package, + * Package {@code javax.print.attribute.standard} contains classes for specific + * printing attributes. The parent package, * javax.print.attribute, provides classes and interfaces that describe the * types of Java Print Service attributes and how they can be collected into * attribute sets. @@ -43,19 +43,19 @@ * support them. These support requirements are recorded in the documentation * for each attribute class. *

    - * Package javax.print.attribute.standard contains standard printing attributes - * and standard printing attribute values that are widely used in the printing - * domain. A print service vendor can provide new vendor-specific printing - * attributes in addition to the standard ones. A vendor can also provide - * vendor-specific extensions (subclasses) of the standard printing attributes - * -- for example, to provide additional vendor-specific values for an existing - * standard attribute. Of course, if a vendor wants clients to be able to use - * any added or extended attributes, the vendor must publish the new attribute - * classes. + * Package {@code javax.print.attribute.standard} contains standard printing + * attributes and standard printing attribute values that are widely used in the + * printing domain. A print service vendor can provide new vendor-specific + * printing attributes in addition to the standard ones. A vendor can also + * provide vendor-specific extensions (subclasses) of the standard printing + * attributes -- for example, to provide additional vendor-specific values for + * an existing standard attribute. Of course, if a vendor wants clients to be + * able to use any added or extended attributes, the vendor must publish the new + * attribute classes. *

    * Many of the standard attribute classes extend one of the abstract syntax - * classes of the javax.print.attribute package. These abstract syntax classes - * each represent a different type. The + * classes of the {@code javax.print.attribute} package. These abstract syntax + * classes each represent a different type. The * EnumSyntax class, for example, represents a type-safe enumeration. The * abstract syntax class provides a wrapper for the attribute value. *

    @@ -73,9 +73,9 @@ * attribute classes in package javax.print.attribute.standard, just the ones * that pertain to the application. *

    - * The attribute classes in package javax.print.attribute.standard are based on - * the Internet Printing Protocol (IPP) attributes as defined in the Internet - * RFC document, RFC 2911 Internet Printing Protocol/1.1: Model and + * The attribute classes in package {@code javax.print.attribute.standard} are + * based on the Internet Printing Protocol (IPP) attributes as defined in the + * Internet RFC document, RFC 2911 Internet Printing Protocol/1.1: Model and * Semantics dated September 2000. See * RFC 2911 for more * information. The descriptive text for each attribute class was taken largely @@ -152,485 +152,418 @@ * indicates the supported values for that attribute category. * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + *
    Attribute ClassDoc
    Attribute
    Print
    Request
    Attribute
    Print
    Job
    Attribute
    Print
    Service
    Attribute
    SupportedValuesAttribute
    CompressionX    
    DocumentNameX    
    ChromaticityXXX  
    Copies XX CopiesSupported
    FinishingsXXX  
    JobHoldUntil XX  
    JobImpressions XX  - * JobImpressionsSupported
    JobKOctets XX JobKOctetsSupported
    JobMediaSheets XX  - * JobMediaSheetsSupported
    JobName XX  
    JobPriority XX JobPrioritySupported
    JobSheets XX  
    MediaXXX  
    MediaSize     
    - * MultipleDocumentHandling XX  
    NumberUpXXX NumberUpSupported
    OrientationRequestedXXX  
    PageRangesXXX  
    - * PresentationDirectionXXX  
    PrinterResolutionXXX  
    PrintQualityXXX  
    RequestingUserName XX  
    SheetCollateXXX  
    SidesXXX  
    DateTimeAtCompleted  X  
    DateTimeAtCreation  X  
    DateTimeAtProcessing  X  
    - * JobImpressionsCompleted  X  
    JobKOctetsProcessed  X  
    - * JobMediaSheetsCompleted  X  
    - * JobMessageFromOperator  X  
    - * JobOriginatingUserName  X  
    JobState  X  
    JobStateReasons
    - * Contains zero or more --
      X  
    -- JobStateReason     
    NumberOfDocuments  X  
    - * NumberOfInterveningJobs  X  
    OutputDeviceAssigned  X  
    ColorSupported   X 
    PagesPerMinute   X 
    PagesPerMinuteColor   X 
    PDLOverrideSupported   X 
    - * PrinterIsAcceptingJobs   X 
    PrinterInfo   X 
    PrinterLocation   X 
    - * PrinterMessageFromOperator   X 
    PrinterMakeAndModel   X 
    PrinterMoreInfo   X 
    - * PrinterMoreInfoManufacturer   X 
    PrinterName   X 
    PrinterState   X 
    PrinterStateReasons
    - * Contains zero or more --
       X 
    -- PrinterStateReason     
    -- Severity     
    QueuedJobCount   X 
    - * ReferenceUriSchemesSupported     
    Attribute Class + * Doc
    Attribute + *
    Print
    Request
    Attribute + *
    Print
    Job
    Attribute + *
    Print
    Service
    Attribute + *
    SupportedValuesAttribute + *
    Compression + * X + *   + *   + *   + *   + *
    DocumentName + * X + *   + *   + *   + *   + *
    Chromaticity + * X + * X + * X + *   + *   + *
    Copies + *   + * X + * X + *   + * CopiesSupported + *
    Finishings + * X + * X + * X + *   + *   + *
    JobHoldUntil + *   + * X + * X + *   + *   + *
    JobImpressions + *   + * X + * X + *   + * JobImpressionsSupported + *
    JobKOctets + *   + * X + * X + *   + * JobKOctetsSupported + *
    JobMediaSheets + *   + * X + * X + *   + * JobMediaSheetsSupported + *
    JobName + *   + * X + * X + *   + *   + *
    JobPriority + *   + * X + * X + *   + * JobPrioritySupported + *
    JobSheets + *   + * X + * X + *   + *   + *
    Media + * X + * X + * X + *   + *   + *
    MediaSize + *   + *   + *   + *   + *   + *
    MultipleDocumentHandling + *   + * X + * X + *   + *   + *
    NumberUp + * X + * X + * X + *   + * NumberUpSupported + *
    OrientationRequested + * X + * X + * X + *   + *   + *
    PageRanges + * X + * X + * X + *   + *   + *
    PresentationDirection + * X + * X + * X + *   + *   + *
    PrinterResolution + * X + * X + * X + *   + *   + *
    PrintQuality + * X + * X + * X + *   + *   + *
    RequestingUserName + *   + * X + * X + *   + *   + *
    SheetCollate + * X + * X + * X + *   + *   + *
    Sides + * X + * X + * X + *   + *   + *
    DateTimeAtCompleted + *   + *   + * X + *   + *   + *
    DateTimeAtCreation + *   + *   + * X + *   + *   + *
    DateTimeAtProcessing + *   + *   + * X + *   + *   + *
    JobImpressionsCompleted + *   + *   + * X + *   + *   + *
    JobKOctetsProcessed + *   + *   + * X + *   + *   + *
    JobMediaSheetsCompleted + *   + *   + * X + *   + *   + *
    JobMessageFromOperator + *   + *   + * X + *   + *   + *
    JobOriginatingUserName + *   + *   + * X + *   + *   + *
    JobState + *   + *   + * X + *   + *   + *
    JobStateReasons
    + * Contains zero or more -- + *
      + *   + * X + *   + *   + *
    -- JobStateReason + *   + *   + *   + *   + *   + *
    NumberOfDocuments + *   + *   + * X + *   + *   + *
    NumberOfInterveningJobs + *   + *   + * X + *   + *   + *
    OutputDeviceAssigned + *   + *   + * X + *   + *   + *
    ColorSupported + *   + *   + *   + * X + *   + *
    PagesPerMinute + *   + *   + *   + * X + *   + *
    PagesPerMinuteColor + *   + *   + *   + * X + *   + *
    PDLOverrideSupported + *   + *   + *   + * X + *   + *
    PrinterIsAcceptingJobs + *   + *   + *   + * X + *   + *
    PrinterInfo + *   + *   + *   + * X + *   + *
    PrinterLocation + *   + *   + *   + * X + *   + *
    + * PrinterMessageFromOperator + *   + *   + *   + * X + *   + *
    PrinterMakeAndModel + *   + *   + *   + * X + *   + *
    PrinterMoreInfo + *   + *   + *   + * X + *   + *
    + * PrinterMoreInfoManufacturer + *   + *   + *   + * X + *   + *
    PrinterName + *   + *   + *   + * X + *   + *
    PrinterState + *   + *   + *   + * X + *   + *
    PrinterStateReasons
    + * Contains zero or more -- + *
      + *   + *   + * X + *   + *
    -- PrinterStateReason + *   + *   + *   + *   + *   + *
    -- Severity + *   + *   + *   + *   + *   + *
    QueuedJobCount + *   + *   + *   + * X + *   + *
    + * ReferenceUriSchemesSupported + *   + *   + *   + *   + *   *
    *

    - * Please note: In the javax.print APIs, a null reference parameter to methods - * is incorrect unless explicitly documented on the method as having a - * meaningful interpretation. Usage to the contrary is incorrect coding and may - * result in a run time exception either immediately or at some later time. - * IllegalArgumentException and NullPointerException are examples of typical and - * acceptable run time exceptions for such cases. + * Please note: In the {@code javax.print} APIs, a {@code null} reference + * parameter to methods is incorrect unless explicitly documented on the method + * as having a meaningful interpretation. Usage to the contrary is incorrect + * coding and may result in a run time exception either immediately or at some + * later time. {@code IllegalArgumentException} and {@code NullPointerException} + * are examples of typical and acceptable run time exceptions for such cases. * * @since 1.4 */ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/event/PrintEvent.java --- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintEvent.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintEvent.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -26,29 +26,31 @@ package javax.print.event; /** - * - * Class PrintEvent is the super class of all Print Service API events. + * Class {@code PrintEvent} is the super class of all Print Service API events. */ - public class PrintEvent extends java.util.EventObject { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = 2286914924430763847L; /** - * Constructs a PrintEvent object. - * @param source is the source of the event - * @throws IllegalArgumentException if {@code source} is - * {@code null}. + * Constructs a {@code PrintEvent} object. + * + * @param source is the source of the event + * @throws IllegalArgumentException if {@code source} is {@code null} */ public PrintEvent (Object source) { super(source); } /** + * Returns a string representation of this {@code PrintEvent}. + * * @return a message describing the event */ public String toString() { return ("PrintEvent on " + getSource().toString()); } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAdapter.java --- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAdapter.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAdapter.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -26,27 +26,23 @@ package javax.print.event; /** - * An abstract adapter class for receiving print job events. - * The methods in this class are empty. - * This class exists as a convenience for creating listener objects. - * Extend this class to create a {@link PrintJobEvent} listener and override - * the methods for the events of interest. Unlike the - * {@link java.awt.event.ComponentListener ComponentListener} - * interface, this abstract interface provides null methods so that you - * only need to define the methods you need, rather than all of the methods. - * - */ - + * An abstract adapter class for receiving print job events. The methods in this + * class are empty. This class exists as a convenience for creating listener + * objects. Extend this class to create a {@link PrintJobEvent} listener and + * override the methods for the events of interest. Unlike the + * {@link java.awt.event.ComponentListener ComponentListener} interface, this + * abstract interface provides empty methods so that you only need to define the + * methods you need, rather than all of the methods. + */ public abstract class PrintJobAdapter implements PrintJobListener { /** - * Called to notify the client that data has been successfully - * transferred to the print service, and the client may free - * local resources allocated for that data. The client should - * not assume that the data has been completely printed after - * receiving this event. + * Called to notify the client that data has been successfully transferred + * to the print service, and the client may free local resources allocated + * for that data. The client should not assume that the data has been + * completely printed after receiving this event. * - * @param pje the event being notified + * @param pje the event being notified */ public void printDataTransferCompleted(PrintJobEvent pje) { } @@ -54,52 +50,46 @@ /** * Called to notify the client that the job completed successfully. * - * @param pje the event being notified + * @param pje the event being notified */ public void printJobCompleted(PrintJobEvent pje) { } - /** - * Called to notify the client that the job failed to complete - * successfully and will have to be resubmitted. + * Called to notify the client that the job failed to complete successfully + * and will have to be resubmitted. * - * @param pje the event being notified + * @param pje the event being notified */ public void printJobFailed(PrintJobEvent pje) { } /** - * Called to notify the client that the job was canceled - * by user or program. + * Called to notify the client that the job was canceled by user or program. * - * @param pje the event being notified + * @param pje the event being notified */ public void printJobCanceled(PrintJobEvent pje) { } - /** - * Called to notify the client that no more events will be delivered. - * One cause of this event being generated is if the job - * has successfully completed, but the printing system - * is limited in capability and cannot verify this. - * This event is required to be delivered if none of the other + * Called to notify the client that no more events will be delivered. One + * cause of this event being generated is if the job has successfully + * completed, but the printing system is limited in capability and cannot + * verify this. This event is required to be delivered if none of the other * terminal events (completed/failed/canceled) are delivered. * - * @param pje the event being notified + * @param pje the event being notified */ public void printJobNoMoreEvents(PrintJobEvent pje) { } - /** - * Called to notify the client that some possibly user rectifiable - * problem occurs (eg printer out of paper). + * Called to notify the client that some possibly user rectifiable problem + * occurs (eg printer out of paper). * - * @param pje the event being notified + * @param pje the event being notified */ public void printJobRequiresAttention(PrintJobEvent pje) { } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAttributeEvent.java --- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAttributeEvent.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAttributeEvent.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -30,23 +30,28 @@ import javax.print.attribute.PrintJobAttributeSet; /** - * Class PrintJobAttributeEvent encapsulates an event a PrintService - * reports to let the client know that one or more printing attributes for a - * PrintJob have changed. + * Class {@code PrintJobAttributeEvent} encapsulates an event a + * {@code PrintService} reports to let the client know that one or more printing + * attributes for a {@code PrintJob} have changed. */ - public class PrintJobAttributeEvent extends PrintEvent { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -6534469883874742101L; + /** + * The printing service attributes that changed. + */ private PrintJobAttributeSet attributes; /** - * Constructs a PrintJobAttributeEvent object. - * @param source the print job generating this event - * @param attributes the attribute changes being reported - * @throws IllegalArgumentException if {@code source} is - * {@code null}. + * Constructs a {@code PrintJobAttributeEvent} object. + * + * @param source the print job generating this event + * @param attributes the attribute changes being reported + * @throws IllegalArgumentException if {@code source} is {@code null} */ public PrintJobAttributeEvent (DocPrintJob source, PrintJobAttributeSet attributes) { @@ -55,28 +60,24 @@ this.attributes = AttributeSetUtilities.unmodifiableView(attributes); } - /** - * Determine the Print Job to which this print job event pertains. + * Determine the {@code PrintJob} to which this print job event pertains. * - * @return Print Job object. + * @return {@code PrintJob} object */ public DocPrintJob getPrintJob() { return (DocPrintJob) getSource(); } - /** * Determine the printing attributes that changed and their new values. * - * @return Attributes containing the new values for the print job - * attributes that changed. The returned set may not be modifiable. + * @return attributes containing the new values for the print job attributes + * that changed. The returned set may not be modifiable. */ public PrintJobAttributeSet getAttributes() { return attributes; - } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAttributeListener.java --- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAttributeListener.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobAttributeListener.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -26,21 +26,19 @@ package javax.print.event; /** - * Implementations of this interface are attached to a - * {@link javax.print.DocPrintJob DocPrintJob} to monitor - * the status of attribute changes associated with the print job. - * - */ + * Implementations of this interface are attached to a + * {@link javax.print.DocPrintJob DocPrintJob} to monitor the status of + * attribute changes associated with the print job. + */ public interface PrintJobAttributeListener { /** - * Notifies the listener of a change in some print job attributes. - * One example of an occurrence triggering this event is if the - * {@link javax.print.attribute.standard.JobState JobState} - * attribute changed from - * {@code PROCESSING} to {@code PROCESSING_STOPPED}. - * @param pjae the event. + * Notifies the listener of a change in some print job attributes. One + * example of an occurrence triggering this event is if the + * {@link javax.print.attribute.standard.JobState JobState} attribute + * changed from {@code PROCESSING} to {@code PROCESSING_STOPPED}. + * + * @param pjae the event being notified */ public void attributeUpdate(PrintJobAttributeEvent pjae) ; - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/event/PrintJobEvent.java --- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobEvent.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobEvent.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -28,98 +28,95 @@ import javax.print.DocPrintJob; /** - * - * Class {@code PrintJobEvent} encapsulates common events a print job - * reports to let a listener know of progress in the processing of the - * {@link DocPrintJob}. - * + * Class {@code PrintJobEvent} encapsulates common events a print job reports to + * let a listener know of progress in the processing of the {@link DocPrintJob}. */ - public class PrintJobEvent extends PrintEvent { - private static final long serialVersionUID = -1711656903622072997L; - - private int reason; + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ + private static final long serialVersionUID = -1711656903622072997L; - /** - * The job was canceled by the {@link javax.print.PrintService PrintService}. - */ - public static final int JOB_CANCELED = 101; + /** + * The reason of this event. + */ + private int reason; - /** - * The document cis completely printed. - */ - public static final int JOB_COMPLETE = 102; + /** + * The job was canceled by the + * {@link javax.print.PrintService PrintService}. + */ + public static final int JOB_CANCELED = 101; - /** - * The print service reports that the job cannot be completed. - * The application must resubmit the job. - */ + /** + * The document is completely printed. + */ + public static final int JOB_COMPLETE = 102; - public static final int JOB_FAILED = 103; + /** + * The print service reports that the job cannot be completed. The + * application must resubmit the job. + */ + public static final int JOB_FAILED = 103; - /** - * The print service indicates that a - possibly transient - problem - * may require external intervention before the print service can - * continue. One example of an event that can - * generate this message is when the printer runs out of paper. - */ - public static final int REQUIRES_ATTENTION = 104; + /** + * The print service indicates that a - possibly transient - problem may + * require external intervention before the print service can continue. One + * example of an event that can generate this message is when the printer + * runs out of paper. + */ + public static final int REQUIRES_ATTENTION = 104; - /** - * Not all print services may be capable of delivering interesting - * events, or even telling when a job is complete. This message indicates - * the print job has no further information or communication - * with the print service. This message should always be delivered - * if a terminal event (completed/failed/canceled) is not delivered. - * For example, if messages such as JOB_COMPLETE have NOT been received - * before receiving this message, the only inference that should be drawn - * is that the print service does not support delivering such an event. - */ - public static final int NO_MORE_EVENTS = 105; + /** + * Not all print services may be capable of delivering interesting events, + * or even telling when a job is complete. This message indicates the print + * job has no further information or communication with the print service. + * This message should always be delivered if a terminal event + * (completed/failed/canceled) is not delivered. For example, if messages + * such as {@code JOB_COMPLETE} have NOT been received before receiving this + * message, the only inference that should be drawn is that the print + * service does not support delivering such an event. + */ + public static final int NO_MORE_EVENTS = 105; - /** - * The job is not necessarily printed yet, but the data has been transferred - * successfully from the client to the print service. The client may - * free data resources. - */ - public static final int DATA_TRANSFER_COMPLETE = 106; + /** + * The job is not necessarily printed yet, but the data has been transferred + * successfully from the client to the print service. The client may free + * data resources. + */ + public static final int DATA_TRANSFER_COMPLETE = 106; - /** + /** * Constructs a {@code PrintJobEvent} object. * - * @param source a {@code DocPrintJob} object - * @param reason an int specifying the reason. - * @throws IllegalArgumentException if {@code source} is - * {@code null}. + * @param source a {@code DocPrintJob} object + * @param reason an int specifying the reason + * @throws IllegalArgumentException if {@code source} is {@code null} */ - public PrintJobEvent( DocPrintJob source, int reason) { super(source); this.reason = reason; - } + } /** * Gets the reason for this event. - * @return reason int. + * + * @return reason int */ public int getPrintEventType() { return reason; } /** - * Determines the {@code DocPrintJob} to which this print job - * event pertains. + * Determines the {@code DocPrintJob} to which this print job event + * pertains. * - * @return the {@code DocPrintJob} object that represents the - * print job that reports the events encapsulated by this - * {@code PrintJobEvent}. - * + * @return the {@code DocPrintJob} object that represents the print job that + * reports the events encapsulated by this {@code PrintJobEvent} */ public DocPrintJob getPrintJob() { return (DocPrintJob) getSource(); } - - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/event/PrintJobListener.java --- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobListener.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintJobListener.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -26,70 +26,66 @@ package javax.print.event; /** - * Implementations of this listener interface should be attached to a - * {@link javax.print.DocPrintJob DocPrintJob} to monitor the status of - * the printer job. - * These callback methods may be invoked on the thread processing the - * print job, or a service created notification thread. In either case - * the client should not perform lengthy processing in these callbacks. - */ - + * Implementations of this listener interface should be attached to a + * {@link javax.print.DocPrintJob DocPrintJob} to monitor the status of the + * printer job. These callback methods may be invoked on the thread processing + * the print job, or a service created notification thread. In either case the + * client should not perform lengthy processing in these callbacks. + */ public interface PrintJobListener { /** - * Called to notify the client that data has been successfully - * transferred to the print service, and the client may free - * local resources allocated for that data. The client should - * not assume that the data has been completely printed after - * receiving this event. - * If this event is not received the client should wait for a terminal - * event (completed/canceled/failed) before freeing the resources. - * @param pje the job generating this event + * Called to notify the client that data has been successfully transferred + * to the print service, and the client may free local resources allocated + * for that data. The client should not assume that the data has been + * completely printed after receiving this event. If this event is not + * received the client should wait for a terminal event + * (completed/canceled/failed) before freeing the resources. + * + * @param pje the job generating this event */ public void printDataTransferCompleted(PrintJobEvent pje) ; - /** * Called to notify the client that the job completed successfully. - * @param pje the job generating this event + * + * @param pje the job generating this event */ public void printJobCompleted(PrintJobEvent pje) ; - /** - * Called to notify the client that the job failed to complete - * successfully and will have to be resubmitted. - * @param pje the job generating this event + * Called to notify the client that the job failed to complete successfully + * and will have to be resubmitted. + * + * @param pje the job generating this event */ public void printJobFailed(PrintJobEvent pje) ; - /** - * Called to notify the client that the job was canceled - * by a user or a program. - * @param pje the job generating this event + * Called to notify the client that the job was canceled by a user or a + * program. + * + * @param pje the job generating this event */ public void printJobCanceled(PrintJobEvent pje) ; - /** - * Called to notify the client that no more events will be delivered. - * One cause of this event being generated is if the job - * has successfully completed, but the printing system - * is limited in capability and cannot verify this. - * This event is required to be delivered if none of the other + * Called to notify the client that no more events will be delivered. One + * cause of this event being generated is if the job has successfully + * completed, but the printing system is limited in capability and cannot + * verify this. This event is required to be delivered if none of the other * terminal events (completed/failed/canceled) are delivered. - * @param pje the job generating this event + * + * @param pje the job generating this event */ public void printJobNoMoreEvents(PrintJobEvent pje) ; - /** - * Called to notify the client that an error has occurred that the - * user might be able to fix. One example of an error that can - * generate this event is when the printer runs out of paper. - * @param pje the job generating this event + * Called to notify the client that an error has occurred that the user + * might be able to fix. One example of an error that can generate this + * event is when the printer runs out of paper. + * + * @param pje the job generating this event */ public void printJobRequiresAttention(PrintJobEvent pje) ; - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/event/PrintServiceAttributeEvent.java --- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintServiceAttributeEvent.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintServiceAttributeEvent.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -30,25 +30,28 @@ import javax.print.attribute.PrintServiceAttributeSet; /** - * - * Class PrintServiceAttributeEvent encapsulates an event a - * Print Service instance reports to let the client know of - * changes in the print service state. + * Class {@code PrintServiceAttributeEvent} encapsulates an event a Print + * Service instance reports to let the client know of changes in the print + * service state. */ - public class PrintServiceAttributeEvent extends PrintEvent { + /** + * Use serialVersionUID from JDK 1.4 for interoperability. + */ private static final long serialVersionUID = -7565987018140326600L; + /** + * The printing service attributes that changed. + */ private PrintServiceAttributeSet attributes; /** - * Constructs a PrintServiceAttributeEvent object. + * Constructs a {@code PrintServiceAttributeEvent} object. * - * @param source the print job generating this event - * @param attributes the attribute changes being reported - * @throws IllegalArgumentException if {@code source} is - * {@code null}. + * @param source the print job generating this event + * @param attributes the attribute changes being reported + * @throws IllegalArgumentException if {@code source} is {@code null} */ public PrintServiceAttributeEvent(PrintService source, PrintServiceAttributeSet attributes) { @@ -57,28 +60,25 @@ this.attributes = AttributeSetUtilities.unmodifiableView(attributes); } - /** * Returns the print service. - - * @return Print Service object. + * + * @return {@code PrintService} object */ public PrintService getPrintService() { return (PrintService) getSource(); } - /** * Determine the printing service attributes that changed and their new * values. * - * @return Attributes containing the new values for the service - * attributes that changed. The returned set may be unmodifiable. + * @return attributes containing the new values for the service attributes + * that changed. The returned set may be unmodifiable. */ public PrintServiceAttributeSet getAttributes() { return attributes; } - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/event/PrintServiceAttributeListener.java --- a/jdk/src/java.desktop/share/classes/javax/print/event/PrintServiceAttributeListener.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/event/PrintServiceAttributeListener.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, 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 @@ -26,23 +26,22 @@ package javax.print.event; /** - * Implementations of this listener interface are attached to a - * {@link javax.print.PrintService PrintService} to monitor - * the status of the print service. - *

    - * To monitor a particular job see {@link PrintJobListener} and - * {@link PrintJobAttributeListener}. - */ - + * Implementations of this listener interface are attached to a + * {@link javax.print.PrintService PrintService} to monitor the status of the + * print service. + *

    + * To monitor a particular job see {@link PrintJobListener} and + * {@link PrintJobAttributeListener}. + */ public interface PrintServiceAttributeListener { /** - * Called to notify a listener of an event in the print service. - * The service will call this method on an event notification thread. - * The client should not perform lengthy processing in this callback - * or subsequent event notifications may be blocked. - * @param psae the event being notified + * Called to notify a listener of an event in the print service. The service + * will call this method on an event notification thread. The client should + * not perform lengthy processing in this callback or subsequent event + * notifications may be blocked. + * + * @param psae the event being notified */ public void attributeUpdate(PrintServiceAttributeEvent psae) ; - } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/event/package-info.java --- a/jdk/src/java.desktop/share/classes/javax/print/event/package-info.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/event/package-info.java Sat Sep 09 14:36:45 2017 +0200 @@ -24,17 +24,18 @@ */ /** - * Package javax.print.event contains event classes and listener interfaces. + * Package {@code javax.print.event} contains event classes and listener + * interfaces. *

    * They may be used to monitor both print services (such as printers going * on-line & off-line), and the progress of a specific print job. *

    - * Please note: In the javax.print APIs, a null reference parameter to methods - * is incorrect unless explicitly documented on the method as having a - * meaningful interpretation. Usage to the contrary is incorrect coding and may - * result in a run time exception either immediately or at some later time. - * IllegalArgumentException and NullPointerException are examples of typical and - * acceptable run time exceptions for such cases. + * Please note: In the {@code javax.print} APIs, a {@code null} reference + * parameter to methods is incorrect unless explicitly documented on the method + * as having a meaningful interpretation. Usage to the contrary is incorrect + * coding and may result in a run time exception either immediately or at some + * later time. {@code IllegalArgumentException} and {@code NullPointerException} + * are examples of typical and acceptable run time exceptions for such cases. * * @since 1.4 */ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/print/package-info.java --- a/jdk/src/java.desktop/share/classes/javax/print/package-info.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/package-info.java Sat Sep 09 14:36:45 2017 +0200 @@ -28,10 +28,10 @@ * Service API. The Java Print Service API enables client and server * applications to: *

      - *
    • Discover and select print services based on their capabilities
    • - *
    • Specify the format of print data
    • - *
    • Submit print jobs to services that support the document type to be - * printed.
    • + *
    • Discover and select print services based on their capabilities + *
    • Specify the format of print data + *
    • Submit print jobs to services that support the document type to be + * printed. *
    * *

    Print Service Discovery

    @@ -51,15 +51,15 @@ *

    Attribute Definitions

    * The {@link javax.print.attribute} and {@link javax.print.attribute.standard} * packages define print attributes, which describe the capabilities of a print - * service, specify the requirements of a print job, and track the progress of - * a print job. + * service, specify the requirements of a print job, and track the progress of a + * print job. *

    * The {@code javax.print.attribute} package describes the types of attributes * and how they can be collected into sets. The * {@code javax.print.attribute.standard} package enumerates all of the standard * attributes supported by the API, most of which are implementations of * attributes specified in the IETF Specification, - * RFC 2911 Internet Printing + * RFC 2911 Internet Printing * Protocol, 1.1: Model and Semantics, dated September 2000. The attributes * specified in {@code javax.print.attribute.standard} include common * capabilities, such as: resolution, copies, media sizes, job priority, and @@ -78,16 +78,16 @@ * A typical application using the Java Print Service API performs these steps * to process a print request: *

      - *
    1. Chooses a {@code DocFlavor}.
    2. - *
    3. Creates a set of attributes.
    4. - *
    5. Locates a print service that can handle the print request as - * specified by the {@code DocFlavor} and the attribute set.
    6. - *
    7. Creates a {@link javax.print.Doc Doc} object encapsulating the - * {@code DocFlavor} and the actual print data, which can take many forms - * including: a Postscript file, a JPEG image, a URL, or plain text.
    8. - *
    9. Gets a print job, represented by - * {@link javax.print.DocPrintJob DocPrintJob}, from the print service.
    10. - *
    11. Calls the print method of the print job.
    12. + *
    13. Chooses a {@code DocFlavor}. + *
    14. Creates a set of attributes. + *
    15. Locates a print service that can handle the print request as specified + * by the {@code DocFlavor} and the attribute set. + *
    16. Creates a {@link javax.print.Doc Doc} object encapsulating the + * {@code DocFlavor} and the actual print data, which can take many forms + * including: a Postscript file, a JPEG image, a {@code URL}, or plain text. + *
    17. Gets a print job, represented by + * {@link javax.print.DocPrintJob DocPrintJob}, from the print service. + *
    18. Calls the print method of the print job. *
    * The following code sample demonstrates a typical use of the Java Print * Service API: locating printers that can print five double-sided copies of a @@ -119,13 +119,13 @@ * } * } * - *

    - * Please note: In the javax.print APIs, a null reference parameter to methods - * is incorrect unless explicitly documented on the method as having a - * meaningful interpretation. Usage to the contrary is incorrect coding and may - * result in a run time exception either immediately or at some later time. - * IllegalArgumentException and NullPointerException are examples of typical and - * acceptable run time exceptions for such cases. + *

    + * Please note: In the {@code javax.print} APIs, a {@code null} reference + * parameter to methods is incorrect unless explicitly documented on the method + * as having a meaningful interpretation. Usage to the contrary is incorrect + * coding and may result in a run time exception either immediately or at some + * later time. {@code IllegalArgumentException} and {@code NullPointerException} + * are examples of typical and acceptable run time exceptions for such cases. * * @since 1.4 */ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/InvalidMidiDataException.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/InvalidMidiDataException.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/InvalidMidiDataException.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -39,6 +39,9 @@ */ public class InvalidMidiDataException extends Exception { + /** + * Use serialVersionUID from JDK 1.3 for interoperability. + */ private static final long serialVersionUID = 2780771756789932067L; /** diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MetaMessage.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -54,8 +54,8 @@ /** * Status byte for {@code MetaMessage} (0xFF, or 255), which is used in MIDI - * files. It has the same value as SYSTEM_RESET, which is used in the - * real-time "MIDI wire" protocol. + * files. It has the same value as {@link ShortMessage#SYSTEM_RESET}, which + * is used in the real-time "MIDI wire" protocol. * * @see MidiMessage#getStatus */ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDevice.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDevice.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDevice.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -64,11 +64,11 @@ * {@code MidiDevice} instance, the following rules apply: * *

      - *
    • After an explicit open (either before or after implicit opens), the - * device will not be closed by implicit closing. The only way to close an - * explicitly opened device is an explicit close.
    • - *
    • An explicit close always closes the device, even if it also has been - * opened implicitly. A subsequent implicit close has no further effect.
    • + *
    • After an explicit open (either before or after implicit opens), the + * device will not be closed by implicit closing. The only way to close an + * explicitly opened device is an explicit close. + *
    • An explicit close always closes the device, even if it also has been + * opened implicitly. A subsequent implicit close has no further effect. *
    * * To detect if a MidiDevice represents a hardware MIDI port, the following @@ -76,7 +76,7 @@ * *
    {@code
      * MidiDevice device = ...;
    - * if ( ! (device instanceof Sequencer) && ! (device instanceof Synthesizer)) {
    + * if (!(device instanceof Sequencer) && !(device instanceof Synthesizer)) {
      *   // we're now sure that device represents a MIDI port
      *   // ...
      * }
    @@ -112,7 +112,8 @@
          * resources and allow applications to exit cleanly.
          * 

    * Note that some devices, once closed, cannot be reopened. Attempts to - * reopen such a device will always result in a MidiUnavailableException. + * reopen such a device will always result in a + * {@code MidiUnavailableException}. * * @throws MidiUnavailableException thrown if the device cannot be opened * due to resource restrictions @@ -198,7 +199,8 @@ /** * Returns all currently active, non-closed receivers connected with this - * MidiDevice. A receiver can be removed from the device by closing it. + * {@code MidiDevice}. A receiver can be removed from the device by closing + * it. *

    * Usually the returned receivers implement the {@code MidiDeviceReceiver} * interface. @@ -231,7 +233,8 @@ /** * Returns all currently active, non-closed transmitters connected with this - * MidiDevice. A transmitter can be removed from the device by closing it. + * {@code MidiDevice}. A transmitter can be removed from the device by + * closing it. *

    * Usually the returned transmitters implement the * {@code MidiDeviceTransmitter} interface. @@ -288,12 +291,12 @@ } /** - * Reports whether two objects are equal. Returns {@code true} if the - * objects are identical. + * Indicates whether the specified object is equal to this info object, + * returning {@code true} if the objects are the same. * - * @param obj the reference object with which to compare this object - * @return {@code true} if this object is the same as the {@code obj} - * argument; {@code false} otherwise + * @param obj the reference object with which to compare + * @return {@code true} if the specified object is equal to this info + * object; {@code false} otherwise */ @Override public final boolean equals(Object obj) { @@ -301,7 +304,9 @@ } /** - * Finalizes the hashcode method. + * Returns a hash code value for this info object. + * + * @return a hash code value for this info object */ @Override public final int hashCode() { @@ -353,5 +358,5 @@ public final String toString() { return name; } - } // class Info + } } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDeviceReceiver.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDeviceReceiver.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDeviceReceiver.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2017, 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 @@ -35,9 +35,11 @@ public interface MidiDeviceReceiver extends Receiver { /** - * Obtains a MidiDevice object which is an owner of this Receiver. + * Obtains a {@code MidiDevice} object which is an owner of this + * {@code Receiver}. * - * @return a MidiDevice object which is an owner of this Receiver + * @return a {@code MidiDevice} object which is an owner of this + * {@code Receiver} */ MidiDevice getMidiDevice(); } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDeviceTransmitter.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDeviceTransmitter.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiDeviceTransmitter.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2017, 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 @@ -35,9 +35,11 @@ public interface MidiDeviceTransmitter extends Transmitter { /** - * Obtains a MidiDevice object which is an owner of this Transmitter. + * Obtains a {@code MidiDevice} object which is an owner of this + * {@code Transmitter}. * - * @return a MidiDevice object which is an owner of this Transmitter + * @return a {@code MidiDevice} object which is an owner of this + * {@code Transmitter} */ MidiDevice getMidiDevice(); } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/MidiFileFormat.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiFileFormat.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiFileFormat.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -44,37 +44,31 @@ * implementations: * * - - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + *
    MIDI File Format Properties
    Property keyValue typeDescription
    "author"{@link java.lang.String String}name of the author of this file
    "title"{@link java.lang.String String}title of this file
    "copyright"{@link java.lang.String String}copyright message
    "date"{@link java.util.Date Date}date of the recording or release
    "comment"{@link java.lang.String String}an arbitrary text
    MIDI File Format Properties
    Property key + * Value type + * Description + *
    "author" + * {@link String String} + * name of the author of this file + *
    "title" + * {@link String String} + * title of this file + *
    "copyright" + * {@link String String} + * copyright message + *
    "date" + * {@link java.util.Date Date} + * date of the recording or release + *
    "comment" + * {@link String String} + * an arbitrary text *
    * * @author Kara Kytle @@ -135,10 +129,10 @@ * @param divisionType the timing division type (PPQ or one of the SMPTE * types) * @param resolution the timing resolution - * @param bytes the length of the MIDI file in bytes, or UNKNOWN_LENGTH if - * not known + * @param bytes the length of the MIDI file in bytes, or + * {@link #UNKNOWN_LENGTH} if not known * @param microseconds the duration of the file in microseconds, or - * UNKNOWN_LENGTH if not known + * {@link #UNKNOWN_LENGTH} if not known * @see #UNKNOWN_LENGTH * @see Sequence#PPQ * @see Sequence#SMPTE_24 @@ -163,10 +157,10 @@ * @param divisionType the timing division type (PPQ or one of the SMPTE * types) * @param resolution the timing resolution - * @param bytes the length of the MIDI file in bytes, or UNKNOWN_LENGTH if - * not known + * @param bytes the length of the MIDI file in bytes, or + * {@code UNKNOWN_LENGTH} if not known * @param microseconds the duration of the file in microseconds, or - * UNKNOWN_LENGTH if not known + * {@code UNKNOWN_LENGTH} if not known * @param properties a {@code Map} object with properties * @see #UNKNOWN_LENGTH * @see Sequence#PPQ @@ -224,7 +218,8 @@ /** * Obtains the length of the MIDI file, expressed in 8-bit bytes. * - * @return the number of bytes in the file, or UNKNOWN_LENGTH if not known + * @return the number of bytes in the file, or {@code UNKNOWN_LENGTH} if not + * known * @see #UNKNOWN_LENGTH */ public int getByteLength() { @@ -234,8 +229,8 @@ /** * Obtains the length of the MIDI file, expressed in microseconds. * - * @return the file's duration in microseconds, or UNKNOWN_LENGTH if not - * known + * @return the file's duration in microseconds, or {@code UNKNOWN_LENGTH} if + * not known * @see Sequence#getMicrosecondLength() * @see #getByteLength * @see #UNKNOWN_LENGTH diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiMessage.java Sat Sep 09 14:36:45 2017 +0200 @@ -38,29 +38,29 @@ * The base {@code MidiMessage} class provides access to three types of * information about a MIDI message: *

      - *
    • The messages's status byte
    • - *
    • The total length of the message in bytes (the status byte plus any data - * bytes)
    • - *
    • A byte array containing the complete message
    • + *
    • The messages's status byte + *
    • The total length of the message in bytes (the status byte plus any data + * bytes) + *
    • A byte array containing the complete message *
    * * {@code MidiMessage} includes methods to get, but not set, these values. * Setting them is a subclass responsibility. *

    - * The MIDI standard expresses MIDI data in - * bytes. However, because JavaTM uses signed bytes, the Java Sound - * API uses integers instead of bytes when expressing MIDI data. For example, - * the {@link #getStatus()} method of {@code MidiMessage} returns MIDI status - * bytes as integers. If you are processing MIDI data that originated outside - * Java Sound and now is encoded as signed bytes, the bytes can be - * converted to integers using this conversion: + * The MIDI standard expresses MIDI data in bytes. + * However, because Java™ uses signed bytes, the Java Sound API uses + * integers instead of bytes when expressing MIDI data. For example, the + * {@link #getStatus()} method of {@code MidiMessage} returns MIDI status bytes + * as integers. If you are processing MIDI data that originated outside Java + * Sound and now is encoded as signed bytes, the bytes can be converted to + * integers using this conversion: *

    * {@code int i = (int)(byte & 0xFF)} *

    * If you simply need to pass a known MIDI byte value as a method parameter, it * can be expressed directly as an integer, using (for example) decimal or * hexadecimal notation. For instance, to pass the "active sensing" status byte - * as the first argument to ShortMessage's + * as the first argument to {@code ShortMessage}'s * {@link ShortMessage#setMessage(int) setMessage(int)} method, you can express * it as 254 or 0xFE. * diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java Sat Sep 09 14:36:45 2017 +0200 @@ -57,7 +57,7 @@ * one or more {@code MidiSystem} methods to learn what devices are installed * and to obtain the ones needed in that application. *

    - * The class also has methods for reading files, streams, and URLs that contain + * The class also has methods for reading files, streams, and URLs that contain * standard MIDI file data or soundbanks. You can query the {@code MidiSystem} * for the format of a specified MIDI file. *

    @@ -77,33 +77,28 @@ * * * - * - * - * - * - * + * + * * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * *
    MIDI System Property Keys
    Property KeyInterfaceAffected Method
    Property Key + * Interface + * Affected Method *
    {@code javax.sound.midi.Receiver}{@link Receiver}{@link #getReceiver}
    {@code javax.sound.midi.Sequencer}{@link Sequencer}{@link #getSequencer}
    {@code javax.sound.midi.Synthesizer}{@link Synthesizer}{@link #getSynthesizer}
    {@code javax.sound.midi.Transmitter}{@link Transmitter}{@link #getTransmitter}
    {@code javax.sound.midi.Receiver} + * {@link Receiver} + * {@link #getReceiver} + *
    {@code javax.sound.midi.Sequencer} + * {@link Sequencer} + * {@link #getSequencer} + *
    {@code javax.sound.midi.Synthesizer} + * {@link Synthesizer} + * {@link #getSynthesizer} + *
    {@code javax.sound.midi.Transmitter} + * {@link Transmitter} + * {@link #getTransmitter} *
    * @@ -567,8 +562,7 @@ * @return an {@code MidiFileFormat} object describing the MIDI file format * @throws InvalidMidiDataException if the stream does not point to valid * MIDI file data recognized by the system - * @throws IOException if an I/O exception occurs while accessing the - * stream + * @throws IOException if an I/O exception occurs while accessing the stream * @throws NullPointerException if {@code stream} is {@code null} * @see #getMidiFileFormat(URL) * @see #getMidiFileFormat(File) @@ -1027,21 +1021,42 @@ } // HELPER METHODS + + /** + * Obtains the list of MidiDeviceProviders installed on the system. + * + * @return the list of MidiDeviceProviders installed on the system + */ @SuppressWarnings("unchecked") private static List getMidiDeviceProviders() { return (List) getProviders(MidiDeviceProvider.class); } + /** + * Obtains the list of SoundbankReaders installed on the system. + * + * @return the list of SoundbankReaders installed on the system + */ @SuppressWarnings("unchecked") private static List getSoundbankReaders() { return (List) getProviders(SoundbankReader.class); } + /** + * Obtains the list of MidiFileWriters installed on the system. + * + * @return the list of MidiFileWriters installed on the system + */ @SuppressWarnings("unchecked") private static List getMidiFileWriters() { return (List) getProviders(MidiFileWriter.class); } + /** + * Obtains the list of MidiFileReaders installed on the system. + * + * @return the list of MidiFileReaders installed on the system + */ @SuppressWarnings("unchecked") private static List getMidiFileReaders() { return (List) getProviders(MidiFileReader.class); @@ -1056,6 +1071,7 @@ * * @param deviceClass The requested device type, one of Synthesizer.class, * Sequencer.class, Receiver.class or Transmitter.class + * @return default MidiDevice of the specified type * @throws MidiUnavailableException on failure */ private static MidiDevice getDefaultDeviceWrapper(Class deviceClass) @@ -1074,6 +1090,7 @@ * * @param deviceClass The requested device type, one of Synthesizer.class, * Sequencer.class, Receiver.class or Transmitter.class + * @return default MidiDevice of the specified type. * @throws IllegalArgumentException on failure */ private static MidiDevice getDefaultDevice(Class deviceClass) { @@ -1098,9 +1115,12 @@ } } - /* Provider class not specified or cannot be found, or - provider class specified, and no appropriate device available or - provider class and instance specified and instance cannot be found or is not appropriate */ + /* + * - Provider class not specified or cannot be found, or + * - provider class specified, and no appropriate device available, or + * - provider class and instance specified and instance cannot be found + * or is not appropriate + */ if (instanceName != null) { device = getNamedDevice(instanceName, providers, deviceClass); if (device != null) { @@ -1108,8 +1128,10 @@ } } - /* No default are specified, or if something is specified, everything - failed. */ + /* + * No defaults are specified, or if something is specified, everything + * failed + */ device = getFirstDevice(providers, deviceClass); if (device != null) { return device; @@ -1176,6 +1198,17 @@ * @param provider The MidiDeviceProvider to check for MidiDevices * @param deviceClass The requested device type, one of Synthesizer.class, * Sequencer.class, Receiver.class or Transmitter.class + * @param allowSynthesizer if true, Synthesizers are considered + * appropriate. Otherwise only pure MidiDevices are considered + * appropriate (unless allowSequencer is true). This flag only has + * an effect for deviceClass Receiver and Transmitter. For other + * device classes (Sequencer and Synthesizer), this flag has no + * effect. + * @param allowSequencer if true, Sequencers are considered appropriate. + * Otherwise only pure MidiDevices are considered appropriate + * (unless allowSynthesizer is true). This flag only has an effect + * for deviceClass Receiver and Transmitter. For other device + * classes (Sequencer and Synthesizer), this flag has no effect. * @return A MidiDevice matching the requirements, or null if none is found */ private static MidiDevice getNamedDevice(String deviceName, @@ -1237,6 +1270,17 @@ * MidiDevices * @param deviceClass The requested device type, one of Synthesizer.class, * Sequencer.class, Receiver.class or Transmitter.class + * @param allowSynthesizer if true, Synthesizers are considered + * appropriate. Otherwise only pure MidiDevices are considered + * appropriate (unless allowSequencer is true). This flag only has + * an effect for deviceClass Receiver and Transmitter. For other + * device classes (Sequencer and Synthesizer), this flag has no + * effect. + * @param allowSequencer if true, Sequencers are considered appropriate. + * Otherwise only pure MidiDevices are considered appropriate + * (unless allowSynthesizer is true). This flag only has an effect + * for deviceClass Receiver and Transmitter. For other device + * classes (Sequencer and Synthesizer), this flag has no effect. * @return A Mixer matching the requirements, or null if none is found */ private static MidiDevice getNamedDevice(String deviceName, @@ -1294,6 +1338,17 @@ * @param provider The MidiDeviceProvider to check for MidiDevices * @param deviceClass The requested device type, one of Synthesizer.class, * Sequencer.class, Receiver.class or Transmitter.class + * @param allowSynthesizer if true, Synthesizers are considered + * appropriate. Otherwise only pure MidiDevices are considered + * appropriate (unless allowSequencer is true). This flag only has + * an effect for deviceClass Receiver and Transmitter. For other + * device classes (Sequencer and Synthesizer), this flag has no + * effect. + * @param allowSequencer if true, Sequencers are considered appropriate. + * Otherwise only pure MidiDevices are considered appropriate + * (unless allowSynthesizer is true). This flag only has an effect + * for deviceClass Receiver and Transmitter. For other device + * classes (Sequencer and Synthesizer), this flag has no effect. * @return A MidiDevice is considered appropriate, or null if no appropriate * device is found */ @@ -1351,6 +1406,17 @@ * @param providers The List of MidiDeviceProviders to search * @param deviceClass The requested device type, one of Synthesizer.class, * Sequencer.class, Receiver.class or Transmitter.class + * @param allowSynthesizer if true, Synthesizers are considered + * appropriate. Otherwise only pure MidiDevices are considered + * appropriate (unless allowSequencer is true). This flag only has + * an effect for deviceClass Receiver and Transmitter. For other + * device classes (Sequencer and Synthesizer), this flag has no + * effect. + * @param allowSequencer if true, Sequencers are considered appropriate. + * Otherwise only pure MidiDevices are considered appropriate + * (unless allowSynthesizer is true). This flag only has an effect + * for deviceClass Receiver and Transmitter. For other device + * classes (Sequencer and Synthesizer), this flag has no effect. * @return A MidiDevice that is considered appropriate, or null if none is * found */ @@ -1379,6 +1445,8 @@ * respectively. * * @param device the MidiDevice to test + * @param deviceClass The requested device type, one of Synthesizer.class, + * Sequencer.class, Receiver.class or Transmitter.class * @param allowSynthesizer if true, Synthesizers are considered * appropriate. Otherwise only pure MidiDevices are considered * appropriate (unless allowSequencer is true). This flag only has @@ -1429,10 +1497,15 @@ * Obtains the set of services currently installed on the system using the * SPI mechanism in 1.3. * + * @param providerClass The type of providers requested. This should be one + * of AudioFileReader.class, AudioFileWriter.class, + * FormatConversionProvider.class, MixerProvider.class, + * MidiDeviceProvider.class, MidiFileReader.class, + * MidiFileWriter.class or SoundbankReader.class. * @return a List of instances of providers for the requested service. If no * providers are available, a List of length 0 will be returned. */ - private static List getProviders(Class providerClass) { - return JDK13Services.getProviders(providerClass); + private static List getProviders(Class providerClass) { + return JDK13Services.getProviders(providerClass); } } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/MidiUnavailableException.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiUnavailableException.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiUnavailableException.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -39,6 +39,9 @@ */ public class MidiUnavailableException extends Exception { + /** + * Use serialVersionUID from JDK 1.3 for interoperability. + */ private static final long serialVersionUID = 6093809578628944323L; /** diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/Receiver.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Receiver.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Receiver.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -64,7 +64,7 @@ * closed, too. For a detailed description of open/close behaviour see the * class description of {@link MidiDevice MidiDevice}. * - * @see javax.sound.midi.MidiSystem#getReceiver + * @see MidiSystem#getReceiver */ @Override void close(); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Sequencer.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -38,22 +38,22 @@ * The {@code Sequencer} interface includes methods for the following basic MIDI * sequencer operations: *

      - *
    • obtaining a sequence from MIDI file data
    • - *
    • starting and stopping playback
    • - *
    • moving to an arbitrary position in the sequence
    • - *
    • changing the tempo (speed) of playback
    • - *
    • synchronizing playback to an internal clock or to received MIDI - * messages
    • - *
    • controlling the timing of another device
    • + *
    • obtaining a sequence from MIDI file data + *
    • starting and stopping playback + *
    • moving to an arbitrary position in the sequence + *
    • changing the tempo (speed) of playback + *
    • synchronizing playback to an internal clock or to received MIDI + * messages + *
    • controlling the timing of another device *
    * In addition, the following operations are supported, either directly, or * indirectly through objects that the {@code Sequencer} has access to: *
      - *
    • editing the data by adding or deleting individual MIDI events or entire - * tracks
    • - *
    • muting or soloing individual tracks in the sequence
    • - *
    • notifying listener objects about any meta-events or control-change events - * encountered while playing back the sequence.
    • + *
    • editing the data by adding or deleting individual MIDI events or entire + * tracks + *
    • muting or soloing individual tracks in the sequence + *
    • notifying listener objects about any meta-events or control-change + * events encountered while playing back the sequence *
    * * @author Kara Kytle @@ -694,12 +694,13 @@ } /** - * Determines whether two objects are equal. Returns {@code true} if the - * objects are identical. + * Indicates whether the specified object is equal to this + * synchronization mode, returning {@code true} if the objects are the + * same. * * @param obj the reference object with which to compare - * @return {@code true} if this object is the same as the {@code obj} - * argument, {@code false} otherwise + * @return {@code true} if the specified object is equal to this + * synchronization mode; {@code false} otherwise */ @Override public final boolean equals(Object obj) { @@ -708,7 +709,9 @@ } /** - * Finalizes the hashcode method. + * Returns a hash code value for this synchronization mode. + * + * @return a hash code value for this synchronization mode */ @Override public final int hashCode() { diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/ShortMessage.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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 @@ -303,9 +303,8 @@ * @param status the MIDI status byte * @param data1 the first data byte * @param data2 the second data byte - * @throws InvalidMidiDataException if the status byte, or all data - * bytes belonging to the message, do not specify a valid MIDI - * message + * @throws InvalidMidiDataException if the status byte, or all data bytes + * belonging to the message, do not specify a valid MIDI message * @see #setMessage(int, int, int, int) * @see #setMessage(int) */ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/SoundbankResource.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/SoundbankResource.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/SoundbankResource.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -31,24 +31,24 @@ * A {@code SoundbankResource} represents any audio resource stored in a * {@link Soundbank}. Common soundbank resources include: *
      - *
    • Instruments. An instrument may be specified in a variety of ways. - * However, all soundbanks have some mechanism for defining instruments. In - * doing so, they may reference other resources stored in the soundbank. Each - * instrument has a {@code Patch} which specifies the MIDI program and bank by - * which it may be referenced in MIDI messages. Instrument information may be - * stored in {@link Instrument} objects.
    • - *
    • Audio samples. A sample typically is a sampled audio waveform which - * contains a short sound recording whose duration is a fraction of a second, or - * at most a few seconds. These audio samples may be used by a - * {@link Synthesizer} to synthesize sound in response to MIDI commands, or - * extracted for use by an application. (The terminology reflects musicians' use - * of the word "sample" to refer collectively to a series of contiguous audio - * samples or frames, rather than to a single, instantaneous sample.) The data - * class for an audio sample will be an object that encapsulates the audio - * sample data itself and information about how to interpret it (the format of - * the audio data), such as an {@link AudioInputStream}.
    • - *
    • Embedded sequences. A sound bank may contain built-in song data stored in - * a data object such as a {@link Sequence}.
    • + *
    • Instruments. An instrument may be specified in a variety of ways. + * However, all soundbanks have some mechanism for defining instruments. In + * doing so, they may reference other resources stored in the soundbank. + * Each instrument has a {@code Patch} which specifies the MIDI program and + * bank by which it may be referenced in MIDI messages. Instrument information + * may be stored in {@link Instrument} objects. + *
    • Audio samples. A sample typically is a sampled audio waveform which + * contains a short sound recording whose duration is a fraction of a + * second, or at most a few seconds. These audio samples may be used by a + * {@link Synthesizer} to synthesize sound in response to MIDI commands, or + * extracted for use by an application. (The terminology reflects musicians' + * use of the word "sample" to refer collectively to a series of contiguous + * audio samples or frames, rather than to a single, instantaneous sample.) + * The data class for an audio sample will be an object that encapsulates + * the audio sample data itself and information about how to interpret it + * (the format of the audio data), such as an {@link AudioInputStream}. + *
    • Embedded sequences. A sound bank may contain built-in song data stored + * in a data object such as a {@link Sequence}. *
    * Synthesizers that use wavetable synthesis or related techniques play back the * audio in a sample when synthesizing notes, often when emulating the diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/Synthesizer.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Synthesizer.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Synthesizer.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -49,8 +49,8 @@ * be used by every synthesizer, even if the synthesis technique is compatible. * To see whether the instruments from a certain soundbank can be played by a * given synthesizer, invoke the - * {@link #isSoundbankSupported(Soundbank) isSoundbankSupported} - * method of {@code Synthesizer}. + * {@link #isSoundbankSupported(Soundbank) isSoundbankSupported} method of + * {@code Synthesizer}. *

    * "Loading" an instrument means that that instrument becomes available for * synthesizing notes. The instrument is loaded into the bank and program diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/SysexMessage.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2017, 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 @@ -40,8 +40,8 @@ * As dictated by the Standard MIDI Files specification, two status byte values * are legal for a {@code SysexMessage} read from a MIDI file: *

      - *
    • 0xF0: System Exclusive message (same as in MIDI wire protocol)
    • - *
    • 0xF7: Special System Exclusive message
    • + *
    • 0xF0: System Exclusive message (same as in MIDI wire protocol) + *
    • 0xF7: Special System Exclusive message *
    * When Java Sound is used to handle system exclusive data that is being * received using MIDI wire protocol, it should place the data in one or more @@ -49,8 +49,8 @@ * is not known in advance; the end of the system exclusive data is marked by an * end-of-exclusive flag (0xF7) in the MIDI wire byte stream. *
      - *
    • 0xF0: System Exclusive message (same as in MIDI wire protocol)
    • - *
    • 0xF7: End of Exclusive (EOX)
    • + *
    • 0xF0: System Exclusive message (same as in MIDI wire protocol) + *
    • 0xF7: End of Exclusive (EOX) *
    * The first {@code SysexMessage} object containing data for a particular system * exclusive message should have the status value 0xF0. If this message contains @@ -148,7 +148,7 @@ * should be non-negative and less than or equal to * {@code data.length} * @throws InvalidMidiDataException if the parameter values do not specify a - * valid MIDI meta message + * valid MIDI system exclusive message * @see #setMessage(byte[], int) * @see #setMessage(int, byte[], int) * @see #getData() @@ -178,6 +178,8 @@ * @param data the system exclusive message data * @param length the length of the valid message data in the array, * including the status byte + * @throws InvalidMidiDataException if the parameter values do not specify a + * valid MIDI system exclusive message */ @Override public void setMessage(byte[] data, int length) throws InvalidMidiDataException { @@ -195,7 +197,7 @@ * @param data the system exclusive message data * @param length the length of the valid message data in the array * @throws InvalidMidiDataException if the status byte is invalid for a - * sysex message + * system exclusive message */ public void setMessage(int status, byte[] data, int length) throws InvalidMidiDataException { if ( (status != 0xF0) && (status != 0xF7) ) { diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/Track.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Track.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Track.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -64,10 +64,14 @@ // TODO: use arrays for faster access - // the list containing the events + /** + * The list containing the events. + */ private final ArrayList eventsList = new ArrayList<>(); - // use a hashset to detect duplicate events in add(MidiEvent) + /** + * Use a hashset to detect duplicate events in add(MidiEvent). + */ private final HashSet set = new HashSet<>(); private final MidiEvent eotEvent; diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/Transmitter.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/Transmitter.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/Transmitter.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -67,7 +67,7 @@ * open/close behaviour see the class description of * {@link MidiDevice MidiDevice}. * - * @see javax.sound.midi.MidiSystem#getTransmitter + * @see MidiSystem#getTransmitter */ @Override void close(); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/VoiceStatus.java Sat Sep 09 14:36:45 2017 +0200 @@ -51,8 +51,8 @@ * given type of {@code Synthesizer} always has a fixed number of voices, equal * to the maximum number of simultaneous notes it is capable of sounding. *

    - * If the voice is not currently processing - * a MIDI note, it is considered inactive. A voice is inactive when it has been + * If the voice is not currently processing a + * MIDI note, it is considered inactive. A voice is inactive when it has been * given no note-on commands, or when every note-on command received has been * terminated by a corresponding note-off (or by an "all notes off" message). * For example, this happens when a synthesizer capable of playing 16 diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/package-info.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/package-info.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/package-info.java Sat Sep 09 14:36:45 2017 +0200 @@ -30,8 +30,8 @@ *

    Related Documentation

    * For more information on using Java Sound see: * * * @since 1.3 diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/spi/MidiFileReader.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/MidiFileReader.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/MidiFileReader.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -54,8 +54,8 @@ * stream's read pointer to its original position. If the input stream does * not support this, this method may fail with an {@code IOException}. * - * @param stream the input stream from which file format information - * should be extracted + * @param stream the input stream from which file format information should + * be extracted * @return a {@code MidiFileFormat} object describing the MIDI file format * @throws InvalidMidiDataException if the stream does not point to valid * MIDI file data recognized by the system @@ -68,14 +68,14 @@ throws InvalidMidiDataException, IOException; /** - * Obtains the MIDI file format of the URL provided. The URL must point to - * valid MIDI file data. + * Obtains the MIDI file format of the {@code URL} provided. The {@code URL} + * must point to valid MIDI file data. * - * @param url the URL from which file format information should be + * @param url the {@code URL} from which file format information should be * extracted * @return a {@code MidiFileFormat} object describing the MIDI file format - * @throws InvalidMidiDataException if the URL does not point to valid MIDI - * file data recognized by the system + * @throws InvalidMidiDataException if the {@code URL} does not point to + * valid MIDI file data recognized by the system * @throws IOException if an I/O exception occurs * @throws NullPointerException if {@code url} is {@code null} */ @@ -104,10 +104,10 @@ * it. These parsers must be able to mark the stream, read enough data to * determine whether they support the stream, and, if not, reset the * stream's read pointer to its original position. If the input stream does - * not support this, this method may fail with an IOException. + * not support this, this method may fail with an {@code IOException}. * - * @param stream the input stream from which the {@code Sequence} should - * be constructed + * @param stream the input stream from which the {@code Sequence} should be + * constructed * @return a {@code Sequence} object based on the MIDI file data contained * in the input stream * @throws InvalidMidiDataException if the stream does not point to valid @@ -121,14 +121,15 @@ throws InvalidMidiDataException, IOException; /** - * Obtains a MIDI sequence from the URL provided. The URL must point to - * valid MIDI file data. + * Obtains a MIDI sequence from the {@code URL} provided. The {@code URL} + * must point to valid MIDI file data. * - * @param url the URL for which the {@code Sequence} should be constructed + * @param url the {@code URL} for which the {@code Sequence} should be + * constructed * @return a {@code Sequence} object based on the MIDI file data pointed to - * by the URL - * @throws InvalidMidiDataException if the URL does not point to valid MIDI - * file data recognized by the system + * by the {@code URL} + * @throws InvalidMidiDataException if the {@code URL} does not point to + * valid MIDI file data recognized by the system * @throws IOException if an I/O exception occurs * @throws NullPointerException if {@code url} is {@code null} */ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/spi/MidiFileWriter.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/MidiFileWriter.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/MidiFileWriter.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -54,8 +54,7 @@ * Obtains the file types that this file writer can write from the sequence * specified. * - * @param sequence the sequence for which MIDI file type support is - * queried + * @param sequence the sequence for which MIDI file type support is queried * @return array of file types. If no file types are supported, returns an * array of length 0. * @throws NullPointerException if {@code sequence} is {@code null} diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/spi/SoundbankReader.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/SoundbankReader.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/SoundbankReader.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -39,18 +39,18 @@ * subclasses of {@code SoundbankReader} parse a given soundbank file, producing * a {@link Soundbank} object that can be loaded into a {@link Synthesizer}. * + * @author Kara Kytle * @since 1.3 - * @author Kara Kytle */ public abstract class SoundbankReader { /** - * Obtains a soundbank object from the URL provided. + * Obtains a soundbank object from the {@code URL} provided. * - * @param url URL representing the soundbank + * @param url {@code URL} representing the soundbank * @return soundbank object - * @throws InvalidMidiDataException if the URL does not point to valid MIDI - * soundbank data recognized by this soundbank reader + * @throws InvalidMidiDataException if the {@code URL} does not point to + * valid MIDI soundbank data recognized by this soundbank reader * @throws IOException if an I/O error occurs * @throws NullPointerException if {@code url} is {@code null} */ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/midi/spi/package-info.java --- a/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/package-info.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/spi/package-info.java Sat Sep 09 14:36:45 2017 +0200 @@ -30,8 +30,8 @@ *

    Related Documentation

    * For more information on using Java Sound see: * * * @since 1.3 diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFileFormat.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFileFormat.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFileFormat.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -51,45 +51,37 @@ * implementations: * * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * + * + * + * + *
    Audio File Format Properties
    Property keyValue typeDescription
    "duration"{@link java.lang.Long Long}playback duration of the file in microseconds
    "author"{@link java.lang.String String}name of the author of this file
    "title"{@link java.lang.String String}title of this file
    "copyright"{@link java.lang.String String}copyright message
    "date"{@link java.util.Date Date}date of the recording or release
    "comment"{@link java.lang.String String}an arbitrary text
    Audio File Format Properties
    Property key + * Value type + * Description + *
    "duration" + * {@link Long Long} + * playback duration of the file in microseconds + *
    "author" + * {@link String String} + * name of the author of this file + *
    "title" + * {@link String String} + * title of this file + *
    "copyright" + * {@link String String} + * copyright message + *
    "date" + * {@link java.util.Date Date} + * date of the recording or release + *
    "comment" + * {@link String String} + * an arbitrary text *
    * - * * @author David Rivas * @author Kara Kytle * @author Florian Bomers @@ -351,7 +343,12 @@ } /** - * Finalizes the equals method. + * Indicates whether the specified object is equal to this file type, + * returning {@code true} if the objects are equal. + * + * @param obj the reference object with which to compare + * @return {@code true} if the specified object is equal to this file + * type; {@code false} otherwise */ @Override public final boolean equals(final Object obj) { @@ -365,7 +362,9 @@ } /** - * Finalizes the hashCode method. + * Returns a hash code value for this file type. + * + * @return a hash code value for this file type */ @Override public final int hashCode() { diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioFormat.java Sat Sep 09 14:36:45 2017 +0200 @@ -40,6 +40,7 @@ * data line expects to receive for output. For a target (capture) data line, * the audio format specifies the kind of the data that can be read from the * line. + *

    * Sound files also have audio formats, of course. The {@link AudioFileFormat} * class encapsulates an {@code AudioFormat} in addition to other, file-specific * information. Similarly, an {@link AudioInputStream} has an @@ -92,29 +93,24 @@ * * * - * - * - * - * - * + * + * * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * *
    Audio Format Properties
    Property keyValue typeDescription
    Property key + * Value type + * Description *
    "bitrate"{@link java.lang.Integer Integer}average bit rate in bits per second
    "vbr"{@link java.lang.Boolean Boolean}{@code true}, if the file is encoded in variable bit - * rate (VBR)
    "quality"{@link java.lang.Integer Integer}encoding/conversion quality, 1..100
    "bitrate" + * {@link java.lang.Integer Integer} + * average bit rate in bits per second + *
    "vbr" + * {@link java.lang.Boolean Boolean} + * {@code true}, if the file is encoded in variable bit rate (VBR) + *
    "quality" + * {@link java.lang.Integer Integer} + * encoding/conversion quality, 1..100 *
    *

    @@ -183,8 +179,8 @@ * @param encoding the audio encoding technique * @param sampleRate the number of samples per second * @param sampleSizeInBits the number of bits in each sample - * @param channels the number of channels (1 for mono, 2 for stereo, - * and so on) + * @param channels the number of channels (1 for mono, 2 for stereo, and so + * on) * @param frameSize the number of bytes in each frame * @param frameRate the number of frames per second * @param bigEndian indicates whether the data for a single sample is @@ -217,7 +213,8 @@ * @param frameSize the number of bytes in each frame * @param frameRate the number of frames per second * @param bigEndian indicates whether the data for a single sample is - * stored in big-endian byte order ({@code false} means little-endian) + * stored in big-endian byte order ({@code false} means + * little-endian) * @param properties a {@code Map} object containing format * properties * @since 1.5 @@ -276,9 +273,10 @@ /** * Obtains the sample rate. For compressed formats, the return value is the - * sample rate of the uncompressed audio data. When this AudioFormat is used - * for queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat, - * AudioFormat) AudioSystem.isConversionSupported}) or capabilities (e.g. + * sample rate of the uncompressed audio data. When this {@code AudioFormat} + * is used for queries (e.g. + * {@link AudioSystem#isConversionSupported(AudioFormat, AudioFormat) + * AudioSystem.isConversionSupported}) or capabilities (e.g. * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a sample rate * of {@code AudioSystem.NOT_SPECIFIED} means that any sample rate is * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the @@ -296,10 +294,10 @@ /** * Obtains the size of a sample. For compressed formats, the return value is - * the sample size of the uncompressed audio data. When this AudioFormat is - * used for queries (e.g. {@link AudioSystem#isConversionSupported( - * AudioFormat,AudioFormat) AudioSystem.isConversionSupported}) or - * capabilities (e.g. + * the sample size of the uncompressed audio data. When this + * {@code AudioFormat} is used for queries (e.g. + * {@link AudioSystem#isConversionSupported(AudioFormat,AudioFormat) + * AudioSystem.isConversionSupported}) or capabilities (e.g. * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a sample size * of {@code AudioSystem.NOT_SPECIFIED} means that any sample size is * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the @@ -316,9 +314,9 @@ } /** - * Obtains the number of channels. When this AudioFormat is used for queries - * (e.g. {@link AudioSystem#isConversionSupported(AudioFormat, AudioFormat) - * AudioSystem.isConversionSupported}) or capabilities (e.g. + * Obtains the number of channels. When this {@code AudioFormat} is used for + * queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat, + * AudioFormat) AudioSystem.isConversionSupported}) or capabilities (e.g. * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a return * value of {@code AudioSystem.NOT_SPECIFIED} means that any (positive) * number of channels is acceptable. @@ -333,8 +331,8 @@ } /** - * Obtains the frame size in bytes. When this AudioFormat is used for - * queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat, + * Obtains the frame size in bytes. When this {@code AudioFormat} is used + * for queries (e.g. {@link AudioSystem#isConversionSupported(AudioFormat, * AudioFormat) AudioSystem.isConversionSupported}) or capabilities (e.g. * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a frame size * of {@code AudioSystem.NOT_SPECIFIED} means that any frame size is @@ -352,10 +350,10 @@ } /** - * Obtains the frame rate in frames per second. When this AudioFormat is - * used for queries (e.g. {@link AudioSystem#isConversionSupported( - * AudioFormat,AudioFormat) AudioSystem.isConversionSupported}) or - * capabilities (e.g. + * Obtains the frame rate in frames per second. When this + * {@code AudioFormat} is used for queries (e.g. + * {@link AudioSystem#isConversionSupported(AudioFormat,AudioFormat) + * AudioSystem.isConversionSupported}) or capabilities (e.g. * {@link DataLine.Info#getFormats DataLine.Info.getFormats}), a frame rate * of {@code AudioSystem.NOT_SPECIFIED} means that any frame rate is * acceptable. {@code AudioSystem.NOT_SPECIFIED} is also returned when the @@ -551,9 +549,10 @@ * the sound amplitude that are often used for recording speech. *

    * You can use a predefined encoding by referring to one of the static - * objects created by this class, such as PCM_SIGNED or PCM_UNSIGNED. - * Service providers can create new encodings, such as compressed audio - * formats, and make these available through the {@link AudioSystem} class. + * objects created by this class, such as {@code PCM_SIGNED} or + * {@code PCM_UNSIGNED}. Service providers can create new encodings, such as + * compressed audio formats, and make these available through the + * {@link AudioSystem} class. *

    * The {@code Encoding} class is static, so that all {@code AudioFormat} * objects that have the same encoding will refer to the same object (rather @@ -609,7 +608,12 @@ } /** - * Finalizes the equals method. + * Indicates whether the specified object is equal to this encoding, + * returning {@code true} if the objects are equal. + * + * @param obj the reference object with which to compare + * @return {@code true} if the specified object is equal to this + * encoding; {@code false} otherwise */ @Override public final boolean equals(final Object obj) { @@ -623,7 +627,9 @@ } /** - * Finalizes the hashCode method. + * Returns a hash code value for this encoding. + * + * @return a hash code value for this encoding */ @Override public final int hashCode() { diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioInputStream.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioInputStream.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioInputStream.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -28,7 +28,6 @@ import java.io.IOException; import java.io.InputStream; - /** * An audio input stream is an input stream with a specified audio format and * length. The length is expressed in sample frames, not bytes. Several methods @@ -42,9 +41,10 @@ * The {@code AudioSystem} class includes many methods that manipulate * {@code AudioInputStream} objects. For example, the methods let you: *

      - *
    • obtain an audio input stream from an external audio file, stream, or URL - *
    • write an external file from an audio input stream - *
    • convert an audio input stream to a different audio format + *
    • obtain an audio input stream from an external audio file, stream, or + * {@code URL} + *
    • write an external file from an audio input stream + *
    • convert an audio input stream to a different audio format *
    * * @author David Rivas @@ -139,7 +139,7 @@ /** * Constructs an audio input stream that reads its data from the target data * line indicated. The format of the stream is the same as that of the - * target data line, and the length is AudioSystem#NOT_SPECIFIED. + * target data line, and the length is {@code AudioSystem#NOT_SPECIFIED}. * * @param line the target data line from which this stream obtains its data * @see AudioSystem#NOT_SPECIFIED @@ -370,11 +370,11 @@ /** * Returns the maximum number of bytes that can be read (or skipped over) - * from this audio input stream without blocking. This limit applies only - * to the next invocation of a {@code read} or {@code skip} method for this + * from this audio input stream without blocking. This limit applies only to + * the next invocation of a {@code read} or {@code skip} method for this * audio input stream; the limit can vary each time these methods are - * invoked. Depending on the underlying stream, an IOException may be thrown - * if this stream is closed. + * invoked. Depending on the underlying stream, an {@code IOException} may + * be thrown if this stream is closed. * * @return the number of bytes that can be read from this audio input stream * without blocking diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioPermission.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioPermission.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioPermission.java Sat Sep 09 14:36:45 2017 +0200 @@ -45,34 +45,30 @@ * Permission target name, what the permission allows, and associated * risks * - * - * Permission Target Name - * What the Permission Allows - * Risks of Allowing this Permission - * + * + * Permission Target Name + * What the Permission Allows + * Risks of Allowing this Permission * * - * - * play - * Audio playback through the audio device or devices on the system. - * Allows the application to obtain and manipulate lines and mixers for - * audio playback (rendering). - * In some cases use of this permission may affect other - * applications because the audio from one line may be mixed with other audio - * being played on the system, or because manipulation of a mixer affects the - * audio for all lines using that mixer. - * - * - * - * record - * Audio recording through the audio device or devices on the system. - * Allows the application to obtain and manipulate lines and mixers for - * audio recording (capture). - * In some cases use of this permission may affect other - * applications because manipulation of a mixer affects the audio for all lines - * using that mixer. - * This permission can enable an applet or application to eavesdrop on a user. - * + * + * play + * Audio playback through the audio device or devices on the system. + * Allows the application to obtain and manipulate lines and mixers for + * audio playback (rendering). + * In some cases use of this permission may affect other + * applications because the audio from one line may be mixed with other + * audio being played on the system, or because manipulation of a mixer + * affects the audio for all lines using that mixer. + * + * record + * Audio recording through the audio device or devices on the system. + * Allows the application to obtain and manipulate lines and mixers for + * audio recording (capture). + * In some cases use of this permission may affect other applications + * because manipulation of a mixer affects the audio for all lines using + * that mixer. This permission can enable an applet or application to + * eavesdrop on a user. * * * @@ -81,6 +77,9 @@ */ public class AudioPermission extends BasicPermission { + /** + * Use serialVersionUID from JDK 1.3 for interoperability. + */ private static final long serialVersionUID = -5518053473477801126L; /** diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java Sat Sep 09 14:36:45 2017 +0200 @@ -25,7 +25,6 @@ package javax.sound.sampled; -import java.io.EOFException; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -75,33 +74,28 @@ * * * - * - * - * - * - * + * + * * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * + * + * + * + * + * *
    Audio System Property Keys
    Property KeyInterfaceAffected Method(s)
    Property Key + * Interface + * Affected Method(s) *
    {@code javax.sound.sampled.Clip}{@link Clip}{@link #getLine}, {@link #getClip}
    {@code javax.sound.sampled.Port}{@link Port}{@link #getLine}
    {@code javax.sound.sampled.SourceDataLine}{@link SourceDataLine}{@link #getLine}, {@link #getSourceDataLine}
    {@code javax.sound.sampled.TargetDataLine}{@link TargetDataLine}{@link #getLine}, {@link #getTargetDataLine}
    {@code javax.sound.sampled.Clip} + * {@link Clip} + * {@link #getLine}, {@link #getClip} + *
    {@code javax.sound.sampled.Port} + * {@link Port} + * {@link #getLine} + *
    {@code javax.sound.sampled.SourceDataLine} + * {@link SourceDataLine} + * {@link #getLine}, {@link #getSourceDataLine} + *
    {@code javax.sound.sampled.TargetDataLine} + * {@link TargetDataLine} + * {@link #getLine}, {@link #getTargetDataLine} *
    * @@ -125,20 +119,19 @@ * matching {@code Mixer.Info} object is found, or the mixer name is not * specified, the first mixer from the resulting list, which provides the * respective line interface, will be returned. - * + *

    * For example, the property {@code javax.sound.sampled.Clip} with a value - * {@code "com.sun.media.sound.MixerProvider#SunClip"} - * will have the following consequences when {@code getLine} is called - * requesting a {@code Clip} instance: if the class - * {@code com.sun.media.sound.MixerProvider} exists in the list of installed - * mixer providers, the first {@code Clip} from the first mixer with name - * {@code "SunClip"} will be returned. If it cannot be found, the - * first {@code Clip} from the first mixer of the specified provider will be + * {@code "com.sun.media.sound.MixerProvider#SunClip"} will have the following + * consequences when {@code getLine} is called requesting a {@code Clip} + * instance: if the class {@code com.sun.media.sound.MixerProvider} exists in + * the list of installed mixer providers, the first {@code Clip} from the first + * mixer with name {@code "SunClip"} will be returned. If it cannot be found, + * the first {@code Clip} from the first mixer of the specified provider will be * returned, regardless of name. If there is none, the first {@code Clip} from - * the first {@code Mixer} with name {@code "SunClip"} in the list of - * all mixers (as returned by {@code getMixerInfo}) will be returned, or, if not - * found, the first {@code Clip} of the first {@code Mixer} that can be found in - * the list of all mixers is returned. If that fails, too, an + * the first {@code Mixer} with name {@code "SunClip"} in the list of all mixers + * (as returned by {@code getMixerInfo}) will be returned, or, if not found, the + * first {@code Clip} of the first {@code Mixer} that can be found in the list + * of all mixers is returned. If that fails, too, an * {@code IllegalArgumentException} is thrown. * * @author Kara Kytle @@ -479,7 +472,6 @@ * @param mixerInfo a {@code Mixer.Info} object representing the desired * mixer, or {@code null} for the system default mixer * @return a clip object from the specified mixer - * * @throws LineUnavailableException if a clip is not available from this * mixer due to resource restrictions * @throws SecurityException if a clip is not available from this mixer due @@ -670,9 +662,9 @@ * * @param sourceEncoding the encoding for which conversion support is * queried - * @return array of encodings. If {@code sourceEncoding}is not supported, an - * array of length 0 is returned. Otherwise, the array will have a - * length of at least 1, representing {@code sourceEncoding} + * @return array of encodings. If {@code sourceEncoding} is not supported, + * an array of length 0 is returned. Otherwise, the array will have + * a length of at least 1, representing {@code sourceEncoding} * (no conversion). * @throws NullPointerException if {@code sourceEncoding} is {@code null} */ @@ -935,15 +927,15 @@ } /** - * Obtains the audio file format of the specified URL. The URL must point to - * valid audio file data. + * Obtains the audio file format of the specified {@code URL}. The + * {@code URL} must point to valid audio file data. * - * @param url the URL from which file format information should be + * @param url the {@code URL} from which file format information should be * extracted * @return an {@code AudioFileFormat} object describing the audio file * format - * @throws UnsupportedAudioFileException if the URL does not point to valid - * audio file data recognized by the system + * @throws UnsupportedAudioFileException if the {@code URL} does not point + * to valid audio file data recognized by the system * @throws IOException if an input/output exception occurs * @throws NullPointerException if {@code url} is {@code null} */ @@ -1021,15 +1013,15 @@ } /** - * Obtains an audio input stream from the URL provided. The URL must point - * to valid audio file data. + * Obtains an audio input stream from the {@code URL} provided. The + * {@code URL} must point to valid audio file data. * - * @param url the URL for which the {@code AudioInputStream} should be - * constructed + * @param url the {@code URL} for which the {@code AudioInputStream} should + * be constructed * @return an {@code AudioInputStream} object based on the audio file data - * pointed to by the URL - * @throws UnsupportedAudioFileException if the URL does not point to valid - * audio file data recognized by the system + * pointed to by the {@code URL} + * @throws UnsupportedAudioFileException if the {@code URL} does not point + * to valid audio file data recognized by the system * @throws IOException if an I/O exception occurs * @throws NullPointerException if {@code url} is {@code null} */ @@ -1121,8 +1113,8 @@ * Obtains the file types that the system can write from the audio input * stream specified. * - * @param stream the audio input stream for which audio file type - * support is queried + * @param stream the audio input stream for which audio file type support + * is queried * @return array of file types. If no file types are supported, an array of * length 0 is returned. * @throws NullPointerException if {@code stream} is {@code null} @@ -1175,8 +1167,8 @@ * type to the output stream provided. Some file types require that the * length be written into the file header; such files cannot be written from * start to finish unless the length is known in advance. An attempt to - * write a file of such a type will fail with an IOException if the length - * in the audio file type is {@code AudioSystem.NOT_SPECIFIED}. + * write a file of such a type will fail with an {@code IOException} if the + * length in the audio file type is {@code AudioSystem.NOT_SPECIFIED}. * * @param stream the audio input stream containing audio data to be written * to the file @@ -1250,7 +1242,9 @@ // METHODS FOR INTERNAL IMPLEMENTATION USE /** - * Obtains the set of MixerProviders on the system. + * Obtains the list of MixerProviders currently installed on the system. + * + * @return the list of MixerProviders currently installed on the system */ @SuppressWarnings("unchecked") private static List getMixerProviders() { @@ -1331,9 +1325,12 @@ } } - /* Provider class not specified or - provider class cannot be found, or - provider class and instance specified and instance cannot be found or is not appropriate */ + /* + * - Provider class not specified, or + * - provider class cannot be found, or + * - provider class and instance specified and instance cannot be found + * or is not appropriate + */ if (instanceName != null) { mixer = getNamedMixer(instanceName, providers, info); if (mixer != null) { @@ -1342,8 +1339,10 @@ } - /* No default are specified, or if something is specified, everything - failed. */ + /* + * No defaults are specified, or if something is specified, everything + * failed + */ return null; } @@ -1436,10 +1435,14 @@ /** * Checks if a Mixer is appropriate. A Mixer is considered appropriate if it - * support the given line type. If isMixingRequired is true and the line - * type is an output one (SourceDataLine, Clip), the mixer is appropriate if - * it supports at least 2 (concurrent) lines of the given type. + * support the given line type. If isMixingRequired is {@code true} and the + * line type is an output one (SourceDataLine, Clip), the mixer is + * appropriate if it supports at least 2 (concurrent) lines of the given + * type. * + * @param mixer The mixer to check + * @param lineInfo The line to check + * @param isMixingRequired Is the mixing required or not * @return {@code true} if the mixer is considered appropriate according to * the rules given above, {@code false} otherwise */ @@ -1461,6 +1464,10 @@ /** * Like getMixerInfo, but return List. + * + * @return a List of info objects for the currently installed mixers. If no + * mixers are available on the system, an empty List is returned. + * @see #getMixerInfo() */ private static List getMixerInfoList() { List providers = getMixerProviders(); @@ -1469,6 +1476,11 @@ /** * Like getMixerInfo, but return List. + * + * @param providers The list of MixerProviders + * @return a List of info objects for the currently installed mixers. If no + * mixers are available on the system, an empty List is returned. + * @see #getMixerInfo() */ private static List getMixerInfoList(List providers) { List infos = new ArrayList<>(); @@ -1491,6 +1503,11 @@ * Obtains the set of services currently installed on the system using the * SPI mechanism in 1.3. * + * @param providerClass The type of providers requested. This should be one + * of AudioFileReader.class, AudioFileWriter.class, + * FormatConversionProvider.class, MixerProvider.class, + * MidiDeviceProvider.class, MidiFileReader.class, + * MidiFileWriter.class or SoundbankReader.class. * @return a List of instances of providers for the requested service. If no * providers are available, a vector of length 0 will be returned. */ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/BooleanControl.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/BooleanControl.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/BooleanControl.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -121,7 +121,7 @@ /** * Provides a string representation of the control. * - * @return a string description + * @return a string representation of the control */ @Override public String toString() { @@ -153,7 +153,7 @@ /** * Constructs a new boolean control type. * - * @param name the name of the new boolean control type + * @param name the name of the new boolean control type */ protected Type(final String name) { super(name); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/Clip.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Clip.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Clip.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -178,13 +178,13 @@ /** * Sets the first and last sample frames that will be played in the loop. * The ending point must be greater than or equal to the starting point, and - * both must fall within the size of the loaded media. A value of 0 for - * the starting point means the beginning of the loaded media. Similarly, a + * both must fall within the size of the loaded media. A value of 0 for the + * starting point means the beginning of the loaded media. Similarly, a * value of -1 for the ending point indicates the last frame of the media. * * @param start the loop's starting position, in sample frames (zero-based) - * @param end the loop's ending position, in sample frames (zero-based), - * or -1 to indicate the final frame + * @param end the loop's ending position, in sample frames (zero-based), or + * -1 to indicate the final frame * @throws IllegalArgumentException if the requested loop points cannot be * set, usually because one or both falls outside the media's * duration or because the ending point is before the starting point diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/CompoundControl.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/CompoundControl.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/CompoundControl.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -90,8 +90,7 @@ /** * An instance of the {@code CompoundControl.Type} inner class identifies - * one kind of compound control. Static instances are provided for the - * common types. + * one kind of compound control. * * @author Kara Kytle * @since 1.3 diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/Control.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Control.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Control.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -48,7 +48,7 @@ private final Type type; /** - * Constructs a Control with the specified type. + * Constructs a control with the specified type. * * @param type the kind of control desired */ @@ -66,9 +66,9 @@ } /** - * Obtains a String describing the control type and its current state. + * Obtains a string describing the control type and its current state. * - * @return a String representation of the Control + * @return a string representation of the control */ @Override public String toString() { @@ -77,7 +77,6 @@ /** * An instance of the {@code Type} class represents the type of the control. - * Static instances are provided for the common types. */ public static class Type { @@ -98,7 +97,12 @@ } /** - * Finalizes the equals method. + * Indicates whether the specified object is equal to this control type, + * returning {@code true} if the objects are the same. + * + * @param obj the reference object with which to compare + * @return {@code true} if the specified object is equal to this control + * type; {@code false} otherwise */ @Override public final boolean equals(Object obj) { @@ -106,7 +110,9 @@ } /** - * Finalizes the hashCode method. + * Returns a hash code value for this control type. + * + * @return a hash code value for this control type */ @Override public final int hashCode() { diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/DataLine.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/DataLine.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/DataLine.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -54,7 +54,7 @@ * data, a {@code STOP} event is generated. *

    * Mixers often support synchronized control of multiple data lines. - * Synchronization can be established through the Mixer interface's + * Synchronization can be established through the {@code Mixer} interface's * {@link Mixer#synchronize synchronize} method. See the description of the * {@link Mixer Mixer} interface for a more complete description. * @@ -181,7 +181,7 @@ * are bytes, but will always correspond to an integral number of sample * frames of audio data. * - * @return the size of the buffer in bytes + * @return the size of the buffer, in bytes */ int getBufferSize(); @@ -260,8 +260,8 @@ * {@code DataLine.Info} provides additional information specific to data * lines. This information includes: *

      - *
    • the audio formats supported by the data line - *
    • the minimum and maximum sizes of its internal buffer + *
    • the audio formats supported by the data line + *
    • the minimum and maximum sizes of its internal buffer *
    * Because a {@code Line.Info} knows the class of the line its describes, a * {@code DataLine.Info} object can describe {@code DataLine} subinterfaces @@ -270,14 +270,25 @@ * appropriate instance of {@code DataLine.Info} as the argument to a method * such as {@link Mixer#getLine(Line.Info)}. * + * @author Kara Kytle * @see Line.Info - * @author Kara Kytle * @since 1.3 */ class Info extends Line.Info { + /** + * The set of supported formats. + */ private final AudioFormat[] formats; + + /** + * Minimum buffer size supported by the data line, in bytes. + */ private final int minBufferSize; + + /** + * Maximum buffer size supported by the data line, in bytes. + */ private final int maxBufferSize; /** @@ -289,10 +300,10 @@ * @param lineClass the class of the data line described by the info * object * @param formats set of formats supported - * @param minBufferSize minimum buffer size supported by the data - * line, in bytes - * @param maxBufferSize maximum buffer size supported by the data - * line, in bytes + * @param minBufferSize minimum buffer size supported by the data line, + * in bytes + * @param maxBufferSize maximum buffer size supported by the data line, + * in bytes */ public Info(Class lineClass, AudioFormat[] formats, int minBufferSize, int maxBufferSize) { @@ -317,7 +328,7 @@ * @param lineClass the class of the data line described by the info * object * @param format desired format - * @param bufferSize desired buffer size in bytes + * @param bufferSize desired buffer size, in bytes */ public Info(Class lineClass, AudioFormat format, int bufferSize) { @@ -354,7 +365,7 @@ * {@code isFormatSupported(AudioFormat)} is guaranteed to return * {@code true} for all formats returned by {@code getFormats()}. *

    - * Some fields in the AudioFormat instances can be set to + * Some fields in the {@code AudioFormat} instances can be set to * {@link AudioSystem#NOT_SPECIFIED NOT_SPECIFIED} if that field does * not apply to the format, or if the format supports a wide range of * values for that field. For example, a multi-channel device supporting @@ -419,6 +430,7 @@ * large as that of the object specified, and all of its formats must * match formats supported by the object specified. * + * @param info the info object which is being compared to this one * @return {@code true} if this object matches the one specified, * otherwise {@code false} */ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/Line.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Line.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Line.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -237,8 +237,8 @@ * class. This constructor is typically used by an application to * describe a desired line. * - * @param lineClass the class of the line that the new Line.Info object - * describes + * @param lineClass the class of the line that the new + * {@code Line.Info} object describes */ public Info(Class lineClass) { @@ -250,7 +250,8 @@ } /** - * Obtains the class of the line that this Line.Info object describes. + * Obtains the class of the line that this {@code Line.Info} object + * describes. * * @return the described line's class */ @@ -261,13 +262,13 @@ /** * Indicates whether the specified info object matches this one. To * match, the specified object must be identical to or a special case of - * this one. The specified info object must be either an instance of - * the same class as this one, or an instance of a sub-type of this one. - * In addition, the attributes of the specified object must be - * compatible with the capabilities of this one. Specifically, the - * routing configuration for the specified info object must be - * compatible with that of this one. Subclasses may add other criteria - * to determine whether the two objects match. + * this one. The specified info object must be either an instance of the + * same class as this one, or an instance of a sub-type of this one. In + * addition, the attributes of the specified object must be compatible + * with the capabilities of this one. Specifically, the routing + * configuration for the specified info object must be compatible with + * that of this one. Subclasses may add other criteria to determine + * whether the two objects match. * * @param info the info object which is being compared to this one * @return {@code true} if the specified object matches this one, diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineEvent.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -48,14 +48,17 @@ */ public class LineEvent extends EventObject { + /** + * Use serialVersionUID from JDK 1.3 for interoperability. + */ private static final long serialVersionUID = -1274246333383880410L; /** * The kind of line event ({@code OPEN}, {@code CLOSE}, {@code START}, or * {@code STOP}). * + * @see #getType * @serial - * @see #getType */ private final Type type; @@ -67,8 +70,8 @@ * this value is not known, the position value should be * {@link AudioSystem#NOT_SPECIFIED}. * + * @see #getFramePosition * @serial - * @see #getFramePosition */ private final long position; @@ -184,11 +187,11 @@ /** * Indicates whether the specified object is equal to this event type, - * returning {@code true} if the objects are identical. + * returning {@code true} if the objects are the same. * * @param obj the reference object with which to compare - * @return {@code true} if this event type is the same as {@code obj}; - * {@code false} otherwise + * @return {@code true} if the specified object is equal to this event + * type; {@code false} otherwise */ @Override public final boolean equals(Object obj) { @@ -196,7 +199,9 @@ } /** - * Finalizes the hashcode method. + * Returns a hash code value for this event type. + * + * @return a hash code value for this event type */ @Override public final int hashCode() { @@ -205,6 +210,8 @@ /** * Returns the type name as the string representation. + * + * @return the type name as the string representation */ @Override public String toString() { @@ -253,22 +260,24 @@ /** * A type of event that is sent when a line ceases to engage in active - * input or output of audio data because the end of media has been reached. + * input or output of audio data because the end of media has been + * reached. */ /* - * ISSUE: we may want to get rid of this. Is JavaSound - * responsible for reporting this?? + * ISSUE: we may want to get rid of this. Is JavaSound responsible for + * reporting this?? * - * [If it's decided to keep this API, the docs will need to be updated to include mention - * of EOM events elsewhere.] + * [If it's decided to keep this API, the docs will need to be updated + * to include mention of EOM events elsewhere.] */ //public static final Type EOM = new Type("EOM"); /** * A type of event that is sent when a line begins to engage in active - * input or output of audio data. Examples of when this happens are - * when a source line begins or resumes writing data to its mixer, and - * when a target line begins or resumes reading data from its mixer. + * input or output of audio data. Examples of when this happens are when + * a source line begins or resumes writing data to its mixer, and when a + * target line begins or resumes reading data from its mixer. + * * @see #STOP * @see SourceDataLine#write * @see TargetDataLine#read @@ -277,8 +286,9 @@ //public static final Type ACTIVE = new Type("ACTIVE"); /** - * A type of event that is sent when a line ceases active input or output - * of audio data. + * A type of event that is sent when a line ceases active input or + * output of audio data. + * * @see #START * @see DataLine#stop */ diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/LineUnavailableException.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineUnavailableException.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/LineUnavailableException.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -35,6 +35,9 @@ */ public class LineUnavailableException extends Exception { + /** + * Use serialVersionUID from JDK 1.3 for interoperability. + */ private static final long serialVersionUID = -2046718279487432130L; /** diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/Mixer.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Mixer.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Mixer.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -58,7 +58,7 @@ * version, vendor, etc. * * @return a mixer info object that describes this mixer - * @see Mixer.Info + * @see Info */ Info getMixerInfo(); @@ -144,19 +144,19 @@ /** * Obtains the approximate maximum number of lines of the requested type * that can be open simultaneously on the mixer. - * + *

    * Certain types of mixers do not have a hard bound and may allow opening * more lines. Since certain lines are a shared resource, a mixer may not be * able to open the maximum number of lines if another process has opened * lines of this mixer. - * + *

    * The requested type is any line that matches the description in the * provided {@code Line.Info} object. For example, if the info object * represents a speaker port, and the mixer supports exactly one speaker - * port, this method should return 1. If the info object represents a - * source data line and the mixer supports the use of 32 source data lines + * port, this method should return 1. If the info object represents a source + * data line and the mixer supports the use of 32 source data lines * simultaneously, the return value should be 32. If there is no limit, this - * function returns {@code AudioSystem.NOT_SPECIFIED}. + * function returns {@link AudioSystem#NOT_SPECIFIED}. * * @param info a {@code Line.Info} that describes the line for which the * number of supported instances is queried @@ -215,11 +215,10 @@ * this mixer are unsynchronized. * * @param lines the synchronized lines for which synchronization should be - * released, or {@code null} for all this mixer's synchronized - * lines + * released, or {@code null} for all this mixer's synchronized lines * @throws IllegalArgumentException if the lines cannot be unsynchronized. - * This may occur if the argument specified does not exactly match - * a set of lines for which synchronization has already been + * This may occur if the argument specified does not exactly match a + * set of lines for which synchronization has already been * established. */ void unsynchronize(Line[] lines); @@ -277,8 +276,8 @@ * information. * * @param name the name of the mixer - * @param vendor the company who manufactures or creates the - * hardware or software mixer + * @param vendor the company who manufactures or creates the hardware + * or software mixer * @param description descriptive text about the mixer * @param version version information for the mixer */ @@ -291,13 +290,12 @@ } /** - * Indicates whether two info objects are equal, returning {@code true} - * if they are identical. + * Indicates whether the specified object is equal to this info object, + * returning {@code true} if the objects are the same. * - * @param obj the reference object with which to compare this info - * object - * @return {@code true} if this info object is the same as the - * {@code obj} argument; {@code false} otherwise + * @param obj the reference object with which to compare + * @return {@code true} if the specified object is equal to this info + * object; {@code false} otherwise */ @Override public final boolean equals(Object obj) { @@ -305,9 +303,9 @@ } /** - * Finalizes the hashcode method. + * Returns a hash code value for this info object. * - * @return the hashcode for this object + * @return a hash code value for this info object */ @Override public final int hashCode() { diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/Port.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/Port.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/Port.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -100,7 +100,14 @@ // DAT // DVD + /** + * The string that names the port. + */ private final String name; + + /** + * Whether this port is source or not. + */ private final boolean isSource; /** @@ -111,8 +118,8 @@ * @param lineClass the class of the port described by the info object * @param name the string that names the port * @param isSource {@code true} if the port is a source port (such as a - * microphone), {@code false} if the port is a target port - * (such as a speaker) + * microphone), {@code false} if the port is a target port (such + * as a speaker) */ public Info(Class lineClass, String name, boolean isSource) { @@ -134,8 +141,8 @@ * Indicates whether the port is a source or a target for its mixer. * * @return {@code true} if the port is a source port (such as a - * microphone), {@code false} if the port is a target port - * (such as a speaker) + * microphone), {@code false} if the port is a target port (such + * as a speaker) */ public boolean isSource() { return isSource; @@ -147,6 +154,8 @@ * types must be equal. * * @param info the info object for which the match is queried + * @return {@code true} if the specified object matches this one, + * {@code false} otherwise */ @Override public boolean matches(Line.Info info) { @@ -167,7 +176,12 @@ } /** - * Finalizes the equals method. + * Indicates whether the specified object is equal to this info object, + * returning {@code true} if the objects are the same. + * + * @param obj the reference object with which to compare + * @return {@code true} if the specified object is equal to this info + * object; {@code false} otherwise */ @Override public final boolean equals(Object obj) { @@ -175,7 +189,9 @@ } /** - * Finalizes the hashCode method. + * Returns a hash code value for this info object. + * + * @return a hash code value for this info object */ @Override public final int hashCode() { diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/ReverbType.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/ReverbType.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/ReverbType.java Sat Sep 09 14:36:45 2017 +0200 @@ -38,7 +38,7 @@ * delay time and intensity of early reflections, the delay time and intensity * of late reflections, and an overall decay time. Early reflections are the * initial individual low-order reflections of the direct signal off the - * surfaces in the room. The late Reflections are the dense, high-order + * surfaces in the room. The late reflections are the dense, high-order * reflections that characterize the room's reverberation. The delay times for * the start of these two reflection types give the listener a sense of the * overall size and complexity of the room's shape and contents. The larger the @@ -63,8 +63,8 @@ *

    * If implementing JavaSound on a I3DL2-compliant device: *

      - *
    • Filtering is disabled (high-frequency attenuations are set to 0.0 dB) - *
    • Density parameters are set to midway between minimum and maximum + *
    • Filtering is disabled (high-frequency attenuations are set to 0.0 dB) + *
    • Density parameters are set to midway between minimum and maximum *
    *

    * The following table shows what parameter values an implementation might use @@ -74,60 +74,50 @@ * Reverb types and params: decay time, late intensity, late delay, * early intensity, and early delay * - * - * Type - * Decay Time (ms) - * Late Intensity (dB) - * Late Delay (ms) - * Early Intensity (dB) - * Early Delay(ms) - * + * + * Type + * Decay Time (ms) + * Late Intensity (dB) + * Late Delay (ms) + * Early Intensity (dB) + * Early Delay(ms) * * - * - * Cavern - * 2250 - * -2.0 - * 41.3 - * -1.4 - * 10.3 - * - * - * - * Dungeon - * 1600 - * -1.0 - * 10.3 - * -0.7 - * 2.6 - * - * - * - * Garage - * 900 - * -6.0 - * 14.7 - * -4.0 - * 3.9 - * - * - * - * Acoustic Lab - * 280 - * -3.0 - * 8.0 - * -2.0 - * 2.0 - * - * - * - * Closet - * 150 - * -10.0 - * 2.5 - * -7.0 - * 0.6 - * + * + * Cavern + * 2250 + * -2.0 + * 41.3 + * -1.4 + * 10.3 + * + * Dungeon + * 1600 + * -1.0 + * 10.3 + * -0.7 + * 2.6 + * + * Garage + * 900 + * -6.0 + * 14.7 + * -4.0 + * 3.9 + * + * Acoustic Lab + * 280 + * -3.0 + * 8.0 + * -2.0 + * 2.0 + * + * Closet + * 150 + * -10.0 + * 2.5 + * -7.0 + * 0.6 * * * @@ -199,7 +189,7 @@ * @since 1.5 */ public String getName() { - return name; + return name; } /** @@ -257,11 +247,11 @@ /** * Indicates whether the specified object is equal to this reverb type, - * returning {@code true} if the objects are identical. + * returning {@code true} if the objects are the same. * * @param obj the reference object with which to compare - * @return {@code true} if this reverb type is the same as {@code obj}; - * {@code false} otherwise + * @return {@code true} if the specified object is equal to this reverb + * type; {@code false} otherwise */ @Override public final boolean equals(Object obj) { @@ -269,7 +259,9 @@ } /** - * Finalizes the hashcode method. + * Returns a hash code value for this reverb type. + * + * @return a hash code value for this reverb type */ @Override public final int hashCode() { diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/SourceDataLine.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/SourceDataLine.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/SourceDataLine.java Sat Sep 09 14:36:45 2017 +0200 @@ -168,9 +168,9 @@ * {@code IllegalArgumentException}. * * @param b a byte array containing data to be written to the data line + * @param off the offset from the beginning of the array, in bytes * @param len the length, in bytes, of the valid data in the array (in * other words, the requested amount of data to write, in bytes) - * @param off the offset from the beginning of the array, in bytes * @return the number of bytes actually written * @throws IllegalArgumentException if the requested number of bytes does * not represent an integral number of sample frames, or if diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/UnsupportedAudioFileException.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/UnsupportedAudioFileException.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/UnsupportedAudioFileException.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -35,11 +35,14 @@ */ public class UnsupportedAudioFileException extends Exception { + /** + * Use serialVersionUID from JDK 1.3 for interoperability. + */ private static final long serialVersionUID = -139127412623160368L; /** - * Constructs an {@code UnsupportedAudioFileException} that has - * {@code null} as its error detail message. + * Constructs an {@code UnsupportedAudioFileException} that has {@code null} + * as its error detail message. */ public UnsupportedAudioFileException() { super(); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/package-info.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/package-info.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/package-info.java Sat Sep 09 14:36:45 2017 +0200 @@ -30,8 +30,8 @@ *

    Related Documentation

    * For more information on using Java Sound see: * * * @since 1.3 diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileReader.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileReader.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileReader.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -68,15 +68,15 @@ throws UnsupportedAudioFileException, IOException; /** - * Obtains the audio file format of the URL provided. The URL must point to - * valid audio file data. + * Obtains the audio file format of the {@code URL} provided. The + * {@code URL} must point to valid audio file data. * - * @param url the URL from which file format information should be + * @param url the {@code URL} from which file format information should be * extracted * @return an {@code AudioFileFormat} object describing the audio file * format - * @throws UnsupportedAudioFileException if the URL does not point to valid - * audio file data recognized by the system + * @throws UnsupportedAudioFileException if the {@code URL} does not point + * to valid audio file data recognized by the system * @throws IOException if an I/O exception occurs * @throws NullPointerException if {@code url} is {@code null} */ @@ -84,11 +84,11 @@ throws UnsupportedAudioFileException, IOException; /** - * Obtains the audio file format of the {@code File} provided. - * The {@code File} must point to valid audio file data. + * Obtains the audio file format of the {@code File} provided. The + * {@code File} must point to valid audio file data. * - * @param file the {@code File} from which file format information - * should be extracted + * @param file the {@code File} from which file format information should + * be extracted * @return an {@code AudioFileFormat} object describing the audio file * format * @throws UnsupportedAudioFileException if the {@code File} does not point @@ -123,15 +123,15 @@ throws UnsupportedAudioFileException, IOException; /** - * Obtains an audio input stream from the URL provided. The URL must point - * to valid audio file data. + * Obtains an audio input stream from the {@code URL} provided. The + * {@code URL} must point to valid audio file data. * - * @param url the URL for which the {@code AudioInputStream} should be - * constructed + * @param url the {@code URL} for which the {@code AudioInputStream} should + * be constructed * @return an {@code AudioInputStream} object based on the audio file data - * pointed to by the URL - * @throws UnsupportedAudioFileException if the URL does not point to valid - * audio file data recognized by the system + * pointed to by the {@code URL} + * @throws UnsupportedAudioFileException if the {@code URL} does not point + * to valid audio file data recognized by the system * @throws IOException if an I/O exception occurs * @throws NullPointerException if {@code url} is {@code null} */ @@ -139,8 +139,8 @@ throws UnsupportedAudioFileException, IOException; /** - * Obtains an audio input stream from the {@code File} provided. - * The {@code File} must point to valid audio file data. + * Obtains an audio input stream from the {@code File} provided. The + * {@code File} must point to valid audio file data. * * @param file the {@code File} for which the {@code AudioInputStream} * should be constructed diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileWriter.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileWriter.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/AudioFileWriter.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2017, 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 @@ -113,10 +113,10 @@ /** * Writes a stream of bytes representing an audio file of the file type - * indicated to the output stream provided. Some file types require that - * the length be written into the file header, and cannot be written from - * start to finish unless the length is known in advance. An attempt to - * write such a file type will fail with an IOException if the length in the + * indicated to the output stream provided. Some file types require that the + * length be written into the file header, and cannot be written from start + * to finish unless the length is known in advance. An attempt to write such + * a file type will fail with an {@code IOException} if the length in the * audio file format is {@link AudioSystem#NOT_SPECIFIED}. * * @param stream the audio input stream containing audio data to be written diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/package-info.java --- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/package-info.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/spi/package-info.java Sat Sep 09 14:36:45 2017 +0200 @@ -30,8 +30,8 @@ *

    Related Documentation

    * For more information on using Java Sound see: * * * @since 1.3 diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/swing/ButtonModel.java --- a/jdk/src/java.desktop/share/classes/javax/swing/ButtonModel.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/ButtonModel.java Sat Sep 09 14:36:45 2017 +0200 @@ -199,6 +199,21 @@ public void setGroup(ButtonGroup group); /** + * Returns the group that the button belongs to. + * Normally used with radio buttons, which are mutually + * exclusive within their group. + * + * @implSpec The default implementation of this method returns {@code null}. + * Subclasses should return the group set by setGroup(). + * + * @return the ButtonGroup that the button belongs to + * @since 10 + */ + default ButtonGroup getGroup() { + return null; + } + + /** * Adds an ActionListener to the model. * * @param l the listener to add diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/swing/JInternalFrame.java --- a/jdk/src/java.desktop/share/classes/javax/swing/JInternalFrame.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/JInternalFrame.java Sat Sep 09 14:36:45 2017 +0200 @@ -1077,8 +1077,15 @@ firePropertyChange(IS_SELECTED_PROPERTY, oldValue, newValue); if (isSelected) fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ACTIVATED); - else + else { fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEACTIVATED); + try { + java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent( + new sun.awt.UngrabEvent(this)); + } catch (SecurityException e) { + this.dispatchEvent(new sun.awt.UngrabEvent(this)); + } + } repaint(); } @@ -1758,6 +1765,12 @@ isClosed = true; } fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_CLOSED); + try { + java.awt.Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent( + new sun.awt.UngrabEvent(this)); + } catch (SecurityException e) { + this.dispatchEvent(new sun.awt.UngrabEvent(this)); + } } /** diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java --- a/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/JOptionPane.java Sat Sep 09 14:36:45 2017 +0200 @@ -1233,6 +1233,16 @@ messageType, icon, null, null); } + private static boolean checkFrameForComponent(Component parentComponent) { + if (parentComponent == null) { + return false; + } + if (parentComponent instanceof Frame) { + return true; + } + return checkFrameForComponent(parentComponent.getParent()); + } + /** * Brings up an internal dialog panel with a specified icon, where * the initial choice is determined by the initialValue @@ -1293,32 +1303,39 @@ getFocusOwner(); pane.setInitialValue(initialValue); - - JInternalFrame dialog = - pane.createInternalFrame(parentComponent, title); - pane.selectInitialValue(); - dialog.setVisible(true); + if (checkFrameForComponent(parentComponent)) { + JInternalFrame dialog = + pane.createInternalFrame(parentComponent, title); + pane.selectInitialValue(); + dialog.setVisible(true); - /* Since all input will be blocked until this dialog is dismissed, - * make sure its parent containers are visible first (this component - * is tested below). This is necessary for JApplets, because - * because an applet normally isn't made visible until after its - * start() method returns -- if this method is called from start(), - * the applet will appear to hang while an invisible modal frame - * waits for input. - */ - if (dialog.isVisible() && !dialog.isShowing()) { - Container parent = dialog.getParent(); - while (parent != null) { - if (parent.isVisible() == false) { - parent.setVisible(true); + /* Since all input will be blocked until this dialog is dismissed, + * make sure its parent containers are visible first (this component + * is tested below). This is necessary for JApplets, because + * because an applet normally isn't made visible until after its + * start() method returns -- if this method is called from start(), + * the applet will appear to hang while an invisible modal frame + * waits for input. + */ + if (dialog.isVisible() && !dialog.isShowing()) { + Container parent = dialog.getParent(); + while (parent != null) { + if (parent.isVisible() == false) { + parent.setVisible(true); + } + parent = parent.getParent(); } - parent = parent.getParent(); } + + AWTAccessor.getContainerAccessor().startLWModal(dialog); + } else { + pane.setComponentOrientation(getRootFrame().getComponentOrientation()); + int style = styleFromMessageType(messageType); + JDialog dialog = pane.createDialog(parentComponent, title, style); + pane.selectInitialValue(); + dialog.setVisible(true); } - AWTAccessor.getContainerAccessor().startLWModal(dialog); - if (parentComponent instanceof JInternalFrame) { try { ((JInternalFrame)parentComponent).setSelected(true); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/swing/JToggleButton.java --- a/jdk/src/java.desktop/share/classes/javax/swing/JToggleButton.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/JToggleButton.java Sat Sep 09 14:36:45 2017 +0200 @@ -219,8 +219,8 @@ case TRAVERSAL_BACKWARD: ButtonModel model = getModel(); JToggleButton selection = this; - if (model instanceof DefaultButtonModel) { - ButtonGroup group = ((DefaultButtonModel) model).getGroup(); + if (model != null) { + ButtonGroup group = model.getGroup(); if (group != null && group.getSelection() != null && !group.isSelected(model)) { Iterator iterator = diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/swing/LayoutFocusTraversalPolicy.java --- a/jdk/src/java.desktop/share/classes/javax/swing/LayoutFocusTraversalPolicy.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/LayoutFocusTraversalPolicy.java Sat Sep 09 14:36:45 2017 +0200 @@ -238,19 +238,18 @@ } else if (aComponent instanceof JComponent) { if (SunToolkit.isInstanceOf(aComponent, "javax.swing.JToggleButton")) { - JToggleButton.ToggleButtonModel model = - (JToggleButton.ToggleButtonModel) ((JToggleButton) - aComponent).getModel(); + ButtonModel model = ((JToggleButton)aComponent).getModel(); if (model != null) { ButtonGroup group = model.getGroup(); if (group != null) { Enumeration elements = - group.getElements(); + group.getElements(); int idx = 0; while (elements.hasMoreElements()) { AbstractButton member = elements.nextElement(); - if (member.isVisible() && member.isDisplayable() && - member.isEnabled() && member.isFocusable()) { + if (member instanceof JToggleButton && + member.isVisible() && member.isDisplayable() && + member.isEnabled() && member.isFocusable()) { if (member == aComponent) { return idx == 0; } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/swing/MultiUIDefaults.java --- a/jdk/src/java.desktop/share/classes/javax/swing/MultiUIDefaults.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/MultiUIDefaults.java Sat Sep 09 14:36:45 2017 +0200 @@ -127,7 +127,7 @@ @Override protected void getUIError(String msg) { - if (tables.length > 0) { + if (tables != null && tables.length > 0 && tables[0] != null) { tables[0].getUIError(msg); } else { super.getUIError(msg); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/swing/UIDefaults.java --- a/jdk/src/java.desktop/share/classes/javax/swing/UIDefaults.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/UIDefaults.java Sat Sep 09 14:36:45 2017 +0200 @@ -756,9 +756,8 @@ * @see #getUI */ protected void getUIError(String msg) { - System.err.println("UIDefaults.getUI() failed: " + msg); try { - throw new Error(); + throw new Error(msg); } catch (Throwable e) { e.printStackTrace(); @@ -888,7 +887,7 @@ * Adds a resource bundle to the list of resource bundles that are * searched for localized values. Resource bundles are searched in * the reverse order they were added, using the - * {@linkplain ClassLoader#getSystemClassLoader application class loader}. + * {@linkplain ClassLoader#getSystemClassLoader system class loader}. * In other words, the most recently added bundle is searched first. * * @param bundleName the base name of the resource bundle to be added diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboPopup.java Sat Sep 09 14:36:45 2017 +0200 @@ -911,7 +911,7 @@ // JComboBox mouse listener Component source = (Component)e.getSource(); Dimension size = source.getSize(); - Rectangle bounds = new Rectangle( 0, 0, size.width - 1, size.height - 1 ); + Rectangle bounds = new Rectangle( 0, 0, size.width, size.height); if ( !bounds.contains( e.getPoint() ) ) { MouseEvent newEvent = convertMouseEvent( e ); Point location = newEvent.getPoint(); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java Sat Sep 09 14:36:45 2017 +0200 @@ -917,9 +917,14 @@ processMouseEvent(me); break; case MouseEvent.MOUSE_WHEEL: + // If the scroll is done inside a combobox, menuitem, + // or inside a Popup#HeavyWeightWindow or inside a frame + // popup should not close which is the standard behaviour if (isInPopup(src) - || ((src instanceof JComboBox) && ((JComboBox) src).isPopupVisible())) { - + || ((src instanceof JComboBox) && ((JComboBox) src).isPopupVisible()) + || ((src instanceof JWindow) && ((JWindow)src).isVisible()) + || ((src instanceof JMenuItem) && ((JMenuItem)src).isVisible()) + || (src instanceof JFrame)) { return; } cancelPopupMenu(); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java Sat Sep 09 14:36:45 2017 +0200 @@ -1138,7 +1138,11 @@ int tabIndex, Icon icon, Rectangle iconRect, boolean isSelected ) { if (icon != null) { + // Clip the icon within iconRect bounds + Shape oldClip = g.getClip(); + ((Graphics2D)g).clip(iconRect); icon.paintIcon(tabPane, g, iconRect.x, iconRect.y); + g.setClip(oldClip); } } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/metal/MetalFileChooserUI.java Sat Sep 09 14:36:45 2017 +0200 @@ -281,11 +281,6 @@ // Home Button File homeDir = fsv.getHomeDirectory(); String toolTipText = homeFolderToolTipText; - if (fsv.isRoot(homeDir)) { - toolTipText = getFileView(fc).getName(homeDir); // Probably "Desktop". - } - - JButton b = new JButton(homeFolderIcon); diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java Sat Sep 09 14:36:45 2017 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, 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 @@ -559,7 +559,7 @@ */ public PaintContext(Insets insets, Dimension canvasSize, boolean inverted, CacheMode cacheMode, double maxH, double maxV) { - if (maxH < 1 || maxH < 1) { + if (maxH < 1 || maxV < 1) { throw new IllegalArgumentException("Both maxH and maxV must be >= 1"); } diff -r 000f4e4ddd39 -r 57173ad5c534 jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf --- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf Fri Sep 01 14:13:40 2017 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf Sat Sep 09 14:36:45 2017 +0200 @@ -1,7 +1,7 @@