diff --git a/README.md b/README.md index b3f30676b3c..e939f6a9ca4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Welcome to the JDK! For build instructions please see the -[online documentation](https://openjdk.org/groups/build/doc/building.html), +[online documentation](https://git.openjdk.org/jdk/blob/master/doc/building.md), or either of these files: - [doc/building.html](doc/building.html) (html version) diff --git a/make/Bundles.gmk b/make/Bundles.gmk index 8161b3b0362..0b324e7e3f3 100644 --- a/make/Bundles.gmk +++ b/make/Bundles.gmk @@ -185,77 +185,30 @@ endif ifneq ($(filter product-bundles% legacy-bundles, $(MAKECMDGOALS)), ) - SYMBOLS_EXCLUDE_PATTERN := %.debuginfo %.diz %.map - - # There may be files with spaces in the names, so use ShellFindFiles - # explicitly. + # There may be files with spaces in the names, so use ShellFindFiles explicitly. ALL_JDK_FILES := $(call ShellFindFiles, $(JDK_IMAGE_DIR)) - ifneq ($(JDK_IMAGE_DIR), $(JDK_SYMBOLS_IMAGE_DIR)) - ALL_JDK_SYMBOLS_FILES := $(call ShellFindFiles, $(JDK_SYMBOLS_IMAGE_DIR)) - else - ALL_JDK_SYMBOLS_FILES := $(ALL_JDK_FILES) - endif ifneq ($(JDK_IMAGE_DIR), $(JDK_DEMOS_IMAGE_DIR)) ALL_JDK_DEMOS_FILES := $(call ShellFindFiles, $(JDK_DEMOS_IMAGE_DIR)) else ALL_JDK_DEMOS_FILES := $(ALL_JDK_FILES) endif - # Create special filter rules when dealing with unzipped .dSYM directories on - # macosx - ifeq ($(call isTargetOs, macosx), true) - ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), false) - JDK_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \ - $(call containing, .dSYM/, $(patsubst $(JDK_IMAGE_DIR)/%, %, \ - $(ALL_JDK_SYMBOLS_FILES)))) - endif - endif - - # Create special filter rules when dealing with debug symbols on windows - ifeq ($(call isTargetOs, windows), true) - ifeq ($(SHIP_DEBUG_SYMBOLS), ) - JDK_SYMBOLS_EXCLUDE_PATTERN := %.pdb - endif - endif - JDK_BUNDLE_FILES := \ $(filter-out \ - $(JDK_SYMBOLS_EXCLUDE_PATTERN) \ $(JDK_EXTRA_EXCLUDES) \ - $(SYMBOLS_EXCLUDE_PATTERN) \ $(JDK_IMAGE_HOMEDIR)/demo/% \ , \ $(ALL_JDK_FILES) \ ) - JDK_SYMBOLS_BUNDLE_FILES := \ - $(call FindFiles, $(SYMBOLS_IMAGE_DIR)) + JDK_SYMBOLS_BUNDLE_FILES := $(call FindFiles, $(SYMBOLS_IMAGE_DIR)) TEST_DEMOS_BUNDLE_FILES := $(filter $(JDK_DEMOS_IMAGE_HOMEDIR)/demo/%, \ $(ALL_JDK_DEMOS_FILES)) ALL_JRE_FILES := $(call ShellFindFiles, $(JRE_IMAGE_DIR)) - # Create special filter rules when dealing with unzipped .dSYM directories on - # macosx - ifeq ($(OPENJDK_TARGET_OS), macosx) - ifeq ($(ZIP_EXTERNAL_DEBUG_SYMBOLS), false) - JRE_SYMBOLS_EXCLUDE_PATTERN := $(addprefix %, \ - $(call containing, .dSYM/, $(patsubst $(JRE_IMAGE_DIR)/%, %, $(ALL_JRE_FILES)))) - endif - endif - - # Create special filter rules when dealing with debug symbols on windows - ifeq ($(call isTargetOs, windows), true) - ifeq ($(SHIP_DEBUG_SYMBOLS), ) - JRE_SYMBOLS_EXCLUDE_PATTERN := %.pdb - endif - endif - - JRE_BUNDLE_FILES := $(filter-out \ - $(JRE_SYMBOLS_EXCLUDE_PATTERN) \ - $(SYMBOLS_EXCLUDE_PATTERN), \ - $(ALL_JRE_FILES)) + JRE_BUNDLE_FILES := $(ALL_JRE_FILES) ifeq ($(MACOSX_CODESIGN_MODE), hardened) # Macosx release build and code signing available. diff --git a/make/CreateJmods.gmk b/make/CreateJmods.gmk index 3280b24924a..32f107b6bb6 100644 --- a/make/CreateJmods.gmk +++ b/make/CreateJmods.gmk @@ -218,10 +218,14 @@ ifeq ($(call isTargetOs, windows), true) ifeq ($(SHIP_DEBUG_SYMBOLS), ) JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.diz,*.pdb,*.map}' else - JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.diz,*.map}' + JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.map}' endif else - JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM}' + ifeq ($(SHIP_DEBUG_SYMBOLS), ) + JMOD_FLAGS += --exclude '**{_the.*,_*.marker*,*.diz,*.debuginfo,*.dSYM/**,*.dSYM}' + else + JMOD_FLAGS += --exclude '**{_the.*,_*.marker*}' + endif endif # Unless we are creating a very large module, use the small tool JVM options diff --git a/make/Docs.gmk b/make/Docs.gmk index b105e1d8683..a8d40e078e2 100644 --- a/make/Docs.gmk +++ b/make/Docs.gmk @@ -93,16 +93,19 @@ JAVADOC_DISABLED_DOCLINT_WARNINGS := missing JAVADOC_DISABLED_DOCLINT_PACKAGES := org.w3c.* javax.smartcardio # The initial set of options for javadoc +# -XDaccessInternalAPI is a temporary workaround, see 8373909 JAVADOC_OPTIONS := -use -keywords -notimestamp \ -serialwarn -encoding utf-8 -docencoding utf-8 -breakiterator \ -splitIndex --system none -javafx --expand-requires transitive \ - --override-methods=summary + --override-methods=summary \ + -XDaccessInternalAPI # The reference options must stay stable to allow for comparisons across the # development cycle. REFERENCE_OPTIONS := -XDignore.symbol.file=true -use -keywords -notimestamp \ -serialwarn -encoding utf-8 -breakiterator -splitIndex --system none \ - -html5 -javafx --expand-requires transitive + -html5 -javafx --expand-requires transitive \ + -XDaccessInternalAPI # Should we add DRAFT stamps to the generated javadoc? ifeq ($(VERSION_IS_GA), true) diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4 index b0dc565b39f..466ff1beaf4 100644 --- a/make/autoconf/flags-ldflags.m4 +++ b/make/autoconf/flags-ldflags.m4 @@ -63,7 +63,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER], fi BASIC_LDFLAGS_JVM_ONLY="" - LDFLAGS_LTO="-flto=auto -fuse-linker-plugin -fno-strict-aliasing" + LDFLAGS_LTO="-flto=auto -fuse-linker-plugin -fno-strict-aliasing $DEBUG_PREFIX_CFLAGS" LDFLAGS_CXX_PARTIAL_LINKING="$MACHINE_FLAG -r" @@ -71,7 +71,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER], BASIC_LDFLAGS_JVM_ONLY="-mno-omit-leaf-frame-pointer -mstack-alignment=16 \ -fPIC" - LDFLAGS_LTO="-flto=auto -fuse-linker-plugin -fno-strict-aliasing" + LDFLAGS_LTO="-flto=auto -fuse-linker-plugin -fno-strict-aliasing $DEBUG_PREFIX_CFLAGS" LDFLAGS_CXX_PARTIAL_LINKING="$MACHINE_FLAG -r" if test "x$OPENJDK_TARGET_OS" = xlinux; then diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index bb188778001..87d147d4f07 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -316,23 +316,36 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_DEBUG_SYMBOLS], AC_MSG_CHECKING([if we should add external native debug symbols to the shipped bundles]) AC_ARG_WITH([external-symbols-in-bundles], [AS_HELP_STRING([--with-external-symbols-in-bundles], - [which type of external native debug symbol information shall be shipped in product bundles (none, public, full) - (e.g. ship full/stripped pdbs on Windows) @<:@none@:>@])]) + [which type of external native debug symbol information shall be shipped with bundles/images (none, public, full). + @<:@none in release builds, full otherwise. --with-native-debug-symbols=external/zipped is a prerequisite. public is only supported on Windows@:>@])], + [], + [with_external_symbols_in_bundles=default]) if test "x$with_external_symbols_in_bundles" = x || test "x$with_external_symbols_in_bundles" = xnone ; then AC_MSG_RESULT([no]) elif test "x$with_external_symbols_in_bundles" = xfull || test "x$with_external_symbols_in_bundles" = xpublic ; then - if test "x$OPENJDK_TARGET_OS" != xwindows ; then - AC_MSG_ERROR([--with-external-symbols-in-bundles currently only works on windows!]) - elif test "x$COPY_DEBUG_SYMBOLS" != xtrue ; then - AC_MSG_ERROR([--with-external-symbols-in-bundles only works when --with-native-debug-symbols=external is used!]) - elif test "x$with_external_symbols_in_bundles" = xfull ; then + if test "x$COPY_DEBUG_SYMBOLS" != xtrue ; then + AC_MSG_ERROR([--with-external-symbols-in-bundles only works when --with-native-debug-symbols=external/zipped is used!]) + elif test "x$with_external_symbols_in_bundles" = xpublic && test "x$OPENJDK_TARGET_OS" != xwindows ; then + AC_MSG_ERROR([--with-external-symbols-in-bundles=public is only supported on Windows!]) + fi + + if test "x$with_external_symbols_in_bundles" = xfull ; then AC_MSG_RESULT([full]) SHIP_DEBUG_SYMBOLS=full else AC_MSG_RESULT([public]) SHIP_DEBUG_SYMBOLS=public fi + elif test "x$with_external_symbols_in_bundles" = xdefault ; then + if test "x$DEBUG_LEVEL" = xrelease ; then + AC_MSG_RESULT([no (default)]) + elif test "x$COPY_DEBUG_SYMBOLS" = xtrue ; then + AC_MSG_RESULT([full (default)]) + SHIP_DEBUG_SYMBOLS=full + else + AC_MSG_RESULT([no (default, native debug symbols are not external/zipped)]) + fi else AC_MSG_ERROR([$with_external_symbols_in_bundles is an unknown value for --with-external-symbols-in-bundles]) fi diff --git a/make/common/native/Flags.gmk b/make/common/native/Flags.gmk index efb4c08e74c..6353b490654 100644 --- a/make/common/native/Flags.gmk +++ b/make/common/native/Flags.gmk @@ -234,6 +234,9 @@ define SetupLinkerFlags ifeq ($(call isTargetOs, macosx), true) $1_EXTRA_LDFLAGS += -Wl,-object_path_lto,$$($1_OBJECT_DIR)/$$($1_NAME)_lto_helper.o endif + ifeq ($(TOOLCHAIN_TYPE), microsoft) + $1_EXTRA_LDFLAGS += -LTCGOUT:$$($1_OBJECT_DIR)/$$($1_NAME).iobj + endif endif $1_EXTRA_LDFLAGS += $$($1_LDFLAGS_$(OPENJDK_TARGET_OS_TYPE)) $$($1_LDFLAGS_$(OPENJDK_TARGET_OS)) \ diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 795335d7c3c..93aeebc0dd6 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -1192,8 +1192,8 @@ var getJibProfilesDependencies = function (input, common) { server: "jpg", product: "jcov", version: "3.0", - build_number: "3", - file: "bundles/jcov-3.0+3.zip", + build_number: "5", + file: "bundles/jcov-3.0+5.zip", environment_name: "JCOV_HOME", }, diff --git a/make/jdk/src/classes/build/tools/taglet/JSpec.java b/make/jdk/src/classes/build/tools/taglet/JSpec.java index ca45104e086..d19cdac3122 100644 --- a/make/jdk/src/classes/build/tools/taglet/JSpec.java +++ b/make/jdk/src/classes/build/tools/taglet/JSpec.java @@ -31,10 +31,9 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.lang.reflect.Field; import javax.lang.model.element.Element; -import javax.lang.model.element.PackageElement; -import javax.lang.model.element.TypeElement; import com.sun.source.doctree.DocTree; import com.sun.source.doctree.LiteralTree; @@ -160,9 +159,10 @@ public class JSpec implements Taglet { if (m.find()) { String chapter = m.group("chapter"); String section = m.group("section"); + String rootParent = currentPath().replaceAll("[^/]+", ".."); - String url = String.format("%1$s/../specs/%2$s/%2$s-%3$s.html#%2$s-%3$s%4$s", - docRoot(elem), idPrefix, chapter, section); + String url = String.format("%1$s/specs/%2$s/%2$s-%3$s.html#%2$s-%3$s%4$s", + rootParent, idPrefix, chapter, section); sb.append(" CURRENT_PATH = null; + + private String currentPath() { + if (CURRENT_PATH == null) { + try { + Field f = Class.forName("jdk.javadoc.internal.doclets.formats.html.HtmlDocletWriter") + .getField("CURRENT_PATH"); + @SuppressWarnings("unchecked") + ThreadLocal tl = (ThreadLocal) f.get(null); + CURRENT_PATH = tl; + } catch (ReflectiveOperationException e) { + throw new RuntimeException("Cannot determine current path", e); + } + } + return CURRENT_PATH.get(); + } private String expand(List trees) { return (new SimpleDocTreeVisitor() { @@ -209,34 +225,4 @@ public class JSpec implements Taglet { }).visit(trees, new StringBuilder()).toString(); } - private String docRoot(Element elem) { - switch (elem.getKind()) { - case MODULE: - return ".."; - - case PACKAGE: - PackageElement pe = (PackageElement)elem; - String pkgPart = pe.getQualifiedName() - .toString() - .replace('.', '/') - .replaceAll("[^/]+", ".."); - return pe.getEnclosingElement() != null - ? "../" + pkgPart - : pkgPart; - - case CLASS, ENUM, RECORD, INTERFACE, ANNOTATION_TYPE: - TypeElement te = (TypeElement)elem; - return te.getQualifiedName() - .toString() - .replace('.', '/') - .replaceAll("[^/]+", ".."); - - default: - var enclosing = elem.getEnclosingElement(); - if (enclosing == null) - throw new IllegalArgumentException(elem.getKind().toString()); - return docRoot(enclosing); - } - } - } diff --git a/make/jdk/src/classes/build/tools/taglet/ToolGuide.java b/make/jdk/src/classes/build/tools/taglet/ToolGuide.java index 72a8ab05b3b..ebd8fd10437 100644 --- a/make/jdk/src/classes/build/tools/taglet/ToolGuide.java +++ b/make/jdk/src/classes/build/tools/taglet/ToolGuide.java @@ -31,10 +31,9 @@ import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.lang.reflect.Field; import javax.lang.model.element.Element; -import javax.lang.model.element.PackageElement; -import javax.lang.model.element.TypeElement; import com.sun.source.doctree.DocTree; import com.sun.source.doctree.UnknownBlockTagTree; @@ -68,7 +67,7 @@ public class ToolGuide implements Taglet { static final String TAG_NAME = "toolGuide"; - static final String BASE_URL = "../specs/man"; + static final String BASE_URL = "specs/man"; static final Pattern TAG_PATTERN = Pattern.compile("(?s)(?[A-Za-z0-9]+)\\s*(? + * JLS 5.7.1 Exact Testing Conversions + * @see + * JLS 5.7.2 Unconditionally Exact Testing Conversions + * @see + * JLS 15.20.2 The instanceof Operator * * @implNote Some exactness checks describe a test which can be redirected * safely through one of the existing methods. Those are omitted too (i.e., diff --git a/src/java.base/share/classes/java/text/MessageFormat.java b/src/java.base/share/classes/java/text/MessageFormat.java index 5477d0f881a..1a850ebaa42 100644 --- a/src/java.base/share/classes/java/text/MessageFormat.java +++ b/src/java.base/share/classes/java/text/MessageFormat.java @@ -1713,12 +1713,7 @@ public class MessageFormat extends Format { throw new IllegalArgumentException("unknown format type: " + type); } // Get the style if recognized, otherwise treat style as a SubformatPattern - FormatStyle fStyle; - try { - fStyle = FormatStyle.fromString(style); - } catch (IllegalArgumentException iae) { - fStyle = FormatStyle.SUBFORMATPATTERN; - } + FormatStyle fStyle = FormatStyle.fromString(style); return switch (fType) { case NUMBER -> switch (fStyle) { case DEFAULT -> NumberFormat.getInstance(locale); @@ -1976,41 +1971,43 @@ public class MessageFormat extends Format { } // Corresponding to the FormatStyle pattern + // WARNING: fromString is dependent on ordinal positioning and Enum names. private enum FormatStyle { - DEFAULT(""), - SHORT("short"), - MEDIUM("medium"), - LONG("long"), - FULL("full"), - INTEGER("integer"), - CURRENCY("currency"), - PERCENT("percent"), - COMPACT_SHORT("compact_short"), - COMPACT_LONG("compact_long"), - OR("or"), - UNIT("unit"), - SUBFORMATPATTERN(null); + // Special styles + DEFAULT, + SUBFORMATPATTERN, + // Pre-defined styles + SHORT, + MEDIUM, + LONG, + FULL, + INTEGER, + CURRENCY, + PERCENT, + COMPACT_SHORT, + COMPACT_LONG, + OR, + UNIT; - private final String text; - - // Differs from FormatType in that the text String is - // not guaranteed to match the Enum name, thus a text field is used - FormatStyle(String text) { - this.text = text; - } - - // This method returns a FormatStyle (excluding SUBFORMATPATTERN) - // that matches the passed String. If no FormatStyle is found, - // an IllegalArgumentException is thrown + // Returns a FormatStyle corresponding to the input text. + // DEFAULT is the empty String. + // Pre-defined styles are lower case versions of their enum name + // (but compared case-insensitive for historical compatibility). + // SUBFORMATPATTERN is anything else. private static FormatStyle fromString(String text) { - for (FormatStyle style : values()) { - // Also check trimmed case-insensitive for historical reasons - if (style != FormatStyle.SUBFORMATPATTERN && - text.trim().compareToIgnoreCase(style.text) == 0) { - return style; + var style = text.trim(); + if (style.isEmpty()) { + return FormatStyle.DEFAULT; + } + var styles = values(); + // Match starting at the pre-defined styles -> [SHORT:] + for (int i = SHORT.ordinal(); i < styles.length; i++) { + var fStyle = styles[i]; + if (style.compareToIgnoreCase(fStyle.name()) == 0) { + return fStyle; } } - throw new IllegalArgumentException(); + return FormatStyle.SUBFORMATPATTERN; } } diff --git a/src/java.base/share/classes/java/util/ImmutableCollections.java b/src/java.base/share/classes/java/util/ImmutableCollections.java index abc48ff5ed9..e7fe22490da 100644 --- a/src/java.base/share/classes/java/util/ImmutableCollections.java +++ b/src/java.base/share/classes/java/util/ImmutableCollections.java @@ -42,6 +42,9 @@ import java.util.function.UnaryOperator; import jdk.internal.access.JavaUtilCollectionAccess; import jdk.internal.access.SharedSecrets; import jdk.internal.misc.CDS; +import jdk.internal.vm.annotation.AOTRuntimeSetup; +import jdk.internal.vm.annotation.AOTSafeClassInitializer; +import jdk.internal.vm.annotation.ForceInline; import jdk.internal.vm.annotation.Stable; /** @@ -52,6 +55,7 @@ import jdk.internal.vm.annotation.Stable; * classes use a serial proxy and thus have no need to declare serialVersionUID. */ @SuppressWarnings("serial") +@AOTSafeClassInitializer class ImmutableCollections { /** * A "salt" value used for randomizing iteration order. This is initialized once @@ -59,14 +63,20 @@ class ImmutableCollections { * it needs to vary sufficiently from one run to the next so that iteration order * will vary between JVM runs. */ - private static final long SALT32L; + @Stable private static long SALT32L; /** * For set and map iteration, we will iterate in "reverse" stochastically, * decided at bootstrap time. */ - private static final boolean REVERSE; + @Stable private static boolean REVERSE; + static { + runtimeSetup(); + } + + @AOTRuntimeSetup + private static void runtimeSetup() { // to generate a reasonably random and well-mixed SALT, use an arbitrary // value (a slice of pi), multiply with a random seed, then pick // the mid 32-bits from the product. By picking a SALT value in the @@ -102,6 +112,7 @@ class ImmutableCollections { static final MapN EMPTY_MAP; static { + // Legacy CDS archive support (to be deprecated) CDS.initializeFromArchive(ImmutableCollections.class); if (archivedObjects == null) { EMPTY = new Object(); diff --git a/src/java.base/share/classes/java/util/Locale.java b/src/java.base/share/classes/java/util/Locale.java index 54863d58782..f45a52c14fa 100644 --- a/src/java.base/share/classes/java/util/Locale.java +++ b/src/java.base/share/classes/java/util/Locale.java @@ -535,34 +535,13 @@ import sun.util.locale.provider.TimeZoneNameUtility; * *

Legacy language codes

* - *

Locale's constructors have always converted three language codes to - * their earlier, obsoleted forms: {@code he} maps to {@code iw}, - * {@code yi} maps to {@code ji}, and {@code id} maps to - * {@code in}. Since Java SE 17, this is no longer the case. Each - * language maps to its new form; {@code iw} maps to {@code he}, {@code ji} - * maps to {@code yi}, and {@code in} maps to {@code id}. - * - *

For backwards compatible behavior, the system property - * {@systemProperty java.locale.useOldISOCodes} reverts the behavior - * back to that of before Java SE 17. If the system property is set to - * {@code true}, those three current language codes are mapped to their - * backward compatible forms. The property is only read at Java runtime - * startup and subsequent calls to {@code System.setProperty()} will - * have no effect. As of Java SE 25, the use of the - * {@code java.locale.useOldISOCodes} system property is deprecated. - * This backwards compatible behavior will be removed in a future release - * of the JDK. - * - *

The APIs added in Java SE 7 map between the old and new language codes, - * maintaining the mapped codes internal to Locale (so that - * {@code getLanguage} and {@code toString} reflect the mapped - * code, which depends on the {@code java.locale.useOldISOCodes} system - * property), but using the new codes in the BCP 47 language tag APIs (so - * that {@code toLanguageTag} reflects the new one). This - * preserves the equivalence between Locales no matter which code or - * API is used to construct them. Java's default resource bundle - * lookup mechanism also implements this mapping, so that resources - * can be named using either convention, see {@link ResourceBundle.Control}. + *

For compatibility, a {@code Locale} created with one of the + * three obsolete language codes, {@code iw}, {@code ji}, or {@code in}, + * will map the language to its modern equivalent, {@code he}, {@code yi}, + * or {@code id}, respectively. + *

The default resource bundle lookup mechanism also implements + * this mapping, so that resources can be named using either convention, + * see {@link ResourceBundle.Control}. * * @spec https://www.rfc-editor.org/info/rfc4647 * RFC 4647: Matching of Language Tags @@ -2527,8 +2506,7 @@ public final class Locale implements Cloneable, Serializable { private static String convertOldISOCodes(String language) { // we accept both the old and the new ISO codes for the languages whose ISO - // codes have changed, but we always store the NEW code, unless the property - // java.locale.useOldISOCodes is set to "true" + // codes have changed, but we always store the NEW code return BaseLocale.convertOldISOCodes(LocaleUtils.toLowerString(language).intern()); } diff --git a/src/java.base/share/classes/java/util/UUID.java b/src/java.base/share/classes/java/util/UUID.java index 117ddb09cc8..9c3bc528f91 100644 --- a/src/java.base/share/classes/java/util/UUID.java +++ b/src/java.base/share/classes/java/util/UUID.java @@ -33,12 +33,11 @@ import jdk.internal.util.ByteArrayLittleEndian; import jdk.internal.util.HexDigits; /** - * A class that represents an immutable universally unique identifier (UUID). + * A class that represents an immutable Universally Unique IDentifier (UUID). * A UUID represents a 128-bit value. * - *

There exist different variants of these global identifiers. The methods - * of this class are for manipulating the Leach-Salz variant, although the - * constructors allow the creation of any variant of UUID (described below). + *

This class is primarily designed for manipulating Leach-Salz variant UUIDs, + * but it also supports the creation of UUIDs of other variants. * *

The layout of a variant 2 (Leach-Salz) UUID is as follows: * diff --git a/src/java.base/share/classes/java/util/jar/Attributes.java b/src/java.base/share/classes/java/util/jar/Attributes.java index 9322bb9acac..20ff81676c9 100644 --- a/src/java.base/share/classes/java/util/jar/Attributes.java +++ b/src/java.base/share/classes/java/util/jar/Attributes.java @@ -36,6 +36,7 @@ import java.util.Objects; import java.util.Set; import jdk.internal.misc.CDS; +import jdk.internal.vm.annotation.AOTSafeClassInitializer; import jdk.internal.vm.annotation.Stable; import sun.nio.cs.UTF_8; @@ -60,6 +61,7 @@ import sun.util.logging.PlatformLogger; * @see Manifest * @since 1.2 */ +@AOTSafeClassInitializer public class Attributes implements Map, Cloneable { /** * The attribute name-value mappings. @@ -450,6 +452,7 @@ public class Attributes implements Map, Cloneable { * * @spec jar/jar.html JAR File Specification */ + @AOTSafeClassInitializer public static class Name { private final String name; private final int hashCode; @@ -669,6 +672,7 @@ public class Attributes implements Map, Cloneable { static { + // Legacy CDS archive support (to be deprecated) CDS.initializeFromArchive(Attributes.Name.class); if (KNOWN_NAMES == null) { diff --git a/src/java.base/share/classes/jdk/internal/loader/ArchivedClassLoaders.java b/src/java.base/share/classes/jdk/internal/loader/ArchivedClassLoaders.java index be3425590fc..439772a8789 100644 --- a/src/java.base/share/classes/jdk/internal/loader/ArchivedClassLoaders.java +++ b/src/java.base/share/classes/jdk/internal/loader/ArchivedClassLoaders.java @@ -27,11 +27,13 @@ package jdk.internal.loader; import java.util.Map; import jdk.internal.misc.CDS; import jdk.internal.module.ServicesCatalog; +import jdk.internal.vm.annotation.AOTSafeClassInitializer; /** * Used to archive the built-in class loaders, their services catalogs, and the * package-to-module map used by the built-in class loaders. */ +@AOTSafeClassInitializer class ArchivedClassLoaders { private static ArchivedClassLoaders archivedClassLoaders; diff --git a/src/java.base/share/classes/jdk/internal/math/FDBigInteger.java b/src/java.base/share/classes/jdk/internal/math/FDBigInteger.java index 1ef9dee3a8a..5413226c112 100644 --- a/src/java.base/share/classes/jdk/internal/math/FDBigInteger.java +++ b/src/java.base/share/classes/jdk/internal/math/FDBigInteger.java @@ -26,6 +26,7 @@ package jdk.internal.math; import jdk.internal.misc.CDS; +import jdk.internal.vm.annotation.AOTSafeClassInitializer; import jdk.internal.vm.annotation.Stable; import java.util.Arrays; @@ -33,6 +34,7 @@ import java.util.Arrays; /** * A simple big integer class specifically for floating point base conversion. */ +@AOTSafeClassInitializer final class FDBigInteger { @Stable @@ -53,6 +55,7 @@ final class FDBigInteger { // Initialize FDBigInteger cache of powers of 5. static { + // Legacy CDS archive support (to be deprecated) CDS.initializeFromArchive(FDBigInteger.class); Object[] caches = archivedCaches; if (caches == null) { diff --git a/src/java.base/share/classes/jdk/internal/module/ArchivedBootLayer.java b/src/java.base/share/classes/jdk/internal/module/ArchivedBootLayer.java index 5c806f81dcd..425238dd521 100644 --- a/src/java.base/share/classes/jdk/internal/module/ArchivedBootLayer.java +++ b/src/java.base/share/classes/jdk/internal/module/ArchivedBootLayer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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,10 +25,12 @@ package jdk.internal.module; import jdk.internal.misc.CDS; +import jdk.internal.vm.annotation.AOTSafeClassInitializer; /** * Used by ModuleBootstrap for archiving the boot layer. */ +@AOTSafeClassInitializer class ArchivedBootLayer { private static ArchivedBootLayer archivedBootLayer; diff --git a/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java b/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java index 4f9223d0171..deb280c878d 100644 --- a/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java +++ b/src/java.base/share/classes/jdk/internal/module/ArchivedModuleGraph.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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,11 +30,13 @@ import java.util.function.Function; import java.lang.module.Configuration; import java.lang.module.ModuleFinder; import jdk.internal.misc.CDS; +import jdk.internal.vm.annotation.AOTSafeClassInitializer; /** * Used by ModuleBootstrap for archiving the configuration for the boot layer, * and the system module finder. */ +@AOTSafeClassInitializer class ArchivedModuleGraph { private static ArchivedModuleGraph archivedModuleGraph; @@ -126,6 +128,7 @@ class ArchivedModuleGraph { } static { + // Legacy CDS archive support (to be deprecated) CDS.initializeFromArchive(ArchivedModuleGraph.class); } } diff --git a/src/java.base/share/classes/jdk/internal/util/StaticProperty.java b/src/java.base/share/classes/jdk/internal/util/StaticProperty.java index 4fb3ae7a184..4740062dcde 100644 --- a/src/java.base/share/classes/jdk/internal/util/StaticProperty.java +++ b/src/java.base/share/classes/jdk/internal/util/StaticProperty.java @@ -53,7 +53,6 @@ public final class StaticProperty { private static final String STDOUT_ENCODING; private static final String SUN_JNU_ENCODING; private static final String JAVA_PROPERTIES_DATE; - private static final String JAVA_LOCALE_USE_OLD_ISO_CODES; private static final String OS_NAME; private static final String OS_ARCH; private static final String OS_VERSION; @@ -94,7 +93,6 @@ public final class StaticProperty { STDOUT_ENCODING = getProperty(props, "stdout.encoding"); SUN_JNU_ENCODING = getProperty(props, "sun.jnu.encoding"); JAVA_PROPERTIES_DATE = getProperty(props, "java.properties.date", null); - JAVA_LOCALE_USE_OLD_ISO_CODES = getProperty(props, "java.locale.useOldISOCodes", ""); OS_NAME = getProperty(props, "os.name"); OS_ARCH = getProperty(props, "os.arch"); OS_VERSION = getProperty(props, "os.version"); @@ -258,13 +256,6 @@ public final class StaticProperty { return JAVA_PROPERTIES_DATE; } - /** - * {@return the {@code java.locale.useOldISOCodes} system property} - */ - public static String javaLocaleUseOldISOCodes() { - return JAVA_LOCALE_USE_OLD_ISO_CODES; - } - /** * {@return the {@code os.name} system property} */ diff --git a/src/java.base/share/classes/sun/launcher/resources/launcher_de.properties b/src/java.base/share/classes/sun/launcher/resources/launcher_de.properties index 79b5968b210..e80869b868c 100644 --- a/src/java.base/share/classes/sun/launcher/resources/launcher_de.properties +++ b/src/java.base/share/classes/sun/launcher/resources/launcher_de.properties @@ -30,8 +30,8 @@ java.launcher.opt.vmselect =\ {0}\t zur Auswahl der "{1}" VM\n java.launcher.opt.hotspot =\ {0}\t ist ein Synonym für die "{1}" VM [verworfen]\n # Translators please note do not translate the options themselves -java.launcher.opt.footer = \ -cp \n -classpath \n --class-path \n Eine durch "{0}" getrennte Liste mit Verzeichnissen, JAR-Archiven\n und ZIP-Archiven, in denen nach Klassendateien gesucht wird.\n -p \n --module-path ...\n Eine durch "{0}" getrennte Liste mit Elementen, von denen jedes Element ein Dateipfad ist\n zu einem Modul oder einem Verzeichnis mit Modulen ist. Jedes Modul ist entweder\n ein modulares JAR oder ein entpacktes Modulverzeichnis.\n --upgrade-module-path ...\n Eine durch "{0}" getrennte Liste mit Elementen, von denen jedes Element ein Dateipfad ist\n zu einem Modul oder einem Verzeichnis mit Modulen ist,\n um upgradefähige Module im Laufzeitimage zu ersetzen. Jedes Modul ist entweder\n ein modulares JAR oder ein entpacktes Modulverzeichnis.\n --add-modules [,...]\n Root-Module, die zusätzlich zum anfänglichen Modul aufgelöst werden sollen.\n kann auch wie folgt lauten: ALL-DEFAULT, ALL-SYSTEM,\n ALL-MODULE-PATH.\n --enable-native-access [,...]\n Damit kann der Code in Modulen auf Code und Daten außerhalb der JRE zugreifen.\n kann auch ALL-UNNAMED sein, um den Code im Classpath anzugeben.\n --illegal-native-access=\n Zugriff auf Code und Daten außerhalb der JRE\n durch Code in Modulen zulassen oder verweigern, für die der native Zugriff nicht explizit aktiviert ist.\n ist "deny", "warn" oder "allow". Der Standardwert ist "warn".\n Diese Option wird in einem zukünftigen Release entfernt.\n --list-modules\n Listet beobachtbare Module auf und beendet den Vorgang\n -d \n --describe-module \n Beschreibt ein Modul und beendet den Vorgang\n --dry-run Erstellt eine VM und lädt die Hauptklasse, führt aber nicht die Hauptmethode aus.\n Die Option "--dry-run" kann nützlich sein, um die\n Befehlszeilenoptionen, wie die Modulsystemkonfiguration, zu validieren.\n --validate-modules\n Validiert alle Module und beendet den Vorgang\n Die Option "--validate-modules" kann nützlich sein, um\n Konflikte und andere Fehler mit Modulen auf dem Modulpfad zu ermitteln.\n -D=\n Legt eine Systemeigenschaft fest\n -verbose:[class|module|gc|jni]\n Aktiviert die Verbose-Ausgabe für das angegebene Subsystem\n -version Gibt die Produktversion an den Fehlerstream aus und beendet den Vorgang\n --version Gibt die Produktversion an den Outputstream aus und beendet den Vorgang\n -showversion Gibt die Produktversion an den Fehlerstream aus und setzt den Vorgang fort\n --show-version\n Gibt die Produktversion an den Outputstream aus und setzt den Vorgang fort\n --show-module-resolution\n Zeigt die Modulauflösungsausgabe beim Start an\n -? -h -help\n Gibt diese Hilfemeldung an den Fehlerstream aus\n --help Gibt diese Hilfemeldung an den Outputstream aus\n -X Gibt Hilfe zu zusätzlichen Optionen an den Fehlerstream aus\n --help-extra Gibt Hilfe zu zusätzlichen Optionen an den Outputstream aus\n -ea[:...|:]\n -enableassertions[:...|:]\n Aktiviert Assertions mit angegebener \ -Granularität\n -da[:...|:]\n -disableassertions[:...|:]\n Deaktiviert Assertions mit angegebener Granularität\n -esa | -enablesystemassertions\n Aktiviert System-Assertions\n -dsa | -disablesystemassertions\n Deaktiviert System-Assertions\n -agentlib:[=]\n Lädt die native Agent Library . Beispiel: -agentlib:jdwp\n siehe auch -agentlib:jdwp=help\n -agentpath:[=]\n Lädt die native Agent Library mit dem vollständigen Pfadnamen\n -javaagent:[=]\n Lädt den Java-Programmiersprachen-Agent, siehe java.lang.instrument\n -splash:\n Zeigt den Startbildschirm mit einem angegebenen Bild an\n Skalierte HiDPI-Bilder werden automatisch unterstützt und verwendet,\n falls verfügbar. Der nicht skalierte Bilddateiname (Beispiel: image.ext)\n muss immer als Argument an die Option "-splash" übergeben werden.\n Das am besten geeignete angegebene skalierte Bild wird\n automatisch ausgewählt.\n Weitere Informationen finden Sie in der Dokumentation zur SplashScreen-API\n @argument files\n Eine oder mehrere Argumentdateien mit Optionen\n --disable-@files\n Verhindert die weitere Erweiterung von Argumentdateien\n --enable-preview\n Lässt zu, das Klassen von Vorschaufeatures dieses Release abhängig sind\nUm ein Argument für eine lange Option anzugeben, können Sie --= oder\n-- verwenden.\n +java.launcher.opt.footer = \ -cp \n -classpath \n --class-path \n Eine durch "{0}" getrennte Liste mit Verzeichnissen, JAR-Archiven\n und ZIP-Archiven, in denen nach Klassendateien gesucht wird.\n -p \n --module-path ...\n Eine durch "{0}" getrennte Liste mit Elementen, von denen jedes Element ein Dateipfad ist\n zu einem Modul oder einem Verzeichnis mit Modulen ist. Jedes Modul ist entweder\n ein modulares JAR oder ein entpacktes Modulverzeichnis.\n --upgrade-module-path ...\n Eine durch "{0}" getrennte Liste mit Elementen, von denen jedes Element ein Dateipfad ist\n zu einem Modul oder einem Verzeichnis mit Modulen ist,\n um upgradefähige Module im Laufzeitimage zu ersetzen. Jedes Modul ist entweder\n ein modulares JAR oder ein entpacktes Modulverzeichnis.\n --add-modules [,...]\n Root-Module, die zusätzlich zum anfänglichen Modul aufgelöst werden sollen.\n kann auch wie folgt lauten: ALL-DEFAULT, ALL-SYSTEM,\n ALL-MODULE-PATH.\n --enable-native-access [,...]\n Damit kann der Code in Modulen auf Code und Daten außerhalb der JRE zugreifen.\n kann auch ALL-UNNAMED sein, um den Code im Classpath anzugeben.\n --illegal-native-access=\n Zugriff auf Code und Daten außerhalb der JRE\n durch Code in Modulen zulassen oder verweigern, für die der native Zugriff nicht explizit aktiviert ist.\n ist "deny", "warn" oder "allow". Der Standardwert ist "warn".\n Diese Option wird in einem zukünftigen Release entfernt.\n --enable-final-field-mutation [,...]\n Zulassen, dass die endgültigen Instanzfelder durch Code in den angegebenen Modulen mutiert werden.\n kann auch ALL-UNNAMED sein, um den Code im Classpath anzugeben.\n --illegal-final-field-mutation=\n Erlauben oder verweigern Sie die Mutation von endgültigen Feldern durch Code in Modulen, für die die Mutation\n von endgültigen Feldern nicht explizit aktiviert ist.\n ist "deny", "warn", "debug" oder "allow". Der Standardwert ist "warn".\n Diese Option wird in einem zukünftigen Release entfernt.\n --list-modules\n Listet beobachtbare Module auf und beendet den Vorgang\n -d \n --describe-module \n Beschreibt ein Modul und beendet den Vorgang\n --dry-run Erstellt eine VM und lädt die Hauptklasse, führt aber nicht die Hauptmethode aus.\n Die Option "--dry-run" kann nützlich sein, um die\n Befehlszeilenoptionen, wie die Modulsystemkonfiguration, zu validieren.\n --validate-modules\n Validiert alle Module und beendet den Vorgang\n Die Option "--validate-modules" kann nützlich sein, um\n Konflikte und andere Fehler mit Modulen auf dem Modulpfad zu ermitteln.\n -D=\n Legt eine Systemeigenschaft fest\n -verbose:[class|module|gc|jni]\n Aktiviert die Verbose-Ausgabe für das angegebene Subsystem\n -version Gibt die Produktversion an den Fehlerstream aus und beendet den Vorgang\n --version Gibt die Produktversion an den Outputstream aus und beendet den Vorgang\n -showversion Gibt die Produktversion an den Fehlerstream aus und \ +setzt den Vorgang fort\n --show-version\n Gibt die Produktversion an den Outputstream aus und setzt den Vorgang fort\n --show-module-resolution\n Zeigt die Modulauflösungsausgabe beim Start an\n -? -h -help\n Gibt diese Hilfemeldung an den Fehlerstream aus\n --help Gibt diese Hilfemeldung an den Outputstream aus\n -X Gibt Hilfe zu zusätzlichen Optionen an den Fehlerstream aus\n --help-extra Gibt Hilfe zu zusätzlichen Optionen an den Outputstream aus\n -ea[:...|:]\n -enableassertions[:...|:]\n Aktiviert Assertions mit angegebener Granularität\n -da[:...|:]\n -disableassertions[:...|:]\n Deaktiviert Assertions mit angegebener Granularität\n -esa | -enablesystemassertions\n Aktiviert System-Assertions\n -dsa | -disablesystemassertions\n Deaktiviert System-Assertions\n -agentlib:[=]\n Lädt die native Agent Library . Beispiel: -agentlib:jdwp\n siehe auch -agentlib:jdwp=help\n -agentpath:[=]\n Lädt die native Agent Library mit dem vollständigen Pfadnamen\n -javaagent:[=]\n Lädt den Java-Programmiersprachen-Agent, siehe java.lang.instrument\n -splash:\n Zeigt den Startbildschirm mit einem angegebenen Bild an\n Skalierte HiDPI-Bilder werden automatisch unterstützt und verwendet,\n falls verfügbar. Der nicht skalierte Bilddateiname (Beispiel: image.ext)\n muss immer als Argument an die Option "-splash" übergeben werden.\n Das am besten geeignete angegebene skalierte Bild wird\n automatisch ausgewählt.\n Weitere Informationen finden Sie in der Dokumentation zur SplashScreen-API\n @argument files\n Eine oder mehrere Argumentdateien mit Optionen\n --disable-@files\n Verhindert die weitere Erweiterung von Argumentdateien\n --enable-preview\n Lässt zu, das Klassen von Vorschaufeatures dieses Release abhängig sind\nUm ein Argument für eine lange Option anzugeben, können Sie --= oder\n-- verwenden.\n # Translators please note do not translate the options themselves java.launcher.X.usage=\n -Xbatch Deaktiviert die Hintergrundkompilierung\n -Xbootclasspath/a:\n An das Ende des Bootstrap Classpaths anhängen\n -Xcheck:jni Führt zusätzliche Prüfungen für JNI-Funktionen aus\n -Xcomp Erzwingt die Kompilierung von Methoden beim ersten Aufruf\n -Xdebug Führt keine Aktion aus. Ist veraltet und wird in einem zukünftigen Release entfernt.\n -Xdiag Zeigt zusätzliche Diagnosemeldungen an\n -Xint Nur Ausführung im interpretierten Modus\n -Xinternalversion\n Zeigt detailliertere JVM-Versionsinformationen an als die\n Option -version\n -Xlog: Konfiguriert oder aktiviert Logging mit dem einheitlichen Java Virtual\n Machine-(JVM-)Logging-Framework. Verwenden Sie -Xlog:help\n für weitere Einzelheiten.\n -Xloggc: Protokolliert den GC-Status in einer Datei mit Zeitstempeln.\n Diese Option ist veraltet und kann in einem\n zukünftigen Release entfernt werden. Wird durch -Xlog:gc: ersetzt.\n -Xmixed Ausführung im gemischten Modus (Standard)\n -Xmn Legt die anfängliche und maximale Größe (in Byte) des Heaps\n für die Young Generation (Nursery) fest\n -Xms Legt die minimale und die anfängliche Java-Heap-Größe fest\n -Xmx Legt die maximale Java-Heap-Größe fest\n -Xnoclassgc Deaktiviert die Klassen-Garbage Collection\n -Xrs Reduziert die Verwendung von BS-Signalen durch Java/VM (siehe Dokumentation)\n -Xshare:auto Verwendet freigegebene Klassendaten, wenn möglich (Standard)\n -Xshare:off Versucht nicht, freigegebene Klassendaten zu verwenden\n -Xshare:on Erfordert die Verwendung freigegebener Klassendaten, verläuft sonst nicht erfolgreich.\n Diese Testoption kann zeitweise zu\n Fehlern führen. Sie darf nicht in Produktionsumgebungen verwendet werden.\n -XshowSettings Zeigt alle Einstellungen an und fährt fort\n -XshowSettings:all\n Zeigt alle Einstellungen als Verbose-Ausgabe an und fährt fort\n -XshowSettings:locale\n Zeigt alle gebietsschemabezogenen Einstellungen an und fährt fort\n -XshowSettings:properties\n Zeigt alle Eigenschaftseinstellungen an und fährt fort\n -XshowSettings:vm\n Zeigt alle VM-bezogenen Einstellungen an und fährt fort\n -XshowSettings:security\n Zeigt alle Sicherheitseinstellungen an und fährt fort\n -XshowSettings:security:all\n Zeigt alle Sicherheitseinstellungen an und fährt fort\n -XshowSettings:security:properties\n Zeigt Sicherheitseigenschaften an und fährt fort\n -XshowSettings:security:providers\n Zeigt statische Sicherheitsprovidereinstellungen an und fährt fort\n -XshowSettings:security:tls\n Zeigt TLS-bezogene Sicherheitseinstellungen an und fährt fort\n -XshowSettings:system\n (Nur Linux) Zeigt die Konfiguration des Hostsystems oder Containers an\n und fährt fort\n -Xss Legt die Stackgröße des Java-Threads fest\n Die tatsächliche Größe kann auf ein Vielfaches der\n Systemseitengröße aufgerundet werden, wenn für das Betriebssystem erforderlich.\n -Xverify Legt den Modus der Bytecodeverifizierung fest\n \ @@ -58,6 +58,7 @@ java.launcher.jar.error3=kein Hauptmanifestattribut, in {0} java.launcher.jar.error4=Fehler beim Laden des Java-Agents in {0} java.launcher.jar.error5=Fehler: Beim Versuch, Datei {0} zu schließen, ist ein unerwarteter Fehler aufgetreten java.launcher.jar.error.illegal.ena.value=Fehler: Ungültiger Wert "{0}" für das Manifestattribut "Enable-Native-Access". Nur ''ALL-UNNAMED'' ist zulässig +java.launcher.jar.error.illegal.effm.value=Fehler: Ungültiger Wert "{0}" für das Manifestattribut "Enable-Final-Field-Mutation". Nur "ALL-UNNAMED" ist zulässig java.launcher.init.error=Initialisierungsfehler java.launcher.javafx.error1=Fehler: Die JavaFX-Methode launchApplication hat die falsche Signatur, sie\nmuss als statisch deklariert werden und einen Wert vom Typ VOID zurückgeben java.launcher.module.error1=Modul {0} weist kein ModuleMainClass-Attribut auf. Verwenden Sie -m / diff --git a/src/java.base/share/classes/sun/launcher/resources/launcher_ja.properties b/src/java.base/share/classes/sun/launcher/resources/launcher_ja.properties index 04b68db3a8e..49712b21c52 100644 --- a/src/java.base/share/classes/sun/launcher/resources/launcher_ja.properties +++ b/src/java.base/share/classes/sun/launcher/resources/launcher_ja.properties @@ -31,8 +31,9 @@ java.launcher.opt.hotspot =\ {0}\t は"{1}" VMのシノニムです [非 # Translators please note do not translate the options themselves java.launcher.opt.footer = \ -cp <ディレクトリおよびzip/jarファイルのクラス検索パス>\n -classpath <ディレクトリおよびzip/jarファイルのクラス検索パス>\n --class-path <ディレクトリおよびzip/jarファイルのクラス検索パス>\n "{0}"区切りリスト(ディレクトリ、JARアーカイブ、\n ZIPアーカイブ)で、クラス・ファイルの検索用。\n -p \n --module-path ...\n 要素を"{0}"で区切ったリストで、各要素は次へのファイル・パスです:\n モジュール、またはモジュールが格納されているディレクトリ。各モジュールは次のいずれかです:\n モジュラJARまたは展開形式のモジュール・ディレクトリ。\n --upgrade-module-path ...\n 要素を"{0}"で区切ったリストで、各要素は次へのファイル・パスです:\n モジュール、またはモジュールが格納されているディレクトリで、次のものを置き換えます:\n ランタイム・イメージのアップグレード可能なモジュール。各モジュールは次のいずれかです:\n モジュラJARまたは展開形式のモジュール・ディレクトリ。\n --add-modules [,...]\n 初期モジュールに加えて解決するルート・モジュール。\n には次も指定できます: ALL-DEFAULT、ALL-SYSTEM、\n ALL-MODULE-PATH.\n --enable-native-access [,...]\n モジュール内のコードをJavaランタイムの外のコードおよびデータにアクセスさせることができます。\n は、クラス・パス上のコードを指定するためにALL-UNNAMEDにもできます。\n --illegal-native-access=\n Javaランタイムの外のコードおよびデータへのアクセスを許可または拒否します\n (ネイティブ・アクセスが明示的に有効化されていないモジュール内のコードによる)。\n \ -は、"deny"、"warn"または"allow"のいずれかです。デフォルト値は"warn"です。\n このオプションは、将来のリリースで削除される予定です。\n --list-modules\n 参照可能なモジュールをリストし終了します\n -d \n --describe-module \n モジュールを説明し終了します\n --dry-run VMを作成しメイン・クラスをロードしますが、メイン・メソッドは実行しません。\n --dry-runオプションは、次の検証に役立つ場合があります:\n モジュール・システム構成などのコマンド行オプション。\n --validate-modules\n すべてのモジュールを検証し終了します\n --validate-modulesオプションは、次の検索に役立つ場合があります:\n モジュール・パス上のモジュールでの競合およびその他のエラー。\n -D=\n システム・プロパティを設定します\n -verbose:[class|module|gc|jni]\n 特定のサブシステムで詳細出力を有効にする\n -version 製品バージョンをエラー・ストリームに出力して終了します\n --version 製品バージョンを出力ストリームに出力して終了します\n -showversion 製品バージョンをエラー・ストリームに出力して続行します\n --show-version\n 製品バージョンを出力ストリームに出力して続行します\n --show-module-resolution\n 起動時にモジュール解決出力を表示します\n -? -h -help\n このヘルプ・メッセージをエラー・ストリームに出力します\n --help このヘルプ・メッセージを出力ストリームに出力します\n -X 追加オプションのヘルプをエラー・ストリームに出力します\n --help-extra 追加オプションのヘルプを出力ストリームに出力します\n -ea[:...|:]\n -enableassertions[:...|:]\n 指定した粒度でアサーションを有効にします\n -da[:...|:]\n \ --disableassertions[:...|:]\n 指定した粒度でアサーションを無効にします\n -esa | -enablesystemassertions\n システム・アサーションを有効にします\n -dsa | -disablesystemassertions\n システム・アサーションを無効にします\n -agentlib:[=]\n ネイティブ・エージェント・ライブラリをロードします。例: -agentlib:jdwp\n -agentlib:jdwp=helpも参照してください\n -agentpath:[=]\n フルパス名を使用して、ネイティブ・エージェント・ライブラリをロードします\n -javaagent:[=]\n Javaプログラミング言語エージェントをロードします。java.lang.instrumentを参照してください\n -splash:\n 指定されたイメージを含むスプラッシュ画面を表示します\n HiDPIスケールのイメージが自動的にサポートされて使用されます\n (可能な場合)。スケーリングされないイメージのファイル名(image.extなど)を\n 引数として-splashオプションに必ず渡す必要があります。\n 指定された最も適切なスケーリング済イメージが選択されます\n (自動的)。\n 詳細は、SplashScreen APIのドキュメントを参照してください\n @argumentファイル\n オプションを含む1つ以上の引数ファイル\n --disable-@files\n さらなる引数ファイル拡張を無効にします\n --enable-preview\n クラスをこのリリースのプレビュー機能に依存させることができます\n長いオプションの引数を指定する場合、--=または\n-- を使用できます。\n +は、"deny"、"warn"または"allow"のいずれかです。デフォルト値は"warn"です。\n このオプションは、将来のリリースで削除される予定です。\n --enable-final-field-mutation [,...]\n 指定されたモジュールのコードで、finalインスタンス・フィールドを変更できます。\n は、クラス・パス上のコードを指定するためにALL-UNNAMEDにもできます。\n --illegal-final-field-mutation=\n finalのモジュール内のコードによるfinalフィールド変更を許可または拒否します\n フィールド変更は明示的に有効化されていません。\n は、"deny"、"warn"、"debug"または"allow"のいずれかです。デフォルト値は"warn"です。\n このオプションは、将来のリリースで削除される予定です。\n --list-modules\n 参照可能なモジュールをリストし終了します\n -d \n --describe-module \n モジュールを説明し終了します\n --dry-run VMを作成しメイン・クラスをロードしますが、メイン・メソッドは実行しません。\n --dry-runオプションは、次の検証に役立つ場合があります:\n モジュール・システム構成などのコマンド行オプション。\n --validate-modules\n すべてのモジュールを検証し終了します\n --validate-modulesオプションは、次の検索に役立つ場合があります:\n モジュール・パス上のモジュールでの競合およびその他のエラー。\n -D=\n システム・プロパティを設定します\n -verbose:[class|module|gc|jni]\n 特定のサブシステムで詳細出力を有効にする\n -version 製品バージョンをエラー・ストリームに出力して終了します\n --version 製品バージョンを出力ストリームに出力して終了します\n -showversion 製品バージョンをエラー・ストリームに出力して続行します\n --show-version\n \ + 製品バージョンを出力ストリームに出力して続行します\n --show-module-resolution\n 起動時にモジュール解決出力を表示します\n -? -h -help\n このヘルプ・メッセージをエラー・ストリームに出力します\n --help このヘルプ・メッセージを出力ストリームに出力します\n -X 追加オプションのヘルプをエラー・ストリームに出力します\n --help-extra 追加オプションのヘルプを出力ストリームに出力します\n -ea[:...|:]\n -enableassertions[:...|:]\n 指定した粒度でアサーションを有効にします\n -da[:...|:]\n -disableassertions[:...|:]\n 指定した粒度でアサーションを無効にします\n -esa | -enablesystemassertions\n システム・アサーションを有効にします\n -dsa | -disablesystemassertions\n システム・アサーションを無効にします\n -agentlib:[=]\n ネイティブ・エージェント・ライブラリをロードします。例: -agentlib:jdwp\n -agentlib:jdwp=helpも参照してください\n -agentpath:[=]\n フルパス名を使用して、ネイティブ・エージェント・ライブラリをロードします\n -javaagent:[=]\n Javaプログラミング言語エージェントをロードします。java.lang.instrumentを参照してください\n -splash:\n 指定されたイメージを含むスプラッシュ画面を表示します\n HiDPIスケールのイメージが自動的にサポートされて使用されます\n (可能な場合)。スケーリングされないイメージのファイル名(image.extなど)を\n 引数として-splashオプションに必ず渡す必要があります。\n 指定された最も適切なスケーリング済イメージが選択されます\n (自動的)。\n 詳細は、SplashScreen APIのドキュメントを参照してください\n @argumentファイル\n \ +オプションを含む1つ以上の引数ファイル\n --disable-@files\n さらなる引数ファイル拡張を無効にします\n --enable-preview\n クラスをこのリリースのプレビュー機能に依存させることができます\n長いオプションの引数を指定する場合、--=または\n-- を使用できます。\n # Translators please note do not translate the options themselves java.launcher.X.usage=\n -Xbatch バックグラウンド・コンパイルを無効にします\n -Xbootclasspath/a:\n ブートストラップ・クラス・パスの最後に追加します\n -Xcheck:jni JNI関数に対する追加のチェックを実行します\n -Xcomp 初回呼出し時にメソッドのコンパイルを強制します\n -Xdebug 何も実行されません。将来のリリースで削除されるため、非推奨になりました。\n -Xdiag 追加の診断メッセージを表示します\n -Xint インタプリタ・モードの実行のみ\n -Xinternalversion\n -versionオプションより詳細なJVMバージョン情報を\n 表示します\n -Xlog: Java Virtual Machine (JVM)統合ロギング・フレームワークでの\n ロギングを構成または有効化します。詳細は、-Xlog:helpを\n 使用してください。\n -Xloggc: タイムスタンプが付いたファイルにGCステータスのログを記録します\n このオプションは非推奨であり、将来のリリースで削除される\n 可能性があります。-Xlog:gc:で置換されています。\n -Xmixed 混合モードの実行(デフォルト)\n -Xmn 若い世代(ナーサリ)のヒープの初期サイズおよび最大サイズ\n (バイト単位)を設定します\n -Xms Javaの最小および初期のヒープ・サイズを設定します\n -Xmx Javaの最大ヒープ・サイズを設定します\n -Xnoclassgc クラスのガベージ・コレクションを無効にします\n -Xrs Java/VMによるOSシグナルの使用を削減します(ドキュメントを参照)\n -Xshare:auto 可能であれば共有クラス・データを使用します(デフォルト)\n -Xshare:off 共有クラス・データの使用を試みません\n -Xshare:on 共有クラス・データの使用を必須にし、できなければ失敗します。\n \ @@ -60,6 +61,7 @@ java.launcher.jar.error3={0}にメイン・マニフェスト属性がありま java.launcher.jar.error4={0}内のJavaエージェントのロード中にエラーが発生しました java.launcher.jar.error5=エラー: ファイル{0}を閉じるときに、予期しないエラーが発生しました java.launcher.jar.error.illegal.ena.value=エラー: Enable-Native-Accessマニフェスト属性の値"{0}"が不正です。''ALL-UNNAMED''のみ許可されます +java.launcher.jar.error.illegal.effm.value=エラー: Enable-Final-Field-Mutationマニフェスト属性の値"{0}"が不正です。''ALL-UNNAMED''のみ許可されます java.launcher.init.error=初期化エラー java.launcher.javafx.error1=エラー: JavaFX launchApplicationメソッドに誤ったシグネチャがあり、\nstaticを宣言してvoid型の値を返す必要があります java.launcher.module.error1=モジュール{0}にModuleMainClass属性がありません。-m /を使用してください diff --git a/src/java.base/share/classes/sun/launcher/resources/launcher_zh_CN.properties b/src/java.base/share/classes/sun/launcher/resources/launcher_zh_CN.properties index ec466bf3019..b3c0268f953 100644 --- a/src/java.base/share/classes/sun/launcher/resources/launcher_zh_CN.properties +++ b/src/java.base/share/classes/sun/launcher/resources/launcher_zh_CN.properties @@ -30,8 +30,9 @@ java.launcher.opt.vmselect =\ {0}\t 选择 "{1}" VM\n java.launcher.opt.hotspot =\ {0}\t 是 "{1}" VM 的同义词 [已过时]\n # Translators please note do not translate the options themselves -java.launcher.opt.footer = \ -cp <目录和 zip/jar 文件的类搜索路径>\n -classpath <目录和 zip/jar 文件的类搜索路径>\n --class-path <目录和 zip/jar 文件的类搜索路径>\n 以 "{0}" 分隔的用于搜索类文件的目录、JAR 档案\n 和 ZIP 档案列表。\n -p <模块路径>\n --module-path <模块路径>...\n 以 "{0}" 分隔的元素列表,每个元素都是\n 模块或包含模块的目录的文件路径。每个模块都是\n 模块化 JAR 或展开的模块目录。\n --upgrade-module-path <模块路径>...\n 以 "{0}" 分隔的元素列表,每个元素都是\n 模块或包含模块(用于替换运行时映像中的\n 可升级模块)的目录的文件路径。每个模块都是\n 模块化 JAR 或展开的模块目录。\n --add-modules <模块名称>[,<模块名称>...]\n 除了初始模块之外要解析的根模块。\n <模块名称> 还可以为 ALL-DEFAULT, ALL-SYSTEM,\n ALL-MODULE-PATH.\n --enable-native-access [,...]\n 允许模块中的代码访问 Java 运行时之外的代码和数据。\n 也可以是 ALL-UNNAMED,以指示类路径上的代码。\n --illegal-native-access=\n 允许或拒绝模块中没有明确为其启用本机访问的\n 代码访问 Java 运行时之外的代码和数据。\n 为 "deny"、"warn" 或 "allow" 之一。默认值为 "warn"。\n 此选项将在未来发行版中删除。\n --list-modules\n 列出可观察模块并退出\n -d \n --describe-module <模块名称>\n 描述模块并退出\n --dry-run 创建 VM 并加载主类, 但不执行 main 方法。\n 此 --dry-run 选项对于验证诸如\n 模块系统配置这样的命令行选项可能非常有用。\n --validate-modules\n 验证所有模块并退出\n --validate-modules 选项对于查找\n 模块路径中模块的冲突及其他错误可能非常有用。\n -D<名称>=<值>\n 设置系统属性\n -verbose:[class|module|gc|jni]\n 为给定子系统启用详细输出\n -version 将产品版本输出到错误流并退出\n --version \ -将产品版本输出到输出流并退出\n -showversion 将产品版本输出到错误流并继续\n --show-version\n 将产品版本输出到输出流并继续\n --show-module-resolution\n 在启动过程中显示模块解析输出\n -? -h -help\n 将此帮助消息输出到错误流\n --help 将此帮助消息输出到输出流\n -X 将额外选项的帮助输出到错误流\n --help-extra 将额外选项的帮助输出到输出流\n -ea[:<程序包名称>...|:<类名>]\n -enableassertions[:<程序包名称>...|:<类名>]\n 按指定的粒度启用断言\n -da[:<程序包名称>...|:<类名>]\n -disableassertions[:<程序包名称>...|:<类名>]\n 按指定的粒度禁用断言\n -esa | -enablesystemassertions\n 启用系统断言\n -dsa | -disablesystemassertions\n 禁用系统断言\n -agentlib:<库名>[=<选项>]\n 加载本机代理库 <库名>, 例如 -agentlib:jdwp\n 另请参阅 -agentlib:jdwp=help\n -agentpath:<路径名>[=<选项>]\n 按完整路径名加载本机代理库\n -javaagent:[=<选项>]\n 加载 Java 编程语言代理, 请参阅 java.lang.instrument\n -splash:<图像路径>\n 使用指定的图像显示启动屏幕\n 自动支持和使用 HiDPI 缩放图像\n (如果可用)。应始终将未缩放的图像文件名 (例如, image.ext)\n 作为参数传递给 -splash 选项。\n 将自动选取提供的最合适的缩放\n 图像。\n 有关详细信息, 请参阅 SplashScreen API 文档\n @argument 文件\n 一个或多个包含选项的参数文件\n --disable-@files\n 阻止进一步扩展参数文件\n --enable-preview\n 允许类依赖于此发行版的预览功能\n要为长选项指定参数, 可以使用 --<名称>=<值> 或\n--<名称> <值>。\n +java.launcher.opt.footer = \ -cp <目录和 zip/jar 文件的类搜索路径>\n -classpath <目录和 zip/jar 文件的类搜索路径>\n --class-path <目录和 zip/jar 文件的类搜索路径>\n 以 "{0}" 分隔的用于搜索类文件的目录、JAR 档案\n 和 ZIP 档案列表。\n -p <模块路径>\n --module-path <模块路径>...\n 以 "{0}" 分隔的元素列表,每个元素都是\n 模块或包含模块的目录的文件路径。每个模块都是\n 模块化 JAR 或展开的模块目录。\n --upgrade-module-path <模块路径>...\n 以 "{0}" 分隔的元素列表,每个元素都是\n 模块或包含模块(用于替换运行时映像中的\n 可升级模块)的目录的文件路径。每个模块都是\n 模块化 JAR 或展开的模块目录。\n --add-modules <模块名称>[,<模块名称>...]\n 除了初始模块之外要解析的根模块。\n <模块名称> 还可以为 ALL-DEFAULT, ALL-SYSTEM,\n ALL-MODULE-PATH.\n --enable-native-access [,...]\n 允许模块中的代码访问 Java 运行时之外的代码和数据。\n 也可以是 ALL-UNNAMED,以指示类路径上的代码。\n --illegal-native-access=\n 允许或拒绝模块中没有明确为其启用本机访问的\n 代码访问 Java 运行时之外的代码和数据。\n 为 "deny"、"warn" 或 "allow" 之一。默认值为 "warn"。\n 此选项将在未来发行版中删除。\n --enable-final-field-mutation [,...]\n 允许指定模块中的代码变更最终实例字段。\n 也可以是 ALL-UNNAMED,以指示类路径上的代码。\n --illegal-final-field-mutation=\n 允许或拒绝模块中的代码在未明确启用最终字段变更时\n 变更最终字段。\n 为 "deny"、"warn"、"debug" 或 "allow" 之一。默认值为 "warn"。\n 此选项将在未来发行版中删除。\n --list-modules\n 列出可观察模块并退出\n -d \n --describe-module <模块名称>\n 描述模块并退出\n --dry-run 创建 VM 并加载主类, 但不执行 main 方法。\n 此 --dry-run \ +选项对于验证诸如\n 模块系统配置这样的命令行选项可能非常有用。\n --validate-modules\n 验证所有模块并退出\n --validate-modules 选项对于查找\n 模块路径中模块的冲突及其他错误可能非常有用。\n -D<名称>=<值>\n 设置系统属性\n -verbose:[class|module|gc|jni]\n 为给定子系统启用详细输出\n -version 将产品版本输出到错误流并退出\n --version 将产品版本输出到输出流并退出\n -showversion 将产品版本输出到错误流并继续\n --show-version\n 将产品版本输出到输出流并继续\n --show-module-resolution\n 在启动过程中显示模块解析输出\n -? -h -help\n 将此帮助消息输出到错误流\n --help 将此帮助消息输出到输出流\n -X 将额外选项的帮助输出到错误流\n --help-extra 将额外选项的帮助输出到输出流\n -ea[:<程序包名称>...|:<类名>]\n -enableassertions[:<程序包名称>...|:<类名>]\n 按指定的粒度启用断言\n -da[:<程序包名称>...|:<类名>]\n -disableassertions[:<程序包名称>...|:<类名>]\n 按指定的粒度禁用断言\n -esa | -enablesystemassertions\n 启用系统断言\n -dsa | -disablesystemassertions\n 禁用系统断言\n -agentlib:<库名>[=<选项>]\n 加载本机代理库 <库名>, 例如 -agentlib:jdwp\n 另请参阅 -agentlib:jdwp=help\n -agentpath:<路径名>[=<选项>]\n 按完整路径名加载本机代理库\n -javaagent:[=<选项>]\n 加载 Java 编程语言代理, 请参阅 java.lang.instrument\n -splash:<图像路径>\n 使用指定的图像显示启动屏幕\n 自动支持和使用 HiDPI 缩放图像\n (如果可用)。应始终将未缩放的图像文件名 (例如, image.ext)\n 作为参数传递给 -splash 选项。\n 将自动选取提供的最合适的缩放\n 图像。\n 有关详细信息, 请参阅 SplashScreen API 文档\n @argument 文件\n 一个或多个包含选项的参数文件\n --disable-@files\n 阻止进一步扩展参数文件\n --enable-preview\n \ +允许类依赖于此发行版的预览功能\n要为长选项指定参数, 可以使用 --<名称>=<值> 或\n--<名称> <值>。\n # Translators please note do not translate the options themselves java.launcher.X.usage=\n -Xbatch 禁用后台编译\n -Xbootclasspath/a:<以 {0} 分隔的目录和 zip/jar 文件>\n 附加在引导类路径末尾\n -Xcheck:jni 对 JNI 函数执行其他检查\n -Xcomp 强制在首次调用时编译方法\n -Xdebug 不执行任何操作;已过时,将在未来发行版中删除。\n -Xdiag 显示附加诊断消息\n -Xint 仅解释模式执行\n -Xinternalversion\n 显示比 -version 选项更详细的\n JVM 版本信息\n -Xlog: 配置或启用采用 Java 虚拟\n 机 (Java Virtual Machine, JVM) 统一记录框架进行事件记录。使用 -Xlog:help\n 可了解详细信息。\n -Xloggc: 将 GC 状态记录在文件中(带时间戳)。\n 此选项已过时,可能会在\n 将来的发行版中删除。它将替换为 -Xlog:gc:。\n -Xmixed 混合模式执行(默认值)\n -Xmn 为年轻代(新生代)设置初始和最大堆大小\n (以字节为单位)\n -Xms 设置最小和初始 Java 堆大小\n -Xmx 设置最大 Java 堆大小\n -Xnoclassgc 禁用类垃圾收集\n -Xrs 减少 Java/VM 对操作系统信号的使用(请参见文档)\n -Xshare:auto 在可能的情况下使用共享类数据(默认值)\n -Xshare:off 不尝试使用共享类数据\n -Xshare:on 要求使用共享类数据,否则将失败。\n 这是一个测试选项,可能导致间歇性\n 故障。不应在生产环境中使用它。\n -XshowSettings 显示所有设置并继续\n -XshowSettings:all\n 详细显示所有设置并继续\n -XshowSettings:locale\n 显示所有与区域设置相关的设置并继续\n -XshowSettings:properties\n 显示所有属性设置并继续\n -XshowSettings:vm\n 显示所有与 vm 相关的设置并继续\n -XshowSettings:security\n 显示所有安全设置并继续\n -XshowSettings:security:all\n 显示所有安全设置并继续\n -XshowSettings:security:properties\n 显示安全属性并继续\n -XshowSettings:security:providers\n 显示静态安全提供方设置并继续\n -XshowSettings:security:tls\n 显示与 TLS \ @@ -49,7 +50,7 @@ java.launcher.cls.error2=错误: 在类 {0} 中找不到 main 方法, 请将 mai java.launcher.cls.error3=错误: 缺少 JavaFX 运行时组件, 需要使用该组件来运行此应用程序 java.launcher.cls.error4=错误: 加载主类 {0} 时出现 LinkageError\n\t{1} java.launcher.cls.error5=错误: 无法初始化主类 {0}\n原因: {1}: {2} -java.launcher.cls.error6=错误:在类 {0} 中未找到非专用零参数构造器\n请从现有构造器中删除专用,或者定义为:\n public {0}() +java.launcher.cls.error6=错误:在类 {0} 中未找到非专用零参数构造器\n请从现有构造器中删除 private,或者定义为:\n public {0}() java.launcher.cls.error7=错误:无法调用非静态内部类 {0} 构造器\n请将内部类设为静态或将内部类移出到单独的源文件 java.launcher.cls.error8=错误:无法实例化抽象类 {0}\n请使用具体类 java.launcher.jar.error1=错误: 尝试打开文件{0}时出现意外错误 @@ -58,6 +59,7 @@ java.launcher.jar.error3={0}中没有主清单属性 java.launcher.jar.error4=在 {0} 中加载 Java 代理时出错 java.launcher.jar.error5=错误:尝试关闭文件 {0} 时出现意外错误 java.launcher.jar.error.illegal.ena.value=错误:Enable-Native-Access 清单属性的值 "{0}" 非法。仅允许使用 ''ALL-UNNAMED'' +java.launcher.jar.error.illegal.effm.value=错误:Enable-Final-Field-Mutation 清单属性的值 "{0}" 非法。仅允许使用 ''ALL-UNNAMED'' java.launcher.init.error=初始化错误 java.launcher.javafx.error1=错误: JavaFX launchApplication 方法具有错误的签名, 必须\n将方法声明为静态方法并返回空类型的值 java.launcher.module.error1=模块 {0} 不具有 ModuleMainClass 属性,请使用 -m <模块>/<主类> diff --git a/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java b/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java index f567d7bd643..9c9766e2ce2 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java +++ b/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2025, 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,6 +25,7 @@ package sun.net.www.protocol.http; +import java.io.IOException; import java.net.PasswordAuthentication; import java.net.URL; import java.util.HashMap; @@ -428,9 +429,10 @@ public abstract class AuthenticationInfo extends AuthCacheValue implements Clone * @param conn The connection to apply the header(s) to * @param p A source of header values for this connection, if needed. * @param raw The raw header field (if needed) - * @return true if all goes well, false if no headers were set. + * @throws IOException if no headers were set */ - public abstract boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw); + public abstract void setHeaders(HttpURLConnection conn, HeaderParser p, String raw) + throws IOException; /** * Check if the header indicates that the current auth. parameters are stale. diff --git a/src/java.base/share/classes/sun/net/www/protocol/http/BasicAuthentication.java b/src/java.base/share/classes/sun/net/www/protocol/http/BasicAuthentication.java index f008c185b5d..aa2a9625a01 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/http/BasicAuthentication.java +++ b/src/java.base/share/classes/sun/net/www/protocol/http/BasicAuthentication.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -125,15 +125,13 @@ final class BasicAuthentication extends AuthenticationInfo { * @param conn The connection to apply the header(s) to * @param p A source of header values for this connection, if needed. * @param raw The raw header values for this connection, if needed. - * @return true if all goes well, false if no headers were set. */ @Override - public boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) { + public void setHeaders(HttpURLConnection conn, HeaderParser p, String raw) { // no need to synchronize here: // already locked by s.n.w.p.h.HttpURLConnection assert conn.isLockHeldByCurrentThread(); conn.setAuthenticationProperty(getHeaderName(), getHeaderValue(null,null)); - return true; } /** diff --git a/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java b/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java index 28d7bc5cf4e..87ea7c17085 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java +++ b/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -321,7 +321,11 @@ final class DigestAuthentication extends AuthenticationInfo { */ @Override public String getHeaderValue(URL url, String method) { - return getHeaderValueImpl(url.getFile(), method); + try { + return getHeaderValueImpl(url.getFile(), method); + } catch (IOException _) { + return null; + } } /** @@ -339,7 +343,11 @@ final class DigestAuthentication extends AuthenticationInfo { * @return the value of the HTTP header this authentication wants set */ String getHeaderValue(String requestURI, String method) { - return getHeaderValueImpl(requestURI, method); + try { + return getHeaderValueImpl(requestURI, method); + } catch (IOException _) { + return null; + } } /** @@ -369,10 +377,11 @@ final class DigestAuthentication extends AuthenticationInfo { * @param conn The connection to apply the header(s) to * @param p A source of header values for this connection, if needed. * @param raw Raw header values for this connection, if needed. - * @return true if all goes well, false if no headers were set. + * @throws IOException if no headers were set */ @Override - public boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) { + public void setHeaders(HttpURLConnection conn, HeaderParser p, String raw) + throws IOException { // no need to synchronize here: // already locked by s.n.w.p.h.HttpURLConnection assert conn.isLockHeldByCurrentThread(); @@ -380,14 +389,14 @@ final class DigestAuthentication extends AuthenticationInfo { params.setNonce (p.findValue("nonce")); params.setOpaque (p.findValue("opaque")); params.setQop (p.findValue("qop")); - params.setUserhash (Boolean.valueOf(p.findValue("userhash"))); + params.setUserhash (Boolean.parseBoolean(p.findValue("userhash"))); String charset = p.findValue("charset"); if (charset == null) { charset = "ISO_8859_1"; } else if (!charset.equalsIgnoreCase("UTF-8")) { // UTF-8 is only valid value. ISO_8859_1 represents default behavior // when the parameter is not set. - return false; + throw new IOException("Illegal charset in header"); } params.setCharset(charset.toUpperCase(Locale.ROOT)); @@ -405,7 +414,7 @@ final class DigestAuthentication extends AuthenticationInfo { } if (params.nonce == null || authMethod == null || pw == null || realm == null) { - return false; + throw new IOException("Server challenge incomplete"); } if (authMethod.length() >= 1) { // Method seems to get converted to all lower case elsewhere. @@ -415,8 +424,7 @@ final class DigestAuthentication extends AuthenticationInfo { + authMethod.substring(1).toLowerCase(Locale.ROOT); } - if (!setAlgorithmNames(p, params)) - return false; + setAlgorithmNames(p, params); // If authQop is true, then the server is doing RFC2617 and // has offered qop=auth. We do not support any other modes @@ -426,20 +434,17 @@ final class DigestAuthentication extends AuthenticationInfo { params.setNewCnonce(); } - String value = getHeaderValueImpl (uri, method); - if (value != null) { - conn.setAuthenticationProperty(getHeaderName(), value); - return true; - } else { - return false; - } + String value = getHeaderValueImpl(uri, method); + assert value != null; + conn.setAuthenticationProperty(getHeaderName(), value); } // Algorithm name is stored in two separate fields (of Paramaeters) // This allows for variations in digest algorithm name (aliases) // and also allow for the -sess variant defined in HTTP Digest protocol - // returns false if algorithm not supported - private static boolean setAlgorithmNames(HeaderParser p, Parameters params) { + // throws IOException if algorithm not supported + private static void setAlgorithmNames(HeaderParser p, Parameters params) + throws IOException { String algorithm = p.findValue("algorithm"); String digestName = algorithm; if (algorithm == null || algorithm.isEmpty()) { @@ -459,18 +464,17 @@ final class DigestAuthentication extends AuthenticationInfo { var oid = KnownOIDs.findMatch(digestName); if (oid == null) { log("unknown algorithm: " + algorithm); - return false; + throw new IOException("Unknown algorithm: " + algorithm); } digestName = oid.stdName(); params.setAlgorithm (algorithm); params.setDigestName (digestName); - return true; } /* Calculate the Authorization header field given the request URI * and based on the authorization information in params */ - private String getHeaderValueImpl (String uri, String method) { + private String getHeaderValueImpl (String uri, String method) throws IOException { String response; char[] passwd = pw.getPassword(); boolean qop = params.authQop(); @@ -479,11 +483,7 @@ final class DigestAuthentication extends AuthenticationInfo { String nonce = params.getNonce (); String algorithm = params.getAlgorithm (); String digest = params.getDigestName (); - try { - validateDigest(digest); - } catch (IOException e) { - return null; - } + validateDigest(digest); Charset charset = params.getCharset(); boolean userhash = params.getUserhash (); params.incrementNC (); @@ -505,7 +505,7 @@ final class DigestAuthentication extends AuthenticationInfo { digest, session, charset); } catch (CharacterCodingException | NoSuchAlgorithmException ex) { log(ex.getMessage()); - return null; + throw new IOException("Failed to compute digest", ex); } String ncfield = "\""; @@ -534,7 +534,7 @@ final class DigestAuthentication extends AuthenticationInfo { } } catch (CharacterCodingException | NoSuchAlgorithmException ex) { log(ex.getMessage()); - return null; + throw new IOException("Failed to compute user hash", ex); } String value = authMethod diff --git a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java index aee9670ce26..89ad0cc48ed 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java +++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java @@ -61,6 +61,7 @@ import java.util.Set; import java.util.StringJoiner; import jdk.internal.access.JavaNetHttpCookieAccess; import jdk.internal.access.SharedSecrets; +import jdk.internal.util.Exceptions; import sun.net.NetProperties; import sun.net.NetworkClient; import sun.net.util.IPAddressUtil; @@ -1469,16 +1470,29 @@ public class HttpURLConnection extends java.net.HttpURLConnection { /* in this case, only one header field will be present */ String raw = responses.findValue ("Proxy-Authenticate"); reset (); - if (!proxyAuthentication.setHeaders(this, - authhdr.headerParser(), raw)) { + try { + proxyAuthentication.setHeaders(this, + authhdr.headerParser(), raw); + } catch (IOException ex) { disconnectInternal(); - throw new IOException ("Authentication failure"); + if (Exceptions.enhancedNonSocketExceptions()) { + throw new IOException ("Authentication failure", ex); + } else { + throw new IOException ("Authentication failure"); + } } - if (serverAuthentication != null && srvHdr != null && - !serverAuthentication.setHeaders(this, - srvHdr.headerParser(), raw)) { - disconnectInternal (); - throw new IOException ("Authentication failure"); + if (serverAuthentication != null && srvHdr != null) { + try { + serverAuthentication.setHeaders(this, + srvHdr.headerParser(), raw); + } catch (IOException ex) { + disconnectInternal(); + if (Exceptions.enhancedNonSocketExceptions()) { + throw new IOException ("Authentication failure", ex); + } else { + throw new IOException ("Authentication failure"); + } + } } authObj = null; doingNTLMp2ndStage = false; @@ -1557,9 +1571,15 @@ public class HttpURLConnection extends java.net.HttpURLConnection { } else { reset (); /* header not used for ntlm */ - if (!serverAuthentication.setHeaders(this, null, raw)) { + try { + serverAuthentication.setHeaders(this, null, raw); + } catch (IOException ex) { disconnectWeb(); - throw new IOException ("Authentication failure"); + if (Exceptions.enhancedNonSocketExceptions()) { + throw new IOException ("Authentication failure", ex); + } else { + throw new IOException ("Authentication failure"); + } } doingNTLM2ndStage = false; authObj = null; @@ -1935,10 +1955,16 @@ public class HttpURLConnection extends java.net.HttpURLConnection { } else { String raw = responses.findValue ("Proxy-Authenticate"); reset (); - if (!proxyAuthentication.setHeaders(this, - authhdr.headerParser(), raw)) { + try { + proxyAuthentication.setHeaders(this, + authhdr.headerParser(), raw); + } catch (IOException ex) { disconnectInternal(); - throw new IOException ("Authentication failure"); + if (Exceptions.enhancedNonSocketExceptions()) { + throw new IOException ("Authentication failure", ex); + } else { + throw new IOException ("Authentication failure"); + } } authObj = null; doingNTLMp2ndStage = false; @@ -2201,7 +2227,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection { }; } if (ret != null) { - if (!ret.setHeaders(this, p, raw)) { + try { + ret.setHeaders(this, p, raw); + } catch (IOException e) { ret.disposeContext(); ret = null; } @@ -2358,7 +2386,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection { } } if (ret != null ) { - if (!ret.setHeaders(this, p, raw)) { + try { + ret.setHeaders(this, p, raw); + } catch (IOException e) { ret.disposeContext(); ret = null; } diff --git a/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java b/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java index c27d866f5ef..c016b0dae29 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java +++ b/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -168,29 +168,24 @@ final class NegotiateAuthentication extends AuthenticationInfo { * @param p A source of header values for this connection, not used because * HeaderParser converts the fields to lower case, use raw instead * @param raw The raw header field. - * @return true if all goes well, false if no headers were set. + * @throws IOException if no headers were set */ @Override - public boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) { + public void setHeaders(HttpURLConnection conn, HeaderParser p, String raw) throws IOException { // no need to synchronize here: // already locked by s.n.w.p.h.HttpURLConnection assert conn.isLockHeldByCurrentThread(); - try { - String response; - byte[] incoming = null; - String[] parts = raw.split("\\s+"); - if (parts.length > 1) { - incoming = Base64.getDecoder().decode(parts[1]); - } - response = hci.scheme + " " + Base64.getEncoder().encodeToString( - incoming==null?firstToken():nextToken(incoming)); - - conn.setAuthenticationProperty(getHeaderName(), response); - return true; - } catch (IOException e) { - return false; + String response; + byte[] incoming = null; + String[] parts = raw.split("\\s+"); + if (parts.length > 1) { + incoming = Base64.getDecoder().decode(parts[1]); } + response = hci.scheme + " " + Base64.getEncoder().encodeToString( + incoming==null?firstToken():nextToken(incoming)); + + conn.setAuthenticationProperty(getHeaderName(), response); } /** diff --git a/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java b/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java index 2f011f5805b..9f1d7b07021 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java +++ b/src/java.base/share/classes/sun/net/www/protocol/https/HttpsClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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,6 +44,7 @@ import java.util.Objects; import java.util.StringTokenizer; import javax.net.ssl.*; +import sun.net.util.IPAddressUtil; import sun.net.www.http.HttpClient; import sun.net.www.protocol.http.AuthCacheImpl; import sun.net.www.protocol.http.HttpURLConnection; @@ -471,7 +472,13 @@ final class HttpsClient extends HttpClient SSLParameters parameters = s.getSSLParameters(); parameters.setEndpointIdentificationAlgorithm("HTTPS"); // host has been set previously for SSLSocketImpl - if (!(s instanceof SSLSocketImpl)) { + if (!(s instanceof SSLSocketImpl) && + !IPAddressUtil.isIPv4LiteralAddress(host) && + !(host.charAt(0) == '[' && host.charAt(host.length() - 1) == ']' && + IPAddressUtil.isIPv6LiteralAddress(host.substring(1, host.length() - 1)) + )) { + // Fully qualified DNS hostname of the server, as per section 3, RFC 6066 + // Literal IPv4 and IPv6 addresses are not permitted in "HostName". parameters.setServerNames(List.of(new SNIHostName(host))); } s.setSSLParameters(parameters); diff --git a/src/java.base/share/classes/sun/nio/ch/ChannelInputStream.java b/src/java.base/share/classes/sun/nio/ch/ChannelInputStream.java index 14b2058d28d..09f6d7b1d75 100644 --- a/src/java.base/share/classes/sun/nio/ch/ChannelInputStream.java +++ b/src/java.base/share/classes/sun/nio/ch/ChannelInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -109,6 +109,7 @@ class ChannelInputStream extends InputStream { if (len == 0) return 0; + len = Math.min(len, Streams.MAX_BUFFER_SIZE); ByteBuffer bb = ((this.bs == bs) ? this.bb : ByteBuffer.wrap(bs)); diff --git a/src/java.base/share/classes/sun/nio/ch/ChannelOutputStream.java b/src/java.base/share/classes/sun/nio/ch/ChannelOutputStream.java index dff8af9ebaf..b7207c9fd4b 100644 --- a/src/java.base/share/classes/sun/nio/ch/ChannelOutputStream.java +++ b/src/java.base/share/classes/sun/nio/ch/ChannelOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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,15 @@ class ChannelOutputStream extends OutputStream { * If the channel is selectable then it must be configured blocking. */ private void writeFully(ByteBuffer bb) throws IOException { - while (bb.remaining() > 0) { + int pos = bb.position(); + int rem = bb.limit() - pos; + while (rem > 0) { + bb.limit(pos + Math.min(Streams.MAX_BUFFER_SIZE, rem)); int n = ch.write(bb); if (n <= 0) - throw new RuntimeException("no bytes written"); + throw new IOException("Write failed"); + pos += n; + rem -= n; } } diff --git a/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java b/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java index 57935ff5b00..01f894be227 100644 --- a/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/NioSocketImpl.java @@ -78,10 +78,6 @@ import static jdk.internal.util.Exceptions.formatMsg; public final class NioSocketImpl extends SocketImpl implements PlatformSocketImpl { private static final NativeDispatcher nd = new SocketDispatcher(); - // The maximum number of bytes to read/write per syscall to avoid needing - // a huge buffer from the temporary buffer cache - private static final int MAX_BUFFER_SIZE = 128 * 1024; - // true if this is a SocketImpl for a ServerSocket private final boolean server; @@ -355,8 +351,8 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp // emulate legacy behavior to return -1, even if socket is closed if (readEOF) return -1; - // read up to MAX_BUFFER_SIZE bytes - int size = Math.min(len, MAX_BUFFER_SIZE); + // read up to Streams.MAX_BUFFER_SIZE bytes + int size = Math.min(len, Streams.MAX_BUFFER_SIZE); int n = implRead(b, off, size, remainingNanos); if (n == -1) readEOF = true; @@ -453,8 +449,8 @@ public final class NioSocketImpl extends SocketImpl implements PlatformSocketImp int pos = off; int end = off + len; while (pos < end) { - // write up to MAX_BUFFER_SIZE bytes - int size = Math.min((end - pos), MAX_BUFFER_SIZE); + // write up to Streams.MAX_BUFFER_SIZE bytes + int size = Math.min((end - pos), Streams.MAX_BUFFER_SIZE); int n = implWrite(b, pos, size); pos += n; } diff --git a/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java b/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java index 6f3e8b443dc..868ed3b64bc 100644 --- a/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java +++ b/src/java.base/share/classes/sun/nio/ch/SocketChannelImpl.java @@ -1373,6 +1373,7 @@ class SocketChannelImpl // nothing to do return 0; } + len = Math.min(len, Streams.MAX_BUFFER_SIZE); readLock.lock(); try { @@ -1469,7 +1470,7 @@ class SocketChannelImpl beginWrite(true); configureSocketNonBlockingIfVirtualThread(); while (pos < end && isOpen()) { - int size = end - pos; + int size = Math.min(end - pos, Streams.MAX_BUFFER_SIZE); int n = tryWrite(b, pos, size); while (IOStatus.okayToRetry(n) && isOpen()) { park(Net.POLLOUT); diff --git a/src/java.base/share/classes/sun/nio/ch/Streams.java b/src/java.base/share/classes/sun/nio/ch/Streams.java index 4326c9e2e0b..847fa8333e8 100644 --- a/src/java.base/share/classes/sun/nio/ch/Streams.java +++ b/src/java.base/share/classes/sun/nio/ch/Streams.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -33,6 +33,10 @@ import java.nio.channels.WritableByteChannel; * Factory methods for input/output streams based on channels. */ public class Streams { + // The maximum number of bytes to read/write per syscall to avoid needing + // a huge buffer from the temporary buffer cache + static final int MAX_BUFFER_SIZE = 128 * 1024; + private Streams() { } /** diff --git a/src/java.base/share/classes/sun/security/provider/ML_DSA.java b/src/java.base/share/classes/sun/security/provider/ML_DSA.java index af64ef399a8..6a578427e51 100644 --- a/src/java.base/share/classes/sun/security/provider/ML_DSA.java +++ b/src/java.base/share/classes/sun/security/provider/ML_DSA.java @@ -1555,7 +1555,7 @@ public class ML_DSA { return res; } - // precondition: -2^31 * MONT_Q <= a, b < 2^31, -2^31 < a * b < 2^31 * MONT_Q + // precondition: -2^31 <= a, b < 2^31, -2^31 * MONT_Q <= a * b < 2^31 * MONT_Q // computes a * b * 2^-32 mod MONT_Q // the result is greater than -MONT_Q and less than MONT_Q // See e.g. Algorithm 3 in https://eprint.iacr.org/2018/039.pdf diff --git a/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java b/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java index 1bbe0bfb9c7..40ee01d284a 100644 --- a/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java +++ b/src/java.base/share/classes/sun/security/ssl/X509TrustManagerImpl.java @@ -30,9 +30,7 @@ import java.security.*; import java.security.cert.*; import java.util.*; import java.util.concurrent.locks.ReentrantLock; - import javax.net.ssl.*; - import sun.security.ssl.SSLAlgorithmConstraints.SIGNATURE_CONSTRAINTS_MODE; import sun.security.util.AnchorCertificates; import sun.security.util.HostnameChecker; @@ -40,19 +38,14 @@ import sun.security.validator.*; /** * This class implements the SunJSSE X.509 trust manager using the internal - * validator API in J2SE core. The logic in this class is minimal.

+ * validator API in J2SE core. The logic in this class is minimal. *

* This class supports both the Simple validation algorithm from previous - * JSSE versions and PKIX validation. Currently, it is not possible for the - * application to specify PKIX parameters other than trust anchors. This will - * be fixed in a future release using new APIs. When that happens, it may also - * make sense to separate the Simple and PKIX trust managers into separate - * classes. + * JSSE versions and PKIX validation. * * @author Andreas Sterbenz */ -final class X509TrustManagerImpl extends X509ExtendedTrustManager - implements X509TrustManager { +final class X509TrustManagerImpl extends X509ExtendedTrustManager { private final String validatorType; @@ -208,120 +201,90 @@ final class X509TrustManagerImpl extends X509ExtendedTrustManager private void checkTrusted(X509Certificate[] chain, String authType, Socket socket, boolean checkClientTrusted) throws CertificateException { - Validator v = checkTrustedInit(chain, authType, checkClientTrusted); - X509Certificate[] trustedChain; + SSLSession session = null; + AlgorithmConstraints constraints = null; + String identityAlg = null; + if (socket instanceof SSLSocket sslSocket && sslSocket.isConnected()) { - - SSLSession session = sslSocket.getHandshakeSession(); - if (session == null) { - throw new CertificateException("No handshake session"); - } - - AlgorithmConstraints constraints = SSLAlgorithmConstraints.forSocket( + session = sslSocket.getHandshakeSession(); + constraints = SSLAlgorithmConstraints.forSocket( sslSocket, SIGNATURE_CONSTRAINTS_MODE.LOCAL, false); - - // Grab any stapled OCSP responses for use in validation - List responseList = Collections.emptyList(); - if (!checkClientTrusted && session instanceof ExtendedSSLSession) { - responseList = - ((ExtendedSSLSession)session).getStatusResponses(); - } - trustedChain = v.validate(chain, null, responseList, - constraints, checkClientTrusted ? null : authType); - - // check endpoint identity - String identityAlg = sslSocket.getSSLParameters(). + identityAlg = sslSocket.getSSLParameters(). getEndpointIdentificationAlgorithm(); - if (identityAlg != null && !identityAlg.isEmpty()) { - checkIdentity(session, - trustedChain, identityAlg, checkClientTrusted); - } - } else { - trustedChain = v.validate(chain, null, Collections.emptyList(), - null, checkClientTrusted ? null : authType); } - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,trustmanager")) { - SSLLogger.fine("Found trusted certificate", - trustedChain[trustedChain.length - 1]); + findTrustedCertificate(chain, authType, + session, constraints, identityAlg, checkClientTrusted); + } + + private void checkTrusted(X509Certificate[] chain, + String authType, SSLEngine engine, + boolean checkClientTrusted) throws CertificateException { + + SSLSession session = null; + AlgorithmConstraints constraints = null; + String identityAlg = null; + + if (engine != null) { + session = engine.getHandshakeSession(); + constraints = SSLAlgorithmConstraints.forEngine( + engine, SIGNATURE_CONSTRAINTS_MODE.LOCAL, false); + identityAlg = engine.getSSLParameters(). + getEndpointIdentificationAlgorithm(); } + + findTrustedCertificate(chain, authType, + session, constraints, identityAlg, checkClientTrusted); } private void checkTrusted(X509Certificate[] chain, String authType, QuicTLSEngineImpl quicTLSEngine, boolean checkClientTrusted) throws CertificateException { - Validator v = checkTrustedInit(chain, authType, checkClientTrusted); + + SSLSession session = null; + AlgorithmConstraints constraints = null; + String identityAlg = null; + + if (quicTLSEngine != null) { + session = quicTLSEngine.getHandshakeSession(); + constraints = SSLAlgorithmConstraints.forQUIC( + quicTLSEngine, SIGNATURE_CONSTRAINTS_MODE.LOCAL, false); + identityAlg = quicTLSEngine.getSSLParameters(). + getEndpointIdentificationAlgorithm(); + } + + findTrustedCertificate(chain, authType, + session, constraints, identityAlg, checkClientTrusted); + } + + private void findTrustedCertificate(X509Certificate[] chain, + String authType, SSLSession session, + AlgorithmConstraints constraints, String identityAlg, + boolean checkClientTrusted) throws CertificateException { final X509Certificate[] trustedChain; - if (quicTLSEngine != null) { + Validator v = checkTrustedInit(chain, authType, checkClientTrusted); - final SSLSession session = quicTLSEngine.getHandshakeSession(); + if (constraints != null) { if (session == null) { throw new CertificateException("No handshake session"); } - // create the algorithm constraints - final AlgorithmConstraints constraints = SSLAlgorithmConstraints.forQUIC( - quicTLSEngine, SIGNATURE_CONSTRAINTS_MODE.LOCAL, false); + // Grab any stapled OCSP responses for use in validation final List responseList; - // grab any stapled OCSP responses for use in validation if (!checkClientTrusted && session instanceof ExtendedSSLSession extSession) { responseList = extSession.getStatusResponses(); } else { responseList = Collections.emptyList(); } - // do the certificate chain validation + + // Certificate chain validation trustedChain = v.validate(chain, null, responseList, constraints, checkClientTrusted ? null : authType); - // check endpoint identity - String identityAlg = quicTLSEngine.getSSLParameters(). - getEndpointIdentificationAlgorithm(); - if (identityAlg != null && !identityAlg.isEmpty()) { - checkIdentity(session, trustedChain, - identityAlg, checkClientTrusted); - } - } else { - trustedChain = v.validate(chain, null, Collections.emptyList(), - null, checkClientTrusted ? null : authType); - } - - if (SSLLogger.isOn() && SSLLogger.isOn("ssl,trustmanager")) { - SSLLogger.fine("Found trusted certificate", - trustedChain[trustedChain.length - 1]); - } - } - - private void checkTrusted(X509Certificate[] chain, - String authType, SSLEngine engine, - boolean checkClientTrusted) throws CertificateException { - Validator v = checkTrustedInit(chain, authType, checkClientTrusted); - - X509Certificate[] trustedChain; - if (engine != null) { - - SSLSession session = engine.getHandshakeSession(); - if (session == null) { - throw new CertificateException("No handshake session"); - } - - AlgorithmConstraints constraints = SSLAlgorithmConstraints.forEngine( - engine, SIGNATURE_CONSTRAINTS_MODE.LOCAL, false); - - // Grab any stapled OCSP responses for use in validation - List responseList = Collections.emptyList(); - if (!checkClientTrusted && session instanceof ExtendedSSLSession) { - responseList = - ((ExtendedSSLSession)session).getStatusResponses(); - } - trustedChain = v.validate(chain, null, responseList, - constraints, checkClientTrusted ? null : authType); - - // check endpoint identity - String identityAlg = engine.getSSLParameters(). - getEndpointIdentificationAlgorithm(); + // Check endpoint identity if (identityAlg != null && !identityAlg.isEmpty()) { checkIdentity(session, trustedChain, identityAlg, checkClientTrusted); diff --git a/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_de.properties b/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_de.properties index 1c7a9cd17cf..a452dd34e9d 100644 --- a/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_de.properties +++ b/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_de.properties @@ -313,7 +313,7 @@ Unable.to.parse.denyAfter.string.in.exception.message=denyAfter-Datumszeichenfol whose.sigalg.weak=%1$s verwendet den Signaturalgorithmus %2$s. Dies gilt als Sicherheitsrisiko. whose.key.disabled=%1$s verwendet %2$s. Dies gilt als Sicherheitsrisiko und ist deaktiviert. whose.key.weak=%1$s verwendet %2$s. Das gilt als Sicherheitsrisiko. Dieser Schlüssel wird in einem zukünftigen Update deaktiviert. -jks.storetype.warning=Der %1$s-Keystore verwendet ein proprietäres Format. Es wird empfohlen, auf PKCS12 zu migrieren, das ein Industriestandardformat mit "keytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12" ist. +jks.storetype.warning=%1$s verwendet veraltete kryptografische Algorithmen und wird in einer zukünftigen Version entfernt. Migrieren Sie zu PKCS12 mit:\nkeytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12 migrate.keystore.warning="%1$s" zu %4$s migriert. Der %2$s-Keystore wurde als "%3$s" gesichert. backup.keystore.warning=Der ursprüngliche Keystore "%1$s" wird als "%3$s" gesichert... importing.keystore.status=Keystore %1$s wird in %2$s importiert... diff --git a/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_ja.properties b/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_ja.properties index 63ba4f220dd..a3d7771eb38 100644 --- a/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_ja.properties +++ b/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_ja.properties @@ -313,7 +313,7 @@ Unable.to.parse.denyAfter.string.in.exception.message=例外メッセージのde whose.sigalg.weak=%1$sは%2$s署名アルゴリズムを使用しており、これはセキュリティ・リスクとみなされます。 whose.key.disabled=%1$sは%2$sを使用しており、これはセキュリティ・リスクとみなされ、無効化されています。 whose.key.weak=%1$sは%2$sを使用しており、これはセキュリティ・リスクとみなされます。これは将来の更新で無効化されます。 -jks.storetype.warning=%1$sキーストアは独自の形式を使用しています。"keytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12"を使用する業界標準の形式であるPKCS12に移行することをお薦めします。 +jks.storetype.warning=%1$sは古い暗号化アルゴリズムを使用しているため、将来のリリースで削除されます。次を使用してPKCS12に移行します:\nkeytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12 migrate.keystore.warning="%1$s"が%4$sに移行されました。%2$sキーストアは"%3$s"としてバックアップされます。 backup.keystore.warning=元のキーストア"%1$s"は"%3$s"としてバックアップされます... importing.keystore.status=キーストア%1$sを%2$sにインポートしています... diff --git a/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_zh_CN.properties b/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_zh_CN.properties index 1f96aa12c57..435e74e468f 100644 --- a/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_zh_CN.properties +++ b/src/java.base/share/classes/sun/security/tools/keytool/resources/keytool_zh_CN.properties @@ -313,7 +313,7 @@ Unable.to.parse.denyAfter.string.in.exception.message=无法解析异常错误 whose.sigalg.weak=%1$s 使用的 %2$s 签名算法存在安全风险。 whose.key.disabled=%1$s 使用的 %2$s 被视为存在安全风险而且被禁用。 whose.key.weak=%1$s 使用的 %2$s 被视为存在安全风险。它将在未来的更新中被禁用。 -jks.storetype.warning=%1$s 密钥库使用专用格式。建议使用 "keytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12" 迁移到行业标准格式 PKCS12。 +jks.storetype.warning=%1$s 使用的加密算法已过时,将在未来发行版中删除。请使用以下命令迁移到 PKCS12:\nkeytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12 migrate.keystore.warning=已将 "%1$s" 迁移到 %4$s。将 %2$s 密钥库作为 "%3$s" 进行了备份。 backup.keystore.warning=已将原始密钥库 "%1$s" 备份为 "%3$s"... importing.keystore.status=正在将密钥库 %1$s 导入到 %2$s... diff --git a/src/java.base/share/classes/sun/security/util/resources/security_de.properties b/src/java.base/share/classes/sun/security/util/resources/security_de.properties index a431268831b..63c7fdca472 100644 --- a/src/java.base/share/classes/sun/security/util/resources/security_de.properties +++ b/src/java.base/share/classes/sun/security/util/resources/security_de.properties @@ -43,7 +43,7 @@ provided.null.OID.map=Null-OID-Zuordnung angegeben NEWLINE=\n invalid.null.action.provided=Ungültige Nullaktion angegeben invalid.null.Class.provided=Ungültige Nullklasse angegeben -Subject.=Subjekt:\n +Subject.=Subject:\n .Principal.=\tPrincipal:\u0020 .Public.Credential.=\tÖffentliche Zugangsdaten:\u0020 .Private.Credential.=\tPrivate Zugangsdaten:\u0020 @@ -74,3 +74,6 @@ line.number.expected.expect.found.actual.=Zeile {0}: [{1}] erwartet, [{2}] gefun # sun.security.pkcs11.SunPKCS11 PKCS11.Token.providerName.Password.=Kennwort für PKCS11-Token [{0}]:\u0020 + +# sun.security.util.Password +warning.input.may.be.visible.on.screen=[Warnung: Eingabe ist möglicherweise auf dem Bildschirm sichtbar]\u0020 diff --git a/src/java.base/share/classes/sun/security/util/resources/security_ja.properties b/src/java.base/share/classes/sun/security/util/resources/security_ja.properties index ff13b37cf3b..00d22e054a5 100644 --- a/src/java.base/share/classes/sun/security/util/resources/security_ja.properties +++ b/src/java.base/share/classes/sun/security/util/resources/security_ja.properties @@ -74,3 +74,6 @@ line.number.expected.expect.found.actual.=行{0}: [{1}]ではなく[{2}]が検 # sun.security.pkcs11.SunPKCS11 PKCS11.Token.providerName.Password.=PKCS11トークン[{0}]パスワード:\u0020 + +# sun.security.util.Password +warning.input.may.be.visible.on.screen=[警告: 入力が画面に表示される場合があります]\u0020 diff --git a/src/java.base/share/classes/sun/security/util/resources/security_zh_CN.properties b/src/java.base/share/classes/sun/security/util/resources/security_zh_CN.properties index 6a4ec11de77..a322cb7b1e8 100644 --- a/src/java.base/share/classes/sun/security/util/resources/security_zh_CN.properties +++ b/src/java.base/share/classes/sun/security/util/resources/security_zh_CN.properties @@ -74,3 +74,6 @@ line.number.expected.expect.found.actual.=行号 {0}: 应为 [{1}], 找到 [{2}] # sun.security.pkcs11.SunPKCS11 PKCS11.Token.providerName.Password.=PKCS11 标记 [{0}] 密码:\u0020 + +# sun.security.util.Password +warning.input.may.be.visible.on.screen=[警告:输入可能显示在屏幕上]\u0020 diff --git a/src/java.base/share/classes/sun/util/locale/BaseLocale.java b/src/java.base/share/classes/sun/util/locale/BaseLocale.java index 91efc61d1bf..31078720ddc 100644 --- a/src/java.base/share/classes/sun/util/locale/BaseLocale.java +++ b/src/java.base/share/classes/sun/util/locale/BaseLocale.java @@ -34,12 +34,14 @@ package sun.util.locale; import jdk.internal.misc.CDS; import jdk.internal.util.ReferencedKeySet; -import jdk.internal.util.StaticProperty; +import jdk.internal.vm.annotation.AOTRuntimeSetup; +import jdk.internal.vm.annotation.AOTSafeClassInitializer; import jdk.internal.vm.annotation.Stable; import java.util.StringJoiner; import java.util.function.Supplier; +@AOTSafeClassInitializer public final class BaseLocale { public static @Stable BaseLocale[] constantBaseLocales; @@ -64,6 +66,7 @@ public final class BaseLocale { CANADA_FRENCH = 18, NUM_CONSTANTS = 19; static { + // Legacy CDS archive support (to be deprecated) CDS.initializeFromArchive(BaseLocale.class); BaseLocale[] baseLocales = constantBaseLocales; if (baseLocales == null) { @@ -92,13 +95,21 @@ public final class BaseLocale { } // Interned BaseLocale cache - private static final LazyConstant> CACHE = + @Stable private static LazyConstant> CACHE; + static { + runtimeSetup(); + } + + @AOTRuntimeSetup + private static void runtimeSetup() { + CACHE = LazyConstant.of(new Supplier<>() { @Override public ReferencedKeySet get() { return ReferencedKeySet.create(true, ReferencedKeySet.concurrentHashMapSupplier()); } }); + } public static final String SEP = "_"; @@ -110,16 +121,14 @@ public final class BaseLocale { private @Stable int hash; /** - * Boolean for the old ISO language code compatibility. - * The system property "java.locale.useOldISOCodes" is not security sensitive, - * so no need to ensure privileged access here. + * Emit the warning message if the system property "java.locale.useOldISOCodes" is + * specified. */ - private static final boolean OLD_ISO_CODES = StaticProperty.javaLocaleUseOldISOCodes() - .equalsIgnoreCase("true"); static { - if (OLD_ISO_CODES) { - System.err.println("WARNING: The use of the system property \"java.locale.useOldISOCodes\"" + - " is deprecated. It will be removed in a future release of the JDK."); + if (System.getProperty("java.locale.useOldISOCodes") != null) { + System.err.println("WARNING: The system property" + + " \"java.locale.useOldISOCodes\" is no longer supported." + + " Any specified value will be ignored."); } } @@ -166,7 +175,8 @@ public final class BaseLocale { } } - // JDK uses deprecated ISO639.1 language codes for he, yi and id + // Normalize deprecated ISO 639-1 language codes for Hebrew, Yiddish, + // and Indonesian to their current standard forms. if (!language.isEmpty()) { language = convertOldISOCodes(language); } @@ -183,9 +193,9 @@ public final class BaseLocale { public static String convertOldISOCodes(String language) { return switch (language) { - case "he", "iw" -> OLD_ISO_CODES ? "iw" : "he"; - case "id", "in" -> OLD_ISO_CODES ? "in" : "id"; - case "yi", "ji" -> OLD_ISO_CODES ? "ji" : "yi"; + case "iw" -> "he"; + case "in" -> "id"; + case "ji" -> "yi"; default -> language; }; } diff --git a/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java b/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java index c539f57141e..ac43b22a3bd 100644 --- a/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java +++ b/src/java.base/share/classes/sun/util/locale/provider/LocaleResources.java @@ -62,7 +62,6 @@ import java.util.concurrent.ConcurrentMap; import java.util.regex.Pattern; import java.util.stream.Stream; -import jdk.internal.util.StaticProperty; import sun.util.resources.LocaleData; import sun.util.resources.OpenListResourceBundle; import sun.util.resources.TimeZoneNamesBundle; @@ -288,16 +287,6 @@ public class LocaleResources { } public String getLocaleName(String key) { - // Get names for old ISO codes with new ISO code resources - if (StaticProperty.javaLocaleUseOldISOCodes().equalsIgnoreCase("true")) { - key = switch (key) { - case "iw" -> "he"; - case "in" -> "id"; - case "ji" -> "yi"; - default -> key; - }; - } - Object localeName = null; String cacheKey = LOCALE_NAMES + key; diff --git a/src/java.base/share/man/java.md b/src/java.base/share/man/java.md index 8517e161e3f..30661a3f387 100644 --- a/src/java.base/share/man/java.md +++ b/src/java.base/share/man/java.md @@ -3002,6 +3002,8 @@ No documented java options have been removed in JDK @@VERSION_SPECIFICATION@@. For the lists and descriptions of options removed in previous releases see the *Removed Java Options* section in: +- [The `java` Command, Release 26](https://docs.oracle.com/en/java/javase/26/docs/specs/man/java.html) + - [The `java` Command, Release 25](https://docs.oracle.com/en/java/javase/25/docs/specs/man/java.html) - [The `java` Command, Release 24](https://docs.oracle.com/en/java/javase/24/docs/specs/man/java.html) diff --git a/src/java.base/share/native/libjimage/imageDecompressor.cpp b/src/java.base/share/native/libjimage/imageDecompressor.cpp index 65bda0957b8..748bbf8203f 100644 --- a/src/java.base/share/native/libjimage/imageDecompressor.cpp +++ b/src/java.base/share/native/libjimage/imageDecompressor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -111,11 +111,11 @@ ImageDecompressor* ImageDecompressor::get_decompressor(const char * decompressor u8 ImageDecompressor::getU8(u1* ptr, Endian *endian) { u8 ret; if (endian->is_big_endian()) { - ret = (u8)ptr[0] << 56 | (u8)ptr[1] << 48 | (u8)ptr[2]<<40 | (u8)ptr[3]<<32 | - ptr[4]<<24 | ptr[5]<<16 | ptr[6]<<8 | ptr[7]; + ret = (u8)ptr[0] << 56 | (u8)ptr[1] << 48 | (u8)ptr[2] << 40 | (u8)ptr[3] << 32 | + (u8)ptr[4] << 24 | (u8)ptr[5] << 16 | (u8)ptr[6] << 8 | (u8)ptr[7]; } else { - ret = ptr[0] | ptr[1]<<8 | ptr[2]<<16 | ptr[3]<<24 | (u8)ptr[4]<<32 | - (u8)ptr[5]<<40 | (u8)ptr[6]<<48 | (u8)ptr[7]<<56; + ret = (u8)ptr[0] | (u8)ptr[1] << 8 | (u8)ptr[2] << 16 | (u8)ptr[3] << 24 | + (u8)ptr[4] << 32 | (u8)ptr[5] << 40 | (u8)ptr[6] << 48 | (u8)ptr[7] << 56; } return ret; } @@ -123,9 +123,9 @@ u8 ImageDecompressor::getU8(u1* ptr, Endian *endian) { u4 ImageDecompressor::getU4(u1* ptr, Endian *endian) { u4 ret; if (endian->is_big_endian()) { - ret = ptr[0] << 24 | ptr[1]<<16 | (ptr[2]<<8) | ptr[3]; + ret = (u4)ptr[0] << 24 | (u4)ptr[1] << 16 | (u4)ptr[2] << 8 | (u4)ptr[3]; } else { - ret = ptr[0] | ptr[1]<<8 | (ptr[2]<<16) | ptr[3]<<24; + ret = (u4)ptr[0] | (u4)ptr[1] << 8 | (u4)ptr[2] << 16 | (u4)ptr[3] << 24; } return ret; } diff --git a/src/java.base/share/native/libnet/net_util.c b/src/java.base/share/native/libnet/net_util.c index 5b356d04b3c..2a89d0711bc 100644 --- a/src/java.base/share/native/libnet/net_util.c +++ b/src/java.base/share/native/libnet/net_util.c @@ -81,12 +81,11 @@ DEF_JNI_OnLoad(JavaVM *vm, void *reserved) * supporting socket APIs are available */ IPv4_available = IPv4_supported(); - IPv6_available = IPv6_supported() & (!preferIPv4Stack); + IPv6_available = IPv6_supported() && !preferIPv4Stack; /* check if SO_REUSEPORT is supported on this platform */ REUSEPORT_available = reuseport_supported(IPv6_available); - return JNI_VERSION_1_2; } diff --git a/src/java.base/unix/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java b/src/java.base/unix/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java index dc56abb86df..efe72fc760f 100644 --- a/src/java.base/unix/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java +++ b/src/java.base/unix/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,7 +35,6 @@ import java.net.URL; import java.security.GeneralSecurityException; import java.util.Base64; import java.util.Locale; -import java.util.Properties; import sun.net.www.HeaderParser; import sun.net.www.protocol.http.AuthenticationInfo; @@ -203,10 +202,10 @@ public final class NTLMAuthentication extends AuthenticationInfo { * @param p A source of header values for this connection, not used because * HeaderParser converts the fields to lower case, use raw instead * @param raw The raw header field. - * @return true if all goes well, false if no headers were set. + * @throws IOException if no headers were set */ @Override - public boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) { + public void setHeaders(HttpURLConnection conn, HeaderParser p, String raw) throws IOException { // no need to synchronize here: // already locked by s.n.w.p.h.HttpURLConnection assert conn.isLockHeldByCurrentThread(); @@ -220,9 +219,8 @@ public final class NTLMAuthentication extends AuthenticationInfo { response = buildType3Msg (msg); } conn.setAuthenticationProperty(getHeaderName(), response); - return true; - } catch (IOException | GeneralSecurityException e) { - return false; + } catch (GeneralSecurityException e) { + throw new IOException(e); } } @@ -232,8 +230,7 @@ public final class NTLMAuthentication extends AuthenticationInfo { return result; } - private String buildType3Msg (String challenge) throws GeneralSecurityException, - IOException { + private String buildType3Msg (String challenge) throws GeneralSecurityException { /* First decode the type2 message to get the server nonce */ /* nonce is located at type2[24] for 8 bytes */ diff --git a/src/java.base/unix/native/libjli/java_md_common.c b/src/java.base/unix/native/libjli/java_md_common.c index f67a50304d0..45509c7d25d 100644 --- a/src/java.base/unix/native/libjli/java_md_common.c +++ b/src/java.base/unix/native/libjli/java_md_common.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, 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 @@ -259,29 +259,6 @@ JLI_ReportExceptionDescription(JNIEnv * env) { (*env)->ExceptionDescribe(env); } -/* - * Since using the file system as a registry is a bit risky, perform - * additional sanity checks on the identified directory to validate - * it as a valid JDK. - * - * Return 0 if the tests fail; otherwise return non-zero (true). - * - * Note that checking for anything more than the existence of an - * executable object at bin/java relative to the path being checked - * will break the regression tests. - */ -static int -CheckSanity(char *path, char *dir) -{ - char buffer[PATH_MAX]; - - if (JLI_StrLen(path) + JLI_StrLen(dir) + 11 > PATH_MAX) - return (0); /* Silently reject "impossibly" long paths */ - - JLI_Snprintf(buffer, sizeof(buffer), "%s/%s/bin/java", path, dir); - return ((access(buffer, X_OK) == 0) ? 1 : 0); -} - /* * "Borrowed" from Solaris 10 where the unsetenv() function is being added * to libc thanks to SUSv3 (Standard Unix Specification, version 3). As diff --git a/src/java.base/unix/native/libnet/Inet4AddressImpl.c b/src/java.base/unix/native/libnet/Inet4AddressImpl.c index fff524e03ae..f537226c330 100644 --- a/src/java.base/unix/native/libnet/Inet4AddressImpl.c +++ b/src/java.base/unix/native/libnet/Inet4AddressImpl.c @@ -108,7 +108,8 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, hints.ai_flags = AI_CANONNAME; hints.ai_family = AF_INET; - error = getaddrinfo(hostname, NULL, &hints, &res); + NET_RESTARTABLE(error, getaddrinfo(hostname, NULL, &hints, &res), + error == EAI_SYSTEM && errno == EINTR); if (error) { #if defined(MACOSX) @@ -229,17 +230,21 @@ Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this, sa.sin_addr.s_addr = htonl(addr); sa.sin_family = AF_INET; - if (getnameinfo((struct sockaddr *)&sa, sizeof(struct sockaddr_in), - host, sizeof(host), NULL, 0, NI_NAMEREQD)) { - JNU_ThrowByName(env, "java/net/UnknownHostException", NULL); - } else { + int r; + + NET_RESTARTABLE(r, getnameinfo((struct sockaddr *)&sa, sizeof(struct sockaddr_in), + host, sizeof(host), NULL, 0, NI_NAMEREQD), + r == EAI_SYSTEM && errno == EINTR); + + if (r == 0) { ret = (*env)->NewStringUTF(env, host); - if (ret == NULL) { - JNU_ThrowByName(env, "java/net/UnknownHostException", NULL); + if (ret != NULL) { + return ret; } } - return ret; + JNU_ThrowByName(env, "java/net/UnknownHostException", NULL); + return NULL; } /** @@ -283,7 +288,8 @@ tcp_ping4(JNIEnv *env, SOCKETADDRESS *sa, SOCKETADDRESS *netif, jint timeout, SET_NONBLOCKING(fd); sa->sa4.sin_port = htons(7); // echo port - connect_rv = connect(fd, &sa->sa, sizeof(struct sockaddr_in)); + NET_RESTARTABLE(connect_rv, connect(fd, &sa->sa, sizeof(struct sockaddr_in)), + connect_rv == -1 && errno == EINTR); // connection established or refused immediately, either way it means // we were able to reach the host! @@ -397,8 +403,11 @@ ping4(JNIEnv *env, jint fd, SOCKETADDRESS *sa, SOCKETADDRESS *netif, icmp->icmp_cksum = 0; // manually calculate checksum icmp->icmp_cksum = in_cksum((u_short *)icmp, plen); + // send it - n = sendto(fd, sendbuf, plen, 0, &sa->sa, sizeof(struct sockaddr_in)); + NET_RESTARTABLE(n, sendto(fd, sendbuf, plen, 0, &sa->sa, sizeof(struct sockaddr_in)), + n == -1 && errno == EINTR) + if (n < 0 && errno != EINPROGRESS) { #if defined(__linux__) /* @@ -422,8 +431,9 @@ ping4(JNIEnv *env, jint fd, SOCKETADDRESS *sa, SOCKETADDRESS *netif, tmout2 = NET_Wait(env, fd, NET_WAIT_READ, tmout2); if (tmout2 >= 0) { len = sizeof(sa_recv); - n = recvfrom(fd, recvbuf, sizeof(recvbuf), 0, - (struct sockaddr *)&sa_recv, &len); + NET_RESTARTABLE(n, recvfrom(fd, recvbuf, sizeof(recvbuf), 0, + (struct sockaddr *)&sa_recv, &len), + n == -1 && errno == EINTR); // check if we received enough data if (n < (jint)sizeof(struct ip)) { continue; diff --git a/src/java.base/unix/native/libnet/Inet6AddressImpl.c b/src/java.base/unix/native/libnet/Inet6AddressImpl.c index 83354356936..8dce4f9cc6b 100644 --- a/src/java.base/unix/native/libnet/Inet6AddressImpl.c +++ b/src/java.base/unix/native/libnet/Inet6AddressImpl.c @@ -227,7 +227,8 @@ Java_java_net_Inet6AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this, hints.ai_flags = AI_CANONNAME; hints.ai_family = lookupCharacteristicsToAddressFamily(characteristics); - error = getaddrinfo(hostname, NULL, &hints, &res); + NET_RESTARTABLE(error, getaddrinfo(hostname, NULL, &hints, &res), + error == EAI_SYSTEM && errno == EINTR); if (error) { #if defined(MACOSX) @@ -430,16 +431,20 @@ Java_java_net_Inet6AddressImpl_getHostByAddr(JNIEnv *env, jobject this, len = sizeof(struct sockaddr_in6); } - if (getnameinfo(&sa.sa, len, host, sizeof(host), NULL, 0, NI_NAMEREQD)) { - JNU_ThrowByName(env, "java/net/UnknownHostException", NULL); - } else { + int r; + + NET_RESTARTABLE(r, getnameinfo(&sa.sa, len, host, sizeof(host), NULL, 0, NI_NAMEREQD), + r == EAI_SYSTEM && errno == EINTR); + + if (r == 0) { ret = (*env)->NewStringUTF(env, host); - if (ret == NULL) { - JNU_ThrowByName(env, "java/net/UnknownHostException", NULL); + if (ret != NULL) { + return ret; } } - return ret; + JNU_ThrowByName(env, "java/net/UnknownHostException", NULL); + return NULL; } /** @@ -483,7 +488,8 @@ tcp_ping6(JNIEnv *env, SOCKETADDRESS *sa, SOCKETADDRESS *netif, jint timeout, SET_NONBLOCKING(fd); sa->sa6.sin6_port = htons(7); // echo port - connect_rv = connect(fd, &sa->sa, sizeof(struct sockaddr_in6)); + NET_RESTARTABLE(connect_rv, connect(fd, &sa->sa, sizeof(struct sockaddr_in6)), + connect_rv == -1 && errno == EINTR); // connection established or refused immediately, either way it means // we were able to reach the host! @@ -604,7 +610,10 @@ ping6(JNIEnv *env, jint fd, SOCKETADDRESS *sa, SOCKETADDRESS *netif, memcpy(sendbuf + sizeof(struct icmp6_hdr), &tv, sizeof(tv)); icmp6->icmp6_cksum = 0; // send it - n = sendto(fd, sendbuf, plen, 0, &sa->sa, sizeof(struct sockaddr_in6)); + + NET_RESTARTABLE(n, sendto(fd, sendbuf, plen, 0, &sa->sa, sizeof(struct sockaddr_in6)), + n == -1 && errno == EINTR); + if (n < 0 && errno != EINPROGRESS) { #if defined(__linux__) /* @@ -628,8 +637,9 @@ ping6(JNIEnv *env, jint fd, SOCKETADDRESS *sa, SOCKETADDRESS *netif, tmout2 = NET_Wait(env, fd, NET_WAIT_READ, tmout2); if (tmout2 >= 0) { len = sizeof(sa_recv); - n = recvfrom(fd, recvbuf, sizeof(recvbuf), 0, - (struct sockaddr *)&sa_recv, &len); + NET_RESTARTABLE(n, recvfrom(fd, recvbuf, sizeof(recvbuf), 0, + (struct sockaddr *)&sa_recv, &len), + n == -1 && errno == EINTR); // check if we received enough data if (n < (jint)sizeof(struct icmp6_hdr)) { continue; diff --git a/src/java.base/unix/native/libnet/net_util_md.c b/src/java.base/unix/native/libnet/net_util_md.c index 9bb6a026961..b0915615d96 100644 --- a/src/java.base/unix/native/libnet/net_util_md.c +++ b/src/java.base/unix/native/libnet/net_util_md.c @@ -76,9 +76,6 @@ NET_ThrowNew(JNIEnv *env, int errorNumber, char *msg) { jio_snprintf(fullMsg, sizeof(fullMsg), "socket closed: %s", msg); JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", fullMsg); break; - case EINTR: - JNU_ThrowByName(env, JNU_JAVAIOPKG "InterruptedIOException", msg); - break; default: errno = errorNumber; JNU_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", msg); @@ -627,11 +624,11 @@ NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout) pfd.fd = fd; pfd.events = 0; if (flags & NET_WAIT_READ) - pfd.events |= POLLIN; + pfd.events |= POLLIN; if (flags & NET_WAIT_WRITE) - pfd.events |= POLLOUT; + pfd.events |= POLLOUT; if (flags & NET_WAIT_CONNECT) - pfd.events |= POLLOUT; + pfd.events |= POLLOUT; errno = 0; read_rv = poll(&pfd, 1, nanoTimeout / NET_NSEC_PER_MSEC); @@ -639,13 +636,13 @@ NET_Wait(JNIEnv *env, jint fd, jint flags, jint timeout) newNanoTime = JVM_NanoTime(env, 0); nanoTimeout -= (newNanoTime - prevNanoTime); if (nanoTimeout < NET_NSEC_PER_MSEC) { - return read_rv > 0 ? 0 : -1; + return read_rv > 0 ? 0 : -1; } prevNanoTime = newNanoTime; if (read_rv > 0) { - break; + break; } - } /* while */ + } /* while */ return (nanoTimeout / NET_NSEC_PER_MSEC); } diff --git a/src/java.base/unix/native/libnet/net_util_md.h b/src/java.base/unix/native/libnet/net_util_md.h index 902cf96732f..d6cb3250bbe 100644 --- a/src/java.base/unix/native/libnet/net_util_md.h +++ b/src/java.base/unix/native/libnet/net_util_md.h @@ -80,4 +80,17 @@ void NET_ThrowUnknownHostExceptionWithGaiError(JNIEnv *env, void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name, const char *defaultDetail); +/** + * Invokes CALL in a loop, setting RET to return value. + * Invokes PREDICATE for condition to restart CALL (in loop) + * Return RET otherwise + */ +#define NET_RESTARTABLE(RET,CALL,PREDICATE) \ + while (1) { \ + RET = CALL; \ + if (!(PREDICATE)) { \ + break; \ + } \ + } + #endif /* NET_UTILS_MD_H */ diff --git a/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java b/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java index 517b4801e2c..76890045724 100644 --- a/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java +++ b/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java @@ -91,6 +91,7 @@ public class NTLMAuthSequence { private native long getCredentialsHandle (String user, String domain, String password); - private native byte[] getNextToken (long crdHandle, byte[] lastToken, Status returned); + private native byte[] getNextToken (long crdHandle, byte[] lastToken, Status returned) + throws IOException; } diff --git a/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java b/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java index a7056082e12..75a9dc027b1 100644 --- a/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java +++ b/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthentication.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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,9 +26,7 @@ package sun.net.www.protocol.http.ntlm; import java.io.IOException; -import java.net.InetAddress; import java.net.PasswordAuthentication; -import java.net.UnknownHostException; import java.net.URL; import java.util.Locale; import sun.net.NetProperties; @@ -204,10 +202,10 @@ public final class NTLMAuthentication extends AuthenticationInfo { * @param p A source of header values for this connection, not used because * HeaderParser converts the fields to lower case, use raw instead * @param raw The raw header field. - * @return true if all goes well, false if no headers were set. + * @throws IOException if no headers were set */ @Override - public boolean setHeaders(HttpURLConnection conn, HeaderParser p, String raw) { + public void setHeaders(HttpURLConnection conn, HeaderParser p, String raw) throws IOException { // no need to synchronize here: // already locked by s.n.w.p.h.HttpURLConnection @@ -224,10 +222,9 @@ public final class NTLMAuthentication extends AuthenticationInfo { if (seq.isComplete()) { conn.authObj(null); } - return true; } catch (IOException e) { conn.authObj(null); - return false; + throw e; } } } diff --git a/src/java.base/windows/native/libnet/NTLMAuthSequence.c b/src/java.base/windows/native/libnet/NTLMAuthSequence.c index 507409e0ae6..c058c8ad234 100644 --- a/src/java.base/windows/native/libnet/NTLMAuthSequence.c +++ b/src/java.base/windows/native/libnet/NTLMAuthSequence.c @@ -230,6 +230,8 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc } if (ss < 0) { + SetLastError(ss); + JNU_ThrowIOExceptionWithLastError(env, "InitializeSecurityContext"); endSequence (pCred, pCtx, env, status); return 0; } @@ -238,6 +240,8 @@ JNIEXPORT jbyteArray JNICALL Java_sun_net_www_protocol_http_ntlm_NTLMAuthSequenc ss = CompleteAuthToken( pCtx, &OutBuffDesc ); if (ss < 0) { + SetLastError(ss); + JNU_ThrowIOExceptionWithLastError(env, "CompleteAuthToken"); endSequence (pCred, pCtx, env, status); return 0; } diff --git a/src/java.desktop/macosx/classes/sun/lwawt/LWListPeer.java b/src/java.desktop/macosx/classes/sun/lwawt/LWListPeer.java index 905a66b3212..e2f26201919 100644 --- a/src/java.desktop/macosx/classes/sun/lwawt/LWListPeer.java +++ b/src/java.desktop/macosx/classes/sun/lwawt/LWListPeer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, 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,6 +49,10 @@ import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import static java.awt.event.ItemEvent.DESELECTED; +import static java.awt.event.ItemEvent.ITEM_STATE_CHANGED; +import static java.awt.event.ItemEvent.SELECTED; + /** * Lightweight implementation of {@link ListPeer}. Delegates most of the work to * the {@link JList}, which is placed inside {@link JScrollPane}. @@ -86,8 +90,11 @@ final class LWListPeer extends LWComponentPeer final int[] selectedIndices = getTarget().getSelectedIndexes(); synchronized (getDelegateLock()) { getDelegate().setSkipStateChangedEvent(true); - getDelegate().getView().setSelectedIndices(selectedIndices); - getDelegate().setSkipStateChangedEvent(false); + try { + getDelegate().getView().setSelectedIndices(selectedIndices); + } finally { + getDelegate().setSkipStateChangedEvent(false); + } } } @@ -111,24 +118,39 @@ final class LWListPeer extends LWComponentPeer @Override public void add(final String item, final int index) { synchronized (getDelegateLock()) { - getDelegate().getModel().add(index, item); - revalidate(); + getDelegate().setSkipStateChangedEvent(true); + try { + getDelegate().getModel().add(index, item); + revalidate(); + } finally { + getDelegate().setSkipStateChangedEvent(false); + } } } @Override public void delItems(final int start, final int end) { synchronized (getDelegateLock()) { - getDelegate().getModel().removeRange(start, end); - revalidate(); + getDelegate().setSkipStateChangedEvent(true); + try { + getDelegate().getModel().removeRange(start, end); + revalidate(); + } finally { + getDelegate().setSkipStateChangedEvent(false); + } } } @Override public void removeAll() { synchronized (getDelegateLock()) { - getDelegate().getModel().removeAllElements(); - revalidate(); + getDelegate().setSkipStateChangedEvent(true); + try { + getDelegate().getModel().removeAllElements(); + revalidate(); + } finally { + getDelegate().setSkipStateChangedEvent(false); + } } } @@ -136,16 +158,23 @@ final class LWListPeer extends LWComponentPeer public void select(final int index) { synchronized (getDelegateLock()) { getDelegate().setSkipStateChangedEvent(true); - getDelegate().getView().setSelectedIndex(index); - getDelegate().setSkipStateChangedEvent(false); + try { + getDelegate().getView().setSelectedIndex(index); + } finally { + getDelegate().setSkipStateChangedEvent(false); + } } } @Override public void deselect(final int index) { synchronized (getDelegateLock()) { - getDelegate().getView().getSelectionModel(). - removeSelectionInterval(index, index); + getDelegate().setSkipStateChangedEvent(true); + try { + getDelegate().getView().removeSelectionInterval(index, index); + } finally { + getDelegate().setSkipStateChangedEvent(false); + } } } @@ -255,21 +284,18 @@ final class LWListPeer extends LWComponentPeer @Override public void valueChanged(final ListSelectionEvent e) { - if (!e.getValueIsAdjusting() && !isSkipStateChangedEvent()) { - final JList source = (JList) e.getSource(); - for(int i = 0 ; i < source.getModel().getSize(); i++) { - - final boolean wasSelected = Arrays.binarySearch(oldSelectedIndices, i) >= 0; - final boolean isSelected = source.isSelectedIndex(i); - - if (wasSelected == isSelected) { - continue; + if (!e.getValueIsAdjusting()) { + JList source = (JList) e.getSource(); + if (!isSkipStateChangedEvent()) { + for (int i = 0; i < source.getModel().getSize(); i++) { + boolean wasSelected = + Arrays.binarySearch(oldSelectedIndices, i) >= 0; + if (wasSelected != source.isSelectedIndex(i)) { + int state = wasSelected ? DESELECTED : SELECTED; + LWListPeer.this.postEvent(new ItemEvent(getTarget(), + ITEM_STATE_CHANGED, i, state)); + } } - - final int state = !wasSelected && isSelected ? ItemEvent.SELECTED: ItemEvent.DESELECTED; - - LWListPeer.this.postEvent(new ItemEvent(getTarget(), ItemEvent.ITEM_STATE_CHANGED, - i, state)); } oldSelectedIndices = source.getSelectedIndices(); } diff --git a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTextPipe.java b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTextPipe.java index 6fdda409ce5..cf4a6e72136 100644 --- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTextPipe.java +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CTextPipe.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, 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 @@ -97,8 +97,14 @@ public class CTextPipe implements TextPipe { if (f2d instanceof CFont) { CompositeFont cf = ((CFont)f2d).getCompositeFont2D(); PhysicalFont pf = cf.getSlotFont(slot); - Font f = new Font(pf.getFontName(null), - font.getStyle(), font.getSize()); + String name = pf.getFontName(null); + Font f = new Font(name, font.getStyle(), font.getSize()); + if (font.isTransformed()) { + f = f.deriveFont(font.getTransform()); + } + if (font.hasLayoutAttributes()) { + f = f.deriveFont(font.getAttributes()); + } return f; } return null; diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m index 32164493f9f..70f0741347a 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m @@ -60,16 +60,14 @@ static int getBPPFromModeString(CFStringRef mode) } static BOOL isValidDisplayMode(CGDisplayModeRef mode) { - // Workaround for apple bug FB13261205, since it only affects arm based macs - // and arm support started with macOS 11 ignore the workaround for previous versions - if (@available(macOS 11, *)) { - if (architecture == -1) { - architecture = [[NSRunningApplication currentApplication] executableArchitecture]; - } - if (architecture == NSBundleExecutableArchitectureARM64) { - return (CGDisplayModeGetPixelWidth(mode) >= 800); - } + // Workaround for apple bug FB13261205, only affects arm based macs + if (architecture == -1) { + architecture = [[NSRunningApplication currentApplication] executableArchitecture]; } + if (architecture == NSBundleExecutableArchitectureARM64) { + return (CGDisplayModeGetPixelWidth(mode) >= 800); + } + return (1 < CGDisplayModeGetWidth(mode) && 1 < CGDisplayModeGetHeight(mode)); } diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java index 1c8c1e88be4..7c243396dda 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKColorChooserPanel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -122,6 +122,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements /** * Returns a user presentable description of this GTKColorChooserPane. */ + @Override public String getDisplayName() { return (String)UIManager.get("GTKColorChooserPanel.nameText"); } @@ -129,6 +130,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements /** * Returns the mnemonic to use with getDisplayName. */ + @Override public int getMnemonic() { String m = (String)UIManager.get("GTKColorChooserPanel.mnemonic"); @@ -145,6 +147,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements /** * Character to underline that represents the mnemonic. */ + @Override public int getDisplayedMnemonicIndex() { String m = (String)UIManager.get( "GTKColorChooserPanel.displayedMnemonicIndex"); @@ -159,14 +162,17 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements return -1; } + @Override public Icon getSmallDisplayIcon() { return null; } + @Override public Icon getLargeDisplayIcon() { return null; } + @Override public void uninstallChooserPanel(JColorChooser enclosingChooser) { super.uninstallChooserPanel(enclosingChooser); removeAll(); @@ -175,6 +181,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements /** * Builds and configures the widgets for the GTKColorChooserPanel. */ + @Override protected void buildChooser() { triangle = new ColorTriangle(); triangle.setName("GTKColorChooserPanel.triangle"); @@ -307,6 +314,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements /** * Refreshes the display from the model. */ + @Override public void updateChooser() { if (!settingColor) { lastLabel.setBackground(getColorFromModel()); @@ -490,6 +498,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements /** * ChangeListener method, updates the necessary display widgets. */ + @Override public void stateChanged(ChangeEvent e) { if (settingColor) { return; @@ -687,6 +696,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements return circleY + getIndicatorSize() / 2 - getWheelYOrigin(); } + @Override protected void processEvent(AWTEvent e) { if (!(getGTKColorChooserPanel().isEnabled())) { @@ -741,6 +751,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements super.processEvent(e); } + @Override public void paintComponent(Graphics g) { super.paintComponent(g); @@ -1259,6 +1270,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements this.type = type; } + @Override public void actionPerformed(ActionEvent e) { ColorTriangle triangle = (ColorTriangle)e.getSource(); @@ -1318,6 +1330,7 @@ class GTKColorChooserPanel extends AbstractColorChooserPanel implements @SuppressWarnings("serial") // Superclass is not serializable across versions private static class OpaqueLabel extends JLabel { + @Override public boolean isOpaque() { return true; } diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java index 4f18dc84f4a..29d77650cb4 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java @@ -188,6 +188,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { super(filechooser); } + @Override protected ActionMap createActionMap() { ActionMap map = new ActionMapUIResource(); map.put("approveSelection", getApproveSelectionAction()); @@ -197,6 +198,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { return map; } + @Override @SuppressWarnings("deprecation") public String getFileName() { JFileChooser fc = getFileChooser(); @@ -243,6 +245,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { return sb.toString(); } + @Override public void setFileName(String fileName) { if (fileNameTextField != null) { fileNameTextField.setText(fileName); @@ -253,18 +256,22 @@ class GTKFileChooserUI extends SynthFileChooserUI { // return pathField.getText(); // } + @Override public void setDirectoryName(String dirname) { pathField.setText(dirname); } + @Override public void ensureFileIsVisible(JFileChooser fc, File f) { // PENDING } + @Override public void rescanCurrentDirectory(JFileChooser fc) { getModel().validateFileCache(); } + @Override public JPanel getAccessoryPanel() { return accessoryPanel; } @@ -273,6 +280,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { // * FileView operations * // *********************** + @Override public FileView getFileView(JFileChooser fc) { return fileView; } @@ -282,16 +290,20 @@ class GTKFileChooserUI extends SynthFileChooserUI { iconCache = null; } + @Override public void clearIconCache() { } + @Override public Icon getCachedIcon(File f) { return null; } + @Override public void cacheIcon(File f, Icon i) { } + @Override public Icon getIcon(File f) { return (f != null && f.isDirectory()) ? directoryIcon : fileIcon; } @@ -317,6 +329,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { } } + @Override protected void doSelectedFileChanged(PropertyChangeEvent e) { super.doSelectedFileChanged(e); File f = (File) e.getNewValue(); @@ -325,6 +338,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { } } + @Override protected void doDirectoryChanged(PropertyChangeEvent e) { directoryList.clearSelection(); ListSelectionModel sm = directoryList.getSelectionModel(); @@ -357,6 +371,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { super.doDirectoryChanged(e); } + @Override protected void doAccessoryChanged(PropertyChangeEvent e) { if (getAccessoryPanel() != null) { if (e.getOldValue() != null) { @@ -374,6 +389,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { } } + @Override protected void doFileSelectionModeChanged(PropertyChangeEvent e) { directoryList.clearSelection(); rightPanel.setVisible(((Integer)e.getNewValue()).intValue() != JFileChooser.DIRECTORIES_ONLY); @@ -381,6 +397,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { super.doFileSelectionModeChanged(e); } + @Override protected void doMultiSelectionChanged(PropertyChangeEvent e) { if (getFileChooser().isMultiSelectionEnabled()) { fileList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); @@ -395,6 +412,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { super.doMultiSelectionChanged(e); } + @Override protected void doControlButtonsChanged(PropertyChangeEvent e) { super.doControlButtonsChanged(e); @@ -407,6 +425,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { updateDefaultButton(); } + @Override protected void doAncestorChanged(PropertyChangeEvent e) { if (e.getOldValue() == null && e.getNewValue() != null) { // Ancestor was added, set initial focus @@ -424,6 +443,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { // ************ Create Listeners ************** // ******************************************** + @Override public ListSelectionListener createListSelectionListener(JFileChooser fc) { return new SelectionListener(); } @@ -434,6 +454,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { this.list = list; } + @Override public void mouseClicked(MouseEvent e) { if (!getFileChooser().isEnabled()) { @@ -464,6 +485,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { } } + @Override public void mouseEntered(MouseEvent evt) { if (list != null) { TransferHandler th1 = getFileChooser().getTransferHandler(); @@ -478,6 +500,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { } } + @Override protected MouseListener createDoubleClickListener(JFileChooser fc, JList list) { return new DoubleClickListener(list); } @@ -486,6 +509,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { @SuppressWarnings("deprecation") protected class SelectionListener implements ListSelectionListener { + @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { JFileChooser chooser = getFileChooser(); @@ -547,6 +571,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { return new GTKFileChooserUI((JFileChooser)c); } + @Override public void installUI(JComponent c) { accessoryPanel = new JPanel(new BorderLayout(10, 10)); accessoryPanel.setName("GTKFileChooser.accessoryPanel"); @@ -554,6 +579,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { super.installUI(c); } + @Override public void uninstallUI(JComponent c) { c.removePropertyChangeListener(filterComboBoxModel); super.uninstallUI(c); @@ -565,6 +591,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { getFileChooser().removeAll(); } + @Override public void installComponents(JFileChooser fc) { super.installComponents(fc); @@ -623,6 +650,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { JPanel comboBoxPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 0, 0) { + @Override public void layoutContainer(Container target) { super.layoutContainer(target); JComboBox comboBox = directoryComboBox; @@ -733,6 +761,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { curDirName = currentDirectory.getPath(); } JLabel tmp = new JLabel(curDirName) { + @Override public Dimension getMaximumSize() { Dimension d = super.getMaximumSize(); d.height = getPreferredSize().height; @@ -747,6 +776,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { // add the fileName field JTextField tmp2 = new JTextField() { + @Override public Dimension getMaximumSize() { Dimension d = super.getMaximumSize(); d.height = getPreferredSize().height; @@ -811,6 +841,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { } } + @Override protected void installListeners(JFileChooser fc) { super.installListeners(fc); @@ -822,6 +853,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { return SwingUtilities2.getUIDefaultsInt(key, l); } + @Override protected void uninstallListeners(JFileChooser fc) { super.uninstallListeners(fc); @@ -831,6 +863,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { } private class GTKFCPropertyChangeListener implements PropertyChangeListener { + @Override public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (prop.equals("GTKFileChooser.showDirectoryIcons")) { @@ -841,6 +874,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { } } + @Override protected void installDefaults(JFileChooser fc) { super.installDefaults(fc); readOnly = UIManager.getBoolean("FileChooser.readOnly"); @@ -850,11 +884,13 @@ class GTKFileChooserUI extends SynthFileChooserUI { Boolean.TRUE.equals(fc.getClientProperty("GTKFileChooser.showFileIcons")); } + @Override protected void installIcons(JFileChooser fc) { directoryIcon = UIManager.getIcon("FileView.directoryIcon"); fileIcon = UIManager.getIcon("FileView.fileIcon"); } + @Override protected void installStrings(JFileChooser fc) { super.installStrings(fc); @@ -894,6 +930,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { filterLabelMnemonic = UIManager.getInt("FileChooser.filterLabelMnemonic"); } + @Override protected void uninstallStrings(JFileChooser fc) { super.uninstallStrings(fc); @@ -972,14 +1009,17 @@ class GTKFileChooserUI extends SynthFileChooserUI { return scrollpane; } + @Override protected void createModel() { model = new GTKDirectoryModel(); } + @Override public BasicDirectoryModel getModel() { return model; } + @Override public Action getApproveSelectionAction() { return approveSelectionAction; } @@ -990,6 +1030,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { super(getFileChooser()); } + @Override protected void sort(Vector v) { FileSystemView fsv = getFileChooser().getFileSystemView(); if (fsv == null) { @@ -1028,6 +1069,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { directoryChanged(); } + @Override public int getSize() { return getModel().getDirectories().size() + 1; } @@ -1038,10 +1080,12 @@ class GTKFileChooserUI extends SynthFileChooserUI { curDir; } + @Override public void intervalAdded(ListDataEvent e) { fireIntervalAdded(this, e.getIndex0(), e.getIndex1()); } + @Override public void intervalRemoved(ListDataEvent e) { fireIntervalRemoved(this, e.getIndex0(), e.getIndex1()); } @@ -1055,6 +1099,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { // PENDING - fire the correct interval changed - currently sending // out that everything has changed + @Override public void contentsChanged(ListDataEvent e) { fireContentsChanged(); } @@ -1071,6 +1116,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { getModel().addListDataListener(this); } + @Override public int getSize() { return getModel().getFiles().size(); } @@ -1088,10 +1134,12 @@ class GTKFileChooserUI extends SynthFileChooserUI { return getModel().getFiles().elementAt(index); } + @Override public void intervalAdded(ListDataEvent e) { fireIntervalAdded(this, e.getIndex0(), e.getIndex1()); } + @Override public void intervalRemoved(ListDataEvent e) { fireIntervalRemoved(this, e.getIndex0(), e.getIndex1()); } @@ -1104,6 +1152,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { } // PENDING - fire the interval changed + @Override public void contentsChanged(ListDataEvent e) { fireContentsChanged(); } @@ -1112,6 +1161,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { @SuppressWarnings("serial") // Superclass is not serializable across versions protected class FileCellRenderer extends DefaultListCellRenderer { + @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { @@ -1129,6 +1179,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { @SuppressWarnings("serial") // Superclass is not serializable across versions protected class DirectoryCellRenderer extends DefaultListCellRenderer { + @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { @@ -1178,6 +1229,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { c.setAlignmentY(JComponent.TOP_ALIGNMENT); } + @Override public Action getNewFolderAction() { if (newFolderAction == null) { newFolderAction = new NewFolderAction(); @@ -1252,15 +1304,18 @@ class GTKFileChooserUI extends SynthFileChooserUI { setSelectedItem(canonical); } + @Override public void setSelectedItem(Object selectedDirectory) { this.selectedDirectory = (File)selectedDirectory; fireContentsChanged(this, -1, -1); } + @Override public Object getSelectedItem() { return selectedDirectory; } + @Override public int getSize() { return directories.size(); } @@ -1280,6 +1335,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { super("DirectoryComboBoxAction"); } + @Override public void actionPerformed(ActionEvent e) { File f = (File)directoryComboBox.getSelectedItem(); getFileChooser().setCurrentDirectory(f); @@ -1294,6 +1350,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { protected NewFolderAction() { super(FilePane.ACTION_NEW_FOLDER); } + @Override public void actionPerformed(ActionEvent e) { if (readOnly) { return; @@ -1327,6 +1384,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { @SuppressWarnings("serial") // Superclass is not serializable across versions private class GTKApproveSelectionAction extends ApproveSelectionAction { + @Override public void actionPerformed(ActionEvent e) { if (isDirectorySelected()) { File dir = getDirectory(); @@ -1362,6 +1420,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { protected RenameFileAction() { super(FilePane.ACTION_EDIT_FILE_NAME); } + @Override public void actionPerformed(ActionEvent e) { if (getFileName().isEmpty()) { return; @@ -1405,6 +1464,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { */ @SuppressWarnings("serial") // Superclass is not serializable across versions public class FilterComboBoxRenderer extends DefaultListCellRenderer { + @Override public String getName() { // As SynthComboBoxRenderer's are asked for a size BEFORE they // are parented getName is overridden to force the name to be @@ -1417,6 +1477,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { return name; } + @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { @@ -1457,6 +1518,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { filters = getFileChooser().getChoosableFileFilters(); } + @Override public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (prop == JFileChooser.CHOOSABLE_FILE_FILTER_CHANGED_PROPERTY) { @@ -1467,6 +1529,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { } } + @Override public void setSelectedItem(Object filter) { if (filter != null) { getFileChooser().setFileFilter((FileFilter) filter); @@ -1474,6 +1537,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { } } + @Override public Object getSelectedItem() { // Ensure that the current filter is in the list. // NOTE: we shouldn't have to do this, since JFileChooser adds @@ -1495,6 +1559,7 @@ class GTKFileChooserUI extends SynthFileChooserUI { return getFileChooser().getFileFilter(); } + @Override public int getSize() { if (filters != null) { return filters.length; diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java index 2a0aa7be41c..49062277086 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKGraphicsUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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,6 +41,7 @@ import sun.swing.MnemonicHandler; * @author Joshua Outwater */ class GTKGraphicsUtils extends SynthGraphicsUtils { + @Override public void paintText(SynthContext context, Graphics g, String text, int x, int y, int mnemonicIndex) { if (text == null || text.length() <= 0) { @@ -83,6 +84,7 @@ class GTKGraphicsUtils extends SynthGraphicsUtils { * @param bounds Bounds of the text to be drawn. * @param mnemonicIndex Index to draw string at. */ + @Override public void paintText(SynthContext context, Graphics g, String text, Rectangle bounds, int mnemonicIndex) { if (text == null || text.length() <= 0) { diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java index 4f04d729099..ffd7df909b5 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -163,6 +163,7 @@ class GTKIconFactory { this.method = methodName; } + @Override public void paintIcon(SynthContext context, Graphics g, int x, int y, int w, int h) { if (context != null) { @@ -171,10 +172,12 @@ class GTKIconFactory { } } + @Override public int getIconWidth(SynthContext context) { return getIconDimension(context); } + @Override public int getIconHeight(SynthContext context) { return getIconDimension(context); } @@ -248,6 +251,7 @@ class GTKIconFactory { super(method); } + @Override public void paintIcon(SynthContext context, Graphics g, int x, int y, int w, int h) { if (context != null) { @@ -256,6 +260,7 @@ class GTKIconFactory { } } + @Override int getIconDimension(SynthContext context) { updateSizeIfNecessary(context); return (iconDimension == -1) ? DEFAULT_ICON_SIZE : @@ -285,10 +290,12 @@ class GTKIconFactory { super(TOOL_BAR_HANDLE_ICON); } + @Override protected Class[] getMethodParamTypes() { return PARAM_TYPES; } + @Override public void paintIcon(SynthContext context, Graphics g, int x, int y, int w, int h) { if (context != null) { @@ -309,6 +316,7 @@ class GTKIconFactory { } } + @Override public int getIconWidth(SynthContext context) { if (context == null) { return 10; @@ -321,6 +329,7 @@ class GTKIconFactory { } } + @Override public int getIconHeight(SynthContext context) { if (context == null) { return 10; @@ -344,10 +353,12 @@ class GTKIconFactory { super(MENU_ARROW_ICON); } + @Override protected Class[] getMethodParamTypes() { return PARAM_TYPES; } + @Override public void paintIcon(SynthContext context, Graphics g, int x, int y, int w, int h) { if (context != null) { diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java index 480b8bacb30..24a1997bdc1 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKLookAndFeel.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -261,6 +261,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { region == Region.TREE); } + @Override public UIDefaults getDefaults() { // We need to call super for basic's properties file. UIDefaults table = super.getDefaults(); @@ -301,6 +302,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { "com.sun.java.swing.plaf.gtk.resources.gtk"); } + @Override protected void initComponentDefaults(UIDefaults table) { // For compatibility with apps expecting certain defaults we'll // populate the table with the values from basic. @@ -511,6 +513,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { FontLazyValue(Region region) { this.region = region; } + @Override public Object createValue(UIDefaults table) { SynthStyleFactory factory = getStyleFactory(); GTKStyle style = (GTKStyle)factory.getStyle(null, region); @@ -556,6 +559,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { "ColorChooser.showPreviewPanelText", Boolean.FALSE, "ColorChooser.panels", new UIDefaults.ActiveValue() { + @Override public Object createValue(UIDefaults table) { return new AbstractColorChooserPanel[] { new GTKColorChooserPanel() }; @@ -1168,6 +1172,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { "TitledBorder.titleColor", controlText, "TitledBorder.border", new UIDefaults.LazyValue() { + @Override public Object createValue(UIDefaults table) { return new GTKPainter.TitledBorder(); } @@ -1184,6 +1189,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { "ToolBar.separatorSize", new DimensionUIResource(10, 10), "ToolBar.handleIcon", new UIDefaults.ActiveValue() { + @Override public Object createValue(UIDefaults table) { return GTKIconFactory.getToolBarHandleIcon(); } @@ -1312,6 +1318,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { } } + @Override protected void initSystemColorDefaults(UIDefaults table) { SynthStyleFactory factory = getStyleFactory(); GTKStyle windowStyle = @@ -1492,6 +1499,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { public String getKey() { return key; } + @Override public void propertyChange(final PropertyChangeEvent pce) { final GTKLookAndFeel lnf = get(); @@ -1504,6 +1512,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { // We are using invokeLater here because we are getting called // on the AWT-Motif thread which can cause a deadlock. SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { String name = pce.getPropertyName(); /* We are listening for GTK desktop text AA settings: @@ -1531,30 +1540,36 @@ public class GTKLookAndFeel extends SynthLookAndFeel { } } + @Override public boolean isSupportedLookAndFeel() { Toolkit toolkit = Toolkit.getDefaultToolkit(); return (toolkit instanceof SunToolkit && ((SunToolkit)toolkit).isNativeGTKAvailable()); } + @Override public boolean isNativeLookAndFeel() { return true; } + @Override public String getDescription() { return "GTK look and feel"; } + @Override public String getName() { return "GTK look and feel"; } + @Override public String getID() { return "GTK"; } // Subclassed to pass in false to the superclass, we don't want to try // and load the system colors. + @Override protected void loadSystemColors(UIDefaults table, String[] systemColors, boolean useNative) { super.loadSystemColors(table, systemColors, false); } @@ -1663,6 +1678,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { * SynthStyles from the SynthStyleFactory * when the ancestor changed. */ + @Override public boolean shouldUpdateStyleOnAncestorChanged() { return true; } @@ -1670,6 +1686,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel { /** * {@inheritDoc} */ + @Override public LayoutStyle getLayoutStyle() { return GnomeLayoutStyle.INSTANCE; } diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java index fa28eb3ca71..cf9cd0f2551 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKPainter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -77,17 +77,20 @@ class GTKPainter extends SynthPainter { context.getComponent().getName(); } + @Override public void paintCheckBoxBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { paintRadioButtonBackground(context, g, x, y, w, h); } + @Override public void paintCheckBoxMenuItemBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { paintRadioButtonMenuItemBackground(context, g, x, y, w, h); } // FORMATTED_TEXT_FIELD + @Override public void paintFormattedTextFieldBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -97,6 +100,7 @@ class GTKPainter extends SynthPainter { // // TOOL_BAR_DRAG_WINDOW // + @Override public void paintToolBarDragWindowBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -107,6 +111,7 @@ class GTKPainter extends SynthPainter { // // TOOL_BAR // + @Override public void paintToolBarBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -126,6 +131,7 @@ class GTKPainter extends SynthPainter { } } + @Override public void paintToolBarContentBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -144,6 +150,7 @@ class GTKPainter extends SynthPainter { // // PASSWORD_FIELD // + @Override public void paintPasswordFieldBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -153,6 +160,7 @@ class GTKPainter extends SynthPainter { // // TEXT_FIELD // + @Override public void paintTextFieldBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { if (getName(context) == "Tree.cellEditor") { @@ -166,6 +174,7 @@ class GTKPainter extends SynthPainter { // RADIO_BUTTON // // NOTE: this is called for JCheckBox too + @Override public void paintRadioButtonBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -204,6 +213,7 @@ class GTKPainter extends SynthPainter { // RADIO_BUTTON_MENU_ITEM // // NOTE: this is called for JCheckBoxMenuItem too + @Override public void paintRadioButtonMenuItemBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -218,6 +228,7 @@ class GTKPainter extends SynthPainter { // // LABEL // + @Override public void paintLabelBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -247,6 +258,7 @@ class GTKPainter extends SynthPainter { // // INTERNAL_FRAME // + @Override public void paintInternalFrameBorder(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -256,6 +268,7 @@ class GTKPainter extends SynthPainter { // // DESKTOP_PANE // + @Override public void paintDesktopPaneBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -266,12 +279,14 @@ class GTKPainter extends SynthPainter { // // DESKTOP_ICON // + @Override public void paintDesktopIconBorder(SynthContext context, Graphics g, int x, int y, int w, int h) { Metacity.INSTANCE.paintFrameBorder(context, g, x, y, w, h); } + @Override public void paintButtonBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { String name = getName(context); @@ -388,6 +403,7 @@ class GTKPainter extends SynthPainter { // // ARROW_BUTTON // + @Override public void paintArrowButtonForeground(SynthContext context, Graphics g, int x, int y, int w, int h, int direction) { @@ -437,6 +453,7 @@ class GTKPainter extends SynthPainter { } } + @Override public void paintArrowButtonBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); @@ -515,12 +532,14 @@ class GTKPainter extends SynthPainter { // // LIST // + @Override public void paintListBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { // Does not call into ENGINE for better performance fillArea(context, g, x, y, w, h, GTKColorType.TEXT_BACKGROUND); } + @Override public void paintMenuBarBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); @@ -544,6 +563,7 @@ class GTKPainter extends SynthPainter { // // MENU // + @Override public void paintMenuBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -551,6 +571,7 @@ class GTKPainter extends SynthPainter { } // This is called for both MENU and MENU_ITEM + @Override public void paintMenuItemBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -561,6 +582,7 @@ class GTKPainter extends SynthPainter { } } + @Override public void paintPopupMenuBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); @@ -604,6 +626,7 @@ class GTKPainter extends SynthPainter { } } + @Override public void paintProgressBarBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -618,6 +641,7 @@ class GTKPainter extends SynthPainter { } } + @Override public void paintProgressBarForeground(SynthContext context, Graphics g, int x, int y, int w, int h, int orientation) { @@ -637,6 +661,7 @@ class GTKPainter extends SynthPainter { } } + @Override public void paintViewportBorder(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); @@ -650,6 +675,7 @@ class GTKPainter extends SynthPainter { } } + @Override public void paintSeparatorBackground(SynthContext context, Graphics g, int x, int y, int w, int h, @@ -768,6 +794,7 @@ class GTKPainter extends SynthPainter { } } + @Override public void paintSliderTrackBackground(SynthContext context, Graphics g, int x, int y, int w,int h) { @@ -830,6 +857,7 @@ class GTKPainter extends SynthPainter { } } + @Override public void paintSliderThumbBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int dir) { Region id = context.getRegion(); @@ -856,6 +884,7 @@ class GTKPainter extends SynthPainter { // // SPINNER // + @Override public void paintSpinnerBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -865,6 +894,7 @@ class GTKPainter extends SynthPainter { // // SPLIT_PANE_DIVIDER // + @Override public void paintSplitPaneDividerBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -886,12 +916,14 @@ class GTKPainter extends SynthPainter { } } + @Override public void paintSplitPaneDragDivider(SynthContext context, Graphics g,int x, int y, int w, int h, int orientation) { paintSplitPaneDividerForeground(context, g, x, y, w, h, orientation); } + @Override public void paintTabbedPaneContentBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { JTabbedPane pane = (JTabbedPane)context.getComponent(); @@ -931,6 +963,7 @@ class GTKPainter extends SynthPainter { } } + @Override public void paintTabbedPaneTabBackground(SynthContext context, Graphics g, int x, int y, int w, int h, @@ -958,6 +991,7 @@ class GTKPainter extends SynthPainter { // // TEXT_PANE // + @Override public void paintTextPaneBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { paintTextAreaBackground(context, g, x, y, w, h); @@ -966,6 +1000,7 @@ class GTKPainter extends SynthPainter { // // EDITOR_PANE // + @Override public void paintEditorPaneBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { paintTextAreaBackground(context, g, x, y, w, h); @@ -974,6 +1009,7 @@ class GTKPainter extends SynthPainter { // // TEXT_AREA // + @Override public void paintTextAreaBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { // Does not call into ENGINE for better performance @@ -1076,6 +1112,7 @@ class GTKPainter extends SynthPainter { // // ROOT_PANE // + @Override public void paintRootPaneBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { // Does not call into ENGINE for better performance @@ -1085,6 +1122,7 @@ class GTKPainter extends SynthPainter { // // TOGGLE_BUTTON // + @Override public void paintToggleButtonBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { @@ -1103,6 +1141,7 @@ class GTKPainter extends SynthPainter { // // SCROLL_BAR // + @Override public void paintScrollBarBackground(SynthContext context, Graphics g, int x, int y, int w,int h) { @@ -1148,6 +1187,7 @@ class GTKPainter extends SynthPainter { // // SCROLL_BAR_THUMB // + @Override public void paintScrollBarThumbBackground(SynthContext context, Graphics g, int x, int y, int w, int h, int dir) { Region id = context.getRegion(); @@ -1206,6 +1246,7 @@ class GTKPainter extends SynthPainter { // // TOOL_TIP // + @Override public void paintToolTipBackground(SynthContext context, Graphics g, int x, int y, int w,int h) { Region id = context.getRegion(); @@ -1224,6 +1265,7 @@ class GTKPainter extends SynthPainter { // // TREE_CELL // + @Override public void paintTreeCellBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = context.getRegion(); @@ -1243,6 +1285,7 @@ class GTKPainter extends SynthPainter { } } + @Override public void paintTreeCellFocus(SynthContext context, Graphics g, int x, int y, int w, int h) { Region id = Region.TREE_CELL; @@ -1254,6 +1297,7 @@ class GTKPainter extends SynthPainter { // // TREE // + @Override public void paintTreeBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { // As far as I can tell, these don't call into the ENGINE. @@ -1264,6 +1308,7 @@ class GTKPainter extends SynthPainter { // // VIEWPORT // + @Override public void paintViewportBackground(SynthContext context, Graphics g, int x, int y, int w, int h) { // As far as I can tell, these don't call into the ENGINE. @@ -1509,6 +1554,7 @@ class GTKPainter extends SynthPainter { return context; } + @Override public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { if (focusedCell) { @@ -1523,6 +1569,7 @@ class GTKPainter extends SynthPainter { } } + @Override public Insets getBorderInsets(Component c, Insets i) { SynthContext context = getContext(c); @@ -1533,6 +1580,7 @@ class GTKPainter extends SynthPainter { return i; } + @Override public boolean isBorderOpaque() { return true; } @@ -1542,6 +1590,7 @@ class GTKPainter extends SynthPainter { @SuppressWarnings("serial") // Superclass is not serializable across versions static class TitledBorder extends AbstractBorder implements UIResource { + @Override public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) { SynthContext context = getContext((JComponent)c); @@ -1559,11 +1608,13 @@ class GTKPainter extends SynthPainter { } } + @Override public Insets getBorderInsets(Component c, Insets i) { SynthContext context = getContext((JComponent)c); return context.getStyle().getInsets(context, i); } + @Override public boolean isBorderOpaque() { return true; } diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java index cc7a1333b64..baeb249eaa8 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -142,6 +142,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { return GTKPainter.INSTANCE; } + @Override protected Color getColorForState(SynthContext context, ColorType type) { if (type == ColorType.FOCUS || type == GTKColorType.BLACK) { return BLACK_COLOR; @@ -292,6 +293,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { return font; } + @Override protected Font getFontForState(SynthContext context) { Font propFont = UIManager .getFont(context.getRegion().getName() + ".font"); @@ -1053,6 +1055,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { this.size = size; } + @Override public void paintIcon(SynthContext context, Graphics g, int x, int y, int w, int h) { Icon icon = getIcon(context); @@ -1067,6 +1070,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { } } + @Override public int getIconWidth(SynthContext context) { Icon icon = getIcon(context); @@ -1076,6 +1080,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { return 0; } + @Override public int getIconHeight(SynthContext context) { Icon icon = getIcon(context); @@ -1135,6 +1140,7 @@ class GTKStyle extends SynthStyle implements GTKConstants { this.methodName = methodName; } + @Override @SuppressWarnings("deprecation") public Object createValue(UIDefaults table) { try { diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyleFactory.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyleFactory.java index 9683ba06788..4127e39c172 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyleFactory.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/GTKStyleFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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,6 +58,7 @@ class GTKStyleFactory extends SynthStyleFactory { * @param c this parameter isn't used, may be null. * @param id of the region to get the style. */ + @Override public synchronized SynthStyle getStyle(JComponent c, Region id) { WidgetType wt = GTKEngine.getWidgetType(c, id); diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java index 4f7d19355c8..6e8f64b457d 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -693,6 +693,7 @@ class Metacity implements SynthConstants { return new ImageIcon(context.getComponent().createImage(producer)).getImage(); } + @Override public int filterRGB(int x, int y, int rgb) { // Assume all rgb values are shades of gray double grayLevel = 2 * (rgb & 0xff) / 255.0; @@ -729,12 +730,16 @@ class Metacity implements SynthConstants { protected class TitlePaneLayout implements LayoutManager { + @Override public void addLayoutComponent(String name, Component c) {} + @Override public void removeLayoutComponent(Component c) {} + @Override public Dimension preferredLayoutSize(Container c) { return minimumLayoutSize(c); } + @Override public Dimension minimumLayoutSize(Container c) { JComponent titlePane = (JComponent)c; Container titlePaneParent = titlePane.getParent(); @@ -794,6 +799,7 @@ class Metacity implements SynthConstants { return new Dimension(width, height); } + @Override public void layoutContainer(Container c) { JComponent titlePane = (JComponent)c; Container titlePaneParent = titlePane.getParent(); @@ -1943,10 +1949,12 @@ class Metacity implements SynthConstants { return token; } + @Override public boolean hasMoreTokens() { return (token != null || super.hasMoreTokens()); } + @Override public String nextToken() { if (token != null) { String t = token; @@ -2000,18 +2008,22 @@ class Metacity implements SynthConstants { this.archeight = arch; } + @Override public double getX() { return (double)x; } + @Override public double getY() { return (double)y; } + @Override public double getWidth() { return (double)width; } + @Override public double getHeight() { return (double)height; } @@ -2024,10 +2036,12 @@ class Metacity implements SynthConstants { return (double)archeight; } + @Override public boolean isEmpty() { return false; // Not called } + @Override public Rectangle2D getBounds2D() { return null; // Not called } @@ -2036,10 +2050,12 @@ class Metacity implements SynthConstants { return corners; } + @Override public void setFrame(double x, double y, double w, double h) { // Not called } + @Override public boolean contains(double x, double y) { return false; // Not called } @@ -2048,14 +2064,17 @@ class Metacity implements SynthConstants { return 0; // Not called } + @Override public boolean intersects(double x, double y, double w, double h) { return false; // Not called } + @Override public boolean contains(double x, double y, double w, double h) { return false; // Not called } + @Override public PathIterator getPathIterator(AffineTransform at) { return new RoundishRectIterator(this, at); } @@ -2148,18 +2167,22 @@ class Metacity implements SynthConstants { } } + @Override public int getWindingRule() { return WIND_NON_ZERO; } + @Override public boolean isDone() { return index >= ctrlpts.length; } + @Override public void next() { index++; } + @Override public int currentSegment(float[] coords) { if (isDone()) { throw new NoSuchElementException("roundrect iterator out of bounds"); @@ -2176,6 +2199,7 @@ class Metacity implements SynthConstants { return types[index]; } + @Override public int currentSegment(double[] coords) { if (isDone()) { throw new NoSuchElementException("roundrect iterator out of bounds"); diff --git a/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifOptionPaneUI.java b/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifOptionPaneUI.java index e68d7e2d8bf..21e8c0f6747 100644 --- a/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifOptionPaneUI.java +++ b/src/java.desktop/share/classes/com/sun/java/swing/plaf/motif/MotifOptionPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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,6 +25,7 @@ package com.sun.java.swing.plaf.motif; +import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.Dimension; @@ -102,7 +103,7 @@ public class MotifOptionPaneUI extends BasicOptionPaneUI JLabel iconLabel = new JLabel(sideIcon); iconLabel.setVerticalAlignment(SwingConstants.CENTER); - top.add(iconLabel, "West"); + top.add(iconLabel, BorderLayout.BEFORE_LINE_BEGINS); } } diff --git a/src/java.desktop/share/classes/javax/swing/JTable.java b/src/java.desktop/share/classes/javax/swing/JTable.java index e9ae9d82166..6e64b216d58 100644 --- a/src/java.desktop/share/classes/javax/swing/JTable.java +++ b/src/java.desktop/share/classes/javax/swing/JTable.java @@ -4454,8 +4454,6 @@ public class JTable extends JComponent implements TableModelListener, Scrollable // The whole thing changed clearSelectionAndLeadAnchor(); - rowModel = null; - if (sortManager != null) { try { ignoreSortChange = true; diff --git a/src/java.desktop/share/classes/javax/swing/SwingUtilities.java b/src/java.desktop/share/classes/javax/swing/SwingUtilities.java index 4633e9c4756..70fbeee8c7b 100644 --- a/src/java.desktop/share/classes/javax/swing/SwingUtilities.java +++ b/src/java.desktop/share/classes/javax/swing/SwingUtilities.java @@ -1813,6 +1813,9 @@ public class SwingUtilities implements SwingConstants while (map != null) { InputMap parent = map.getParent(); + if (uiInputMap == null) { + map.clear(); + } if (parent == null || (parent instanceof UIResource)) { map.setParent(uiInputMap); return; @@ -1837,6 +1840,9 @@ public class SwingUtilities implements SwingConstants while (map != null) { ActionMap parent = map.getParent(); + if (uiActionMap == null) { + map.clear(); + } if (parent == null || (parent instanceof UIResource)) { map.setParent(uiActionMap); return; diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java index 59799f4d91a..842e8892c76 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java @@ -293,6 +293,16 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants { installDefaults(); installListeners(); installKeyboardActions(); + setFocusIndex(tabPane.getSelectedIndex(), false); + + if (tabPane.getLayout() instanceof TabbedPaneScrollLayout) { + ensureCurrentLayout(); + int index = tabPane.getSelectedIndex(); + if (index < rects.length && index != -1) { + tabScroller.tabPanel.scrollRectToVisible( + (Rectangle)rects[index].clone()); + } + } } public void uninstallUI(JComponent c) { diff --git a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java index ee50976bbf4..a300110cced 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -216,11 +216,9 @@ public class SynthProgressBarUI extends BasicProgressBarUI SynthLookAndFeel.update(context, g); - if (((JProgressBar) c).isBorderPainted()) { - context.getPainter().paintProgressBarBackground(context, - g, 0, 0, c.getWidth(), c.getHeight(), - progressBar.getOrientation()); - } + context.getPainter().paintProgressBarBackground(context, + g, 0, 0, c.getWidth(), c.getHeight(), + progressBar.getOrientation()); paint(context, g); } diff --git a/src/java.desktop/share/classes/sun/font/StandardGlyphVector.java b/src/java.desktop/share/classes/sun/font/StandardGlyphVector.java index e333a9de291..d44bd9a00e5 100644 --- a/src/java.desktop/share/classes/sun/font/StandardGlyphVector.java +++ b/src/java.desktop/share/classes/sun/font/StandardGlyphVector.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, 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 @@ -608,11 +608,13 @@ public class StandardGlyphVector extends GlyphVector { } Rectangle2D vb = getGlyphVisualBounds(ix).getBounds2D(); - Point2D pt = getGlyphPosition(ix); - vb.setRect(vb.getMinX() - pt.getX(), - vb.getMinY() - pt.getY(), - vb.getWidth(), - vb.getHeight()); + if (!vb.isEmpty()) { + Point2D pt = getGlyphPosition(ix); + vb.setRect(vb.getMinX() - pt.getX(), + vb.getMinY() - pt.getY(), + vb.getWidth(), + vb.getHeight()); + } Point2D.Float adv = getGlyphStrike(ix).strike.getGlyphMetrics(glyphs[ix]); GlyphMetrics gm = new GlyphMetrics(true, adv.x, adv.y, diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopManager.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopManager.java index 355f70b4607..79d81bad089 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopManager.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsDesktopManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, 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 @@ -80,10 +80,13 @@ public final class WindowsDesktopManager extends DefaultDesktopManager if (f.isMaximizable()) { if (!f.isMaximum()) { f.setMaximum(true); - } else if (f.isMaximum() && f.isIcon()) { - f.setIcon(false); } else { - f.setMaximum(false); + // If frame being activated is set to maximised + // and iconified, let it be maximised + // else remain non-maximised + if (f.isIcon()) { + f.setIcon(false); + } } } } diff --git a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java index 130b09227cc..a7aca0c5ccf 100644 --- a/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java +++ b/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsMenuUI.java @@ -301,7 +301,7 @@ public final class WindowsMenuUI extends BasicMenuUI { JMenu menu = (JMenu)evt.getSource(); ButtonModel model = menu.getModel(); - if (menu.isRolloverEnabled()) { + if (menu.isRolloverEnabled() && menu.isTopLevelMenu()) { model.setRollover(false); menuItem.repaint(); } diff --git a/src/java.management/share/classes/sun/management/VMManagement.java b/src/java.management/share/classes/sun/management/VMManagement.java index 3e227225ccd..29391cf53ba 100644 --- a/src/java.management/share/classes/sun/management/VMManagement.java +++ b/src/java.management/share/classes/sun/management/VMManagement.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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,6 +48,9 @@ public interface VMManagement { public boolean isGcNotificationSupported(); public boolean isRemoteDiagnosticCommandsSupported(); + // AOT Subsystem + public boolean endAOTRecording(); + // Class Loading Subsystem public long getTotalClassCount(); public int getLoadedClassCount(); diff --git a/src/java.management/share/classes/sun/management/VMManagementImpl.java b/src/java.management/share/classes/sun/management/VMManagementImpl.java index b8c7a2921d4..0fd0d8ad562 100644 --- a/src/java.management/share/classes/sun/management/VMManagementImpl.java +++ b/src/java.management/share/classes/sun/management/VMManagementImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -117,6 +117,9 @@ class VMManagementImpl implements VMManagement { public native boolean isThreadCpuTimeEnabled(); public native boolean isThreadAllocatedMemoryEnabled(); + // AOT Subsystem + public native boolean endAOTRecording(); + // Class Loading Subsystem public int getLoadedClassCount() { long count = getTotalClassCount() - getUnloadedClassCount(); diff --git a/src/java.management/share/native/libmanagement/VMManagementImpl.c b/src/java.management/share/native/libmanagement/VMManagementImpl.c index d5141c71ee7..e6570d06bdd 100644 --- a/src/java.management/share/native/libmanagement/VMManagementImpl.c +++ b/src/java.management/share/native/libmanagement/VMManagementImpl.c @@ -101,6 +101,13 @@ Java_sun_management_VMManagementImpl_getVmArguments0 return JVM_GetVmArguments(env); } +JNIEXPORT jboolean JNICALL +Java_sun_management_VMManagementImpl_endAOTRecording + (JNIEnv *env, jobject dummy) +{ + return JVM_AOTEndRecording(env); +} + JNIEXPORT jlong JNICALL Java_sun_management_VMManagementImpl_getTotalClassCount (JNIEnv *env, jobject dummy) diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java index f9442df9ac4..35ce4972ed9 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Response.java @@ -30,6 +30,7 @@ import java.lang.System.Logger.Level; import java.lang.invoke.MethodHandles; import java.lang.invoke.VarHandle; import java.net.http.HttpResponse.BodySubscriber; +import java.net.ProtocolException; import java.nio.ByteBuffer; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -46,6 +47,7 @@ import jdk.internal.net.http.common.MinimalFuture; import jdk.internal.net.http.common.Utils; import static java.net.http.HttpClient.Version.HTTP_1_1; import static java.net.http.HttpResponse.BodySubscribers.discarding; +import static jdk.internal.net.http.common.Utils.readContentLength; import static jdk.internal.net.http.common.Utils.wrapWithExtraDetail; import static jdk.internal.net.http.RedirectFilter.HTTP_NOT_MODIFIED; @@ -272,16 +274,31 @@ class Http1Response { } /** - * Read up to MAX_IGNORE bytes discarding + * Reads the body, if it is present and less than {@value MAX_IGNORE} bytes. + * Otherwise, just the connection is closed. */ public CompletableFuture ignoreBody(Executor executor) { - int clen = (int)headers.firstValueAsLong("Content-Length").orElse(-1); - if (clen == -1 || clen > MAX_IGNORE) { + + // Read the `Content-Length` header + long clen; + try { + clen = readContentLength(headers, "", -1); + } catch (ProtocolException pe) { + return MinimalFuture.failedFuture(pe); + } + + // Read the body, if it is present and less than `MAX_IGNORE` bytes. + // + // We proceed with reading the body even when `Content-Length: 0` to + // ensure that the happy path is taken, and upon success, the connection + // is returned back to the pool. + if (clen != -1 && clen <= MAX_IGNORE) { + return readBody(discarding(), !request.isWebSocket(), executor); + } else { connection.close(); return MinimalFuture.completedFuture(null); // not treating as error - } else { - return readBody(discarding(), !request.isWebSocket(), executor); } + } // Used for those response codes that have no body associated @@ -308,11 +325,28 @@ class Http1Response { this.return2Cache = return2Cache; final BodySubscriber subscriber = p; - final CompletableFuture cf = new MinimalFuture<>(); - long clen0 = headers.firstValueAsLong("Content-Length").orElse(-1L); - final long clen = fixupContentLen(clen0); + Consumer errorNotifier = error -> { + try { + subscriber.onError(error); + cf.completeExceptionally(error); + } finally { + asyncReceiver.setRetryOnError(false); + asyncReceiver.onReadError(error); + } + }; + + // Read the content length + long clen; + try { + long clen0 = readContentLength(headers, "", -1); + clen = fixupContentLen(clen0); + } catch (ProtocolException pe) { + errorNotifier.accept(pe); + connection.close(pe); + return cf; + } // expect-continue reads headers and body twice. // if we reach here, we must reset the headersReader state. @@ -398,12 +432,7 @@ class Http1Response { } }); - ResponseSubscribers.getBodyAsync(executor, p, cf, (t) -> { - subscriber.onError(t); - cf.completeExceptionally(t); - asyncReceiver.setRetryOnError(false); - asyncReceiver.onReadError(t); - }); + ResponseSubscribers.getBodyAsync(executor, p, cf, errorNotifier); return cf.whenComplete((s,t) -> { if (t != null) { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http3ExchangeImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http3ExchangeImpl.java index 81475a47c4a..4625968682f 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http3ExchangeImpl.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http3ExchangeImpl.java @@ -81,6 +81,8 @@ import jdk.internal.net.http.qpack.writers.HeaderFrameWriter; import jdk.internal.net.http.quic.streams.QuicBidiStream; import jdk.internal.net.http.quic.streams.QuicStreamReader; import jdk.internal.net.http.quic.streams.QuicStreamWriter; + +import static jdk.internal.net.http.common.Utils.readContentLength; import static jdk.internal.net.http.http3.ConnectionSettings.UNLIMITED_MAX_FIELD_SECTION_SIZE; /** @@ -1293,12 +1295,16 @@ final class Http3ExchangeImpl extends Http3Stream { if (Set.of("PUT", "DELETE", "OPTIONS", "TRACE").contains(method)) { throw new ProtocolException("push method not allowed pushId=" + pushId); } - long clen = promiseHeaders.firstValueAsLong("Content-Length").orElse(-1); + + // Read & validate `Content-Length` + long clen = readContentLength( + promiseHeaders, "illegal push headers for pushId=%s: ".formatted(pushId), -1); if (clen > 0) { - throw new ProtocolException("push headers contain non-zero Content-Length for pushId=" + pushId); + throw new ProtocolException("push headers contain non-zero \"Content-Length\" for pushId=" + pushId); } + if (promiseHeaders.firstValue("Transfer-Encoding").isPresent()) { - throw new ProtocolException("push headers contain Transfer-Encoding for pushId=" + pushId); + throw new ProtocolException("push headers contain \"Transfer-Encoding\" for pushId=" + pushId); } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http3Stream.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http3Stream.java index cdac68b47f1..14e440a0e33 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http3Stream.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http3Stream.java @@ -31,7 +31,6 @@ import java.net.ProtocolException; import java.net.http.HttpHeaders; import java.nio.ByteBuffer; import java.util.List; -import java.util.OptionalLong; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicInteger; @@ -58,6 +57,8 @@ import jdk.internal.net.http.quic.streams.QuicStreamReader; import static jdk.internal.net.http.Exchange.MAX_NON_FINAL_RESPONSES; import static jdk.internal.net.http.RedirectFilter.HTTP_NOT_MODIFIED; +import static jdk.internal.net.http.common.Utils.readContentLength; +import static jdk.internal.net.http.common.Utils.readStatusCode; /** * A common super class for the HTTP/3 request/response stream ({@link Http3ExchangeImpl} @@ -606,23 +607,17 @@ sealed abstract class Http3Stream extends ExchangeImpl permits Http3Exchan } int responseCode; - boolean finalResponse = false; try { - responseCode = (int) responseHeaders - .firstValueAsLong(":status") - .orElseThrow(() -> new IOException("no statuscode in response")); - } catch (IOException | NumberFormatException exception) { + responseCode = readStatusCode(responseHeaders, ""); + } catch (ProtocolException pe) { // RFC-9114: 4.1.2. Malformed Requests and Responses: // "Malformed requests or responses that are // detected MUST be treated as a stream error of type H3_MESSAGE_ERROR" - cancelImpl(exception, Http3Error.H3_MESSAGE_ERROR); - return; - } - if (responseCode < 100 || responseCode > 999) { - cancelImpl(new IOException("Unexpected :status header value"), Http3Error.H3_MESSAGE_ERROR); + cancelImpl(pe, Http3Error.H3_MESSAGE_ERROR); return; } + boolean finalResponse = false; if (responseCode >= 200) { responseState = ResponseState.PERMIT_TRAILER; finalResponse = true; @@ -653,23 +648,21 @@ sealed abstract class Http3Stream extends ExchangeImpl permits Http3Exchan responseHeaders); } - try { - OptionalLong cl = responseHeaders.firstValueAsLong("content-length"); - if (finalResponse && cl.isPresent()) { - long cll = cl.getAsLong(); - if (cll < 0) { - cancelImpl(new IOException("Invalid content-length value "+cll), Http3Error.H3_MESSAGE_ERROR); - return; - } - if (!(exchange.request().method().equalsIgnoreCase("HEAD") || responseCode == HTTP_NOT_MODIFIED)) { - // HEAD response and 304 response might have a content-length header, - // but it carries no meaning - contentLength = cll; - } + if (finalResponse) { + long cl; + try { + cl = readContentLength(responseHeaders, "", -1); + } catch (ProtocolException pe) { + cancelImpl(pe, Http3Error.H3_MESSAGE_ERROR); + return; + } + if (cl != -1 && + !(exchange.request().method().equalsIgnoreCase("HEAD") || + responseCode == HTTP_NOT_MODIFIED)) { + // HEAD response and 304 response might have a content-length header, + // but it carries no meaning + contentLength = cl; } - } catch (NumberFormatException nfe) { - cancelImpl(nfe, Http3Error.H3_MESSAGE_ERROR); - return; } if (Log.headers() || debug.on()) { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java index 60eb55ec0ad..671874b8fb5 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java @@ -28,8 +28,11 @@ package jdk.internal.net.http; import java.io.IOException; import java.lang.ref.WeakReference; import java.net.ConnectException; +import java.net.ProtocolException; +import java.net.ProtocolException; import java.net.http.HttpClient.Version; import java.net.http.HttpConnectTimeoutException; +import java.net.http.HttpHeaders; import java.net.http.StreamLimitException; import java.time.Duration; import java.util.List; @@ -47,7 +50,6 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.Function; import java.net.http.HttpClient; -import java.net.http.HttpHeaders; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodySubscriber; @@ -62,6 +64,7 @@ import jdk.internal.net.http.common.Utils; import static jdk.internal.net.http.common.MinimalFuture.completedFuture; import static jdk.internal.net.http.common.MinimalFuture.failedFuture; import static jdk.internal.net.http.AltSvcProcessor.processAltSvcHeader; +import static jdk.internal.net.http.common.Utils.readContentLength; /** @@ -358,13 +361,22 @@ class MultiExchange implements Cancelable { return r.statusCode == 204; } - private boolean bodyIsPresent(Response r) { - HttpHeaders headers = r.headers(); - if (headers.firstValueAsLong("Content-length").orElse(0L) != 0L) - return true; - if (headers.firstValue("Transfer-encoding").isPresent()) - return true; - return false; + private void ensureNoBody(HttpHeaders headers) throws ProtocolException { + + // Check `Content-Length` + var contentLength = readContentLength(headers, "", 0); + if (contentLength > 0) { + throw new ProtocolException( + "Unexpected \"Content-Length\" header in a 204 response: " + contentLength); + } + + // Check `Transfer-Encoding` + var transferEncoding = headers.firstValue("Transfer-Encoding"); + if (transferEncoding.isPresent()) { + throw new ProtocolException( + "Unexpected \"Transfer-Encoding\" header in a 204 response: " + transferEncoding.get()); + } + } // Call the user's body handler to get an empty body object @@ -405,13 +417,13 @@ class MultiExchange implements Cancelable { if (bodyNotPermitted(r)) { // No response body consumption is expected, we can cancel the timer right away cancelTimer(); - if (bodyIsPresent(r)) { - IOException ioe = new IOException( - "unexpected content length header with 204 response"); - exch.cancel(ioe); - return MinimalFuture.failedFuture(ioe); - } else - return handleNoBody(r, exch); + try { + ensureNoBody(r.headers); + } catch (ProtocolException pe) { + exch.cancel(pe); + return MinimalFuture.failedFuture(pe); + } + return handleNoBody(r, exch); } return exch.readBodyAsync(responseHandler) .thenApply((T body) -> setNewResponse(r.request, r, body, exch)); diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java b/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java index bf9170f8f51..9826b280438 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java @@ -61,6 +61,7 @@ import jdk.internal.net.http.hpack.DecodingCallback; import static jdk.internal.net.http.AltSvcProcessor.processAltSvcFrame; import static jdk.internal.net.http.Exchange.MAX_NON_FINAL_RESPONSES; +import static jdk.internal.net.http.common.Utils.readStatusCode; /** * Http/2 Stream handling. @@ -615,18 +616,14 @@ class Stream extends ExchangeImpl { return null; } - protected void handleResponse(HeaderFrame hf) throws IOException { + protected void handleResponse(HeaderFrame hf) { HttpHeaders responseHeaders = responseHeadersBuilder.build(); if (!finalResponseCodeReceived) { try { - responseCode = (int) responseHeaders - .firstValueAsLong(":status") - .orElseThrow(() -> new ProtocolException(String.format( - "Stream %s PROTOCOL_ERROR: no status code in response", - streamid))); - } catch (ProtocolException cause) { - cancelImpl(cause, ResetFrame.PROTOCOL_ERROR); + responseCode = readStatusCode(responseHeaders, "Stream %s PROTOCOL_ERROR: ".formatted(streamid)); + } catch (ProtocolException pe) { + cancelImpl(pe, ResetFrame.PROTOCOL_ERROR); rspHeadersConsumer.reset(); return; } @@ -1730,21 +1727,18 @@ class Stream extends ExchangeImpl { HttpHeaders responseHeaders = responseHeadersBuilder.build(); if (!finalPushResponseCodeReceived) { - responseCode = (int)responseHeaders - .firstValueAsLong(":status") - .orElse(-1); - - if (responseCode == -1) { - cancelImpl(new ProtocolException("No status code"), ResetFrame.PROTOCOL_ERROR); + try { + responseCode = readStatusCode(responseHeaders, ""); + if (responseCode >= 100 && responseCode < 200) { + String protocolErrorMsg = checkInterimResponseCountExceeded(); + if (protocolErrorMsg != null) { + throw new ProtocolException(protocolErrorMsg); + } + } + } catch (ProtocolException pe) { + cancelImpl(pe, ResetFrame.PROTOCOL_ERROR); rspHeadersConsumer.reset(); return; - } else if (responseCode >= 100 && responseCode < 200) { - String protocolErrorMsg = checkInterimResponseCountExceeded(); - if (protocolErrorMsg != null) { - cancelImpl(new ProtocolException(protocolErrorMsg), ResetFrame.PROTOCOL_ERROR); - rspHeadersConsumer.reset(); - return; - } } this.finalPushResponseCodeReceived = true; diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java index 20b0338215c..e5ea07c3b97 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java @@ -39,6 +39,7 @@ import java.lang.System.Logger.Level; import java.net.ConnectException; import java.net.Inet6Address; import java.net.InetSocketAddress; +import java.net.ProtocolException; import java.net.SocketAddress; import java.net.StandardSocketOptions; import java.net.Proxy; @@ -1354,6 +1355,47 @@ public final class Utils { } // -- toAsciiString-like support to encode path and query URI segments + public static int readStatusCode(HttpHeaders headers, String errorPrefix) throws ProtocolException { + var s = headers.firstValue(":status").orElse(null); + if (s == null) { + throw new ProtocolException(errorPrefix + "missing status code"); + } + Throwable t = null; + int i = 0; + try { + i = Integer.parseInt(s); + } catch (NumberFormatException nfe) { + t = nfe; + } + if (t != null || i < 100 || i > 999) { + var pe = new ProtocolException(errorPrefix + "invalid status code: " + s); + pe.initCause(t); + throw pe; + } + return i; + } + + public static long readContentLength(HttpHeaders headers, String errorPrefix, long defaultIfMissing) throws ProtocolException { + var k = "Content-Length"; + var s = headers.firstValue(k).orElse(null); + if (s == null) { + return defaultIfMissing; + } + Throwable t = null; + long i = 0; + try { + i = Long.parseLong(s); + } catch (NumberFormatException nfe) { + t = nfe; + } + if (t != null || i < 0) { + var pe = new ProtocolException("%sinvalid \"%s\": %s".formatted(errorPrefix, k, s)); + pe.initCause(t); + throw pe; + } + return i; + } + // Encodes all characters >= \u0080 into escaped, normalized UTF-8 octets, // assuming that s is otherwise legal // diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/quic/ConnectionTerminatorImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/quic/ConnectionTerminatorImpl.java index 7870f4f1d8e..5e2384dce27 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/quic/ConnectionTerminatorImpl.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/quic/ConnectionTerminatorImpl.java @@ -344,10 +344,6 @@ final class ConnectionTerminatorImpl implements ConnectionTerminator { } } failHandshakeCFs(); - // remap the connection to a draining connection - final QuicEndpoint endpoint = this.connection.endpoint(); - assert endpoint != null : "QUIC endpoint is null"; - endpoint.draining(connection); discardConnectionState(); connection.streams.terminate(terminationCause); if (Log.quic()) { @@ -439,7 +435,7 @@ final class ConnectionTerminatorImpl implements ConnectionTerminator { final ProtectionRecord protectionRecord = ProtectionRecord.single(packet, connection::allocateDatagramForEncryption); // while sending the packet containing the CONNECTION_CLOSE frame, the pushDatagram will - // remap (or remove) the QuicConnectionImpl in QuicEndpoint. + // remap the QuicConnectionImpl in QuicEndpoint. connection.pushDatagram(protectionRecord); } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicConnectionImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicConnectionImpl.java index c07df1c6eb2..580bbe23d31 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicConnectionImpl.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicConnectionImpl.java @@ -2811,7 +2811,7 @@ public class QuicConnectionImpl extends QuicConnection implements QuicPacketRece // a CONNECTION_CLOSE frame is being sent to the peer when the local // connection state is in DRAINING. This implies that the local endpoint // is responding to an incoming CONNECTION_CLOSE frame from the peer. - // we remove the connection from the endpoint for such cases. + // we switch this connection to one that does not respond to incoming packets. endpoint.pushClosedDatagram(this, peerAddress(), datagram); } else if (stateHandle.isMarked(QuicConnectionState.CLOSING)) { // a CONNECTION_CLOSE frame is being sent to the peer when the local diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicEndpoint.java b/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicEndpoint.java index b1de5ef4bfd..91b4a678a23 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicEndpoint.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/quic/QuicEndpoint.java @@ -1509,7 +1509,8 @@ public abstract sealed class QuicEndpoint implements AutoCloseable /** * Called to schedule sending of a datagram that contains a single {@code ConnectionCloseFrame} * sent in response to a {@code ConnectionClose} frame. - * This will completely remove the connection from the connection map. + * This will replace the {@link QuicConnectionImpl} with a {@link DrainingConnection} that + * will discard all incoming packets. * @param connection the connection being closed * @param destination the peer address * @param datagram the datagram @@ -1518,7 +1519,7 @@ public abstract sealed class QuicEndpoint implements AutoCloseable InetSocketAddress destination, ByteBuffer datagram) { if (debug.on()) debug.log("Pushing closed datagram for " + connection.logTag()); - removeConnection(connection); + draining(connection); pushDatagram(connection, destination, datagram); } @@ -1581,34 +1582,30 @@ public abstract sealed class QuicEndpoint implements AutoCloseable peerIssuedResetTokens.replaceAll((tok, c) -> c == from ? to : c); } - public void draining(final QuicPacketReceiver connection) { + public void draining(final QuicConnectionImpl connection) { // remap the connection to a DrainingConnection if (closed) return; + + final long idleTimeout = connection.peerPtoMs() * 3; // 3 PTO + connection.localConnectionIdManager().close(); + DrainingConnection draining = new DrainingConnection(connection.connectionIds(), idleTimeout); + // we can ignore stateless reset in the draining state. + remapPeerIssuedResetToken(connection, draining); + connection.connectionIds().forEach((id) -> - connections.compute(id, this::remapDraining)); + connections.compute(id, (i, r) -> remapDraining(i, r, draining))); + draining.startTimer(); assert !connections.containsValue(connection) : connection; } - private DrainingConnection remapDraining(QuicConnectionId id, QuicPacketReceiver conn) { + private DrainingConnection remapDraining(QuicConnectionId id, QuicPacketReceiver conn, DrainingConnection draining) { if (closed) return null; var debugOn = debug.on() && !Thread.currentThread().isVirtual(); - if (conn instanceof ClosingConnection closing) { + if (conn instanceof QuicConnectionImpl || conn instanceof ClosingConnection) { if (debugOn) debug.log("remapping %s to DrainingConnection", id); - final var draining = closing.toDraining(); - remapPeerIssuedResetToken(closing, draining); - draining.startTimer(); - return draining; - } else if (conn instanceof DrainingConnection draining) { - return draining; - } else if (conn instanceof QuicConnectionImpl impl) { - final long idleTimeout = impl.peerPtoMs() * 3; // 3 PTO - impl.localConnectionIdManager().close(); - if (debugOn) debug.log("remapping %s to DrainingConnection", id); - var draining = new DrainingConnection(conn.connectionIds(), idleTimeout); - // we can ignore stateless reset in the draining state. - remapPeerIssuedResetToken(impl, draining); - draining.startTimer(); return draining; + } else if (conn instanceof DrainingConnection d) { + return d; } else if (conn == null) { // connection absent (was probably removed), don't remap to draining if (debugOn) { @@ -1623,30 +1620,32 @@ public abstract sealed class QuicEndpoint implements AutoCloseable protected void closing(QuicConnectionImpl connection, ByteBuffer datagram) { if (closed) return; - ByteBuffer closing = ByteBuffer.allocate(datagram.limit()); - closing.put(datagram.slice()); - closing.flip(); + ByteBuffer closingDatagram = ByteBuffer.allocate(datagram.limit()); + closingDatagram.put(datagram.slice()); + closingDatagram.flip(); + + final long idleTimeout = connection.peerPtoMs() * 3; // 3 PTO + connection.localConnectionIdManager().close(); + var closingConnection = new ClosingConnection(connection.connectionIds(), idleTimeout, datagram); + remapPeerIssuedResetToken(connection, closingConnection); + connection.connectionIds().forEach((id) -> - connections.compute(id, (i, r) -> remapClosing(i, r, closing))); + connections.compute(id, (i, r) -> remapClosing(i, r, closingConnection))); + closingConnection.startTimer(); assert !connections.containsValue(connection) : connection; } - private ClosedConnection remapClosing(QuicConnectionId id, QuicPacketReceiver conn, ByteBuffer datagram) { + private ClosedConnection remapClosing(QuicConnectionId id, QuicPacketReceiver conn, ClosingConnection closingConnection) { if (closed) return null; var debugOn = debug.on() && !Thread.currentThread().isVirtual(); - if (conn instanceof ClosingConnection closing) { + if (conn instanceof QuicConnectionImpl) { + if (debugOn) debug.log("remapping %s to ClosingConnection", id); + return closingConnection; + } else if (conn instanceof ClosingConnection closing) { // we already have a closing datagram, drop the new one return closing; } else if (conn instanceof DrainingConnection draining) { return draining; - } else if (conn instanceof QuicConnectionImpl impl) { - final long idleTimeout = impl.peerPtoMs() * 3; // 3 PTO - impl.localConnectionIdManager().close(); - if (debugOn) debug.log("remapping %s to ClosingConnection", id); - var closing = new ClosingConnection(conn.connectionIds(), idleTimeout, datagram); - remapPeerIssuedResetToken(impl, closing); - closing.startTimer(); - return closing; } else if (conn == null) { // connection absent (was probably removed), don't remap to closing if (debugOn) { @@ -1896,10 +1895,6 @@ public abstract sealed class QuicEndpoint implements AutoCloseable debug.log("ClosingConnection(%s): dropping %s packet", localConnectionIds, headersType); } } - - private DrainingConnection toDraining() { - return new DrainingConnection(localConnectionIds, maxIdleTimeMs); - } } /** diff --git a/src/java.security.sasl/share/classes/com/sun/security/sasl/Provider.java b/src/java.security.sasl/share/classes/com/sun/security/sasl/Provider.java index c3d4cdcc54b..6a6c1bb3ce3 100644 --- a/src/java.security.sasl/share/classes/com/sun/security/sasl/Provider.java +++ b/src/java.security.sasl/share/classes/com/sun/security/sasl/Provider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -24,6 +24,7 @@ */ package com.sun.security.sasl; +import java.io.Serial; import java.security.NoSuchAlgorithmException; import java.security.InvalidParameterException; import java.security.ProviderException; @@ -45,6 +46,7 @@ import static sun.security.util.SecurityConstants.PROVIDER_VER; public final class Provider extends java.security.Provider { + @Serial private static final long serialVersionUID = 8622598936488630849L; private static final String info = "Sun SASL provider" + diff --git a/src/java.security.sasl/share/classes/javax/security/sasl/AuthenticationException.java b/src/java.security.sasl/share/classes/javax/security/sasl/AuthenticationException.java index b61981bc16f..c9c3a274c44 100644 --- a/src/java.security.sasl/share/classes/javax/security/sasl/AuthenticationException.java +++ b/src/java.security.sasl/share/classes/javax/security/sasl/AuthenticationException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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,6 +25,8 @@ package javax.security.sasl; +import java.io.Serial; + /** * This exception is thrown by a SASL mechanism implementation * to indicate that the SASL @@ -79,5 +81,6 @@ public class AuthenticationException extends SaslException { } /** Use serialVersionUID from JSR 28 RI for interoperability */ + @Serial private static final long serialVersionUID = -3579708765071815007L; } diff --git a/src/java.security.sasl/share/classes/javax/security/sasl/AuthorizeCallback.java b/src/java.security.sasl/share/classes/javax/security/sasl/AuthorizeCallback.java index e0f323d36c9..a254159229b 100644 --- a/src/java.security.sasl/share/classes/javax/security/sasl/AuthorizeCallback.java +++ b/src/java.security.sasl/share/classes/javax/security/sasl/AuthorizeCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, 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,6 +25,8 @@ package javax.security.sasl; +import java.io.Serial; + import javax.security.auth.callback.Callback; /** @@ -141,5 +143,6 @@ public class AuthorizeCallback implements Callback, java.io.Serializable { authorizedID = id; } + @Serial private static final long serialVersionUID = -2353344186490470805L; } diff --git a/src/java.security.sasl/share/classes/javax/security/sasl/RealmCallback.java b/src/java.security.sasl/share/classes/javax/security/sasl/RealmCallback.java index af14158aa77..4d87b4da9d9 100644 --- a/src/java.security.sasl/share/classes/javax/security/sasl/RealmCallback.java +++ b/src/java.security.sasl/share/classes/javax/security/sasl/RealmCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, 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,6 +25,8 @@ package javax.security.sasl; +import java.io.Serial; + import javax.security.auth.callback.TextInputCallback; /** @@ -63,5 +65,6 @@ public class RealmCallback extends TextInputCallback { super(prompt, defaultRealmInfo); } + @Serial private static final long serialVersionUID = -4342673378785456908L; } diff --git a/src/java.security.sasl/share/classes/javax/security/sasl/RealmChoiceCallback.java b/src/java.security.sasl/share/classes/javax/security/sasl/RealmChoiceCallback.java index 61d9c0edd35..6a782268fb6 100644 --- a/src/java.security.sasl/share/classes/javax/security/sasl/RealmChoiceCallback.java +++ b/src/java.security.sasl/share/classes/javax/security/sasl/RealmChoiceCallback.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2025, 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,6 +25,8 @@ package javax.security.sasl; +import java.io.Serial; + import javax.security.auth.callback.ChoiceCallback; /** @@ -58,5 +60,6 @@ public class RealmChoiceCallback extends ChoiceCallback { super(prompt, choices, defaultChoice, multiple); } + @Serial private static final long serialVersionUID = -8588141348846281332L; } diff --git a/src/java.security.sasl/share/classes/javax/security/sasl/SaslException.java b/src/java.security.sasl/share/classes/javax/security/sasl/SaslException.java index 0398d8d7277..4d07eb18d36 100644 --- a/src/java.security.sasl/share/classes/javax/security/sasl/SaslException.java +++ b/src/java.security.sasl/share/classes/javax/security/sasl/SaslException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, 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,6 +26,7 @@ package javax.security.sasl; import java.io.IOException; +import java.io.Serial; /** * This class represents an error that has occurred when using SASL. @@ -125,5 +126,6 @@ public class SaslException extends IOException { } /** Use serialVersionUID from JSR 28 RI for interoperability */ + @Serial private static final long serialVersionUID = 4579784287983423626L; } diff --git a/src/jdk.accessibility/windows/native/jabswitch/jabswitch.cpp b/src/jdk.accessibility/windows/native/jabswitch/jabswitch.cpp index 62546b4dd78..fdd7ff524da 100644 --- a/src/jdk.accessibility/windows/native/jabswitch/jabswitch.cpp +++ b/src/jdk.accessibility/windows/native/jabswitch/jabswitch.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, 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 @@ -226,9 +226,9 @@ int modify(bool enable) { printf("Couldn't create file: %s\n", path); perror("Error"); } else { - char str[100] = "assistive_technologies=com.sun.java.accessibility.AccessBridge\n"; - strcat_s(str, "screen_magnifier_present=true\n"); - fprintf(origFile, str); + fprintf(origFile, "%s", + "assistive_technologies=com.sun.java.accessibility.AccessBridge\n" + "screen_magnifier_present=true\n"); fclose(origFile); } } else { @@ -314,11 +314,11 @@ void printVersion() { pVSInfo->dwProductVersionMS & 0xFFFF, pVSInfo->dwProductVersionLS >> 16, pVSInfo->dwProductVersionLS & 0xFFFF ); - char outputString[100]; - strcpy_s(outputString, "jabswitch "); - strcat_s(outputString, versionString); - strcat_s(outputString, "\njabswitch enables or disables the Java Access Bridge.\n"); - printf(outputString); + printf( + "jabswitch %s\n" + "jabswitch enables or disables the Java Access Bridge.\n", + versionString + ); } int regEnable() { diff --git a/src/jdk.accessibility/windows/native/toolscommon/AccessInfo.cpp b/src/jdk.accessibility/windows/native/toolscommon/AccessInfo.cpp index b9cd8434fc7..256f123c83a 100644 --- a/src/jdk.accessibility/windows/native/toolscommon/AccessInfo.cpp +++ b/src/jdk.accessibility/windows/native/toolscommon/AccessInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -97,8 +97,7 @@ void logString(FILE *logfile, const char *msg, ...) { va_start(argprt, msg); vsnprintf(tmpbuf, sizeof(tmpbuf), msg, argprt); - fprintf(logfile, tmpbuf); - fprintf(logfile, "\n"); + fprintf(logfile, "%s\n", tmpbuf); fflush(logfile); } diff --git a/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java b/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java index 5c786db1366..a7a348affe3 100644 --- a/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java +++ b/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java @@ -28,9 +28,13 @@ import com.sun.tools.attach.AgentLoadException; import com.sun.tools.attach.AttachNotSupportedException; import com.sun.tools.attach.spi.AttachProvider; +import sun.jvmstat.PlatformSupport; + import java.io.InputStream; import java.io.IOException; import java.io.File; +import java.nio.file.Files; +import java.nio.file.Path; import static java.nio.charset.StandardCharsets.UTF_8; @@ -39,14 +43,17 @@ import static java.nio.charset.StandardCharsets.UTF_8; */ @SuppressWarnings("restricted") public class VirtualMachineImpl extends HotSpotVirtualMachine { - // "tmpdir" is used as a global well-known location for the files - // .java_pid. and .attach_pid. It is important that this - // location is the same for all processes, otherwise the tools - // will not be able to find all Hotspot processes. - // This is intentionally not the same as java.io.tmpdir, since - // the latter can be changed by the user. - // Any changes to this needs to be synchronized with HotSpot. - private static final String tmpdir; + + /** + * HotSpot PerfData file prefix + */ + private static final String HSPERFDATA_PREFIX = "hsperfdata_"; + + /** + * Use platform specific methods for looking up temporary directories. + */ + private static final PlatformSupport platformSupport = PlatformSupport.getInstance(); + String socket_path; private OperationProperties props = new OperationProperties(VERSION_1); // updated in ctor @@ -67,10 +74,12 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { // Find the socket file. If not found then we attempt to start the // attach mechanism in the target VM by sending it a QUIT signal. // Then we attempt to find the socket file again. - File socket_file = new File(tmpdir, ".java_pid" + pid); + // In macOS the socket file is located in per-user temp directory. + String tempdir = getTempDirFromPid(pid); + File socket_file = new File(tempdir, ".java_pid" + pid); socket_path = socket_file.getPath(); if (!socket_file.exists()) { - File f = createAttachFile(pid); + File f = createAttachFile(tempdir, pid); try { checkCatchesAndSendQuitTo(pid, false); @@ -211,12 +220,34 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { } } - private File createAttachFile(int pid) throws IOException { + private File createAttachFile(String tmpdir, int pid) throws IOException { File f = new File(tmpdir, ".attach_pid" + pid); createAttachFile0(f.getPath()); return f; } + /* + * Returns a platform-specific temporary directory for a given process. + * In VMs running as unprivileged user it returns the default platform-specific + * temporary directory. In VMs running as root it searches over the list of + * temporary directories for one containing HotSpot PerfData directory. + */ + private String getTempDirFromPid(int pid) { + ProcessHandle ph = ProcessHandle.of(pid).orElse(null); + if (ph != null) { + String user = ph.info().user().orElse(null); + if (user != null) { + for (String dir : platformSupport.getTemporaryDirectories(pid)) { + Path fullPath = Path.of(dir, HSPERFDATA_PREFIX + user, String.valueOf(pid)); + if (Files.exists(fullPath)) { + return dir; + } + } + } + } + return PlatformSupport.getTemporaryDirectory(); + } + //-- native methods static native boolean checkCatchesAndSendQuitTo(int pid, boolean throwIfNotReady) throws IOException, AttachNotSupportedException; @@ -235,10 +266,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { static native void createAttachFile0(String path); - static native String getTempDir(); - static { System.loadLibrary("attach"); - tmpdir = getTempDir(); } } diff --git a/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c b/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c index d105d7d3b1b..5b2579eba39 100644 --- a/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c +++ b/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -335,27 +335,3 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_createAttachFile JNU_ReleaseStringPlatformChars(env, path, _path); } } - -/* - * Class: sun_tools_attach_BSDVirtualMachine - * Method: getTempDir - * Signature: (V)Ljava.lang.String; - */ -JNIEXPORT jstring JNICALL Java_sun_tools_attach_VirtualMachineImpl_getTempDir(JNIEnv *env, jclass cls) -{ - // This must be hard coded because it's the system's temporary - // directory not the java application's temp directory, ala java.io.tmpdir. - -#ifdef __APPLE__ - // macosx has a secure per-user temporary directory. - // Don't cache the result as this is only called once. - char path[PATH_MAX]; - int pathSize = confstr(_CS_DARWIN_USER_TEMP_DIR, path, PATH_MAX); - if (pathSize == 0 || pathSize > PATH_MAX) { - strlcpy(path, "/tmp", sizeof(path)); - } - return JNU_NewStringPlatform(env, path); -#else /* __APPLE__ */ - return (*env)->NewStringUTF(env, "/tmp"); -#endif /* __APPLE__ */ -} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java index 3f72ada94e8..cc21113882f 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java @@ -5634,12 +5634,16 @@ public class Attr extends JCTree.Visitor { chk.validateRepeatable(c, repeatable, cbPos); } } else { - // Check that all extended classes and interfaces - // are compatible (i.e. no two define methods with same arguments - // yet different return types). (JLS 8.4.8.3) - chk.checkCompatibleSupertypes(tree.pos(), c.type); - chk.checkDefaultMethodClashes(tree.pos(), c.type); - chk.checkPotentiallyAmbiguousOverloads(tree, c.type); + try { + // Check that all extended classes and interfaces + // are compatible (i.e. no two define methods with same arguments + // yet different return types). (JLS 8.4.8.3) + chk.checkCompatibleSupertypes(tree.pos(), c.type); + chk.checkDefaultMethodClashes(tree.pos(), c.type); + chk.checkPotentiallyAmbiguousOverloads(tree, c.type); + } catch (CompletionFailure cf) { + chk.completionError(tree.pos(), cf); + } } // Check that class does not import the same parameterized interface diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java index b13c9e0fe2b..22cb796870b 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java @@ -1152,7 +1152,7 @@ public class LambdaToMethod extends TreeTranslator { propagateAnnos = false; break; case LOCAL_VAR: - ret = new VarSymbol(sym.flags() & FINAL, sym.name, sym.type, translatedSym); + ret = new VarSymbol(sym.flags(), sym.name, sym.type, translatedSym); ret.pos = sym.pos; // If sym.data == ElementKind.EXCEPTION_PARAMETER, // set ret.data = ElementKind.EXCEPTION_PARAMETER too. @@ -1164,7 +1164,8 @@ public class LambdaToMethod extends TreeTranslator { } break; case PARAM: - ret = new VarSymbol((sym.flags() & FINAL) | PARAMETER, sym.name, types.erasure(sym.type), translatedSym); + Assert.check((sym.flags() & PARAMETER) != 0); + ret = new VarSymbol(sym.flags(), sym.name, types.erasure(sym.type), translatedSym); ret.pos = sym.pos; break; default: diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java index 07f2a742bcb..d88180bb15c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java @@ -3843,12 +3843,15 @@ public class Resolve { Env env1 = env; boolean staticOnly = false; while (env1.outer != null) { + // If the local class is defined inside a static method, and the instance creation expression + // occurs in that same method, the creation occurs (technically) inside a static context, but that's ok. if (env1.info.scope.owner == owner) { return (staticOnly) ? new BadLocalClassCreation(c) : owner; + } else if (isStatic(env1) || env1.enclClass.sym.isStatic()) { + staticOnly = true; } - if (isStatic(env1)) staticOnly = true; env1 = env1.outer; } return owner.kind == MTH ? diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties index 0787c839cb4..b8fa413adba 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_de.properties @@ -292,10 +292,10 @@ compiler.err.annotation.decl.not.allowed.here=Annotationsschnittstellendeklarati compiler.err.cant.inherit.from.final=Erben aus finalem {0}-Element nicht möglich # 0: symbol or name -compiler.err.cant.ref.before.ctor.called={0} kann nicht referenziert werden, bevor der Supertypkonstruktor aufgerufen wurde +compiler.err.cant.ref.before.ctor.called=Referenz zu {0} darf nur nach einem expliziten Konstruktoraufruf angezeigt werden # 0: symbol or name -compiler.err.cant.assign.initialized.before.ctor.called=Initialisiertes Feld "{0}" kann nicht zugewiesen werden, bevor der Supertypkonstruktor aufgerufen wurde +compiler.err.cant.assign.initialized.before.ctor.called=Zuweisung zu initialisiertem Feld "{0}" darf nur nach einem expliziten Konstruktoraufruf angezeigt werden compiler.err.cant.select.static.class.from.param.type=Statische Klasse kann nicht aus einem parametrisierten Typ ausgewählt werden @@ -649,11 +649,14 @@ compiler.err.limit.string.overflow=UTF8-Darstellung für Zeichenfolge "{0}..." i compiler.err.malformed.fp.lit=Nicht wohlgeformtes Gleitkommaliteral -compiler.err.method.does.not.override.superclass=Methode überschreibt oder implementiert keine Methode aus einem Supertyp +# 0: symbol, 1: symbol +compiler.err.method.does.not.override.superclass={0} in {1} überschreibt oder implementiert keine Methode aus einem Supertyp -compiler.err.static.methods.cannot.be.annotated.with.override=Statische Methoden können nicht mit @Override-Annotation versehen werden +# 0: symbol, 1: symbol +compiler.err.static.methods.cannot.be.annotated.with.override=Statische Methode {0} in {1} kann nicht mit @Override-Annotation versehen werden -compiler.err.missing.meth.body.or.decl.abstract=Methodenbody fehlt oder als abstrakt deklarieren +# 0: symbol, 1: symbol +compiler.err.missing.meth.body.or.decl.abstract=In Methode {0} in {1} fehlt ein Methodenbody, oder sie muss als abstrakt deklariert werden compiler.err.missing.ret.stmt=Rückgabeanweisung fehlt @@ -1139,6 +1142,7 @@ compiler.err.multi-module.outdir.cannot.be.exploded.module=Im Modus für mehrere # 0: path # lint: path +# flags: default-enabled compiler.warn.outdir.is.in.exploded.module=Das Ausgabeverzeichnis befindet sich in einem entpackten Modul: {0} # 0: file object @@ -1198,6 +1202,7 @@ compiler.warn.output.file.clash=Ausgabedatei mehrmals geschrieben: {0} ## The following string will appear before all messages keyed as: ## "compiler.note". +# flags: mandatory compiler.note.compressed.diags=Einige Meldungen wurden vereinfacht. Wiederholen Sie die Kompilierung mit -Xdiags:verbose, um die vollständige Ausgabe abzurufen # 0: boolean, 1: symbol @@ -1378,17 +1383,17 @@ compiler.warn.incubating.modules=Inkubatormodul(e) verwendet: {0} # 0: symbol, 1: symbol # lint: deprecation -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated={0} in {1} ist veraltet # 0: symbol, 1: symbol # lint: removal -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.for.removal={0} in {1} ist veraltet und wurde zum Entfernen markiert # 0: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.is.preview={0} ist eine Vorschau-API, die in einem zukünftigen Release entfernt werden kann. # 0: symbol @@ -1396,7 +1401,7 @@ compiler.err.is.preview={0} ist eine Vorschau-API, die standardmäßig deaktivie # 0: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.is.preview.reflective={0} ist eine reflektive Vorschau-API, die in einem zukünftigen Release entfernt werden kann. # 0: symbol, 1: symbol @@ -1405,12 +1410,12 @@ compiler.warn.restricted.method={0}.{1} ist eine eingeschränkte Methode.\n(Eing # 0: symbol # lint: deprecation -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.module=Modul {0} ist veraltet # 0: symbol # lint: removal -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.for.removal.module=Modul {0} ist veraltet und wurde zum Entfernen markiert # 0: symbol @@ -1583,10 +1588,12 @@ compiler.warn.static.not.qualified.by.type2={0} (statisch) darf nicht als Member # 0: string, 1: fragment # lint: options +# flags: default-enabled compiler.warn.source.no.bootclasspath=Bootstrap Classpath ist nicht zusammen mit -source {0} festgelegt\n{1} # 0: string, 1: fragment # lint: options +# flags: default-enabled compiler.warn.source.no.system.modules.path=Systemmodulpfad ist nicht zusammen mit -source {0} festgelegt\n{1} # 0: string @@ -1603,10 +1610,12 @@ compiler.misc.source.no.system.modules.path.with.target=Wenn Sie den Speicherort # 0: string # lint: options +# flags: default-enabled compiler.warn.option.obsolete.source=Quellwert {0} ist veraltet und wird in einem zukünftigen Release entfernt # 0: target # lint: options +# flags: default-enabled compiler.warn.option.obsolete.target=Zielwert {0} ist veraltet und wird in einem zukünftigen Release entfernt # 0: string, 1: string @@ -1616,12 +1625,17 @@ compiler.err.option.removed.source=Quelloption {0} wird nicht mehr unterstützt. compiler.err.option.removed.target=Zieloption {0} wird nicht mehr unterstützt. Verwenden Sie {1} oder höher. # lint: options +# flags: default-enabled compiler.warn.option.obsolete.suppression=Verwenden Sie -Xlint:-options, um Warnungen zu veralteten Optionen zu unterdrücken. # 0: name, 1: number, 2: number, 3: number, 4: number # lint: classfile compiler.warn.future.attr={0}-Attribut, das in Klassendateien der Version {1}.{2} eingeführt wurde, wird in Klassendateien der Version {3}.{4} ignoriert +# 0: symbol, 1: file object +# lint: classfile +compiler.warn.inconsistent.inner.classes=InnerClasses-Attribut für {0} in {1} inkonsistent mit Quellcode\n({1} muss möglicherweise mit {0} neu kompiliert werden) + # lint: requires-automatic compiler.warn.requires.automatic=Erfordert Direktive für ein automatisches Modul @@ -1706,17 +1720,21 @@ compiler.warn.try.resource.not.referenced=Automatisch schließbare Ressource {0} # lint: try compiler.warn.try.resource.throws.interrupted.exc=Automatisch schließbare Ressource {0} umfasst die Mitgliedsmethode close(), die InterruptedException auslösen könnte +# 0: type +# lint: try +compiler.warn.try.resource.can.throw.interrupted.exc=close()-Methode kann InterruptedException in automatisch schließbarer Klasse {0} auslösen + # lint: unchecked compiler.warn.unchecked.assign=Nicht geprüfte Zuweisung: {0} zu {1} # 0: symbol, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.assign.to.var=Nicht geprüfte Zuweisung zu Variable {0} als Mitglied des Raw-Typs {1} # 0: symbol, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.call.mbr.of.raw.type=Nicht geprüfter Aufruf von {0} als Mitglied des Raw-Typs {1} # lint: unchecked @@ -1724,17 +1742,17 @@ compiler.warn.unchecked.cast.to.type=Nicht geprüftes Casting zu Typ {0} # 0: kind name, 1: name, 2: object, 3: object, 4: kind name, 5: symbol # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.meth.invocation.applied=Nicht geprüfter Methodenaufruf: {0} {1} in {4} {5} wird auf die angegebenen Typen angewendet\nErforderlich: {2}\nErmittelt: {3} # 0: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.generic.array.creation=Nicht geprüfte Erstellung eines generischen Arrays für varargs-Parameter des Typs {0} # 0: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.varargs.non.reifiable.type=Möglich Heap-Beschädigung aus parametrisiertem vararg-Typ {0} # 0: symbol @@ -1772,6 +1790,10 @@ compiler.err.no.zipfs.for.archive=Kein Dateisystemprovider zur Verarbeitung dies # lint: divzero compiler.warn.div.zero=Division durch Null +# 0: type, 1: long, 2: number +# lint: lossy-conversions +compiler.warn.bit.shift.out.of.range=Das Verschieben von {0} um {1} Bit entspricht einer Verschiebung um {2} Bit + # lint: empty compiler.warn.empty.if=Leere Anweisung nach "if" @@ -2023,7 +2045,7 @@ compiler.misc.prob.found.req=Inkompatible Typen: {0} # 0: message segment, 1: type, 2: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.prob.found.req={0}\nErforderlich: {2}\nErmittelt: {1} # 0: type, 1: type @@ -2297,12 +2319,12 @@ compiler.err.override.incompatible.ret={0}\nRückgabetyp {1} ist nicht mit {2} k # 0: message segment, 1: type, 2: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.override.unchecked.ret={0}\nRückgabetyp erfordert eine nicht geprüfte Konvertierung von {1} in {2} # 0: message segment, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.override.unchecked.thrown={0}\nAußer Kraft gesetzte Methode löst nicht {1} aus # 0: symbol @@ -2377,16 +2399,17 @@ compiler.err.preview.feature.disabled.classfile=Klassendatei für {0} verwendet # 0: message segment (feature) # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.preview.feature.use={0} ist ein Vorschaufeature, das in einem zukünftigen Release entfernt werden kann. # 0: message segment (feature) # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.preview.feature.use.plural={0} sind ein Vorschaufeature, das in einem zukünftigen Release entfernt werden kann. # 0: file object (classfile), 1: string (expected version) # lint: preview +# flags: mandatory compiler.warn.preview.feature.use.classfile=Klassendatei für {0} verwendet Vorschaufeatures von Java SE {1}. compiler.misc.feature.modules=Module @@ -2783,6 +2806,7 @@ compiler.err.bad.name.for.option=Ungültiger Name im Wert für {0}-Option: "{1}" # 0: option name, 1: symbol # lint: options +# flags: default-enabled compiler.warn.module.for.option.not.found=Modulname in {0}-Option nicht gefunden: {1} compiler.err.addmods.all.module.path.invalid=--add-modules ALL-MODULE-PATH kann nur beim Kompilieren des unbenannten Moduls oder beim Kompilieren im Kontext eines automatischen Moduls verwendet werden @@ -2794,6 +2818,7 @@ compiler.err.add.exports.with.release=Export eines Packages aus Systemmodul {0} compiler.err.add.reads.with.release=Hinzufügen von Lese-Edges für Systemmodul {0} ist mit --release nicht zulässig # lint: options +# flags: default-enabled compiler.warn.addopens.ignored=--add-opens hat zur Kompilierungszeit keine Auswirkungen compiler.misc.locn.module_source_path=Modulquellpfad @@ -3060,7 +3085,7 @@ compiler.err.incorrect.number.of.nested.patterns=Falsche Anzahl verschachtelter # 0: kind name, 1: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.declared.using.preview={0} {1} ist mit einem Vorschaufeature deklariert, das in einem zukünftigen Release entfernt werden kann. # lint: identity diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties index 291d8aeeec5..89bdc893a43 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties @@ -292,10 +292,10 @@ compiler.err.annotation.decl.not.allowed.here=ここでは注釈インタフェ compiler.err.cant.inherit.from.final=final {0}からは継承できません # 0: symbol or name -compiler.err.cant.ref.before.ctor.called=スーパータイプのコンストラクタの呼出し前は{0}を参照できません +compiler.err.cant.ref.before.ctor.called={0}への参照は、明示的なコンストラクタの呼出しの後にのみ表示されます # 0: symbol or name -compiler.err.cant.assign.initialized.before.ctor.called=スーパータイプのコンストラクタの呼出し前は、初期化されたフィールド''{0}''を割り当てられません +compiler.err.cant.assign.initialized.before.ctor.called=初期化されたフィールド''{0}''への割当ては、明示的なコンストラクタの呼出しの後にのみ表示されます compiler.err.cant.select.static.class.from.param.type=パラメータにされた型からstaticクラスを選択することはできません @@ -649,11 +649,14 @@ compiler.err.limit.string.overflow=文字列"{0}..."のUTF8表現が、定数プ compiler.err.malformed.fp.lit=浮動小数点リテラルが不正です -compiler.err.method.does.not.override.superclass=メソッドはスーパータイプのメソッドをオーバーライドまたは実装しません +# 0: symbol, 1: symbol +compiler.err.method.does.not.override.superclass={1}の{0}はスーパータイプのメソッドをオーバーライドまたは実装しません -compiler.err.static.methods.cannot.be.annotated.with.override=staticメソッドは@Overrideで注釈付けすることはできません +# 0: symbol, 1: symbol +compiler.err.static.methods.cannot.be.annotated.with.override={1}のstaticメソッド{0}は@Overrideで注釈付けすることはできません -compiler.err.missing.meth.body.or.decl.abstract=メソッド本体がないか、abstractとして宣言されています +# 0: symbol, 1: symbol +compiler.err.missing.meth.body.or.decl.abstract={1}のメソッド{0}にメソッド本体がないか、abstractを宣言する必要があります compiler.err.missing.ret.stmt=return文が指定されていません @@ -1139,6 +1142,7 @@ compiler.err.multi-module.outdir.cannot.be.exploded.module=複数モジュール # 0: path # lint: path +# flags: default-enabled compiler.warn.outdir.is.in.exploded.module=出力ディレクトリは展開したモジュール内です: {0} # 0: file object @@ -1198,6 +1202,7 @@ compiler.warn.output.file.clash=出力ファイルへの書込みが複数回あ ## The following string will appear before all messages keyed as: ## "compiler.note". +# flags: mandatory compiler.note.compressed.diags=一部のメッセージは簡略化されています。-Xdiags:verboseで再コンパイルして完全な出力を取得してください # 0: boolean, 1: symbol @@ -1378,17 +1383,17 @@ compiler.warn.incubating.modules=実験的なモジュールを使用してい # 0: symbol, 1: symbol # lint: deprecation -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated={1}の{0}は推奨されません # 0: symbol, 1: symbol # lint: removal -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.for.removal={1}の{0}は推奨されておらず、削除用にマークされています # 0: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.is.preview={0}はプレビューAPIであり、今後のリリースで削除される可能性があります。 # 0: symbol @@ -1396,7 +1401,7 @@ compiler.err.is.preview={0}はプレビューAPIであり、デフォルトで # 0: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.is.preview.reflective={0}はリフレクティブ・プレビューAPIであり、今後のリリースで削除される可能性があります。 # 0: symbol, 1: symbol @@ -1405,12 +1410,12 @@ compiler.warn.restricted.method={0}.{1}は制限されたメソッドです。\n # 0: symbol # lint: deprecation -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.module=モジュール{0}は推奨されません # 0: symbol # lint: removal -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.for.removal.module=モジュール{0}は推奨されておらず、削除用にマークされています # 0: symbol @@ -1583,10 +1588,12 @@ compiler.warn.static.not.qualified.by.type2=static {0}を匿名クラスのメ # 0: string, 1: fragment # lint: options +# flags: default-enabled compiler.warn.source.no.bootclasspath=ブートストラップ・クラス・パスが-source {0}と一緒に設定されていません\n{1} # 0: string, 1: fragment # lint: options +# flags: default-enabled compiler.warn.source.no.system.modules.path=システム・モジュールの場所が-source {0}と一緒に設定されていません\n{1} # 0: string @@ -1603,10 +1610,12 @@ compiler.misc.source.no.system.modules.path.with.target=システム・モジュ # 0: string # lint: options +# flags: default-enabled compiler.warn.option.obsolete.source=ソース値{0}は廃止されていて、今後のリリースで削除される予定です # 0: target # lint: options +# flags: default-enabled compiler.warn.option.obsolete.target=ターゲット値{0}は廃止されていて、今後のリリースで削除される予定です # 0: string, 1: string @@ -1616,12 +1625,17 @@ compiler.err.option.removed.source=ソース・オプション{0}は現在サポ compiler.err.option.removed.target=ターゲット・オプション{0}は現在サポートされていません。{1}以降を使用してください。 # lint: options +# flags: default-enabled compiler.warn.option.obsolete.suppression=廃止されたオプションについての警告を表示しないようにするには、-Xlint:オプションを使用します。 # 0: name, 1: number, 2: number, 3: number, 4: number # lint: classfile compiler.warn.future.attr=バージョン{1}.{2}のクラス・ファイルで導入された{0}属性は、バージョン{3}.{4}のクラス・ファイルでは無視されます +# 0: symbol, 1: file object +# lint: classfile +compiler.warn.inconsistent.inner.classes={1}の{0}のInnerClasses属性はソース・コードと一貫性がありません\n({1}は{0}で再コンパイルする必要がある場合があります) + # lint: requires-automatic compiler.warn.requires.automatic=自動モジュールにはディレクティブが必要です @@ -1706,17 +1720,21 @@ compiler.warn.try.resource.not.referenced=自動クローズ可能なリソー # lint: try compiler.warn.try.resource.throws.interrupted.exc=自動クローズ可能なリソース{0}に、InterruptedExceptionをスローする可能性があるメンバー・メソッドclose()があります +# 0: type +# lint: try +compiler.warn.try.resource.can.throw.interrupted.exc=close()メソッドは、自動クローズ可能なクラス{0}でInterruptedExceptionをスローできます + # lint: unchecked compiler.warn.unchecked.assign={0}から{1}への無検査代入です # 0: symbol, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.assign.to.var=raw型{1}のメンバーとして変数{0}への無検査代入です # 0: symbol, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.call.mbr.of.raw.type=raw型{1}のメンバーとしての{0}への無検査呼出しです # lint: unchecked @@ -1724,17 +1742,17 @@ compiler.warn.unchecked.cast.to.type=型{0}への無検査キャストです # 0: kind name, 1: name, 2: object, 3: object, 4: kind name, 5: symbol # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.meth.invocation.applied=無検査メソッド呼出し: {4} {5}の{0} {1}は指定された型に適用されます\n期待値: {2}\n検出値: {3} # 0: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.generic.array.creation=型{0}の可変引数パラメータに対する総称型配列の無検査作成です # 0: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.varargs.non.reifiable.type=パラメータ化された可変引数型{0}からのヒープ汚染の可能性があります # 0: symbol @@ -1772,6 +1790,10 @@ compiler.err.no.zipfs.for.archive=このファイルの処理に使用できる # lint: divzero compiler.warn.div.zero=ゼロで除算 +# 0: type, 1: long, 2: number +# lint: lossy-conversions +compiler.warn.bit.shift.out.of.range={0}を{1}ビットでシフトすることは、{2}ビットでシフトすることと同等です + # lint: empty compiler.warn.empty.if=if以降が空の文です @@ -2023,7 +2045,7 @@ compiler.misc.prob.found.req=不適合な型: {0} # 0: message segment, 1: type, 2: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.prob.found.req={0}\n期待値: {2}\n検出値: {1} # 0: type, 1: type @@ -2297,12 +2319,12 @@ compiler.err.override.incompatible.ret={0}\n戻り値の型{1}は{2}と互換性 # 0: message segment, 1: type, 2: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.override.unchecked.ret={0}\n戻り値の型は{1}から{2}への無検査変換が必要です # 0: message segment, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.override.unchecked.thrown={0}\nオーバーライドされたメソッドは{1}をスローしません # 0: symbol @@ -2377,16 +2399,17 @@ compiler.err.preview.feature.disabled.classfile={0}のクラス・ファイル # 0: message segment (feature) # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.preview.feature.use={0}はプレビュー機能であり、今後のリリースで削除される可能性があります。 # 0: message segment (feature) # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.preview.feature.use.plural={0}はプレビュー機能であり、今後のリリースで削除される可能性があります。 # 0: file object (classfile), 1: string (expected version) # lint: preview +# flags: mandatory compiler.warn.preview.feature.use.classfile={0}のクラス・ファイルはJava SE {1}のプレビュー機能を使用します。 compiler.misc.feature.modules=モジュール @@ -2783,6 +2806,7 @@ compiler.err.bad.name.for.option={0}オプションの値に含まれる名前 # 0: option name, 1: symbol # lint: options +# flags: default-enabled compiler.warn.module.for.option.not.found={0}オプション内にモジュール名が見つかりません: {1} compiler.err.addmods.all.module.path.invalid=--add-modules ALL-MODULE-PATHは、名前のないモジュールのコンパイル時または自動モジュールのコンテキストでのコンパイル時のみ使用できます @@ -2794,6 +2818,7 @@ compiler.err.add.exports.with.release=システム・モジュール{0}からの compiler.err.add.reads.with.release=システム・モジュール{0}の読取りエッジの追加は--releaseを指定して実行できません # lint: options +# flags: default-enabled compiler.warn.addopens.ignored=--add-opensは、コンパイル時には無効です compiler.misc.locn.module_source_path=モジュール・ソース・パス @@ -3060,7 +3085,7 @@ compiler.err.incorrect.number.of.nested.patterns=ネスト・パターンの数 # 0: kind name, 1: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.declared.using.preview={0} {1}はプレビュー機能を使用して宣言されており、今後のリリースで削除される可能性があります。 # lint: identity diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties index 268ce26bd49..861f371632d 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties @@ -292,10 +292,10 @@ compiler.err.annotation.decl.not.allowed.here=此处不允许批注接口声明 compiler.err.cant.inherit.from.final=无法从最终{0}进行继承 # 0: symbol or name -compiler.err.cant.ref.before.ctor.called=无法在调用超类型构造器之前引用{0} +compiler.err.cant.ref.before.ctor.called=对 {0} 的引用只能在显式调用构造器后显示 # 0: symbol or name -compiler.err.cant.assign.initialized.before.ctor.called=无法在调用超类型构造器之前分配初始化字段 ''{0}'' +compiler.err.cant.assign.initialized.before.ctor.called=对初始化字段 ''{0}'' 的分配只能在显式调用构造器后显示 compiler.err.cant.select.static.class.from.param.type=无法从参数化的类型中选择静态类 @@ -649,11 +649,14 @@ compiler.err.limit.string.overflow=对于常量池来说, 字符串 "{0}..." 的 compiler.err.malformed.fp.lit=浮点文字的格式错误 -compiler.err.method.does.not.override.superclass=方法不会覆盖或实现超类型的方法 +# 0: symbol, 1: symbol +compiler.err.method.does.not.override.superclass={1} 中的 {0} 不会覆盖或实现超类型中的方法 -compiler.err.static.methods.cannot.be.annotated.with.override=不能使用 @Override 对静态方法进行批注 +# 0: symbol, 1: symbol +compiler.err.static.methods.cannot.be.annotated.with.override=不能使用 @Override 对 {1} 中的静态方法 {0} 进行批注 -compiler.err.missing.meth.body.or.decl.abstract=缺少方法主体, 或声明抽象 +# 0: symbol, 1: symbol +compiler.err.missing.meth.body.or.decl.abstract={1} 中的方法 {0} 缺少方法主体,或者应声明为抽象方法 compiler.err.missing.ret.stmt=缺少返回语句 @@ -1139,6 +1142,7 @@ compiler.err.multi-module.outdir.cannot.be.exploded.module=在多模块模式下 # 0: path # lint: path +# flags: default-enabled compiler.warn.outdir.is.in.exploded.module=输出目录位于展开的模块中: {0} # 0: file object @@ -1198,6 +1202,7 @@ compiler.warn.output.file.clash=多次写入输出文件:{0} ## The following string will appear before all messages keyed as: ## "compiler.note". +# flags: mandatory compiler.note.compressed.diags=某些消息已经过简化; 请使用 -Xdiags:verbose 重新编译以获得完整输出 # 0: boolean, 1: symbol @@ -1378,17 +1383,17 @@ compiler.warn.incubating.modules=使用 incubating 模块: {0} # 0: symbol, 1: symbol # lint: deprecation -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated={1}中的{0}已过时 # 0: symbol, 1: symbol # lint: removal -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.for.removal={1} 中的 {0} 已过时, 且标记为待删除 # 0: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.is.preview={0} 是预览 API,可能会在未来发行版中删除。 # 0: symbol @@ -1396,7 +1401,7 @@ compiler.err.is.preview={0} 是预览 API,默认情况下处于禁用状态。 # 0: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.is.preview.reflective={0} 是反射预览 API,可能会在未来发行版中删除。 # 0: symbol, 1: symbol @@ -1405,12 +1410,12 @@ compiler.warn.restricted.method={0}.{1} 是受限制的方法。\n(受限制 # 0: symbol # lint: deprecation -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.module=模块 {0} 已过时 # 0: symbol # lint: removal -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.has.been.deprecated.for.removal.module=模块 {0} 已过时, 且标记为待删除 # 0: symbol @@ -1583,10 +1588,12 @@ compiler.warn.static.not.qualified.by.type2=static {0} 不应用作匿名类的 # 0: string, 1: fragment # lint: options +# flags: default-enabled compiler.warn.source.no.bootclasspath=未与 -source {0} 一起设置引导类路径\n{1} # 0: string, 1: fragment # lint: options +# flags: default-enabled compiler.warn.source.no.system.modules.path=未与 -source {0} 一起设置系统模块的位置\n{1} # 0: string @@ -1603,10 +1610,12 @@ compiler.misc.source.no.system.modules.path.with.target=不设置系统模块的 # 0: string # lint: options +# flags: default-enabled compiler.warn.option.obsolete.source=源值 {0} 已过时,将在未来发行版中删除 # 0: target # lint: options +# flags: default-enabled compiler.warn.option.obsolete.target=目标值 {0} 已过时,将在未来发行版中删除 # 0: string, 1: string @@ -1616,12 +1625,17 @@ compiler.err.option.removed.source=不再支持源选项 {0}。请使用 {1} 或 compiler.err.option.removed.target=不再支持目标选项 {0}。请使用 {1} 或更高版本。 # lint: options +# flags: default-enabled compiler.warn.option.obsolete.suppression=要隐藏有关已过时选项的警告, 请使用 -Xlint:-options。 # 0: name, 1: number, 2: number, 3: number, 4: number # lint: classfile compiler.warn.future.attr={1}.{2} 版类文件中引入的 {0} 属性在 {3}.{4} 版类文件中被忽略 +# 0: symbol, 1: file object +# lint: classfile +compiler.warn.inconsistent.inner.classes={1} 中 {0} 的 InnerClasses 属性与源代码不一致\n(可能需要使用 {0} 重新编译 {1}) + # lint: requires-automatic compiler.warn.requires.automatic=需要自动模块的指令 @@ -1706,17 +1720,21 @@ compiler.warn.try.resource.not.referenced=不能在相应的 try 语句的正文 # lint: try compiler.warn.try.resource.throws.interrupted.exc=可自动关闭的资源{0}包含的成员方法 close() 可能抛出 InterruptedException +# 0: type +# lint: try +compiler.warn.try.resource.can.throw.interrupted.exc=在可自动关闭的类 {0} 中,close() 方法可能抛出 InterruptedException + # lint: unchecked compiler.warn.unchecked.assign=未经检查的分配: 将{0}分配给{1} # 0: symbol, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.assign.to.var=对作为原始类型{1}的成员的变量{0}的分配未经过检查 # 0: symbol, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.call.mbr.of.raw.type=对作为原始类型{1}的成员的{0}的调用未经过检查 # lint: unchecked @@ -1724,17 +1742,17 @@ compiler.warn.unchecked.cast.to.type=向类型{0}的转换未经过检查 # 0: kind name, 1: name, 2: object, 3: object, 4: kind name, 5: symbol # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.meth.invocation.applied=方法调用未经过检查: 将{4} {5}中的{0} {1}应用到给定的类型\n需要: {2}\n找到: {3} # 0: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.generic.array.creation=对于类型为{0}的 varargs 参数, 泛型数组创建未经过检查 # 0: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.unchecked.varargs.non.reifiable.type=参数化 vararg 类型{0}的堆可能已受污染 # 0: symbol @@ -1772,6 +1790,10 @@ compiler.err.no.zipfs.for.archive=没有任何文件系统提供方可处理此 # lint: divzero compiler.warn.div.zero=除数为零 +# 0: type, 1: long, 2: number +# lint: lossy-conversions +compiler.warn.bit.shift.out.of.range=按 {1} 位移动 {0} 相当于按 {2} 位移动 + # lint: empty compiler.warn.empty.if=if 之后没有语句 @@ -2023,7 +2045,7 @@ compiler.misc.prob.found.req=不兼容的类型: {0} # 0: message segment, 1: type, 2: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.prob.found.req={0}\n需要: {2}\n找到: {1} # 0: type, 1: type @@ -2297,12 +2319,12 @@ compiler.err.override.incompatible.ret={0}\n返回类型{1}与{2}不兼容 # 0: message segment, 1: type, 2: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.override.unchecked.ret={0}\n返回类型需要从{1}到{2}的未经检查的转换 # 0: message segment, 1: type # lint: unchecked -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.override.unchecked.thrown={0}\n被覆盖的方法未抛出{1} # 0: symbol @@ -2377,16 +2399,17 @@ compiler.err.preview.feature.disabled.classfile={0} 的类文件使用 Java SE { # 0: message segment (feature) # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.preview.feature.use={0} 是预览功能,可能会在未来发行版中删除。 # 0: message segment (feature) # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.preview.feature.use.plural={0} 是预览功能,可能会在未来发行版中删除。 # 0: file object (classfile), 1: string (expected version) # lint: preview +# flags: mandatory compiler.warn.preview.feature.use.classfile={0} 的类文件使用 Java SE {1} 的预览功能。 compiler.misc.feature.modules=模块 @@ -2783,6 +2806,7 @@ compiler.err.bad.name.for.option={0} 选项的值中有错误的名称: ''{1}'' # 0: option name, 1: symbol # lint: options +# flags: default-enabled compiler.warn.module.for.option.not.found=找不到 {0} 选项中的模块名称: {1} compiler.err.addmods.all.module.path.invalid=--add-modules ALL-MODULE-PATH 只能在编译未命名模块或在自动模块的上下文中编译时使用 @@ -2794,6 +2818,7 @@ compiler.err.add.exports.with.release=不允许在使用 --release 时从系统 compiler.err.add.reads.with.release=不允许在使用 --release 时为系统模块 {0} 添加读取维边: # lint: options +# flags: default-enabled compiler.warn.addopens.ignored=--add-opens 在编译时没有任何效果 compiler.misc.locn.module_source_path=模块源路径 @@ -3060,7 +3085,7 @@ compiler.err.incorrect.number.of.nested.patterns=嵌套模式数不正确\n需 # 0: kind name, 1: symbol # lint: preview -# flags: aggregate +# flags: aggregate, mandatory, default-enabled compiler.warn.declared.using.preview={0} {1} 是使用预览功能声明的,可能会在未来发行版中删除。 # lint: identity diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_de.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_de.properties index 1a00fad1dd0..b36ad3d00ac 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_de.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_de.properties @@ -60,6 +60,8 @@ javac.opt.target=Generiert Klassendateien, die sich für das angegebene Java SE- javac.opt.release=Kompiliert für das angegebene Java SE-Release.\nUnterstützte Releases: \n {0} javac.opt.source=Liefert Quellkompatibilität mit dem angegebenen Release von Java SE.\nUnterstützte Releases: \n {0} javac.opt.Werror=Kompilierung beenden, wenn Warnungen auftreten +javac.opt.arg.Werror=(,)* +javac.opt.Werror.custom=Geben Sie Lint-Kategorien, für die die Kompilierung durch Warnungen beendet werden soll,\ndurch Komma getrennt an. \nStellen Sie einem Schlüssel "-" voran, um die angegebene Kategorie auszuschließen. Verwenden Sie --help-lint, um die unterstützten Schlüssel anzuzeigen. javac.opt.A=Optionen zur Übergabe an die Annotationsprozessoren javac.opt.implicit=Gibt an, ob Klassendateien für implizit referenzierte Dateien generiert werden javac.opt.pkginfo=Gibt an, wie package-info-Dateien behandelt werden sollen @@ -97,12 +99,12 @@ javac.opt.arg.pathname= javac.opt.arg.file= javac.opt.Xbootclasspath.p=Dem Bootstrap Classpath voranstellen javac.opt.Xbootclasspath.a=An Bootstrap Classpath anhängen -javac.opt.Xlint=Empfohlene Warnungskategorien aktivieren -javac.opt.Xlint.all=Alle Warnungskategorien aktivieren -javac.opt.Xlint.none=Alle Warnungskategorien deaktivieren +javac.opt.Xlint=Aktivieren Sie empfohlene Lint-Warnungskategorien. In diesem Release werden alle\nverfügbaren Lint-Warnungskategorien empfohlen. +javac.opt.Xlint.all=Alle Lint-Warnungskategorien aktivieren +javac.opt.Xlint.none=Alle Lint-Warnungskategorien deaktivieren #L10N: do not localize: -Xlint javac.opt.arg.Xlint=(,)* -javac.opt.Xlint.custom=Durch Komma getrennte Warnungskategorien, die aktiviert oder deaktiviert werden sollen.\nStellen Sie einem Schlüssel "-" voran, um die angegebene Warnung zu deaktivieren.\nVerwenden Sie "--help-lint", um die unterstützten Schlüssel anzuzeigen. +javac.opt.Xlint.custom=Lint-Warnungskategorien, die aktiviert oder deaktiviert werden sollen, durch Komma getrennt. \nStellen Sie einem Schlüssel "-" voran, um die angegebene Kategorie zu deaktivieren. Verwenden Sie\n''--help-lint'', um unterstützte Schlüssel und die standardmäßig aktivierten\nKategorien anzuzeigen. javac.opt.Xlint.desc.auxiliaryclass=Warnt vor Auxiliary-Klassen, die in einer Quelldatei verborgen sind und aus anderen Dateien heraus verwendet werden. javac.opt.Xlint.desc.cast=Warnt vor unnötigen Umwandlungen mit Cast. @@ -129,7 +131,7 @@ javac.opt.Xlint.desc.finally=Warnt vor Finally-Klauseln, die nicht normal beende javac.opt.Xlint.desc.incubating=Warnt vor der Verwendung von Inkubatormodulen. -javac.opt.Xlint.desc.lossy-conversions=Warnung über möglichen Verlust von Konvertierungen in zusammengesetzten Zuweisungen. +javac.opt.Xlint.desc.lossy-conversions=Warnung über möglichen Verlust von Konvertierungen in zusammengesetzten Zuweisungen und Bitverschiebungsvorgängen. javac.opt.Xlint.desc.module=Warnt vor Problemen im Zusammenhang mit dem Modulsystem. @@ -175,11 +177,10 @@ javac.opt.Xlint.desc.preview=Warnt vor Verwendung von Vorschausprachfeatures. javac.opt.Xlint.desc.restricted=Warnt vor der Verwendung eingeschränkter Methoden. -# L10N: do not localize: identity synchronization -javac.opt.Xlint.desc.synchronization=Warnt vor Synchronisierungsversuchen mit Instanzen wertbasierter Klassen.\n Dieser Schlüssel ist ein veralteter Alias für die Kategorie "identity", die dieselben Verwendungen und\n Effekte hat. Benutzern wird empfohlen, die Kategorie "identity" für alle zukünftigen\n und vorhandenen Verwendungen von "synchronization" zu verwenden. - javac.opt.Xlint.desc.identity=Warnt vor Verwendungen wertbasierter Klassen, wenn eine Identitätsklasse erwartet wird. +javac.opt.Xlint.alias.of=Veralteter Alias für "{0}" mit identischem Effekt. Benutzern wird empfohlen,\n "{0}" anstatt "{1}" für alle aktuellen und zukünftigen Verwendungen zu nutzen. + javac.opt.Xdoclint=Empfohlene Prüfungen für Probleme in javadoc-Kommentaren aktivieren # L10N: do not localize: all none javac.opt.Xdoclint.subopts = (all|none|[-])[/] @@ -195,14 +196,17 @@ javac.opt.Xdoclint.package.desc=Aktiviert oder deaktiviert Prüfungen in bestimm javac.opt.Xstdout=Leitet die Standardausgabe um javac.opt.X=Gibt Hilfe zu zusätzlichen Optionen aus javac.opt.help=Gibt diese Hilfemeldung aus -javac.opt.help.lint=Gibt die unterstützten Schlüssel für -Xlint aus +javac.opt.help.lint=Gibt die unterstützten Schlüssel für -Xlint und -Werror aus javac.opt.help.lint.header=Die unterstützten Schlüssel für -Xlint sind: +javac.opt.help.lint.enabled.by.default=Die folgenden Lint-Warnungskategorien sind standardmäßig aktiviert: +javac.opt.help.lint.footer=Kategorien und die zugehörigen Aliasnamen können austauschbar verwendet werden. Beispiel: Das Kennzeichen\n"-Xlint:{0},{1}" wäre redundant. javac.opt.print=Gibt eine Textdarstellung der angegebenen Typen aus javac.opt.printRounds=Gibt Informationen zu Durchläufen der Annotationsverarbeitung aus javac.opt.printProcessorInfo=Gibt Informationen dazu aus, welche Annotationen ein Prozessor\nverarbeiten soll javac.opt.userpathsfirst=Durchsucht classpath und sourcepath vor anstatt nach bootclasspath nach Klassen javac.opt.prefer=Gibt an, welche Datei gelesen werden soll, wenn sowohl eine Quell- als auch eine Klassendatei für eine implizit kompilierte Klasse gefunden werden -javac.opt.preview=Aktiviert Vorschausprachfeatures.\nWird in Verbindung mit -source oder --release verwendet. +# L10N: do not localize: ''preview'' +javac.opt.preview=Aktiviert Vorschausprachfeatures. \nDeaktiviert auch die Lint-Kategorie ''preview''. \nWird in Verbindung mit -source oder --release verwendet. javac.opt.AT=Liest Optionen und Dateinamen aus Datei javac.opt.diags=Wählt einen Diagnosemodus aus javac.opt.addExports=Gibt an, dass ein Package als aus seinem definierenden Modul in\nweitere Module oder, wenn ALL-UNNAMED lautet, in alle unbenannten Module\nexportiert betrachtet werden soll. diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties index 3b967d368ae..0ea1796a8e6 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_ja.properties @@ -59,7 +59,9 @@ javac.opt.profile=使用されているAPIが、指定したプロファイル javac.opt.target=指定されたJava SEリリースに適したクラス・ファイルを生成します。サポートされているリリース: \n {0} javac.opt.release=指定されたJava SEリリースに対してコンパイルします。サポートされているリリース: \n {0} javac.opt.source=指定されたJava SEリリースとソースの互換性を保持します。サポートされているリリース: \n {0} -javac.opt.Werror=警告が発生した場合にコンパイルを終了する +javac.opt.Werror=警告が発生した場合にコンパイルを終了します +javac.opt.arg.Werror=(,)* +javac.opt.Werror.custom=コンパイルを終了する警告のlintカテゴリを\nコンマで区切って指定します。\n指定したカテゴリを除外するには、キーの前に''-''を指定します。\nサポートされているキーを表示するには--help-lintを使用します。 javac.opt.A=注釈プロセッサに渡されるオプション javac.opt.implicit=暗黙的に参照されるファイルについてクラス・ファイルを生成するかどうかを指定する javac.opt.pkginfo=package-infoファイルの処理を指定する @@ -97,12 +99,12 @@ javac.opt.arg.pathname= javac.opt.arg.file= javac.opt.Xbootclasspath.p=ブートストラップ・クラス・パスの先頭に付加する javac.opt.Xbootclasspath.a=ブートストラップ・クラス・パスに追加する -javac.opt.Xlint=推奨の警告カテゴリを有効にします -javac.opt.Xlint.all=すべての警告カテゴリを有効にします -javac.opt.Xlint.none=すべての警告カテゴリを無効にします +javac.opt.Xlint=推奨lint警告カテゴリを有効にします。このリリースでは、\n使用可能なすべてのlint警告カテゴリが推奨されます。 +javac.opt.Xlint.all=すべてのlint警告カテゴリを有効にします +javac.opt.Xlint.none=すべてのlint警告カテゴリを無効にします #L10N: do not localize: -Xlint javac.opt.arg.Xlint=(,)* -javac.opt.Xlint.custom=有効または無効にする警告カテゴリ(カンマ区切り)。\n指定した警告を無効にするには、キーの前に''-''を指定します。\nサポートされているキーを表示するには--help-lintを使用します。 +javac.opt.Xlint.custom=有効または無効にするLint警告カテゴリ(カンマ区切り)。\n指定されたカテゴリを無効にするには、キーの前に''-''を指定します。サポートされているキーと\nデフォルトで有効になっているカテゴリを表示するには、\n''--help-lint''を使用します。 javac.opt.Xlint.desc.auxiliaryclass=ソース・ファイルで非表示になっているが他のファイルから使用されている補助クラスについて警告します。 javac.opt.Xlint.desc.cast=不要なキャストの使用について警告します。 @@ -129,7 +131,7 @@ javac.opt.Xlint.desc.finally=正常に完了しないfinally節について警 javac.opt.Xlint.desc.incubating=実験的なモジュールの使用について警告します。 -javac.opt.Xlint.desc.lossy-conversions=複合代入における精度が失われる可能性がある変換についての警告。 +javac.opt.Xlint.desc.lossy-conversions=複合代入およびビット・シフト操作における精度が失われている可能性がある変換についての警告。 javac.opt.Xlint.desc.module=モジュール・システム関連の問題について警告します。 @@ -175,11 +177,10 @@ javac.opt.Xlint.desc.preview=プレビュー言語機能の使用について警 javac.opt.Xlint.desc.restricted=制限されたメソッドの使用について警告します。 -# L10N: do not localize: identity synchronization -javac.opt.Xlint.desc.synchronization=値ベース・クラスのインスタンスでの同期の試行について警告します。\n このキーは、''identity''の非推奨のエイリアスであり、同じ使用方法と効果を\n 持ちます。ユーザーには、今後および既存の''synchronization''の使用に対して''identity''カテゴリを\n 使用することをお薦めします。 - javac.opt.Xlint.desc.identity=アイデンティティ・クラスが必要な場所での値ベース・クラスの使用について警告します。 +javac.opt.Xlint.alias.of=同じ効果を持つ''{0}''の非推奨の別名。ユーザーは現在および将来のすべての使用で\n ''{1}''のかわりに''{0}''の使用が推奨されます。 + javac.opt.Xdoclint=javadocコメントの問題に関する推奨チェックを有効にします # L10N: do not localize: all none javac.opt.Xdoclint.subopts = (all|none|[-])[/] @@ -195,14 +196,17 @@ javac.opt.Xdoclint.package.desc=特定のパッケージのチェックを有効 javac.opt.Xstdout=標準出力をリダイレクトする javac.opt.X=追加オプションのヘルプを出力します javac.opt.help=このヘルプ・メッセージを出力します -javac.opt.help.lint=-Xlintにサポートされているキーを出力します +javac.opt.help.lint=-Xlintおよび-Werrorにサポートされているキーを出力します javac.opt.help.lint.header=-Xlintにサポートされているキーは次のとおりです: +javac.opt.help.lint.enabled.by.default=次のlint警告カテゴリはデフォルトで有効になっています: +javac.opt.help.lint.footer=カテゴリとその別名は同じ意味で使用できます。たとえば、フラグ\n''-Xlint:{0},{1}''は冗長です。 javac.opt.print=指定した型のテキスト表示を出力する javac.opt.printRounds=注釈処理の往復についての情報を印刷する javac.opt.printProcessorInfo=プロセッサが処理を依頼される注釈についての情報を印刷する javac.opt.userpathsfirst=ブート・クラスパスの後ではなく、ブート・クラスパスの前にクラスのクラスパスおよびソース・パスを検索する javac.opt.prefer=暗黙的にコンパイルされるクラスについて、ソース・ファイルとクラス・ファイルの両方が見つかった際どちらを読み込むか指定する -javac.opt.preview=プレビュー言語機能を有効にします。-sourceまたは--releaseとともに使用されます。 +# L10N: do not localize: ''preview'' +javac.opt.preview=プレビュー言語機能を有効にします。\nまた、''preview'' lintカテゴリも無効にします。\n-sourceまたは--releaseとともに使用されます。 javac.opt.AT=ファイルからの読取りオプションおよびファイル名 javac.opt.diags=診断モードの選択 javac.opt.addExports=がALL-UNNAMEDである場合、その定義モジュールから、追加モジュールまたは\n すべての名前のないモジュールにエクスポート済とみなされるようにパッケージを指定します。 diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties index a24b5511c9c..0cbfac7e778 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties @@ -59,7 +59,9 @@ javac.opt.profile=检查使用的 API 在指定的配置文件中是否可用。 javac.opt.target=生成适合指定的 Java SE 发行版的类文件。支持的发行版:{0} javac.opt.release=为指定的 Java SE 发行版编译。支持的发行版:{0} javac.opt.source=提供与指定的 Java SE 发行版的源兼容性。支持的发行版:{0} -javac.opt.Werror=出现警告时终止编译 +javac.opt.Werror=出现任何警告时终止编译 +javac.opt.arg.Werror=(,)* +javac.opt.Werror.custom=指定出现警告时应终止编译的 lint 类别,\n以逗号分隔。\n在关键字前面加上 ''-'' 可排除指定的类别。\n使用 --help-lint 可查看支持的关键字。 javac.opt.A=传递给批注处理程序的选项 javac.opt.implicit=指定是否为隐式引用文件生成类文件 javac.opt.pkginfo=指定 package-info 文件的处理 @@ -97,12 +99,12 @@ javac.opt.arg.pathname= javac.opt.arg.file= javac.opt.Xbootclasspath.p=置于引导类路径之前 javac.opt.Xbootclasspath.a=置于引导类路径之后 -javac.opt.Xlint=启用建议的警告类别 -javac.opt.Xlint.all=启用所有警告类别 -javac.opt.Xlint.none=禁用所有警告类别 +javac.opt.Xlint=启用建议的 lint 警告类别。在此发行版中,\n建议使用所有可用的 lint 警告类别。 +javac.opt.Xlint.all=启用所有 lint 警告类别 +javac.opt.Xlint.none=禁用所有 lint 警告类别 #L10N: do not localize: -Xlint javac.opt.arg.Xlint=(,)* -javac.opt.Xlint.custom=要启用或禁用的警告类别(以逗号分隔)。\n在关键字前面加上 ''-'' 可禁用指定的警告。\n使用 --help-lint 可查看受支持的关键字。 +javac.opt.Xlint.custom=要启用或禁用的 lint 警告类别(以逗号分隔)。\n在关键字前面加上 ''-'' 可禁用指定的类别。\n使用 ''--help-lint'' 可显示支持的关键字和\n默认情况下启用的类别。 javac.opt.Xlint.desc.auxiliaryclass=有关辅助类在源文件中隐藏, 但在其他文件中使用的警告。 javac.opt.Xlint.desc.cast=有关使用了不必要转换的警告。 @@ -129,7 +131,7 @@ javac.opt.Xlint.desc.finally=有关 finally 子句未正常终止的警告。 javac.opt.Xlint.desc.incubating=有关使用 incubating 模块的警告。 -javac.opt.Xlint.desc.lossy-conversions=有关复合赋值中的转换可能会有损失的警告。 +javac.opt.Xlint.desc.lossy-conversions=有关复合赋值和移位操作中的转换可能会有损失的警告。 javac.opt.Xlint.desc.module=有关模块系统相关问题的警告。 @@ -175,11 +177,10 @@ javac.opt.Xlint.desc.preview=有关使用预览语言功能的警告。 javac.opt.Xlint.desc.restricted=有关使用受限制方法的警告。 -# L10N: do not localize: identity synchronization -javac.opt.Xlint.desc.synchronization=有关尝试在基于值的类的实例上同步的警告。\n 此密钥是 ''identity'' 的已过时别名,具有相同的用法和\n 效果。建议用户在 ''synchronization'' 的所有未来和现有\n 用法中使用 ''identity'' 类别。 - javac.opt.Xlint.desc.identity=有关在需要身份类的情况下使用基于值的类的警告。 +javac.opt.Xlint.alias.of=具有相同效果的 ''{0}'' 的别名已过时。建议用户当前和将来\n 都使用 ''{0}'' 而不是 ''{1}''。 + javac.opt.Xdoclint=为 javadoc 注释中的问题启用建议的检查 # L10N: do not localize: all none javac.opt.Xdoclint.subopts = (all|none|[-])[/] @@ -195,14 +196,17 @@ javac.opt.Xdoclint.package.desc=在特定的程序包中启用或禁用检查。 javac.opt.Xstdout=重定向标准输出 javac.opt.X=输出额外选项的帮助 javac.opt.help=输出此帮助消息 -javac.opt.help.lint=输出 -Xlint 支持的关键字 +javac.opt.help.lint=输出 -Xlint 和 -Werror 支持的关键字 javac.opt.help.lint.header=-Xlint 支持的关键字包括: +javac.opt.help.lint.enabled.by.default=默认情况下会启用以下 lint 警告类别: +javac.opt.help.lint.footer=类别及其别名可以互换使用;例如,标记\n''-Xlint:{0},{1}'' 将是冗余的。 javac.opt.print=输出指定类型的文本表示 javac.opt.printRounds=输出有关批注处理循环的信息 javac.opt.printProcessorInfo=输出有关请求处理程序处理哪些批注的信息 javac.opt.userpathsfirst=在引导类路径之前而不是之后搜索类的类路径和源路径 javac.opt.prefer=指定读取文件, 当同时找到隐式编译类的源文件和类文件时 -javac.opt.preview=启用预览语言功能。要与 -source 或 --release 一起使用。 +# L10N: do not localize: ''preview'' +javac.opt.preview=启用预览语言功能。\n还禁用''preview''lint 类别。\n要与 -source 或 --release 一起使用。 javac.opt.AT=从文件读取选项和文件名 javac.opt.diags=选择诊断模式 javac.opt.addExports=指定被视为已从其定义模块导出到其他模块或者导出到所有\n 未命名模块 (如果 为 ALL-UNNAMED) 的程序包。 diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties index 1edda5da22f..bb0f14ab833 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_de.properties @@ -111,6 +111,9 @@ launcher.err.cant.access.main.method=kein Zugriff auf Methode "main" in Klasse: # 0: string launcher.err.cant.find.constructor=No-Argument-Konstruktor nicht gefunden in Klasse: {0} +# 0: string +launcher.err.cant.use.private.constructor=Kein nicht privater Null-Argument-Konstruktor in Klasse {0} gefunden\nEntfernen Sie die Eigenschaft "private" aus dem vorhandenen Konstruktor, oder definieren Sie ihn als:\n public {0}() + # 0: string launcher.err.cant.access.constructor=Kein Zugriff auf No-Argument-Konstruktor in Klasse: {0} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties index be1feb4a8a9..ed940e731bd 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_ja.properties @@ -111,6 +111,9 @@ launcher.err.cant.access.main.method=クラスのメイン・メソッドにア # 0: string launcher.err.cant.find.constructor=クラスに引数なしのコンストラクタが見つかりません: {0} +# 0: string +launcher.err.cant.use.private.constructor=非privateのゼロ引数コンストラクタがクラス{0}に見つかりません\n既存のコンストラクタからprivateを削除するか、次のように定義してください:\n public {0}() + # 0: string launcher.err.cant.access.constructor=クラスの引数なしのコンストラクタにアクセスできません: {0} diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties index 5367036d82f..1fafa95c146 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher_zh_CN.properties @@ -111,6 +111,9 @@ launcher.err.cant.access.main.method=无法访问类 {0} 中的 main 方法 # 0: string launcher.err.cant.find.constructor=在类 {0} 中找不到无参数构造器 +# 0: string +launcher.err.cant.use.private.constructor=在类 {0} 中未找到 non-private 零参数构造器\n请从现有构造器中删除 private,或者定义为:\n public {0}() + # 0: string launcher.err.cant.access.constructor=无法访问类 {0} 中的无参数构造器 diff --git a/src/jdk.compiler/share/data/symbols/java.base-Q.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-Q.sym.txt index fb1ec6ec7bb..29ecd9f0304 100644 --- a/src/jdk.compiler/share/data/symbols/java.base-Q.sym.txt +++ b/src/jdk.compiler/share/data/symbols/java.base-Q.sym.txt @@ -83,6 +83,11 @@ method name close descriptor ()V thrownTypes java/io/IOException flags 1 -class name java/lang/StableValue +class name java/lang/String +field name UNICODE_CASEFOLD_ORDER descriptor Ljava/util/Comparator; flags 19 signature Ljava/util/Comparator; +method name equalsFoldCase descriptor (Ljava/lang/String;)Z flags 1 +method name compareToFoldCase descriptor (Ljava/lang/String;)I flags 1 + class name java/lang/Thread -method name stop descriptor ()V @@ -464,6 +469,16 @@ innerclass innerClass java/lang/Thread$State outerClass java/lang/Thread innerCl innerclass innerClass java/util/concurrent/StructuredTaskScope$Subtask outerClass java/util/concurrent/StructuredTaskScope innerClassName Subtask flags 609 innerclass innerClass java/util/concurrent/StructuredTaskScope$Subtask$State outerClass java/util/concurrent/StructuredTaskScope$Subtask innerClassName State flags 4019 +class name java/util/concurrent/ThreadLocalRandom +method name nextGaussian descriptor ()D flags 1 + +class name java/util/jar/JarFile +header extends java/util/zip/ZipFile flags 21 +innerclass innerClass java/lang/Runtime$Version outerClass java/lang/Runtime innerClassName Version flags 19 +innerclass innerClass java/util/jar/Attributes$Name outerClass java/util/jar/Attributes innerClassName Name flags 9 +innerclass innerClass java/lang/ScopedValue$Carrier outerClass java/lang/ScopedValue innerClassName Carrier flags 19 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 + class name java/util/stream/Collectors header extends java/lang/Object flags 31 runtimeAnnotations @Ljdk/internal/vm/annotation/AOTSafeClassInitializer; innerclass innerClass java/util/stream/Collector$Characteristics outerClass java/util/stream/Collector innerClassName Characteristics flags 4019 @@ -486,6 +501,35 @@ method name getKey descriptor (Ljava/security/Key;Ljava/security/Provider;)Ljava method name getKeyPair descriptor ([C)Ljava/security/KeyPair; thrownTypes java/security/NoSuchAlgorithmException,java/security/InvalidKeyException flags 1 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) method name getKeyPair descriptor (Ljava/security/Key;Ljava/security/Provider;)Ljava/security/KeyPair; thrownTypes java/security/NoSuchAlgorithmException,java/security/InvalidKeyException flags 1 classAnnotations @Ljdk/internal/javac/PreviewFeature;(feature=eLjdk/internal/javac/PreviewFeature$Feature;PEM_API;) +class name javax/crypto/spec/HPKEParameterSpec +header extends java/lang/Object implements java/security/spec/AlgorithmParameterSpec flags 31 +field name KEM_DHKEM_P_256_HKDF_SHA256 descriptor I constantValue 16 flags 19 +field name KEM_DHKEM_P_384_HKDF_SHA384 descriptor I constantValue 17 flags 19 +field name KEM_DHKEM_P_521_HKDF_SHA512 descriptor I constantValue 18 flags 19 +field name KEM_DHKEM_X25519_HKDF_SHA256 descriptor I constantValue 32 flags 19 +field name KEM_DHKEM_X448_HKDF_SHA512 descriptor I constantValue 33 flags 19 +field name KDF_HKDF_SHA256 descriptor I constantValue 1 flags 19 +field name KDF_HKDF_SHA384 descriptor I constantValue 2 flags 19 +field name KDF_HKDF_SHA512 descriptor I constantValue 3 flags 19 +field name AEAD_AES_128_GCM descriptor I constantValue 1 flags 19 +field name AEAD_AES_256_GCM descriptor I constantValue 2 flags 19 +field name AEAD_CHACHA20_POLY1305 descriptor I constantValue 3 flags 19 +field name EXPORT_ONLY descriptor I constantValue 65535 flags 19 +method name of descriptor (III)Ljavax/crypto/spec/HPKEParameterSpec; flags 9 +method name withInfo descriptor ([B)Ljavax/crypto/spec/HPKEParameterSpec; flags 1 +method name withPsk descriptor (Ljavax/crypto/SecretKey;[B)Ljavax/crypto/spec/HPKEParameterSpec; flags 1 +method name withEncapsulation descriptor ([B)Ljavax/crypto/spec/HPKEParameterSpec; flags 1 +method name withAuthKey descriptor (Ljava/security/AsymmetricKey;)Ljavax/crypto/spec/HPKEParameterSpec; flags 1 +method name kem_id descriptor ()I flags 1 +method name kdf_id descriptor ()I flags 1 +method name aead_id descriptor ()I flags 1 +method name info descriptor ()[B flags 1 +method name psk descriptor ()Ljavax/crypto/SecretKey; flags 1 +method name psk_id descriptor ()[B flags 1 +method name authKey descriptor ()Ljava/security/AsymmetricKey; flags 1 +method name encapsulation descriptor ()[B flags 1 +method name toString descriptor ()Ljava/lang/String; flags 1 + class name jdk/internal/classfile/impl/DirectCodeBuilder header extends jdk/internal/classfile/impl/AbstractDirectBuilder implements jdk/internal/classfile/impl/TerminalCodeBuilder flags 31 signature Ljdk/internal/classfile/impl/AbstractDirectBuilder;Ljdk/internal/classfile/impl/TerminalCodeBuilder; innerclass innerClass jdk/internal/classfile/impl/AbstractPseudoInstruction$ExceptionCatchImpl outerClass jdk/internal/classfile/impl/AbstractPseudoInstruction innerClassName ExceptionCatchImpl flags 19 diff --git a/src/jdk.compiler/share/data/symbols/java.sql-Q.sym.txt b/src/jdk.compiler/share/data/symbols/java.sql-Q.sym.txt new file mode 100644 index 00000000000..a8f41a27db0 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/java.sql-Q.sym.txt @@ -0,0 +1,64 @@ +# +# Copyright (c) 2025, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name java/sql/Array +header extends java/lang/Object implements java/lang/AutoCloseable flags 601 +method name close descriptor ()V thrownTypes java/sql/SQLException flags 1 + +class name java/sql/Blob +header extends java/lang/Object implements java/lang/AutoCloseable flags 601 +method name close descriptor ()V thrownTypes java/sql/SQLException flags 1 + +class name java/sql/Clob +header extends java/lang/Object implements java/lang/AutoCloseable flags 601 +method name close descriptor ()V thrownTypes java/sql/SQLException flags 1 + +class name java/sql/Connection +method name enquoteLiteral descriptor (Ljava/lang/String;)Ljava/lang/String; thrownTypes java/sql/SQLException flags 1 +method name enquoteIdentifier descriptor (Ljava/lang/String;Z)Ljava/lang/String; thrownTypes java/sql/SQLException flags 1 +method name isSimpleIdentifier descriptor (Ljava/lang/String;)Z thrownTypes java/sql/SQLException flags 1 +method name enquoteNCharLiteral descriptor (Ljava/lang/String;)Ljava/lang/String; thrownTypes java/sql/SQLException flags 1 + +class name java/sql/JDBCType +field name DECFLOAT descriptor Ljava/sql/JDBCType; flags 4019 +field name JSON descriptor Ljava/sql/JDBCType; flags 4019 + +class name java/sql/SQLPermission +header extends java/security/BasicPermission flags 31 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="26") + +class name java/sql/SQLXML +header extends java/lang/Object implements java/lang/AutoCloseable flags 601 +method name close descriptor ()V thrownTypes java/sql/SQLException flags 1 + +class name java/sql/Statement +header extends java/lang/Object implements java/sql/Wrapper,java/lang/AutoCloseable flags 601 classAnnotations @Ljdk/Profile+Annotation;(value=I2) + +class name java/sql/Types +field name DECFLOAT descriptor I constantValue 2015 flags 19 +field name JSON descriptor I constantValue 2016 flags 19 + diff --git a/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-Q.sym.txt new file mode 100644 index 00000000000..2d774f83cf1 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.incubator.foreign-Q.sym.txt @@ -0,0 +1,43 @@ +# +# Copyright (c) 2025, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +class name jdk/internal/foreign/AbstractMemorySegmentImpl +header extends java/lang/Object implements java/lang/foreign/MemorySegment,java/lang/foreign/SegmentAllocator sealed true permittedSubclasses jdk/internal/foreign/HeapMemorySegmentImpl,jdk/internal/foreign/NativeMemorySegmentImpl flags 421 +innerclass innerClass java/lang/foreign/ValueLayout$OfByte outerClass java/lang/foreign/ValueLayout innerClassName OfByte flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfBoolean outerClass java/lang/foreign/ValueLayout innerClassName OfBoolean flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfChar outerClass java/lang/foreign/ValueLayout innerClassName OfChar flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfShort outerClass java/lang/foreign/ValueLayout innerClassName OfShort flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfInt outerClass java/lang/foreign/ValueLayout innerClassName OfInt flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfFloat outerClass java/lang/foreign/ValueLayout innerClassName OfFloat flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfLong outerClass java/lang/foreign/ValueLayout innerClassName OfLong flags 609 +innerclass innerClass java/lang/foreign/ValueLayout$OfDouble outerClass java/lang/foreign/ValueLayout innerClassName OfDouble flags 609 +innerclass innerClass java/lang/foreign/MemorySegment$Scope outerClass java/lang/foreign/MemorySegment innerClassName Scope flags 609 +innerclass innerClass java/lang/invoke/MethodHandles$Lookup outerClass java/lang/invoke/MethodHandles innerClassName Lookup flags 19 +-method name apply descriptor (Ljava/lang/String;Ljava/util/List;)Ljava/lang/RuntimeException; +-method name apply descriptor (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; + diff --git a/src/jdk.compiler/share/data/symbols/jdk.jpackage-Q.sym.txt b/src/jdk.compiler/share/data/symbols/jdk.jpackage-Q.sym.txt new file mode 100644 index 00000000000..27fd9e69203 --- /dev/null +++ b/src/jdk.compiler/share/data/symbols/jdk.jpackage-Q.sym.txt @@ -0,0 +1,31 @@ +# +# Copyright (c) 2025, 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. +# +# ########################################################## +# ### THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. ### +# ########################################################## +# +module name jdk.jpackage +header requires name\u0020;java.base\u0020;flags\u0020;8000,name\u0020;jdk.internal.opt\u0020;flags\u0020;0,name\u0020;jdk.jlink\u0020;flags\u0020;0,name\u0020;java.naming\u0020;flags\u0020;0,name\u0020;java.desktop\u0020;flags\u0020;0 uses jdk/jpackage/internal/cli/CliBundlingEnvironment provides interface\u0020;java/util/spi/ToolProvider\u0020;impls\u0020;jdk/jpackage/internal/cli/Main$Provider,interface\u0020;jdk/jpackage/internal/cli/CliBundlingEnvironment\u0020;impls\u0020;jdk/jpackage/internal/MacBundlingEnvironment target macos-aarch64 moduleMainClass jdk/jpackage/main/Main flags 8000 + diff --git a/src/jdk.compiler/share/data/symbols/symbols b/src/jdk.compiler/share/data/symbols/symbols index 4bc5127310f..8fdcac5c652 100644 --- a/src/jdk.compiler/share/data/symbols/symbols +++ b/src/jdk.compiler/share/data/symbols/symbols @@ -48,4 +48,4 @@ platform version M base L files java.base-M.sym.txt:java.compiler-M.sym.txt:java platform version N base M files java.base-N.sym.txt:java.compiler-N.sym.txt:java.desktop-N.sym.txt:java.management-N.sym.txt:java.management.rmi-N.sym.txt:jdk.compiler-N.sym.txt:jdk.httpserver-N.sym.txt:jdk.incubator.foreign-N.sym.txt:jdk.javadoc-N.sym.txt:jdk.jshell-N.sym.txt:jdk.localedata-N.sym.txt:jdk.unsupported-N.sym.txt platform version O base N files java.base-O.sym.txt:java.compiler-O.sym.txt:java.datatransfer-O.sym.txt:java.desktop-O.sym.txt:java.instrument-O.sym.txt:java.logging-O.sym.txt:java.management-O.sym.txt:java.management.rmi-O.sym.txt:java.naming-O.sym.txt:java.net.http-O.sym.txt:java.prefs-O.sym.txt:java.rmi-O.sym.txt:java.scripting-O.sym.txt:java.se-O.sym.txt:java.security.jgss-O.sym.txt:java.security.sasl-O.sym.txt:java.smartcardio-O.sym.txt:java.sql-O.sym.txt:java.sql.rowset-O.sym.txt:java.transaction.xa-O.sym.txt:java.xml-O.sym.txt:java.xml.crypto-O.sym.txt:jdk.accessibility-O.sym.txt:jdk.attach-O.sym.txt:jdk.charsets-O.sym.txt:jdk.compiler-O.sym.txt:jdk.crypto.cryptoki-O.sym.txt:jdk.dynalink-O.sym.txt:jdk.editpad-O.sym.txt:jdk.hotspot.agent-O.sym.txt:jdk.httpserver-O.sym.txt:jdk.incubator.foreign-O.sym.txt:jdk.incubator.vector-O.sym.txt:jdk.jartool-O.sym.txt:jdk.javadoc-O.sym.txt:jdk.jcmd-O.sym.txt:jdk.jconsole-O.sym.txt:jdk.jdeps-O.sym.txt:jdk.jdi-O.sym.txt:jdk.jdwp.agent-O.sym.txt:jdk.jfr-O.sym.txt:jdk.jlink-O.sym.txt:jdk.jpackage-O.sym.txt:jdk.jshell-O.sym.txt:jdk.jsobject-O.sym.txt:jdk.jstatd-O.sym.txt:jdk.localedata-O.sym.txt:jdk.management-O.sym.txt:jdk.management.agent-O.sym.txt:jdk.management.jfr-O.sym.txt:jdk.naming.dns-O.sym.txt:jdk.naming.rmi-O.sym.txt:jdk.net-O.sym.txt:jdk.nio.mapmode-O.sym.txt:jdk.sctp-O.sym.txt:jdk.security.auth-O.sym.txt:jdk.security.jgss-O.sym.txt:jdk.unsupported-O.sym.txt:jdk.xml.dom-O.sym.txt:jdk.zipfs-O.sym.txt platform version P base O files java.base-P.sym.txt:java.compiler-P.sym.txt:java.desktop-P.sym.txt:java.logging-P.sym.txt:java.management-P.sym.txt:java.net.http-P.sym.txt:java.security.jgss-P.sym.txt:java.xml.crypto-P.sym.txt:jdk.attach-P.sym.txt:jdk.compiler-P.sym.txt:jdk.incubator.foreign-P.sym.txt:jdk.incubator.vector-P.sym.txt:jdk.jdi-P.sym.txt:jdk.jfr-P.sym.txt:jdk.jpackage-P.sym.txt:jdk.jshell-P.sym.txt:jdk.net-P.sym.txt:jdk.security.jgss-P.sym.txt -platform version Q base P files java.base-Q.sym.txt:java.compiler-Q.sym.txt:java.desktop-Q.sym.txt:java.management-Q.sym.txt:java.net.http-Q.sym.txt:jdk.httpserver-Q.sym.txt:jdk.incubator.vector-Q.sym.txt:jdk.jartool-Q.sym.txt:jdk.jdeps-Q.sym.txt:jdk.jfr-Q.sym.txt:jdk.jlink-Q.sym.txt:jdk.jshell-Q.sym.txt:jdk.jsobject-Q.sym.txt:jdk.localedata-Q.sym.txt +platform version Q base P files java.base-Q.sym.txt:java.compiler-Q.sym.txt:java.desktop-Q.sym.txt:java.management-Q.sym.txt:java.net.http-Q.sym.txt:java.sql-Q.sym.txt:jdk.httpserver-Q.sym.txt:jdk.incubator.foreign-Q.sym.txt:jdk.incubator.vector-Q.sym.txt:jdk.jartool-Q.sym.txt:jdk.jdeps-Q.sym.txt:jdk.jfr-Q.sym.txt:jdk.jlink-Q.sym.txt:jdk.jpackage-Q.sym.txt:jdk.jshell-Q.sym.txt:jdk.jsobject-Q.sym.txt:jdk.localedata-Q.sym.txt diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java index c119e374d66..01a71c8f44c 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/BsdCDebugger.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -86,18 +86,22 @@ class BsdCDebugger implements CDebugger { String cpu = dbg.getCPU(); if (cpu.equals("amd64") || cpu.equals("x86_64")) { AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext(); + Address rsp = context.getRegisterAsAddress(AMD64ThreadContext.RSP); + if (rsp == null) return null; Address rbp = context.getRegisterAsAddress(AMD64ThreadContext.RBP); if (rbp == null) return null; Address pc = context.getRegisterAsAddress(AMD64ThreadContext.RIP); if (pc == null) return null; - return new BsdAMD64CFrame(dbg, rbp, pc); + return new BsdAMD64CFrame(dbg, rsp, rbp, pc); } else if (cpu.equals("aarch64")) { AARCH64ThreadContext context = (AARCH64ThreadContext) thread.getContext(); + Address sp = context.getRegisterAsAddress(AARCH64ThreadContext.SP); + if (sp == null) return null; Address fp = context.getRegisterAsAddress(AARCH64ThreadContext.FP); if (fp == null) return null; Address pc = context.getRegisterAsAddress(AARCH64ThreadContext.PC); if (pc == null) return null; - return new BsdAARCH64CFrame(dbg, fp, pc); + return new BsdAARCH64CFrame(dbg, sp, fp, pc); } else { throw new DebuggerException(cpu + " is not yet supported"); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java index ebc5c7d716e..185148b39b4 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/aarch64/BsdAARCH64CFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2015, Red Hat Inc. * Copyright (c) 2021, Azul Systems, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -26,15 +26,19 @@ package sun.jvm.hotspot.debugger.bsd.aarch64; +import sun.jvm.hotspot.code.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.debugger.aarch64.*; import sun.jvm.hotspot.debugger.bsd.*; import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.cdbg.basic.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.runtime.aarch64.*; public final class BsdAARCH64CFrame extends BasicCFrame { - public BsdAARCH64CFrame(BsdDebugger dbg, Address fp, Address pc) { + public BsdAARCH64CFrame(BsdDebugger dbg, Address sp, Address fp, Address pc) { super(dbg.getCDebugger()); + this.sp = sp; this.fp = fp; this.pc = pc; this.dbg = dbg; @@ -54,28 +58,65 @@ public final class BsdAARCH64CFrame extends BasicCFrame { return fp; } + @Override public CFrame sender(ThreadProxy thread) { - AARCH64ThreadContext context = (AARCH64ThreadContext) thread.getContext(); - Address rsp = context.getRegisterAsAddress(AARCH64ThreadContext.SP); + return sender(thread, null, null, null); + } - if ((fp == null) || fp.lessThan(rsp)) { + @Override + public CFrame sender(ThreadProxy thread, Address nextSP, Address nextFP, Address nextPC) { + // Check fp + // Skip if both nextFP and nextPC are given - do not need to load from fp. + if (nextFP == null && nextPC == null) { + if (fp == null) { + return null; + } + + // Check alignment of fp + if (dbg.getAddressValue(fp) % (2 * ADDRESS_SIZE) != 0) { + return null; + } + } + + if (nextFP == null) { + nextFP = fp.getAddressAt(0); + } + if (nextFP == null) { return null; } - // Check alignment of fp - if (dbg.getAddressValue(fp) % (2 * ADDRESS_SIZE) != 0) { - return null; + if (nextPC == null) { + nextPC = fp.getAddressAt(ADDRESS_SIZE); } - - Address nextFP = fp.getAddressAt(0 * ADDRESS_SIZE); - if (nextFP == null || nextFP.lessThanOrEqual(fp)) { - return null; - } - Address nextPC = fp.getAddressAt(1 * ADDRESS_SIZE); if (nextPC == null) { return null; } - return new BsdAARCH64CFrame(dbg, nextFP, nextPC); + + if (nextSP == null) { + CodeCache cc = VM.getVM().getCodeCache(); + CodeBlob currentBlob = cc.findBlobUnsafe(pc()); + + // This case is different from HotSpot. See JDK-8371194 for details. + if (currentBlob != null && (currentBlob.isContinuationStub() || currentBlob.isNativeMethod())) { + // Use FP since it should always be valid for these cases. + // TODO: These should be walked as Frames not CFrames. + nextSP = fp.addOffsetTo(2 * ADDRESS_SIZE); + } else { + CodeBlob codeBlob = cc.findBlobUnsafe(nextPC); + boolean useCodeBlob = codeBlob != null && codeBlob.getFrameSize() > 0; + nextSP = useCodeBlob ? nextFP.addOffsetTo((2 * ADDRESS_SIZE) - codeBlob.getFrameSize()) : nextFP; + } + } + if (nextSP == null) { + return null; + } + + return new BsdAARCH64CFrame(dbg, nextSP, nextFP, nextPC); + } + + @Override + public Frame toFrame() { + return new AARCH64Frame(sp, fp, pc); } // package/class internals only diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/amd64/BsdAMD64CFrame.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/amd64/BsdAMD64CFrame.java index 8d0d94b11b7..9077e0007a5 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/amd64/BsdAMD64CFrame.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/debugger/bsd/amd64/BsdAMD64CFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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,10 +29,13 @@ import sun.jvm.hotspot.debugger.amd64.*; import sun.jvm.hotspot.debugger.bsd.*; import sun.jvm.hotspot.debugger.cdbg.*; import sun.jvm.hotspot.debugger.cdbg.basic.*; +import sun.jvm.hotspot.runtime.*; +import sun.jvm.hotspot.runtime.amd64.*; public final class BsdAMD64CFrame extends BasicCFrame { - public BsdAMD64CFrame(BsdDebugger dbg, Address rbp, Address rip) { + public BsdAMD64CFrame(BsdDebugger dbg, Address rsp, Address rbp, Address rip) { super(dbg.getCDebugger()); + this.rsp = rsp; this.rbp = rbp; this.rip = rip; this.dbg = dbg; @@ -52,32 +55,49 @@ public final class BsdAMD64CFrame extends BasicCFrame { return rbp; } + @Override public CFrame sender(ThreadProxy thread) { - AMD64ThreadContext context = (AMD64ThreadContext) thread.getContext(); - Address rsp = context.getRegisterAsAddress(AMD64ThreadContext.RSP); + return sender(thread, null, null, null); + } - if ( (rbp == null) || rbp.lessThan(rsp) ) { - return null; + @Override + public CFrame sender(ThreadProxy thread, Address sp, Address fp, Address pc) { + // Check fp + // Skip if both fp and pc are given - do not need to load from rbp. + if (fp == null && pc == null) { + if (rbp == null) { + return null; + } + + // Check alignment of rbp + if (dbg.getAddressValue(rbp) % ADDRESS_SIZE != 0) { + return null; + } } - // Check alignment of rbp - if (dbg.getAddressValue(rbp) % ADDRESS_SIZE != 0) { + Address nextRSP = sp != null ? sp : rbp.addOffsetTo(2 * ADDRESS_SIZE); + if (nextRSP == null) { return null; } - - Address nextRBP = rbp.getAddressAt( 0 * ADDRESS_SIZE); - if (nextRBP == null || nextRBP.lessThanOrEqual(rbp)) { + Address nextRBP = fp != null ? fp : rbp.getAddressAt(0); + if (nextRBP == null) { return null; } - Address nextPC = rbp.getAddressAt( 1 * ADDRESS_SIZE); + Address nextPC = pc != null ? pc : rbp.getAddressAt(ADDRESS_SIZE); if (nextPC == null) { return null; } - return new BsdAMD64CFrame(dbg, nextRBP, nextPC); + return new BsdAMD64CFrame(dbg, nextRSP, nextRBP, nextPC); + } + + @Override + public Frame toFrame() { + return new AMD64Frame(rsp, rbp, rip); } // package/class internals only private static final int ADDRESS_SIZE = 8; + private Address rsp; private Address rip; private Address rbp; private BsdDebugger dbg; diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java index 76125e33e80..b0d158f409d 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/parallel/ParallelScavengeHeap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -60,11 +60,11 @@ public class ParallelScavengeHeap extends CollectedHeap { // Accessors public PSYoungGen youngGen() { - return VMObjectFactory.newObject(PSYoungGen.class, youngGenField.getValue()); + return VMObjectFactory.newObject(PSYoungGen.class, youngGenField.getValue(addr)); } public PSOldGen oldGen() { - return VMObjectFactory.newObject(PSOldGen.class, oldGenField.getValue()); + return VMObjectFactory.newObject(PSOldGen.class, oldGenField.getValue(addr)); } public long capacity() { diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Authenticator.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Authenticator.java index ddef30f0c5c..6bb97e0799a 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Authenticator.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Authenticator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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,7 +40,7 @@ public abstract class Authenticator { /** * Constructor for subclasses to call. */ - protected Authenticator () { } + protected Authenticator() { } /** * Base class for return type from {@link #authenticate(HttpExchange)} method. @@ -50,7 +50,7 @@ public abstract class Authenticator { /** * Constructor for subclasses to call. */ - protected Result () {} + protected Result() {} } /** @@ -67,7 +67,7 @@ public abstract class Authenticator { * @param responseCode the response code to associate with this * {@code Failure} instance */ - public Failure (int responseCode) { + public Failure(int responseCode) { this.responseCode = responseCode; } @@ -94,7 +94,7 @@ public abstract class Authenticator { * * @param p the authenticated user you wish to set as {@code Principal} */ - public Success (HttpPrincipal p) { + public Success(HttpPrincipal p) { principal = p; } @@ -126,7 +126,7 @@ public abstract class Authenticator { * @param responseCode the response code to associate with this * {@code Retry} instance */ - public Retry (int responseCode) { + public Retry(int responseCode) { this.responseCode = responseCode; } @@ -158,5 +158,5 @@ public abstract class Authenticator { * @param exch the {@code HttpExchange} upon which authenticate is called * @return the result */ - public abstract Result authenticate (HttpExchange exch); + public abstract Result authenticate(HttpExchange exch); } diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/BasicAuthenticator.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/BasicAuthenticator.java index b2cf78dd992..8c306888370 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/BasicAuthenticator.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/BasicAuthenticator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, 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,7 +35,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; /** * BasicAuthenticator provides an implementation of HTTP Basic * authentication. It is an abstract class and must be extended - * to provide an implementation of {@link #checkCredentials(String,String)} + * to provide an implementation of {@link #checkCredentials(String, String)} * which is called to verify each incoming request. * * @since 1.6 @@ -104,34 +104,34 @@ public abstract class BasicAuthenticator extends Authenticator { * * @return the authenticator's realm string */ - public String getRealm () { + public String getRealm() { return realm; } - public Result authenticate (HttpExchange t) + public Result authenticate(HttpExchange t) { Headers rmap = t.getRequestHeaders(); /* * look for auth token */ - String auth = rmap.getFirst ("Authorization"); + String auth = rmap.getFirst("Authorization"); if (auth == null) { setAuthHeader(t); - return new Authenticator.Retry (401); + return new Authenticator.Retry(401); } - int sp = auth.indexOf (' '); + int sp = auth.indexOf(' '); if (sp == -1 || !auth.substring(0, sp).equalsIgnoreCase("Basic")) { - return new Authenticator.Failure (401); + return new Authenticator.Failure(401); } byte[] b = Base64.getDecoder().decode(auth.substring(sp+1)); - String userpass = new String (b, charset); - int colon = userpass.indexOf (':'); - String uname = userpass.substring (0, colon); - String pass = userpass.substring (colon+1); + String userpass = new String(b, charset); + int colon = userpass.indexOf(':'); + String uname = userpass.substring(0, colon); + String pass = userpass.substring(colon+1); - if (checkCredentials (uname, pass)) { - return new Authenticator.Success ( - new HttpPrincipal ( + if (checkCredentials(uname, pass)) { + return new Authenticator.Success( + new HttpPrincipal( uname, realm ) ); @@ -146,7 +146,7 @@ public abstract class BasicAuthenticator extends Authenticator { Headers map = t.getResponseHeaders(); var authString = "Basic realm=" + "\"" + realm + "\"" + (isUTF8 ? ", charset=\"UTF-8\"" : ""); - map.set ("WWW-Authenticate", authString); + map.set("WWW-Authenticate", authString); } /** @@ -159,6 +159,6 @@ public abstract class BasicAuthenticator extends Authenticator { * @param password the password from the request * @return {@code true} if the credentials are valid, {@code false} otherwise */ - public abstract boolean checkCredentials (String username, String password); + public abstract boolean checkCredentials(String username, String password); } diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java index 7dacefcb59b..906e8448c54 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Filter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -53,7 +53,7 @@ public abstract class Filter { /** * Constructor for subclasses to call. */ - protected Filter () {} + protected Filter() {} /** * A chain of filters associated with a {@link HttpServer}. @@ -76,7 +76,7 @@ public abstract class Filter { * @param handler the {@link HttpHandler} that will be invoked after * the final {@code Filter} has finished */ - public Chain (List filters, HttpHandler handler) { + public Chain(List filters, HttpHandler handler) { iter = filters.listIterator(); this.handler = handler; } @@ -93,12 +93,12 @@ public abstract class Filter { * @throws IOException if an I/O error occurs * @throws NullPointerException if exchange is {@code null} */ - public void doFilter (HttpExchange exchange) throws IOException { + public void doFilter(HttpExchange exchange) throws IOException { if (!iter.hasNext()) { - handler.handle (exchange); + handler.handle(exchange); } else { Filter f = iter.next(); - f.doFilter (exchange, this); + f.doFilter(exchange, this); } } } @@ -135,14 +135,14 @@ public abstract class Filter { * must be rethrown again * @throws NullPointerException if either exchange or chain are {@code null} */ - public abstract void doFilter (HttpExchange exchange, Chain chain) + public abstract void doFilter(HttpExchange exchange, Chain chain) throws IOException; /** * Returns a short description of this {@code Filter}. * * @return a {@code String} describing the {@code Filter} */ - public abstract String description (); + public abstract String description(); /** * Returns a pre-processing {@code Filter} with the given description and diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java index 7d11bd42c94..2decd48c806 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java @@ -62,9 +62,9 @@ import sun.net.httpserver.UnmodifiableHeaders; *

    *
  • {@link #getFirst(String)} returns a single valued header or the first * value of a multi-valued header. - *
  • {@link #add(String,String)} adds the given header value to the list + *
  • {@link #add(String, String)} adds the given header value to the list * for the given key. - *
  • {@link #set(String,String)} sets the given header field to the single + *
  • {@link #set(String, String)} sets the given header field to the single * value given overwriting any existing values in the value list. *
* @@ -80,9 +80,9 @@ import sun.net.httpserver.UnmodifiableHeaders; * {@code null} keys will never be present in HTTP request or response headers. * @since 1.6 */ -public class Headers implements Map> { +public class Headers implements Map> { - HashMap> map; + HashMap> map; /** * Creates an empty instance of {@code Headers}. @@ -99,7 +99,7 @@ public class Headers implements Map> { * null. * @since 18 */ - public Headers(Map> headers) { + public Headers(Map> headers) { Objects.requireNonNull(headers); var h = headers.entrySet().stream() .collect(Collectors.toUnmodifiableMap( @@ -234,7 +234,7 @@ public class Headers implements Map> { List l = map.get(k); if (l == null) { l = new LinkedList<>(); - map.put(k,l); + map.put(k, l); } l.add(value); } @@ -372,7 +372,7 @@ public class Headers implements Map> { * null. * @since 18 */ - public static Headers of(Map> headers) { + public static Headers of(Map> headers) { return new UnmodifiableHeaders(new Headers(headers)); } } diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpContext.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpContext.java index 12529d88385..1c9e41e866c 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpContext.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,7 +90,7 @@ public abstract class HttpContext { * * @return a {@code Map} containing the attributes of this context */ - public abstract Map getAttributes() ; + public abstract Map getAttributes() ; /** * Returns this context's {@link List} of {@linkplain Filter filters}. This diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java index 7ea43c0418e..a56c20b53af 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpExchange.java @@ -48,7 +48,7 @@ import java.net.URI; * should be closed. *
  • {@link #getResponseHeaders()} to set any response headers, except * content-length. - *
  • {@link #sendResponseHeaders(int,long)} to send the response headers. + *
  • {@link #sendResponseHeaders(int, long)} to send the response headers. * Must be called before next step. *
  • {@link #getResponseBody()} to get a {@link OutputStream} to * send the response body. When the response body has been written, the @@ -73,7 +73,7 @@ public abstract class HttpExchange implements AutoCloseable, Request { /* * Symbolic values for the responseLength parameter of - * sendResponseHeaders(int,long) + * sendResponseHeaders(int, long) */ /** @@ -163,7 +163,7 @@ public abstract class HttpExchange implements AutoCloseable, Request { /** * Returns a stream to which the response body must be - * written. {@link #sendResponseHeaders(int,long)}) must be called prior to + * written. {@link #sendResponseHeaders(int, long)}) must be called prior to * calling this method. Multiple calls to this method (for the same exchange) * will return the same stream. In order to correctly terminate each exchange, * the output stream must be closed, even if no response body is being sent. diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpHandler.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpHandler.java index 1f1fc129c9d..447001a4f53 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpHandler.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,5 +44,5 @@ public interface HttpHandler { * @throws NullPointerException if exchange is {@code null} * @throws IOException if an I/O error occurs */ - public abstract void handle (HttpExchange exchange) throws IOException; + public abstract void handle(HttpExchange exchange) throws IOException; } diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpServer.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpServer.java index 8ed0172690f..a0271fed146 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpServer.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,7 +44,7 @@ import java.util.concurrent.Executor; * a root URI path which represents the location of the application or service * on this server. The mapping of a handler to a {@code HttpServer} is * encapsulated by a {@link HttpContext} object. HttpContexts are created by - * calling {@link #createContext(String,HttpHandler)}. + * calling {@link #createContext(String, HttpHandler)}. * Any request for which no handler can be found is rejected with a 404 response. * Management of threads can be done external to this object by providing a * {@link java.util.concurrent.Executor} object. If none is provided a default @@ -117,13 +117,13 @@ public abstract class HttpServer { * Creates a {@code HttpServer} instance which is initially not bound to any * local address/port. The {@code HttpServer} is acquired from the currently * installed {@link HttpServerProvider}. The server must be bound using - * {@link #bind(InetSocketAddress,int)} before it can be used. + * {@link #bind(InetSocketAddress, int)} before it can be used. * * @throws IOException if an I/O error occurs * @return an instance of {@code HttpServer} */ public static HttpServer create() throws IOException { - return create (null, 0); + return create(null, 0); } /** @@ -149,7 +149,7 @@ public abstract class HttpServer { public static HttpServer create(InetSocketAddress addr, int backlog) throws IOException { HttpServerProvider provider = HttpServerProvider.provider(); - return provider.createHttpServer (addr, backlog); + return provider.createHttpServer(addr, backlog); } /** diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsConfigurator.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsConfigurator.java index 8cd9e3affa2..7f329e02f47 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsConfigurator.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsConfigurator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,11 +38,11 @@ import javax.net.ssl.SSLParameters; *

    The following example shows how this may be done: * *

    - * SSLContext sslContext = SSLContext.getInstance (....);
    + * SSLContext sslContext = SSLContext.getInstance(....);
      * HttpsServer server = HttpsServer.create();
      *
    - * server.setHttpsConfigurator (new HttpsConfigurator(sslContext) {
    - *     public void configure (HttpsParameters params) {
    + * server.setHttpsConfigurator(new HttpsConfigurator(sslContext) {
    + *     public void configure(HttpsParameters params) {
      *
      *         // get the remote address if needed
      *         InetSocketAddress remote = params.getClientAddress();
    @@ -51,7 +51,7 @@ import javax.net.ssl.SSLParameters;
      *
      *         // get the default parameters
      *         SSLParameters sslparams = c.getDefaultSSLParameters();
    - *         if (remote.equals (...) ) {
    + *         if (remote.equals(...)) {
      *             // modify the default set for client x
      *         }
      *
    @@ -74,7 +74,7 @@ public class HttpsConfigurator {
          */
         public HttpsConfigurator(SSLContext context) {
             if (context == null) {
    -            throw new NullPointerException ("null SSLContext");
    +            throw new NullPointerException("null SSLContext");
             }
             this.context = context;
         }
    @@ -107,6 +107,6 @@ public class HttpsConfigurator {
         * @since 1.6
         */
         public void configure(HttpsParameters params) {
    -        params.setSSLParameters (getSSLContext().getDefaultSSLParameters());
    +        params.setSSLParameters(getSSLContext().getDefaultSSLParameters());
         }
     }
    diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsServer.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsServer.java
    index 7b3dafd5582..192b8c3d697 100644
    --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsServer.java
    +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/HttpsServer.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2005, 2025, 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,7 +57,7 @@ public abstract class HttpsServer extends HttpServer {
          * Creates a {@code HttpsServer} instance which is initially not bound to any
          * local address/port. The {@code HttpsServer} is acquired from the currently
          * installed {@link HttpServerProvider}. The server must be bound using
    -     * {@link #bind(InetSocketAddress,int)} before it can be used. The server
    +     * {@link #bind(InetSocketAddress, int)} before it can be used. The server
          * must also have a {@code HttpsConfigurator} established with
          * {@link #setHttpsConfigurator(HttpsConfigurator)}.
          *
    @@ -80,7 +80,7 @@ public abstract class HttpsServer extends HttpServer {
          * established with {@link #setHttpsConfigurator(HttpsConfigurator)}.
          *
          * @param addr the address to listen on, if {@code null} then
    -     *             {@link #bind(InetSocketAddress,int)} must be called to set
    +     *             {@link #bind(InetSocketAddress, int)} must be called to set
          *             the address
          * @param backlog the socket backlog. If this value is less than or equal to
          *               zero, then a system default value is used.
    diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/SimpleFileServer.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/SimpleFileServer.java
    index 551f24d3cf0..ba93b81db5a 100644
    --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/SimpleFileServer.java
    +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/SimpleFileServer.java
    @@ -1,5 +1,5 @@
     /*
    - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved.
    + * Copyright (c) 2021, 2025, 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
    @@ -55,7 +55,7 @@ import sun.net.httpserver.simpleserver.OutputFilter;
      *
      * 

    Simple file server

    * - *

    The {@link #createFileServer(InetSocketAddress,Path,OutputLevel) createFileServer} + *

    The {@link #createFileServer(InetSocketAddress, Path, OutputLevel) createFileServer} * static factory method returns an {@link HttpServer HttpServer} that is a * simple out-of-the-box file server. The server comes with an initial handler * that serves files from a given directory path (and its subdirectories). diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/package-info.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/package-info.java index 3b9de3520fb..466b76a6c4a 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/package-info.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -117,26 +117,25 @@ The following code shows how the SSLContext is then used in a HttpsConfigurator and how the SSLContext and HttpsConfigurator are linked to the HttpsServer.

    -    server.setHttpsConfigurator (new HttpsConfigurator(sslContext) {
    -        public void configure (HttpsParameters params) {
    +   server.setHttpsConfigurator(new HttpsConfigurator(sslContext) {
    +       public void configure(HttpsParameters params) {
     
    -        // get the remote address if needed
    -        InetSocketAddress remote = params.getClientAddress();
    +           // get the remote address if needed
    +           InetSocketAddress remote = params.getClientAddress();
     
    -        SSLContext c = getSSLContext();
    +           SSLContext c = getSSLContext();
     
    -        // get the default parameters
    -        SSLParameters sslparams = c.getDefaultSSLParameters();
    -        if (remote.equals (...) ) {
    -            // modify the default set for client x
    -        }
    +           // get the default parameters
    +           SSLParameters sslparams = c.getDefaultSSLParameters();
    +           if (remote.equals(...)) {
    +               // modify the default set for client x
    +           }
     
    -        params.setSSLParameters(sslparams);
    -        // statement above could throw IAE if any params invalid.
    -        // eg. if app has a UI and parameters supplied by a user.
    -
    -        }
    -    });
    +           params.setSSLParameters(sslparams);
    +           // statement above could throw IAE if any params invalid.
    +           // eg. if app has a UI and parameters supplied by a user.
    +       }
    +   });
        
    @since 1.6 */ diff --git a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java index d025e90cf87..9d73f0e7340 100644 --- a/src/jdk.httpserver/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java +++ b/src/jdk.httpserver/share/classes/com/sun/net/httpserver/spi/HttpServerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -152,7 +152,7 @@ public abstract class HttpServerProvider { * * @return The system-wide default HttpServerProvider */ - public static HttpServerProvider provider () { + public static HttpServerProvider provider() { synchronized (lock) { if (provider != null) return provider; diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/AuthFilter.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/AuthFilter.java index 468fa19fe16..4641325af92 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/AuthFilter.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/AuthFilter.java @@ -33,48 +33,48 @@ public class AuthFilter extends Filter { private Authenticator authenticator; - public AuthFilter (Authenticator authenticator) { + public AuthFilter(Authenticator authenticator) { this.authenticator = authenticator; } - public String description () { + public String description() { return "Authentication filter"; } - public void setAuthenticator (Authenticator a) { + public void setAuthenticator(Authenticator a) { authenticator = a; } - public void consumeInput (HttpExchange t) throws IOException { + public void consumeInput(HttpExchange t) throws IOException { InputStream i = t.getRequestBody(); byte[] b = new byte [4096]; - while (i.read (b) != -1); - i.close (); + while (i.read(b) != -1); + i.close(); } /** * The filter's implementation, which is invoked by the server */ - public void doFilter (HttpExchange t, Filter.Chain chain) throws IOException + public void doFilter(HttpExchange t, Filter.Chain chain) throws IOException { if (authenticator != null) { - Authenticator.Result r = authenticator.authenticate (t); + Authenticator.Result r = authenticator.authenticate(t); if (r instanceof Authenticator.Success) { Authenticator.Success s = (Authenticator.Success)r; - ExchangeImpl e = ExchangeImpl.get (t); - e.setPrincipal (s.getPrincipal()); - chain.doFilter (t); + ExchangeImpl e = ExchangeImpl.get(t); + e.setPrincipal(s.getPrincipal()); + chain.doFilter(t); } else if (r instanceof Authenticator.Retry) { Authenticator.Retry ry = (Authenticator.Retry)r; - consumeInput (t); - t.sendResponseHeaders (ry.getResponseCode(), RSPBODY_EMPTY); + consumeInput(t); + t.sendResponseHeaders(ry.getResponseCode(), RSPBODY_EMPTY); } else if (r instanceof Authenticator.Failure) { Authenticator.Failure f = (Authenticator.Failure)r; - consumeInput (t); - t.sendResponseHeaders (f.getResponseCode(), RSPBODY_EMPTY); + consumeInput(t); + t.sendResponseHeaders(f.getResponseCode(), RSPBODY_EMPTY); } } else { - chain.doFilter (t); + chain.doFilter(t); } } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedInputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedInputStream.java index 34ac72e1fee..0c003378d77 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedInputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,7 +31,7 @@ import com.sun.net.httpserver.*; import com.sun.net.httpserver.spi.*; class ChunkedInputStream extends LeftOverInputStream { - ChunkedInputStream (ExchangeImpl t, InputStream src) { + ChunkedInputStream(ExchangeImpl t, InputStream src) { super (t, src); } @@ -48,7 +48,7 @@ class ChunkedInputStream extends LeftOverInputStream { */ private static final int MAX_CHUNK_HEADER_SIZE = 2050; - private int numeric (char[] arr, int nchars) throws IOException { + private int numeric(char[] arr, int nchars) throws IOException { assert arr.length >= nchars; int len = 0; for (int i=0; i='A' && c<= 'F') { val = c - 'A' + 10; } else { - throw new IOException ("invalid chunk length"); + throw new IOException("invalid chunk length"); } len = len * 16 + val; } @@ -71,10 +71,10 @@ class ChunkedInputStream extends LeftOverInputStream { /* read the chunk header line and return the chunk length * any chunk extensions are ignored */ - private int readChunkHeader () throws IOException { + private int readChunkHeader() throws IOException { boolean gotCR = false; int c; - char[] len_arr = new char [16]; + char[] len_arr = new char[16]; int len_size = 0; boolean end_of_len = false; int read = 0; @@ -85,11 +85,11 @@ class ChunkedInputStream extends LeftOverInputStream { if ((len_size == len_arr.length -1) || (read > MAX_CHUNK_HEADER_SIZE)) { - throw new IOException ("invalid chunk header"); + throw new IOException("invalid chunk header"); } if (gotCR) { if (ch == LF) { - int l = numeric (len_arr, len_size); + int l = numeric(len_arr, len_size); return l; } else { gotCR = false; @@ -107,10 +107,10 @@ class ChunkedInputStream extends LeftOverInputStream { } } } - throw new IOException ("end of stream reading chunk header"); + throw new IOException("end of stream reading chunk header"); } - protected int readImpl (byte[]b, int off, int len) throws IOException { + protected int readImpl(byte[] b, int off, int len) throws IOException { if (eof) { return -1; } @@ -119,7 +119,7 @@ class ChunkedInputStream extends LeftOverInputStream { if (remaining == 0) { eof = true; consumeCRLF(); - t.getServerImpl().requestCompleted (t.getConnection()); + t.getServerImpl().requestCompleted(t.getConnection()); return -1; } needToReadHeader = false; @@ -140,15 +140,15 @@ class ChunkedInputStream extends LeftOverInputStream { return n; } - private void consumeCRLF () throws IOException { + private void consumeCRLF() throws IOException { char c; c = (char)in.read(); /* CR */ if (c != CR) { - throw new IOException ("invalid chunk end"); + throw new IOException("invalid chunk end"); } c = (char)in.read(); /* LF */ if (c != LF) { - throw new IOException ("invalid chunk end"); + throw new IOException("invalid chunk end"); } } @@ -158,7 +158,7 @@ class ChunkedInputStream extends LeftOverInputStream { * limitation for the moment. It only affects potential efficiency * rather than correctness. */ - public int available () throws IOException { + public int available() throws IOException { if (eof || closed) { return 0; } @@ -170,17 +170,17 @@ class ChunkedInputStream extends LeftOverInputStream { * have been read from the underlying channel * and buffered internally */ - public boolean isDataBuffered () throws IOException { + public boolean isDataBuffered() throws IOException { assert eof; return in.available() > 0; } - public boolean markSupported () {return false;} + public boolean markSupported() {return false;} - public void mark (int l) { + public void mark(int l) { } - public void reset () throws IOException { - throw new IOException ("mark/reset not supported"); + public void reset() throws IOException { + throw new IOException("mark/reset not supported"); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java index e8e84eb8edd..fd1a940c0a5 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ChunkedOutputStream.java @@ -57,14 +57,14 @@ class ChunkedOutputStream extends FilterOutputStream private byte[] buf = new byte [CHUNK_SIZE+OFFSET+2]; ExchangeImpl t; - ChunkedOutputStream (ExchangeImpl t, OutputStream src) { - super (src); + ChunkedOutputStream(ExchangeImpl t, OutputStream src) { + super(src); this.t = t; } - public void write (int b) throws IOException { + public void write(int b) throws IOException { if (closed) { - throw new StreamClosedException (); + throw new StreamClosedException(); } buf [pos++] = (byte)b; count ++; @@ -74,23 +74,23 @@ class ChunkedOutputStream extends FilterOutputStream assert count < CHUNK_SIZE; } - public void write (byte[]b, int off, int len) throws IOException { + public void write(byte[] b, int off, int len) throws IOException { Objects.checkFromIndexSize(off, len, b.length); if (len == 0) { return; } if (closed) { - throw new StreamClosedException (); + throw new StreamClosedException(); } int remain = CHUNK_SIZE - count; if (len > remain) { - System.arraycopy (b,off,buf,pos,remain); + System.arraycopy(b, off, buf, pos, remain); count = CHUNK_SIZE; writeChunk(); len -= remain; off += remain; while (len >= CHUNK_SIZE) { - System.arraycopy (b,off,buf,OFFSET,CHUNK_SIZE); + System.arraycopy(b, off, buf, OFFSET, CHUNK_SIZE); len -= CHUNK_SIZE; off += CHUNK_SIZE; count = CHUNK_SIZE; @@ -98,7 +98,7 @@ class ChunkedOutputStream extends FilterOutputStream } } if (len > 0) { - System.arraycopy (b,off,buf,pos,len); + System.arraycopy(b, off, buf, pos, len); count += len; pos += len; } @@ -112,8 +112,8 @@ class ChunkedOutputStream extends FilterOutputStream * chunk does not have to be CHUNK_SIZE bytes * count must == number of user bytes (<= CHUNK_SIZE) */ - private void writeChunk () throws IOException { - char[] c = Integer.toHexString (count).toCharArray(); + private void writeChunk() throws IOException { + char[] c = Integer.toHexString(count).toCharArray(); int clen = c.length; int startByte = 4 - clen; int i; @@ -124,12 +124,12 @@ class ChunkedOutputStream extends FilterOutputStream buf[startByte + (i++)] = '\n'; buf[startByte + (i++) + count] = '\r'; buf[startByte + (i++) + count] = '\n'; - out.write (buf, startByte, i+count); + out.write(buf, startByte, i+count); count = 0; pos = OFFSET; } - public void close () throws IOException { + public void close() throws IOException { if (closed) { return; } @@ -156,12 +156,12 @@ class ChunkedOutputStream extends FilterOutputStream } Event e = new Event.WriteFinished(t); - t.getHttpContext().getServerImpl().addEvent (e); + t.getHttpContext().getServerImpl().addEvent(e); } - public void flush () throws IOException { + public void flush() throws IOException { if (closed) { - throw new StreamClosedException (); + throw new StreamClosedException(); } if (count > 0) { writeChunk(); diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/Code.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/Code.java index 6b86b8fa5bd..c5391343f96 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/Code.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/Code.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ class Code { public static final int HTTP_GATEWAY_TIMEOUT = 504; public static final int HTTP_VERSION = 505; - static String msg (int code) { + static String msg(int code) { switch (code) { case HTTP_OK: return " OK"; diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ContextList.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ContextList.java index cbedb6ca860..96b55575928 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ContextList.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ContextList.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,30 +31,30 @@ class ContextList { private final LinkedList list = new LinkedList<>(); - public synchronized void add (HttpContextImpl ctx) { + public synchronized void add(HttpContextImpl ctx) { assert ctx.getPath() != null; if (contains(ctx)) { - throw new IllegalArgumentException ("cannot add context to list"); + throw new IllegalArgumentException("cannot add context to list"); } - list.add (ctx); + list.add(ctx); } boolean contains(HttpContextImpl ctx) { return findContext(ctx.getProtocol(), ctx.getPath(), true) != null; } - public synchronized int size () { + public synchronized int size() { return list.size(); } /* initially contexts are located only by protocol:path. * Context with longest prefix matches (currently case-sensitive) */ - synchronized HttpContextImpl findContext (String protocol, String path) { - return findContext (protocol, path, false); + synchronized HttpContextImpl findContext(String protocol, String path) { + return findContext(protocol, path, false); } - synchronized HttpContextImpl findContext (String protocol, String path, boolean exact) { + synchronized HttpContextImpl findContext(String protocol, String path, boolean exact) { protocol = protocol.toLowerCase(Locale.ROOT); String longest = ""; HttpContextImpl lc = null; @@ -63,7 +63,7 @@ class ContextList { continue; } String cpath = ctx.getPath(); - if (exact && !cpath.equals (path)) { + if (exact && !cpath.equals(path)) { continue; } else if (!exact && !path.startsWith(cpath)) { continue; @@ -76,25 +76,25 @@ class ContextList { return lc; } - public synchronized void remove (String protocol, String path) + public synchronized void remove(String protocol, String path) throws IllegalArgumentException { - HttpContextImpl ctx = findContext (protocol, path, true); + HttpContextImpl ctx = findContext(protocol, path, true); if (ctx == null) { - throw new IllegalArgumentException ("cannot remove element from list"); + throw new IllegalArgumentException("cannot remove element from list"); } - list.remove (ctx); + list.remove(ctx); } - public synchronized void remove (HttpContextImpl context) + public synchronized void remove(HttpContextImpl context) throws IllegalArgumentException { for (HttpContextImpl ctx: list) { - if (ctx.equals (context)) { - list.remove (ctx); + if (ctx.equals(context)) { + list.remove(ctx); return; } } - throw new IllegalArgumentException ("no such context in list"); + throw new IllegalArgumentException("no such context in list"); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/DefaultHttpServerProvider.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/DefaultHttpServerProvider.java index fe746befb9f..7b54ef45e72 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/DefaultHttpServerProvider.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/DefaultHttpServerProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,11 +31,11 @@ import com.sun.net.httpserver.*; import com.sun.net.httpserver.spi.*; public class DefaultHttpServerProvider extends HttpServerProvider { - public HttpServer createHttpServer (InetSocketAddress addr, int backlog) throws IOException { - return new HttpServerImpl (addr, backlog); + public HttpServer createHttpServer(InetSocketAddress addr, int backlog) throws IOException { + return new HttpServerImpl(addr, backlog); } - public HttpsServer createHttpsServer (InetSocketAddress addr, int backlog) throws IOException { - return new HttpsServerImpl (addr, backlog); + public HttpsServer createHttpsServer(InetSocketAddress addr, int backlog) throws IOException { + return new HttpsServerImpl(addr, backlog); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java index 17dff13d4e5..8da98cdcfa5 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java @@ -82,12 +82,12 @@ class ExchangeImpl { PlaceholderOutputStream uos_orig; boolean sentHeaders; /* true after response headers sent */ - final Map attributes; + final Map attributes; int rcode = -1; HttpPrincipal principal; ServerImpl server; - ExchangeImpl ( + ExchangeImpl( String m, URI u, Request req, long len, HttpConnection connection ) throws IOException { this.req = req; @@ -107,23 +107,23 @@ class ExchangeImpl { server.startExchange(); } - public Headers getRequestHeaders () { + public Headers getRequestHeaders() { return reqHdrs; } - public Headers getResponseHeaders () { + public Headers getResponseHeaders() { return rspHdrs; } - public URI getRequestURI () { + public URI getRequestURI() { return uri; } - public String getRequestMethod (){ + public String getRequestMethod() { return method; } - public HttpContextImpl getHttpContext (){ + public HttpContextImpl getHttpContext() { return connection.getHttpContext(); } @@ -131,7 +131,7 @@ class ExchangeImpl { return HEAD.equals(getRequestMethod()); } - public void close () { + public void close() { if (closed) { return; } @@ -160,38 +160,38 @@ class ExchangeImpl { } } - public InputStream getRequestBody () { + public InputStream getRequestBody() { if (uis != null) { return uis; } if (reqContentLen == -1L) { - uis_orig = new ChunkedInputStream (this, ris); + uis_orig = new ChunkedInputStream(this, ris); uis = uis_orig; } else { - uis_orig = new FixedLengthInputStream (this, ris, reqContentLen); + uis_orig = new FixedLengthInputStream(this, ris, reqContentLen); uis = uis_orig; } return uis; } - LeftOverInputStream getOriginalInputStream () { + LeftOverInputStream getOriginalInputStream() { return uis_orig; } - public int getResponseCode () { + public int getResponseCode() { return rcode; } - public OutputStream getResponseBody () { + public OutputStream getResponseBody() { /* TODO. Change spec to remove restriction below. Filters * cannot work with this restriction * * if (!sentHeaders) { - * throw new IllegalStateException ("headers not sent"); + * throw new IllegalStateException("headers not sent"); * } */ if (uos == null) { - uos_orig = new PlaceholderOutputStream (null); + uos_orig = new PlaceholderOutputStream(null); uos = uos_orig; } return uos; @@ -202,37 +202,37 @@ class ExchangeImpl { * returned from the 1st call to getResponseBody() * The "real" ouputstream is then placed inside this */ - PlaceholderOutputStream getPlaceholderResponseBody () { + PlaceholderOutputStream getPlaceholderResponseBody() { getResponseBody(); return uos_orig; } - public void sendResponseHeaders (int rCode, long contentLen) + public void sendResponseHeaders(int rCode, long contentLen) throws IOException { final Logger logger = server.getLogger(); if (sentHeaders) { - throw new IOException ("headers already sent"); + throw new IOException("headers already sent"); } this.rcode = rCode; - String statusLine = "HTTP/1.1 "+rCode+Code.msg(rCode)+"\r\n"; + String statusLine = "HTTP/1.1 " + rCode + Code.msg(rCode) + "\r\n"; ByteArrayOutputStream tmpout = new ByteArrayOutputStream(); PlaceholderOutputStream o = getPlaceholderResponseBody(); - tmpout.write (bytes(statusLine, 0), 0, statusLine.length()); + tmpout.write(bytes(statusLine, 0), 0, statusLine.length()); boolean noContentToSend = false; // assume there is content boolean noContentLengthHeader = false; // must not send Content-length is set rspHdrs.set("Date", FORMATTER.format(Instant.now())); /* check for response type that is not allowed to send a body */ - if ((rCode>=100 && rCode <200) /* informational */ + if ((rCode >= 100 && rCode < 200) /* informational */ ||(rCode == 204) /* no content */ ||(rCode == 304)) /* not modified */ { if (contentLen != RSPBODY_EMPTY) { - String msg = "sendResponseHeaders: rCode = "+ rCode + String msg = "sendResponseHeaders: rCode = " + rCode + ": forcing contentLen = RSPBODY_EMPTY"; - logger.log (Level.WARNING, msg); + logger.log(Level.WARNING, msg); } contentLen = RSPBODY_EMPTY; noContentLengthHeader = (rCode != 304); @@ -245,19 +245,19 @@ class ExchangeImpl { if (contentLen >= 0) { String msg = "sendResponseHeaders: being invoked with a content length for a HEAD request"; - logger.log (Level.WARNING, msg); + logger.log(Level.WARNING, msg); } noContentToSend = true; contentLen = 0; - o.setWrappedStream (new FixedLengthOutputStream (this, ros, contentLen)); + o.setWrappedStream(new FixedLengthOutputStream(this, ros, contentLen)); } else { /* not a HEAD request or 304 response */ if (contentLen == RSPBODY_CHUNKED) { if (http10) { - o.setWrappedStream (new UndefLengthOutputStream (this, ros)); + o.setWrappedStream(new UndefLengthOutputStream(this, ros)); close = true; } else { - rspHdrs.set ("Transfer-encoding", "chunked"); - o.setWrappedStream (new ChunkedOutputStream (this, ros)); + rspHdrs.set("Transfer-encoding", "chunked"); + o.setWrappedStream(new ChunkedOutputStream(this, ros)); } } else { if (contentLen == RSPBODY_EMPTY) { @@ -267,7 +267,7 @@ class ExchangeImpl { if (!noContentLengthHeader) { rspHdrs.set("Content-length", Long.toString(contentLen)); } - o.setWrappedStream (new FixedLengthOutputStream (this, ros, contentLen)); + o.setWrappedStream(new FixedLengthOutputStream(this, ros, contentLen)); } } @@ -280,12 +280,12 @@ class ExchangeImpl { Optional.ofNullable(rspHdrs.get("Connection")) .map(List::stream).orElse(Stream.empty()); if (conheader.anyMatch("close"::equalsIgnoreCase)) { - logger.log (Level.DEBUG, "Connection: close requested by handler"); + logger.log(Level.DEBUG, "Connection: close requested by handler"); close = true; } } - write (rspHdrs, tmpout); + write(rspHdrs, tmpout); this.rspContentLen = contentLen; tmpout.writeTo(ros); sentHeaders = true; @@ -294,33 +294,33 @@ class ExchangeImpl { ros.flush(); close(); } - server.logReply (rCode, req.requestLine(), null); + server.logReply(rCode, req.requestLine(), null); } - void write (Headers map, OutputStream os) throws IOException { - Set>> entries = map.entrySet(); - for (Map.Entry> entry : entries) { + void write(Headers map, OutputStream os) throws IOException { + Set>> entries = map.entrySet(); + for (Map.Entry> entry : entries) { String key = entry.getKey(); byte[] buf; List values = entry.getValue(); for (String val : values) { int i = key.length(); - buf = bytes (key, 2); + buf = bytes(key, 2); buf[i++] = ':'; buf[i++] = ' '; - os.write (buf, 0, i); - buf = bytes (val, 2); + os.write(buf, 0, i); + buf = bytes(val, 2); i = val.length(); buf[i++] = '\r'; buf[i++] = '\n'; - os.write (buf, 0, i); + os.write(buf, 0, i); } } - os.write ('\r'); - os.write ('\n'); + os.write('\r'); + os.write('\n'); } - private byte[] rspbuf = new byte [128]; // used by bytes() + private byte[] rspbuf = new byte[128]; // used by bytes() /** * convert string to byte[], using rspbuf @@ -328,7 +328,7 @@ class ExchangeImpl { * of rspbuf. Reallocate rspbuf if not big enough. * caller must check return value to see if rspbuf moved */ - private byte[] bytes (String s, int extra) { + private byte[] bytes(String s, int extra) { int slen = s.length(); if (slen+extra > rspbuf.length) { int diff = slen + extra - rspbuf.length; @@ -341,27 +341,27 @@ class ExchangeImpl { return rspbuf; } - public InetSocketAddress getRemoteAddress (){ + public InetSocketAddress getRemoteAddress() { Socket s = connection.getChannel().socket(); InetAddress ia = s.getInetAddress(); int port = s.getPort(); - return new InetSocketAddress (ia, port); + return new InetSocketAddress(ia, port); } - public InetSocketAddress getLocalAddress (){ + public InetSocketAddress getLocalAddress() { Socket s = connection.getChannel().socket(); InetAddress ia = s.getLocalAddress(); int port = s.getLocalPort(); - return new InetSocketAddress (ia, port); + return new InetSocketAddress(ia, port); } - public String getProtocol (){ + public String getProtocol() { String reqline = req.requestLine(); - int index = reqline.lastIndexOf (' '); - return reqline.substring (index+1); + int index = reqline.lastIndexOf(' '); + return reqline.substring(index+1); } - public SSLSession getSSLSession () { + public SSLSession getSSLSession() { SSLEngine e = connection.getSSLEngine(); if (e == null) { return null; @@ -369,11 +369,11 @@ class ExchangeImpl { return e.getSession(); } - public Object getAttribute (String name) { + public Object getAttribute(String name) { return attributes.get(Objects.requireNonNull(name, "null name parameter")); } - public void setAttribute (String name, Object value) { + public void setAttribute(String name, Object value) { var key = Objects.requireNonNull(name, "null name parameter"); if (value != null) { attributes.put(key, value); @@ -382,7 +382,7 @@ class ExchangeImpl { } } - public void setStreams (InputStream i, OutputStream o) { + public void setStreams(InputStream i, OutputStream o) { assert uis != null; if (i != null) { uis = i; @@ -395,23 +395,23 @@ class ExchangeImpl { /** * PP */ - HttpConnection getConnection () { + HttpConnection getConnection() { return connection; } - ServerImpl getServerImpl () { + ServerImpl getServerImpl() { return getHttpContext().getServerImpl(); } - public HttpPrincipal getPrincipal () { + public HttpPrincipal getPrincipal() { return principal; } - void setPrincipal (HttpPrincipal principal) { + void setPrincipal(HttpPrincipal principal) { this.principal = principal; } - static ExchangeImpl get (HttpExchange t) { + static ExchangeImpl get(HttpExchange t) { if (t instanceof HttpExchangeImpl) { return ((HttpExchangeImpl)t).getExchangeImpl(); } else { @@ -432,37 +432,37 @@ class PlaceholderOutputStream extends java.io.OutputStream { OutputStream wrapped; - PlaceholderOutputStream (OutputStream os) { + PlaceholderOutputStream(OutputStream os) { wrapped = os; } - void setWrappedStream (OutputStream os) { + void setWrappedStream(OutputStream os) { wrapped = os; } - boolean isWrapped () { + boolean isWrapped() { return wrapped != null; } - private void checkWrap () throws IOException { + private void checkWrap() throws IOException { if (wrapped == null) { - throw new IOException ("response headers not sent yet"); + throw new IOException("response headers not sent yet"); } } public void write(int b) throws IOException { checkWrap(); - wrapped.write (b); + wrapped.write(b); } public void write(byte b[]) throws IOException { checkWrap(); - wrapped.write (b); + wrapped.write(b); } public void write(byte b[], int off, int len) throws IOException { checkWrap(); - wrapped.write (b, off, len); + wrapped.write(b, off, len); } public void flush() throws IOException { diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthInputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthInputStream.java index ac6fb7be005..100ba9e1b3b 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthInputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,15 +39,15 @@ import com.sun.net.httpserver.spi.*; class FixedLengthInputStream extends LeftOverInputStream { private long remaining; - FixedLengthInputStream (ExchangeImpl t, InputStream src, long len) { - super (t, src); + FixedLengthInputStream(ExchangeImpl t, InputStream src, long len) { + super(t, src); if (len < 0) { throw new IllegalArgumentException("Content-Length: " + len); } this.remaining = len; } - protected int readImpl (byte[]b, int off, int len) throws IOException { + protected int readImpl(byte[] b, int off, int len) throws IOException { eof = (remaining == 0L); if (eof) { @@ -60,7 +60,7 @@ class FixedLengthInputStream extends LeftOverInputStream { if (n > -1) { remaining -= n; if (remaining == 0) { - t.getServerImpl().requestCompleted (t.getConnection()); + t.getServerImpl().requestCompleted(t.getConnection()); } } if (n < 0 && !eof) @@ -68,7 +68,7 @@ class FixedLengthInputStream extends LeftOverInputStream { return n; } - public int available () throws IOException { + public int available() throws IOException { if (eof) { return 0; } @@ -76,12 +76,12 @@ class FixedLengthInputStream extends LeftOverInputStream { return n < remaining? n: (int)remaining; } - public boolean markSupported () {return false;} + public boolean markSupported() {return false;} - public void mark (int l) { + public void mark(int l) { } - public void reset () throws IOException { - throw new IOException ("mark/reset not supported"); + public void reset() throws IOException { + throw new IOException("mark/reset not supported"); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java index f800bdaba18..95de03d27fa 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/FixedLengthOutputStream.java @@ -42,7 +42,7 @@ class FixedLengthOutputStream extends FilterOutputStream private boolean closed = false; ExchangeImpl t; - FixedLengthOutputStream (ExchangeImpl t, OutputStream src, long len) { + FixedLengthOutputStream(ExchangeImpl t, OutputStream src, long len) { super (src); if (len < 0) { throw new IllegalArgumentException("Content-Length: " + len); @@ -51,9 +51,9 @@ class FixedLengthOutputStream extends FilterOutputStream this.remaining = len; } - public void write (int b) throws IOException { + public void write(int b) throws IOException { if (closed) { - throw new IOException ("stream closed"); + throw new IOException("stream closed"); } if (remaining == 0) { throw new StreamClosedException(); @@ -62,30 +62,30 @@ class FixedLengthOutputStream extends FilterOutputStream remaining --; } - public void write (byte[]b, int off, int len) throws IOException { + public void write(byte[] b, int off, int len) throws IOException { Objects.checkFromIndexSize(off, len, b.length); if (len == 0) { return; } if (closed) { - throw new IOException ("stream closed"); + throw new IOException("stream closed"); } if (len > remaining) { // stream is still open, caller can retry - throw new IOException ("too many bytes to write to stream"); + throw new IOException("too many bytes to write to stream"); } out.write(b, off, len); remaining -= len; } - public void close () throws IOException { + public void close() throws IOException { if (closed) { return; } closed = true; if (remaining > 0) { t.close(); - throw new IOException ("insufficient bytes written to stream"); + throw new IOException("insufficient bytes written to stream"); } flush(); LeftOverInputStream is = t.getOriginalInputStream(); @@ -95,7 +95,7 @@ class FixedLengthOutputStream extends FilterOutputStream } catch (IOException e) {} } Event e = new Event.WriteFinished(t); - t.getHttpContext().getServerImpl().addEvent (e); + t.getHttpContext().getServerImpl().addEvent(e); } // flush is a pass-through diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpConnection.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpConnection.java index 38aabe1136e..2be4a37d432 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpConnection.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -73,14 +73,14 @@ class HttpConnection { return sb.toString(); } - HttpConnection () { + HttpConnection() { } - void setChannel (SocketChannel c) { + void setChannel(SocketChannel c) { chan = c; } - void setContext (HttpContextImpl ctx) { + void setContext(HttpContextImpl ctx) { context = ctx; } @@ -88,11 +88,11 @@ class HttpConnection { return state; } - void setState (State s) { + void setState(State s) { state = s; } - void setParameters ( + void setParameters( InputStream in, OutputStream rawout, SocketChannel chan, SSLEngine engine, SSLStreams sslStreams, SSLContext sslContext, String protocol, HttpContextImpl context, InputStream raw @@ -110,21 +110,21 @@ class HttpConnection { this.logger = context.getLogger(); } - SocketChannel getChannel () { + SocketChannel getChannel() { return chan; } - synchronized void close () { + synchronized void close() { if (closed) { return; } closed = true; if (logger != null && chan != null) { - logger.log (Level.TRACE, "Closing connection: " + chan.toString()); + logger.log(Level.TRACE, "Closing connection: " + chan.toString()); } if (!chan.isOpen()) { - ServerImpl.dprint ("Channel already closed"); + ServerImpl.dprint("Channel already closed"); return; } try { @@ -133,65 +133,65 @@ class HttpConnection { raw.close(); } } catch (IOException e) { - ServerImpl.dprint (e); + ServerImpl.dprint(e); } try { if (rawout != null) { rawout.close(); } } catch (IOException e) { - ServerImpl.dprint (e); + ServerImpl.dprint(e); } try { if (sslStreams != null) { sslStreams.close(); } } catch (IOException e) { - ServerImpl.dprint (e); + ServerImpl.dprint(e); } try { chan.close(); } catch (IOException e) { - ServerImpl.dprint (e); + ServerImpl.dprint(e); } } /* remaining is the number of bytes left on the lowest level inputstream * after the exchange is finished */ - void setRemaining (int r) { + void setRemaining(int r) { remaining = r; } - int getRemaining () { + int getRemaining() { return remaining; } - SelectionKey getSelectionKey () { + SelectionKey getSelectionKey() { return selectionKey; } - InputStream getInputStream () { + InputStream getInputStream() { return i; } - OutputStream getRawOutputStream () { + OutputStream getRawOutputStream() { return rawout; } - String getProtocol () { + String getProtocol() { return protocol; } - SSLEngine getSSLEngine () { + SSLEngine getSSLEngine() { return engine; } - SSLContext getSSLContext () { + SSLContext getSSLContext() { return sslContext; } - HttpContextImpl getHttpContext () { + HttpContextImpl getHttpContext() { return context; } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpContextImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpContextImpl.java index f1583954115..10cd116a3a0 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpContextImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpContextImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,7 +35,7 @@ import com.sun.net.httpserver.*; * to a {@link HttpHandler} which is invoked to handle requests destined * for the protocol/path on the associated HttpServer. *

    - * HttpContext instances are created by {@link HttpServer#createContext(String,String,HttpHandler,Object)} + * HttpContext instances are created by {@link HttpServer#createContext(String, String, HttpHandler, Object)} *

    */ class HttpContextImpl extends HttpContext { @@ -44,7 +44,7 @@ class HttpContextImpl extends HttpContext { private final String protocol; private final ServerImpl server; private final AuthFilter authfilter; - private final Map attributes = new ConcurrentHashMap<>(); + private final Map attributes = new ConcurrentHashMap<>(); /* system filters, not visible to applications */ private final List sfilters = new CopyOnWriteArrayList<>(); /* user filters, set by applications */ @@ -55,35 +55,35 @@ class HttpContextImpl extends HttpContext { /** * constructor is package private. */ - HttpContextImpl (String protocol, String path, HttpHandler cb, ServerImpl server) { + HttpContextImpl(String protocol, String path, HttpHandler cb, ServerImpl server) { if (path == null || protocol == null || path.length() < 1 || path.charAt(0) != '/') { - throw new IllegalArgumentException ("Illegal value for path or protocol"); + throw new IllegalArgumentException("Illegal value for path or protocol"); } this.protocol = protocol.toLowerCase(Locale.ROOT); this.path = path; - if (!this.protocol.equals ("http") && !this.protocol.equals ("https")) { - throw new IllegalArgumentException ("Illegal value for protocol"); + if (!this.protocol.equals("http") && !this.protocol.equals("https")) { + throw new IllegalArgumentException("Illegal value for protocol"); } this.handler = cb; this.server = server; authfilter = new AuthFilter(null); - sfilters.add (authfilter); + sfilters.add(authfilter); } /** * returns the handler for this context * @return the HttpHandler for this context */ - public HttpHandler getHandler () { + public HttpHandler getHandler() { return handler; } - public void setHandler (HttpHandler h) { + public void setHandler(HttpHandler h) { if (h == null) { - throw new NullPointerException ("Null handler parameter"); + throw new NullPointerException("Null handler parameter"); } if (handler != null) { - throw new IllegalArgumentException ("handler already set"); + throw new IllegalArgumentException("handler already set"); } handler = h; } @@ -100,11 +100,11 @@ class HttpContextImpl extends HttpContext { * returns the server this context was created with * @return this context's server */ - public HttpServer getServer () { + public HttpServer getServer() { return server.getWrapper(); } - ServerImpl getServerImpl () { + ServerImpl getServerImpl() { return server; } @@ -124,29 +124,29 @@ class HttpContextImpl extends HttpContext { * Every attribute stored in this Map will be visible to * every HttpExchange processed by this context */ - public Map getAttributes() { + public Map getAttributes() { return attributes; } - public List getFilters () { + public List getFilters() { return ufilters; } - List getSystemFilters () { + List getSystemFilters() { return sfilters; } - public Authenticator setAuthenticator (Authenticator auth) { + public Authenticator setAuthenticator(Authenticator auth) { Authenticator old = authenticator; authenticator = auth; - authfilter.setAuthenticator (auth); + authfilter.setAuthenticator(auth); return old; } - public Authenticator getAuthenticator () { + public Authenticator getAuthenticator() { return authenticator; } - Logger getLogger () { + Logger getLogger() { return server.getLogger(); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpError.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpError.java index de9dfba8cfb..b201c822193 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpError.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,7 +31,7 @@ package sun.net.httpserver; class HttpError extends RuntimeException { private static final long serialVersionUID = 8769596371344178179L; - public HttpError (String msg) { - super (msg); + public HttpError(String msg) { + super(msg); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpExchangeImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpExchangeImpl.java index 420ef3d9e64..d4606019c56 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpExchangeImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpExchangeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,82 +38,82 @@ class HttpExchangeImpl extends HttpExchange { ExchangeImpl impl; - HttpExchangeImpl (ExchangeImpl impl) { + HttpExchangeImpl(ExchangeImpl impl) { this.impl = impl; } - public Headers getRequestHeaders () { + public Headers getRequestHeaders() { return impl.getRequestHeaders(); } - public Headers getResponseHeaders () { + public Headers getResponseHeaders() { return impl.getResponseHeaders(); } - public URI getRequestURI () { + public URI getRequestURI() { return impl.getRequestURI(); } - public String getRequestMethod (){ + public String getRequestMethod() { return impl.getRequestMethod(); } - public HttpContextImpl getHttpContext (){ + public HttpContextImpl getHttpContext() { return impl.getHttpContext(); } - public void close () { + public void close() { impl.close(); } - public InputStream getRequestBody () { + public InputStream getRequestBody() { return impl.getRequestBody(); } - public int getResponseCode () { + public int getResponseCode() { return impl.getResponseCode(); } - public OutputStream getResponseBody () { + public OutputStream getResponseBody() { return impl.getResponseBody(); } - public void sendResponseHeaders (int rCode, long contentLen) + public void sendResponseHeaders(int rCode, long contentLen) throws IOException { - impl.sendResponseHeaders (rCode, contentLen); + impl.sendResponseHeaders(rCode, contentLen); } - public InetSocketAddress getRemoteAddress (){ + public InetSocketAddress getRemoteAddress() { return impl.getRemoteAddress(); } - public InetSocketAddress getLocalAddress (){ + public InetSocketAddress getLocalAddress() { return impl.getLocalAddress(); } - public String getProtocol (){ + public String getProtocol() { return impl.getProtocol(); } - public Object getAttribute (String name) { - return impl.getAttribute (name); + public Object getAttribute(String name) { + return impl.getAttribute(name); } - public void setAttribute (String name, Object value) { - impl.setAttribute (name, value); + public void setAttribute(String name, Object value) { + impl.setAttribute(name, value); } - public void setStreams (InputStream i, OutputStream o) { - impl.setStreams (i, o); + public void setStreams(InputStream i, OutputStream o) { + impl.setStreams(i, o); } - public HttpPrincipal getPrincipal () { + public HttpPrincipal getPrincipal() { return impl.getPrincipal(); } - ExchangeImpl getExchangeImpl () { + ExchangeImpl getExchangeImpl() { return impl; } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpServerImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpServerImpl.java index dd09957c0c6..93ace4e7bd2 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpServerImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpServerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,50 +35,50 @@ public class HttpServerImpl extends HttpServer { ServerImpl server; - HttpServerImpl () throws IOException { - this (new InetSocketAddress(80), 0); + HttpServerImpl() throws IOException { + this(new InetSocketAddress(80), 0); } - HttpServerImpl ( + HttpServerImpl( InetSocketAddress addr, int backlog ) throws IOException { - server = new ServerImpl (this, "http", addr, backlog); + server = new ServerImpl(this, "http", addr, backlog); } - public void bind (InetSocketAddress addr, int backlog) throws IOException { - server.bind (addr, backlog); + public void bind(InetSocketAddress addr, int backlog) throws IOException { + server.bind(addr, backlog); } - public void start () { + public void start() { server.start(); } - public void setExecutor (Executor executor) { + public void setExecutor(Executor executor) { server.setExecutor(executor); } - public Executor getExecutor () { + public Executor getExecutor() { return server.getExecutor(); } - public void stop (int delay) { - server.stop (delay); + public void stop(int delay) { + server.stop(delay); } - public HttpContextImpl createContext (String path, HttpHandler handler) { - return server.createContext (path, handler); + public HttpContextImpl createContext(String path, HttpHandler handler) { + return server.createContext(path, handler); } - public HttpContextImpl createContext (String path) { - return server.createContext (path); + public HttpContextImpl createContext(String path) { + return server.createContext(path); } - public void removeContext (String path) throws IllegalArgumentException { - server.removeContext (path); + public void removeContext(String path) throws IllegalArgumentException { + server.removeContext(path); } - public void removeContext (HttpContext context) throws IllegalArgumentException { - server.removeContext (context); + public void removeContext(HttpContext context) throws IllegalArgumentException { + server.removeContext(context); } public InetSocketAddress getAddress() { diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsExchangeImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsExchangeImpl.java index f7f43d7feca..939b88d3928 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsExchangeImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsExchangeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,86 +38,86 @@ class HttpsExchangeImpl extends HttpsExchange { ExchangeImpl impl; - HttpsExchangeImpl (ExchangeImpl impl) throws IOException { + HttpsExchangeImpl(ExchangeImpl impl) throws IOException { this.impl = impl; } - public Headers getRequestHeaders () { + public Headers getRequestHeaders() { return impl.getRequestHeaders(); } - public Headers getResponseHeaders () { + public Headers getResponseHeaders() { return impl.getResponseHeaders(); } - public URI getRequestURI () { + public URI getRequestURI() { return impl.getRequestURI(); } - public String getRequestMethod (){ + public String getRequestMethod() { return impl.getRequestMethod(); } - public HttpContextImpl getHttpContext (){ + public HttpContextImpl getHttpContext() { return impl.getHttpContext(); } - public void close () { + public void close() { impl.close(); } - public InputStream getRequestBody () { + public InputStream getRequestBody() { return impl.getRequestBody(); } - public int getResponseCode () { + public int getResponseCode() { return impl.getResponseCode(); } - public OutputStream getResponseBody () { + public OutputStream getResponseBody() { return impl.getResponseBody(); } - public void sendResponseHeaders (int rCode, long contentLen) + public void sendResponseHeaders(int rCode, long contentLen) throws IOException { - impl.sendResponseHeaders (rCode, contentLen); + impl.sendResponseHeaders(rCode, contentLen); } - public InetSocketAddress getRemoteAddress (){ + public InetSocketAddress getRemoteAddress() { return impl.getRemoteAddress(); } - public InetSocketAddress getLocalAddress (){ + public InetSocketAddress getLocalAddress() { return impl.getLocalAddress(); } - public String getProtocol (){ + public String getProtocol() { return impl.getProtocol(); } - public SSLSession getSSLSession () { - return impl.getSSLSession (); + public SSLSession getSSLSession() { + return impl.getSSLSession(); } - public Object getAttribute (String name) { - return impl.getAttribute (name); + public Object getAttribute(String name) { + return impl.getAttribute(name); } - public void setAttribute (String name, Object value) { - impl.setAttribute (name, value); + public void setAttribute(String name, Object value) { + impl.setAttribute(name, value); } - public void setStreams (InputStream i, OutputStream o) { - impl.setStreams (i, o); + public void setStreams(InputStream i, OutputStream o) { + impl.setStreams(i, o); } - public HttpPrincipal getPrincipal () { + public HttpPrincipal getPrincipal() { return impl.getPrincipal(); } - ExchangeImpl getExchangeImpl () { + ExchangeImpl getExchangeImpl() { return impl; } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsServerImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsServerImpl.java index 97312ec29e6..8ef179c1194 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsServerImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/HttpsServerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,58 +35,58 @@ public class HttpsServerImpl extends HttpsServer { ServerImpl server; - HttpsServerImpl () throws IOException { - this (new InetSocketAddress(443), 0); + HttpsServerImpl() throws IOException { + this(new InetSocketAddress(443), 0); } - HttpsServerImpl ( + HttpsServerImpl( InetSocketAddress addr, int backlog ) throws IOException { - server = new ServerImpl (this, "https", addr, backlog); + server = new ServerImpl(this, "https", addr, backlog); } - public void setHttpsConfigurator (HttpsConfigurator config) { - server.setHttpsConfigurator (config); + public void setHttpsConfigurator(HttpsConfigurator config) { + server.setHttpsConfigurator(config); } - public HttpsConfigurator getHttpsConfigurator () { + public HttpsConfigurator getHttpsConfigurator() { return server.getHttpsConfigurator(); } - public void bind (InetSocketAddress addr, int backlog) throws IOException { - server.bind (addr, backlog); + public void bind(InetSocketAddress addr, int backlog) throws IOException { + server.bind(addr, backlog); } - public void start () { + public void start() { server.start(); } - public void setExecutor (Executor executor) { + public void setExecutor(Executor executor) { server.setExecutor(executor); } - public Executor getExecutor () { + public Executor getExecutor() { return server.getExecutor(); } - public void stop (int delay) { - server.stop (delay); + public void stop(int delay) { + server.stop(delay); } - public HttpContextImpl createContext (String path, HttpHandler handler) { - return server.createContext (path, handler); + public HttpContextImpl createContext(String path, HttpHandler handler) { + return server.createContext(path, handler); } - public HttpContextImpl createContext (String path) { - return server.createContext (path); + public HttpContextImpl createContext(String path) { + return server.createContext(path); } - public void removeContext (String path) throws IllegalArgumentException { - server.removeContext (path); + public void removeContext(String path) throws IllegalArgumentException { + server.removeContext(path); } - public void removeContext (HttpContext context) throws IllegalArgumentException { - server.removeContext (context); + public void removeContext(HttpContext context) throws IllegalArgumentException { + server.removeContext(context); } public InetSocketAddress getAddress() { diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/LeftOverInputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/LeftOverInputStream.java index 772fa621076..ea904835770 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/LeftOverInputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/LeftOverInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -45,47 +45,47 @@ abstract class LeftOverInputStream extends FilterInputStream { final ServerImpl server; protected boolean closed = false; protected boolean eof = false; - byte[] one = new byte [1]; + byte[] one = new byte[1]; private static final int MAX_SKIP_BUFFER_SIZE = 2048; - public LeftOverInputStream (ExchangeImpl t, InputStream src) { - super (src); + public LeftOverInputStream(ExchangeImpl t, InputStream src) { + super(src); this.t = t; this.server = t.getServerImpl(); } /** * if bytes are left over buffered on *the UNDERLYING* stream */ - public boolean isDataBuffered () throws IOException { + public boolean isDataBuffered() throws IOException { assert eof; return super.available() > 0; } - public void close () throws IOException { + public void close() throws IOException { if (closed) { return; } closed = true; if (!eof) { - eof = drain (ServerConfig.getDrainAmount()); + eof = drain(ServerConfig.getDrainAmount()); } } - public boolean isClosed () { + public boolean isClosed() { return closed; } - public boolean isEOF () { + public boolean isEOF() { return eof; } - protected abstract int readImpl (byte[]b, int off, int len) throws IOException; + protected abstract int readImpl(byte[] b, int off, int len) throws IOException; - public synchronized int read () throws IOException { + public synchronized int read() throws IOException { if (closed) { - throw new IOException ("Stream is closed"); + throw new IOException("Stream is closed"); } - int c = readImpl (one, 0, 1); + int c = readImpl(one, 0, 1); if (c == -1 || c == 0) { return c; } else { @@ -93,11 +93,11 @@ abstract class LeftOverInputStream extends FilterInputStream { } } - public synchronized int read (byte[]b, int off, int len) throws IOException { + public synchronized int read(byte[] b, int off, int len) throws IOException { if (closed) { - throw new IOException ("Stream is closed"); + throw new IOException("Stream is closed"); } - return readImpl (b, off, len); + return readImpl(b, off, len); } @Override @@ -132,7 +132,7 @@ abstract class LeftOverInputStream extends FilterInputStream { * is at eof (ie. all bytes were read) or false if not * (still bytes to be read) */ - public boolean drain (long l) throws IOException { + public boolean drain(long l) throws IOException { while (l > 0) { long skip = skip(l); if (skip <= 0) break; // might return 0 if isFinishing or EOF diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/Request.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/Request.java index 6c0c2c271ed..75eeb29f015 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/Request.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/Request.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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,6 +25,7 @@ package sun.net.httpserver; +import java.net.ProtocolException; import java.nio.*; import java.io.*; import java.nio.channels.*; @@ -39,15 +40,18 @@ class Request { static final int BUF_LEN = 2048; static final byte CR = 13; static final byte LF = 10; + static final byte FIRST_CHAR = 32; private String startLine; private SocketChannel chan; private InputStream is; private OutputStream os; private final int maxReqHeaderSize; + private final boolean firstClearRequest; - Request (InputStream rawInputStream, OutputStream rawout) throws IOException { + Request(InputStream rawInputStream, OutputStream rawout, boolean firstClearRequest) throws IOException { this.maxReqHeaderSize = ServerConfig.getMaxReqHeaderSize(); + this.firstClearRequest = firstClearRequest; is = rawInputStream; os = rawout; do { @@ -57,15 +61,15 @@ class Request { } - char[] buf = new char [BUF_LEN]; + char[] buf = new char[BUF_LEN]; int pos; StringBuffer lineBuf; - public InputStream inputStream () { + public InputStream inputStream() { return is; } - public OutputStream outputStream () { + public OutputStream outputStream() { return os; } @@ -74,10 +78,29 @@ class Request { * Not used for reading headers. */ - public String readLine () throws IOException { + public String readLine() throws IOException { boolean gotCR = false, gotLF = false; pos = 0; lineBuf = new StringBuffer(); long lsize = 32; + + // For the first request that comes on a clear connection + // we will check that the first non CR/LF char on the + // request line is eligible. This should be the first char + // of a method name, so it should be at least greater or equal + // to 32 (FIRST_CHAR) which is the space character. + // The main goal here is to fail fast if we receive 0x16 (22) which + // happens to be the first byte of a TLS handshake record. + // This is typically what would be received if a TLS client opened + // a TLS connection on a non-TLS server. + // If we receive 0x16 we should close the connection immediately as + // it indicates we're receiving a ClientHello on a clear + // connection, and we will never receive the expected CRLF that + // terminates the first request line. + // Though we could check only for 0x16, any characters < 32 + // (excluding CRLF) is not expected at this position in a + // request line, so we can still fail here early if any of + // those are detected. + int offset = 0; while (!gotLF) { int c = is.read(); if (c == -1) { @@ -88,15 +111,27 @@ class Request { gotLF = true; } else { gotCR = false; - consume (CR); - consume (c); + consume(CR); + if (firstClearRequest && offset == 0) { + if (c < FIRST_CHAR) { + throw new ProtocolException("Unexpected start of request line"); + } + offset++; + } + consume(c); lsize = lsize + 2; } } else { if (c == CR) { gotCR = true; } else { - consume (c); + if (firstClearRequest && offset == 0) { + if (c < FIRST_CHAR) { + throw new ProtocolException("Unexpected start of request line"); + } + offset++; + } + consume(c); lsize = lsize + 1; } } @@ -106,13 +141,13 @@ class Request { ServerConfig.getMaxReqHeaderSize() + "."); } } - lineBuf.append (buf, 0, pos); - return new String (lineBuf); + lineBuf.append(buf, 0, pos); + return new String(lineBuf); } - private void consume (int c) throws IOException { + private void consume(int c) throws IOException { if (pos == BUF_LEN) { - lineBuf.append (buf); + lineBuf.append(buf); pos = 0; } buf[pos++] = (char)c; @@ -121,13 +156,13 @@ class Request { /** * returns the request line (first line of a request) */ - public String requestLine () { + public String requestLine() { return startLine; } Headers hdrs = null; @SuppressWarnings("fallthrough") - Headers headers () throws IOException { + Headers headers() throws IOException { if (hdrs != null) { return hdrs; } @@ -239,7 +274,7 @@ class Request { if (k == null) { // Headers disallows null keys, use empty string k = ""; // instead to represent invalid key } - hdrs.add (k,v); + hdrs.add(k, v); len = 0; } return hdrs; @@ -262,21 +297,21 @@ class Request { ServerImpl server; static final int BUFSIZE = 8 * 1024; - public ReadStream (ServerImpl server, SocketChannel chan) throws IOException { + public ReadStream(ServerImpl server, SocketChannel chan) throws IOException { this.channel = chan; this.server = server; - chanbuf = ByteBuffer.allocate (BUFSIZE); + chanbuf = ByteBuffer.allocate(BUFSIZE); chanbuf.clear(); one = new byte[1]; closed = marked = reset = false; } - public synchronized int read (byte[] b) throws IOException { - return read (b, 0, b.length); + public synchronized int read(byte[] b) throws IOException { + return read(b, 0, b.length); } - public synchronized int read () throws IOException { - int result = read (one, 0, 1); + public synchronized int read() throws IOException { + int result = read(one, 0, 1); if (result == 1) { return one[0] & 0xFF; } else { @@ -284,12 +319,12 @@ class Request { } } - public synchronized int read (byte[] b, int off, int srclen) throws IOException { + public synchronized int read(byte[] b, int off, int srclen) throws IOException { int canreturn, willreturn; if (closed) - throw new IOException ("Stream closed"); + throw new IOException("Stream closed"); if (eof) { return -1; @@ -300,30 +335,30 @@ class Request { Objects.checkFromIndexSize(off, srclen, b.length); if (reset) { /* satisfy from markBuf */ - canreturn = markBuf.remaining (); + canreturn = markBuf.remaining(); willreturn = canreturn>srclen ? srclen : canreturn; markBuf.get(b, off, willreturn); if (canreturn == willreturn) { reset = false; } } else { /* satisfy from channel */ - chanbuf.clear (); + chanbuf.clear(); if (srclen < BUFSIZE) { - chanbuf.limit (srclen); + chanbuf.limit(srclen); } do { - willreturn = channel.read (chanbuf); + willreturn = channel.read(chanbuf); } while (willreturn == 0); if (willreturn == -1) { eof = true; return -1; } - chanbuf.flip (); + chanbuf.flip(); chanbuf.get(b, off, willreturn); if (marked) { /* copy into markBuf */ try { - markBuf.put (b, off, willreturn); + markBuf.put(b, off, willreturn); } catch (BufferOverflowException e) { marked = false; } @@ -332,14 +367,14 @@ class Request { return willreturn; } - public boolean markSupported () { + public boolean markSupported() { return true; } /* Does not query the OS socket */ - public synchronized int available () throws IOException { + public synchronized int available() throws IOException { if (closed) - throw new IOException ("Stream is closed"); + throw new IOException("Stream is closed"); if (eof) return -1; @@ -350,31 +385,31 @@ class Request { return chanbuf.remaining(); } - public void close () throws IOException { + public void close() throws IOException { if (closed) { return; } - channel.close (); + channel.close(); closed = true; } - public synchronized void mark (int readlimit) { + public synchronized void mark(int readlimit) { if (closed) return; this.readlimit = readlimit; - markBuf = ByteBuffer.allocate (readlimit); + markBuf = ByteBuffer.allocate(readlimit); marked = true; reset = false; } - public synchronized void reset () throws IOException { + public synchronized void reset() throws IOException { if (closed ) return; if (!marked) - throw new IOException ("Stream not marked"); + throw new IOException("Stream not marked"); marked = false; reset = true; - markBuf.flip (); + markBuf.flip(); } } @@ -386,50 +421,50 @@ class Request { byte[] one; ServerImpl server; - public WriteStream (ServerImpl server, SocketChannel channel) throws IOException { + public WriteStream(ServerImpl server, SocketChannel channel) throws IOException { this.channel = channel; this.server = server; assert channel.isBlocking(); closed = false; one = new byte [1]; - buf = ByteBuffer.allocate (4096); + buf = ByteBuffer.allocate(4096); } - public synchronized void write (int b) throws IOException { + public synchronized void write(int b) throws IOException { one[0] = (byte)b; write (one, 0, 1); } - public synchronized void write (byte[] b) throws IOException { + public synchronized void write(byte[] b) throws IOException { write (b, 0, b.length); } - public synchronized void write (byte[] b, int off, int len) throws IOException { + public synchronized void write(byte[] b, int off, int len) throws IOException { int l = len; if (closed) - throw new IOException ("stream is closed"); + throw new IOException("stream is closed"); int cap = buf.capacity(); if (cap < len) { int diff = len - cap; - buf = ByteBuffer.allocate (2*(cap+diff)); + buf = ByteBuffer.allocate(2*(cap+diff)); } buf.clear(); - buf.put (b, off, len); - buf.flip (); + buf.put(b, off, len); + buf.flip(); int n; - while ((n = channel.write (buf)) < l) { + while ((n = channel.write(buf)) < l) { l -= n; if (l == 0) return; } } - public void close () throws IOException { + public void close() throws IOException { if (closed) return; - //server.logStackTrace ("Request.OS.close: isOpen="+channel.isOpen()); - channel.close (); + //server.logStackTrace("Request.OS.close: isOpen="+channel.isOpen()); + channel.close(); closed = true; } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java index 5cc16befa96..5f5eef0c684 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/SSLStreams.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -53,35 +53,35 @@ class SSLStreams { /* held by thread doing the hand-shake on this connection */ Lock handshaking = new ReentrantLock(); - SSLStreams (ServerImpl server, SSLContext sslctx, SocketChannel chan) throws IOException { + SSLStreams(ServerImpl server, SSLContext sslctx, SocketChannel chan) throws IOException { this.server = server; this.sslctx= sslctx; this.chan= chan; InetSocketAddress addr = (InetSocketAddress)chan.socket().getRemoteSocketAddress(); - engine = sslctx.createSSLEngine (addr.getHostName(), addr.getPort()); - engine.setUseClientMode (false); + engine = sslctx.createSSLEngine(addr.getHostName(), addr.getPort()); + engine.setUseClientMode(false); HttpsConfigurator cfg = server.getHttpsConfigurator(); - configureEngine (cfg, addr); - wrapper = new EngineWrapper (chan, engine); + configureEngine(cfg, addr); + wrapper = new EngineWrapper(chan, engine); } @SuppressWarnings("deprecation") - private void configureEngine(HttpsConfigurator cfg, InetSocketAddress addr){ + private void configureEngine(HttpsConfigurator cfg, InetSocketAddress addr) { if (cfg != null) { - Parameters params = new Parameters (cfg, addr); + Parameters params = new Parameters(cfg, addr); //BEGIN_TIGER_EXCLUDE - cfg.configure (params); + cfg.configure(params); SSLParameters sslParams = params.getSSLParameters(); if (sslParams != null) { - engine.setSSLParameters (sslParams); + engine.setSSLParameters(sslParams); } else //END_TIGER_EXCLUDE { /* tiger compatibility */ if (params.getCipherSuites() != null) { try { - engine.setEnabledCipherSuites ( + engine.setEnabledCipherSuites( params.getCipherSuites() ); } catch (IllegalArgumentException e) { /* LOG */} @@ -93,7 +93,7 @@ class SSLStreams { } if (params.getProtocols() != null) { try { - engine.setEnabledProtocols ( + engine.setEnabledProtocols( params.getProtocols() ); } catch (IllegalArgumentException e) { /* LOG */} @@ -106,11 +106,11 @@ class SSLStreams { InetSocketAddress addr; HttpsConfigurator cfg; - Parameters (HttpsConfigurator cfg, InetSocketAddress addr) { + Parameters(HttpsConfigurator cfg, InetSocketAddress addr) { this.addr = addr; this.cfg = cfg; } - public InetSocketAddress getClientAddress () { + public InetSocketAddress getClientAddress() { return addr; } public HttpsConfigurator getHttpsConfigurator() { @@ -118,10 +118,10 @@ class SSLStreams { } //BEGIN_TIGER_EXCLUDE SSLParameters params; - public void setSSLParameters (SSLParameters p) { + public void setSSLParameters(SSLParameters p) { params = p; } - SSLParameters getSSLParameters () { + SSLParameters getSSLParameters() { return params; } //END_TIGER_EXCLUDE @@ -130,14 +130,14 @@ class SSLStreams { /** * cleanup resources allocated inside this object */ - void close () throws IOException { + void close() throws IOException { wrapper.close(); } /** * return the SSL InputStream */ - InputStream getInputStream () throws IOException { + InputStream getInputStream() throws IOException { if (is == null) { is = new InputStream(); } @@ -147,14 +147,14 @@ class SSLStreams { /** * return the SSL OutputStream */ - OutputStream getOutputStream () throws IOException { + OutputStream getOutputStream() throws IOException { if (os == null) { os = new OutputStream(); } return os; } - SSLEngine getSSLEngine () { + SSLEngine getSSLEngine() { return engine; } @@ -183,11 +183,11 @@ class SSLStreams { PACKET, APPLICATION }; - private ByteBuffer allocate (BufType type) { - return allocate (type, -1); + private ByteBuffer allocate(BufType type) { + return allocate(type, -1); } - private ByteBuffer allocate (BufType type, int len) { + private ByteBuffer allocate(BufType type, int len) { assert engine != null; synchronized (this) { int size; @@ -210,7 +210,7 @@ class SSLStreams { } size = app_buf_size; } - return ByteBuffer.allocate (size); + return ByteBuffer.allocate(size); } } @@ -222,10 +222,10 @@ class SSLStreams { * flip is set to true if the old buffer needs to be flipped * before it is copied. */ - private ByteBuffer realloc (ByteBuffer b, boolean flip, BufType type) { + private ByteBuffer realloc(ByteBuffer b, boolean flip, BufType type) { synchronized (this) { int nsize = 2 * b.capacity(); - ByteBuffer n = allocate (type, nsize); + ByteBuffer n = allocate(type, nsize); if (flip) { b.flip(); } @@ -252,7 +252,7 @@ class SSLStreams { boolean closed = false; int u_remaining; // the number of bytes left in unwrap_src after an unwrap() - EngineWrapper (SocketChannel chan, SSLEngine engine) throws IOException { + EngineWrapper(SocketChannel chan, SSLEngine engine) throws IOException { this.chan = chan; this.engine = engine; wrapLock = new Object(); @@ -261,7 +261,7 @@ class SSLStreams { wrap_dst = allocate(BufType.PACKET); } - void close () throws IOException { + void close() throws IOException { } /* try to wrap and send the data in src. Handles OVERFLOW. @@ -275,17 +275,17 @@ class SSLStreams { WrapperResult wrapAndSendX(ByteBuffer src, boolean ignoreClose) throws IOException { if (closed && !ignoreClose) { - throw new IOException ("Engine is closed"); + throw new IOException("Engine is closed"); } Status status; WrapperResult r = new WrapperResult(); synchronized (wrapLock) { wrap_dst.clear(); do { - r.result = engine.wrap (src, wrap_dst); + r.result = engine.wrap(src, wrap_dst); status = r.result.getStatus(); if (status == Status.BUFFER_OVERFLOW) { - wrap_dst = realloc (wrap_dst, true, BufType.PACKET); + wrap_dst = realloc(wrap_dst, true, BufType.PACKET); } } while (status == Status.BUFFER_OVERFLOW); if (status == Status.CLOSED && !ignoreClose) { @@ -296,7 +296,7 @@ class SSLStreams { int l = wrap_dst.remaining(); assert l == r.result.bytesProduced(); while (l>0) { - l -= chan.write (wrap_dst); + l -= chan.write(wrap_dst); } } } @@ -313,7 +313,7 @@ class SSLStreams { WrapperResult r = new WrapperResult(); r.buf = dst; if (closed) { - throw new IOException ("Engine is closed"); + throw new IOException("Engine is closed"); } boolean needData; if (u_remaining > 0) { @@ -329,19 +329,19 @@ class SSLStreams { do { if (needData) { do { - x = chan.read (unwrap_src); + x = chan.read(unwrap_src); } while (x == 0); if (x == -1) { - throw new IOException ("connection closed for reading"); + throw new IOException("connection closed for reading"); } unwrap_src.flip(); } - r.result = engine.unwrap (unwrap_src, r.buf); + r.result = engine.unwrap(unwrap_src, r.buf); status = r.result.getStatus(); if (status == Status.BUFFER_UNDERFLOW) { if (unwrap_src.limit() == unwrap_src.capacity()) { /* buffer not big enough */ - unwrap_src = realloc ( + unwrap_src = realloc( unwrap_src, false, BufType.PACKET ); } else { @@ -349,12 +349,12 @@ class SSLStreams { * data off the channel. Reset pointers * for reading off SocketChannel */ - unwrap_src.position (unwrap_src.limit()); - unwrap_src.limit (unwrap_src.capacity()); + unwrap_src.position(unwrap_src.limit()); + unwrap_src.limit(unwrap_src.capacity()); } needData = true; } else if (status == Status.BUFFER_OVERFLOW) { - r.buf = realloc (r.buf, true, BufType.APPLICATION); + r.buf = realloc(r.buf, true, BufType.APPLICATION); needData = false; } else if (status == Status.CLOSED) { closed = true; @@ -374,13 +374,13 @@ class SSLStreams { * all of the given user data has been sent and any handshake has been * completed. Caller should check if engine has been closed. */ - public WrapperResult sendData (ByteBuffer src) throws IOException { + public WrapperResult sendData(ByteBuffer src) throws IOException { WrapperResult r=null; while (src.remaining() > 0) { r = wrapper.wrapAndSend(src); Status status = r.result.getStatus(); if (status == Status.CLOSED) { - doClosure (); + doClosure(); return r; } HandshakeStatus hs_status = r.result.getHandshakeStatus(); @@ -399,16 +399,16 @@ class SSLStreams { * and returned. This call handles handshaking automatically. * Caller should check if engine has been closed. */ - public WrapperResult recvData (ByteBuffer dst) throws IOException { + public WrapperResult recvData(ByteBuffer dst) throws IOException { /* we wait until some user data arrives */ WrapperResult r = null; assert dst.position() == 0; while (dst.position() == 0) { - r = wrapper.recvAndUnwrap (dst); + r = wrapper.recvAndUnwrap(dst); dst = (r.buf != dst) ? r.buf: dst; Status status = r.result.getStatus(); if (status == Status.CLOSED) { - doClosure (); + doClosure(); return r; } @@ -416,7 +416,7 @@ class SSLStreams { if (hs_status != HandshakeStatus.FINISHED && hs_status != HandshakeStatus.NOT_HANDSHAKING) { - doHandshake (hs_status); + doHandshake(hs_status); } } dst.flip(); @@ -426,7 +426,7 @@ class SSLStreams { /* we've received a close notify. Need to call wrap to send * the response */ - void doClosure () throws IOException { + void doClosure() throws IOException { try { handshaking.lock(); ByteBuffer tmp = allocate(BufType.APPLICATION); @@ -435,8 +435,8 @@ class SSLStreams { HandshakeStatus hs; do { tmp.clear(); - tmp.flip (); - r = wrapper.wrapAndSendX (tmp, true); + tmp.flip(); + r = wrapper.wrapAndSendX(tmp, true); hs = r.result.getHandshakeStatus(); st = r.result.getStatus(); } while (st != Status.CLOSED && @@ -452,7 +452,7 @@ class SSLStreams { * is called with no data to send then there must be no problem */ @SuppressWarnings("fallthrough") - void doHandshake (HandshakeStatus hs_status) throws IOException { + void doHandshake(HandshakeStatus hs_status) throws IOException { try { handshaking.lock(); ByteBuffer tmp = allocate(BufType.APPLICATION); @@ -478,7 +478,7 @@ class SSLStreams { case NEED_UNWRAP: tmp.clear(); - r = wrapper.recvAndUnwrap (tmp); + r = wrapper.recvAndUnwrap(tmp); if (r.buf != tmp) { tmp = r.buf; } @@ -507,27 +507,27 @@ class SSLStreams { boolean needData = true; - InputStream () { - bbuf = allocate (BufType.APPLICATION); + InputStream() { + bbuf = allocate(BufType.APPLICATION); } - public int read (byte[] buf, int off, int len) throws IOException { + public int read(byte[] buf, int off, int len) throws IOException { if (closed) { - throw new IOException ("SSL stream is closed"); + throw new IOException("SSL stream is closed"); } if (eof) { return -1; } - int available=0; + int available = 0; if (!needData) { available = bbuf.remaining(); - needData = (available==0); + needData = (available == 0); } if (needData) { bbuf.clear(); - WrapperResult r = recvData (bbuf); - bbuf = r.buf== bbuf? bbuf: r.buf; - if ((available=bbuf.remaining()) == 0) { + WrapperResult r = recvData(bbuf); + bbuf = r.buf == bbuf ? bbuf: r.buf; + if ((available = bbuf.remaining()) == 0) { eof = true; return -1; } else { @@ -538,26 +538,26 @@ class SSLStreams { if (len > available) { len = available; } - bbuf.get (buf, off, len); + bbuf.get(buf, off, len); return len; } - public int available () throws IOException { + public int available() throws IOException { return bbuf.remaining(); } - public boolean markSupported () { + public boolean markSupported() { return false; /* not possible with SSLEngine */ } - public void reset () throws IOException { - throw new IOException ("mark/reset not supported"); + public void reset() throws IOException { + throw new IOException("mark/reset not supported"); } - public long skip (long s) throws IOException { + public long skip(long s) throws IOException { int n = (int)s; if (closed) { - throw new IOException ("SSL stream is closed"); + throw new IOException("SSL stream is closed"); } if (eof) { return 0; @@ -565,13 +565,13 @@ class SSLStreams { int ret = n; while (n > 0) { if (bbuf.remaining() >= n) { - bbuf.position (bbuf.position()+n); + bbuf.position(bbuf.position()+n); return ret; } else { n -= bbuf.remaining(); bbuf.clear(); - WrapperResult r = recvData (bbuf); - bbuf = r.buf==bbuf? bbuf: r.buf; + WrapperResult r = recvData(bbuf); + bbuf = r.buf == bbuf ? bbuf: r.buf; } } return ret; /* not reached */ @@ -582,22 +582,22 @@ class SSLStreams { * before this is called. Otherwise an exception will be thrown. * [Note. May need to revisit this. not quite the normal close() semantics */ - public void close () throws IOException { + public void close() throws IOException { eof = true; - engine.closeInbound (); + engine.closeInbound(); } - public int read (byte[] buf) throws IOException { - return read (buf, 0, buf.length); + public int read(byte[] buf) throws IOException { + return read(buf, 0, buf.length); } byte single[] = new byte [1]; - public int read () throws IOException { + public int read() throws IOException { if (eof) { return -1; } - int n = read (single, 0, 1); + int n = read(single, 0, 1); if (n <= 0) { return -1; } else { @@ -622,28 +622,28 @@ class SSLStreams { public void write(int b) throws IOException { single[0] = (byte)b; - write (single, 0, 1); + write(single, 0, 1); } public void write(byte b[]) throws IOException { - write (b, 0, b.length); + write(b, 0, b.length); } public void write(byte b[], int off, int len) throws IOException { if (closed) { - throw new IOException ("output stream is closed"); + throw new IOException("output stream is closed"); } while (len > 0) { int l = len > buf.capacity() ? buf.capacity() : len; buf.clear(); - buf.put (b, off, l); + buf.put(b, off, l); len -= l; off += l; buf.flip(); - WrapperResult r = sendData (buf); + WrapperResult r = sendData(buf); if (r.result.getStatus() == Status.CLOSED) { closed = true; if (len > 0) { - throw new IOException ("output stream is closed"); + throw new IOException("output stream is closed"); } } } @@ -654,13 +654,13 @@ class SSLStreams { } public void close() throws IOException { - WrapperResult r=null; + WrapperResult r = null; engine.closeOutbound(); closed = true; HandshakeStatus stat = HandshakeStatus.NEED_WRAP; buf.clear(); while (stat == HandshakeStatus.NEED_WRAP) { - r = wrapper.wrapAndSend (buf); + r = wrapper.wrapAndSend(buf); stat = r.result.getHandshakeStatus(); } assert r.result.getStatus() == Status.CLOSED diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java index 217ae86f5d3..e8c8d336e03 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java @@ -45,6 +45,7 @@ import java.lang.System.Logger; import java.lang.System.Logger.Level; import java.net.BindException; import java.net.InetSocketAddress; +import java.net.ProtocolException; import java.net.ServerSocket; import java.net.URI; import java.net.URISyntaxException; @@ -128,61 +129,61 @@ class ServerImpl { private final Logger logger; private Thread dispatcherThread; - ServerImpl ( + ServerImpl( HttpServer wrapper, String protocol, InetSocketAddress addr, int backlog ) throws IOException { this.protocol = protocol; this.wrapper = wrapper; - this.logger = System.getLogger ("com.sun.net.httpserver"); - ServerConfig.checkLegacyProperties (logger); - https = protocol.equalsIgnoreCase ("https"); + this.logger = System.getLogger("com.sun.net.httpserver"); + ServerConfig.checkLegacyProperties(logger); + https = protocol.equalsIgnoreCase("https"); this.address = addr; contexts = new ContextList(); schan = ServerSocketChannel.open(); if (addr != null) { ServerSocket socket = schan.socket(); - socket.bind (addr, backlog); + socket.bind(addr, backlog); bound = true; } - selector = Selector.open (); - schan.configureBlocking (false); - listenerKey = schan.register (selector, SelectionKey.OP_ACCEPT); + selector = Selector.open(); + schan.configureBlocking(false); + listenerKey = schan.register(selector, SelectionKey.OP_ACCEPT); dispatcher = new Dispatcher(); - idleConnections = Collections.synchronizedSet (new HashSet()); - allConnections = Collections.synchronizedSet (new HashSet()); - reqConnections = Collections.synchronizedSet (new HashSet()); - rspConnections = Collections.synchronizedSet (new HashSet()); + idleConnections = Collections.synchronizedSet(new HashSet()); + allConnections = Collections.synchronizedSet(new HashSet()); + reqConnections = Collections.synchronizedSet(new HashSet()); + rspConnections = Collections.synchronizedSet(new HashSet()); newlyAcceptedConnections = Collections.synchronizedSet(new HashSet<>()); - timer = new Timer ("idle-timeout-task", true); - timer.schedule (new IdleTimeoutTask(), IDLE_TIMER_TASK_SCHEDULE, IDLE_TIMER_TASK_SCHEDULE); + timer = new Timer("idle-timeout-task", true); + timer.schedule(new IdleTimeoutTask(), IDLE_TIMER_TASK_SCHEDULE, IDLE_TIMER_TASK_SCHEDULE); if (reqRspTimeoutEnabled) { - timer1 = new Timer ("req-rsp-timeout-task", true); - timer1.schedule (new ReqRspTimeoutTask(), REQ_RSP_TIMER_SCHEDULE, REQ_RSP_TIMER_SCHEDULE); + timer1 = new Timer("req-rsp-timeout-task", true); + timer1.schedule(new ReqRspTimeoutTask(), REQ_RSP_TIMER_SCHEDULE, REQ_RSP_TIMER_SCHEDULE); logger.log(Level.DEBUG, "HttpServer request/response timeout task schedule ms: ", REQ_RSP_TIMER_SCHEDULE); - logger.log (Level.DEBUG, "MAX_REQ_TIME: "+MAX_REQ_TIME); - logger.log (Level.DEBUG, "MAX_RSP_TIME: "+MAX_RSP_TIME); + logger.log(Level.DEBUG, "MAX_REQ_TIME: "+MAX_REQ_TIME); + logger.log(Level.DEBUG, "MAX_RSP_TIME: "+MAX_RSP_TIME); } events = new ArrayList<>(); - logger.log (Level.DEBUG, "HttpServer created "+protocol+" "+ addr); + logger.log(Level.DEBUG, "HttpServer created "+protocol+" "+ addr); } - public void bind (InetSocketAddress addr, int backlog) throws IOException { + public void bind(InetSocketAddress addr, int backlog) throws IOException { if (bound) { - throw new BindException ("HttpServer already bound"); + throw new BindException("HttpServer already bound"); } if (addr == null) { - throw new NullPointerException ("null address"); + throw new NullPointerException("null address"); } ServerSocket socket = schan.socket(); - socket.bind (addr, backlog); + socket.bind(addr, backlog); bound = true; } - public void start () { + public void start() { if (!bound || started || finished()) { - throw new IllegalStateException ("server in wrong state"); + throw new IllegalStateException("server in wrong state"); } if (executor == null) { executor = new DefaultExecutor(); @@ -192,39 +193,39 @@ class ServerImpl { dispatcherThread.start(); } - public void setExecutor (Executor executor) { + public void setExecutor(Executor executor) { if (started) { - throw new IllegalStateException ("server already started"); + throw new IllegalStateException("server already started"); } this.executor = executor; } private static class DefaultExecutor implements Executor { - public void execute (Runnable task) { + public void execute(Runnable task) { task.run(); } } - public Executor getExecutor () { + public Executor getExecutor() { return executor; } - public void setHttpsConfigurator (HttpsConfigurator config) { + public void setHttpsConfigurator(HttpsConfigurator config) { if (config == null) { - throw new NullPointerException ("null HttpsConfigurator"); + throw new NullPointerException("null HttpsConfigurator"); } if (started) { - throw new IllegalStateException ("server already started"); + throw new IllegalStateException("server already started"); } this.httpsConfig = config; sslContext = config.getSSLContext(); } - public HttpsConfigurator getHttpsConfigurator () { + public HttpsConfigurator getHttpsConfigurator() { return httpsConfig; } - private final boolean finished(){ + private final boolean finished() { // if the latch is 0, the server is finished return finishedLatch.getCount() == 0; } @@ -242,9 +243,9 @@ class ServerImpl { * * @param delay maximum delay to wait for exchanges completion, in seconds */ - public void stop (int delay) { + public void stop(int delay) { if (delay < 0) { - throw new IllegalArgumentException ("negative delay parameter"); + throw new IllegalArgumentException("negative delay parameter"); } logger.log(Level.TRACE, "stopping"); @@ -298,49 +299,49 @@ class ServerImpl { Dispatcher dispatcher; - public synchronized HttpContextImpl createContext (String path, HttpHandler handler) { + public synchronized HttpContextImpl createContext(String path, HttpHandler handler) { if (handler == null || path == null) { - throw new NullPointerException ("null handler, or path parameter"); + throw new NullPointerException("null handler, or path parameter"); } - HttpContextImpl context = new HttpContextImpl (protocol, path, handler, this); - contexts.add (context); - logger.log (Level.DEBUG, "context created: " + path); + HttpContextImpl context = new HttpContextImpl(protocol, path, handler, this); + contexts.add(context); + logger.log(Level.DEBUG, "context created: " + path); return context; } - public synchronized HttpContextImpl createContext (String path) { + public synchronized HttpContextImpl createContext(String path) { if (path == null) { - throw new NullPointerException ("null path parameter"); + throw new NullPointerException("null path parameter"); } - HttpContextImpl context = new HttpContextImpl (protocol, path, null, this); - contexts.add (context); - logger.log (Level.DEBUG, "context created: " + path); + HttpContextImpl context = new HttpContextImpl(protocol, path, null, this); + contexts.add(context); + logger.log(Level.DEBUG, "context created: " + path); return context; } - public synchronized void removeContext (String path) throws IllegalArgumentException { + public synchronized void removeContext(String path) throws IllegalArgumentException { if (path == null) { - throw new NullPointerException ("null path parameter"); + throw new NullPointerException("null path parameter"); } - contexts.remove (protocol, path); - logger.log (Level.DEBUG, "context removed: " + path); + contexts.remove(protocol, path); + logger.log(Level.DEBUG, "context removed: " + path); } - public synchronized void removeContext (HttpContext context) throws IllegalArgumentException { + public synchronized void removeContext(HttpContext context) throws IllegalArgumentException { if (!(context instanceof HttpContextImpl)) { - throw new IllegalArgumentException ("wrong HttpContext type"); + throw new IllegalArgumentException("wrong HttpContext type"); } - contexts.remove ((HttpContextImpl)context); - logger.log (Level.DEBUG, "context removed: " + context.getPath()); + contexts.remove((HttpContextImpl)context); + logger.log(Level.DEBUG, "context removed: " + context.getPath()); } public InetSocketAddress getAddress() { return (InetSocketAddress) schan.socket().getLocalSocketAddress(); } - void addEvent (Event r) { + void addEvent(Event r) { synchronized (lolock) { - events.add (r); + events.add(r); selector.wakeup(); } } @@ -413,7 +414,7 @@ class ServerImpl { */ class Dispatcher implements Runnable { - private void handleEvent (Event r) { + private void handleEvent(Event r) { // Stopping marking the state as finished if stop is requested, // termination is in progress and exchange count is 0 @@ -450,22 +451,22 @@ class ServerImpl { requestCompleted(c); } } - responseCompleted (c); + responseCompleted(c); if (t.close) { c.close(); - allConnections.remove (c); + allConnections.remove(c); } else { if (is.isDataBuffered()) { /* don't re-enable the interestops, just handle it */ - requestStarted (c); - handle (c.getChannel(), c); + requestStarted(c); + handle(c.getChannel(), c); } else { - connsToRegister.add (c); + connsToRegister.add(c); } } } } catch (IOException e) { - logger.log ( + logger.log( Level.TRACE, "Dispatcher (1)", e ); c.close(); @@ -474,18 +475,18 @@ class ServerImpl { final ArrayList connsToRegister = new ArrayList<>(); - void reRegister (HttpConnection c) { + void reRegister(HttpConnection c) { /* re-register with selector */ try { SocketChannel chan = c.getChannel(); - chan.configureBlocking (false); - SelectionKey key = chan.register (selector, SelectionKey.OP_READ); - key.attach (c); + chan.configureBlocking(false); + SelectionKey key = chan.register(selector, SelectionKey.OP_READ); + key.attach(c); c.selectionKey = key; markIdle(c); } catch (IOException e) { dprint(e); - logger.log (Level.TRACE, "Dispatcher(8)", e); + logger.log(Level.TRACE, "Dispatcher (8)", e); c.close(); } } @@ -504,7 +505,7 @@ class ServerImpl { if (list != null) { for (Event r: list) { - handleEvent (r); + handleEvent(r); } } @@ -525,7 +526,7 @@ class ServerImpl { for (final SelectionKey key : selected.toArray(SelectionKey[]::new)) { // remove the key from the original selected keys (live) Set selected.remove(key); - if (key.equals (listenerKey)) { + if (key.equals(listenerKey)) { if (terminating) { continue; } @@ -546,15 +547,15 @@ class ServerImpl { if (ServerConfig.noDelay()) { chan.socket().setTcpNoDelay(true); } - chan.configureBlocking (false); + chan.configureBlocking(false); SelectionKey newkey = - chan.register (selector, SelectionKey.OP_READ); - HttpConnection c = new HttpConnection (); + chan.register(selector, SelectionKey.OP_READ); + HttpConnection c = new HttpConnection(); c.selectionKey = newkey; - c.setChannel (chan); - newkey.attach (c); + c.setChannel(chan); + newkey.attach(c); markNewlyAccepted(c); - allConnections.add (c); + allConnections.add(c); } } else { try { @@ -563,7 +564,7 @@ class ServerImpl { HttpConnection conn = (HttpConnection)key.attachment(); key.cancel(); - chan.configureBlocking (true); + chan.configureBlocking(true); // check if connection is being closed if (newlyAcceptedConnections.remove(conn) || idleConnections.remove(conn)) { @@ -571,7 +572,7 @@ class ServerImpl { // connection. In either case, we mark that the request // has now started on this connection. requestStarted(conn); - handle (chan, conn); + handle(chan, conn); } } else { assert false : "Unexpected non-readable key:" + key; @@ -586,56 +587,56 @@ class ServerImpl { // call the selector just to process the cancelled keys selector.selectNow(); } catch (IOException e) { - logger.log (Level.TRACE, "Dispatcher (4)", e); + logger.log(Level.TRACE, "Dispatcher (4)", e); } catch (Exception e) { - logger.log (Level.TRACE, "Dispatcher (7)", e); + logger.log(Level.TRACE, "Dispatcher (7)", e); } } - try {selector.close(); } catch (Exception e) {} + try { selector.close(); } catch (Exception e) {} } - private void handleException (SelectionKey key, Exception e) { + private void handleException(SelectionKey key, Exception e) { HttpConnection conn = (HttpConnection)key.attachment(); if (e != null) { - logger.log (Level.TRACE, "Dispatcher (2)", e); + logger.log(Level.TRACE, "Dispatcher (2)", e); } closeConnection(conn); } - public void handle (SocketChannel chan, HttpConnection conn) + public void handle(SocketChannel chan, HttpConnection conn) { try { - Exchange t = new Exchange (chan, protocol, conn); - executor.execute (t); + Exchange t = new Exchange(chan, protocol, conn); + executor.execute(t); } catch (HttpError e1) { - logger.log (Level.TRACE, "Dispatcher (4)", e1); + logger.log(Level.TRACE, "Dispatcher (4)", e1); closeConnection(conn); } catch (IOException e) { - logger.log (Level.TRACE, "Dispatcher (5)", e); + logger.log(Level.TRACE, "Dispatcher (5)", e); closeConnection(conn); } catch (Throwable e) { - logger.log (Level.TRACE, "Dispatcher (6)", e); + logger.log(Level.TRACE, "Dispatcher (6)", e); closeConnection(conn); } } } - static boolean debug = ServerConfig.debugEnabled (); + static boolean debug = ServerConfig.debugEnabled(); - static synchronized void dprint (String s) { + static synchronized void dprint(String s) { if (debug) { - System.out.println (s); + System.out.println(s); } } - static synchronized void dprint (Exception e) { + static synchronized void dprint(Exception e) { if (debug) { - System.out.println (e); + System.out.println(e); e.printStackTrace(); } } - Logger getLogger () { + Logger getLogger() { return logger; } @@ -675,13 +676,13 @@ class ServerImpl { HttpContextImpl ctx; boolean rejected = false; - Exchange (SocketChannel chan, String protocol, HttpConnection conn) throws IOException { + Exchange(SocketChannel chan, String protocol, HttpConnection conn) throws IOException { this.chan = chan; this.connection = conn; this.protocol = protocol; } - public void run () { + public void run() { /* context will be null for new connections */ logger.log(Level.TRACE, "exchange started"); @@ -702,7 +703,7 @@ class ServerImpl { String requestLine = null; SSLStreams sslStreams = null; try { - if (context != null ) { + if (context != null) { this.rawin = connection.getInputStream(); this.rawout = connection.getRawOutputStream(); newconnection = false; @@ -711,21 +712,21 @@ class ServerImpl { newconnection = true; if (https) { if (sslContext == null) { - logger.log (Level.WARNING, + logger.log(Level.WARNING, "SSL connection received. No https context created"); - throw new HttpError ("No SSL context established"); + throw new HttpError("No SSL context established"); } - sslStreams = new SSLStreams (ServerImpl.this, sslContext, chan); + sslStreams = new SSLStreams(ServerImpl.this, sslContext, chan); rawin = sslStreams.getInputStream(); rawout = sslStreams.getOutputStream(); engine = sslStreams.getSSLEngine(); connection.sslStreams = sslStreams; } else { rawin = new BufferedInputStream( - new Request.ReadStream ( + new Request.ReadStream( ServerImpl.this, chan )); - rawout = new Request.WriteStream ( + rawout = new Request.WriteStream( ServerImpl.this, chan ); } @@ -733,7 +734,16 @@ class ServerImpl { connection.raw = rawin; connection.rawout = rawout; } - Request req = new Request (rawin, rawout); + + Request req; + try { + req = new Request(rawin, rawout, newconnection && !https); + } catch (ProtocolException pe) { + logger.log(Level.DEBUG, "closing due to: " + pe); + reject(Code.HTTP_BAD_REQUEST, "", pe.getMessage()); + return; + } + requestLine = req.requestLine(); if (requestLine == null) { /* connection closed */ @@ -742,31 +752,31 @@ class ServerImpl { return; } logger.log(Level.DEBUG, "Exchange request line: {0}", requestLine); - int space = requestLine.indexOf (' '); + int space = requestLine.indexOf(' '); if (space == -1) { - reject (Code.HTTP_BAD_REQUEST, + reject(Code.HTTP_BAD_REQUEST, requestLine, "Bad request line"); return; } - String method = requestLine.substring (0, space); + String method = requestLine.substring(0, space); int start = space+1; space = requestLine.indexOf(' ', start); if (space == -1) { - reject (Code.HTTP_BAD_REQUEST, + reject(Code.HTTP_BAD_REQUEST, requestLine, "Bad request line"); return; } - String uriStr = requestLine.substring (start, space); + String uriStr = requestLine.substring(start, space); URI uri; try { - uri = new URI (uriStr); + uri = new URI(uriStr); } catch (URISyntaxException e3) { reject(Code.HTTP_BAD_REQUEST, requestLine, "URISyntaxException thrown"); return; } start = space+1; - String version = requestLine.substring (start); + String version = requestLine.substring(start); Headers headers = req.headers(); /* check key for illegal characters */ for (var k : headers.keySet()) { @@ -817,32 +827,32 @@ class ServerImpl { requestCompleted(connection); } } - ctx = contexts.findContext (protocol, uri.getPath()); + ctx = contexts.findContext(protocol, uri.getPath()); if (ctx == null) { - reject (Code.HTTP_NOT_FOUND, + reject(Code.HTTP_NOT_FOUND, requestLine, "No context found for request"); return; } - connection.setContext (ctx); + connection.setContext(ctx); if (ctx.getHandler() == null) { - reject (Code.HTTP_INTERNAL_ERROR, + reject(Code.HTTP_INTERNAL_ERROR, requestLine, "No handler for context"); return; } - tx = new ExchangeImpl ( + tx = new ExchangeImpl( method, uri, req, clen, connection ); String chdr = headers.getFirst("Connection"); Headers rheaders = tx.getResponseHeaders(); - if (chdr != null && chdr.equalsIgnoreCase ("close")) { + if (chdr != null && chdr.equalsIgnoreCase("close")) { tx.close = true; } - if (version.equalsIgnoreCase ("http/1.0")) { + if (version.equalsIgnoreCase("http/1.0")) { tx.http10 = true; if (chdr == null) { tx.close = true; - rheaders.set ("Connection", "close"); + rheaders.set("Connection", "close"); } else if (chdr.equalsIgnoreCase("keep-alive")) { rheaders.set("Connection", "keep-alive"); int idleSeconds = (int) (ServerConfig.getIdleIntervalMillis() / 1000); @@ -852,7 +862,7 @@ class ServerImpl { } if (newconnection) { - connection.setParameters ( + connection.setParameters( rawin, rawout, chan, engine, sslStreams, sslContext, protocol, ctx, rawin ); @@ -863,9 +873,9 @@ class ServerImpl { * be involved in this process. */ String exp = headers.getFirst("Expect"); - if (exp != null && exp.equalsIgnoreCase ("100-continue")) { - logReply (100, requestLine, null); - sendReply ( + if (exp != null && exp.equalsIgnoreCase("100-continue")) { + logReply(100, requestLine, null); + sendReply( Code.HTTP_CONTINUE, false, null ); } @@ -880,19 +890,19 @@ class ServerImpl { final List uf = ctx.getFilters(); final Filter.Chain sc = new Filter.Chain(sf, ctx.getHandler()); - final Filter.Chain uc = new Filter.Chain(uf, new LinkHandler (sc)); + final Filter.Chain uc = new Filter.Chain(uf, new LinkHandler(sc)); /* set up the two stream references */ tx.getRequestBody(); tx.getResponseBody(); if (https) { - uc.doFilter (new HttpsExchangeImpl (tx)); + uc.doFilter(new HttpsExchangeImpl(tx)); } else { - uc.doFilter (new HttpExchangeImpl (tx)); + uc.doFilter(new HttpExchangeImpl(tx)); } } catch (Exception e) { - logger.log (Level.TRACE, "ServerImpl.Exchange", e); + logger.log(Level.TRACE, "ServerImpl.Exchange", e); if (tx == null || !tx.writefinished) { closeConnection(connection); } @@ -907,59 +917,59 @@ class ServerImpl { class LinkHandler implements HttpHandler { Filter.Chain nextChain; - LinkHandler (Filter.Chain nextChain) { + LinkHandler(Filter.Chain nextChain) { this.nextChain = nextChain; } - public void handle (HttpExchange exchange) throws IOException { - nextChain.doFilter (exchange); + public void handle(HttpExchange exchange) throws IOException { + nextChain.doFilter(exchange); } } - void reject (int code, String requestStr, String message) { + void reject(int code, String requestStr, String message) { rejected = true; - logReply (code, requestStr, message); - sendReply ( + logReply(code, requestStr, message); + sendReply( code, true, "

    "+code+Code.msg(code)+"

    "+message ); } - void sendReply ( + void sendReply( int code, boolean closeNow, String text) { try { - StringBuilder builder = new StringBuilder (512); - builder.append ("HTTP/1.1 ") - .append (code).append (Code.msg(code)).append ("\r\n"); + StringBuilder builder = new StringBuilder(512); + builder.append("HTTP/1.1 ") + .append(code).append(Code.msg(code)).append("\r\n"); if (text != null && text.length() != 0) { - builder.append ("Content-Length: ") - .append (text.length()).append ("\r\n") - .append ("Content-Type: text/html\r\n"); + builder.append("Content-Length: ") + .append(text.length()).append("\r\n") + .append("Content-Type: text/html\r\n"); } else { - builder.append ("Content-Length: 0\r\n"); + builder.append("Content-Length: 0\r\n"); text = ""; } if (closeNow) { - builder.append ("Connection: close\r\n"); + builder.append("Connection: close\r\n"); } - builder.append ("\r\n").append (text); + builder.append("\r\n").append(text); String s = builder.toString(); byte[] b = s.getBytes(ISO_8859_1); - rawout.write (b); + rawout.write(b); rawout.flush(); if (closeNow) { closeConnection(connection); } } catch (IOException e) { - logger.log (Level.TRACE, "ServerImpl.sendReply", e); + logger.log(Level.TRACE, "ServerImpl.sendReply", e); closeConnection(connection); } } } - void logReply (int code, String requestStr, String text) { + void logReply(int code, String requestStr, String text) { if (!logger.isLoggable(Level.DEBUG)) { return; } @@ -968,18 +978,18 @@ class ServerImpl { } String r; if (requestStr.length() > 80) { - r = requestStr.substring (0, 80) + ""; + r = requestStr.substring(0, 80) + ""; } else { r = requestStr; } String message = r + " [" + code + " " + Code.msg(code) + "] ("+text+")"; - logger.log (Level.DEBUG, message); + logger.log(Level.DEBUG, message); } private int exchangeCount = 0; - synchronized void startExchange () { + synchronized void startExchange() { exchangeCount ++; } @@ -987,20 +997,20 @@ class ServerImpl { return exchangeCount; } - synchronized int endExchange () { + synchronized int endExchange() { exchangeCount --; assert exchangeCount >= 0; return exchangeCount; } - HttpServer getWrapper () { + HttpServer getWrapper() { return wrapper; } - void requestStarted (HttpConnection c) { + void requestStarted(HttpConnection c) { c.reqStartedTime = System.currentTimeMillis(); - c.setState (State.REQUEST); - reqConnections.add (c); + c.setState(State.REQUEST); + reqConnections.add(c); } void markIdle(HttpConnection c) { @@ -1037,21 +1047,21 @@ class ServerImpl { // that ensures the client reads the response in a timely // fashion. - void requestCompleted (HttpConnection c) { + void requestCompleted(HttpConnection c) { State s = c.getState(); assert s == State.REQUEST : "State is not REQUEST ("+s+")"; - reqConnections.remove (c); + reqConnections.remove(c); c.rspStartedTime = System.currentTimeMillis(); - rspConnections.add (c); - c.setState (State.RESPONSE); + rspConnections.add(c); + c.setState(State.RESPONSE); } // called after response has been sent - void responseCompleted (HttpConnection c) { + void responseCompleted(HttpConnection c) { State s = c.getState(); assert s == State.RESPONSE : "State is not RESPONSE ("+s+")"; - rspConnections.remove (c); - c.setState (State.IDLE); + rspConnections.remove(c); + c.setState(State.IDLE); } /** @@ -1059,7 +1069,7 @@ class ServerImpl { * TimerTask run every CLOCK_TICK ms */ class IdleTimeoutTask extends TimerTask { - public void run () { + public void run() { closeConnections(idleConnections, IDLE_INTERVAL); // if any newly accepted connection has been idle (i.e. no byte has been sent on that // connection during the configured idle timeout period) then close it as well @@ -1095,20 +1105,20 @@ class ServerImpl { class ReqRspTimeoutTask extends TimerTask { // runs every TIMER_MILLIS - public void run () { + public void run() { ArrayList toClose = new ArrayList<>(); final long currentTime = System.currentTimeMillis(); synchronized (reqConnections) { if (MAX_REQ_TIME != -1) { for (HttpConnection c : reqConnections) { if (currentTime - c.reqStartedTime >= MAX_REQ_TIME) { - toClose.add (c); + toClose.add(c); } } for (HttpConnection c : toClose) { - logger.log (Level.DEBUG, "closing: no request: " + c); - reqConnections.remove (c); - allConnections.remove (c); + logger.log(Level.DEBUG, "closing: no request: " + c); + reqConnections.remove(c); + allConnections.remove(c); c.close(); } } @@ -1118,13 +1128,13 @@ class ServerImpl { if (MAX_RSP_TIME != -1) { for (HttpConnection c : rspConnections) { if (currentTime - c.rspStartedTime >= MAX_RSP_TIME) { - toClose.add (c); + toClose.add(c); } } for (HttpConnection c : toClose) { - logger.log (Level.DEBUG, "closing: no response: " + c); - rspConnections.remove (c); - allConnections.remove (c); + logger.log(Level.DEBUG, "closing: no response: " + c); + rspConnections.remove(c); + allConnections.remove(c); c.close(); } } diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java index 7bfc39c84a1..ecda32ecc31 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/UndefLengthOutputStream.java @@ -40,30 +40,30 @@ class UndefLengthOutputStream extends FilterOutputStream private boolean closed = false; ExchangeImpl t; - UndefLengthOutputStream (ExchangeImpl t, OutputStream src) { - super (src); + UndefLengthOutputStream(ExchangeImpl t, OutputStream src) { + super(src); this.t = t; } - public void write (int b) throws IOException { + public void write(int b) throws IOException { if (closed) { - throw new IOException ("stream closed"); + throw new IOException("stream closed"); } out.write(b); } - public void write (byte[]b, int off, int len) throws IOException { + public void write(byte[] b, int off, int len) throws IOException { Objects.checkFromIndexSize(off, len, b.length); if (len == 0) { return; } if (closed) { - throw new IOException ("stream closed"); + throw new IOException("stream closed"); } out.write(b, off, len); } - public void close () throws IOException { + public void close() throws IOException { if (closed) { return; } @@ -76,7 +76,7 @@ class UndefLengthOutputStream extends FilterOutputStream } catch (IOException e) {} } Event e = new Event.WriteFinished(t); - t.getHttpContext().getServerImpl().addEvent (e); + t.getHttpContext().getServerImpl().addEvent(e); } // flush is a pass-through diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/UnmodifiableHeaders.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/UnmodifiableHeaders.java index 91bfc186828..503004b35e0 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/UnmodifiableHeaders.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/UnmodifiableHeaders.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 @@ -62,32 +62,32 @@ public class UnmodifiableHeaders extends Headers { @Override public List put(String key, List value) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override public void add(String key, String value) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override public void set(String key, String value) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override public List remove(Object key) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override public void putAll(Map> t) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override public void clear() { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override @@ -106,19 +106,19 @@ public class UnmodifiableHeaders extends Headers { @Override public boolean replace(String key, List oldValue, List newValue) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override public void replaceAll(BiFunction, ? extends List> function) { - throw new UnsupportedOperationException ("unsupported operation"); + throw new UnsupportedOperationException("unsupported operation"); } @Override - public boolean equals(Object o) {return headers.equals(o);} + public boolean equals(Object o) { return headers.equals(o); } @Override - public int hashCode() {return headers.hashCode();} + public int hashCode() { return headers.hashCode(); } @Override public String toString() { diff --git a/src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/FileServerHandler.java b/src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/FileServerHandler.java index 3a3654d4a73..cbf032e8398 100644 --- a/src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/FileServerHandler.java +++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/simpleserver/FileServerHandler.java @@ -367,7 +367,7 @@ public final class FileServerHandler implements HttpHandler { // A non-exhaustive map of reserved-HTML and special characters to their // equivalent entity. - private static final Map RESERVED_CHARS = Map.of( + private static final Map RESERVED_CHARS = Map.of( (int) '&' , "&" , (int) '<' , "<" , (int) '>' , ">" , diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java index 335cbef2331..dfdd2a304c6 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/Float16.java @@ -260,6 +260,9 @@ public final class Float16 * Float#toString(float)} in the handling of special values * (signed zeros, infinities, and NaN) and the generation of a * decimal string that will convert back to the argument value. + * However, the range for plain notation is defined to be the interval + * [10-3, 103) rather than the interval used + * for {@code float} and {@code double}. * * @param f16 the {@code Float16} to be converted. * @return a string representation of the argument. @@ -2106,7 +2109,7 @@ public final class Float16 int h = (int) (f * 107_375L >>> 30); int l = f - 10_000 * h; - if (0 < e && e <= 7) { + if (0 < e && e <= 3) { return toChars1(h, l, e); } if (-3 < e && e <= 0) { diff --git a/src/jdk.internal.jvmstat/macosx/classes/sun/jvmstat/PlatformSupportImpl.java b/src/jdk.internal.jvmstat/macosx/classes/sun/jvmstat/PlatformSupportImpl.java new file mode 100644 index 00000000000..f858fde4dce --- /dev/null +++ b/src/jdk.internal.jvmstat/macosx/classes/sun/jvmstat/PlatformSupportImpl.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, BELLSOFT. 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 sun.jvmstat; + +import java.io.IOException; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; + +/* + * macOS specific implementation of the PlatformSupport routines + * providing temporary directory support. + */ +public class PlatformSupportImpl extends PlatformSupport { + + private static final String VAR_FOLDERS_PATH = "/var/folders"; + private static final String USER_NAME_SYSTEM_PROPERTY = "user.name"; + private static final String USER_NAME_ROOT = "root"; + private static final String DIRHELPER_TEMP_STR = "T"; + + private static final boolean isCurrentUserRoot = + System.getProperty(USER_NAME_SYSTEM_PROPERTY).equals(USER_NAME_ROOT); + + public PlatformSupportImpl() { + super(); + } + + /* + * Return a list of the temporary directories that the VM uses + * for the attach and perf data files. + * + * This function returns the traditional temp directory. Additionally, + * when called by root, it returns other temporary directories of non-root + * users. + * + * macOS per-user temp directories are located under /var/folders + * and have the form /var/folders///T + */ + @Override + public List getTemporaryDirectories(int pid) { + if (!isCurrentUserRoot) { + // early exit for non-root + return List.of(PlatformSupport.getTemporaryDirectory()); + } + List result = new ArrayList<>(); + try (DirectoryStream bs = Files.newDirectoryStream(Path.of(VAR_FOLDERS_PATH))) { + for (Path bucket : bs) { + try (DirectoryStream encUuids = Files.newDirectoryStream(bucket)) { + for (Path encUuid : encUuids) { + try { + Path tempDir = encUuid.resolve(DIRHELPER_TEMP_STR); + if (Files.isDirectory(tempDir) && Files.isReadable(tempDir)) { + result.add(tempDir.toString()); + } + } catch (Exception ignore) { // ignored unreadable bucket/encUuid, continue + } + } + } catch (IOException ignore) { // IOException ignored, continue to the next bucket + } + } + } catch (Exception ignore) { // var/folders directory is inaccessible / other errors + } + return result.isEmpty() ? List.of(PlatformSupport.getTemporaryDirectory()) : result; + } +} diff --git a/src/jdk.internal.jvmstat/share/classes/module-info.java b/src/jdk.internal.jvmstat/share/classes/module-info.java index 9e12c98b016..d9e1bc68008 100644 --- a/src/jdk.internal.jvmstat/share/classes/module-info.java +++ b/src/jdk.internal.jvmstat/share/classes/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, 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,6 +40,8 @@ module jdk.internal.jvmstat { jdk.jstatd; exports sun.jvmstat.perfdata.monitor to jdk.jstatd; + exports sun.jvmstat to + jdk.attach; uses sun.jvmstat.monitor.MonitoredHostService; diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_de.properties b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_de.properties index c5d9f41ee85..2b76f1408fa 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_de.properties +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_de.properties @@ -220,3 +220,4 @@ entry.1.is.signed.in.jarinputstream.but.is.not.signed.in.jarfile=Eintrag %s ist jar.contains.internal.inconsistencies.result.in.different.contents.via.jarfile.and.jarinputstream=Diese JAR-Datei enthält interne Inkonsistenzen, die zu anderem Inhalt beim Lesen über JarFile als beim Lesen über JarInputStream führen können: signature.verification.failed.on.entry.1.when.reading.via.jarinputstream=Signaturverifizierung war für Eintrag %s beim Lesen über JarInputStream nicht erfolgreich signature.verification.failed.on.entry.1.when.reading.via.jarfile=Signaturverifizierung war für Eintrag %s beim Lesen über JarFile nicht erfolgreich +jks.storetype.warning=%1$s verwendet veraltete kryptografische Algorithmen und wird in einer zukünftigen Version entfernt. Migrieren Sie zu PKCS12 mit:\nkeytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12 diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_ja.properties b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_ja.properties index 97ab6a918cb..f2a5ce39be3 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_ja.properties +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_ja.properties @@ -220,3 +220,4 @@ entry.1.is.signed.in.jarinputstream.but.is.not.signed.in.jarfile=エントリ%s jar.contains.internal.inconsistencies.result.in.different.contents.via.jarfile.and.jarinputstream=このJARファイルには内部的な不整合があるため、JarFileとJarInputStreamから読み取る場合にコンテンツが異なる可能性があります: signature.verification.failed.on.entry.1.when.reading.via.jarinputstream=JarInputStreamを介して読み取るときに署名検証がエントリ%sで失敗しました signature.verification.failed.on.entry.1.when.reading.via.jarfile=JarFileを介して読み取るときに署名検証がエントリ%sで失敗しました +jks.storetype.warning=%1$sは古い暗号化アルゴリズムを使用しているため、将来のリリースで削除されます。次を使用してPKCS12に移行します:\nkeytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12 diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_zh_CN.properties b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_zh_CN.properties index 378cc3ba9fc..f780bd1f1c3 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_zh_CN.properties +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/resources/jarsigner_zh_CN.properties @@ -220,3 +220,4 @@ entry.1.is.signed.in.jarinputstream.but.is.not.signed.in.jarfile=条目 %s 已 jar.contains.internal.inconsistencies.result.in.different.contents.via.jarfile.and.jarinputstream=此 JAR 文件包含内部不一致,通过 JarFile 和 JarInputStream 读取时可能会导致内容不同: signature.verification.failed.on.entry.1.when.reading.via.jarinputstream=通过 JarInputStream 读取时,条目 %s 的签名验证失败 signature.verification.failed.on.entry.1.when.reading.via.jarfile=通过 JarFile 读取时,条目 %s 的签名验证失败 +jks.storetype.warning=%1$s 使用的加密算法已过时,将在未来发行版中删除。请使用以下命令迁移到 PKCS12:\nkeytool -importkeystore -srckeystore %2$s -destkeystore %2$s -deststoretype pkcs12 diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties index 2a5786e10b4..292ec9c963d 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_de.properties @@ -80,6 +80,8 @@ error.validator.info.opens.notequal=module-info.class in einem versionierten Ver error.validator.info.provides.notequal=module-info.class in einem versionierten Verzeichnis enthält unterschiedliche "provides" error.validator.info.version.notequal={0}: module-info.class in einem versionierten Verzeichnis enthält unterschiedlichen "version"-Wert error.validator.info.manclass.notequal={0}: module-info.class in einem versionierten Verzeichnis enthält unterschiedlichen "main-class"-Wert +error.validator.metainf.wrong.position=Eintrag META-INF/ an Position 0 erwartet, aber an Position {0} gefunden +error.validator.manifest.wrong.position=Eintrag META-INF/MANIFEST.MF an Position 0 oder 1 erwartet, aber an Position {0} gefunden warn.validator.identical.entry=Warnung: Eintrag {0} enthält eine Klasse, die mit\neinem bereits in der JAR-Datei enthaltenen Eintrag identisch ist warn.validator.resources.with.same.name=Warnung: Eintrag {0}, mehrere Ressourcen mit demselben Namen warn.validator.concealed.public.class=Warnung: Eintrag {0} ist eine öffentliche Klasse\nin einem verdeckten Package. Wenn Sie diese JAR-Datei in den Classpath einfügen, kommt es\nzu nicht kompatiblen öffentlichen Schnittstellen diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties index c7d7c14613a..0d0f91ad791 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ja.properties @@ -80,6 +80,8 @@ error.validator.info.opens.notequal=バージョニング・ディレクトリ error.validator.info.provides.notequal=バージョニングされたディレクトリのmodule-info.classに異なる"provides"が含まれています error.validator.info.version.notequal={0}: バージョニングされたディレクトリのmodule-info.classに異なる"version"が含まれています error.validator.info.manclass.notequal={0}: バージョニングされたディレクトリのmodule-info.classに異なる"main-class"が含まれています +error.validator.metainf.wrong.position=エントリMETA-INF/は0の位置にある必要がありますが、見つかりました: {0} +error.validator.manifest.wrong.position=エントリMETA-INF/MANIFEST.MFは0または1の位置にある必要がありますが、位置: {0}で見つかりました warn.validator.identical.entry=警告 : エントリ{0}には、jarにすでに存在する\nエントリと同じクラスが含まれます warn.validator.resources.with.same.name=警告 : エントリ{0}、同じ名前を持つ複数のリソース warn.validator.concealed.public.class=警告 : エントリ{0}は、隠しパッケージ内のpublicクラスです。\nクラスパスにこのjarを配置すると、互換性のない\npublicインタフェースが生成されます diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties index 1979f3e2386..41833d28bfc 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_CN.properties @@ -80,6 +80,8 @@ error.validator.info.opens.notequal=版本化目录中的 module-info.class 包 error.validator.info.provides.notequal=版本化目录中的 module-info.class 包含不同的 "provides" error.validator.info.version.notequal={0}: 版本化目录中的 module-info.class 包含不同的 "version" error.validator.info.manclass.notequal={0}: 版本化目录中的 module-info.class 包含不同的 "main-class" +error.validator.metainf.wrong.position=条目 META-INF/ 应位于位置 0 处,但发现:{0} +error.validator.manifest.wrong.position=条目 META-INF/MANIFEST.MF 应位于位置 0 或 1 处,但发现该条目位于位置 {0} 处 warn.validator.identical.entry=警告: 条目 {0} 包含与 jar 中的\n现有条目相同的类 warn.validator.resources.with.same.name=警告: 条目 {0}, 多个资源具有相同名称 warn.validator.concealed.public.class=警告: 条目 {0} 是已隐藏程序包中的\n公共类, 将此 jar 放置在类路径中\n将导致公共接口不兼容 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java index 1f2c4d97dd3..86ac3a892fd 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java @@ -243,8 +243,12 @@ public abstract class HtmlDocletWriter { if (generating) { writeGenerating(); } + CURRENT_PATH.set(path.getPath()); } + /** Temporary workaround to share current path with taglets, see 8373909 */ + public static final ThreadLocal CURRENT_PATH = new ThreadLocal<>(); + /** * The top-level method to generate and write the page represented by this writer. * diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_de.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_de.properties index 4cbb4b97774..a380b29d553 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_de.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_de.properties @@ -190,6 +190,10 @@ doclet.Window_Help_title=API-Hilfe doclet.references={0} Referenzen doclet.Window_Search_title=Suchen doclet.search.main_heading=Suchen +doclet.theme.select_theme=Theme auswählen +doclet.theme.light=Hell +doclet.theme.dark=Dunkel +doclet.theme.system=Systemeinstellung # label for link/button element to show the information below doclet.search.show_more=Zusätzliche Ressourcen @@ -539,3 +543,5 @@ doclet.NoFrames_specified=Die Option --no-frames wird nicht mehr benötigt und w # L10N: do not localize the option name -footer doclet.footer_specified=Die Option -footer wird nicht mehr unterstützt und wird ignoriert.\nSie wird möglicherweise in einem zukünftigen Release entfernt. + +doclet.selectModule=Wählen Sie das Modul aus, in dem gesucht werden soll. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties index 2151b3f4a2e..69cdc862b4c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_ja.properties @@ -190,6 +190,10 @@ doclet.Window_Help_title=APIヘルプ doclet.references={0}の参照 doclet.Window_Search_title=検索 doclet.search.main_heading=検索 +doclet.theme.select_theme=テーマを選択 +doclet.theme.light=明るい +doclet.theme.dark=暗い +doclet.theme.system=システム設定 # label for link/button element to show the information below doclet.search.show_more=その他のリソース @@ -539,3 +543,5 @@ doclet.NoFrames_specified=--no-framesオプションは必須ではなくなり # L10N: do not localize the option name -footer doclet.footer_specified=-footerオプションはサポートされなくなったため、無視されます。\n将来のリリースで削除される可能性があります。 + +doclet.selectModule=検索するモジュールを選択します。 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties index 66620d158bb..b3a0a3a1197 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard_zh_CN.properties @@ -190,6 +190,10 @@ doclet.Window_Help_title=API 帮助 doclet.references={0} 个引用 doclet.Window_Search_title=搜索 doclet.search.main_heading=搜索 +doclet.theme.select_theme=选择主题 +doclet.theme.light=浅色 +doclet.theme.dark=深色 +doclet.theme.system=系统设置 # label for link/button element to show the information below doclet.search.show_more=其他资源 @@ -539,3 +543,5 @@ doclet.NoFrames_specified=--no-frames 选项不再是必需的,可能\n会在 # L10N: do not localize the option name -footer doclet.footer_specified=-footer 选项不再受支持并将被忽略。\n可能会在未来发行版中删除此选项。 + +doclet.selectModule=选择要在其中搜索的模块。 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_de.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_de.properties index 0ee34071c93..a6dbf050bf3 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_de.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_de.properties @@ -65,6 +65,7 @@ doclet.JavaScript_in_comment=JavaScript in Dokumentationskommentar gefunden.\nVe doclet.JavaScript_in_option=Option {0} enthält JavaScript.\nVerwenden Sie --allow-script-in-comments, um die Verwendung von JavaScript zuzulassen. doclet.Link_icon=Linksymbol doclet.Link_to_section=Link zu diesem Abschnitt +doclet.Toggle_member_listing=Zwischen kurzer und detaillierter Listenansicht umschalten doclet.Packages=Packages doclet.All_Packages=Alle Packages doclet.Modules=Module @@ -114,7 +115,7 @@ doclet.inheritDocWithinInappropriateTag=@inheritDoc kann in diesem Tag nicht ver doclet.inheritDocNoDoc=überschriebene Methoden dokumentieren Ausnahmetyp {0} nicht doclet.throwsInheritDocUnsupported=@inheritDoc wird für Parameter vom Typ Ausnahme, die nicht von einer Methode deklariert werden, nicht unterstützt. Dokumentieren Sie solche Ausnahmetypen direkt. doclet.noInheritedDoc=@inheritDoc wurde verwendet, aber mit {0} wird keine Methode außer Kraft gesetzt oder implementiert. -doclet.tag_misuse=Tag {0} kann nicht in {1}-Dokumentation verwendet werden. Es kann nur in folgenden Dokumentationstypen verwendet werden: {2}. +doclet.tag_misuse=Tag {0} kann nicht in Dokumentation {1} verwendet werden. Es kann nur in folgenden Dokumentationstypen verwendet werden: {2}. doclet.Package_Summary=Packageübersicht doclet.Requires_Summary=Erfordernisse doclet.Indirect_Requires_Summary=Indirekte Erfordernisse @@ -226,7 +227,7 @@ doclet.search=Suchen doclet.search_placeholder=In Dokumentation suchen ("/" eingeben) doclet.search_in_documentation=In Dokumentation suchen doclet.search_reset=Zurücksetzen -doclet.Member=Mitglied +doclet.Member=Member doclet.Field=Feld doclet.Property=Eigenschaft doclet.Constructor=Konstruktor @@ -240,11 +241,14 @@ doclet.Description=Beschreibung doclet.ConstantField=Konstantenfeld doclet.Value=Wert doclet.table_of_contents=Inhaltsverzeichnis +doclet.Sort_lexicographically=Member-Details lexikographisch sortieren +doclet.Sort_by_source_order=Member-Details nach Quellreihenfolge sortieren doclet.hide_sidebar=Randleiste ausblenden doclet.show_sidebar=Randleiste einblenden doclet.filter_label=Inhalt filtern ("." eingeben) doclet.filter_table_of_contents=Inhaltsverzeichnis filtern doclet.filter_reset=Zurücksetzen +doclet.sort_table_of_contents=Member-Details in lexikographischer Reihenfolge sortieren doclet.linkMismatch_PackagedLinkedtoModule=Der Code, der dokumentiert wird, verwendet Packages im unbenannten Modul, aber die in {0} definierten Packages befinden sich in benannten Modulen. doclet.linkMismatch_ModuleLinkedtoPackage=Der Code, der dokumentiert wird, verwendet Module, aber die in {0} definierten Packages befinden sich im unbenannten Modul. doclet.urlRedirected=URL {0} wurde umgeleitet an {1} - Aktualisieren Sie die Befehlszeilenoptionen, um diese Warnung zu unterdrücken. diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties index 2b10f4e6e9a..1970203da38 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_ja.properties @@ -65,6 +65,7 @@ doclet.JavaScript_in_comment=ドキュメント・コメントにJavaScriptが doclet.JavaScript_in_option=オプション{0}にJavaScriptが含まれています。\n--allow-script-in-commentsを使用して、JavaScriptの使用を許可してください。 doclet.Link_icon=リンク・アイコン doclet.Link_to_section=このセクションにリンク +doclet.Toggle_member_listing=短いリスト・ビューと詳細リスト・ビューの切替え doclet.Packages=パッケージ doclet.All_Packages=すべてのパッケージ doclet.Modules=モジュール @@ -240,11 +241,14 @@ doclet.Description=説明 doclet.ConstantField=定数フィールド doclet.Value=値 doclet.table_of_contents=目次 +doclet.Sort_lexicographically=メンバー詳細を辞書順にソート +doclet.Sort_by_source_order=メンバー詳細をソース順序にソート doclet.hide_sidebar=サイドバーの非表示 doclet.show_sidebar=サイドバーの表示 doclet.filter_label=コンテンツのフィルタ(.と入力) doclet.filter_table_of_contents=目次のフィルタ doclet.filter_reset=リセット +doclet.sort_table_of_contents=メンバー詳細を辞書順にソート doclet.linkMismatch_PackagedLinkedtoModule=ドキュメント化しようとしているコードでは名前のないモジュールのパッケージが使用されていますが、{0}で定義されているパッケージは名前のあるモジュールのものです。 doclet.linkMismatch_ModuleLinkedtoPackage=ドキュメント化しようとしているコードではモジュールが使用されていますが、{0}で定義されているパッケージは名前のないモジュールのものです。 doclet.urlRedirected=URL {0}は{1}にリダイレクトされました -- コマンドライン・オプションを更新してこの警告を表示しないようにしてください。 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties index f2c8762b283..62e51c2c1c4 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/doclets_zh_CN.properties @@ -65,6 +65,7 @@ doclet.JavaScript_in_comment=文档注释中发现 JavaScript。\n使用 --allow doclet.JavaScript_in_option=选项 {0} 包含 JavaScript。\n使用 --allow-script-in-comments 可允许使用 JavaScript。 doclet.Link_icon=链接图标 doclet.Link_to_section=链接到此节 +doclet.Toggle_member_listing=在简短列表视图和详细列表视图之间切换 doclet.Packages=程序包 doclet.All_Packages=所有程序包 doclet.Modules=模块 @@ -240,11 +241,14 @@ doclet.Description=说明 doclet.ConstantField=常量字段 doclet.Value=值 doclet.table_of_contents=目录 +doclet.Sort_lexicographically=按字典顺序对成员详细信息进行排序 +doclet.Sort_by_source_order=按源顺序对成员详细信息进行排序 doclet.hide_sidebar=隐藏子工具栏 doclet.show_sidebar=显示子工具栏 doclet.filter_label=筛选内容(键入 .) doclet.filter_table_of_contents=筛选目录 doclet.filter_reset=重置 +doclet.sort_table_of_contents=按字典顺序对成员详细信息进行排序 doclet.linkMismatch_PackagedLinkedtoModule=进行文档化的代码使用了未命名模块中的程序包,但在 {0} 中定义的程序包在命名模块中。 doclet.linkMismatch_ModuleLinkedtoPackage=进行文档化的代码使用了模块,但在 {0} 中定义的程序包在未命名模块中。 doclet.urlRedirected=URL {0} 已重定向到 {1} — 更新命令行选项以隐藏此警告。 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_de.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_de.properties index 7829d2d7e27..57137ffe75d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_de.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_de.properties @@ -52,7 +52,7 @@ main.opt.package.desc=Zeigt Package-/geschützte/öffentliche Typen und Mitglied main.opt.private.desc=Zeigt alle Typen und Mitglieder. Zeigt bei benannten Modulen\nalle Packages und alle Moduldetails. main.opt.show.members.arg= -main.opt.show.members.desc=Gibt an, welche Member (Felder, Methoden oder Konstruktoren) dokumentiert\nwerden, wobei der Wert "public", "protected",\n"package" oder "private" lauten kann. Der Standardwert ist "protected"\nund zeigt öffentliche und geschützte Member an. "public" zeigt nur\nöffentliche Member, "package" zeigt öffentliche, geschützte und\nPackage-Member, und "private" zeigt alle Member an. +main.opt.show.members.desc=Gibt an, welche Members (Felder, Methoden oder Konstruktoren) dokumentiert\nwerden, wobei der Wert "public", "protected",\n"package" oder "private" lauten kann. Der Standardwert ist "protected"\nund zeigt öffentliche und geschützte Members an. "public" zeigt nur\nöffentliche Members, "package" zeigt öffentliche, geschützte und\nPackage-Members, und "private" zeigt alle Members an. main.opt.show.types.arg= main.opt.show.types.desc=Gibt an, welche Typen (Klassen, Schnittstellen usw.) dokumentiert\nwerden, wobei der Wert "public", "protected",\n"package" oder "private" lauten kann. Der Standardwert ist "protected"\nund zeigt öffentliche und geschützte Typen, "public" zeigt nur\nöffentliche Typen, "package" zeigt öffentliche, geschützte und\nPackagetypen, und "private" zeigt alle Typen. diff --git a/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequestManager.java b/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequestManager.java index 3bd363af56e..de13561a4fc 100644 --- a/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequestManager.java +++ b/src/jdk.jdi/share/classes/com/sun/jdi/request/EventRequestManager.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, 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 @@ -251,13 +251,13 @@ public interface EventRequestManager extends Mirror { * after the first step is detected. Thus a next line method * would do the following: *
    {@code
    -     *     EventRequestManager mgr = myVM.{@link VirtualMachine#eventRequestManager eventRequestManager}();
    +     *     EventRequestManager mgr = myVM.eventRequestManager();
          *     StepRequest request = mgr.createStepRequest(myThread,
    -     *                                                 StepRequest.{@link StepRequest#STEP_LINE STEP_LINE},
    -     *                                                 StepRequest.{@link StepRequest#STEP_OVER STEP_OVER});
    -     *     request.{@link EventRequest#addCountFilter addCountFilter}(1);  // next step only
    +     *                                                 StepRequest.STEP_LINE,
    +     *                                                 StepRequest.STEP_OVER);
    +     *     request.addCountFilter(1);  // next step only
          *     request.enable();
    -     *     myVM.{@link VirtualMachine#resume resume}();
    +     *     myVM.resume();
          * }
    * * @param thread the thread in which to step @@ -382,7 +382,7 @@ public interface EventRequestManager extends Mirror { * Iterator iter = requestManager.stepRequests().iterator(); * while (iter.hasNext()) { * requestManager.deleteEventRequest(iter.next()); - * } + * } *
    * may cause a {@link java.util.ConcurrentModificationException}. * Instead use diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties index 9b776745c66..40022a5532b 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_de.properties @@ -78,7 +78,8 @@ err.runtime.link.patched.module=jlink unterstützt keine Verknüpfung vom Laufze err.no.module.path=Option --module-path muss mit --add-modules ALL-MODULE-PATH angegeben werden err.empty.module.path=Kein Modul im Modulpfad "{0}" mit --add-modules ALL-MODULE-PATH gefunden err.limit.modules=--limit-modules nicht mit --add-modules ALL-MODULE-PATH zulässig -err.jlink.version.mismatch=jlink-Version {0}.{1} stimmt nicht mit Ziel-java.base-Version {2}.{3} überein +err.jlink.version.mismatch=jlink-Build "{0}" stimmt nicht mit dem java.base-Ziel-Build "{1}" überein +err.jlink.version.missing=jlink-Build "{0}" kann die Build-Signatur nicht im Modul java.base finden, das im Modulpfad angegebenen wird. Wahrscheinlich stammt es aus einem früheren Build. err.automatic.module:automatisches Modul kann nicht mit jlink verwendet werden: {0} aus {1} err.unknown.byte.order:unbekannte Bytereihenfolge {0} err.launcher.main.class.empty:Launcher-Hauptklassenname darf nicht leer sein: {0} diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties index c925f250c41..9519a24c96e 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_ja.properties @@ -78,7 +78,8 @@ err.runtime.link.patched.module=--patch-moduleを使用してパッチ済ラン err.no.module.path=--module-pathオプションは--add-modules ALL-MODULE-PATHで指定する必要があります err.empty.module.path=モジュール・パス''{0}''に--add-modules ALL-MODULE-PATHを使用したモジュールが見つかりません err.limit.modules=--limit-modulesは--add-modules ALL-MODULE-PATHとともに指定できません -err.jlink.version.mismatch=jlinkバージョン{0}.{1}がターゲットのjava.baseバージョン{2}.{3}と一致しません +err.jlink.version.mismatch=jlinkビルド''{0}''がターゲットのjava.baseビルド''{1}''と一致しません +err.jlink.version.missing=jlinkビルド''{0}''では、モジュール・パスで指定されたjava.baseにビルド署名が見つかりません(おそらく以前のビルドから)。 err.automatic.module:jlinkでは自動モジュールは使用できません: {1}からの{0} err.unknown.byte.order:不明なバイト順{0} err.launcher.main.class.empty:起動ツールのメイン・クラス名は空にできません: {0} diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties index b7526c9f57a..81af170ae7f 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/jlink_zh_CN.properties @@ -78,7 +78,8 @@ err.runtime.link.patched.module=当使用 --patch-module 在打补丁的运行 err.no.module.path=--module-path 选项必须与 --add-modules ALL-MODULE-PATH 一起指定 err.empty.module.path=在随 --add-modules ALL-MODULE-PATH 提供的模块路径 ''{0}'' 中找不到模块 err.limit.modules=不允许将 --limit-modules 与 --add-modules ALL-MODULE-PATH 一起使用 -err.jlink.version.mismatch=jlink 版本 {0}.{1} 与目标 java.base 版本 {2}.{3} 不匹配 +err.jlink.version.mismatch=jlink 工作版本 ''{0}'' 与目标 java.base 工作版本 ''{1}'' 不匹配 +err.jlink.version.missing=jlink 工作版本 ''{0}'' 在模块路径中指定的 java.base 中找不到工作版本签名,可能来自早期工作版本。 err.automatic.module:自动模块不能用于来自 {1} 的 jlink: {0} err.unknown.byte.order:未知的字节顺序 {0} err.launcher.main.class.empty:启动程序主类名不能为空: {0} diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_de.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_de.properties index 4713eabed85..80d1ba6e05f 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_de.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2025, 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,9 +31,9 @@ add-options.usage=\ --add-options Stellt die angegebene release-info.argument=|add:=:=:...|del: -release-info.description=-Option lädt Releaseeigenschaften aus der angegebenen Datei.\nadd: fügt der Datei "release" Eigenschaften hinzu.\nEine beliebige Anzahl von =-Paaren kann übergeben werden.\ndel: löscht die Liste der Schlüssel in der Releasedatei. +release-info.description=Option lädt Releaseeigenschaften aus der angegebenen Datei.\n Die angegebene Datei soll erwartungsgemäß in UTF-8 codiert sein.\nadd: fügt der Datei "release" Eigenschaften hinzu.\nEine beliebige Anzahl von =-Paaren kann übergeben werden.\ndel: löscht die Liste der Schlüssel in der Releasedatei. -release-info.usage=\ --release-info |add:=:=:...|del:\n Option löscht Releaseeigenschaften aus\n der angegebenen Datei.\n add: fügt Eigenschaften der Datei "release" hinzu.\n Eine beliebige Anzahl =-Paare kann übergeben werden.\n del: löscht die Liste der Schlüssel in der Releasedatei. +release-info.usage=\ --release-info |add:=:=:...|del:\n Option lädt Releaseeigenschaften aus\n der angegebenen Datei. Die angegebene Datei soll erwartungsgemäß\n in UTF-8 codiert sein.\n add: fügt der Datei "release" Eigenschaften hinzu.\n Eine beliebige Anzahl =-Paare kann übergeben werden.\n del: löscht die Liste der Schlüssel in der Releasedatei. class-for-name.argument= @@ -41,11 +41,11 @@ class-for-name.description=Klassenoptimierung: Konvertiert Class.forName-Aufrufe class-for-name.usage=\ --class-for-name Klassenoptimierung: Konvertiert Class.forName-Aufrufe in Konstantenladevorgänge. -compress.argument=[:filter=] +compress.argument=[:filter=] compress.description= Zu verwendende Komprimierung für Ressourcen. -compress.usage=\ --compress Zu verwendende Komprimierung für Ressourcen:\n Zulässige Werte:\n zip-[0-9], wobei "zip-0" für keine Komprimierung\n und "zip-9" für die beste Komprimierung steht.\n Standardwert ist "zip-6". +compress.usage=\ --compress Zu verwendende Komprimierung für Ressourcen:\n Zulässige Werte:\n zip-'{0-9}', wobei "zip-0" für keine Komprimierung\n und "zip-9" für die beste Komprimierung steht.\n Standardwert ist "zip-6". compress.warn.argumentdeprecated=Warnung: Das Argument {0} für --compress ist veraltet und wird möglicherweise in einem zukünftigen Release entfernt @@ -170,7 +170,7 @@ plugin.opt.resources-last-sorter=\ --resources-last-sorter Das le plugin.opt.disable-plugin=\ --disable-plugin Deaktiviert das angegebene Plug-in -plugin.opt.compress=\ --compress Zu verwendende Komprimierung für Ressourcen:\n Zulässige Werte:\n zip-[0-9], wobei "zip-0" für keine Komprimierung\n und "zip-9" für die beste Komprimierung steht.\n Standardwert ist "zip-6".\n Veraltete Werte, die in einem zukünftigen Release entfernt werden:\n 0: Keine Komprimierung. Entspricht "zip-0".\n 1: Gemeinsame Verwendung konstanter Zeichenfolgen\n 2: Entspricht "zip-6". +plugin.opt.compress=\ --compress Komprimiert alle Ressourcen im Ausgabeimage:\n Zulässige Werte:\n zip-'{0-9}', wobei "zip-0" für keine Komprimierung\n und "zip-9" für die beste Komprimierung steht.\n Standardwert ist "zip-6."\n Veraltete Werte, die in einem zukünftigen Release entfernt werden:\n 0: Keine Komprimierung. Verwenden Sie stattdessen "zip-0".\n 1: Gemeinsame Verwendung konstanter Zeichenfolgen\n 2: ZIP. Verwenden Sie stattdessen "zip-6". plugin.opt.strip-debug=\ -G, --strip-debug Entfernt Debuginformationen diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_ja.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_ja.properties index 1cf3ba5b0c0..6ed0a486132 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_ja.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2025, 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,9 +31,9 @@ add-options.usage=\ --add-options 指定した文字列を release-info.argument=|add:=:=:...|del: -release-info.description=オプションは指定されたファイルからリリース・プロパティをロードします。\nadd:はリリース・ファイルにプロパティを追加します。\n任意の数の=のペアを渡すことができます。\ndel:はリリース・ファイルのキーのリストを削除します。 +release-info.description=オプションは指定されたファイルからリリース・プロパティをロードします。\n 指定されたファイルはUTF-8でエンコードされる必要があります。\nadd:はリリース・ファイルにプロパティを追加します。\n任意の数の=のペアを渡すことができます。\ndel:はリリース・ファイルのキーのリストを削除します。 -release-info.usage=\ --release-info |add:=:=:...|del:\n オプションは指定されたファイルからリリース・プロパティを\n ロードします。\n add:はリリース・ファイルにプロパティを追加します。\n 任意の数の=ペアを渡すことができます。\n del:はリリース・ファイルのキーのリストを削除します。 +release-info.usage=\ --release-info |add:=:=:...|del:\n オプションは指定されたファイルからリリース・プロパティを\n ロードします。指定されたファイルはUTF-8で\n エンコードされる必要があります。\n add:はリリース・ファイルにプロパティを追加します。\n 任意の数の=ペアを渡すことができます。\n del:はリリース・ファイルのキーのリストを削除します。 class-for-name.argument= @@ -41,11 +41,11 @@ class-for-name.description=クラスの最適化: Class.forName呼出しを定 class-for-name.usage=\ --class-for-name クラスの最適化: Class.forName呼出しを定数のロードに変換します。 -compress.argument=[:filter=] +compress.argument=[:filter=] compress.description= リソースの圧縮に使用する圧縮。 -compress.usage=\ --compress リソースの圧縮に使用する圧縮:\n 使用可能な値は\n zip-[0-9]です。zip-0では圧縮は行われず、\n zip-9では最適な圧縮が行われます。\n デフォルトはzip-6です。 +compress.usage=\ --compress リソースの圧縮に使用する圧縮:\n 使用可能な値は\n zip-'{0-9}'です。zip-0では圧縮は行われず、\n zip-9では最適な圧縮が行われます。\n デフォルトはzip-6です。 compress.warn.argumentdeprecated=警告: --compressの{0}引数は非推奨であり、今後のリリースで削除される可能性があります @@ -170,7 +170,7 @@ plugin.opt.resources-last-sorter=\ --resources-last-sorter 最後 plugin.opt.disable-plugin=\ --disable-plugin 指定したプラグインを無効にします -plugin.opt.compress=\ --compress リソースの圧縮に使用する圧縮:\n 使用可能な値は\n zip-[0-9]です。zip-0では圧縮は行われず、\n zip-9では最適な圧縮が行われます。\n デフォルトはzip-6です。\n 今後のリリースで削除される非推奨の値:\n 0: 圧縮なし。zip-0と同等。\n 1: 定数文字列の共有\n 2: zip-6と同等。 +plugin.opt.compress=\ --compress 出力イメージ内のすべてのリソースを圧縮します:\n 使用可能な値は\n zip-'{0-9}'です。zip-0では圧縮は行われず、\n zip-9では最適な圧縮が行われます。\n デフォルトはzip-6です。\n 今後のリリースで削除される非推奨の値:\n 0: 圧縮なし。かわりにzip-0を使用。\n 1: 定数文字列の共有\n 2: ZIP。かわりにzip-6を使用。 plugin.opt.strip-debug=\ -G, --strip-debug デバッグ情報を削除します diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_zh_CN.properties b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_zh_CN.properties index 819238e7d04..a0480a31fc3 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_zh_CN.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2025, 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,9 +31,9 @@ add-options.usage=\ --add-options 在生成的映像中调用虚拟 release-info.argument=|add:=:=:...|del: -release-info.description= 选项:从提供的文件加载 release 属性。\nadd:向 'release' 文件中添加属性。\n可以传递任意数量的 = 对。\ndel:删除 release 文件中的关键字列表。 +release-info.description= 选项:从提供的文件加载 release 属性。\n 指定的文件应采用 UTF-8 编码。\nadd:向 'release' 文件中添加属性。\n可以传递任意数量的 = 对。\ndel:删除 release 文件中的关键字列表。 -release-info.usage=\ --release-info |add:=:=:...|del:\n 选项:从提供的文件\n 加载 release 属性。\n add:向 'release' 文件中添加属性。\n 可以传递任意数量的 = 对。\n del:删除 release 文件中的关键字列表。 +release-info.usage=\ --release-info |add:=:=:...|del:\n 选项:从提供的文件\n 加载 release 属性。指定的文件\n 应采用 UTF-8 编码。\n add:向 'release' 文件中添加属性。\n 可以传递任意数量的 = 对。\n del:删除 release 文件中的关键字列表。 class-for-name.argument= @@ -41,11 +41,11 @@ class-for-name.description=类优化:将 Class.forName 调用转换为常量 class-for-name.usage=\ --class-for-name 类优化:将 Class.forName 调用转换为常量负载。 -compress.argument=[:filter=] +compress.argument=[:filter=] compress.description= 要在压缩资源时使用的压缩。 -compress.usage=\ --compress 要在压缩资源时使用的压缩:\n 接受的值为:\n zip-[0-9],其中 zip-0 表示无压缩,\n zip-9 表示最佳压缩。\n 默认值为 zip-6。 +compress.usage=\ --compress 要在压缩资源时使用的压缩:\n 接受的值为:\n zip-'{0-9}',其中 zip-0 表示无压缩,\n zip-9 表示最佳压缩。\n 默认值为 zip-6。 compress.warn.argumentdeprecated=警告:--compress 的 {0} 参数已过时,可能会在未来发行版中删除 @@ -170,7 +170,7 @@ plugin.opt.resources-last-sorter=\ --resources-last-sorter 允许 plugin.opt.disable-plugin=\ --disable-plugin 禁用所提及的插件 -plugin.opt.compress=\ --compress 要在压缩资源时使用的压缩:\n 接受的值为:\n zip-[0-9],其中 zip-0 表示无压缩,\n zip-9 表示最佳压缩。\n 默认值为 zip-6。\n 要在未来发行版中删除的已过时值:\n 0:无压缩。等同于 zip-0。\n 1:常量字符串共享\n 2:等同于 zip-6。 +plugin.opt.compress=\ --compress 在输出映像中压缩所有资源:\n 接受的值包括:\n zip-'{0-9}',其中 zip-0 表示无压缩,\n zip-9 表示最佳压缩。\n 默认值为 zip-6。\n 要在未来发行版中删除的已过时值:\n 0:无压缩。改为使用 zip-0。\n 1:常量字符串共享\n 2:ZIP。改为使用 zip-6。 plugin.opt.strip-debug=\ -G, --strip-debug 去除调试信息 diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxBundlingEnvironment.java b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxBundlingEnvironment.java index cfd8ab391bb..6e438e66a26 100644 --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxBundlingEnvironment.java +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxBundlingEnvironment.java @@ -56,7 +56,7 @@ public class LinuxBundlingEnvironment extends DefaultBundlingEnvironment { private static void createDebPackage(Options options, LinuxDebSystemEnvironment sysEnv) { createNativePackage(options, - LinuxFromOptions::createLinuxDebPackage, + LinuxFromOptions.createLinuxDebPackage(options), buildEnv()::create, LinuxBundlingEnvironment::buildPipeline, (env, pkg, outputDir) -> { @@ -67,7 +67,7 @@ public class LinuxBundlingEnvironment extends DefaultBundlingEnvironment { private static void createRpmPackage(Options options, LinuxRpmSystemEnvironment sysEnv) { createNativePackage(options, - LinuxFromOptions::createLinuxRpmPackage, + LinuxFromOptions.createLinuxRpmPackage(options), buildEnv()::create, LinuxBundlingEnvironment::buildPipeline, (env, pkg, outputDir) -> { diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_de.properties b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_de.properties index 2f8fcddff73..345ed36b7be 100644 --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_de.properties +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_de.properties @@ -23,12 +23,7 @@ # questions. # # -app.bundler.name=Linux-Anwendungsimage -deb.bundler.name=DEB-Bundle -rpm.bundler.name=RPM-Bundle - param.license-type.default=Unbekannt -param.menu-group.default=Unbekannt resource.deb-control-file=DEB-Kontrolldatei resource.deb-preinstall-script=DEB-Preinstall-Skript @@ -59,7 +54,6 @@ message.output-to-location=Package (.deb) gespeichert in: {0}. message.debs-like-licenses=Debian-Packages müssen eine Lizenz angeben. Bei fehlender Lizenz geben einige Linux-Distributionen eine Meldung über eine Beeinträchtigung der Anwendungsqualität aus. message.outputting-bundle-location=RPM für Installationsprogramm wird generiert in: {0}. message.output-bundle-location=Package (.rpm) gespeichert in: {0}. -message.creating-association-with-null-extension=Verknüpfung mit Nullerweiterung wird erstellt. message.ldd-not-available=ldd-Befehl nicht gefunden. Packageabhängigkeiten werden nicht generiert. message.deb-ldd-not-available.advice=Installieren Sie das DEB-Package "libc-bin", um ldd abzurufen. diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties index be2cd00b42c..d0bc4f73407 100644 --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_ja.properties @@ -23,12 +23,7 @@ # questions. # # -app.bundler.name=Linuxアプリケーション・イメージ -deb.bundler.name=DEBバンドル -rpm.bundler.name=RPMバンドル - param.license-type.default=不明 -param.menu-group.default=不明 resource.deb-control-file=DEB制御ファイル resource.deb-preinstall-script=DEBインストール前スクリプト @@ -59,7 +54,6 @@ message.output-to-location=パッケージ(.deb)は次に保存されました: message.debs-like-licenses=Debianパッケージではライセンスを指定する必要があります。ライセンスがない場合、一部のLinuxディストリビューションでアプリケーションの品質に問題が発生する場合があります。 message.outputting-bundle-location=インストーラのRPMを次に生成しています: {0} message.output-bundle-location=パッケージ(.rpm)は次に保存されました: {0} -message.creating-association-with-null-extension=null拡張子との関連付けを作成しています。 message.ldd-not-available=lddコマンドが見つかりませんでした。パッケージ依存性は生成されません。 message.deb-ldd-not-available.advice="libc-bin" DEBパッケージをインストールしてlddを取得します。 diff --git a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties index 5b583062ab6..f3d62675c4d 100644 --- a/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties +++ b/src/jdk.jpackage/linux/classes/jdk/jpackage/internal/resources/LinuxResources_zh_CN.properties @@ -23,12 +23,7 @@ # questions. # # -app.bundler.name=Linux 应用程序映像 -deb.bundler.name=DEB 包 -rpm.bundler.name=RPM 包 - param.license-type.default=未知 -param.menu-group.default=未知 resource.deb-control-file=DEB 控制文件 resource.deb-preinstall-script=DEB 安装前脚本 @@ -59,7 +54,6 @@ message.output-to-location=程序包 (.deb) 已保存到: {0}。 message.debs-like-licenses=Debian 程序包应指定许可证。缺少许可证将导致某些 Linux 分发投诉应用程序质量。 message.outputting-bundle-location=正在为安装程序生成 RPM, 位置: {0}。 message.output-bundle-location=程序包 (.rpm) 已保存到: {0}。 -message.creating-association-with-null-extension=正在使用空扩展名创建关联。 message.ldd-not-available=未找到 ldd 命令。将不生成程序包被依赖对象。 message.deb-ldd-not-available.advice=安装 "libc-bin" DEB 程序包以获取 ldd。 diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBundlingEnvironment.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBundlingEnvironment.java index 371a3c7307a..3cecb2cd243 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBundlingEnvironment.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBundlingEnvironment.java @@ -51,7 +51,7 @@ public class MacBundlingEnvironment extends DefaultBundlingEnvironment { private static void createDmdPackage(Options options, MacDmgSystemEnvironment sysEnv) { createNativePackage(options, - MacFromOptions::createMacDmgPackage, + MacFromOptions.createMacDmgPackage(options), buildEnv()::create, MacBundlingEnvironment::buildPipeline, (env, pkg, outputDir) -> { @@ -62,7 +62,7 @@ public class MacBundlingEnvironment extends DefaultBundlingEnvironment { private static void createPkgPackage(Options options) { createNativePackage(options, - MacFromOptions::createMacPkgPackage, + MacFromOptions.createMacPkgPackage(options), buildEnv()::create, MacBundlingEnvironment::buildPipeline, (env, pkg, outputDir) -> { diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.java index 074014dede0..b1094331740 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacFromOptions.java @@ -49,7 +49,7 @@ import static jdk.jpackage.internal.cli.StandardOption.PREDEFINED_RUNTIME_IMAGE; import static jdk.jpackage.internal.model.MacPackage.RUNTIME_BUNDLE_LAYOUT; import static jdk.jpackage.internal.model.StandardPackageType.MAC_DMG; import static jdk.jpackage.internal.model.StandardPackageType.MAC_PKG; -import static jdk.jpackage.internal.util.function.ExceptionBox.rethrowUnchecked; +import static jdk.jpackage.internal.util.function.ExceptionBox.toUnchecked; import java.nio.file.Path; import java.util.Objects; @@ -106,7 +106,7 @@ final class MacFromOptions { final boolean sign = MAC_SIGN.findIn(options).orElse(false); final boolean appStore = MAC_APP_STORE.findIn(options).orElse(false); - final var appResult = Result.create(() -> createMacApplicationInternal(options)); + final var appResult = Result.of(() -> createMacApplicationInternal(options)); final Optional pkgBuilder; if (appResult.hasValue()) { @@ -146,18 +146,18 @@ final class MacFromOptions { final var expiredAppCertException = appResult.firstError().orElseThrow(); - final var pkgSignConfigResult = Result.create(signingIdentityBuilder::create); + final var pkgSignConfigResult = Result.of(signingIdentityBuilder::create); try { rethrowIfNotExpiredCertificateException(pkgSignConfigResult); // The certificate for the package signing config is also expired! } catch (RuntimeException ex) { // Some error occurred trying to configure the signing config for the package. // Ignore it, bail out with the first error. - rethrowUnchecked(expiredAppCertException); + throw toUnchecked(expiredAppCertException); } Log.error(pkgSignConfigResult.firstError().orElseThrow().getMessage()); - rethrowUnchecked(expiredAppCertException); + throw toUnchecked(expiredAppCertException); } } @@ -303,7 +303,7 @@ final class MacFromOptions { } } - rethrowUnchecked(ex); + throw toUnchecked(ex); } private static SigningIdentityBuilder createSigningIdentityBuilder(Options options) { diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/SigningIdentityBuilder.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/SigningIdentityBuilder.java index 9a57ce1e697..87193783041 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/SigningIdentityBuilder.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/SigningIdentityBuilder.java @@ -147,8 +147,9 @@ final class SigningIdentityBuilder { Objects.requireNonNull(keychain); switch (certs.size()) { case 0 -> { - Log.error(I18N.format("error.cert.not.found", certificateSelector.signingIdentities().getFirst(), - keychain.map(Keychain::name).orElse(""))); + var errMsg = I18N.format("error.cert.not.found", certificateSelector.signingIdentities().getFirst(), + keychain.map(Keychain::name).orElse("")); + Log.error(I18N.format("message.error-header", errMsg)); throw I18N.buildConfigException("error.explicit-sign-no-cert") .advice("error.explicit-sign-no-cert.advice").create(); } diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/TempKeychain.java b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/TempKeychain.java index 97709678c67..b38faecd96f 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/TempKeychain.java +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/TempKeychain.java @@ -35,7 +35,7 @@ import jdk.jpackage.internal.util.function.ThrowingConsumer; final class TempKeychain implements Closeable { - static void withKeychains(ThrowingConsumer> keychainConsumer, List keychains) throws Throwable { + static void withKeychains(ThrowingConsumer, ? extends Exception> keychainConsumer, List keychains) throws Exception { keychains.forEach(Objects::requireNonNull); if (keychains.isEmpty() || OSVersion.current().compareTo(new OSVersion(10, 12)) < 0) { keychainConsumer.accept(keychains); @@ -47,7 +47,7 @@ final class TempKeychain implements Closeable { } } - static void withKeychain(ThrowingConsumer keychainConsumer, Keychain keychain) throws Throwable { + static void withKeychain(ThrowingConsumer keychainConsumer, Keychain keychain) throws Exception { Objects.requireNonNull(keychainConsumer); withKeychains(keychains -> { keychainConsumer.accept(keychains.getFirst()); diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties index 7e36a260c3f..3cc56bb6cdf 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_de.properties @@ -23,24 +23,19 @@ # questions. # # - -app.bundler.name=Mac-Anwendungsimage -store.bundler.name=Mac App Store-fähiger Bundler -dmg.bundler.name=Mac-DMG-Package -pkg.bundler.name=Mac-PKG-Package - error.invalid-cfbundle-version.advice=Legen Sie einen kompatiblen Wert für "app-version" fest. Gültige Versionsnummern sind ein bis drei durch Punkte getrennte Ganzzahlen. error.explicit-sign-no-cert=Signatur wurde explizit angefordert, doch es wurde kein Signaturzertifikat gefunden error.explicit-sign-no-cert.advice=Geben Sie gültige Werte für mac-signing-key-user-name und mac-signing-keychain an -error.must-sign-app-store=Mac App Store-Apps müssen signiert werden. Die Signierung wurde von der Bundler-Konfiguration deaktiviert -error.must-sign-app-store.advice=Verwenden Sie die Option --mac-sign mit entsprechenden Werten für user-name und keychain -error.certificate.expired=Fehler: Zertifikat abgelaufen {0} +error.certificate.expired=Zertifikat abgelaufen {0} error.cert.not.found=Kein Zertifikat gefunden, das [{0}] mit Schlüsselbund [{1}] entspricht -error.multiple.certs.found=WARNUNG: Mehrere Zertifikate gefunden, die [{0}] mit Schlüsselbund [{1}] entsprechen. Es wird das erste Zertifikat verwendet -error.app-image.mac-sign.required=Fehler: Die Option "--mac-sign" ist mit einem vordefinierten Anwendungsimage und Typ [app-image] erforderlich -error.tool.failed.with.output=Fehler: "{0}" nicht erfolgreich mit folgender Ausgabe: -resource.bundle-config-file=Bundle-Konfigurationsdatei +error.multiple.certs.found=Mehrere Zertifikate mit Namen [{0}] in Schlüsselbund [{1}] gefunden +error.app-image.mac-sign.required=Die Option --mac-sign ist mit einem vordefinierten Anwendungsimage und Typ [app-image] erforderlich +error.tool.failed.with.output="{0}" war mit folgender Ausgabe nicht erfolgreich: +error.invalid-runtime-image-missing-file=Im Laufzeitimage "{0}" fehlt die Datei "{1}" +error.invalid-runtime-image-bin-dir=Laufzeitimage "{0}" darf keinen Ordner "bin" enthalten +error.invalid-runtime-image-bin-dir.advice=Verwenden Sie die jlink-Option --strip-native-commands, wenn das Laufzeitimage mit Option {0} generiert wird resource.app-info-plist=Info.plist der Anwendung +resource.app-runtime-info-plist=Eingebettete Info.plist von Java Runtime resource.runtime-info-plist=Info.plist von Java Runtime resource.entitlements=Mac-Berechtigungen resource.dmg-setup-script=DMG-Setupskript @@ -56,21 +51,15 @@ resource.pkg-background-image=PKG-Hintergrundbild resource.pkg-pdf=Projektdefinitionsdatei resource.launchd-plist-file=launchd-PLIST-Datei - message.bundle-name-too-long-warning={0} ist auf "{1}" gesetzt. Dies ist länger als 16 Zeichen. Kürzen Sie den Wert, um die Mac-Nutzungserfahrung zu verbessern. message.preparing-info-plist=Info.plist wird vorbereitet: {0}. message.icon-not-icns= Das angegebene Symbol "{0}" ist keine ICNS-Datei und wird nicht verwendet. Stattdessen wird das Standardsymbol verwendet. message.version-string-too-many-components="app-version" darf ein bis drei Zahlen aufweisen: 1, 1.2, 1.2.3. message.version-string-first-number-not-zero=Die erste Zahl in app-version darf nicht null oder negativ sein. -message.creating-association-with-null-extension=Verknüpfung mit Nullerweiterung wird erstellt. -message.ignoring.symlink=Warnung: codesign überspringt den Symlink {0}. -message.already.signed=Datei ist bereits signiert: {0}. -message.keychain.error=Fehler: Schlüsselbundliste kann nicht abgerufen werden. -message.building-bundle=Mac App Store-Package für {0} wird erstellt. +message.keychain.error=Schlüsselbundliste kann nicht abgerufen werden. message.invalid-identifier=Ungültige Mac-Bundle-ID [{0}]. message.invalid-identifier.advice=Geben Sie die ID mit "--mac-package-identifier" an. message.building-dmg=DMG-Package für {0} wird erstellt. -message.running-script=Shellskript wird auf Anwendungsimage [{0}] ausgeführt. message.preparing-dmg-setup=DMG-Setup wird vorbereitet: {0}. message.creating-dmg-file=DMG-Datei wird erstellt: {0}. message.dmg-cannot-be-overwritten=DMG-Datei [{0}] ist vorhanden und kann nicht entfernt werden. @@ -84,3 +73,5 @@ message.codesign.failed.reason.app.content="codesign" war nicht erfolgreich, und message.codesign.failed.reason.xcode.tools=Möglicher Grund für "codesign"-Fehler ist fehlender Xcode mit Befehlszeilen-Entwicklertools. Installieren Sie Xcode mit Befehlszeilen-Entwicklertools, und prüfen Sie, ob das Problem dadurch beseitigt wird. warning.unsigned.app.image=Warnung: Nicht signiertes app-image wird zum Erstellen von signiertem {0} verwendet. warning.per.user.app.image.signed=Warnung: Konfiguration der installierten Anwendung pro Benutzer wird nicht unterstützt, da "{0}" im vordefinierten signierten Anwendungsimage fehlt. +warning.non.standard.contents.sub.dir=Warnung: Der Dateiname des Verzeichnisses "{0}", das für die Option --app-content angegeben wurde, ist kein Standardunterverzeichnisname im Verzeichnis "Contents" des Anwendungs-Bundles. Möglicherweise verläuft die Codesignierung und/oder Notarisierung im Ergebnisanwendungs-Bundle nicht erfolgreich. +warning.app.content.is.not.dir=Warnung: Der Wert "{0}" der Option --app-content ist kein Verzeichnis. Möglicherweise verläuft die Codesignierung und/oder Notarisierung im Ergebnisanwendungs-Bundle nicht erfolgreich. diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties index 4384d6507f9..d3150a34a86 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_ja.properties @@ -23,24 +23,19 @@ # questions. # # - -app.bundler.name=Macアプリケーション・イメージ -store.bundler.name=Mac App Storeの準備完了バンドラ -dmg.bundler.name=Mac DMGパッケージ -pkg.bundler.name=Mac PKGパッケージ - error.invalid-cfbundle-version.advice=互換性のある'app-version'値を設定します。有効なバージョンは、ドットで区切られた1から3つの整数です。 error.explicit-sign-no-cert=署名が明示的に要求されましたが、署名証明書が見つかりません error.explicit-sign-no-cert.advice=有効なmac-signing-key-user-nameおよびmac-signing-keychainを指定してください -error.must-sign-app-store=Mac App Storeアプリケーションは署名されている必要がありますが、署名はバンドラ構成によって無効化されています -error.must-sign-app-store.advice=--mac-signオプションを適切なuser-nameおよびkeychain付きで使用してください -error.certificate.expired=エラー: 証明書は{0}に期限が切れました +error.certificate.expired=証明書が期限切れです{0} error.cert.not.found=キーチェーン[{1}]を使用する[{0}]と一致する証明書が見つかりません -error.multiple.certs.found=警告: キーチェーン[{1}]を使用する[{0}]と一致する複数の証明書が見つかりました。最初のものを使用します -error.app-image.mac-sign.required=エラー: --mac-signオプションは、事前定義済アプリケーション・イメージおよびタイプ[app-image]で必要です -error.tool.failed.with.output=エラー: "{0}"は次の出力で失敗しました: -resource.bundle-config-file=バンドル構成ファイル +error.multiple.certs.found=名前[{0}]に一致する複数の証明書がキーチェーン[{1}]で見つかりました +error.app-image.mac-sign.required=--mac-signオプションは、事前定義済アプリケーション・イメージおよびタイプ[app-image]で必要です +error.tool.failed.with.output="{0}"は次の出力で失敗しました: +error.invalid-runtime-image-missing-file=ランタイム・イメージ"{0}"に"{1}"ファイルがありません +error.invalid-runtime-image-bin-dir=ランタイム・イメージ"{0}"に"bin"フォルダを含めることはできません +error.invalid-runtime-image-bin-dir.advice={0}オプションとともに使用されるランタイム・イメージを生成する場合は、--strip-native-commands jlinkオプションを使用します resource.app-info-plist=アプリケーションのInfo.plist +resource.app-runtime-info-plist=埋込みJavaランタイムのInfo.plist resource.runtime-info-plist=JavaランタイムのInfo.plist resource.entitlements=Mac権限 resource.dmg-setup-script=DMG設定スクリプト @@ -56,21 +51,15 @@ resource.pkg-background-image=pkg背景イメージ resource.pkg-pdf=プロジェクト定義ファイル resource.launchd-plist-file=launchd plistファイル - message.bundle-name-too-long-warning={0}が16文字を超える''{1}''に設定されています。Macでの操作性をより良くするために短くすることを検討してください。 message.preparing-info-plist=Info.plistを準備しています: {0}。 message.icon-not-icns= 指定したアイコン"{0}"はICNSファイルではなく、使用されません。デフォルト・アイコンがその位置に使用されます。 message.version-string-too-many-components='app-version'には、1、1.2、1.2.3など1から3の数字を使用できます。 message.version-string-first-number-not-zero=pp-versionの最初の数字は、ゼロまたは負の値にできません。 -message.creating-association-with-null-extension=null拡張子との関連付けを作成しています。 -message.ignoring.symlink=警告: codesignがsymlink {0}をスキップしています -message.already.signed=ファイルはすでに署名されています: {0}。 -message.keychain.error=エラー: キーチェーン・リストを取得できません。 -message.building-bundle={0}のMac App Storeパッケージを作成しています。 +message.keychain.error=キーチェーン・リストを取得できません。 message.invalid-identifier=macバンドル識別子[{0}]が無効です。 message.invalid-identifier.advice="--mac-package-identifier"で識別子を指定してください。 message.building-dmg={0}のDMGパッケージを作成しています -message.running-script=アプリケーション・イメージ[{0}]でシェル・スクリプトを実行しています。 message.preparing-dmg-setup=dmgの設定を準備しています: {0} message.creating-dmg-file=DMGファイルを作成しています: {0} message.dmg-cannot-be-overwritten=Dmgファイルは存在し[{0}]、削除できません。 @@ -84,3 +73,5 @@ message.codesign.failed.reason.app.content="codesign"が失敗したため、追 message.codesign.failed.reason.xcode.tools="codesign"失敗の考えられる理由は、Xcodeとコマンドライン・デベロッパ・ツールの欠落です。Xcodeとコマンドライン・デベロッパ・ツールをインストールして、問題が解決されるかを確認してください。 warning.unsigned.app.image=警告: 署名されていないapp-imageを使用して署名された{0}を作成します。 warning.per.user.app.image.signed=警告: 事前定義済の署名付きアプリケーション・イメージに"{0}"がないため、インストール済アプリケーションのユーザーごとの構成はサポートされません。 +warning.non.standard.contents.sub.dir=警告: --app-contentオプションに指定されたディレクトリ"{0}"のファイル名が、アプリケーション・バンドルの"Contents"ディレクトリ内の標準サブディレクトリ名ではありません。結果アプリケーション・バンドルは、コード署名および/または公証に失敗することがあります。 +warning.app.content.is.not.dir=警告: --app-contentオプションの値"{0}"はディレクトリではありません。結果アプリケーション・バンドルは、コード署名または公証(あるいはその両方)に失敗することがあります。 diff --git a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties index 09c6d77694a..8ca2219b72f 100644 --- a/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties +++ b/src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/resources/MacResources_zh_CN.properties @@ -23,24 +23,19 @@ # questions. # # - -app.bundler.name=Mac 应用程序映像 -store.bundler.name=支持 Mac App Store 的打包程序 -dmg.bundler.name=Mac DMG 程序包 -pkg.bundler.name=Mac PKG 程序包 - error.invalid-cfbundle-version.advice=设置兼容的 'app-version' 值。有效版本包含一到三个用点分隔的整数。 error.explicit-sign-no-cert=已明确请求签名,但找不到签名证书 error.explicit-sign-no-cert.advice=指定有效的 mac-signing-key-user-name 和 mac-signing-keychain -error.must-sign-app-store=Mac App Store 应用程序必须签名, 而打包程序配置已禁用签名 -error.must-sign-app-store.advice=将 --mac-sign 选项用于适当的用户名和密钥链 -error.certificate.expired=错误: 证书已失效 {0} +error.certificate.expired=证书已到期 {0} error.cert.not.found=使用密钥链 [{1}] 找不到与 [{0}] 匹配的证书 -error.multiple.certs.found=警告:使用密钥链 [{1}] 找到多个与 [{0}] 匹配的证书,将使用第一个证书 -error.app-image.mac-sign.required=错误:预定义的应用程序映像和类型 [app image] 需要 --mac-sign 选项 -error.tool.failed.with.output=错误:"{0}" 失败,显示以下输出: -resource.bundle-config-file=包配置文件 +error.multiple.certs.found=在密钥链 [{1}] 中找到多个与名称 [{0}] 匹配的证书 +error.app-image.mac-sign.required=预定义的应用程序映像和类型 [app-image] 需要 --mac-sign 选项 +error.tool.failed.with.output="{0}" 失败,显示以下输出: +error.invalid-runtime-image-missing-file=运行时映像 "{0}" 缺少 "{1}" 文件 +error.invalid-runtime-image-bin-dir=运行时映像 "{0}" 不应包含 "bin" 文件夹 +error.invalid-runtime-image-bin-dir.advice=生成与 {0} 选项一起使用的运行时映像时,使用 --strip-native-commands jlink 选项 resource.app-info-plist=应用程序 Info.plist +resource.app-runtime-info-plist=嵌入式 Java 运行时 Info.plist resource.runtime-info-plist=Java 运行时 Info.plist resource.entitlements=Mac 权利 resource.dmg-setup-script=DMG 设置脚本 @@ -56,21 +51,15 @@ resource.pkg-background-image=pkg 背景图像 resource.pkg-pdf=项目定义文件 resource.launchd-plist-file=launchd plist 文件 - message.bundle-name-too-long-warning={0}已设置为 ''{1}'', 其长度超过了 16 个字符。为了获得更好的 Mac 体验, 请考虑将其缩短。 message.preparing-info-plist=正在准备 Info.plist: {0}。 message.icon-not-icns= 指定的图标 "{0}" 不是 ICNS 文件, 不会使用。将使用默认图标代替。 message.version-string-too-many-components='app-version' 可以包含 1 到 3 个数字:1、1.2、1.2.3。 message.version-string-first-number-not-zero=app-version 中的第一个数字不能为零或负数。 -message.creating-association-with-null-extension=正在使用空扩展名创建关联。 -message.ignoring.symlink=警告: codesign 正在跳过符号链接 {0}。 -message.already.signed=文件已签名:{0}。 -message.keychain.error=错误:无法获取密钥链列表。 -message.building-bundle=正在为 {0} 构建 Mac App Store 程序包。 -message.invalid-identifier=无效的 Mac 包标识符 [{0}]。 +message.keychain.error=无法获取密钥链列表。 +message.invalid-identifier=mac 包标识符 [{0}] 无效。 message.invalid-identifier.advice=请使用 "--mac-package-identifier" 指定标识符。 message.building-dmg=正在为 {0} 构建 DMG 程序包。 -message.running-script=正在应用程序映像 [{0}] 上运行 shell 脚本。 message.preparing-dmg-setup=正在准备 dmg 设置: {0}。 message.creating-dmg-file=正在创建 DMG 文件: {0}。 message.dmg-cannot-be-overwritten=Dmg 文件已存在 [{0}] 且无法删除。 @@ -84,3 +73,5 @@ message.codesign.failed.reason.app.content="codesign" 失败,并通过 "--app- message.codesign.failed.reason.xcode.tools="codesign" 失败可能是因为缺少带命令行开发人员工具的 Xcode。请安装带命令行开发人员工具的 Xcode,看看是否可以解决问题。 warning.unsigned.app.image=警告:使用未签名的 app-image 生成已签名的 {0}。 warning.per.user.app.image.signed=警告:由于预定义的已签名应用程序映像中缺少 "{0}",不支持对已安装应用程序的每用户配置提供支持。 +warning.non.standard.contents.sub.dir=警告:为 --app-content 选项指定的目录 "{0}" 的文件名不是应用程序包的 "Contents" 目录中的标准子目录名称。结果应用程序包可能会使代码签名和/或公证失败。 +warning.app.content.is.not.dir=警告:--app-content 选项的值 "{0}" 不是目录。结果应用程序包可能会使代码签名和/或公证失败。 diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AppImageFile.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AppImageFile.java index b6b4322302e..5f473b554be 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AppImageFile.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/AppImageFile.java @@ -198,7 +198,7 @@ final class AppImageFile { } catch (XPathExpressionException ex) { // This should never happen as XPath expressions should be correct - throw ExceptionBox.rethrowUnchecked(ex); + throw ExceptionBox.toUnchecked(ex); } catch (SAXException ex) { // Malformed input XML throw new JPackageException(I18N.format("error.malformed-app-image-file", relativeAppImageFilePath, appImageDir), ex); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DefaultBundlingEnvironment.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DefaultBundlingEnvironment.java index 0bf7d6f41b2..05e080f240a 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DefaultBundlingEnvironment.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/DefaultBundlingEnvironment.java @@ -144,29 +144,27 @@ class DefaultBundlingEnvironment implements CliBundlingEnvironment { } static void createNativePackage(Options options, - Function createPackage, + T pkg, BiFunction createBuildEnv, PackagingPipeline.Builder pipelineBuilder, Packager.PipelineBuilderMutatorFactory pipelineBuilderMutatorFactory) { Objects.requireNonNull(pipelineBuilder); - createNativePackage(options, createPackage, createBuildEnv, _ -> pipelineBuilder, pipelineBuilderMutatorFactory); + createNativePackage(options, pkg, createBuildEnv, _ -> pipelineBuilder, pipelineBuilderMutatorFactory); } static void createNativePackage(Options options, - Function createPackage, + T pkg, BiFunction createBuildEnv, Function createPipelineBuilder, Packager.PipelineBuilderMutatorFactory pipelineBuilderMutatorFactory) { Objects.requireNonNull(options); - Objects.requireNonNull(createPackage); + Objects.requireNonNull(pkg); Objects.requireNonNull(createBuildEnv); Objects.requireNonNull(createPipelineBuilder); Objects.requireNonNull(pipelineBuilderMutatorFactory); - var pkg = Objects.requireNonNull(createPackage.apply(options)); - Packager.build().pkg(pkg) .outputDir(OptionUtils.outputDir(options)) .env(Objects.requireNonNull(createBuildEnv.apply(options, pkg))) @@ -207,7 +205,9 @@ class DefaultBundlingEnvironment implements CliBundlingEnvironment { } private Supplier>> getBundlerSupplier(BundlingOperationDescriptor op) { - return Optional.ofNullable(bundlers.get(op)).orElseThrow(NoSuchElementException::new); + return Optional.ofNullable(bundlers.get(op)).orElseThrow(() -> { + throw new NoSuchElementException(String.format("Unsupported bundling operation: %s", op)); + }); } private String bundleTypeDescription(PackageType type, OperatingSystem os) { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherBuilder.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherBuilder.java index e3720e0a776..5658760b4d6 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherBuilder.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherBuilder.java @@ -50,13 +50,16 @@ final class LauncherBuilder { final var fa = createFileAssociations(faSources, Optional.ofNullable(faTraits).orElse(DEFAULT_FA_TRAITS)); - Objects.requireNonNull(defaultIconResourceName); - final var nonNullName = deriveNonNullName(); - return new Stub(nonNullName, Optional.ofNullable(startupInfo), fa, - isService, Optional.ofNullable(description).orElse(nonNullName), - Optional.ofNullable(icon), defaultIconResourceName, + return new Stub( + nonNullName, + Optional.ofNullable(startupInfo), + fa, + isService, + Optional.ofNullable(description).orElse(nonNullName), + Optional.ofNullable(icon), + Optional.ofNullable(defaultIconResourceName).orElseGet(LauncherBuilder::defaultIconResourceName), Optional.ofNullable(extraAppImageFileData).orElseGet(Map::of)); } @@ -170,6 +173,23 @@ final class LauncherBuilder { return FileAssociationGroup.flatMap(groups.stream()).toList(); } + private static String defaultIconResourceName() { + switch (OperatingSystem.current()) { + case WINDOWS -> { + return "JavaApp.ico"; + } + case LINUX -> { + return "JavaApp.png"; + } + case MACOS -> { + return "JavaApp.icns"; + } + default -> { + throw new UnsupportedOperationException(); + } + } + } + private String name; private LauncherStartupInfo startupInfo; private List faSources = List.of(); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherFromOptions.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherFromOptions.java index 0749cc48b9b..ed030a4a726 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherFromOptions.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/LauncherFromOptions.java @@ -45,7 +45,6 @@ import java.util.Optional; import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.stream.IntStream; -import jdk.internal.util.OperatingSystem; import jdk.jpackage.internal.FileAssociationGroup.FileAssociationException; import jdk.jpackage.internal.FileAssociationGroup.FileAssociationNoExtensionsException; import jdk.jpackage.internal.FileAssociationGroup.FileAssociationNoMimesException; @@ -82,7 +81,7 @@ final class LauncherFromOptions { } Launcher create(Options options) { - final var builder = new LauncherBuilder().defaultIconResourceName(defaultIconResourceName()); + final var builder = new LauncherBuilder(); DESCRIPTION.ifPresentIn(options, builder::description); builder.icon(toLauncherIcon(ICON.findIn(options).orElse(null))); @@ -167,23 +166,6 @@ final class LauncherFromOptions { } } - private static String defaultIconResourceName() { - switch (OperatingSystem.current()) { - case WINDOWS -> { - return "JavaApp.ico"; - } - case LINUX -> { - return "JavaApp.png"; - } - case MACOS -> { - return "JavaApp.icns"; - } - default -> { - throw new UnsupportedOperationException(); - } - } - } - private BiConsumer faGroupBuilderMutator; private BiFunction faMapper; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PackagingPipeline.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PackagingPipeline.java index a2750fee260..c94dada9262 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PackagingPipeline.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/PackagingPipeline.java @@ -508,7 +508,7 @@ final class PackagingPipeline { try { builder.create().call(); } catch (Exception ex) { - throw ExceptionBox.rethrowUnchecked(ex); + throw ExceptionBox.toUnchecked(ex); } } @@ -632,7 +632,7 @@ final class PackagingPipeline { final var accepted = withAction && context.test(id); if (TRACE_TASK_ACTION) { - var sb = new StringBuffer(); + var sb = new StringBuilder(); sb.append("Execute task=[").append(id).append("]: "); if (!withAction) { sb.append("no action"); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java index f377b22374d..9feb5b40944 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/Main.java @@ -31,6 +31,7 @@ import static jdk.jpackage.internal.cli.StandardOption.VERSION; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.PrintStream; import java.io.PrintWriter; import java.io.UncheckedIOException; import java.nio.file.NoSuchFileException; @@ -47,6 +48,7 @@ import jdk.internal.util.OperatingSystem; import jdk.jpackage.internal.Log; import jdk.jpackage.internal.model.ConfigException; import jdk.jpackage.internal.model.JPackageException; +import jdk.jpackage.internal.util.Slot; import jdk.jpackage.internal.util.function.ExceptionBox; /** @@ -65,6 +67,21 @@ public final class Main { public int run(PrintWriter out, PrintWriter err, String... args) { return Main.run(out, err, args); } + + @Override + public int run(PrintStream out, PrintStream err, String... args) { + PrintWriter outWriter = new PrintWriter(out, true); + PrintWriter errWriter = new PrintWriter(err, true); + try { + try { + return run(outWriter, errWriter, args); + } finally { + outWriter.flush(); + } + } finally { + errWriter.flush(); + } + } } @@ -78,27 +95,45 @@ public final class Main { } public static int run(PrintWriter out, PrintWriter err, String... args) { + Objects.requireNonNull(args); + for (String arg : args) { + Objects.requireNonNull(arg); + } Objects.requireNonNull(out); Objects.requireNonNull(err); Log.setPrintWriter(out, err); + final var runner = new Runner(t -> { + new ErrorReporter(_ -> { + t.printStackTrace(err); + }, Log::fatalError, Log.isVerbose()).reportError(t); + }); + try { - try { - args = CommandLine.parse(args); - } catch (FileNotFoundException|NoSuchFileException ex) { - Log.fatalError(I18N.format("ERR_CannotParseOptions", ex.getMessage())); - return 1; - } catch (IOException ex) { - throw ExceptionBox.rethrowUnchecked(ex); + var mappedArgs = Slot.createEmpty(); + + int preprocessStatus = runner.run(() -> { + try { + mappedArgs.set(CommandLine.parse(args)); + return List.of(); + } catch (FileNotFoundException | NoSuchFileException ex) { + return List.of(new JPackageException(I18N.format("ERR_CannotParseOptions", ex.getMessage()), ex)); + } catch (IOException ex) { + return List.of(ex); + } + }); + + if (preprocessStatus != 0) { + return preprocessStatus; } final var bundlingEnv = ServiceLoader.load(CliBundlingEnvironment.class, CliBundlingEnvironment.class.getClassLoader()).findFirst().orElseThrow(); - final var parseResult = Utils.buildParser(OperatingSystem.current(), bundlingEnv).create().apply(args); + final var parseResult = Utils.buildParser(OperatingSystem.current(), bundlingEnv).create().apply(mappedArgs.get()); - return new Runner().run(() -> { + return runner.run(() -> { final var parsedOptionsBuilder = parseResult.orElseThrow(); final var options = parsedOptionsBuilder.create(); @@ -144,13 +179,35 @@ public final class Main { } } + /* + * Exception (error) reporting: + * + * There are two types of exceptions to handle: + * + * 1. Exceptions explicitly thrown by jpackage code with localized, + * jpackage-specific error messages. These are usually instances of + * JPackageException. + * + * 2. Exceptions thrown by JDK code (for example, an NPE from Optional.of(...)). + * These should normally not occur or should be handled at the point + * where they arise. If they reach this level of exception handling, + * it indicates a flaw in jpackage’s internal logic. + * + * Always print stack traces for exceptions of type #2. + * Print stack traces for exceptions of type #1 only in verbose mode. + * Always print the messages for exceptions of any type. + */ - record ErrorReporter(Consumer stackTracePrinter, Consumer messagePrinter) { + record ErrorReporter(Consumer stackTracePrinter, Consumer messagePrinter, boolean verbose) { ErrorReporter { Objects.requireNonNull(stackTracePrinter); Objects.requireNonNull(messagePrinter); } + ErrorReporter(Consumer stackTracePrinter, Consumer messagePrinter) { + this(stackTracePrinter, messagePrinter, true); + } + void reportError(Throwable t) { if (t instanceof ConfigException cfgEx) { printError(cfgEx, Optional.ofNullable(cfgEx.getAdvice())); @@ -164,10 +221,14 @@ public final class Main { } private void printError(Throwable t, Optional advice) { - stackTracePrinter.accept(t); + var isAlienException = isAlienExceptionType(t); + + if (isAlienException || verbose) { + stackTracePrinter.accept(t); + } String msg; - if (isAlienExceptionType(t)) { + if (isAlienException) { msg = t.toString(); } else { msg = t.getMessage(); @@ -196,15 +257,18 @@ public final class Main { } - static final class Runner { + record Runner(Consumer errorReporter) { + + Runner { + Objects.requireNonNull(errorReporter); + } int run(Supplier> r) { final var exceptions = runIt(r); if (exceptions.isEmpty()) { return 0; } else { - var errorReporter = new ErrorReporter(Log::verbose, Log::fatalError); - exceptions.forEach(errorReporter::reportError); + exceptions.forEach(errorReporter); return 1; } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpecMapperOptionScope.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpecMapperOptionScope.java index ec781e107ea..7b517f768bf 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpecMapperOptionScope.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionSpecMapperOptionScope.java @@ -111,7 +111,7 @@ interface OptionSpecMapperOptionScope extends OptionScope { if (contextOptionScope.isEmpty()) { var mutators = new AccumulatingContextOptionScope(optionSpecBuilder, contextType); mutators.addMutator(optionSpecBuilderMutator); - scope = SetBuilder.build(OptionScope.class).add(scope).add(mutators).create(); + scope = SetBuilder.build().add(scope).add(mutators).create(); } return scope; diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionsProcessor.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionsProcessor.java index 1bc5c36989f..54003b714a2 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionsProcessor.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/OptionsProcessor.java @@ -87,7 +87,7 @@ final class OptionsProcessor { final var untypedOptions = optionsBuilder.create(); // Create command line structure analyzer. - final var analyzerResult = Result.create(() -> new OptionsAnalyzer(untypedOptions, bundlingEnv)); + final var analyzerResult = Result.of(() -> new OptionsAnalyzer(untypedOptions, bundlingEnv)); if (analyzerResult.hasErrors()) { // Failed to derive the bundling operation from the command line. allErrors.addAll(analyzerResult.mapErrors().errors()); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardBundlingOperation.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardBundlingOperation.java index 988589884cc..45f9194db0b 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardBundlingOperation.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardBundlingOperation.java @@ -53,9 +53,32 @@ public enum StandardBundlingOperation implements BundlingOperationOptionScope { CREATE_LINUX_DEB(StandardPackageType.LINUX_DEB, "^(?!(win-|mac-|linux-rpm-))", OperatingSystem.LINUX), CREATE_MAC_PKG(StandardPackageType.MAC_PKG, "^(?!(linux-|win-|mac-dmg-))", OperatingSystem.MACOS), CREATE_MAC_DMG(StandardPackageType.MAC_DMG, "^(?!(linux-|win-|mac-pkg-))", OperatingSystem.MACOS), - SIGN_MAC_APP_IMAGE(APP_IMAGE, OperatingSystem.MACOS, "sign"); + SIGN_MAC_APP_IMAGE(APP_IMAGE, OperatingSystem.MACOS, Verb.SIGN); - StandardBundlingOperation(PackageType packageType, String optionNameRegexp, OperatingSystem os, String descriptorVerb) { + /** + * Supported values of the {@link BundlingOperationDescriptor#verb()} property. + */ + private enum Verb { + CREATE(BundlingOperationDescriptor.VERB_CREATE_BUNDLE), + SIGN("sign"), + ; + + Verb(String value) { + this.value = Objects.requireNonNull(value); + } + + String value() { + return value; + } + + boolean createBundle() { + return this == CREATE; + } + + private final String value; + } + + StandardBundlingOperation(PackageType packageType, String optionNameRegexp, OperatingSystem os, Verb descriptorVerb) { this.packageType = Objects.requireNonNull(packageType); optionNamePredicate = Pattern.compile(optionNameRegexp).asPredicate(); this.os = Objects.requireNonNull(os); @@ -63,17 +86,17 @@ public enum StandardBundlingOperation implements BundlingOperationOptionScope { } StandardBundlingOperation(PackageType packageType, String optionNameRegexp, OperatingSystem os) { - this(packageType, optionNameRegexp, os, "create"); + this(packageType, optionNameRegexp, os, Verb.CREATE); } - StandardBundlingOperation(PackageType packageType, OperatingSystem os, String descriptorVerb) { + StandardBundlingOperation(PackageType packageType, OperatingSystem os, Verb descriptorVerb) { this.packageType = Objects.requireNonNull(packageType); optionNamePredicate = v -> false; this.os = Objects.requireNonNull(os); this.descriptorVerb = Objects.requireNonNull(descriptorVerb); } - OperatingSystem os() { + public OperatingSystem os() { return os; } @@ -89,9 +112,17 @@ public enum StandardBundlingOperation implements BundlingOperationOptionScope { return packageType; } + /** + * Returns {@code true} if this bundling operation will create a new bundle and + * {@code false} otherwise. + */ + public boolean isCreateBundle() { + return descriptorVerb.createBundle(); + } + @Override public BundlingOperationDescriptor descriptor() { - return new BundlingOperationDescriptor(os(), packageTypeValue(), descriptorVerb); + return new BundlingOperationDescriptor(os(), packageTypeValue(), descriptorVerb.value()); } public static Optional valueOf(BundlingOperationDescriptor descriptor) { @@ -101,10 +132,17 @@ public enum StandardBundlingOperation implements BundlingOperationOptionScope { }).findFirst(); } - static Stream ofPlatform(OperatingSystem os) { + public static Stream ofPlatform(OperatingSystem os) { return Stream.of(values()).filter(platform(os)); } + public static Predicate platform(OperatingSystem os) { + Objects.requireNonNull(os); + return op -> { + return op.os() == os; + }; + } + static Set fromOptionName(String optionName) { Objects.requireNonNull(optionName); return Stream.of(StandardBundlingOperation.values()).filter(v -> { @@ -112,13 +150,6 @@ public enum StandardBundlingOperation implements BundlingOperationOptionScope { }).collect(Collectors.toUnmodifiableSet()); } - static Predicate platform(OperatingSystem os) { - Objects.requireNonNull(os); - return op -> { - return op.os() == os; - }; - } - static Stream narrow(Stream scope) { return scope.filter(StandardBundlingOperation.class::isInstance).map(StandardBundlingOperation.class::cast); } @@ -145,8 +176,8 @@ public enum StandardBundlingOperation implements BundlingOperationOptionScope { static final Set LINUX = LINUX_CREATE_BUNDLE; - static final Set MACOS = SetBuilder.build( - BundlingOperationOptionScope.class).add(MACOS_CREATE_BUNDLE).add(SIGN_MAC_APP_IMAGE).create(); + static final Set MACOS = SetBuilder.build( + ).add(MACOS_CREATE_BUNDLE).add(SIGN_MAC_APP_IMAGE).create(); static final Set MACOS_APP_IMAGE = Set.of( SIGN_MAC_APP_IMAGE, CREATE_MAC_APP_IMAGE); @@ -169,5 +200,5 @@ public enum StandardBundlingOperation implements BundlingOperationOptionScope { private final Predicate optionNamePredicate; private final OperatingSystem os; private final PackageType packageType; - private final String descriptorVerb; + private final Verb descriptorVerb; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.java index 6de3b7e5c5c..ec63c1fb498 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.java @@ -543,7 +543,7 @@ public final class StandardOption { .description("help.option." + name) .scope(fromOptionName(name)) .scope(scope -> { - return SetBuilder.build(OptionScope.class) + return SetBuilder.build() .add(scope) .add(BundlingOperationModifier.values()) .create(); diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Application.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Application.java index 943a42712c8..5b20a0690d3 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Application.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Application.java @@ -40,7 +40,7 @@ import java.util.stream.Stream; * * @see Package */ -public interface Application extends BundleSpec { +public non-sealed interface Application extends BundleSpec { /** * Gets the name of this application. diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundleSpec.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundleSpec.java index d91662075e3..e6426a9c1b5 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundleSpec.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundleSpec.java @@ -27,5 +27,5 @@ package jdk.jpackage.internal.model; /** * A generic bundle specification. */ -public interface BundleSpec { +public sealed interface BundleSpec permits Application, Package { } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundlingOperationDescriptor.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundlingOperationDescriptor.java index 70e51c849eb..7a736d95514 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundlingOperationDescriptor.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/BundlingOperationDescriptor.java @@ -41,6 +41,10 @@ public record BundlingOperationDescriptor(OperatingSystem os, String bundleType, Objects.requireNonNull(verb); } + public BundlingOperationDescriptor(OperatingSystem os, String bundleType) { + this(os, bundleType, VERB_CREATE_BUNDLE); + } + @Override public String toString() { return os.name() + ":" + verb + ":" + bundleType; @@ -50,4 +54,6 @@ public record BundlingOperationDescriptor(OperatingSystem os, String bundleType, final var components = str.split(":"); return new BundlingOperationDescriptor(OperatingSystem.valueOf(components[0]), components[1], components[2]); } + + public static final String VERB_CREATE_BUNDLE = "create"; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Package.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Package.java index 33c707b776f..ec5d6341d4d 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Package.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/model/Package.java @@ -66,7 +66,7 @@ import java.util.Optional; * * */ -public interface Package extends BundleSpec { +public non-sealed interface Package extends BundleSpec { /** * Gets the application of this package. diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties index c1cb5bf4283..5b9a5728912 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -24,19 +24,163 @@ # # -MSG_Help=Verwendung: jpackage \n\nBeispielverwendungen:\n--------------\n Generiert ein für das Hostsystem geeignetes Anwendungspackage:\n Für eine modulare Anwendung:\n jpackage -n name -p modulePath -m moduleName/className\n Für eine nicht modulare Anwendung:\n jpackage -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n Aus einem vorab erstellten Anwendungsimage:\n jpackage -n name --app-image appImageDir\n Generiert ein Anwendungsimage:\n Für eine modulare Anwendung:\n jpackage --type app-image -n name -p modulePath \\\n -m moduleName/className\n Für eine nicht modulare Anwendung:\n jpackage --type app-image -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n Um eigene Optionen für jlink anzugeben, führen Sie jlink separat aus:\n jlink --output appRuntimeImage -p modulePath \\\n --add-modules moduleName \\\n --no-header-files [...]\n jpackage --type app-image -n name \\\n -m moduleName/className --runtime-image appRuntimeImage\n Generiert ein Java Runtime-Package:\n jpackage -n name --runtime-image \n{6}\nAllgemeine Optionen:\n @ \n Liest Optionen und/oder Modus aus einer Datei \n Diese Option kann mehrmals verwendet werden.\n --type -t \n Der zu erstellende Packagetyp\n Gültige Werte: {1} \n Bei fehlender Angabe dieser Option wird ein plattformabhängiger\n Standardtyp erstellt.\n --app-version \n Version der Anwendung und/oder des Packages\n --copyright \n Copyright für die Anwendung\n --description \n Beschreibung der Anwendung\n --help -h \n Gibt den Verwendungstext mit einer Liste und Beschreibung jeder gültigen\n Option für die aktuelle Plattform an den Ausgabestream aus und beendet den Vorgang\n --icon \n Pfad des Symbols für das Anwendungspackage\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --name -n \n Name der Anwendung und/oder des Packages\n --dest -d \n Pfad, in den die generierte Ausgabedatei abgelegt wird\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Standardmäßig wird das aktuelle Arbeitsverzeichnis verwendet.\n --temp \n Pfad eines neuen oder leeren Verzeichnisses zum Erstellen temporärer Dateien\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Falls angegeben, wird das temporäre Verzeichnis beim Abschließen der Aufgabe\n nicht entfernt und muss manuell entfernt werden.\n Bei fehlender Angabe wird ein temporäres Verzeichnis erstellt und\n beim Abschließen der Aufgabe entfernt.\n --vendor \n Anbieter der Anwendung\n --verbose\n Aktiviert Ausgabe im Verbose-Modus\n --version\n Gibt die Produktversion an den Outputstream aus und beendet den Vorgang.\n\nOptionen für das Erstellen des Laufzeitimages:\n --add-modules [,...]\n Eine per Komma (",") getrennte Liste hinzuzufügender Module\n Diese Modulliste wird zusammen mit dem Hauptmodul (sofern angegeben)\n als Argument --add-module an jlink übergeben.\n Bei fehlender Angabe wird entweder nur das Hauptmodul (sofern --module\n angegeben ist) oder das Standardset an Modulen (sofern --main-jar \n angegeben ist) verwendet.\n Diese Option kann mehrmals verwendet werden.\n --module-path -p ...\n \ -Eine per {0} getrennte Pfadliste\n Jeder Pfad ist entweder ein Verzeichnis mit Modulen oder der Pfad zu einer\n JAR-Datei eines Moduls.\n (Jeder Pfad ist absolut oder relativ zum aktuellen Verzeichnis.)\n Diese Option kann mehrmals verwendet werden.\n --jlink-options \n Eine per Leerzeichen getrennte Liste mit an jlink zu übergebenden Optionen \n Bei fehlender Angabe wird standardmäßig "--strip-native-commands \n --strip-debug --no-man-pages --no-header-files" verwendet. \n Diese Option kann mehrmals verwendet werden.\n --runtime-image \n Pfad des vordefinierten Laufzeitimages, das in\n das Anwendungsimage kopiert wird\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Wenn --runtime-image nicht angegeben wird, führt jpackage jlink aus, um\n das Laufzeitimage mit folgenden Optionen zu erstellen:\n --strip-debug, --no-header-files, --no-man-pages und\n --strip-native-commands.\n\nOptionen für das Erstellen des Anwendungsimages:\n --input -i \n Pfad des Eingabeverzeichnisses mit den zu verpackenden Dateien\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Alle Dateien im Eingabeverzeichnis werden verpackt für das\n Anwendungsimage integriert.\n --app-content [,...]\n Eine per Komma getrennte Liste mit Pfaden zu Dateien und/oder Verzeichnissen,\n die zur Anwendungs-Payload hinzugefügt werden sollen.\n Diese Option kann mehrmals verwendet werden.\n\nOptionen für das Erstellen des Anwendungs-Launchers:\n --add-launcher =\n Name des Launchers sowie ein Pfad zu einer Eigenschaftendatei mit\n einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Die Schlüssel "module", "main-jar", "main-class", "description",\n "arguments", "java-options", "app-version", "icon",\n "launcher-as-service",\n "win-console", "win-shortcut", "win-menu",\n "linux-app-category" und "linux-shortcut" können verwendet werden.\n Diese Optionen werden den ursprünglichen Befehlszeilenoptionen hinzugefügt\n (oder überschreiben diese), um einen zusätzlichen, alternativen Launcher zu erstellen.\n Der Hauptanwendungs-Launcher wird aus den Befehlszeilenoptionen\n erstellt. Mit dieser Option können zusätzliche alternative Launcher\n erstellt werden. Außerdem kann diese Option mehrmals verwendet werden,\n um mehrere zusätzliche Launcher zu erstellen. \n --arguments \n Befehlszeilenargumente, die an die Hauptklasse übergeben werden, falls\n keine Befehlszeilenargumente an den Launcher übergeben werden\n Diese Option kann mehrmals verwendet werden.\n --java-options \n Optionen, die an Java Runtime übergeben werden\n Diese Option kann mehrmals verwendet werden.\n --main-class \n Qualifizierter Name der auszuführenden Anwendungshauptklasse\n Diese Option kann nur bei Angabe von --main-jar verwendet werden.\n --main-jar \n Die Haupt-JAR-Datei der Anwendung, die die Hauptklasse enthält\n (angegeben als Pfad relativ zum Eingabepfad)\n Es kann entweder die Option --module oder die Option --main-jar angegeben werden, nicht jedoch\n beides.\n --module -m [/]\n Das Hauptmodul (und optional die Hauptklasse) der Anwendung\n Dieses Modul muss unter dem Modulpfad gespeichert sein.\n Bei Angabe dieser Option wird das Hauptmodul\n \ -im Java Runtime-Image verknüpft. Es kann entweder die Option --module oder die Option --main-jar\n angegeben werden, nicht jedoch beides.\n{2}\nOptionen für das Erstellen des Anwendungspackages:\n --about-url \n URL der Homepage der Anwendung\n --app-image \n {5} (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --file-associations \n Pfad zu einer Eigenschaftendatei mit einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Mit den Schlüsseln "extension", "mime-type", "icon" und "description"\n kann die Verknüpfung beschrieben werden.\n Diese Option kann mehrmals verwendet werden.\n --install-dir \n {4} --license-file \n Pfad zur Lizenzdatei\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --resource-dir \n Pfad zum Überschreiben von jpackage-Ressourcen\n Symbole, Vorlagendateien und weitere Ressourcen von jpackage können\n durch Hinzufügen von Ersetzungsressourcen zu diesem Verzeichnis überschrieben werden.\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n --runtime-image \n Pfad des zu installierenden vordefinierten Laufzeitimages\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Option muss beim Erstellen eines Laufzeitpackages angegeben werden.\n --launcher-as-service\n Anforderung zum Erstellen eines Installationsprogramms, das den\n Hauptanwendungs-Launcher als Hintergrundserviceanwendung registriert.\n\nPlattformabhängige Optionen für das Erstellen des Anwendungspackages:\n{3} +help.header=Verwendung: jpackage + +help.short=Verwenden Sie jpackage --help (oder -h), um eine Liste möglicher Optionen aufzurufen + +help.option-group.sample.create-native-package=\ Generieren Sie ein Anwendungspackage, das für das Hostsystem geeignet ist:\n Für eine modulare Anwendung:\n jpackage -n name -p modulePath -m moduleName/className\n Für eine nicht modulare Anwendung:\n jpackage -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n Aus einem vordefinierten Anwendungsimage:\n jpackage -n name --app-image appImageDir + +help.option-group.sample.create-app-image=\ Generieren Sie ein Anwendungspackage:\n Für eine modulare Anwendung:\n jpackage --type app-image -n name -p modulePath \\\n -m moduleName/className\n Für eine nicht modulare Anwendung:\n jpackage --type app-image -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n Um eigene Optionen für jlink anzugeben, führen Sie jlink separat aus:\n jlink --output appRuntimeImage -p modulePath \\\n --add-modules moduleName \\\n --no-header-files [...]\n jpackage --type app-image -n name \\\n -m moduleName/className --runtime-image appRuntimeImage + +help.option-group.sample.create-runtime-installer=\ Generieren Sie ein Java-Laufzeitpackage:\n jpackage -n name --runtime-image + +help.option-group.sample.sign-app-image=\ Vordefiniertes Anwendungsimage signieren:\n jpackage --type app-image --app-image \\\n --mac-sign [...]\n Hinweis: In diesem Modus sind nur die folgenden zusätzlichen Optionen zulässig:\n Das Set der zusätzlichen Mac-Signaturoptionen und --verbose + +help.option-group.sample=Beispielverwendungen +help.option-group.generic=Allgemeine Optionen +help.option-group.runtime-image=Optionen für das Erstellen des Laufzeitimages +help.option-group.app-image=Optionen für das Erstellen des Anwendungsimages +help.option-group.launcher=Optionen für das Erstellen der Anwendungslauncher: +help.option-group.launcher-platform=Plattformabhängige Option für das Erstellen des Anwendungslaunchers +help.option-group.package=Optionen für das Erstellen des Anwendungspackages +help.option-group.package-platform=Plattformabhängige Optionen für das Erstellen des Anwendungspackages + +help.option.argument-file=\ Leseoptionen und/oder -modus aus einer Datei\n Diese Option kann mehrmals verwendet werden. + +help.option.about-url=\ URL der Homepage der Anwendung + +help.option.add-launcher.win=\ Name des Launchers sowie ein Pfad zu einer Eigenschaftendatei mit\n einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Die Schlüssel "arguments", "description", "icon", "java-options",\n "launcher-as-service", "main-class", "main-jar", "module",\n "win-console", "win-menu" und "win-shortcut" können verwendet werden. \n Diese Optionen werden den ursprünglichen\n Befehlszeilenoptionen hinzugefügt (oder überschreiben diese), um einen zusätzlichen, alternativen Launcher zu erstellen.\n Der Hauptanwendungslauncher wird aus den Befehlszeilenoptionen\n erstellt. Mit dieser Option können zusätzliche alternative Launcher\n erstellt werden. Außerdem kann diese Option mehrmals verwendet werden,\n um mehrere zusätzliche Launcher zu erstellen. + +help.option.add-launcher.linux=\ Name des Launchers sowie ein Pfad zu einer Eigenschaftendatei mit\n einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Die Schlüssel "arguments", "description", "icon", "java-options",\n "launcher-as-service", "linux-shortcut", "main-class", "main-jar"\n und "module" können verwendet werden. \n Diese Optionen werden den ursprünglichen Befehlszeilenoptionen hinzugefügt\n (oder überschreiben diese), um einen zusätzlichen, alternativen Launcher zu erstellen. \n Der Hauptanwendungslauncher wird aus den Befehlszeilenoptionen\n erstellt. Mit dieser Option können zusätzliche alternative Launcher\n erstellt werden. Außerdem kann diese Option mehrmals verwendet werden,\n um mehrere zusätzliche Launcher zu erstellen. + +help.option.add-launcher.mac=\ Name des Launchers sowie ein Pfad zu einer Eigenschaftendatei mit\n einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Die Schlüssel "arguments", "description", "icon", "java-options",\n "launcher-as-service", "main-class", "main-jar"\n und "module" können verwendet werden. \n Diese Optionen werden den ursprünglichen Befehlszeilenoptionen hinzugefügt\n (oder überschreiben diese), um einen zusätzlichen, alternativen Launcher zu erstellen. \n Der Hauptanwendungslauncher wird aus den Befehlszeilenoptionen\n erstellt. Mit dieser Option können zusätzliche alternative Launcher\n erstellt werden. Außerdem kann diese Option mehrmals verwendet werden,\n um mehrere zusätzliche Launcher zu erstellen. + +help.option.add-modules=\ Eine per Komma (",") getrennte Liste hinzuzufügender Module\n Diese Modulliste wird zusammen mit dem Hauptmodul (sofern angegeben)\n als Argument --add-module an jlink übergeben. \n Bei fehlender Angabe wird entweder nur das Hauptmodul (sofern --module\n angegeben ist) oder das Standardset an Modulen (sofern --main-jar\n angegeben ist) verwendet. \n Diese Option kann mehrmals verwendet werden. + +help.option.app-content=\ Eine per Komma getrennte Liste mit Pfaden zu Dateien und/oder Verzeichnissen,\n die zur Anwendungs-Payload hinzugefügt werden sollen.\n Diese Option kann mehrmals verwendet werden. + +help.option.app-content.mac=\ Eine per Komma getrennte Liste mit Pfaden zu Dateien und/oder Verzeichnissen,\n die zur Anwendungs-Payload hinzugefügt werden sollen. \n Diese Option kann mehrmals verwendet werden. \n Hinweis: Der Wert muss ein Verzeichnis mit dem Unterverzeichnis "Resources" sein\n Unterverzeichnis (oder ein anderes Verzeichnis, das im Verzeichnis "Contents"\n des Anwendungs-Bundles gültig ist). Andernfalls produziert jpackage möglicherweise ein\n ungültiges Anwendungs-Bundle, bei dem die Codesignatur und/oder Notarisierung nicht erfolgreich\n verläuft. + +help.option.app-image=\ Speicherort des vordefinierten Anwendungsimages, mit dem\n ein installierbares Package erstellt wird\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis) + +help.option.app-image.mac=\ Speicherort des vordefinierten Anwendungsimages, mit dem\n ein installierbares Package erstellt oder das vordefinierte\n Anwendungsimage signiert wird\n (absoluter Pfad bzw. relativ zum aktuellen Verzeichnis) + +help.option.app-version=\ Version der Anwendung und/oder des Packages + +help.option.arguments=\ Befehlszeilenargumente, die an die Hauptklasse übergeben werden, falls\n keine Befehlszeilenargumente an den Launcher übergeben werden\n Diese Option kann mehrmals verwendet werden. + +help.option.copyright=\ Copyright für die Anwendung + +help.option.description=\ Beschreibung der Anwendung + +help.option.dest=\ Pfad, in dem die generierte Ausgabedatei abgelegt wird\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Standardmäßig wird das aktuelle Arbeitsverzeichnis verwendet. + +help.option.file-associations=\ Pfad zu einer Eigenschaftendatei mit einer Liste von Schlüssel/Wert-Paaren\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Mit den Schlüsseln "extension", "mime-type", "icon" und "description"\n kann die Verknüpfung beschrieben werden.\n Diese Option kann mehrmals verwendet werden. + +help.option.help=\ Gibt den Verwendungstext mit einer Liste und Beschreibung jeder gültigen\n Option für die aktuelle Plattform an den Outputstream aus und beendet den Vorgang + +help.option.icon=\ Pfad des Symbols für das Anwendungspackage\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis) + +help.option.input=\ Pfad des Eingabeverzeichnisses mit den zu verpackenden Dateien\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Alle Dateien im Eingabeverzeichnis werden als Package in das\n Anwendungsimage integriert. + +help.option.install-dir=\ Absoluter Pfad des Installationsverzeichnisses der Anwendung + +help.option.install-dir.win=\ Relativer Unterpfad des Installationsverzeichnisses der\n Anwendung, wie "Programme" oder "AppData". + +help.option.installer-runtime-image=\ Pfad des zu installierenden vordefinierten Laufzeitimages\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Option muss beim Erstellen eines Laufzeitpackages angegeben werden. + +help.option.java-options=\ Optionen, die an Java Runtime übergeben werden\n Diese Option kann mehrmals verwendet werden. + +help.option.jlink-options=\ Eine per Leerzeichen getrennte Liste mit an jlink zu übergebenden Optionen\n Bei fehlender Angabe wird standardmäßig "--strip-native-commands\n --strip-debug --no-man-pages --no-header-files" verwendet. \n Diese Option kann mehrmals verwendet werden. + +help.option.launcher-as-service=\ Anforderung zum Erstellen eines Installationsprogramms, das den\n Hauptanwendungslauncher als Hintergrundserviceanwendung registriert. + +help.option.license-file=\ Pfad zur Lizenzdatei\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis) + +help.option.linux-app-category=\ Gruppenwert der RPM-Datei .spec oder\n Abschnittswert der DEB-Kontrolldatei + +help.option.linux-app-release=\ Releasewert der RPM-Datei .spec oder\n Debian-Revisionswert der DEB-Kontrolldatei + +help.option.linux-deb-maintainer=\ Maintainer für DEB-Package + +help.option.linux-menu-group=\ Menügruppe, in der diese Anwendung abgelegt wird + +help.option.linux-package-deps=\ Erforderliche Packages oder Funktionen für die Anwendung + +help.option.linux-package-name=\ Name für das Linux-Package, Standardwert: Anwendungsname + +help.option.linux-rpm-license-type=\ Lizenztyp ("Lizenz: " der RPM-SPEC-Datei) + +help.option.linux-shortcut=\ Erstellt eine Verknüpfung für die Anwendung. + +help.option.mac-app-category=\ Zeichenfolge für das Erstellen von LSApplicationCategoryType in\n Anwendungs-plist. Standardwert: "utilities". + +help.option.mac-app-image-sign-identity=\ Zum Signieren des Anwendungsimages verwendete Identität. Dieser Wert wird direkt\n an die Option --sign des Tools "codesign" übergeben. Diese Option kann nicht\n mit --mac-signing-key-user-name kombiniert werden. + +help.option.mac-app-store=\ Gibt an, dass die jpackage-Ausgabe für den\n Mac App Store vorgesehen ist. + +help.option.mac-dmg-content=\ Nimmt den gesamten referenzierten Inhalt in die DMG-Datei auf.\n Diese Option kann mehrmals verwendet werden. + +help.option.mac-entitlements=\ Pfad zu einer Datei mit Berechtigungen, die beim Signieren von ausführbaren\n Dateien und Librarys im Bundle verwendet werden sollen. + +help.option.mac-installer-sign-identity=\ Zum Signieren des Installationsprogramms "pkg" verwendete Identität. Dieser Wert wird direkt\n an die Option --sign des Tools "productbuild"-übergeben. Diese Option\n kann nicht mit --mac-signing-key-user-name kombiniert werden. + +help.option.mac-package-identifier=\ Eine ID, die die Anwendung für macOS eindeutig identifiziert\n Standardwert ist der Hauptklassenname. \n Es dürfen nur alphanumerische Zeichen (A-Z, a-z, 0-9), Bindestriche (-)\n und Punkte (.) verwendet werden. + +help.option.mac-package-name=\ Name der Anwendung, wie in der Menüleiste angezeigt\n Dieser kann vom Anwendungsnamen abweichen.\n Er darf maximal 15 Zeichen enthalten und muss für die Anzeige\n in der Menüleiste und im Infofenster der Anwendung geeignet sein.\n Standardwert: Anwendungsname. + +help.option.mac-package-signing-prefix=\ Beim Signieren des Anwendungspackages wird dieser Wert\n allen zu signierenden Komponenten ohne vorhandene\n Package-ID als Präfix vorangestellt. + +help.option.mac-sign=\ Anforderung zum Signieren des Packages oder des vordefinierten\n Anwendungsimages. + +help.option.mac-signing-keychain=\ Name des Schlüsselbundes für die Suche nach der Signaturidentität\n Bei fehlender Angabe werden die Standardschlüsselbunde verwendet. + +help.option.mac-signing-key-user-name=\ Team- oder Benutzernamensteil der Apple-Signaturidentitäten. Um direkt zu steuern,\n welche Signaturidentität zum Signieren eines Anwendungsimages oder\n Installationsprogramms verwendet wird, verwenden Sie --mac-app-image-sign-identity und/oder\n --mac-installer-sign-identity. Diese Option kann nicht mit\n --mac-app-image-sign-identity oder --mac-installer-sign-identity kombiniert werden. + +help.option.main-class=\ Qualifizierter Name der auszuführenden Anwendungshauptklasse\n Diese Option kann nur bei Angabe von --main-jar verwendet werden. + +help.option.main-jar=\ Die Haupt-JAR-Datei der Anwendung, die die Hauptklasse enthält\n (angegeben als Pfad relativ zum Eingabepfad)\n Es kann entweder die Option --module oder die Option --main-jar angegeben werden, nicht jedoch\n beides. + +help.option.module=\ Das Hauptmodul (und optional die Hauptklasse) der Anwendung\n Dieses Modul muss unter dem Modulpfad gespeichert sein. \n Bei Angabe dieser Option wird das Hauptmodul\n im Java Runtime-Image verknüpft. Es kann entweder die Option --module oder die Option --main-jar\n angegeben werden, nicht jedoch beides. + +help.option.module-path=\ Eine per Doppelpunkt (:) getrennte Pfadliste\n Jeder Pfad ist entweder ein Verzeichnis mit Modulen oder der Pfad zu einer\n modularen JAR-Datei.\n (Jeder Pfad ist absolut oder relativ zum aktuellen Verzeichnis.)\n Diese Option kann mehrmals verwendet werden. +help.option.module-path.win=\ Eine per Semikolon (;) getrennte Pfadliste\n Jeder Pfad ist entweder ein Verzeichnis mit Modulen oder der Pfad zu einer\n modularen JAR-Datei.\n (Jeder Pfad ist absolut oder relativ zum aktuellen Verzeichnis.)\n Diese Option kann mehrmals verwendet werden. + +help.option.name=\ Name der Anwendung und/oder des Packages + +help.option.resource-dir=\ Pfad zum Überschreiben von jpackage-Ressourcen\n Symbole, Vorlagendateien und weitere Ressourcen von jpackage können\n durch Hinzufügen von Ersetzungsressourcen zu diesem Verzeichnis überschrieben werden.\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis) + +help.option.runtime-image=\ Pfad des vordefinierten Laufzeitimages, das in\n das Anwendungsimage kopiert wird\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Wenn --runtime-image nicht angegeben wird, führt jpackage jlink aus, um\n das Laufzeitimage mit folgenden Optionen zu erstellen:\n --strip-debug, --no-header-files, --no-man-pages und\n --strip-native-commands. + +help.option.temp=\ Pfad eines neuen oder leeren Verzeichnisses zum Erstellen temporärer Dateien\n (absoluter Pfad oder relativ zum aktuellen Verzeichnis)\n Falls angegeben, wird das temporäre Verzeichnis beim Abschließen der Aufgabe\n nicht entfernt und muss manuell entfernt werden. \n Bei fehlender Angabe wird ein temporäres Verzeichnis erstellt und\n beim Abschließen der Aufgabe entfernt. + +help.option.type.win=\ Der zu erstellende Packagetyp\n Gültige Werte sind: {"app-image", "exe", "msi"}\n Bei fehlender Angabe dieser Option wird ein plattformabhängiger\n Standardtyp erstellt. +help.option.type.linux=\ Der zu erstellende Packagetyp\n Gültige Werte sind: {"app-image", "deb", "rpm"}\n Bei fehlender Angabe dieser Option wird ein plattformabhängiger\n Standardtyp erstellt. +help.option.type.mac=\ Der zu erstellende Packagetyp\n Gültige Werte sind: {"app-image", "dmg", "pkg"}\n Bei fehlender Angabe dieser Option wird ein plattformabhängiger\n Standardtyp erstellt. + +help.option.vendor=\ Anbieter der Anwendung + +help.option.verbose=\ Aktiviert Ausgabe im Verbose-Modus + +help.option.version=\ Gibt die Produktversion an den Outputstream aus und beendet den Vorgang. + +help.option.win-console=\ Erstellt einen Konsolenlauncher für die Anwendung. Sollte für\n Anwendungen angegeben werden, die Konsoleninteraktionen erfordern + +help.option.win-dir-chooser=\ Fügt ein Dialogfeld hinzu, in dem der Benutzer das Verzeichnis auswählen kann, in dem\n das Produkt installiert wird. + +help.option.win-help-url=\ URL, unter der der Benutzer weitere Informationen oder technische Unterstützung erhält + +help.option.win-menu=\ Anforderung zum Hinzufügen einer Startmenüverknüpfung für diese Anwendung + +help.option.win-menu-group=\ Startmenügruppe, in der diese Anwendung abgelegt wird + +help.option.win-per-user-install=\ Anforderung zum Ausführen einer Installation pro Benutzer + +help.option.win-shortcut=\ Anforderung zum Hinzufügen einer Desktopverknüpfung für diese Anwendung + +help.option.win-shortcut-prompt=\ Fügt ein Dialogfeld hinzu, in dem der Benutzer auswählen kann, ob Verknüpfungen\n vom Installationsprogramm erstellt werden. + +help.option.win-update-url=\ URL der verfügbaren Anwendungsaktualisierungsinformationen + +help.option.win-upgrade-uuid=\ UUID für Upgrades für dieses Package -MSG_Help_win_launcher=\nPlattformabhängige Option für das Erstellen des Anwendungs-Launchers:\n --win-console\n Erstellt einen Konsolen-Launcher für die Anwendung. Sollte für\n Anwendungen angegeben werden, die Konsoleninteraktionen erfordern\n -MSG_Help_win_install=\ --win-dir-chooser\n Fügt ein Dialogfeld hinzu, in dem der Benutzer das Verzeichnis auswählen kann, in dem\n das Produkt installiert wird.\n --win-help-url \n URL, unter der der Benutzer weitere Informationen oder technische Unterstützung erhält\n --win-menu\n Anforderung zum Hinzufügen einer Startmenüverknüpfung für diese Anwendung\n --win-menu-group \n Startmenügruppe, in der diese Anwendung abgelegt wird\n --win-per-user-install\n Anforderung zum Ausführen einer Installation pro Benutzer\n --win-shortcut\n Anforderung zum Hinzufügen einer Desktopverknüpfung für diese Anwendung\n --win-shortcut-prompt\n Fügt ein Dialogfeld hinzu, in dem der Benutzer auswählen kann, ob Verknüpfungen\n vom Installationsprogramm erstellt werden sollen.\n --win-update-url \n URL verfügbarer Anwendungsupdateinformationen\n --win-upgrade-uuid \n UUID, die mit Upgrades für dieses Package verknüpft ist\n -MSG_Help_win_install_dir=Relativer Unterpfad unter dem Standardinstallationsverzeichnis\n -MSG_Help_mac_install=\ --mac-dmg-content [,...]\n Nimmt den gesamten referenzierten Inhalt in die DMG-Datei auf.\n Diese Option kann mehrmals verwendet werden. \n -MSG_Help_mac_launcher=\ --mac-package-identifier \n Eine ID, die die Anwendung für macOS eindeutig identifiziert\n Standardwert ist der Hauptklassenname.\n Es dürfen nur alphanumerische Zeichen (A-Z, a-z, 0-9), Bindestriche (-)\n und Punkte (.) verwendet werden.\n --mac-package-name \n Name der Anwendung, wie in der Menüleiste angezeigt\n Dieser kann vom Anwendungsnamen abweichen.\n Er darf maximal 15 Zeichen enthalten und muss für die Anzeige\n in der Menüleiste und im Infofenster der Anwendung geeignet sein.\n Standardwert: Anwendungsname.\n --mac-package-signing-prefix \n Beim Signieren des Anwendungspackages wird dieser Wert\n allen zu signierenden Komponenten ohne vorhandene\n Package-ID als Präfix vorangestellt.\n --mac-sign\n Anforderung zum Signieren des Packages oder des vordefinierten\nAnwendungsimages\n --mac-signing-keychain \n Name des Schlüsselbundes für die Suche nach der Signaturidentität\n Bei fehlender Angabe werden die Standardschlüsselbunde verwendet.\n --mac-signing-key-user-name \n Team- oder Benutzernamensteil der Apple-Signaturidentitäten. Um direkt zu steuern,\n welche Signaturidentität zum Signieren eines Anwendungsimages oder\n Installationsprogramms verwendet wird, verwenden Sie --mac-app-image-sign-identity und/oder\n --mac-installer-sign-identity. Diese Option kann nicht mit\n --mac-app-image-sign-identity oder --mac-installer-sign-identity kombiniert werden.\n --mac-app-image-sign-identity \n Zum Signieren des Anwendungsimages verwendete Identität. Dieser Wert wird\n direkt an die Option --sign des Tools "codesign" übergeben. Diese Option kann nicht\n mit --mac-signing-key-user-name kombiniert werden.\n --mac-installer-sign-identity \n Zum Signieren des Installationsprogramms "pkg" verwendete Identität. Dieser Wert wird\n direkt an die Option --sign des Tools "productbuild" übergeben. Diese Option\n kann nicht mit --mac-signing-key-user-name kombiniert werden.\n --mac-app-store\n Gibt an, dass die jpackage-Ausgabe für den\n Mac App Store bestimmt ist.\n --mac-entitlements \n Pfad zu einer Datei mit Berechtigungen, die beim Signieren\n von ausführbaren Dateien und Librarys im Bundle verwendet werden sollen.\n --mac-app-category \n Zeichenfolge für das Erstellen von LSApplicationCategoryType in\n Anwendungs-plist. Standardwert: "utilities".\n -MSG_Help_linux_install=\ --linux-package-name \n Name für das Linux-Package, Standardwert: Anwendungsname\n --linux-deb-maintainer \n Maintainer für .deb-Package\n --linux-menu-group \n Menügruppe, in der diese Anwendung abgelegt wird\n --linux-package-deps \n Erforderliche Packages oder Funktionen für die Anwendung\n --linux-rpm-license-type \n Typ der Lizenz ("License: " der RPM-SPEC-Datei)\n --linux-app-release \n Releasewert der RPM-Datei .spec oder \n Debian-Revisionswert der DEB-Kontrolldatei\n --linux-app-category \n Gruppenwert der RPM-Datei .spec oder \n Abschnittswert der DEB-Kontrolldatei\n --linux-shortcut\n Erstellt einen Shortcut für die Anwendung.\n -MSG_Help_mac_linux_install_dir=Absoluter Pfad des Installationsverzeichnisses der Anwendung\n -MSG_Help_default_install_dir=Absoluter Pfad des Installationsverzeichnisses der Anwendung auf OS X\n oder Linux. Relativer Unterpfad des Installationsverzeichnisses der\n Anwendung wie "Programme" oder "AppData" unter Windows.\n -MSG_Help_no_args=Verwendung: jpackage \nVerwenden Sie jpackage --help (oder -h), um eine Liste möglicher Optionen aufzurufen -MSG_Help_default_app_image=Speicherort des vordefinierten Anwendungsimages, mit dem\n ein installierbares Package erstellt wird\n -MSG_Help_mac_app_image=Speicherort des vordefinierten Anwendungsimages, mit dem\n ein installierbares Package erstellt oder das vordefinierte\n Anwendungsimage signiert wird\n -MSG_Help_mac_sign_sample_usage=\ Vordefiniertes Anwendungsimage signieren:\n jpackage --type app-image --app-image \\\n --mac-sign [...]\n Hinweis: In diesem Modus sind nur die folgenden zusätzlichen Optionen zulässig:\n Das Set der zusätzlichen Mac-Signaturoptionen und --verbose\n diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties index cae6ae216d3..ca606dda9f8 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_ja.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -24,22 +24,163 @@ # # -MSG_Help=使用方法: jpackage \n\n使用例:\n--------------\n ホスト・システムに適したアプリケーション・パッケージを生成します。\n モジュラ・アプリケーションの場合:\n jpackage -n name -p modulePath -m moduleName/className\n 非モジュラ・アプリケーションの場合:\n jpackage -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n 事前作成されたアプリケーション・イメージから:\n jpackage -n name --app-image appImageDir\n アプリケーション・イメージの生成:\n モジュラ・アプリケーションの場合:\n jpackage --type app-image -n name -p modulePath \\\n -m moduleName/className\n 非モジュラ・アプリケーションの場合:\n jpackage --type app-image -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n jlinkに独自のオプションを指定するには、jlinkを別個に実行します。\n jlink --output appRuntimeImage -p modulePath \\\n --add-modules moduleName \\\n --no-header-files [...]\n jpackage --type app-image -n name \\\n -m moduleName/className --runtime-image appRuntimeImage\n Javaランタイム・パッケージを生成します。\n jpackage -n name --runtime-image \n{6}\n一般的なオプション:\n @ \n ファイルからの読取りオプションおよびモード \n このオプションは複数回使用できます。\n --type -t \n 作成するパッケージのタイプ\n 有効な値: {1} \n このオプションが指定されていない場合、プラットフォーム依存の\n デフォルト・タイプが作成されます\n --app-version \n アプリケーションおよびパッケージのバージョン\n --copyright \n アプリケーションのコピーライト\n --description \n アプリケーションの説明\n --help -h \n 使用方法テキストと現在のプラットフォームの有効なオプションのリストと説明を\n 出力ストリームに出力して、終了します\n --icon \n アプリケーション・パッケージのアイコンのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n \ ---name -n \n アプリケーションおよびパッケージの名前\n --dest -d \n 生成された出力ファイルが配置されるパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n デフォルトは現在の作業ディレクトリです。\n --temp \n 一時ファイルの作成に使用される新規または空のディレクトリのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n 指定した場合、タスク完了時に一時ディレクトリは削除されないため\n 手動で削除する必要があります\n 指定しなかった場合、一時ディレクトリが作成され\n タスク完了時に削除されます。\n --vendor \n アプリケーションのベンダー\n --verbose\n 詳細な出力を有効にします\n --version\n 製品バージョンを出力ストリームに出力して終了します\n\nランタイム・イメージを作成するためのオプション:\n --add-modules [,...]\n 追加するモジュールのカンマ(",")区切りリスト\n このモジュール・リストとメイン・モジュール(指定した場合)\n が--add-module引数としてjlinkに渡されます。\n 指定しなかった場合、メイン・モジュールのみ(--moduleが\n 指定された場合)、またはデフォルトのモジュール・セット(--main-jarが \n 指定された場合)が使用されます。\n このオプションは複数回使用できます。\n --module-path -p ...\n パスの{0}区切りリスト\n 各パスは、モジュールのディレクトリまたは\n モジュラjarへのパスです。\n (各パスは、絶対パスまたは現在のディレクトリからの相対パスです。)\n このオプションは複数回使用できます。\n --jlink-options \n jlinkに渡すオプションのスペース区切りのリスト \n 指定しない場合、"--strip-native-commands \n --strip-debug \ ---no-man-pages --no-header-files"。 \n このオプションは複数回使用できます。\n --runtime-image \n アプリケーション・イメージにコピーされる、事前定義済みのランタイム・イメージ\n のパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n --runtime-imageが指定されていない場合、jpackageはjlinkを実行し、\n 次のオプションを使用してランタイム・イメージを作成します:\n --strip-debug、--no-header-files、--no-man-pagesおよび\n --strip-native-commands。\n\nアプリケーション・イメージを作成するためのオプション:\n --input -i \n パッケージ化するファイルを含む入力ディレクトリへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n 入力ディレクトリのすべてのファイルは、アプリケーション・イメージに\n パッケージ化されます。\n --app-content [,...]\n ファイルまたはディレクトリ(あるいは両方)のパスのカンマ区切りのリスト\n アプリケーション・ペイロードに追加します。\n このオプションは複数回使用できます。\n\nアプリケーション・ランチャを作成するためのオプション:\n --add-launcher =\n ランチャの名前、およびキー、値のペアのリスト\n を含むプロパティ・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n キー"module"、"main-jar"、"main-class"、"description"、\n "arguments"、"java-options"、"app-version"、"icon"、\n "launcher-as-service"、\n "win-console"、"win-shortcut"、"win-menu"、\n "linux-app-category"および"linux-shortcut"を使用できます。\n これらのオプションを元のコマンドライン・オプションに追加するか、これらのオプションを\n 使用して元のコマンドライン・オプションを上書きして、追加の代替ランチャを作成します。\n \ -メイン・アプリケーション・ランチャはコマンドライン・オプションから作成されます。\n このオプションを使用して追加の代替ランチャを作成でき、\n このオプションを複数回使用して\n 複数の追加のランチャを作成できます。 \n --arguments
    \n ランチャにコマンド・ライン引数が指定されていない場合にメイン・クラスに渡す\n コマンド・ライン引数\n このオプションは複数回使用できます。\n --java-options \n Javaランタイムに渡すオプション\n このオプションは複数回使用できます。\n --main-class \n 実行するアプリケーション・メイン・クラスの修飾名\n このオプションを使用できるのは、--main-jarが指定されている場合だけです。\n --main-jar
    \n メイン・クラスを含む、アプリケーションのメインJAR\n (入力パスからの相対パスとして指定)\n --moduleまたは--main-jarオプションを指定できますが、両方は\n 指定できません。\n --module -m [/
    ]\n アプリケーションのメイン・モジュール(およびオプションでメイン・クラス)\n このモジュールは、モジュール・パスに置かれている必要があります。\n このオプションが指定されている場合、メイン・モジュールは\n Javaランタイム・イメージ内でリンクされます。--moduleまたは--main-jar\n オプションを指定できますが、両方は指定できません。\n{2}\nアプリケーション・パッケージを作成するためのオプション:\n --about-url \n アプリケーションのホームページのURL\n --app-image \n {5} (絶対パスまたは現在のディレクトリからの相対パス)\n --file-associations \n キー、値のペアのリストを含むプロパティ・ファイルへのパス\n \ -(絶対パスまたは現在のディレクトリからの相対パス)\n キー"extension"、"mime-type"、"icon"、"description"\n を使用して関連付けを記述できます。\n このオプションは複数回使用できます。\n --install-dir \n {4} --license-file \n ライセンス・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n --resource-dir \n オーバーライドjpackageリソースへのパス\n アイコン、テンプレート・ファイルおよびjpackageのその他のリソースは、\n このディレクトリに置換リソースを追加することでオーバーライドできます。\n (絶対パスまたは現在のディレクトリからの相対パス)\n --runtime-image \n インストールする事前定義済みのランタイム・イメージのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n ランタイム・パッケージの作成時には、オプションが必要です。\n --launcher-as-service\n 次として登録するインストーラの作成をリクエストします: \n バックグラウンド・サービス・タイプ・アプリケーションとしてのメイン・アプリケーション・ランチャ。\n\nアプリケーション・パッケージを作成するためのプラットフォーム依存オプション:\n{3} +help.header=使用方法: jpackage + +help.short=利用可能なオプションのリストについては、jpackage --help (or -h)を使用します + +help.option-group.sample.create-native-package=\ ホスト・システムに適したアプリケーション・パッケージを生成します:\n モジュラ・アプリケーションの場合:\n jpackage -n name -p modulePath -m moduleName/className\n 非モジュラ・アプリケーションの場合:\n jpackage -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n 事前作成されたアプリケーション・イメージから:\n jpackage -n name --app-image appImageDir + +help.option-group.sample.create-app-image=\ アプリケーション・イメージの生成:\n モジュラ・アプリケーションの場合:\n jpackage --type app-image -n name -p modulePath \\\n -m moduleName/className\n 非モジュラ・アプリケーションの場合:\n jpackage --type app-image -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n jlinkに独自のオプションを指定するには、jlinkを別個に実行します:\n jlink --output appRuntimeImage -p modulePath \\\n --add-modules moduleName \\\n --no-header-files [...]\n jpackage --type app-image -n name \\\n -m moduleName/className --runtime-image appRuntimeImage + +help.option-group.sample.create-runtime-installer=\ Javaランタイム・パッケージを生成します:\n jpackage -n name --runtime-image + +help.option-group.sample.sign-app-image=\ 事前定義済みアプリケーション・イメージへの署名:\n jpackage --type app-image --app-image \\\n --mac-sign [...]\n ノート: このモードで許可される唯一の追加オプション:\n 追加のmac署名オプションのセットおよび--verbose + +help.option-group.sample=使用例 +help.option-group.generic=一般的なオプション +help.option-group.runtime-image=ランタイム・イメージを作成するためのオプション +help.option-group.app-image=アプリケーション・イメージを作成するためのオプション +help.option-group.launcher=アプリケーション・ランチャを作成するためのオプション +help.option-group.launcher-platform=アプリケーション・ランチャを作成するためのプラットフォーム依存オプション +help.option-group.package=アプリケーション・パッケージを作成するためのオプション +help.option-group.package-platform=アプリケーション・パッケージを作成するためのプラットフォーム依存オプション + +help.option.argument-file=\ ファイルからの読取りオプションまたはモード(あるいはその両方)\n このオプションは複数回使用できます。 + +help.option.about-url=\ アプリケーションのホームページのURL + +help.option.add-launcher.win=\ ランチャの名前、およびキー、値のペアのリスト\n を含むプロパティ・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n キー"arguments"、"description"、"icon"、"java-options"、\n "launcher-as-service"、"main-class"、"main-jar"、"module"、\n "win-console"、"win-menu"、"win-shortcut"が使用できます。\n これらのオプションを元のコマンドライン・オプションに追加するか、これらのオプションを\n 使用して元のコマンドライン・オプションを上書きして、追加の代替ランチャを作成します。\n メイン・アプリケーション・ランチャはコマンドライン・オプションから作成されます。\n このオプションを使用して追加の代替ランチャを作成でき、\n このオプションを複数回使用して\n 複数の追加のランチャを作成できます。 + +help.option.add-launcher.linux=\ ランチャの名前、およびキー、値のペアのリスト\n を含むプロパティ・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n キー"arguments"、"description"、"icon"、"java-options"、\n "launcher-as-service"、"linux-shortcut"、"main-class"、"main-jar"、\n "module"が使用できます。\n これらのオプションを元のコマンドライン・オプションに追加するか、これらのオプションを\n 使用して元のコマンドライン・オプションを上書きして、追加の代替ランチャを作成します。\n メイン・アプリケーション・ランチャはコマンドライン・オプションから作成されます。\n このオプションを使用して追加の代替ランチャを作成でき、\n このオプションを複数回使用して\n 複数の追加のランチャを作成できます。 + +help.option.add-launcher.mac=\ ランチャの名前、およびキー、値のペアのリスト\n を含むプロパティ・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n キー"arguments"、"description"、"icon"、"java-options"、\n "launcher-as-service"、"main-class"、"main-jar"、"module"\n が使用できます。\n これらのオプションを元のコマンドライン・オプションに追加するか、これらのオプションを\n 使用して元のコマンドライン・オプションを上書きして、追加の代替ランチャを作成します。\n メイン・アプリケーション・ランチャはコマンドライン・オプションから作成されます。\n このオプションを使用して追加の代替ランチャを作成でき、\n このオプションを複数回使用して\n 複数の追加のランチャを作成できます。 + +help.option.add-modules=\ 追加するモジュールのカンマ(",")区切りリスト\n このモジュール・リストとメイン・モジュール(指定した場合)\n が--add-module引数としてjlinkに渡されます。\n 指定しなかった場合、メイン・モジュールのみ(--moduleが\n 指定された場合)、またはデフォルトのモジュール・セット(--main-jarが\n 指定された場合)が使用されます。\n このオプションは複数回使用できます。 + +help.option.app-content=\ アプリケーション・ペイロードに追加するファイルまたはディレクトリ(あるいはその両方)\n のパスのカンマ区切りのリスト。\n このオプションは複数回使用できます。 + +help.option.app-content.mac=\ アプリケーション・ペイロードに追加するファイルまたはディレクトリ(あるいはその両方)\n のパスのカンマ区切りのリスト。\n このオプションは複数回使用できます。\n ノート: 値は"Resources"サブディレクトリ\n (またはアプリケーション・バンドルの"Contents"ディレクトリで有効なその他のディレクトリ)\n を含むディレクトリである必要があります。それ以外の場合は、jpackageによって無効なアプリケーション・バンドルが生成される場合があり、\n コード署名または公証(あるいはその両方)に失敗する\n 場合があります。 + +help.option.app-image=\ インストール可能なパッケージの作成に使用する、事前定義済\n アプリケーション・イメージの場所\n (絶対パスまたは現在のディレクトリからの相対パス) + +help.option.app-image.mac=\ インストール可能なパッケージの作成または事前定義済\n アプリケーション・イメージの署名に使用する、事前定義済\n アプリケーション・イメージの場所\n (絶対パスまたは現在のディレクトリからの相対パス) + +help.option.app-version=\ アプリケーションおよびパッケージのバージョン + +help.option.arguments=\ コマンドライン引数がランチャに指定されていない場合に、\n メイン・クラスに渡されるコマンドライン引数\n このオプションは複数回使用できます。 + +help.option.copyright=\ アプリケーションのコピーライト + +help.option.description=\ アプリケーションの説明 + +help.option.dest=\ 生成された出力ファイルが配置されるパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n 現在の作業ディレクトリにデフォルト設定されています。 + +help.option.file-associations=\ キー、値のペアのリストを含むプロパティ・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n キー"extension"、"mime-type"、"icon"、"description"\n を使用して関連付けを記述できます。\n このオプションは複数回使用できます。 + +help.option.help=\ 使用方法テキストと現在のプラットフォームの有効なオプションのリストと説明を\n 出力ストリームに出力して、終了します + +help.option.icon=\ アプリケーション・パッケージのアイコンのパス\n (絶対パスまたは現在のディレクトリからの相対パス) + +help.option.input=\ パッケージ化するファイルを含む入力ディレクトリのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n 入力ディレクトリのすべてのファイルは、アプリケーション・イメージに\n パッケージ化されます。 + +help.option.install-dir=\ アプリケーションのインストール・ディレクトリの絶対パス + +help.option.install-dir.win=\ "プログラム・ファイル"または"AppData"など、\n アプリケーションのインストール場所の相対サブパス。 + +help.option.installer-runtime-image=\ インストールする事前定義済のランタイム・イメージのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n ランタイム・パッケージの作成時には、オプションが必要です。 + +help.option.java-options=\ Javaランタイムに渡すオプション\n このオプションは複数回使用できます。 + +help.option.jlink-options=\ jlinkに渡すオプションのスペース区切りのリスト\n 指定しない場合、"--strip-native-commands\n --strip-debug --no-man-pages --no-header-files"にデフォルト設定されます。\n このオプションは複数回使用できます。 + +help.option.launcher-as-service=\ バックグラウンド・サービス・タイプ・アプリケーションとしてメイン・\n アプリケーション・ランチャを登録するインストーラの作成をリクエストします。 + +help.option.license-file=\ ライセンス・ファイルへのパス\n (絶対パスまたは現在のディレクトリからの相対パス) + +help.option.linux-app-category=\ RPM .specファイルのグループ値または\n DEB制御ファイルのセクション値 + +help.option.linux-app-release=\ RPM .specファイルのリリース値または\n DEB制御ファイルのDebianリビジョン値 + +help.option.linux-deb-maintainer=\ .debパッケージのメンテナ + +help.option.linux-menu-group=\ このアプリケーションを配置するメニュー・グループ + +help.option.linux-package-deps=\ アプリケーションに必要なパッケージまたは機能 + +help.option.linux-package-name=\ Linuxパッケージの名前。アプリケーション名にデフォルト設定されています + +help.option.linux-rpm-license-type=\ ライセンスのタイプ(RPM .specの"License: ") + +help.option.linux-shortcut=\ アプリケーションのショートカットを作成します。 + +help.option.mac-app-category=\ アプリケーションplistのLSApplicationCategoryTypeの構築に\n 使用する文字列。デフォルト値は"utilities"です。 + +help.option.mac-app-image-sign-identity=\ アプリケーション・イメージの署名に使用するアイデンティティ。この値は直接\n "codesign"ツールの--signオプションに渡されます。このオプションは\n --mac-signing-key-user-nameと組み合せることはできません。 + +help.option.mac-app-store=\ jpackage出力がMac App Store用であること\n を示します。 + +help.option.mac-dmg-content=\ dmgに参照されたコンテンツをすべて含めます。\n このオプションは複数回使用できます。 + +help.option.mac-entitlements=\ バンドルの実行可能ファイルおよびライブラリの署名時に\n 使用する権限を含むファイルのパス。 + +help.option.mac-installer-sign-identity=\ "pkg"インストーラの署名に使用するアイデンティティ。この値は直接\n "productbuild"ツールの--signオプションに渡されます。このオプションは\n --mac-signing-key-user-nameと組み合せることはできません。 + +help.option.mac-package-identifier=\ MacOSのアプリケーションを一意に識別する識別子。\n メイン・クラス名にデフォルト設定されています。\n 英数字(A-Z、a-z、0-9)、ハイフン(-)、\n およびピリオド(.)のみを使用できます。 + +help.option.mac-package-name=\ メニュー・バーに表示されるアプリケーションの名前\n アプリケーション名とは異なります。\n この名前は16文字未満にする必要があり、メニュー・バー\n およびアプリケーション情報ウィンドウに表示するのに適している必要があります。\n アプリケーション名にデフォルト設定されています。 + +help.option.mac-package-signing-prefix=\ アプリケーション・パッケージに署名する際、既存のパッケージIDのない\n 署名が必要なすべてのコンポーネントに、\n この値が接頭辞として付けられます。 + +help.option.mac-sign=\ パッケージまたは事前定義済アプリケーション・イメージに署名するよう\n リクエストします。 + +help.option.mac-signing-keychain=\ 署名アイデンティティを検索するキーチェーンの名前\n 指定しなかった場合、標準のキーチェーンが使用されます。 + +help.option.mac-signing-key-user-name=\ Apple署名アイデンティティのチームまたはユーザー名部分。\n アプリケーション・イメージまたはインストーラの署名に使用する署名アイデンティティの\n 直接制御には、--mac-app-image-sign-identityまたは\n --mac-installer-sign-identity(あるいはその両方)を使用します。このオプションは\n --mac-app-image-sign-identityまたは--mac-installer-sign-identityと組み合せることはできません。 + +help.option.main-class=\ 実行するアプリケーション・メイン・クラスの修飾名\n このオプションを使用できるのは、--main-jarが指定されている場合だけです。 + +help.option.main-jar=\ メイン・クラスを含む、アプリケーションのメインJAR\n (入力パスからの相対パスとして指定)\n --moduleまたは--main-jarオプションを指定できますが、両方は\n 指定できません。 + +help.option.module=\ アプリケーションのメイン・モジュール(およびオプションでメイン・クラス)\n このモジュールは、モジュール・パスに置かれている必要があります。\n このオプションが指定されている場合、メイン・モジュールは\n Javaランタイム・イメージ内でリンクされます。--moduleまたは--main-jar\n オプションを指定できますが、両方は指定できません。 + +help.option.module-path=\ :で区切られたパスのリスト\n 各パスは、モジュールのディレクトリまたは\n モジュラjarへのパスです。\n (各パスは、絶対パスまたは現在のディレクトリからの相対パスです。)\n このオプションは複数回使用できます。 +help.option.module-path.win=\ ;で区切られたパスのリスト\n 各パスは、モジュールのディレクトリまたは\n モジュラjarへのパスです。\n (各パスは、絶対パスまたは現在のディレクトリからの相対パスです。)\n このオプションは複数回使用できます。 + +help.option.name=\ アプリケーションおよびパッケージの名前 + +help.option.resource-dir=\ オーバーライドjpackageリソースへのパス\n アイコン、テンプレート・ファイルおよびjpackageのその他のリソースは、\n このディレクトリに置換リソースを追加することでオーバーライドできます。\n (絶対パスまたは現在のディレクトリからの相対パス) + +help.option.runtime-image=\ アプリケーション・イメージにコピーされる、事前定義済のランタイム・イメージ\n のパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n --runtime-imageが指定されていない場合、jpackageはjlinkを実行し、\n 次のオプションを使用してランタイム・イメージを作成します:\n --strip-debug、--no-header-files、--no-man-pagesおよび\n --strip-native-commands。 + +help.option.temp=\ 一時ファイルの作成に使用される新規または空のディレクトリのパス\n (絶対パスまたは現在のディレクトリからの相対パス)\n 指定した場合、タスク完了時に一時ディレクトリは削除されないため\n 手動で削除する必要があります。\n 指定しなかった場合、一時ディレクトリが作成され\n タスク完了時に削除されます。 + +help.option.type.win=\ 作成するパッケージのタイプ\n 有効な値: {"app-image", "exe", "msi"}\n このオプションを指定しない場合、プラットフォーム依存の\n デフォルト・タイプが作成されます。 +help.option.type.linux=\ 作成するパッケージのタイプ\n 有効な値: {"app-image", "deb", "rpm"}\n このオプションを指定しない場合、プラットフォーム依存の\n デフォルト・タイプが作成されます。 +help.option.type.mac=\ 作成するパッケージのタイプ\n 有効な値: {"app-image", "dmg", "pkg"}\n このオプションを指定しない場合、プラットフォーム依存の\n デフォルト・タイプが作成されます。 + +help.option.vendor=\ アプリケーションのベンダー + +help.option.verbose=\ 詳細な出力を有効にします + +help.option.version=\ 製品バージョンを出力ストリームに出力して終了します + +help.option.win-console=\ アプリケーションのコンソール・ランチャを作成します。コンソール・\n インタラクションが必要なアプリケーションに指定する必要があります + +help.option.win-dir-chooser=\ 製品をインストールするディレクトリをユーザーが\n 選択できるダイアログを追加します。 + +help.option.win-help-url=\ ユーザーが詳細情報または技術サポートを取得できるURL + +help.option.win-menu=\ このアプリケーションのスタート・メニューのショートカットを追加するリクエスト + +help.option.win-menu-group=\ このアプリケーションを配置するスタート・メニュー・グループ + +help.option.win-per-user-install=\ ユーザーごとにインストールを実行するリクエスト + +help.option.win-shortcut=\ このアプリケーションのデスクトップのショートカットを追加するリクエスト + +help.option.win-shortcut-prompt=\ ショートカットをインストーラで作成するかどうかをユーザーが\n 選択できるダイアログを追加します。 + +help.option.win-update-url=\ 使用可能なアプリケーション更新情報のURL + +help.option.win-upgrade-uuid=\ このパッケージのアップグレードに関連付けられているUUID -MSG_Help_win_launcher=\nアプリケーション・ランチャを作成するためのプラットフォーム依存オプション:\n --win-console\n アプリケーションのコンソール・ランチャを作成します。コンソール・\n インタラクションが必要なアプリケーションに指定する必要があります\n -MSG_Help_win_install=\ --win-dir-chooser\n ユーザーが製品をインストールするディレクトリを選択するための\n ダイアログを追加します。\n --win-help-url \n ユーザーが詳細情報または技術的なサポートを取得できるURL\n --win-menu\n このアプリケーションのスタート・メニュー・ショートカットを追加するようにリクエストします\n --win-menu-group \n このアプリケーションを配置するスタート・メニュー・グループ\n --win-per-user-install\n ユーザーごとにインストールを実行するようにリクエストします\n --win-shortcut\n このアプリケーションのデスクトップ・ショートカットを追加するようにリクエストします\n --win-shortcut-prompt\n ショートカットをインストーラで作成するかどうかをユーザーが選択できるようにする\n ダイアログを追加します。\n --win-update-url \n 使用可能なアプリケーションの更新情報のURL\n --win-upgrade-uuid \n このパッケージのアップグレードに関連付けられたUUID\n -MSG_Help_win_install_dir=デフォルトのインストール場所の下の相対サブパス\n -MSG_Help_mac_install=\ --mac-dmg-content [,...]\n dmgに参照されたコンテンツをすべて含めます。\n このオプションは複数回使用できます。 \n -MSG_Help_mac_launcher=\ --mac-package-identifier \n macOSのアプリケーションを一意に識別するID\n メイン・クラス名にデフォルト設定されています。\n 英数字(A-Z、a-z、0-9)、ハイフン(-)およびピリオド(.)文字のみ\n 使用できます。\n --mac-package-name \n メニュー・バーに表示されるアプリケーションの名前\n アプリケーション名とは異なります。\n この名前は16文字未満にする必要があり、メニュー・バーおよびアプリケーション情報ウィンドウに\n 表示するのに適している必要があります。\n アプリケーション名にデフォルト設定されています。\n --mac-package-signing-prefix \n アプリケーション・パッケージに署名する際、\n 既存のパッケージIDのない署名が必要なすべてのコンポーネントに、\n この値が接頭辞として付けられます。\n --mac-sign\n パッケージまたは事前定義済アプリケーション・イメージに署名するよう\n リクエストします。\n --mac-signing-keychain \n 署名アイデンティティを検索するキーチェーンの名前\n 指定しなかった場合、標準のキーチェーンが使用されます。\n --mac-signing-key-user-name \n Apple署名アイデンティティのチームまたはユーザー名部分。\n アプリケーション・イメージまたはインストーラの署名に使用する署名アイデンティティの\n 直接制御には、--mac-app-image-sign-identityまたは\n --mac-installer-sign-identity(あるいは両方)を使用します。このオプションは\n --mac-app-image-sign-identityまたは--mac-installer-sign-identityと組み合せることはできません。\n --mac-app-image-sign-identity \n アプリケーション・イメージの署名に使用するアイデンティティ。この値は直接\n "codesign"ツールの--signオプションに渡されます。このオプションは\n \ ---mac-signing-key-user-nameと組み合せることはできません。\n --mac-installer-sign-identity \n "pkg"インストーラの署名に使用するアイデンティティ。この値は直接\n "productbuild"ツールの--signオプションに渡されます。このオプションは\n --mac-signing-key-user-nameと組み合せることはできません。\n --mac-app-store\n jpackage出力がMac App Store用であること\n を示します。\n --mac-entitlements \n バンドルの実行可能ファイルおよびライブラリの署名時に\n 使用する権限を含むファイルのパス。\n --mac-app-category \n アプリケーションのplistのLSApplicationCategoryTypeを生成する際に使用する文字列。\n デフォルト値は"utilities"です。\n -MSG_Help_linux_install=\ --linux-package-name \n Linuxパッケージの名前。アプリケーション名にデフォルト設定されています\n --linux-deb-maintainer \n .debパッケージのMaintainer\n --linux-menu-group \n このアプリケーションが配置されているメニュー・グループ\n --linux-package-deps \n アプリケーションに必要なパッケージまたは機能\n --linux-rpm-license-type \n ライセンスのタイプ(RPM .specの"License: ")\n --linux-app-release \n RPM .specファイルのリリース値または\n DEBコントロール・ファイルのDebianリビジョン値。\n --linux-app-category \n RPM .specファイルのグループ値または \n DEBコントロール・ファイルのセクション値\n --linux-shortcut\n アプリケーションのショートカットを作成します。\n -MSG_Help_mac_linux_install_dir=アプリケーションのインストール・ディレクトリの絶対パス\n -MSG_Help_default_install_dir=OS XまたはLinux上のアプリケーションのインストール・ディレクトリの絶対パス。\n "プログラム・ファイル"や"AppData"など、Windows上のアプリケーションの\n インストール場所の相対サブパス。\n -MSG_Help_no_args=使用方法: jpackage \n利用可能なオプションのリストについては、jpackage --help (or -h)を使用します -MSG_Help_default_app_image=インストール可能なパッケージの作成に使用する、事前定義済み\n アプリケーション・イメージの場所\n -MSG_Help_mac_app_image=インストール可能なパッケージの作成または事前定義済みアプリケーション・\n イメージへの署名に使用する、事前定義済みアプリケーション・\n イメージの場所\n -MSG_Help_mac_sign_sample_usage=\ 事前定義済みアプリケーション・イメージへの署名:\n jpackage --type app-image --app-image \\\n --mac-sign [...]\n ノート: このモードで許可される唯一の追加オプション:\n 追加のmac署名オプションのセットおよび--verbose\n diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties index 6adf62ef1f8..ac72c67ee2f 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/HelpResources_zh_CN.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2017, 2025, 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 @@ -24,20 +24,163 @@ # # -MSG_Help=用法:jpackage \n\n示例用法:\n--------------\n 生成适合主机系统的应用程序包:\n 对于模块化应用程序:\n jpackage -n name -p modulePath -m moduleName/className\n 对于非模块化应用程序:\n jpackage -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n 从预构建的应用程序映像:\n jpackage -n name --app-image appImageDir\n 生成应用程序映像:\n 对于模块化应用程序:\n jpackage --type app-image -n name -p modulePath \\\n -m moduleName/className\n 对于非模块化应用程序:\n jpackage --type app-image -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n 要为 jlink 提供您自己的选项,请单独运行 jlink:\n jlink --output appRuntimeImage -p modulePath \\\n --add-modules moduleName \\\n --no-header-files [...]\n jpackage --type app-image -n name \\\n -m moduleName/className --runtime-image appRuntimeImage\n 生成 Java 运行时程序包:\n jpackage -n name --runtime-image \n{6}\n一般选项:\n @ \n 从文件读取选项和/或模式 \n 可以多次使用此选项。\n --type -t \n 要创建的程序包的类型\n 有效值为:{1} \n 如果未指定此选项,则将创建与平台相关的\n 默认类型。\n --app-version \n 应用程序和/或程序包的版本\n --copyright \n 应用程序的版权\n --description \n 应用程序的说明\n --help -h \n 将用法文本输出到输出流并退出,用法文本中包含\n 适用于当前平台的每个有效选项的列表和说明\n --icon \n 应用程序包图标的路径\n (绝对路径或相对于当前目录的路径)\n --name -n \n 应用程序和/或程序包的名称\n --dest -d \n 用来放置所生成的输出文件的路径\n (绝对路径或相对于当前目录的路径)\n 默认为当前的工作目录。\n --temp \n 用来创建临时文件的新目录或空白目录的路径\n (绝对路径或相对于当前目录的路径)\n 如果指定,则在任务完成时将不删除临时目录,\n 必须手动删除临时目录。\n 如果未指定,则将创建一个临时目录,\n \ -并在任务完成时删除该临时目录。\n --vendor \n 应用程序的供应商\n --verbose\n 启用详细的输出\n --version\n 将产品版本输出到输出流并退出。\n\n用来创建运行时映像的选项:\n --add-modules <模块名称>[,<模块名称>...]\n 要添加的模块的逗号 (",") 分隔列表\n 此模块列表连同主模块(如果指定)\n 将作为 --add-module 参数传递到 jlink。\n 如果未指定,则仅使用主模块(如果指定了 --module),\n 或者使用默认的模块集(如果指定了 \n --main-jar)。\n 可以多次使用此选项。\n --module-path -p ...\n 路径的 {0} 分隔列表\n 每个路径要么是模块的目录,要么是\n 模块化 jar 的路径。\n (每个路径可以是绝对路径,也可以是相对于当前目录的路径。)\n 可以多次使用此选项。\n --jlink-options \n 要传递给 jlink 的选项列表(用空格分隔) \n 如果未指定,则默认为 "--strip-native-commands \n --strip-debug --no-man-pages --no-header-files"。 \n 可以多次使用此选项。\n --runtime-image \n 将复制到应用程序映像的预定义\n 运行时映像的路径\n (绝对路径或相对于当前目录的路径)\n 如果未指定 --runtime-image,jpackage 将运行 jlink 以\n 使用如下选项创建运行时映像:\n --strip-debug、--no-header-files、--no-man-pages 和 \n --strip-native-commands。\n\n用来创建应用程序映像的选项:\n --input -i \n 包含要打包的文件的输入目录的路径\n (绝对路径或相对于当前目录的路径)\n 输入目录中的所有文件将打包到\n 应用程序映像中。\n --app-content [,...]\n 要添加到应用程序有效负载中的文件和/或\n 目录的逗号分隔路径列表。\n 此选项可以多次使用。\n\n用来创建应用程序启动程序的选项:\n --add-launcher =\n 启动程序的名称和包含关键字-值对列表的\n 属性文件的路径\n (绝对路径或相对于当前目录的路径)\n \ -可以使用关键字 "module"、"main-jar"、"main-class"、"description"、\n "arguments"、"java-options"、"app-version"、"icon"、\n "launcher-as-service"、\n "win-console"、"win-shortcut"、"win-menu"、\n "linux-app-category" 和 "linux-shortcut"。\n 这些选项将添加到原始命令行选项中或者用来覆盖\n 原始命令行选项,以构建额外的替代启动程序。\n 将从命令行选项构建主应用程序启动程序。\n 可以使用此选项构建额外的替代启动程序,\n 可以多次使用此选项来构建\n 多个额外的启动程序。 \n --arguments
    \n 在没有为启动程序提供命令行参数时,\n 要传递到主类的命令行参数\n 可以多次使用此选项。\n --java-options \n 要传递到 Java 运行时的选项\n 可以多次使用此选项。\n --main-class \n 要执行的应用程序主类的限定名称\n 只有在指定了 --main-jar 时才能使用此选项。\n --main-jar
    \n 应用程序的主 JAR;包含主类\n (指定为相对于输入路径的路径)\n 可以指定 --module 或 --main-jar 选项,但是不能同时指定\n 两者。\n --module -m [/
    ]\n 应用程序的主模块(以及可选的主类)\n 此模块必须位于模块路径中。\n 如果指定了此选项,则将在 Java 运行时映像中\n 链接主模块。可以指定 --module 或 --main-jar 选项,\n 但是不能同时指定这两个选项。\n{2}\n用来创建应用程序包的选项:\n --about-url \n 应用程序主页的 URL\n --app-image \n {5} (绝对路径或相对于当前目录的路径)\n --file-associations \n 包含关键字-值对列表的属性文件的路径\n (绝对路径或相对于当前目录的路径)\n 可以使用关键字 "extension"、"mime-type"、"icon" 和 "description" \n 来描述此关联。\n 可以多次使用此选项。\n --install-dir \n {4} --license-file \n 许可证文件的路径\n (绝对路径或相对于当前目录的路径)\n --resource-dir \n 覆盖 jpackage 资源的路径\n \ -可以通过向该目录中添加替代资源来覆盖 jpackage 的\n 图标、模板文件和其他资源。\n (绝对路径或相对于当前目录的路径)\n --runtime-image \n 要安装的预定义运行时映像的路径\n (绝对路径或相对于当前目录的路径)\n 在创建运行时程序包时需要使用选项。\n --launcher-as-service\n 请求创建安装程序,以将主\n 应用程序启动程序注册为后台服务类型应用程序。\n\n用来创建应用程序包的与平台相关的选项:\n{3} +help.header=用法:jpackage + +help.short=使用 jpackage --help(或 -h)可获取可能选项的列表 + +help.option-group.sample.create-native-package=\ 生成适用于主机系统的应用程序包:\n 对于模块化应用程序:\n jpackage -n name -p modulePath -m moduleName/className\n 对于非模块化应用程序:\n jpackage -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n 从预构建的应用程序映像:\n jpackage -n name --app-image appImageDir + +help.option-group.sample.create-app-image=\ 生成应用程序映像:\n 对于模块化应用程序:\n jpackage --type app-image -n name -p modulePath \\\n -m moduleName/className\n 对于非模块化应用程序:\n jpackage --type app-image -i inputDir -n name \\\n --main-class className --main-jar myJar.jar\n 要向 jlink 提供您自己的选项,请分别运行 jlink:\n jlink --output appRuntimeImage -p modulePath \\\n --add-modules moduleName \\\n --no-header-files [...]\n jpackage --type app-image -n name \\\n -m moduleName/className --runtime-image appRuntimeImage + +help.option-group.sample.create-runtime-installer=\ 生成 Java 运行时程序包:\n jpackage -n name --runtime-image + +help.option-group.sample.sign-app-image=\ 对预定义应用程序映像进行签名:\n jpackage --type app-image --app-image \\\n --mac-sign [...]\n 注:此模式下允许的其他选项只有:\n 一组其他 mac 签名选项和 --verbose + +help.option-group.sample=示例用法 +help.option-group.generic=一般选项 +help.option-group.runtime-image=用来创建运行时映像的选项 +help.option-group.app-image=用来创建应用程序映像的选项 +help.option-group.launcher=用来创建应用程序启动程序的选项 +help.option-group.launcher-platform=用来创建应用程序启动程序的平台相关选项 +help.option-group.package=用来创建应用程序包的选项 +help.option-group.package-platform=用来创建应用程序包的与平台相关的选项 + +help.option.argument-file=\ 从文件读取选项和/或模式\n 可以多次使用此选项。 + +help.option.about-url=\ 应用程序主页的 URL + +help.option.add-launcher.win=\ 启动程序的名称,以及包含\n 键值对列表的属性文件的路径\n (绝对路径或相对于当前目录的路径)\n 可以使用键 "arguments"、"description"、"icon"、"java-options"、\n "launcher-as-service"、"main-class"、"main-jar"、"module"、\n "win-console"、"win-menu" 和 "win-shortcut"。\n 这些选项添加到或用于覆盖原始\n 命令行选项以构建其他替代启动程序。\n 将从命令行选项构建主应用程序启动程序。\n 可以使用此选项构建其他替代启动程序,\n 并且可以多次使用此选项\n 构建多个其他启动程序。 + +help.option.add-launcher.linux=\ 启动程序的名称,以及包含\n 键值对列表的属性文件的路径\n (绝对路径或相对于当前目录的路径)\n 可以使用键 "arguments"、"description"、"icon"、"java-options"、\n "launcher-as-service"、"linux-shortcut"、"main-class"、"main-jar" \n 和 "module"。\n 这些选项添加到或用于覆盖原始\n 命令行选项以构建其他替代启动程序。\n 将从命令行选项构建主应用程序启动程序。\n 可以使用此选项构建其他替代启动程序,\n 并且可以多次使用此选项\n 构建多个其他启动程序。 + +help.option.add-launcher.mac=\ 启动程序的名称,以及包含\n 键值对列表的属性文件的路径\n (绝对路径或相对于当前目录的路径)\n 可以使用键 "arguments"、"description"、"icon"、"java-options"、\n "launcher-as-service"、"main-class"、"main-jar" 和\n "module"。\n 这些选项添加到或用于覆盖原始\n 命令行选项以构建其他替代启动程序。\n 将从命令行选项构建主应用程序启动程序。\n 可以使用此选项构建其他替代启动程序,\n 并且可以多次使用此选项\n 构建多个其他启动程序。 + +help.option.add-modules=\ 要添加的模块列表(以逗号 (",") 分隔)\n 此模块列表以及主模块(如果指定)\n 将作为 --add-module 参数传递到 jlink。\n 如果未指定,则仅使用主模块\n (如果指定 --module)或默认模块集\n (如果指定 --main-jar)。\n 可以多次使用此选项。 + +help.option.app-content=\ 要添加到应用程序有效负载中的文件\n 和/或目录路径的逗号分隔列表。\n 可以多次使用此选项。 + +help.option.app-content.mac=\ 要添加到应用程序有效负载中的文件\n 和/或目录路径的逗号分隔列表。\n 可以多次使用此选项。\n 注:该值应为具有 "Resources" 子目录的\n 目录(或应用程序包的 "Contents" 目录中\n 有效的任何其他目录)。否则,jpackage \n 可能会生成无效的应用程序包,此应用程序包\n 可能会使代码签名和/或公证失败。 + +help.option.app-image=\ 用来构建可安装程序包的\n 预定义应用程序映像的位置\n (绝对路径或相对于当前目录的路径) + +help.option.app-image.mac=\ 用来构建可安装程序包或对预定义应用程序\n 映像进行签名的预定义应用程序\n 映像的位置\n (绝对路径或相对于当前目录的路径) + +help.option.app-version=\ 应用程序和/或程序包的版本 + +help.option.arguments=\ 在没有为启动程序提供命令行参数时,\n 要传递到主类的命令行参数\n 可以多次使用此选项。 + +help.option.copyright=\ 应用程序的版权 + +help.option.description=\ 应用程序的说明 + +help.option.dest=\ 放置生成的输出文件的路径\n (绝对路径或相对于当前目录的路径)\n 默认为当前工作目录。 + +help.option.file-associations=\ 包含键值对列表的属性文件的路径\n (绝对路径或相对于当前目录的路径)\n 键 "extension"、"mime-type"、"icon" 和 "description"\n 可用于描述关联。\n 可以多次使用此选项。 + +help.option.help=\ 将用法文本输出到输出流并退出,用法文本中包含\n 适用于当前平台的每个有效选项的列表和说明 + +help.option.icon=\ 应用程序包图标的路径\n (绝对路径或相对于当前目录的路径) + +help.option.input=\ 包含要打包的文件的输入目录的路径\n (绝对路径或相对于当前目录的路径)\n 输入目录中的所有文件将打包到\n 应用程序映像中。 + +help.option.install-dir=\ 应用程序安装目录的绝对路径 + +help.option.install-dir.win=\ 应用程序安装位置的相对子路径\n 例如 "Program Files" 或 "AppData"。 + +help.option.installer-runtime-image=\ 要安装的预定义运行时映像的路径\n (绝对路径或相对于当前目录的路径)\n 创建运行时程序包时需要提供选项。 + +help.option.java-options=\ 传递到 Java 运行时的选项\n 可以多次使用此选项。 + +help.option.jlink-options=\ 要传递到 jlink 的选项列表(以空格分隔)\n 如果未指定,则默认为 "--strip-native-commands\n --strip-debug --no-man-pages --no-header-files"。\n 可以多次使用此选项。 + +help.option.launcher-as-service=\ 请求创建安装程序,以将主应用程序\n 启动程序注册为后台服务类型应用程序。 + +help.option.license-file=\ 许可证文件的路径\n (绝对路径或相对于当前目录的路径) + +help.option.linux-app-category=\ RPM .spec 文件的组值或\n DEB 控制文件的节值 + +help.option.linux-app-release=\ RPM .spec 文件的发行版值或\n DEB 控制文件的 Debian 修订版值 + +help.option.linux-deb-maintainer=\ .deb 程序包的维护程序 + +help.option.linux-menu-group=\ 此应用程序所在的菜单组 + +help.option.linux-package-deps=\ 应用程序所需的程序包或功能 + +help.option.linux-package-name=\ Linux 程序包的名称,默认为应用程序名称 + +help.option.linux-rpm-license-type=\ 许可证类型(RPM .spec 的 "License: ") + +help.option.linux-shortcut=\ 为应用程序创建快捷方式。 + +help.option.mac-app-category=\ 用于构造应用程序 plist 中的 LSApplicationCategoryType 的\n 字符串。默认值为 "utilities"。 + +help.option.mac-app-image-sign-identity=\ 用于对应用程序映像进行签名的身份。此值将\n 直接传递到 "codesign" 工具的 --sign 选项。此选项\n 不能与 --mac-signing-key-user-name 结合使用。 + +help.option.mac-app-store=\ 指示 jpackage 输出面向\n Mac App Store。 + +help.option.mac-dmg-content=\ 包括 dmg 中引用的所有内容。\n 可以多次使用此选项。 + +help.option.mac-entitlements=\ 包含对包中的可执行文件和库进行签名时\n 要使用的权利的文件路径。 + +help.option.mac-installer-sign-identity=\ 用于对 "pkg" 安装程序进行签名的身份。此值将\n 直接传递到 "productbuild" 工具的 --sign 选项。此选项\n 不能与 --mac-signing-key-user-name 结合使用。 + +help.option.mac-package-identifier=\ 唯一标识 macOS 应用程序的标识符\n 默认为主类名称。\n 只能使用字母数字 (A-Z,a-z,0-9)、连字符 (-)\n 和句点 (.) 字符。 + +help.option.mac-package-name=\ 应用程序在菜单栏中显示的名称\n 此名称可以与应用程序名称不同。\n 此名称的长度必须少于 16 个字符,并且\n 适合显示在菜单栏和应用程序“信息”窗口中。\n 默认为应用程序名称。 + +help.option.mac-package-signing-prefix=\ 对应用程序包进行签名时,此值将作为\n 前缀添加到需要签名但当前没有程序包\n 标识符的所有组件。 + +help.option.mac-sign=\ 请求对程序包或预定义的应用程序映像\n 进行签名。 + +help.option.mac-signing-keychain=\ 要用来搜索签名身份的密钥链的名称\n 如果未指定,则使用标准密钥链。 + +help.option.mac-signing-key-user-name=\ Apple 签名身份的团队或用户名称部分。为了直接\n 控制用于对应用程序映像或安装程序进行签名的\n 签名身份,请使用 --mac-app-image-sign-identity 和/或\n --mac-installer-sign-identity。此选项不能与\n --mac-app-image-sign-identity 或 --mac-installer-sign-identity 结合使用。 + +help.option.main-class=\ 要执行的应用程序主类的限定名称\n 只有在指定了 --main-jar 时才能使用此选项。 + +help.option.main-jar=\ 应用程序的主 JAR;包含主类\n (指定为相对于输入路径的路径)\n 可以指定 --module 或 --main-jar 选项,\n 但不能同时指定这两个选项。 + +help.option.module=\ 应用程序的主模块(以及可选的主类)\n 此模块必须位于模块路径中。\n 指定了此选项时,将在 Java 运行时映像中\n 链接主模块。可以指定 --module 或 --main-jar \n 选项,但不能同时指定这两个选项。 + +help.option.module-path=\ 以 : 分隔的路径列表\n 每个路径是模块的目录或\n 模块化 jar 的路径。\n (每个路径可以是绝对路径,也可以是相对于当前目录的路径。)\n 可以多次使用此选项。 +help.option.module-path.win=\ 以 ; 分隔的路径列表\n 每个路径是模块的目录或\n 模块化 jar 的路径。\n (每个路径可以是绝对路径,也可以是相对于当前目录的路径。)\n 可以多次使用此选项。 + +help.option.name=\ 应用程序和/或程序包的名称 + +help.option.resource-dir=\ 覆盖 jpackage 资源的路径\n 可以通过向此目录中添加替换资源来覆盖 jpackage 的\n 图标、模板文件和其他资源。\n (绝对路径或相对于当前目录的路径) + +help.option.runtime-image=\ 将复制到应用程序映像中的预定义\n 运行时映像的路径\n (绝对路径或相对于当前目录的路径)\n 如果未指定 --runtime-image,jpackage 将运行 jlink 以\n 使用以下选项创建运行时映像:\n --strip-debug、--no-header-files、--no-man-pages 和\n --strip-native-commands。 + +help.option.temp=\ 用于创建临时文件的新目录或空目录的路径\n (绝对路径或相对于当前目录的路径)\n 如果指定,则在任务完成时将不删除\n 临时目录,必须手动删除临时目录。\n 如果未指定,将创建临时目录并\n 并在任务完成时删除该临时目录。 + +help.option.type.win=\ 要创建的程序包的类型\n 有效值为:{"app-image", "exe", "msi"}\n 如果未指定此选项,则将创建与平台相关的\n 默认类型。 +help.option.type.linux=\ 要创建的程序包的类型\n 有效值为:{"app-image", "deb", "rpm"}\n 如果未指定此选项,则将创建与平台相关的\n 默认类型。 +help.option.type.mac=\ 要创建的程序包的类型\n 有效值为:{"app-image", "dmg", "pkg"}\n 如果未指定此选项,则将创建与平台相关的\n 默认类型。 + +help.option.vendor=\ 应用程序的供应商 + +help.option.verbose=\ 启用详细的输出 + +help.option.version=\ 将产品版本输出到输出流并退出。 + +help.option.win-console=\ 为应用程序创建控制台启动程序,应当为\n 需要控制台交互的应用程序指定 + +help.option.win-dir-chooser=\ 添加一个对话框以允许用户选择\n 产品的安装目录。 + +help.option.win-help-url=\ 用户可以从中获取更多信息或技术支持的 URL + +help.option.win-menu=\ 请求为此应用程序添加“开始”菜单快捷方式 + +help.option.win-menu-group=\ 此应用程序所在的“开始”菜单组 + +help.option.win-per-user-install=\ 请求基于每个用户执行安装 + +help.option.win-shortcut=\ 请求为此应用程序添加桌面快捷方式 + +help.option.win-shortcut-prompt=\ 添加一个对话框以允许用户选择是否将由安装程序\n 创建快捷方式。 + +help.option.win-update-url=\ 可用应用程序更新信息的 URL + +help.option.win-upgrade-uuid=\ 与此程序包的升级关联的 UUID -MSG_Help_win_launcher=\n用来创建应用程序启动程序的与平台相关的选项:\n --win-console\n 为应用程序创建控制台启动程序,应当为\n 需要控制台交互的应用程序指定\n -MSG_Help_win_install=\ --win-dir-chooser\n 添加一个对话框以允许用户选择\n 产品的安装目录。\n --win-help-url \n 用户可以从中获取更多信息或技术支持的 URL\n --win-menu\n 请求为此应用程序添加开始菜单快捷方式\n --win-menu-group \n 此应用程序所在的开始菜单组\n --win-per-user-install\n 请求基于每个用户执行安装\n --win-shortcut\n 请求为此应用程序添加桌面快捷方式\n --win-shortcut-prompt\n 添加一个对话框以允许用户选择是否将由安装程序\n 创建快捷方式。\n --win-update-url \n 可用应用程序更新信息的 URL\n --win-upgrade-uuid \n 与此程序包的升级相关联的 UUID\n -MSG_Help_win_install_dir=默认安装位置下面的相对子路径\n -MSG_Help_mac_install=\ --mac-dmg-content [,...]\n 包括 DMG 中引用的所有内容。\n 此选项可以使用多次。\n -MSG_Help_mac_launcher=\ --mac-package-identifier \n 用来唯一地标识 macOS 应用程序的标识符\n 默认为主类名称。\n 只能使用字母数字 (A-Z,a-z,0-9)、连字符 (-) 和\n 句点 (.) 字符。\n --mac-package-name \n 出现在菜单栏中的应用程序名称\n 这可以与应用程序名称不同。\n 此名称的长度必须小于 16 个字符,适合\n 显示在菜单栏中和应用程序“信息”窗口中。\n 默认为应用程序名称。\n --mac-package-signing-prefix \n 在对应用程序包签名时,会在所有需要签名\n 但当前没有程序包标识符的组件的\n 前面加上此值。\n --mac-sign\n 请求对程序包或预定义的应用程序映像\n 进行签名。\n --mac-signing-keychain \n 要用来搜索签名身份的密钥链的名称\n 如果未指定,则使用标准的密钥链。\n --mac-signing-key-user-name \n Apple 签名身份的团队或用户名称部分。为了直接\n 控制用于对应用程序映像或安装程序进行签名的\n 签名身份,请使用 --mac-app-image-sign-identity 和/或\n --mac-installer-sign-identity。此选项不能与\n --mac-app-image-sign-identity 或 --mac-installer-sign-identity 结合使用。\n --mac-app-image-sign-identity \n 用于对应用程序映像进行签名的身份。此值将直接\n 传递至 "codesign" 工具的 --sign 选项。此选项不能\n 与 --mac-signing-key-user-name 结合使用。\n --mac-installer-sign-identity \n 用于对 "pkg" 安装程序进行签名的身份。此值将直接\n 传递至 "productbuild" 工具的 --sign 选项。此选项不能\n 与 --mac-signing-key-user-name 结合使用。\n --mac-app-store\n 指示 jpackage 输出面向\n Mac App Store。\n --mac-entitlements \n 包含一些权利的文件的路径,在对捆绑包中的可执行文件\n 和库进行签名时会使用这些权利。\n --mac-app-category \n 用于构造应用程序 plist 中 LSApplicationCategoryType 的\n 字符串。默认值为 "utilities"。\n -MSG_Help_linux_install=\ --linux-package-name \n Linux 程序包的名称,默认为应用程序名称\n --linux-deb-maintainer \n .deb 程序包的维护程序\n --linux-menu-group \n 此应用程序所在的菜单组\n --linux-package-deps \n 应用程序所需的程序包或功能\n --linux-rpm-license-type \n 许可证的类型(RPM .spec 的 "License: ")\n --linux-app-release \n RPM .spec 文件的发行版值或 \n DEB 控制文件的 Debian 修订版值\n --linux-app-category \n RPM .spec 文件的组值或 \n DEB 控制文件的节值\n --linux-shortcut\n 为应用程序创建快捷方式。\n -MSG_Help_mac_linux_install_dir=应用程序安装目录的绝对路径\n -MSG_Help_default_install_dir=OS X 或 Linux 上应用程序安装目录的绝对路径。\n Windows 上应用程序安装位置的相对子路径\n (如 "Program Files" 或 "AppData")。\n -MSG_Help_no_args=用法:jpackage \n使用 jpackage --help(或 -h)可获取可能选项的列表 -MSG_Help_default_app_image=用来构建可安装程序包的\n 预定义应用程序映像的位置\n -MSG_Help_mac_app_image=用来构建可安装程序包的\n 或对预定义应用程序映像进行签名的\n 预定义应用程序映像的位置\n -MSG_Help_mac_sign_sample_usage=\ 对预定义应用程序映像进行签名:\n jpackage --type app-image --app-image \\\n --mac-sign [...]\n 注:此模式下允许的其他选项只有:\n 一组其他 mac 签名选项和 --verbose\n diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties index c61e60fe4ec..c5ea583514f 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources.properties @@ -48,7 +48,7 @@ message.debug-working-directory=Kept working directory for debug: {0} message.bundle-created=Succeeded in building {0} package message.module-version=Using version "{0}" from module "{1}" as application version -message.error-header={0} +message.error-header=Error: {0} message.advice-header=Advice to fix: {0} error.version-string-empty=Version may not be empty string diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties index 2426b97c7e2..7816f8ee71a 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_de.properties @@ -24,25 +24,32 @@ # # -jpackage.description=Eigenständige Java-Anwendung verpacken - param.copyright.default=Copyright (C) {0,date,YYYY} -param.description.default=Kein Wert param.vendor.default=Unbekannt +bundle-type.win-app=Windows-Anwendungsimage +bundle-type.win-exe=EXE-Installationsprogrammpackage +bundle-type.win-msi=MSI-Installationsprogrammpackage +bundle-type.mac-app=Mac-Anwendungsimage +bundle-type.mac-dmg=Mac-DMG-Package +bundle-type.mac-pkg=Mac-PKG-Package +bundle-type.linux-app=Linux-Anwendungsimage +bundle-type.linux-deb=DEB-Bundle +bundle-type.linux-rpm=RPM-Bundle + resource.post-app-image-script=Auszuführendes Skript nach dem Auffüllen des Anwendungsimages message.using-default-resource=Standardpackageressource {0} {1} wird verwendet (durch Hinzufügen von {2} zu resource-dir ist eine Anpassung möglich). -message.no-default-resource=Keine Standardpackageressource {0} {1} (durch Hinzufügen von {2} zu resource-dir ist eine Anpassung möglich). +message.no-default-resource=Keine Standardpackageressource {0} (durch Hinzufügen von {1} zu resource-dir ist eine Anpassung möglich). message.using-custom-resource-from-file=Benutzerdefinierte Packageressource {0} wird verwendet (aus Datei {1} geladen). message.using-custom-resource=Benutzerdefinierte Packageressource {0} wird verwendet (aus {1} geladen). message.creating-app-bundle=Anwendungspackage {0} wird in {1} erstellt -message.runtime-image-dir-does-not-exist=Angegebenes Laufzeitimageverzeichnis {0}: {1} ist nicht vorhanden -message.resource-dir-does-not-exist=Angegebenes Ressourcenverzeichnis {0}: {1} ist nicht vorhanden message.debug-working-directory=Arbeitsverzeichnis für Debug beibehalten: {0} message.bundle-created={0}-Package wurde erfolgreich erstellt message.module-version=Version "{0}" aus Modul "{1}" wird als Anwendungsversion verwendet -message.module-class=Klasse "{0}" aus Modul "{1}" wird als Anwendungshauptklasse verwendet + +message.error-header={0} +message.advice-header=Empfehlung zur Behebung: {0} error.version-string-empty=Version darf keine leere Zeichenfolge sein error.version-string-zero-length-component=Version [{0}] enthält eine Komponente mit Nulllänge @@ -50,64 +57,69 @@ error.version-string-invalid-component=Version [{0}] enthält ungültige Kompone error.cannot-create-output-dir=Zielverzeichnis {0} kann nicht erstellt werden error.cannot-write-to-output-dir=Zielverzeichnis {0} ist schreibgeschützt -error.root-exists=Fehler: Anwendungszielverzeichnis {0} ist bereits vorhanden +error.root-exists=Anwendungszielverzeichnis {0} ist bereits vorhanden error.no-main-class-with-main-jar=Es wurde keine Hauptklasse angegeben oder in der JAR-Datei {0} gefunden error.no-main-class-with-main-jar.advice=Geben Sie eine Hauptklasse an, oder stellen Sie sicher, dass die JAR-Datei {0} eine Hauptklasse im Manifest angibt -error.no-main-class=Es wurde keine Hauptklasse angegeben oder in den angegebenen Anwendungsressourcen gefunden -error.no-main-class.advice=Geben Sie eine Anwendungsklasse an, oder stellen Sie sicher, dass die appResources eine JAR-Datei mit einer Anwendungsklasse im Manifest enthalten error.main-jar-does-not-exist=Die konfigurierte Haupt-JAR-Datei ist im Eingabeverzeichnis nicht vorhanden {0} error.main-jar-does-not-exist.advice=Die Haupt-JAR-Datei muss relativ zum Eingabeverzeichnis (nicht als absoluter Pfad) angegeben werden und muss in diesem Verzeichnis vorhanden sein error.no-module-in-path="{0}-Modul im Modulpfad nicht gefunden" -error.not-path-parameter="Ungültiger Wert für Parameter {0}: {1}" error.no-input-parameter="--input-Parameter für nicht modulare Anwendung fehlt" +error.non-option-arguments={0} Argumente, die keine Option sind, in der Befehlszeile gefunden. Argumente, die keine Option sind, sind nicht zulässig +error.undefined-default-bundling-operation=Standard-Bundling-Vorgang ist nicht definiert +error.undefined-default-bundling-operation.advice=Parameter {0} zur Befehlszeile hinzufügen +error.parameter-not-uuid=Der für Parameter {1} angegebene Wert "{0}" ist keine gültige UUID +error.parameter-not-path=Der für Parameter {1} angegebene Wert "{0}" ist kein gültiger Pfad +error.parameter-not-file=Der für Parameter {1} angegebene Wert "{0}" ist keine Datei +error.parameter-not-directory=Der für Parameter {1} angegebene Wert "{0}" ist kein Verzeichnis +error.parameter-not-empty-directory=Der für Parameter {1} angegebene Wert "{0}" ist kein leeres Verzeichnis oder kein vorhandener Pfad +error.parameter-not-url=Der für Parameter {1} angegebene Wert "{0}" ist keine gültige URL +error.parameter-not-launcher-shortcut-dir=Der für Parameter {1} angegebene Wert "{0}" ist kein gültiges Verknüpfungsstartverzeichnis +error.path-parameter-ioexception=I/O-Fehler beim Zugriff auf Pfadwert "{0}" von Parameter {1} +error.parameter-add-launcher-malformed=Der für Parameter {1} angegebene Wert "{0}" stimmt nicht mit dem Muster = überein +error.parameter-add-launcher-not-file=Der Wert des Pfades zu einer Eigenschaftendatei "{0}", der für den zusätzlichen Launcher "{1}" bereitgestellt wird, ist kein gültiger Dateipfad +error.properties-parameter-not-path=Der für Eigenschaft "{1}" in Datei "{2}" angegebene Wert "{0}" ist kein gültiger Pfad +error.properties-parameter-not-file=Der für Eigenschaft "{1}" in Datei "{2}" angegebene Wert "{0}" ist keine Datei +error.properties-parameter-not-launcher-shortcut-dir=Der für Eigenschaft "{1}" in Datei "{2}" angegebene Wert "{0}" ist kein gültiges Verknüpfungsstartverzeichnis + error.no-content-types-for-file-association=Für Dateiverknüpfungsnummer {0} wurden keine MIME-Typen angegeben error.no-content-types-for-file-association.advice=Geben Sie einen MIME-Typ für Dateiverknüpfungsnummer {0} an error.too-many-content-types-for-file-association=Für Dateiverknüpfungsnummer {0} wurde mehr als ein MIME-Typ angegeben error.too-many-content-types-for-file-association.advice=Geben Sie nur einen MIME-Typ für Dateiverknüpfungsnummer {0} an -error.tool-not-found={0} kann nicht gefunden werden. Grund: {1} -error.tool-not-found.advice=Installieren Sie {0} -error.tool-old-version={0} {1} oder eine neuere Version kann nicht gefunden werden -error.tool-old-version.advice=Installieren Sie {0} {1} oder eine neuere Version +error.launcher-duplicate-name=Mehrere Launcher haben denselben Namen "{0}". Launcher müssen eindeutige Namen haben + +error.tool-error=Validieren von "{0}" nicht möglich. Grund: {1} +error.tool-not-executable="{0}" ist nicht ausführbar +error.tool-not-found="{0}" kann nicht gefunden werden +error.tool-not-found.advice=Installieren Sie "{0}" +error.tool-old-version="{0}" {1} oder eine neuere Version kann nicht gefunden werden +error.tool-old-version.advice=Installieren Sie "{0}" {1} oder eine neuere Version + error.jlink.failed=jlink nicht erfolgreich mit: {0} error.blocked.option=jlink-Option [{0}] ist in --jlink-options nicht zulässig error.no.name=Name nicht mit --name angegeben. Es kann auch kein Name aus app-image abgeleitet werden error.no.name.advice=Geben Sie den Namen mit --name an -warning.no.jdk.modules.found=Warnung: Keine JDK-Module gefunden - -error.foreign-app-image=Fehler : Fehlende .jpackage.xml-Datei in app-image-Verzeichnis "{0}" -error.invalid-app-image=Fehler: app-image-Verzeichnis "{0}" wurde von einer anderen jpackage-Version generiert, oder Datei "{1}" ist nicht wohlgeformt +error.missing-app-image-file=Datei "{0}" fehlt im vordefinierten Anwendungsimage "{1}" +error.invalid-app-image-file=Datei "{0}" im vordefinierten Anwendungsimage "{1}" ist beschädigt oder wurde von einer anderen Version von jpackage erstellt +error.malformed-app-image-file=Datei "{0}" im vordefinierten Anwendungsimage "{1}" enthält nicht wohlgeformte XML-Daten +error.reading-app-image-file=Datei "{0}" konnte im vordefinierten Anwendungsimage "{1}" nicht gelesen werden error.invalid-install-dir=Ungültiges Installationsverzeichnis "{0}" -MSG_BundlerFailed=Fehler: Bundler "{1}" ({0}) konnte kein Package generieren -MSG_BundlerConfigException=Bundler {0} aufgrund eines Konfigurationsproblems übersprungen: {1} \nEmpfehlung zur Behebung: {2} -MSG_BundlerConfigExceptionNoAdvice=Bundler {0} aufgrund eines Konfigurationsproblems übersprungen: {1} -MSG_BundlerRuntimeException=Bundler {0} nicht erfolgreich. Grund: {1} +ERR_NoMainClass=Hauptanwendungsklasse fehlt +ERR_UnsupportedOption=Option [{0}] ist auf dieser Plattform ungültig +ERR_InvalidTypeOption=Option [{0}] ist nicht gültig mit Typ [{1}] +ERR_NoInstallerEntryPoint=Option [{0}] ist nicht gültig ohne Einstiegspunktoption --module oder --main-jar +ERR_MutuallyExclusiveOptions=Sich gegenseitig ausschließende Optionen: [{0}] und [{1}] +ERR_InvalidOptionWithAppImageSigning=Option [{0}] ist nicht gültig beim Signieren eines Anwendungsimages -ERR_NoMainClass=Fehler: Hauptanwendungsklasse fehlt -ERR_UnsupportedOption=Fehler: Option [{0}] ist auf dieser Plattform ungültig -ERR_InvalidTypeOption=Fehler: Option [{0}] ist nicht gültig mit Typ [{1}] -ERR_NoInstallerEntryPoint=Fehler: Option [{0}] ist nicht gültig ohne Einstiegspunktoption --module oder --main-jar -ERR_MutuallyExclusiveOptions=Fehler: Optionen [{0}] und [{1}] schließen sich gegenseitig aus -ERR_InvalidOptionWithAppImageSigning=Fehler: Option [{0}] ist nicht gültig beim Signieren eines Anwendungsimages - -ERR_MissingArgument=Fehler: Fehlendes Argument: {0} -ERR_MissingRequiredArgument=Fehler: Für das Argument {0} ist mindestens eines der folgenden Argumente erforderlich: [{1}] -ERR_AppImageNotExist=Fehler: Anwendungsimageverzeichnis "{0}" ist nicht vorhanden -ERR_NoAddLauncherName=Fehler: Für Option --add-launcher müssen ein Name und ein Dateipfad angegeben werden (--add-launcher =) -ERR_NoUniqueName=Fehler: Für --add-launcher = ist ein eindeutiger Name erforderlich -ERR_InvalidAppName=Fehler: Ungültiger Anwendungsname: {0} -ERR_InvalidSLName=Fehler: Ungültiger Name für hinzuzufügenden Launcher: {0} -ERR_IconFileNotExit=Fehler: Die angegebene Symboldatei [{0}] ist nicht vorhanden -ERR_LicenseFileNotExit=Fehler: Die angegebene Lizenzdatei ist nicht vorhanden -ERR_BuildRootInvalid=Fehler: Das temporäre Verzeichnis ({0}) darf nicht vorhanden sein oder muss leer sein -ERR_InvalidOption=Fehler: Ungültige Option: [{0}] -ERR_InvalidInstallerType=Fehler: Ungültiger oder nicht unterstützter Typ: [{0}] -ERR_BothMainJarAndModule=Fehler: Die Optionen --main-jar und --module dürfen nicht beide vorhanden sein -ERR_NoEntryPoint=Fehler: Für das Erstellen des Anwendungsimages muss entweder die Option --main-jar oder die Option --module angegeben werden -ERR_CannotParseOptions=Fehler: Option @filename wird verarbeitet: {0} -ERR_MissingJLinkOptMacAppStore=Fehler: Argument "--mac-app-store" erfordert eine {0}-Option für Argument "--jlink-options" -ERR_MacAppStoreRuntimeBinExists=Fehler: Laufzeitimage "{0}" darf nicht den Ordner "bin" enthalten. Verwenden Sie die jlink-Option "--strip-native-commands" beim Generieren des Laufzeitimages mit dem Argument "--mac-app-store". +ERR_MissingArgument2=Fehlendes Argument: {0} oder {1} +ERR_InvalidAppName=Ungültiger Anwendungsname: {0} +ERR_InvalidSLName=Ungültiger Name für hinzuzufügenden Launcher: {0} +ERR_InvalidOption=Ungültige Option: [{0}] +ERR_InvalidInstallerType=Ungültiger oder nicht unterstützter Typ: [{0}] +ERR_NoEntryPoint=Für das Erstellen des Anwendungsimages muss entweder die Option --main-jar oder die Option --module angegeben werden +ERR_CannotParseOptions=Option @filename wird verarbeitet: {0} +ERR_MissingJLinkOptMacAppStore=Argument "--mac-app-store" erfordert eine {0}-Option für Argument "--jlink-options" diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties index e0faf346973..5db5ead7577 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_ja.properties @@ -24,25 +24,32 @@ # # -jpackage.description=自己完結型Javaアプリケーションをパッケージ化します - param.copyright.default=Copyright (C) {0,date,YYYY} -param.description.default=なし param.vendor.default=不明 +bundle-type.win-app=Windowsアプリケーション・イメージ +bundle-type.win-exe=EXEインストーラ・パッケージ +bundle-type.win-msi=MSIインストーラ・パッケージ +bundle-type.mac-app=Macアプリケーション・イメージ +bundle-type.mac-dmg=Mac DMGパッケージ +bundle-type.mac-pkg=Mac PKGパッケージ +bundle-type.linux-app=Linuxアプリケーション・イメージ +bundle-type.linux-deb=DEBバンドル +bundle-type.linux-rpm=RPMバンドル + resource.post-app-image-script=アプリケーション・イメージを移入した後に実行するスクリプト message.using-default-resource=デフォルトのパッケージ・リソース{0} {1}の使用({2}をresource-dirに追加してカスタマイズ)。 -message.no-default-resource=デフォルトのパッケージ・リソース{0} {1}なし({2}をresource-dirに追加してカスタマイズ)。 +message.no-default-resource=デフォルトのパッケージ・リソース{0}なし({1}をresource-dirに追加してカスタマイズ)。 message.using-custom-resource-from-file=カスタム・パッケージ・リソース{0}の使用(ファイル{1}からロード済) message.using-custom-resource=カスタム・パッケージ・リソース{0}の使用({1}からロード済) message.creating-app-bundle=アプリケーション・パッケージを作成しています: {1}内の{0} -message.runtime-image-dir-does-not-exist=指定されたランタイム・イメージ・ディレクトリ{0}: {1}は存在しません -message.resource-dir-does-not-exist=指定されたリソース・ディレクトリ{0}: {1}は存在しません message.debug-working-directory=デバッグの作業ディレクトリが保持されました: {0} message.bundle-created={0}パッケージの作成に成功しました message.module-version=モジュール"{1}"のバージョン"{0}"をアプリケーション・バージョンとして使用 -message.module-class=モジュール"{1}"のクラス"{0}"をアプリケーション・メイン・クラスとして使用 + +message.error-header={0} +message.advice-header=修正のアドバイス: {0} error.version-string-empty=バージョンを空の文字列にすることはできません error.version-string-zero-length-component=バージョン[{0}]に長さゼロのコンポーネントが含まれます @@ -50,64 +57,69 @@ error.version-string-invalid-component=バージョン[{0}]に無効なコンポ error.cannot-create-output-dir=宛先ディレクトリ{0}を作成できません。 error.cannot-write-to-output-dir=宛先ディレクトリ{0}は書込み不可です -error.root-exists=エラー: アプリケーションの宛先ディレクトリ{0}はすでに存在します +error.root-exists=アプリケーションの宛先ディレクトリ{0}はすでに存在します error.no-main-class-with-main-jar=メイン・クラスが指定されていなかったか、jar {0}に見つかりませんでした error.no-main-class-with-main-jar.advice=メイン・クラスを指定するか、jar {0}がマニフェストで指定していることを確認してください -error.no-main-class=メイン・クラスが指定されていなかったか、指定されたアプリケーション・リソースに見つかりませんでした -error.no-main-class.advice=アプリケーション・クラスを指定するか、マニフェストでappResourcesにアプリケーション・クラスを含むjarがあることを確認してください error.main-jar-does-not-exist=入力ディレクトリで、構成されたメインjarが{0}に存在しません error.main-jar-does-not-exist.advice=入力ディレクトリに対して相対的に(絶対パスではない)メインjarを指定する必要があり、そのディレクトリ内に存在する必要があります error.no-module-in-path="モジュール・パスに{0}モジュールが見つかりませんでした" -error.not-path-parameter="{0}パラメータの無効な値: {1}" error.no-input-parameter="非モジュラ・アプリケーションに--inputパラメータがありません" +error.non-option-arguments=コマンドラインで{0}個の非オプション引数が見つかりました。非オプション引数は使用できません +error.undefined-default-bundling-operation=デフォルトのバンドル操作は未定義です +error.undefined-default-bundling-operation.advice=コマンドラインに{0}パラメータを追加します +error.parameter-not-uuid=パラメータ{1}に指定された値"{0}"は有効なUUIDではありません +error.parameter-not-path=パラメータ{1}に指定された値"{0}"は有効なパスではありません +error.parameter-not-file=パラメータ{1}に指定された値"{0}"はファイルではありません +error.parameter-not-directory=パラメータ{1}に指定された値"{0}"はディレクトリではありません +error.parameter-not-empty-directory=パラメータ{1}に指定された値"{0}"が空のディレクトリでないか、存在しないパスです +error.parameter-not-url=パラメータ{1}に指定された値"{0}"は有効なURLではありません +error.parameter-not-launcher-shortcut-dir=パラメータ{1}に指定された値"{0}"は、有効なショートカット起動ディレクトリではありません +error.path-parameter-ioexception=パラメータ{1}のパス値"{0}"へのアクセス中にI/Oエラーが発生しました +error.parameter-add-launcher-malformed=パラメータ{1}に指定された値"{0}"がパターン=と一致しません +error.parameter-add-launcher-not-file=追加のランチャ"{1}"に指定されたプロパティ・ファイル"{0}"へのパスの値は有効なファイル・パスではありません +error.properties-parameter-not-path="{2}"ファイルのプロパティ"{1}"に指定された値"{0}"は有効なパスではありません +error.properties-parameter-not-file="{2}"ファイルのプロパティ"{1}"に指定された値"{0}"はファイルではありません +error.properties-parameter-not-launcher-shortcut-dir="{2}"ファイルのプロパティ"{1}"に指定された値"{0}"は、有効なショートカット起動ディレクトリではありません + error.no-content-types-for-file-association=ファイル・アソシエーション番号{0}にMIMEタイプが指定されませんでした error.no-content-types-for-file-association.advice=ファイル・アソシエーション番号{0}にMIMEタイプを指定してください error.too-many-content-types-for-file-association=ファイル・アソシエーション番号{0}に複数のMIMEタイプが指定されました error.too-many-content-types-for-file-association.advice=ファイル・アソシエーション番号{0}にMIMEタイプを1つのみ指定してください -error.tool-not-found={0}が見つかりません。理由: {1} -error.tool-not-found.advice={0}をインストールしてください -error.tool-old-version={0} {1}以降が見つかりません -error.tool-old-version.advice={0} {1}以降をインストールしてください +error.launcher-duplicate-name=複数のランチャに同じ名前"{0}"が付いています。ランチャには一意の名前が必要です + +error.tool-error="{0}"を検証できません。理由: {1} +error.tool-not-executable="{0}"は実行可能ではありません +error.tool-not-found="{0}"が見つかりません +error.tool-not-found.advice="{0}"をインストールしてください +error.tool-old-version="{0}" {1}以降が見つかりません +error.tool-old-version.advice="{0}" {1}以降をインストールしてください + error.jlink.failed=jlinkが次で失敗しました: {0} error.blocked.option=jlinkオプション[{0}]は--jlink-optionsでは許可されません error.no.name=名前が--nameで指定されておらず、app-imageから推論できません error.no.name.advice=--nameで名前を指定します -warning.no.jdk.modules.found=警告: JDKモジュールが見つかりません - -error.foreign-app-image=エラー: app-imageディレクトリ"{0}"に.jpackage.xmlファイルがありません -error.invalid-app-image=エラー: app-imageディレクトリ"{0}"は、別のjpackageバージョンまたは不正な"{1}"ファイルで生成されました +error.missing-app-image-file=事前定義済アプリケーション・イメージ"{1}"に"{0}"ファイルがありません +error.invalid-app-image-file=事前定義済アプリケーション・イメージ"{1}"の"{0}"ファイルが破損しているか、別のバージョンのjpackageによって作成されました +error.malformed-app-image-file=事前定義済アプリケーション・イメージ"{1}"の"{0}"ファイルに不正なXMLデータが含まれています +error.reading-app-image-file=事前定義済アプリケーション・イメージ"{1}"の"{0}"ファイルの読取りに失敗しました error.invalid-install-dir=無効なインストール・ディレクトリ"{0}" -MSG_BundlerFailed=エラー: バンドラ"{1}" ({0})がパッケージの生成に失敗しました -MSG_BundlerConfigException=構成の問題のため、バンドラ{0}がスキップされました: {1} \n次の修正を行ってください: {2} -MSG_BundlerConfigExceptionNoAdvice=構成の問題のため、バンドラ{0}がスキップされました: {1} -MSG_BundlerRuntimeException={1}のため、バンドラ{0}が失敗しました +ERR_NoMainClass=メイン・アプリケーション・クラスがありません +ERR_UnsupportedOption=オプション[{0}]は、このプラットフォームでは無効です +ERR_InvalidTypeOption=オプション[{0}]は、タイプ[{1}]では無効です +ERR_NoInstallerEntryPoint=オプション[{0}]は、--moduleまたは--main-jarエントリ・ポイント・オプションなしでは無効です +ERR_MutuallyExclusiveOptions=相互排他的なオプション[{0}]と[{1}] +ERR_InvalidOptionWithAppImageSigning=アプリケーション・イメージへの署名時にオプション[{0}]が有効ではありません -ERR_NoMainClass=エラー: メイン・アプリケーション・クラスがありません -ERR_UnsupportedOption=エラー: オプション[{0}]は、このプラットフォームでは無効です -ERR_InvalidTypeOption=エラー: オプション[{0}]は、タイプ[{1}]では無効です -ERR_NoInstallerEntryPoint=エラー: オプション[{0}]は、--moduleまたは--main-jarエントリ・ポイント・オプションなしでは無効です -ERR_MutuallyExclusiveOptions=エラー: 相互排他的なオプション[{0}]と[{1}] -ERR_InvalidOptionWithAppImageSigning=エラー: アプリケーション・イメージへの署名時にオプション[{0}]が有効ではありません - -ERR_MissingArgument=エラー: 引数がありません: {0} -ERR_MissingRequiredArgument=エラー: {0}引数には少なくとも1つの[{1}]引数が必要です -ERR_AppImageNotExist=エラー: アプリケーション・イメージ・ディレクトリ"{0}"は存在しません -ERR_NoAddLauncherName=エラー: --add-launcherオプションには名前およびファイル・パスが必要です(--add-launcher =) -ERR_NoUniqueName=エラー: --add-launcher =には一意の名前が必要です -ERR_InvalidAppName=エラー: 無効なアプリケーション名: {0} -ERR_InvalidSLName=エラー: 無効な追加ランチャ名: {0} -ERR_IconFileNotExit=エラー: 指定されたアイコン・ファイル[{0}]は存在しません -ERR_LicenseFileNotExit=エラー: 指定されたライセンス・ファイルは存在しません -ERR_BuildRootInvalid=エラー: 一時({0})は存在しないか、空のディレクトリである必要があります -ERR_InvalidOption=エラー: 無効なオプション: [{0}] -ERR_InvalidInstallerType=エラー: 無効またはサポートされていないタイプ: [{0}] -ERR_BothMainJarAndModule=エラー: --main-jarオプションと--moduleオプションの両方を指定することはできません -ERR_NoEntryPoint=エラー: アプリケーション・イメージの作成には--main-jarまたは--moduleオプションが必要です -ERR_CannotParseOptions=エラー: @filenameオプションの処理: {0} -ERR_MissingJLinkOptMacAppStore=エラー: --mac-app-store引数では、--jlink-options引数に{0}オプションが必要です -ERR_MacAppStoreRuntimeBinExists=エラー: ランタイム・イメージ"{0}"に"bin"フォルダを含めることはできません。--mac-app-store引数で使用されるランタイム・イメージを生成する際に、--strip-native-commands jlinkオプションを使用します。 +ERR_MissingArgument2=引数がありません: {0}または{1} +ERR_InvalidAppName=無効なアプリケーション名: {0} +ERR_InvalidSLName=無効な追加ランチャ名: {0} +ERR_InvalidOption=無効なオプション: [{0}] +ERR_InvalidInstallerType=無効またはサポートされていないタイプ: [{0}] +ERR_NoEntryPoint=アプリケーション・イメージの作成には--main-jarまたは--moduleオプションが必要です +ERR_CannotParseOptions=@filenameオプションの処理: {0} +ERR_MissingJLinkOptMacAppStore=--mac-app-store引数では、--jlink-options引数に{0}オプションが必要です diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties index 0236ef34077..23540af7db2 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/resources/MainResources_zh_CN.properties @@ -24,25 +24,32 @@ # # -jpackage.description=打包自包含 Java 应用程序 - param.copyright.default=版权所有 (C) {0,date,YYYY} -param.description.default=无 param.vendor.default=未知 +bundle-type.win-app=Windows 应用程序映像 +bundle-type.win-exe=EXE 安装程序包 +bundle-type.win-msi=MSI 安装程序包 +bundle-type.mac-app=Mac 应用程序映像 +bundle-type.mac-dmg=Mac DMG 程序包 +bundle-type.mac-pkg=Mac PKG 程序包 +bundle-type.linux-app=Linux 应用程序映像 +bundle-type.linux-deb=DEB 包 +bundle-type.linux-rpm=RPM 包 + resource.post-app-image-script=要在填充应用程序映像之后运行的脚本 message.using-default-resource=使用默认程序包资源 {0} {1}(将 {2} 添加到 resource-dir 中以进行定制)。 -message.no-default-resource=无默认程序包资源 {0} {1}(将 {2} 添加到 resource-dir 中以进行定制)。 +message.no-default-resource=无默认程序包资源 {0}(将 {1} 添加到 resource-dir 中以进行定制)。 message.using-custom-resource-from-file=使用定制程序包资源 {0} (从文件 {1} 加载)。 message.using-custom-resource=使用定制程序包资源 {0} (从 {1} 加载)。 message.creating-app-bundle=正在 {1} 中创建应用程序包 {0} -message.runtime-image-dir-does-not-exist=指定的运行时映像目录 {0}:{1} 不存在 -message.resource-dir-does-not-exist=指定的资源目录 {0}:{1} 不存在 message.debug-working-directory=用于调试的已保留工作目录: {0} message.bundle-created=已成功地构建 {0} 程序包 message.module-version=正在将模块 "{1}" 中的版本 "{0}" 用作应用程序版本 -message.module-class=正在将模块 "{1}" 中的类 "{0}" 用作应用程序主类 + +message.error-header={0} +message.advice-header=修复建议:{0} error.version-string-empty=版本不能为空字符串 error.version-string-zero-length-component=版本 [{0}] 包含长度为零的组件 @@ -50,64 +57,69 @@ error.version-string-invalid-component=版本 [{0}] 包含无效组件 [{1}] error.cannot-create-output-dir=无法创建目标目录 {0} error.cannot-write-to-output-dir=目标目录 {0} 不可写 -error.root-exists=错误:应用程序目标目录 {0} 已存在 +error.root-exists=应用程序目标目录 {0} 已存在 error.no-main-class-with-main-jar=未指定主类,在 jar {0} 中也未找到主类 error.no-main-class-with-main-jar.advice=请指定主类或确保 jar {0} 在清单中指定一个主类。 -error.no-main-class=未指定主类,在提供的应用程序资源中也未找到主类 -error.no-main-class.advice=请指定应用程序类,或者确保 appResources 中有一个 jar 在清单中包含应用程序类。 error.main-jar-does-not-exist=配置的主 jar 在输入目录中不存在 {0} error.main-jar-does-not-exist.advice=必须使用相对于输入目录的路径(不使用绝对路径)指定主 jar ,并且该目录中存在主 jar error.no-module-in-path="无法在模块路径中找到 {0} 模块" -error.not-path-parameter="{0} 参数的值无效:{1}" error.no-input-parameter="非模块化应用程序缺少 --input 参数" +error.non-option-arguments=在命令行上发现 {0} 个非选项参数。不允许使用非选项参数 +error.undefined-default-bundling-operation=未定义默认绑定操作 +error.undefined-default-bundling-operation.advice=将 {0} 参数添加到命令行 +error.parameter-not-uuid=为参数 {1} 提供的值 "{0}" 不是有效的 UUID +error.parameter-not-path=为参数 {1} 提供的值 "{0}" 不是有效路径 +error.parameter-not-file=为参数 {1} 提供的值 "{0}" 不是文件 +error.parameter-not-directory=为参数 {1} 提供的值 "{0}" 不是目录 +error.parameter-not-empty-directory=为参数 {1} 提供的值 "{0}" 不是空目录或是不存在的路径 +error.parameter-not-url=为参数 {1} 提供的值 "{0}" 不是有效的 URL +error.parameter-not-launcher-shortcut-dir=为参数 {1} 提供的值 "{0}" 不是有效的快捷方式启动目录 +error.path-parameter-ioexception=访问参数 {1} 的路径值 "{0}" 时出现 I/O 错误 +error.parameter-add-launcher-malformed=为参数 {1} 提供的值 "{0}" 与模式 = 不匹配 +error.parameter-add-launcher-not-file=为其他启动程序 "{1}" 提供的属性文件 "{0}" 的路径值不是有效的文件路径 +error.properties-parameter-not-path=为 "{2}" 文件中的属性 "{1}" 提供的值 "{0}" 不是有效路径 +error.properties-parameter-not-file=为 "{2}" 文件中的属性 "{1}" 提供的值 "{0}" 不是文件 +error.properties-parameter-not-launcher-shortcut-dir=为 "{2}" 文件中的属性 "{1}" 提供的值 "{0}" 不是有效的快捷方式启动目录 + error.no-content-types-for-file-association=没有为文件关联号{0}指定 MIME 类型 error.no-content-types-for-file-association.advice=为文件关联号 {0} 指定 MIME 类型 error.too-many-content-types-for-file-association=为文件关联号{0}指定了多个 MIME 类型 error.too-many-content-types-for-file-association.advice=仅为文件关联号 {0} 指定一个 MIME 类型 -error.tool-not-found=找不到 {0}。原因:{1} -error.tool-not-found.advice=请安装 {0} -error.tool-old-version=找不到 {0} {1}或更新版本 -error.tool-old-version.advice=请安装 {0} {1}或更新版本 +error.launcher-duplicate-name=多个启动程序具有相同的名称 "{0}"。启动程序应具有唯一名称 + +error.tool-error=无法验证 "{0}"。原因:{1} +error.tool-not-executable="{0}" 不可执行 +error.tool-not-found=找不到 "{0}" +error.tool-not-found.advice=请安装 "{0}" +error.tool-old-version=找不到 "{0}" {1} 或更新版本 +error.tool-old-version.advice=请安装 "{0}" {1} 或更新版本 + error.jlink.failed=jlink 失败,出现 {0} error.blocked.option=不允许在 --jlink-options 中使用 jlink 选项 [{0}] error.no.name=未使用 --name 指定名称,无法从 app-image 推断名称 error.no.name.advice=使用 --name 指定名称 -warning.no.jdk.modules.found=警告: 未找到 JDK 模块 - -error.foreign-app-image=错误:app-image 目录 "{0}" 中缺少 .jpackage.xml 文件 -error.invalid-app-image=错误:另一个 jpackage 版本或格式错误的 "{1}" 文件生成了 app-image 目录 "{0}" +error.missing-app-image-file=预定义的应用程序映像 "{1}" 中缺少 "{0}" 文件 +error.invalid-app-image-file=预定义的应用程序映像 "{1}" 中的 "{0}" 文件已损坏或由其他版本的 jpackage 创建 +error.malformed-app-image-file=预定义的应用程序映像 "{1}" 中的 "{0}" 文件包含格式错误的 XML 数据 +error.reading-app-image-file=无法在预定义的应用程序映像 "{1}" 中读取 "{0}" 文件 error.invalid-install-dir=安装目录 "{0}" 无效 -MSG_BundlerFailed=错误:打包程序 "{1}" ({0}) 无法生成程序包 -MSG_BundlerConfigException=由于配置问题, 跳过了打包程序{0}: {1} \n修复建议: {2} -MSG_BundlerConfigExceptionNoAdvice=由于配置问题, 跳过了打包程序{0}: {1} -MSG_BundlerRuntimeException=由于{1}, 打包程序{0}失败 +ERR_NoMainClass=缺少主应用程序类 +ERR_UnsupportedOption=选项 [{0}] 在此平台上无效 +ERR_InvalidTypeOption=选项 [{0}] 对于类型 [{1}] 无效 +ERR_NoInstallerEntryPoint=在没有 --module 或 --main-jar 入口点选项时,选项 [{0}] 无效 +ERR_MutuallyExclusiveOptions=选项 [{0}] 和 [{1}] 相互排斥 +ERR_InvalidOptionWithAppImageSigning=对应用程序映像进行签名时,选项 [{0}] 无效 -ERR_NoMainClass=错误:缺少主应用程序类 -ERR_UnsupportedOption=错误:选项 [{0}] 在此平台上无效 -ERR_InvalidTypeOption=错误:选项 [{0}] 对于类型 [{1}] 无效 -ERR_NoInstallerEntryPoint=错误:在没有 --module 或 --main-jar 入口点选项时,选项 [{0}] 无效 -ERR_MutuallyExclusiveOptions=错误:选项 [{0}] 和 [{1}] 相互排斥 -ERR_InvalidOptionWithAppImageSigning=错误:对应用程序映像签名时,选项 [{0}] 无效 - -ERR_MissingArgument=错误: 缺少参数: {0} -ERR_MissingRequiredArgument=错误:{0} 参数至少需要 [{1}] 参数之一 -ERR_AppImageNotExist=错误:应用程序映像目录 "{0}" 不存在 -ERR_NoAddLauncherName=错误:--add-launcher 选项需要一个名称和一个文件路径 (--add-launcher =) -ERR_NoUniqueName=错误:--add-launcher = 需要一个唯一的名称 -ERR_InvalidAppName=错误:应用程序名称 {0} 无效 -ERR_InvalidSLName=错误:添加启动程序名称 {0} 无效 -ERR_IconFileNotExit=错误:指定的图标文件 [{0}] 不存在 -ERR_LicenseFileNotExit=错误:指定的许可证文件不存在 -ERR_BuildRootInvalid=错误:临时目录 ({0}) 必须是不存在的目录或空白目录 -ERR_InvalidOption=错误:选项 [{0}] 无效 -ERR_InvalidInstallerType=错误:类型 [{0}] 无效或不受支持 -ERR_BothMainJarAndModule=错误:不能同时包含 --main-jar 和 --module 选项 -ERR_NoEntryPoint=错误:创建应用程序映像需要 --main-jar 或 --module 选项 -ERR_CannotParseOptions=错误:正在处理 @filename 选项:{0} -ERR_MissingJLinkOptMacAppStore=错误:对于 --jlink-options 参数,--mac-app-store 参数需要 {0} 选项 -ERR_MacAppStoreRuntimeBinExists=错误:运行时映像 "{0}" 不应包含 "bin" 文件夹。生成与 --mac-app-store 参数一起使用的运行时映像时,使用 --strip-native-commands jlink 选项。 +ERR_MissingArgument2=缺少参数:{0} 或 {1} +ERR_InvalidAppName=应用程序名称 {0} 无效 +ERR_InvalidSLName=添加启动程序名称 {0} 无效 +ERR_InvalidOption=选项 [{0}] 无效 +ERR_InvalidInstallerType=类型 [{0}] 无效或不受支持 +ERR_NoEntryPoint=创建应用程序映像需要 --main-jar 或 --module 选项 +ERR_CannotParseOptions=正在处理 @filename 选项:{0} +ERR_MissingJLinkOptMacAppStore=对于 --jlink-options 参数,--mac-app-store 参数需要 {0} 选项 diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/FileUtils.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/FileUtils.java index 49c395642f4..2f7f2682a71 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/FileUtils.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/FileUtils.java @@ -37,7 +37,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Optional; import jdk.internal.util.OperatingSystem; -import jdk.jpackage.internal.util.function.ExceptionBox; import jdk.jpackage.internal.util.function.ThrowingConsumer; public final class FileUtils { @@ -170,15 +169,13 @@ public final class FileUtils { } } - private void runActionOnPath(ThrowingConsumer action, Path path) { + private void runActionOnPath(ThrowingConsumer action, Path path) { try { action.accept(path); } catch (IOException ex) { if (this.ex == null) { this.ex = ex; } - } catch (Throwable t) { - throw ExceptionBox.rethrowUnchecked(t); } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/IdentityWrapper.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/IdentityWrapper.java index 0a7a8cc8d4b..7b4c75630ac 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/IdentityWrapper.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/IdentityWrapper.java @@ -69,5 +69,9 @@ public final class IdentityWrapper { return String.format("Identity[%s]", value); } + public static IdentityWrapper wrapIdentity(T v) { + return new IdentityWrapper<>(v); + } + private final T value; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/Result.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/Result.java index 8a61acafe77..46e99f134df 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/Result.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/Result.java @@ -24,33 +24,28 @@ */ package jdk.jpackage.internal.util; -import static jdk.jpackage.internal.util.function.ExceptionBox.rethrowUnchecked; - import java.util.Collection; import java.util.List; +import java.util.Objects; import java.util.Optional; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; -import java.util.function.UnaryOperator; import java.util.stream.StreamSupport; +import jdk.jpackage.internal.util.function.ExceptionBox; +import jdk.jpackage.internal.util.function.ThrowingSupplier; public record Result(Optional value, Collection errors) { public Result { if (value.isEmpty() == errors.isEmpty()) { - throw new IllegalArgumentException(); + throw new IllegalArgumentException("'value' and 'errors' cannot both be non-empty or both be empty"); } - - if (value.isEmpty() && errors.isEmpty()) { - throw new IllegalArgumentException("Error collection must be non-empty"); - } - } public T orElseThrow() { firstError().ifPresent(ex -> { - rethrowUnchecked(ex); + throw ExceptionBox.toUnchecked(ex); }); return value.orElseThrow(); } @@ -64,7 +59,16 @@ public record Result(Optional value, Collection error } public Result map(Function conv) { - return new Result<>(value.map(conv), errors); + if (hasValue()) { + var mapped = value.map(conv); + if (mapped.isEmpty()) { + throw new NullPointerException(); + } else { + return new Result<>(mapped, errors); + } + } else { + return mapErrors(); + } } public Result flatMap(Function> conv) { @@ -73,12 +77,12 @@ public record Result(Optional value, Collection error }); } - public Result mapErrors(UnaryOperator> errorsMapper) { - return new Result<>(value, errorsMapper.apply(errors)); - } - + @SuppressWarnings("unchecked") public Result mapErrors() { - return new Result<>(Optional.empty(), errors); + if (hasValue()) { + throw new IllegalStateException("Can not map errors from a result without errors"); + } + return (Result)this; } public Result peekErrors(Consumer> consumer) { @@ -97,12 +101,31 @@ public record Result(Optional value, Collection error return errors.stream().findFirst(); } - public static Result create(Supplier supplier) { + public static Result of(Supplier supplier) { + return of(supplier::get, RuntimeException.class); + } + + public static Result of( + ThrowingSupplier supplier, Class supplierExceptionType) { + + Objects.requireNonNull(supplier); + Objects.requireNonNull(supplierExceptionType); + + T value; try { - return ofValue(supplier.get()); + value = supplier.get(); } catch (Exception ex) { - return ofError(ex); + if (supplierExceptionType.isInstance(ex)) { + return ofError(ex); + } else if (ex instanceof RuntimeException rex) { + throw rex; + } else { + // Unreachable because the `supplier` can throw exceptions of type or supertype `E` or runtime exceptions. + throw ExceptionBox.reachedUnreachable(); + } } + + return ofValue(value); } public static Result ofValue(T value) { diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/SetBuilder.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/SetBuilder.java index 18736b4ed7e..d3d677cba50 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/SetBuilder.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/SetBuilder.java @@ -31,7 +31,7 @@ import java.util.Set; public final class SetBuilder { - public static SetBuilder build(Class type) { + public static SetBuilder build() { return new SetBuilder<>(); } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlUtils.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlUtils.java index c8761259254..f62ffee9260 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlUtils.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlUtils.java @@ -24,7 +24,7 @@ */ package jdk.jpackage.internal.util; -import static jdk.jpackage.internal.util.function.ExceptionBox.rethrowUnchecked; +import static jdk.jpackage.internal.util.function.ExceptionBox.toUnchecked; import java.io.IOException; import java.io.Writer; @@ -80,7 +80,7 @@ public final class XmlUtils { xml.flush(); xml.close(); } catch (XMLStreamException ex) { - throw rethrowUnchecked(ex); + throw toUnchecked(ex); } } @@ -101,7 +101,7 @@ public final class XmlUtils { xml.flush(); xml.close(); } catch (XMLStreamException ex) { - throw rethrowUnchecked(ex); + throw toUnchecked(ex); } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ExceptionBox.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ExceptionBox.java index 8428d5d1e7f..40503469873 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ExceptionBox.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ExceptionBox.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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,55 @@ public class ExceptionBox extends RuntimeException { private static final long serialVersionUID = 1L; - public static RuntimeException rethrowUnchecked(Throwable throwable) { - if (throwable instanceof RuntimeException err) { - throw err; + public static RuntimeException toUnchecked(Exception ex) { + switch (ex) { + case RuntimeException rex -> { + return rex; + } + case InvocationTargetException itex -> { + var t = itex.getCause(); + if (t instanceof Exception cause) { + return toUnchecked(cause); + } else { + throw (Error)t; + } + } + case InterruptedException _ -> { + Thread.currentThread().interrupt(); + return new ExceptionBox(ex); + } + default -> { + return new ExceptionBox(ex); + } } - - if (throwable instanceof Error err) { - throw err; - } - - if (throwable instanceof InvocationTargetException err) { - throw rethrowUnchecked(err.getCause()); - } - - throw new ExceptionBox(throwable); } - private ExceptionBox(Throwable throwable) { - super(throwable); + public static Exception unbox(Throwable t) { + switch (t) { + case ExceptionBox ex -> { + return unbox(ex.getCause()); + } + case InvocationTargetException ex -> { + return unbox(ex.getCause()); + } + case Exception ex -> { + return ex; + } + case Error err -> { + throw err; + } + default -> { + // Unreachable + throw reachedUnreachable(); + } + } + } + + public static Error reachedUnreachable() { + return new AssertionError("Reached unreachable!"); + } + + private ExceptionBox(Exception ex) { + super(ex); } } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiConsumer.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiConsumer.java index 3ed0fd67d84..374eaf803d9 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiConsumer.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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,17 +27,17 @@ package jdk.jpackage.internal.util.function; import java.util.function.BiConsumer; @FunctionalInterface -public interface ThrowingBiConsumer { +public interface ThrowingBiConsumer { - void accept(T t, U u) throws Throwable; + void accept(T t, U u) throws E; public static BiConsumer toBiConsumer( - ThrowingBiConsumer v) { + ThrowingBiConsumer v) { return (t, u) -> { try { v.accept(t, u); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiFunction.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiFunction.java index 8c2df773eb5..13b0b53c887 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiFunction.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingBiFunction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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,17 +27,17 @@ package jdk.jpackage.internal.util.function; import java.util.function.BiFunction; @FunctionalInterface -public interface ThrowingBiFunction { +public interface ThrowingBiFunction { - R apply(T t, U u) throws Throwable; + R apply(T t, U u) throws E; public static BiFunction toBiFunction( - ThrowingBiFunction v) { + ThrowingBiFunction v) { return (t, u) -> { try { return v.apply(t, u); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingConsumer.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingConsumer.java index ef1b0a61df7..38342a361c0 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingConsumer.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingConsumer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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,16 +27,16 @@ package jdk.jpackage.internal.util.function; import java.util.function.Consumer; @FunctionalInterface -public interface ThrowingConsumer { +public interface ThrowingConsumer { - void accept(T t) throws Throwable; + void accept(T t) throws E; - public static Consumer toConsumer(ThrowingConsumer v) { + public static Consumer toConsumer(ThrowingConsumer v) { return o -> { try { v.accept(o); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingFunction.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingFunction.java index 2b5eae43842..5bbfb254858 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingFunction.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingFunction.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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,16 +27,16 @@ package jdk.jpackage.internal.util.function; import java.util.function.Function; @FunctionalInterface -public interface ThrowingFunction { +public interface ThrowingFunction { - R apply(T t) throws Throwable; + R apply(T t) throws E; - public static Function toFunction(ThrowingFunction v) { + public static Function toFunction(ThrowingFunction v) { return t -> { try { return v.apply(t); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingRunnable.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingRunnable.java index 7c75c4d9753..f3ce5affbbf 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingRunnable.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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,16 +25,16 @@ package jdk.jpackage.internal.util.function; @FunctionalInterface -public interface ThrowingRunnable { +public interface ThrowingRunnable { - void run() throws Throwable; + void run() throws E; - public static Runnable toRunnable(ThrowingRunnable v) { + public static Runnable toRunnable(ThrowingRunnable v) { return () -> { try { v.run(); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingSupplier.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingSupplier.java index c69c4729190..4f194a0f4d2 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingSupplier.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingSupplier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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,16 +27,16 @@ package jdk.jpackage.internal.util.function; import java.util.function.Supplier; @FunctionalInterface -public interface ThrowingSupplier { +public interface ThrowingSupplier { - T get() throws Throwable; + T get() throws E; - public static Supplier toSupplier(ThrowingSupplier v) { + public static Supplier toSupplier(ThrowingSupplier v) { return () -> { try { return v.get(); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingUnaryOperator.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingUnaryOperator.java index 7a2a0fd67cf..3d757bbec48 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingUnaryOperator.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/function/ThrowingUnaryOperator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, 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,17 +27,17 @@ package jdk.jpackage.internal.util.function; import java.util.function.UnaryOperator; @FunctionalInterface -public interface ThrowingUnaryOperator { +public interface ThrowingUnaryOperator { - T apply(T t) throws Throwable; + T apply(T t) throws E; public static UnaryOperator toUnaryOperator( - ThrowingUnaryOperator v) { + ThrowingUnaryOperator v) { return t -> { try { return v.apply(t); - } catch (Throwable ex) { - throw ExceptionBox.rethrowUnchecked(ex); + } catch (Exception ex) { + throw ExceptionBox.toUnchecked(ex); } }; } diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinBundlingEnvironment.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinBundlingEnvironment.java index 38547999290..dc9891f154a 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinBundlingEnvironment.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinBundlingEnvironment.java @@ -24,7 +24,7 @@ */ package jdk.jpackage.internal; -import static jdk.jpackage.internal.WinFromOpions.createWinApplication; +import static jdk.jpackage.internal.WinFromOptions.createWinApplication; import static jdk.jpackage.internal.WinPackagingPipeline.APPLICATION_LAYOUT; import static jdk.jpackage.internal.cli.StandardBundlingOperation.CREATE_WIN_APP_IMAGE; import static jdk.jpackage.internal.cli.StandardBundlingOperation.CREATE_WIN_EXE; @@ -46,7 +46,7 @@ public class WinBundlingEnvironment extends DefaultBundlingEnvironment { private static void createMsiPackage(Options options, WinSystemEnvironment sysEnv) { createNativePackage(options, - WinFromOpions::createWinMsiPackage, + WinFromOptions.createWinMsiPackage(options), buildEnv()::create, WinPackagingPipeline.build(), (env, pkg, outputDir) -> { @@ -60,7 +60,7 @@ public class WinBundlingEnvironment extends DefaultBundlingEnvironment { private static void createExePackage(Options options, WinSystemEnvironment sysEnv) { createNativePackage(options, - WinFromOpions::createWinExePackage, + WinFromOptions.createWinExePackage(options), buildEnv()::create, WinPackagingPipeline.build(), (env, pkg, outputDir) -> { diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinFromOpions.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinFromOptions.java similarity index 99% rename from src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinFromOpions.java rename to src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinFromOptions.java index 6fd6d0a7b96..6009e2f6724 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinFromOpions.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinFromOptions.java @@ -49,7 +49,7 @@ import jdk.jpackage.internal.model.WinLauncher; import jdk.jpackage.internal.model.WinLauncherMixin; import jdk.jpackage.internal.model.WinMsiPackage; -final class WinFromOpions { +final class WinFromOptions { static WinApplication createWinApplication(Options options) { diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinSystemEnvironment.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinSystemEnvironment.java index ab0cc37b9fe..c0bea444e00 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinSystemEnvironment.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/WinSystemEnvironment.java @@ -34,6 +34,6 @@ record WinSystemEnvironment(WixToolset wixToolset) implements SystemEnvironment } static Result create() { - return Result.create(WixTool::createToolset).map(WinSystemEnvironment::new); + return Result.of(WixTool::createToolset).map(WinSystemEnvironment::new); } } diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/model/WinApplicationMixin.java b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/model/WinApplicationMixin.java index 283b5d84ae3..fde29980599 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/model/WinApplicationMixin.java +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/model/WinApplicationMixin.java @@ -30,7 +30,15 @@ public interface WinApplicationMixin { record Stub(DottedVersion winVersion) implements WinApplicationMixin { public Stub(Application app) { - this(DottedVersion.greedy(app.version())); + this(parse(app.version())); + } + + private static DottedVersion parse(String strVersion) { + try { + return DottedVersion.greedy(strVersion); + } catch (IllegalArgumentException ex) { + throw new JPackageException(ex.getMessage(), ex); + } } } } diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties index 3e6f8e30d6a..baaba64b398 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_de.properties @@ -23,15 +23,9 @@ # questions. # # - -app.bundler.name=Windows-Anwendungsimage -exe.bundler.name=EXE-Installationsprogrammpackage -msi.bundler.name=MSI-Installationsprogrammpackage - param.menu-group.default=Unbekannt resource.executable-properties-template=Vorlage für das Erstellen der ausführbaren Eigenschaftendatei -resource.setup-icon=Symbol für Dialogfeld "Setup" resource.post-msi-script=Auszuführendes Skript nach dem Erstellen der MSI-Datei für das EXE-Installationsprogramm resource.wxl-file=WiX-Lokalisierungsdatei resource.main-wix-file=Haupt-WiX-Projektdatei @@ -65,12 +59,10 @@ message.potential.windows.defender.issue=Warnung: Windows Defender verhindert ev message.outputting-to-location=EXE für Installationsprogramm wird generiert in: {0}. message.output-location=Installationsprogramm (.exe) gespeichert in: {0} message.tool-version=[{0}]-Version [{1}] erkannt. -message.creating-association-with-null-extension=Verknüpfung mit Nullerweiterung wird erstellt. message.wrong-tool-version=[{0}]-Version {1} wurde erkannt. Erforderlich ist jedoch Version {2}. message.use-wix36-features=WiX {0} erkannt. Erweiterte Bereinigungsaktion wird aktiviert. message.product-code=MSI-ProductCode: {0}. message.upgrade-code=MSI-UpgradeCode: {0}. message.preparing-msi-config=MSI-Konfiguration wird vorbereitet: {0}. message.generating-msi=MSI wird generiert: {0}. -message.invalid.install.dir=Warnung: Ungültiges Installationsverzeichnis {0}. Installationsverzeichnis muss ein relativer Unterpfad unter dem Standardinstallationsverzeichnis wie "Programme" sein. Der Anwendungsname "{1}" wird als Standardwert verwendet. diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties index 07604dc9980..119c7532b1f 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_ja.properties @@ -23,15 +23,9 @@ # questions. # # - -app.bundler.name=Windowsアプリケーション・イメージ -exe.bundler.name=EXEインストーラ・パッケージ -msi.bundler.name=MSIインストーラ・パッケージ - param.menu-group.default=不明 resource.executable-properties-template=実行可能なプロパティ・ファイル作成用のテンプレート -resource.setup-icon=設定ダイアログ・アイコン resource.post-msi-script=exeインストーラのmsiファイルが作成された後に実行するスクリプト resource.wxl-file=WiXローカリゼーション・ファイル resource.main-wix-file=メインWiXプロジェクト・ファイル @@ -65,12 +59,10 @@ message.potential.windows.defender.issue=警告: Windows Defenderが原因でjpa message.outputting-to-location=インストーラのEXEを次に生成しています: {0} message.output-location=インストーラ(.exe)は次に保存されました: {0} message.tool-version=[{0}]バージョン[{1}]が検出されました。 -message.creating-association-with-null-extension=null拡張子との関連付けを作成しています。 message.wrong-tool-version=[{0}]バージョン{1}が検出されましたが、バージョン{2}が必要です。 message.use-wix36-features=WiX {0}が検出されました。拡張クリーンアップ・アクションを有効化しています。 message.product-code=MSI ProductCode: {0}。 message.upgrade-code=MSI UpgradeCode: {0}。 message.preparing-msi-config=MSI構成を準備しています: {0} message.generating-msi=MSIを生成しています: {0}。 -message.invalid.install.dir=警告: インストール・ディレクトリ{0}が無効です。インストール・ディレクトリはデフォルトのインストール場所("プログラム・ファイル"など)の下の相対サブパスである必要があります。アプリケーション名"{1}"にデフォルト設定されています。 diff --git a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties index 7eae69fba2f..66d8a9d8b96 100644 --- a/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties +++ b/src/jdk.jpackage/windows/classes/jdk/jpackage/internal/resources/WinResources_zh_CN.properties @@ -23,15 +23,9 @@ # questions. # # - -app.bundler.name=Windows 应用程序映像 -exe.bundler.name=EXE 安装程序包 -msi.bundler.name=MSI 安装程序包 - param.menu-group.default=未知 resource.executable-properties-template=用于创建可执行属性文件的模板 -resource.setup-icon=设置对话框图标 resource.post-msi-script=在为 exe 安装程序创建 msi 文件之后要运行的脚本 resource.wxl-file=WiX 本地化文件 resource.main-wix-file=主 WiX 项目文件 @@ -65,12 +59,10 @@ message.potential.windows.defender.issue=警告:Windows Defender 可能会阻 message.outputting-to-location=正在为安装程序生成 EXE, 位置: {0}。 message.output-location=安装程序 (.exe) 已保存到: {0} message.tool-version=检测到 [{0}] 版本 [{1}]。 -message.creating-association-with-null-extension=正在使用空扩展名创建关联。 message.wrong-tool-version=检测到 [{0}] 版本 {1}, 但需要版本 {2}。 message.use-wix36-features=检测到 WiX {0}。正在启用高级清除操作。 message.product-code=MSI ProductCode:{0}。 message.upgrade-code=MSI UpgradeCode:{0}。 message.preparing-msi-config=正在准备 MSI 配置: {0}。 message.generating-msi=正在生成 MSI: {0}。 -message.invalid.install.dir=警告:安装目录 {0} 无效。安装目录应当是默认安装位置(如 "Program Files")下面的相对子路径。默认为应用程序名称 "{1}"。 diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java index 795321253fd..9a030f7e46b 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java @@ -3362,7 +3362,19 @@ public class JShellTool implements MessageHandler { // error occurred, already reported return false; } - try (BufferedWriter writer = Files.newBufferedWriter(toPathResolvingUserHome(filename), + // Create missing parent directories before writing to target file + Path target; + try { + target = toPathResolvingUserHome(filename); + Path parent = target.getParent(); + if (parent != null) { + Files.createDirectories(parent); + } + } catch (Exception e) { + errormsg("jshell.err.file.exception", "/save", filename, e); + return false; + } + try (BufferedWriter writer = Files.newBufferedWriter(target, Charset.defaultCharset(), CREATE, TRUNCATE_EXISTING, WRITE)) { if (at.hasOption("-history")) { diff --git a/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java b/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java index d5fedf93855..994757f17c3 100644 --- a/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java +++ b/src/jdk.management/share/classes/com/sun/management/DiagnosticCommandMBean.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, 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 @@ -135,7 +135,7 @@ import javax.management.DynamicMBean; * * * dcmd.enabledboolean - * True if the diagnostic command is enabled, false otherwise + * This field is always true -- diagnostic commands cannot be disabled. * * * dcmd.argumentsDescriptor diff --git a/src/jdk.management/share/classes/com/sun/management/internal/HotSpotAOTCacheImpl.java b/src/jdk.management/share/classes/com/sun/management/internal/HotSpotAOTCacheImpl.java new file mode 100644 index 00000000000..4bb556455ea --- /dev/null +++ b/src/jdk.management/share/classes/com/sun/management/internal/HotSpotAOTCacheImpl.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2025, Microsoft, Inc. 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.management.internal; + +import javax.management.ObjectName; +import jdk.management.HotSpotAOTCacheMXBean; +import sun.management.Util; +import sun.management.VMManagement; + +/** + * Implementation class for the AOT Cache subsystem. + * + * ManagementFactory.getRuntimeMXBean() returns an instance + * of this class. + */ +public class HotSpotAOTCacheImpl implements HotSpotAOTCacheMXBean { + + private final VMManagement jvm; + /** + * Constructor of HotSpotAOTCacheImpl class. + */ + HotSpotAOTCacheImpl(VMManagement vm) { + this.jvm = vm; + } + + public boolean endRecording() { + return jvm.endAOTRecording(); + } + + public ObjectName getObjectName() { + return Util.newObjectName("jdk.management:type=HotSpotAOTCache"); + } +} \ No newline at end of file diff --git a/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java b/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java index 3a64fe6b858..b000516e626 100644 --- a/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java +++ b/src/jdk.management/share/classes/com/sun/management/internal/PlatformMBeanProviderImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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,7 @@ import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; import javax.management.DynamicMBean; +import jdk.management.HotSpotAOTCacheMXBean; import jdk.management.VirtualThreadSchedulerMXBean; import sun.management.ManagementFactoryHelper; import sun.management.spi.PlatformMBeanProvider; @@ -159,6 +160,41 @@ public final class PlatformMBeanProviderImpl extends PlatformMBeanProvider { } }); + /** + * HotSpotAOTCacheMXBean. + */ + initMBeanList.add(new PlatformComponent() { + private final Set> mbeanInterfaces = + Set.of(HotSpotAOTCacheMXBean.class); + private final Set mbeanInterfaceNames = + Set.of(HotSpotAOTCacheMXBean.class.getName()); + private HotSpotAOTCacheMXBean impl; + + @Override + public Set> mbeanInterfaces() { + return mbeanInterfaces; + } + + @Override + public Set mbeanInterfaceNames() { + return mbeanInterfaceNames; + } + + @Override + public String getObjectNamePattern() { + return "jdk.management:type=HotSpotAOTCache"; + } + + @Override + public Map nameToMBeanMap() { + HotSpotAOTCacheMXBean impl = this.impl; + if (impl == null) { + this.impl = impl = new HotSpotAOTCacheImpl(ManagementFactoryHelper.getVMManagement()); + } + return Map.of("jdk.management:type=HotSpotAOTCache", impl); + } + }); + /** * VirtualThreadSchedulerMXBean. */ diff --git a/src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java b/src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java new file mode 100644 index 00000000000..4a921c348d0 --- /dev/null +++ b/src/jdk.management/share/classes/jdk/management/HotSpotAOTCacheMXBean.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2025, Microsoft, Inc. 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 jdk.management; + +import java.lang.management.ManagementFactory; +import java.lang.management.PlatformManagedObject; +import javax.management.MBeanServer; +import javax.management.ObjectName; + +/** + * Management interface for the JDK's Ahead of Time (AOT) Cache. + * + *

    The management interface is registered with the platform {@link MBeanServer + * MBeanServer}. The {@link ObjectName ObjectName} that uniquely identifies the management + * interface within the {@code MBeanServer} is {@code jdk.management:type=HotSpotAOTCache}. + * + *

    Direct access to the MXBean interface can be obtained with + * {@link ManagementFactory#getPlatformMXBean(Class)}. + * + * @since 27 + */ +public interface HotSpotAOTCacheMXBean extends PlatformManagedObject { + /** + * If an AOT recording is in progress, ends the recording. This method returns + * after the AOT artifacts have been completely written. + * + *

    The JVM will start recording AOT artifacts upon start-up if appropriate JVM options are + * given in the command-line. The recording will stop when the JVM exits, or when + * the {@code endRecording} method is called. Examples: + * + *

    ${@code java -XX:AOTCacheOutput=app.aot ....} + * + *

    + * The JVM records optimization information for the current application in the AOT cache file + * {@code app.aot}. In a future run of the application, the option {@code -XX:AOTCache=app.aot} will + * cause the JVM to use the cache to improve the application's startup and warmup performance. + *
    + * + *

    ${@code java -XX:AOTMode=record -XX:AOTConfiguration=app.aotconfig ....} + * + *

    + * The JVM records optimization information for the current application in the AOT configuration + * file {@code app.aotconfig}. Subsequently, an AOT cache file can be created with the command: + * + *

    ${@code java -XX:AOTMode=create -XX:AOTConfiguration=app.aotconfig -XX:AOTCache=app.aot ...} + *

    + * + *

    For more information about creating and using the AOT artifacts, and detailed + * specification of the corresponding JVM command-line options, please refer + * to JEP 483 and JEP 514. + * + *

    Currently there are no APIs to start an AOT recording. AOT recordings must be + * started using JVM command-line options such as {@code -XX:AOTCacheOutput}. + * There are also no APIs to query whether an AOT recording is in progress, or what AOT + * artifacts are being recorded. + * + *

    This method enables an application to end its own AOT recording + * programatically, but that is not necessarily the best approach. Doing so + * requires changing the application’s code, which might not be + * feasible. Even when it is feasible, injecting training-specific logic + * into the application reduces the similarity between training runs and + * production runs, potentially making the AOT cache less effective. It may + * be better to arrange for an external agent to end the training run, + * thereby creating an AOT cache without interfering with the application’s + * code. + * + * @return {@code true} if a recording was in progress and has been ended + * successfully; {@code false} otherwise. + */ + public boolean endRecording(); +} diff --git a/test/docs/ProblemList.txt b/test/docs/ProblemList.txt index 4df8bbcc53c..c846678665d 100644 --- a/test/docs/ProblemList.txt +++ b/test/docs/ProblemList.txt @@ -39,7 +39,3 @@ # More than one label is allowed but must be on the same line. # ############################################################################# - -jdk/javadoc/doccheck/checks/jdkCheckLinks.java 8370249 generic-all -jdk/javadoc/doccheck/checks/jdkCheckHtml.java 8370970 generic-all -jdk/javadoc/doccheck/checks/jdkDoctypeBadcharsCheck.java 8370970 generic-all diff --git a/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldGeneration.cpp b/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldGeneration.cpp index b2491226e5c..4167e33b706 100644 --- a/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldGeneration.cpp +++ b/test/hotspot/gtest/gc/shenandoah/test_shenandoahOldGeneration.cpp @@ -165,35 +165,12 @@ TEST_VM_F(ShenandoahOldGenerationTest, test_actual_size_exceeds_promotion_reserv EXPECT_FALSE(promotions_enabled()) << "New plab can only be used for evacuations"; } -TEST_VM_F(ShenandoahOldGenerationTest, test_shared_expends_promoted_but_does_not_change_plab) { +TEST_VM_F(ShenandoahOldGenerationTest, test_expend_promoted_should_increase_expended) { SKIP_IF_NOT_SHENANDOAH(); - ShenandoahAllocRequest req = ShenandoahAllocRequest::for_shared_gc(128, ShenandoahAffiliation::OLD_GENERATION, true); - req.set_actual_size(128); - size_t actual_size = req.actual_size() * HeapWordSize; - size_t expended_before = old->get_promoted_expended(); - old->configure_plab_for_current_thread(req); + old->expend_promoted(128); size_t expended_after = old->get_promoted_expended(); - - EXPECT_EQ(expended_before + actual_size, expended_after) << "Shared promotion still expends promotion"; - EXPECT_EQ(plab_promoted(), INITIAL_PLAB_PROMOTED) << "Shared promotion should not count in plab"; - EXPECT_EQ(plab_size(), INITIAL_PLAB_SIZE) << "Shared promotion should not change size of plab"; - EXPECT_FALSE(promotions_enabled()); -} - -TEST_VM_F(ShenandoahOldGenerationTest, test_shared_evacuation_has_no_side_effects) { - SKIP_IF_NOT_SHENANDOAH(); - ShenandoahAllocRequest req = ShenandoahAllocRequest::for_shared_gc(128, ShenandoahAffiliation::OLD_GENERATION, false); - req.set_actual_size(128); - - size_t expended_before = old->get_promoted_expended(); - old->configure_plab_for_current_thread(req); - size_t expended_after = old->get_promoted_expended(); - - EXPECT_EQ(expended_before, expended_after) << "Not a promotion, should not expend promotion reserve"; - EXPECT_EQ(plab_promoted(), INITIAL_PLAB_PROMOTED) << "Not a plab, should not have touched plab"; - EXPECT_EQ(plab_size(), INITIAL_PLAB_SIZE) << "Not a plab, should not have touched plab"; - EXPECT_FALSE(promotions_enabled()); + EXPECT_EQ(expended_before + 128, expended_after) << "Should expend promotion"; } #undef SKIP_IF_NOT_SHENANDOAH diff --git a/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp b/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp index 69548b06e51..8625f64099d 100644 --- a/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp +++ b/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp @@ -34,13 +34,12 @@ #include "jfr/utilities/jfrAllocation.hpp" #include "jfr/utilities/jfrRandom.inline.hpp" -#include "jfr/utilities/jfrSpinlockHelper.hpp" #include "jfr/utilities/jfrTime.hpp" #include "jfr/utilities/jfrTimeConverter.hpp" #include "jfr/utilities/jfrTryLock.hpp" #include "logging/log.hpp" -#include "runtime/atomicAccess.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/spinCriticalSection.hpp" #include "unittest.hpp" #include diff --git a/test/hotspot/gtest/opto/test_rangeinference.cpp b/test/hotspot/gtest/opto/test_rangeinference.cpp index 1a62941a486..61a9ff7fb70 100644 --- a/test/hotspot/gtest/opto/test_rangeinference.cpp +++ b/test/hotspot/gtest/opto/test_rangeinference.cpp @@ -25,15 +25,16 @@ #include "opto/rangeinference.hpp" #include "opto/type.hpp" #include "runtime/os.hpp" -#include "utilities/intn_t.hpp" #include "unittest.hpp" +#include "utilities/intn_t.hpp" +#include "utilities/rbTree.hpp" +#include +#include +#include template -static U uniform_random(); - -template <> -juint uniform_random() { - return os::random(); +static U uniform_random() { + return U(juint(os::random())); } template <> @@ -201,7 +202,7 @@ static void test_canonicalize_constraints_random() { } } -TEST_VM(opto, canonicalize_constraints) { +TEST(opto, canonicalize_constraints) { test_canonicalize_constraints_trivial(); test_canonicalize_constraints_exhaustive, uintn_t<1>>(); test_canonicalize_constraints_exhaustive, uintn_t<2>>(); @@ -212,3 +213,413 @@ TEST_VM(opto, canonicalize_constraints) { test_canonicalize_constraints_random(); test_canonicalize_constraints_random(); } + +// Implementations of TypeIntMirror methods for testing purposes +template +const TypeIntMirror* TypeIntMirror::operator->() const { + return this; +} + +template +TypeIntMirror TypeIntMirror::meet(const TypeIntMirror& o) const { + return TypeIntHelper::int_type_union(*this, o); +} + +template +bool TypeIntMirror::contains(U u) const { + S s = S(u); + return s >= _lo && s <= _hi && u >= _ulo && u <= _uhi && _bits.is_satisfied_by(u); +} + +template +bool TypeIntMirror::contains(const TypeIntMirror& o) const { + return TypeIntHelper::int_type_is_subset(*this, o); +} + +template +bool TypeIntMirror::operator==(const TypeIntMirror& o) const { + return TypeIntHelper::int_type_is_equal(*this, o); +} + +template +template +TypeIntMirror TypeIntMirror::cast() const { + static_assert(std::is_same_v); + return *this; +} + +// The number of TypeIntMirror instances for integral types with a few bits. These values are +// calculated once and written down for usage in constexpr contexts. +template +static constexpr size_t all_instances_size() { + using U = decltype(CTP::_ulo); + constexpr juint max_unsigned = juint(std::numeric_limits::max()); + if constexpr (max_unsigned == 1U) { + // 1 bit + return 3; + } else if constexpr (max_unsigned == 3U) { + // 2 bits + return 15; + } else if constexpr (max_unsigned == 7U) { + // 3 bits + return 134; + } else { + // 4 bits + static_assert(max_unsigned == 15U); + // For more than 4 bits, the number of instances is too large and it is not realistic to + // compute all of them. + return 1732; + } +} + +template +static std::array()> compute_all_instances() { + using S = decltype(CTP::_lo); + using U = decltype(CTP::_ulo); + + class CTPComparator { + public: + static RBTreeOrdering cmp(const CTP& x, const RBNode* node) { + // Quick helper for the tediousness below + auto f = [](auto x, auto y) { + assert(x != y, "we only handle lt and gt cases"); + return x < y ? RBTreeOrdering::LT : RBTreeOrdering::GT; + }; + + const CTP& y = node->key(); + if (x._lo != y._lo) { + return f(x._lo, y._lo); + } else if (x._hi != y._hi) { + return f(x._hi, y._hi); + } else if (x._ulo != y._ulo) { + return f(x._ulo, y._ulo); + } else if (x._uhi != y._uhi) { + return f(x._uhi, y._uhi); + } else if (x._bits._zeros != y._bits._zeros) { + return f(x._bits._zeros, y._bits._zeros); + } else if (x._bits._ones != y._bits._ones) { + return f(x._bits._ones, y._bits._ones); + } else { + return RBTreeOrdering::EQ; + } + } + }; + + RBTreeCHeap collector; + for (jint lo = jint(std::numeric_limits::min()); lo <= jint(std::numeric_limits::max()); lo++) { + for (jint hi = lo; hi <= jint(std::numeric_limits::max()); hi++) { + for (juint ulo = 0; ulo <= juint(std::numeric_limits::max()); ulo++) { + for (juint uhi = ulo; uhi <= juint(std::numeric_limits::max()); uhi++) { + for (juint zeros = 0; zeros <= juint(std::numeric_limits::max()); zeros++) { + for (juint ones = 0; ones <= juint(std::numeric_limits::max()); ones++) { + TypeIntPrototype t{{S(lo), S(hi)}, {U(ulo), U(uhi)}, {U(zeros), U(ones)}}; + auto canonicalized_t = t.canonicalize_constraints(); + if (canonicalized_t.empty()) { + continue; + } + + TypeIntPrototype ct = canonicalized_t._data; + collector.upsert(CTP{ct._srange._lo, ct._srange._hi, ct._urange._lo, ct._urange._hi, ct._bits}, 0); + } + } + } + } + } + } + + assert(collector.size() == all_instances_size(), "unexpected size of all_instance, expected %d, actual %d", jint(all_instances_size()), jint(collector.size())); + std::array()> res; + size_t idx = 0; + collector.visit_in_order([&](RBNode* node) { + res[idx] = node->key(); + idx++; + return true; + }); + return res; +} + +template +static const std::array()>& all_instances() { + static std::array()> res = compute_all_instances(); + static_assert(std::is_trivially_destructible_v); + return res; +} + +// Check the correctness, that is, if v1 is an element of input1, v2 is an element of input2, then +// op(v1, v2) must be an element of infer(input1, input2). This version does the check exhaustively +// on all elements of input1 and input2. +template +static void test_binary_instance_correctness_exhaustive(Operation op, Inference infer, const InputType& input1, const InputType& input2) { + using S = std::remove_const_t_lo)>; + using U = std::remove_const_t_ulo)>; + InputType result = infer(input1, input2); + + for (juint v1 = juint(std::numeric_limits::min()); v1 <= juint(std::numeric_limits::max()); v1++) { + if (!input1.contains(U(v1))) { + continue; + } + + for (juint v2 = juint(std::numeric_limits::min()); v2 <= juint(std::numeric_limits::max()); v2++) { + if (!input2.contains(U(v2))) { + continue; + } + + U r = op(U(v1), U(v2)); + ASSERT_TRUE(result.contains(r)); + } + } +} + +// Check the correctness, that is, if v1 is an element of input1, v2 is an element of input2, then +// op(v1, v2) must be an element of infer(input1, input2). This version does the check randomly on +// a number of elements in input1 and input2. +template +static void test_binary_instance_correctness_samples(Operation op, Inference infer, const InputType& input1, const InputType& input2) { + using U = std::remove_const_t_ulo)>; + auto result = infer(input1, input2); + + constexpr size_t sample_count = 6; + U input1_samples[sample_count] {U(input1._lo), U(input1._hi), input1._ulo, input1._uhi, input1._ulo, input1._ulo}; + U input2_samples[sample_count] {U(input2._lo), U(input2._hi), input2._ulo, input2._uhi, input2._ulo, input2._ulo}; + + auto random_sample = [](U* samples, const InputType& input) { + constexpr size_t max_tries = 100; + constexpr size_t start_random_idx = 4; + for (size_t tries = 0, idx = start_random_idx; tries < max_tries && idx < sample_count; tries++) { + U n = uniform_random(); + if (input.contains(n)) { + samples[idx] = n; + idx++; + } + } + }; + random_sample(input1_samples, input1); + random_sample(input2_samples, input2); + + for (size_t i = 0; i < sample_count; i++) { + for (size_t j = 0; j < sample_count; j++) { + U r = op(input1_samples[i], input2_samples[j]); + ASSERT_TRUE(result.contains(r)); + } + } +} + +// Check the monotonicity, that is, if input1 is a subset of super1, input2 is a subset of super2, +// then infer(input1, input2) must be a subset of infer(super1, super2). This version does the +// check exhaustively on all supersets of input1 and input2. +template +static void test_binary_instance_monotonicity_exhaustive(Inference infer, const InputType& input1, const InputType& input2) { + InputType result = infer(input1, input2); + + for (const InputType& super1 : all_instances()) { + if (!super1.contains(input1) || super1 == input1) { + continue; + } + + for (const InputType& super2 : all_instances()) { + if (!super2.contains(input2) || super2 == input2) { + continue; + } + + ASSERT_TRUE(infer(input1, super2).contains(result)); + ASSERT_TRUE(infer(super1, input2).contains(result)); + ASSERT_TRUE(infer(super1, super2).contains(result)); + } + } +} + +// Check the monotonicity, that is, if input1 is a subset of super1, input2 is a subset of super2, +// then infer(input1, input2) must be a subset of infer(super1, super2). This version does the +// check randomly on a number of supersets of input1 and input2. +template +static void test_binary_instance_monotonicity_samples(Inference infer, const InputType& input1, const InputType& input2) { + using S = std::remove_const_t_lo)>; + using U = std::remove_const_t_ulo)>; + auto result = infer(input1, input2); + + // The set that is a superset of all other sets + InputType universe = InputType{std::numeric_limits::min(), std::numeric_limits::max(), U(0), U(-1), {U(0), U(0)}}; + ASSERT_TRUE(infer(universe, input2).contains(result)); + ASSERT_TRUE(infer(input1, universe).contains(result)); + ASSERT_TRUE(infer(universe, universe).contains(result)); + + auto random_superset = [](const InputType& input) { + S lo = MIN2(input->_lo, S(uniform_random())); + S hi = MAX2(input->_hi, S(uniform_random())); + U ulo = MIN2(input->_ulo, uniform_random()); + U uhi = MAX2(input->_uhi, uniform_random()); + U zeros = input->_bits._zeros & uniform_random(); + U ones = input->_bits._ones & uniform_random(); + InputType super = InputType::make(TypeIntPrototype{{lo, hi}, {ulo, uhi}, {zeros, ones}}, 0); + assert(super.contains(input), "impossible"); + return super; + }; + + InputType super1 = random_superset(input1); + InputType super2 = random_superset(input2); + ASSERT_TRUE(infer(super1, input2).contains(result)); + ASSERT_TRUE(infer(input1, super2).contains(result)); + ASSERT_TRUE(infer(super1, super2).contains(result)); +} + +// Verify the correctness and monotonicity of an inference function by exhautively analyzing all +// instances of InputType +template +static void test_binary_exhaustive(Operation op, Inference infer) { + for (const InputType& input1 : all_instances()) { + for (const InputType& input2 : all_instances()) { + test_binary_instance_correctness_exhaustive(op, infer, input1, input2); + if (all_instances().size() < 100) { + // This effectively covers the cases up to uintn_t<2> + test_binary_instance_monotonicity_exhaustive(infer, input1, input2); + } else { + // This effectively covers the cases of uintn_t<3> + test_binary_instance_monotonicity_samples(infer, input1, input2); + } + } + } +} + +// Verify the correctness and monotonicity of an inference function by randomly sampling instances +// of InputType +template +static void test_binary_random(Operation op, Inference infer) { + using S = std::remove_const_t; + using U = std::remove_const_t; + + constexpr size_t sample_count = 100; + InputType samples[sample_count]; + + // Fill with {0} + for (size_t i = 0; i < sample_count; i++) { + samples[i] = InputType::make(TypeIntPrototype{{S(0), S(0)}, {U(0), U(0)}, {U(0), U(0)}}, 0); + } + + // {1} + samples[1] = InputType::make(TypeIntPrototype{{S(1), S(1)}, {U(1), U(1)}, {U(0), U(0)}}, 0); + // {-1} + samples[2] = InputType::make(TypeIntPrototype{{S(-1), S(-1)}, {U(-1), U(-1)}, {U(0), U(0)}}, 0); + // {0, 1} + samples[3] = InputType::make(TypeIntPrototype{{S(0), S(1)}, {U(0), U(1)}, {U(0), U(0)}}, 0); + // {-1, 0, 1} + samples[4] = InputType::make(TypeIntPrototype{{S(-1), S(1)}, {U(0), U(-1)}, {U(0), U(0)}}, 0); + // {-1, 1} + samples[5] = InputType::make(TypeIntPrototype{{S(-1), S(1)}, {U(1), U(-1)}, {U(0), U(0)}}, 0); + // {0, 1, 2} + samples[6] = InputType::make(TypeIntPrototype{{S(0), S(2)}, {U(0), U(2)}, {U(0), U(0)}}, 0); + // {0, 2} + samples[7] = InputType::make(TypeIntPrototype{{S(0), S(2)}, {U(0), U(2)}, {U(1), U(0)}}, 0); + // [min_signed, max_signed] + samples[8] = InputType::make(TypeIntPrototype{{std::numeric_limits::min(), std::numeric_limits::max()}, {U(0), U(-1)}, {U(0), U(0)}}, 0); + // [0, max_signed] + samples[9] = InputType::make(TypeIntPrototype{{S(0), std::numeric_limits::max()}, {U(0), U(-1)}, {U(0), U(0)}}, 0); + // [min_signed, 0) + samples[10] = InputType::make(TypeIntPrototype{{std::numeric_limits::min(), S(-1)}, {U(0), U(-1)}, {U(0), U(0)}}, 0); + + constexpr size_t max_tries = 1000; + constexpr size_t start_random_idx = 11; + for (size_t tries = 0, idx = start_random_idx; tries < max_tries && idx < sample_count; tries++) { + // Try to have lo < hi + S signed_bound1 = S(uniform_random()); + S signed_bound2 = S(uniform_random()); + S lo = MIN2(signed_bound1, signed_bound2); + S hi = MAX2(signed_bound1, signed_bound2); + + // Try to have ulo < uhi + U unsigned_bound1 = uniform_random(); + U unsigned_bound2 = uniform_random(); + U ulo = MIN2(unsigned_bound1, unsigned_bound2); + U uhi = MAX2(unsigned_bound1, unsigned_bound2); + + // Try to have (zeros & ones) == 0 + U zeros = uniform_random(); + U ones = uniform_random(); + U common = zeros & ones; + zeros = zeros ^ common; + ones = ones ^ common; + + TypeIntPrototype t{{lo, hi}, {ulo, uhi}, {zeros, ones}}; + auto canonicalized_t = t.canonicalize_constraints(); + if (canonicalized_t.empty()) { + continue; + } + + samples[idx] = TypeIntMirror{canonicalized_t._data._srange._lo, canonicalized_t._data._srange._hi, + canonicalized_t._data._urange._lo, canonicalized_t._data._urange._hi, + canonicalized_t._data._bits}; + idx++; + } + + for (size_t i = 0; i < sample_count; i++) { + for (size_t j = 0; j < sample_count; j++) { + test_binary_instance_correctness_samples(op, infer, samples[i], samples[j]); + test_binary_instance_monotonicity_samples(infer, samples[i], samples[j]); + } + } +} + +template