diff --git a/.jcheck/conf b/.jcheck/conf index 29eebbdaaa2..beb280d1a04 100644 --- a/.jcheck/conf +++ b/.jcheck/conf @@ -4,7 +4,7 @@ jbs=JDK version=25 [checks] -error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists +error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists,copyright warning=issuestitle,binary [repository] @@ -34,3 +34,8 @@ pattern=^([124-8][0-9]{6}): (\S.*)$ [checks "problemlists"] dirs=test/jdk|test/langtools|test/lib-test|test/hotspot/jtreg|test/jaxp + +[checks "copyright"] +files=^(?!LICENSE|license\.txt|.*\.bin|.*\.gif|.*\.jpg|.*\.png|.*\.icon|.*\.tiff|.*\.dat|.*\.patch|.*\.wav|.*\.class|.*-header|.*\.jar|).* +oracle_locator=.*Copyright \(c\)(.*)Oracle and/or its affiliates\. All rights reserved\. +oracle_validator=.*Copyright \(c\) (\d{4})(?:, (\d{4}))?, Oracle and/or its affiliates\. All rights reserved\. diff --git a/make/Main.gmk b/make/Main.gmk index ddcc0c7f674..7675fe6fcf7 100644 --- a/make/Main.gmk +++ b/make/Main.gmk @@ -1310,7 +1310,10 @@ endif ################################################################################ # all-images builds all our deliverables as images. -all-images: product-images static-jdk-image test-image all-docs-images +all-images: product-images test-image all-docs-images +ifeq ($(call isTargetOs, linux macosx windows), true) + all-images: static-jdk-image +endif # all-bundles packages all our deliverables as tar.gz bundles. all-bundles: product-bundles test-bundles docs-bundles static-libs-bundles diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4 index 259315bb23c..d33f1885922 100644 --- a/make/autoconf/flags-cflags.m4 +++ b/make/autoconf/flags-cflags.m4 @@ -237,7 +237,7 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS], # Additional warnings that are not activated by -Wall and -Wextra WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wreturn-type -Wsign-compare \ -Wtrampolines -Wundef -Wunused-const-variable=1 -Wunused-function \ - -Wunused-result -Wunused-value" + -Wunused-result -Wunused-value -Wtype-limits -Wuninitialized" WARNINGS_ENABLE_ADDITIONAL_CXX="-Woverloaded-virtual -Wreorder" WARNINGS_ENABLE_ALL_CFLAGS="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL" WARNINGS_ENABLE_ALL_CXXFLAGS="$WARNINGS_ENABLE_ALL_CFLAGS $WARNINGS_ENABLE_ADDITIONAL_CXX" @@ -754,10 +754,9 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], fi if test "x$TOOLCHAIN_TYPE" = xgcc; then - FLAGS_SETUP_GCC6_COMPILER_FLAGS($1, $3) - $1_TOOLCHAIN_CFLAGS="${$1_GCC6_CFLAGS}" - - $1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized" + # This flag is required since GCC 6 as undefined behavior in OpenJDK code + # runs afoul of the more aggressive versions of this optimization. + $1_TOOLCHAIN_CFLAGS="-fno-lifetime-dse" fi if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then @@ -919,20 +918,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP], AC_SUBST($2SVE_CFLAGS) ]) -# FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX]) -# Arguments: -# $1 - Prefix for each variable defined. -# $2 - Prefix for compiler variables (either BUILD_ or nothing). -AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS], -[ - # This flag is required for GCC 6 builds as undefined behavior in OpenJDK code - # runs afoul of the more aggressive versions of this optimization. - NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse" - FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG], - PREFIX: $2, IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""]) - $1_GCC6_CFLAGS="${NO_LIFETIME_DSE_CFLAG}" -]) - AC_DEFUN_ONCE([FLAGS_SETUP_BRANCH_PROTECTION], [ # Is branch protection available? diff --git a/make/conf/jib-profiles.js b/make/conf/jib-profiles.js index 96cc1473eec..3c124040bf5 100644 --- a/make/conf/jib-profiles.js +++ b/make/conf/jib-profiles.js @@ -780,7 +780,7 @@ var getJibProfilesProfiles = function (input, common, data) { target_os: input.build_os, target_cpu: input.build_cpu, dependencies: [ - "boot_jdk", "devkit", "graphviz", "pandoc", buildJdkDep, + "autoconf", "boot_jdk", "devkit", "graphviz", "pandoc", buildJdkDep, ], configure_args: concat( "--enable-full-docs", diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk index 49a96ec3273..ff4c7fd3af3 100644 --- a/make/hotspot/lib/CompileJvm.gmk +++ b/make/hotspot/lib/CompileJvm.gmk @@ -90,7 +90,7 @@ CFLAGS_VM_VERSION := \ # Disabled warnings DISABLED_WARNINGS_gcc := array-bounds comment delete-non-virtual-dtor \ - empty-body implicit-fallthrough int-in-bool-context \ + empty-body format-zero-length implicit-fallthrough int-in-bool-context \ maybe-uninitialized missing-field-initializers \ shift-negative-value unknown-pragmas unused-but-set-variable \ unused-local-typedefs unused-variable diff --git a/make/jdk/src/classes/build/tools/depend/Depend.java b/make/jdk/src/classes/build/tools/depend/Depend.java index def3265b213..09595e43238 100644 --- a/make/jdk/src/classes/build/tools/depend/Depend.java +++ b/make/jdk/src/classes/build/tools/depend/Depend.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -446,7 +446,7 @@ public Void visitType(TypeElement e, Void p) { } @Override - public Void visitRecordComponent(@SuppressWarnings("preview")RecordComponentElement e, Void p) { + public Void visitRecordComponent(RecordComponentElement e, Void p) { update(e.getSimpleName()); visit(e.asType()); return null; diff --git a/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java b/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java index 114c82c5229..6faefecd424 100644 --- a/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java +++ b/make/langtools/src/classes/build/tools/symbolgenerator/CreateSymbols.java @@ -228,7 +228,6 @@ public class CreateSymbols { /**Create sig files for ct.sym reading the classes description from the directory that contains * {@code ctDescriptionFile}, using the file as a recipe to create the sigfiles. */ - @SuppressWarnings("unchecked") public void createSymbols(String ctDescriptionFileExtra, String ctDescriptionFile, String ctSymLocation, long timestamp, String currentVersion, String preReleaseTag, String moduleClasses, String includedModulesFile) throws IOException { @@ -4634,7 +4633,6 @@ private static AnnotationDescription parseAnnotation(String value, int[] valuePo /**Create sig files for ct.sym reading the classes description from the directory that contains * {@code ctDescriptionFile}, using the file as a recipe to create the sigfiles. */ - @SuppressWarnings("unchecked") public void createJavadocData(String ctDescriptionFileExtra, String ctDescriptionFile, String targetDir, int startVersion) throws IOException { LoadDescriptions data = load(ctDescriptionFileExtra != null ? Paths.get(ctDescriptionFileExtra) diff --git a/make/langtools/tools/propertiesparser/gen/ClassGenerator.java b/make/langtools/tools/propertiesparser/gen/ClassGenerator.java index e3ab548491b..e869d60bbc5 100644 --- a/make/langtools/tools/propertiesparser/gen/ClassGenerator.java +++ b/make/langtools/tools/propertiesparser/gen/ClassGenerator.java @@ -48,6 +48,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Properties; import java.util.Set; import java.util.TreeMap; @@ -87,9 +88,12 @@ enum StubKind { FACTORY_METHOD_DECL("factory.decl.method"), FACTORY_METHOD_ARG("factory.decl.method.arg"), FACTORY_METHOD_BODY("factory.decl.method.body"), + FACTORY_METHOD_BODY_LINT("factory.decl.method.body.lint"), FACTORY_FIELD("factory.decl.field"), + FACTORY_FIELD_LINT("factory.decl.field.lint"), WILDCARDS_EXTENDS("wildcards.extends"), - SUPPRESS_WARNINGS("suppress.warnings"); + SUPPRESS_WARNINGS("suppress.warnings"), + LINT_CATEGORY("lint.category"); /** stub key (as it appears in the property file) */ String key; @@ -114,6 +118,7 @@ String format(Object... args) { enum FactoryKind { ERR("err", "Error", "Errors"), WARN("warn", "Warning", "Warnings"), + LINT_WARN("warn", "LintWarning", "LintWarnings"), NOTE("note", "Note", "Notes"), MISC("misc", "Fragment", "Fragments"), OTHER(null, null, null); @@ -136,13 +141,24 @@ enum FactoryKind { /** * Utility method for parsing a factory kind from a resource key prefix. */ - static FactoryKind parseFrom(String prefix) { + static FactoryKind of(Entry messageEntry) { + String prefix = messageEntry.getKey().split("\\.")[1]; + FactoryKind selected = null; for (FactoryKind k : FactoryKind.values()) { if (k.prefix == null || k.prefix.equals(prefix)) { - return k; + selected = k; + break; } } - return null; + if (selected == WARN) { + for (MessageLine line : messageEntry.getValue().getLines(false)) { + if (line.isLint()) { + selected = LINT_WARN; + break; + } + } + } + return selected; } } @@ -155,7 +171,7 @@ public void generateFactory(MessageFile messageFile, File outDir) { messageFile.messages.entrySet().stream() .collect( Collectors.groupingBy( - e -> FactoryKind.parseFrom(e.getKey().split("\\.")[1]), + FactoryKind::of, TreeMap::new, toList())); //generate nested classes @@ -165,7 +181,7 @@ public void generateFactory(MessageFile messageFile, File outDir) { if (entry.getKey() == FactoryKind.OTHER) continue; //emit members String members = entry.getValue().stream() - .flatMap(e -> generateFactoryMethodsAndFields(e.getKey(), e.getValue()).stream()) + .flatMap(e -> generateFactoryMethodsAndFields(entry.getKey(), e.getKey(), e.getValue()).stream()) .collect(Collectors.joining("\n\n")); //emit nested class String factoryDecl = @@ -230,7 +246,7 @@ List generateImports(Set importedTypes) { /** * Generate a list of factory methods/fields to be added to a given factory nested class. */ - List generateFactoryMethodsAndFields(String key, Message msg) { + List generateFactoryMethodsAndFields(FactoryKind k, String key, Message msg) { MessageInfo msgInfo = msg.getMessageInfo(); List lines = msg.getLines(false); String javadoc = lines.stream() @@ -238,14 +254,27 @@ List generateFactoryMethodsAndFields(String key, Message msg) { .map(ml -> ml.text) .collect(Collectors.joining("\n *")); String[] keyParts = key.split("\\."); - FactoryKind k = FactoryKind.parseFrom(keyParts[1]); + String lintCategory = lines.stream() + .filter(MessageLine::isLint) + .map(MessageLine::lintCategory) + .findFirst().orElse(null); + //System.out.println("category for " + key + " = " + lintCategory); String factoryName = factoryName(key); if (msgInfo.getTypes().isEmpty()) { //generate field - String factoryField = StubKind.FACTORY_FIELD.format(k.keyClazz, factoryName, - "\"" + keyParts[0] + "\"", - "\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"", - javadoc); + String factoryField; + if (lintCategory == null) { + factoryField = StubKind.FACTORY_FIELD.format(k.keyClazz, factoryName, + "\"" + keyParts[0] + "\"", + "\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"", + javadoc); + } else { + factoryField = StubKind.FACTORY_FIELD_LINT.format(k.keyClazz, factoryName, + StubKind.LINT_CATEGORY.format("\"" + lintCategory + "\""), + "\"" + keyParts[0] + "\"", + "\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"", + javadoc); + } return Collections.singletonList(factoryField); } else { //generate method @@ -255,12 +284,22 @@ List generateFactoryMethodsAndFields(String key, Message msg) { List argNames = argNames(types.size()); String suppressionString = needsSuppressWarnings(msgTypes) ? StubKind.SUPPRESS_WARNINGS.format() : ""; + String methodBody; + if (lintCategory == null) { + methodBody = StubKind.FACTORY_METHOD_BODY.format(k.keyClazz, + "\"" + keyParts[0] + "\"", + "\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"", + argNames.stream().collect(Collectors.joining(", "))); + } else { + methodBody = StubKind.FACTORY_METHOD_BODY_LINT.format(k.keyClazz, + StubKind.LINT_CATEGORY.format("\"" + lintCategory + "\""), + "\"" + keyParts[0] + "\"", + "\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"", + argNames.stream().collect(Collectors.joining(", "))); + } String factoryMethod = StubKind.FACTORY_METHOD_DECL.format(suppressionString, k.keyClazz, factoryName, argDecls(types, argNames).stream().collect(Collectors.joining(", ")), - indent(StubKind.FACTORY_METHOD_BODY.format(k.keyClazz, - "\"" + keyParts[0] + "\"", - "\"" + Stream.of(keyParts).skip(2).collect(Collectors.joining(".")) + "\"", - argNames.stream().collect(Collectors.joining(", "))), 1), + indent(methodBody, 1), javadoc); factoryMethods.add(factoryMethod); } diff --git a/make/langtools/tools/propertiesparser/parser/Message.java b/make/langtools/tools/propertiesparser/parser/Message.java index 02a2f5e4f5c..3c1191084ec 100644 --- a/make/langtools/tools/propertiesparser/parser/Message.java +++ b/make/langtools/tools/propertiesparser/parser/Message.java @@ -49,6 +49,9 @@ public final class Message { public MessageInfo getMessageInfo() { if (messageInfo == null) { MessageLine l = firstLine.prev; + if (l != null && l.isLint()) { + l = l.prev; + } if (l != null && l.isInfo()) messageInfo = new MessageInfo(l.text); else @@ -71,7 +74,7 @@ public List getLines(boolean includeAllPrecedingComments) { while (l.text.isEmpty()) l = l.next; } else { - if (l.prev != null && l.prev.isInfo()) + if (l.prev != null && (l.prev.isInfo() || l.prev.isLint())) l = l.prev; } diff --git a/make/langtools/tools/propertiesparser/parser/MessageLine.java b/make/langtools/tools/propertiesparser/parser/MessageLine.java index e370eefa38a..c73021e0827 100644 --- a/make/langtools/tools/propertiesparser/parser/MessageLine.java +++ b/make/langtools/tools/propertiesparser/parser/MessageLine.java @@ -25,6 +25,7 @@ package propertiesparser.parser; +import java.util.regex.Matcher; import java.util.regex.Pattern; /** @@ -37,6 +38,7 @@ public class MessageLine { static final Pattern typePattern = Pattern.compile("[-\\\\'A-Z\\.a-z ]+( \\([-A-Za-z 0-9]+\\))?"); static final Pattern infoPattern = Pattern.compile(String.format("# ([0-9]+: %s, )*[0-9]+: %s", typePattern.pattern(), typePattern.pattern())); + static final Pattern lintPattern = Pattern.compile("# lint: ([a-z\\-]+)"); public String text; MessageLine prev; @@ -54,6 +56,19 @@ public boolean isInfo() { return infoPattern.matcher(text).matches(); } + public boolean isLint() { + return lintPattern.matcher(text).matches(); + } + + public String lintCategory() { + Matcher matcher = lintPattern.matcher(text); + if (matcher.matches()) { + return matcher.group(1); + } else { + return null; + } + } + boolean hasContinuation() { return (next != null) && text.endsWith("\\"); } diff --git a/make/langtools/tools/propertiesparser/resources/templates.properties b/make/langtools/tools/propertiesparser/resources/templates.properties index b6685e68891..991739aa403 100644 --- a/make/langtools/tools/propertiesparser/resources/templates.properties +++ b/make/langtools/tools/propertiesparser/resources/templates.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. # 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,8 +29,10 @@ toplevel.decl=\ {1}\n\ import com.sun.tools.javac.util.JCDiagnostic.Error;\n\ import com.sun.tools.javac.util.JCDiagnostic.Warning;\n\ + import com.sun.tools.javac.util.JCDiagnostic.LintWarning;\n\ import com.sun.tools.javac.util.JCDiagnostic.Note;\n\ import com.sun.tools.javac.util.JCDiagnostic.Fragment;\n\ + import com.sun.tools.javac.code.Lint.LintCategory;\n\ \n\ public class {2} '{'\n\ {3}\n\ @@ -58,16 +60,27 @@ factory.decl.method.arg=\ factory.decl.method.body=\ return new {0}({1}, {2}, {3}); +factory.decl.method.body.lint=\ + return new {0}({1}, {2}, {3}, {4}); + factory.decl.field=\ /**\n\ ' '* {4}\n\ ' '*/\n\ public static final {0} {1} = new {0}({2}, {3}); +factory.decl.field.lint=\ + /**\n\ + ' '* {5}\n\ + ' '*/\n\ + public static final {0} {1} = new {0}({2}, {3}, {4}); + wildcards.extends=\ {0} suppress.warnings=\ @SuppressWarnings("rawtypes")\n +lint.category=\ + LintCategory.get({0}).get() diff --git a/make/modules/java.desktop/lib/ClientLibraries.gmk b/make/modules/java.desktop/lib/ClientLibraries.gmk index 87f6e2e5099..41f3040222c 100644 --- a/make/modules/java.desktop/lib/ClientLibraries.gmk +++ b/make/modules/java.desktop/lib/ClientLibraries.gmk @@ -283,7 +283,7 @@ ifeq ($(FREETYPE_TO_USE), bundled) OPTIMIZATION := HIGHEST, \ CFLAGS := -DFT2_BUILD_LIBRARY, \ CFLAGS_windows := -DDLL_EXPORT, \ - EXTRA_HEADER_DIRS := libfreetype/include, \ + EXTRA_HEADER_DIRS := java.base:libjava libfreetype/include, \ DISABLED_WARNINGS_microsoft := 4267 4244 4996, \ DISABLED_WARNINGS_gcc := dangling-pointer stringop-overflow, \ )) diff --git a/make/test/BuildMicrobenchmark.gmk b/make/test/BuildMicrobenchmark.gmk index da9ff2029e8..1052e422f7b 100644 --- a/make/test/BuildMicrobenchmark.gmk +++ b/make/test/BuildMicrobenchmark.gmk @@ -47,6 +47,7 @@ MICROBENCHMARK_JAR := $(MICROBENCHMARK_IMAGE_DIR)/benchmarks.jar MICROBENCHMARK_OUTPUT := $(SUPPORT_OUTPUTDIR)/test/micro MICROBENCHMARK_CLASSES := $(MICROBENCHMARK_OUTPUT)/classes +MICROBENCHMARK_GENSRC := $(MICROBENCHMARK_OUTPUT)/gensrc MICROBENCHMARK_JAR_BIN := $(MICROBENCHMARK_OUTPUT)/jar MICROBENCHMARK_TOOLS_CLASSES := $(MICROBENCHMARK_OUTPUT)/tools-classes @@ -104,7 +105,8 @@ $(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \ --add-exports java.base/sun.security.util.math.intpoly=ALL-UNNAMED \ --enable-preview \ -XDsuppressNotes \ - -processor org.openjdk.jmh.generators.BenchmarkProcessor, \ + -processor org.openjdk.jmh.generators.BenchmarkProcessor \ + -s $(MICROBENCHMARK_GENSRC), \ JAVA_FLAGS := \ --add-exports java.base/jdk.internal.vm=ALL-UNNAMED \ --add-modules jdk.unsupported \ diff --git a/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp index 4acac65ad5b..4ae2da66802 100644 --- a/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_LIRGenerator_aarch64.cpp @@ -277,18 +277,20 @@ void LIRGenerator::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr bas bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) { - - if (is_power_of_2(c - 1)) { - __ shift_left(left, exact_log2(c - 1), tmp); + juint u_value = (juint)c; + if (is_power_of_2(u_value - 1)) { + __ shift_left(left, exact_log2(u_value - 1), tmp); __ add(tmp, left, result); return true; - } else if (is_power_of_2(c + 1)) { - __ shift_left(left, exact_log2(c + 1), tmp); + } else if (is_power_of_2(u_value + 1)) { + __ shift_left(left, exact_log2(u_value + 1), tmp); __ sub(tmp, left, result); return true; - } else { - return false; + } else if (c == -1) { + __ negate(left, result); + return true; } + return false; } void LIRGenerator::store_stack_parameter (LIR_Opr item, ByteSize offset_from_sp) { diff --git a/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp b/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp index adda0c1c290..a70bf2cbda9 100644 --- a/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp +++ b/src/hotspot/cpu/arm/c1_LIRGenerator_arm.cpp @@ -328,16 +328,20 @@ void LIRGenerator::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr bas bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) { assert(left != result, "should be different registers"); - if (is_power_of_2(c + 1)) { - LIR_Address::Scale scale = (LIR_Address::Scale) log2i_exact(c + 1); + juint u_value = (juint)c; + if (is_power_of_2(u_value + 1)) { + LIR_Address::Scale scale = (LIR_Address::Scale) log2i_exact(u_value + 1); LIR_Address* addr = new LIR_Address(left, left, scale, 0, T_INT); __ sub(LIR_OprFact::address(addr), left, result); // rsb with shifted register return true; - } else if (is_power_of_2(c - 1)) { - LIR_Address::Scale scale = (LIR_Address::Scale) log2i_exact(c - 1); + } else if (is_power_of_2(u_value - 1)) { + LIR_Address::Scale scale = (LIR_Address::Scale) log2i_exact(u_value - 1); LIR_Address* addr = new LIR_Address(left, left, scale, 0, T_INT); __ add(left, LIR_OprFact::address(addr), result); // add with shifted register return true; + } else if (c == -1) { + __ negate(left, result); + return true; } return false; } diff --git a/src/hotspot/cpu/ppc/c1_CodeStubs_ppc.cpp b/src/hotspot/cpu/ppc/c1_CodeStubs_ppc.cpp index 451f3b7e9cd..4d3927dc644 100644 --- a/src/hotspot/cpu/ppc/c1_CodeStubs_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_CodeStubs_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2021 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp index 4e0908d6e61..b332ffbcee7 100644 --- a/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp @@ -296,14 +296,20 @@ void LIRGenerator::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr bas bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) { assert(left != result, "should be different registers"); - if (is_power_of_2(c + 1)) { - __ shift_left(left, log2i_exact(c + 1), result); + // Using unsigned arithmetics to avoid undefined behavior due to integer overflow. + // The involved operations are not sensitive to signedness. + juint u_value = (juint)c; + if (is_power_of_2(u_value + 1)) { + __ shift_left(left, log2i_exact(u_value + 1), result); __ sub(result, left, result); return true; - } else if (is_power_of_2(c - 1)) { - __ shift_left(left, log2i_exact(c - 1), result); + } else if (is_power_of_2(u_value - 1)) { + __ shift_left(left, log2i_exact(u_value - 1), result); __ add(result, left, result); return true; + } else if (c == -1) { + __ negate(left, result); + return true; } return false; } diff --git a/src/hotspot/cpu/ppc/c2_init_ppc.cpp b/src/hotspot/cpu/ppc/c2_init_ppc.cpp index a02b9668c92..d570abc431a 100644 --- a/src/hotspot/cpu/ppc/c2_init_ppc.cpp +++ b/src/hotspot/cpu/ppc/c2_init_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2020 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/ppc/frame_ppc.cpp b/src/hotspot/cpu/ppc/frame_ppc.cpp index 07243ed1c8c..f698b14d312 100644 --- a/src/hotspot/cpu/ppc/frame_ppc.cpp +++ b/src/hotspot/cpu/ppc/frame_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2023 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/ppc/frame_ppc.hpp b/src/hotspot/cpu/ppc/frame_ppc.hpp index 67456158b97..560615089fe 100644 --- a/src/hotspot/cpu/ppc/frame_ppc.hpp +++ b/src/hotspot/cpu/ppc/frame_ppc.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2023 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/ppc/frame_ppc.inline.hpp b/src/hotspot/cpu/ppc/frame_ppc.inline.hpp index c390449dc33..19a90367353 100644 --- a/src/hotspot/cpu/ppc/frame_ppc.inline.hpp +++ b/src/hotspot/cpu/ppc/frame_ppc.inline.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2023 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/ppc/globals_ppc.hpp b/src/hotspot/cpu/ppc/globals_ppc.hpp index 50204d1ac89..7fefc856a47 100644 --- a/src/hotspot/cpu/ppc/globals_ppc.hpp +++ b/src/hotspot/cpu/ppc/globals_ppc.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2023 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp index 632eb97e852..67b9bdc0414 100644 --- a/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/interp_masm_ppc_64.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2023 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/ppc/nativeInst_ppc.cpp b/src/hotspot/cpu/ppc/nativeInst_ppc.cpp index 7577bdb9fdd..78ed81be9cb 100644 --- a/src/hotspot/cpu/ppc/nativeInst_ppc.cpp +++ b/src/hotspot/cpu/ppc/nativeInst_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2020 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/ppc/nativeInst_ppc.hpp b/src/hotspot/cpu/ppc/nativeInst_ppc.hpp index 29b8b1b891b..f4d570116a8 100644 --- a/src/hotspot/cpu/ppc/nativeInst_ppc.hpp +++ b/src/hotspot/cpu/ppc/nativeInst_ppc.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2021 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/ppc/ppc.ad b/src/hotspot/cpu/ppc/ppc.ad index b023ccae86d..808dd022738 100644 --- a/src/hotspot/cpu/ppc/ppc.ad +++ b/src/hotspot/cpu/ppc/ppc.ad @@ -1,6 +1,6 @@ // // Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. -// Copyright (c) 2012, 2023 SAP SE. All rights reserved. +// Copyright (c) 2012, 2024 SAP SE. All rights reserved. // DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. // // This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/ppc/vm_version_ppc.cpp b/src/hotspot/cpu/ppc/vm_version_ppc.cpp index a09d718287f..9a4f13e41a0 100644 --- a/src/hotspot/cpu/ppc/vm_version_ppc.cpp +++ b/src/hotspot/cpu/ppc/vm_version_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2023 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/ppc/vm_version_ppc.hpp b/src/hotspot/cpu/ppc/vm_version_ppc.hpp index 4c0954ebdd2..6096f8e4fd1 100644 --- a/src/hotspot/cpu/ppc/vm_version_ppc.hpp +++ b/src/hotspot/cpu/ppc/vm_version_ppc.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2021 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp b/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp index 6a8c146aa9a..567cfae8d0a 100644 --- a/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp +++ b/src/hotspot/cpu/ppc/vtableStubs_ppc_64.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2021 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/riscv/c1_LIRAssembler_arith_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRAssembler_arith_riscv.cpp index 70731d46fb4..ee6dedfcc07 100644 --- a/src/hotspot/cpu/riscv/c1_LIRAssembler_arith_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_LIRAssembler_arith_riscv.cpp @@ -64,7 +64,7 @@ void LIR_Assembler::arithmetic_idiv(LIR_Code code, LIR_Opr left, LIR_Opr right, if (Assembler::is_simm12(c - 1)) { __ andi(t1, t1, c - 1); } else { - __ zero_extend(t1, t1, shift); + __ zext(t1, t1, shift); } __ subw(dreg, t1, t0); } @@ -78,7 +78,7 @@ void LIR_Assembler::arithmetic_idiv(LIR_Code code, LIR_Opr left, LIR_Opr right, if (Assembler::is_simm12(c - 1)) { __ andi(t0, t0, c - 1); } else { - __ zero_extend(t0, t0, shift); + __ zext(t0, t0, shift); } __ addw(dreg, t0, lreg); __ sraiw(dreg, dreg, shift); @@ -205,7 +205,7 @@ void LIR_Assembler::arith_op_double_cpu(LIR_Code code, LIR_Opr left, LIR_Opr rig if (Assembler::is_simm12(c - 1)) { __ andi(t0, t0, c - 1); } else { - __ zero_extend(t0, t0, shift); + __ zext(t0, t0, shift); } __ add(dreg, t0, lreg_lo); __ srai(dreg, dreg, shift); @@ -224,7 +224,7 @@ void LIR_Assembler::arith_op_double_cpu(LIR_Code code, LIR_Opr left, LIR_Opr rig if (Assembler::is_simm12(c - 1)) { __ andi(t1, t1, c - 1); } else { - __ zero_extend(t1, t1, shift); + __ zext(t1, t1, shift); } __ sub(dreg, t1, t0); } diff --git a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp index b7edd3d231f..d587a557a73 100644 --- a/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/c1_LIRAssembler_riscv.cpp @@ -952,15 +952,15 @@ void LIR_Assembler::emit_opConvert(LIR_OpConvert* op) { case Bytecodes::_d2f: __ fcvt_s_d(dest->as_float_reg(), src->as_double_reg()); break; case Bytecodes::_i2c: - __ zero_extend(dest->as_register(), src->as_register(), 16); break; + __ zext(dest->as_register(), src->as_register(), 16); break; case Bytecodes::_i2l: - __ sign_extend(dest->as_register_lo(), src->as_register(), 32); break; + __ sext(dest->as_register_lo(), src->as_register(), 32); break; case Bytecodes::_i2s: - __ sign_extend(dest->as_register(), src->as_register(), 16); break; + __ sext(dest->as_register(), src->as_register(), 16); break; case Bytecodes::_i2b: - __ sign_extend(dest->as_register(), src->as_register(), 8); break; + __ sext(dest->as_register(), src->as_register(), 8); break; case Bytecodes::_l2i: - __ sign_extend(dest->as_register(), src->as_register_lo(), 32); break; + __ sext(dest->as_register(), src->as_register_lo(), 32); break; case Bytecodes::_d2l: __ fcvt_l_d_safe(dest->as_register_lo(), src->as_double_reg()); break; case Bytecodes::_f2i: @@ -1288,7 +1288,7 @@ void LIR_Assembler::logic_op(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr int right_const = right->as_jint(); if (Assembler::is_simm12(right_const)) { logic_op_imm(Rdst, Rleft, right_const, code); - __ sign_extend(Rdst, Rdst, 32); + __ sext(Rdst, Rdst, 32); } else { __ mv(t0, right_const); logic_op_reg32(Rdst, Rleft, t0, code); @@ -1609,7 +1609,7 @@ void LIR_Assembler::emit_updatecrc32(LIR_OpUpdateCRC32* op) { __ la(res, ExternalAddress(StubRoutines::crc_table_addr())); __ notr(crc, crc); // ~crc - __ zero_extend(crc, crc, 32); + __ zext(crc, crc, 32); __ update_byte_crc32(crc, val, res); __ notr(res, crc); // ~crc } diff --git a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp index 122ea7352fe..798804269d4 100644 --- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp @@ -787,7 +787,8 @@ void C2_MacroAssembler::string_indexof_char(Register str1, Register cnt1, j(NOMATCH); bind(HIT); - ctzc_bit(trailing_char, match_mask, isL, ch1, result); + // count bits of trailing zero chars + ctzc_bits(trailing_char, match_mask, isL, ch1, result); srli(trailing_char, trailing_char, 3); addi(cnt1, cnt1, 8); ble(cnt1, trailing_char, NOMATCH); @@ -1027,7 +1028,7 @@ void C2_MacroAssembler::string_indexof(Register haystack, Register needle, srli(ch2, ch2, XLEN - 8); // pattern[m-2], 0x0000000b slli(ch1, tmp6, XLEN - 16); srli(ch1, ch1, XLEN - 8); // pattern[m-3], 0x0000000c - andi(tmp6, tmp6, 0xff); // pattern[m-4], 0x0000000d + zext(tmp6, tmp6, 8); // pattern[m-4], 0x0000000d slli(ch2, ch2, 16); orr(ch2, ch2, ch1); // 0x00000b0c slli(result, tmp3, 48); // use result as temp register @@ -1536,15 +1537,16 @@ void C2_MacroAssembler::string_compare(Register str1, Register str2, // compute their difference. bind(DIFFERENCE); xorr(tmp3, tmp1, tmp2); - ctzc_bit(result, tmp3, isLL); // count zero from lsb to msb + // count bits of trailing zero chars + ctzc_bits(result, tmp3, isLL); srl(tmp1, tmp1, result); srl(tmp2, tmp2, result); if (isLL) { - andi(tmp1, tmp1, 0xFF); - andi(tmp2, tmp2, 0xFF); + zext(tmp1, tmp1, 8); + zext(tmp2, tmp2, 8); } else { - andi(tmp1, tmp1, 0xFFFF); - andi(tmp2, tmp2, 0xFFFF); + zext(tmp1, tmp1, 16); + zext(tmp2, tmp2, 16); } sub(result, tmp1, tmp2); j(DONE); diff --git a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp index ece872ac034..e17a3765b50 100644 --- a/src/hotspot/cpu/riscv/interp_masm_riscv.cpp +++ b/src/hotspot/cpu/riscv/interp_masm_riscv.cpp @@ -70,20 +70,20 @@ void InterpreterMacroAssembler::narrow(Register result) { bind(notBool); mv(t1, T_BYTE); bne(t0, t1, notByte); - sign_extend(result, result, 8); + sext(result, result, 8); j(done); bind(notByte); mv(t1, T_CHAR); bne(t0, t1, notChar); - zero_extend(result, result, 16); + zext(result, result, 16); j(done); bind(notChar); - sign_extend(result, result, 16); + sext(result, result, 16); bind(done); - sign_extend(result, result, 32); + sext(result, result, 32); } void InterpreterMacroAssembler::jump_to_entry(address entry) { @@ -276,7 +276,7 @@ void InterpreterMacroAssembler::push_ptr(Register r) { void InterpreterMacroAssembler::push_i(Register r) { addi(esp, esp, -wordSize); - sign_extend(r, r, 32); + sext(r, r, 32); sd(r, Address(esp, 0)); } diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp index 17289891ccd..804407fd80e 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.cpp @@ -1536,9 +1536,6 @@ int MacroAssembler::pop_fp(unsigned int bitset, Register stack) { return count; } -static const int64_t right_32_bits = right_n_bits(32); -static const int64_t right_8_bits = right_n_bits(8); - /** * Emits code to update CRC-32 with a byte value according to constants in table * @@ -1555,7 +1552,7 @@ void MacroAssembler::update_byte_crc32(Register crc, Register val, Register tabl assert_different_registers(crc, val, table); xorr(val, val, crc); - andi(val, val, right_8_bits); + zext(val, val, 8); shadd(val, val, table, val, 2); lwu(val, Address(val)); srli(crc, crc, 8); @@ -1585,7 +1582,7 @@ void MacroAssembler::update_word_crc32(Register crc, Register v, Register tmp1, srli(v, v, 32); xorr(v, v, crc); - andi(tmp1, v, right_8_bits); + zext(tmp1, v, 8); shadd(tmp1, tmp1, table3, tmp2, 2); lwu(crc, Address(tmp1)); @@ -2086,7 +2083,11 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len, const int64_t single_table_size = 256; const int64_t unroll = 16; const int64_t unroll_words = unroll*wordSize; - mv(tmp5, right_32_bits); + + // tmp5 = 0xffffffff + notr(tmp5, zr); + srli(tmp5, tmp5, 32); + andn(crc, tmp5, crc); const ExternalAddress table_addr = StubRoutines::crc_table_addr(); @@ -2110,7 +2111,7 @@ void MacroAssembler::kernel_crc32(Register crc, Register buf, Register len, subw(len, len, 2); lhu(tmp1, Address(buf)); add(buf, buf, 2); - andi(tmp2, tmp1, right_8_bits); + zext(tmp2, tmp1, 8); update_byte_crc32(crc, tmp2, table0); srli(tmp2, tmp1, 8); update_byte_crc32(crc, tmp2, table0); @@ -2634,17 +2635,17 @@ void MacroAssembler::subw(Register Rd, Register Rn, int32_t decrement, Register void MacroAssembler::andrw(Register Rd, Register Rs1, Register Rs2) { andr(Rd, Rs1, Rs2); - sign_extend(Rd, Rd, 32); + sext(Rd, Rd, 32); } void MacroAssembler::orrw(Register Rd, Register Rs1, Register Rs2) { orr(Rd, Rs1, Rs2); - sign_extend(Rd, Rd, 32); + sext(Rd, Rd, 32); } void MacroAssembler::xorrw(Register Rd, Register Rs1, Register Rs2) { xorr(Rd, Rs1, Rs2); - sign_extend(Rd, Rd, 32); + sext(Rd, Rd, 32); } // Rd = Rs1 & (~Rd2) @@ -2832,18 +2833,18 @@ void MacroAssembler::revbw(Register Rd, Register Rs, Register tmp1, Register tmp } assert_different_registers(Rs, tmp1, tmp2); assert_different_registers(Rd, tmp1, tmp2); - andi(tmp1, Rs, 0xFF); + zext(tmp1, Rs, 8); slli(tmp1, tmp1, 8); for (int step = 8; step < 24; step += 8) { srli(tmp2, Rs, step); - andi(tmp2, tmp2, 0xFF); + zext(tmp2, tmp2, 8); orr(tmp1, tmp1, tmp2); slli(tmp1, tmp1, 8); } srli(Rd, Rs, 24); - andi(Rd, Rd, 0xFF); + zext(Rd, Rd, 8); orr(Rd, tmp1, Rd); - sign_extend(Rd, Rd, 32); + sext(Rd, Rd, 32); } // reverse bytes in doubleword @@ -2855,16 +2856,16 @@ void MacroAssembler::revb(Register Rd, Register Rs, Register tmp1, Register tmp2 } assert_different_registers(Rs, tmp1, tmp2); assert_different_registers(Rd, tmp1, tmp2); - andi(tmp1, Rs, 0xFF); + zext(tmp1, Rs, 8); slli(tmp1, tmp1, 8); for (int step = 8; step < 56; step += 8) { srli(tmp2, Rs, step); - andi(tmp2, tmp2, 0xFF); + zext(tmp2, tmp2, 8); orr(tmp1, tmp1, tmp2); slli(tmp1, tmp1, 8); } srli(Rd, Rs, 56); - andi(Rd, Rd, 0xFF); + zext(Rd, Rd, 8); orr(Rd, tmp1, Rd); } @@ -3237,7 +3238,7 @@ void MacroAssembler::encode_klass_not_null(Register dst, Register src, Register if (((uint64_t)CompressedKlassPointers::base() & 0xffffffff) == 0 && CompressedKlassPointers::shift() == 0) { - zero_extend(dst, src, 32); + zext(dst, src, 32); return; } @@ -3690,7 +3691,7 @@ void MacroAssembler::load_reserved(Register dst, break; case uint32: lr_w(dst, addr, acquire); - zero_extend(dst, dst, 32); + zext(dst, dst, 32); break; default: ShouldNotReachHere(); @@ -3731,7 +3732,7 @@ void MacroAssembler::cmpxchg_narrow_value_helper(Register addr, Register expecte } else { // size == int16 case mv(mask, -1); - zero_extend(mask, mask, 16); + zext(mask, mask, 16); } sll(mask, mask, shift); @@ -3808,10 +3809,10 @@ void MacroAssembler::cmpxchg_narrow_value(Register addr, Register expected, srl(result, scratch0, shift); if (size == int8) { - sign_extend(result, result, 8); + sext(result, result, 8); } else { // size == int16 case - sign_extend(result, result, 16); + sext(result, result, 16); } } } @@ -4005,7 +4006,7 @@ ATOMIC_XCHG(xchgalw, amoswap_w, Assembler::aq, Assembler::rl) #define ATOMIC_XCHGU(OP1, OP2) \ void MacroAssembler::atomic_##OP1(Register prev, Register newv, Register addr) { \ atomic_##OP2(prev, newv, addr); \ - zero_extend(prev, prev, 32); \ + zext(prev, prev, 32); \ return; \ } @@ -4025,7 +4026,7 @@ void MacroAssembler::atomic_cas(Register prev, Register newv, Register addr, break; case uint32: amocas_w(prev, addr, newv, (Assembler::Aqrl)(acquire | release)); - zero_extend(prev, prev, 32); + zext(prev, prev, 32); break; default: ShouldNotReachHere(); @@ -4614,7 +4615,7 @@ void MacroAssembler::set_narrow_oop(Register dst, jobject obj) { relocate(oop_Relocation::spec(oop_index), [&] { li32(dst, 0xDEADBEEF); }); - zero_extend(dst, dst, 32); + zext(dst, dst, 32); } void MacroAssembler::set_narrow_klass(Register dst, Klass* k) { @@ -4627,7 +4628,7 @@ void MacroAssembler::set_narrow_klass(Register dst, Klass* k) { relocate(metadata_Relocation::spec(index), [&] { li32(dst, nk); }); - zero_extend(dst, dst, 32); + zext(dst, dst, 32); } address MacroAssembler::reloc_call(Address entry, Register tmp) { @@ -4902,7 +4903,7 @@ void MacroAssembler::mul_add(Register out, Register in, Register offset, mv(tmp, out); mv(out, zr); blez(len, L_end); - zero_extend(k, k, 32); + zext(k, k, 32); slliw(t0, offset, LogBytesPerInt); add(offset, tmp, t0); slliw(t0, len, LogBytesPerInt); @@ -5394,28 +5395,26 @@ void MacroAssembler::multiply_to_len(Register x, Register xlen, Register y, Regi } #endif -// Count bits of trailing zero chars from lsb to msb until first non-zero element. -// For LL case, one byte for one element, so shift 8 bits once, and for other case, -// shift 16 bits once. -void MacroAssembler::ctzc_bit(Register Rd, Register Rs, bool isLL, Register tmp1, Register tmp2) { +// Count bits of trailing zero chars from lsb to msb until first non-zero +// char seen. For the LL case, shift 8 bits once as there is only one byte +// per each char. For other cases, shift 16 bits once. +void MacroAssembler::ctzc_bits(Register Rd, Register Rs, bool isLL, + Register tmp1, Register tmp2) { + int step = isLL ? 8 : 16; if (UseZbb) { - assert_different_registers(Rd, Rs, tmp1); - int step = isLL ? 8 : 16; ctz(Rd, Rs); - andi(tmp1, Rd, step - 1); - sub(Rd, Rd, tmp1); + andi(Rd, Rd, -step); return; } - assert_different_registers(Rd, Rs, tmp1, tmp2); + assert_different_registers(Rd, tmp1, tmp2); Label Loop; - int step = isLL ? 8 : 16; - mv(Rd, -step); mv(tmp2, Rs); + mv(Rd, -step); bind(Loop); addi(Rd, Rd, step); - andi(tmp1, tmp2, ((1 << step) - 1)); + zext(tmp1, tmp2, step); srli(tmp2, tmp2, step); beqz(tmp1, Loop); } @@ -5436,7 +5435,7 @@ void MacroAssembler::inflate_lo32(Register Rd, Register Rs, Register tmp1, Regis orr(Rd, Rd, tmp2); } slli(Rd, Rd, wordSize); - andi(tmp2, Rs, 0xFF); // last byte mask at lower word + zext(tmp2, Rs, 8); // last byte mask at lower word orr(Rd, Rd, tmp2); } @@ -5838,7 +5837,7 @@ void MacroAssembler::shadd(Register Rd, Register Rs1, Register Rs2, Register tmp } } -void MacroAssembler::zero_extend(Register dst, Register src, int bits) { +void MacroAssembler::zext(Register dst, Register src, int bits) { switch (bits) { case 32: if (UseZba) { @@ -5853,19 +5852,17 @@ void MacroAssembler::zero_extend(Register dst, Register src, int bits) { } break; case 8: - if (UseZbb) { - zext_b(dst, src); - return; - } - break; + zext_b(dst, src); + return; default: break; } + slli(dst, src, XLEN - bits); srli(dst, dst, XLEN - bits); } -void MacroAssembler::sign_extend(Register dst, Register src, int bits) { +void MacroAssembler::sext(Register dst, Register src, int bits) { switch (bits) { case 32: sext_w(dst, src); @@ -5885,6 +5882,7 @@ void MacroAssembler::sign_extend(Register dst, Register src, int bits) { default: break; } + slli(dst, src, XLEN - bits); srai(dst, dst, XLEN - bits); } @@ -5977,7 +5975,7 @@ void MacroAssembler::move32_64(VMRegPair src, VMRegPair dst, Register tmp) { sd(src.first()->as_Register(), Address(sp, reg2offset_out(dst.first()))); } else { if (dst.first() != src.first()) { - sign_extend(dst.first()->as_Register(), src.first()->as_Register(), 32); + sext(dst.first()->as_Register(), src.first()->as_Register(), 32); } } } diff --git a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp index b7fba1d76d3..4cfc1c55254 100644 --- a/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp +++ b/src/hotspot/cpu/riscv/macroAssembler_riscv.hpp @@ -1362,7 +1362,8 @@ class MacroAssembler: public Assembler { void inflate_lo32(Register Rd, Register Rs, Register tmp1 = t0, Register tmp2 = t1); void inflate_hi32(Register Rd, Register Rs, Register tmp1 = t0, Register tmp2 = t1); - void ctzc_bit(Register Rd, Register Rs, bool isLL = false, Register tmp1 = t0, Register tmp2 = t1); + void ctzc_bits(Register Rd, Register Rs, bool isLL = false, + Register tmp1 = t0, Register tmp2 = t1); void zero_words(Register base, uint64_t cnt); address zero_words(Register ptr, Register cnt); @@ -1518,16 +1519,16 @@ class MacroAssembler: public Assembler { sltu(Rt, zr, Rt); break; case T_CHAR : - zero_extend(Rt, Rt, 16); + zext(Rt, Rt, 16); break; case T_BYTE : - sign_extend(Rt, Rt, 8); + sext(Rt, Rt, 8); break; case T_SHORT : - sign_extend(Rt, Rt, 16); + sext(Rt, Rt, 16); break; case T_INT : - sign_extend(Rt, Rt, 32); + sext(Rt, Rt, 32); break; case T_LONG : /* nothing to do */ break; case T_VOID : /* nothing to do */ break; @@ -1542,8 +1543,8 @@ class MacroAssembler: public Assembler { void double_compare(Register result, FloatRegister Rs1, FloatRegister Rs2, int unordered_result); // Zero/Sign-extend - void zero_extend(Register dst, Register src, int bits); - void sign_extend(Register dst, Register src, int bits); + void zext(Register dst, Register src, int bits); + void sext(Register dst, Register src, int bits); private: void cmp_x2i(Register dst, Register src1, Register src2, Register tmp, bool is_signed = true); diff --git a/src/hotspot/cpu/riscv/riscv.ad b/src/hotspot/cpu/riscv/riscv.ad index 32019251bbe..7cb42a6b30c 100644 --- a/src/hotspot/cpu/riscv/riscv.ad +++ b/src/hotspot/cpu/riscv/riscv.ad @@ -1626,7 +1626,7 @@ uint MachSpillCopyNode::implementation(C2_MacroAssembler *masm, PhaseRegAlloc *r case rc_int: if (dst_lo_rc == rc_int) { // gpr --> gpr copy if (!is64 && this->ideal_reg() != Op_RegI) { // zero extended for narrow oop or klass - __ zero_extend(as_Register(Matcher::_regEncode[dst_lo]), as_Register(Matcher::_regEncode[src_lo]), 32); + __ zext(as_Register(Matcher::_regEncode[dst_lo]), as_Register(Matcher::_regEncode[src_lo]), 32); } else { __ mv(as_Register(Matcher::_regEncode[dst_lo]), as_Register(Matcher::_regEncode[src_lo])); } @@ -8079,7 +8079,7 @@ instruct convI2L_reg_reg(iRegLNoSp dst, iRegIorL2I src) ins_cost(ALU_COST); format %{ "addw $dst, $src, zr\t#@convI2L_reg_reg" %} ins_encode %{ - __ sign_extend(as_Register($dst$$reg), as_Register($src$$reg), 32); + __ sext(as_Register($dst$$reg), as_Register($src$$reg), 32); %} ins_pipe(ialu_reg); %} @@ -8091,7 +8091,7 @@ instruct convL2I_reg(iRegINoSp dst, iRegL src) %{ format %{ "addw $dst, $src, zr\t#@convL2I_reg" %} ins_encode %{ - __ sign_extend(as_Register($dst$$reg), as_Register($src$$reg), 32); + __ sext(as_Register($dst$$reg), as_Register($src$$reg), 32); %} ins_pipe(ialu_reg); @@ -8103,10 +8103,10 @@ instruct convI2UL_reg_reg(iRegLNoSp dst, iRegIorL2I src, immL_32bits mask) match(Set dst (AndL (ConvI2L src) mask)); ins_cost(ALU_COST * 2); - format %{ "zero_extend $dst, $src, 32\t# i2ul, #@convI2UL_reg_reg" %} + format %{ "zext $dst, $src, 32\t# i2ul, #@convI2UL_reg_reg" %} ins_encode %{ - __ zero_extend(as_Register($dst$$reg), as_Register($src$$reg), 32); + __ zext(as_Register($dst$$reg), as_Register($src$$reg), 32); %} ins_pipe(ialu_reg_shift); @@ -8283,10 +8283,10 @@ instruct convP2I(iRegINoSp dst, iRegP src) %{ match(Set dst (ConvL2I (CastP2X src))); ins_cost(ALU_COST * 2); - format %{ "zero_extend $dst, $src, 32\t# ptr -> int, #@convP2I" %} + format %{ "zext $dst, $src, 32\t# ptr -> int, #@convP2I" %} ins_encode %{ - __ zero_extend($dst$$Register, $src$$Register, 32); + __ zext($dst$$Register, $src$$Register, 32); %} ins_pipe(ialu_reg); diff --git a/src/hotspot/cpu/riscv/runtime_riscv.cpp b/src/hotspot/cpu/riscv/runtime_riscv.cpp index 2f879b07e26..441bd1f241f 100644 --- a/src/hotspot/cpu/riscv/runtime_riscv.cpp +++ b/src/hotspot/cpu/riscv/runtime_riscv.cpp @@ -82,7 +82,7 @@ void OptoRuntime::generate_uncommon_trap_blob() { #endif // compiler left unloaded_class_index in j_rarg0 move to where the // runtime expects it. - __ sign_extend(c_rarg1, j_rarg0, 32); + __ sext(c_rarg1, j_rarg0, 32); // we need to set the past SP to the stack pointer of the stub frame // and the pc to the address where this runtime call will return diff --git a/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp b/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp index a8438ab4394..9af1b6a9bb1 100644 --- a/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp +++ b/src/hotspot/cpu/riscv/sharedRuntime_riscv.cpp @@ -2553,17 +2553,18 @@ SafepointBlob* SharedRuntime::generate_handler_blob(SharedStubId id, address cal // Verify the correct encoding of the poll we're about to skip. // See NativeInstruction::is_lwu_to_zr() __ lwu(t0, Address(x18)); - __ andi(t1, t0, 0b0000011); + __ andi(t1, t0, 0b1111111); __ mv(t2, 0b0000011); __ bne(t1, t2, bail); // 0-6:0b0000011 __ srli(t1, t0, 7); - __ andi(t1, t1, 0b00000); + __ andi(t1, t1, 0b11111); __ bnez(t1, bail); // 7-11:0b00000 __ srli(t1, t0, 12); - __ andi(t1, t1, 0b110); + __ andi(t1, t1, 0b111); __ mv(t2, 0b110); __ bne(t1, t2, bail); // 12-14:0b110 #endif + // Adjust return pc forward to step over the safepoint poll instruction __ add(x18, x18, NativeInstruction::instruction_size); __ sd(x18, Address(fp, frame::return_addr_offset * wordSize)); diff --git a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp index 7e6fe50e8f8..0b619923b06 100644 --- a/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/stubGenerator_riscv.cpp @@ -1643,8 +1643,8 @@ class StubGenerator: public StubCodeGenerator { __ bgtu(temp, t0, L_failed); // Have to clean up high 32 bits of 'src_pos' and 'dst_pos'. - __ zero_extend(src_pos, src_pos, 32); - __ zero_extend(dst_pos, dst_pos, 32); + __ zext(src_pos, src_pos, 32); + __ zext(dst_pos, dst_pos, 32); BLOCK_COMMENT("arraycopy_range_checks done"); } @@ -1767,14 +1767,14 @@ class StubGenerator: public StubCodeGenerator { __ beqz(src, L_failed); // if [src_pos < 0] then return -1 - __ sign_extend(t0, src_pos, 32); + __ sext(t0, src_pos, 32); __ bltz(t0, L_failed); // if dst is null then return -1 __ beqz(dst, L_failed); // if [dst_pos < 0] then return -1 - __ sign_extend(t0, dst_pos, 32); + __ sext(t0, dst_pos, 32); __ bltz(t0, L_failed); // registers used as temp @@ -1783,7 +1783,7 @@ class StubGenerator: public StubCodeGenerator { const Register lh = x30; // layout helper // if [length < 0] then return -1 - __ sign_extend(scratch_length, length, 32); // length (elements count, 32-bits value) + __ sext(scratch_length, length, 32); // length (elements count, 32-bits value) __ bltz(scratch_length, L_failed); __ load_klass(scratch_src_klass, src); @@ -1879,13 +1879,13 @@ class StubGenerator: public StubCodeGenerator { __ bnez(t0, L_copy_shorts); __ add(from, src, src_pos); // src_addr __ add(to, dst, dst_pos); // dst_addr - __ sign_extend(count, scratch_length, 32); // length + __ sext(count, scratch_length, 32); // length __ j(RuntimeAddress(byte_copy_entry)); __ BIND(L_copy_shorts); __ shadd(from, src_pos, src, t0, 1); // src_addr __ shadd(to, dst_pos, dst, t0, 1); // dst_addr - __ sign_extend(count, scratch_length, 32); // length + __ sext(count, scratch_length, 32); // length __ j(RuntimeAddress(short_copy_entry)); __ BIND(L_copy_ints); @@ -1893,7 +1893,7 @@ class StubGenerator: public StubCodeGenerator { __ bnez(t0, L_copy_longs); __ shadd(from, src_pos, src, t0, 2); // src_addr __ shadd(to, dst_pos, dst, t0, 2); // dst_addr - __ sign_extend(count, scratch_length, 32); // length + __ sext(count, scratch_length, 32); // length __ j(RuntimeAddress(int_copy_entry)); __ BIND(L_copy_longs); @@ -1902,7 +1902,7 @@ class StubGenerator: public StubCodeGenerator { BLOCK_COMMENT("assert long copy {"); Label L; __ andi(lh, lh, Klass::_lh_log2_element_size_mask); // lh -> x30_elsize - __ sign_extend(lh, lh, 32); + __ sext(lh, lh, 32); __ mv(t0, LogBytesPerLong); __ beq(x30_elsize, t0, L); __ stop("must be long copy, but elsize is wrong"); @@ -1912,7 +1912,7 @@ class StubGenerator: public StubCodeGenerator { #endif __ shadd(from, src_pos, src, t0, 3); // src_addr __ shadd(to, dst_pos, dst, t0, 3); // dst_addr - __ sign_extend(count, scratch_length, 32); // length + __ sext(count, scratch_length, 32); // length __ j(RuntimeAddress(long_copy_entry)); // ObjArrayKlass @@ -1932,7 +1932,7 @@ class StubGenerator: public StubCodeGenerator { __ add(from, from, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); __ shadd(to, dst_pos, dst, t0, LogBytesPerHeapOop); __ add(to, to, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); - __ sign_extend(count, scratch_length, 32); // length + __ sext(count, scratch_length, 32); // length __ BIND(L_plain_copy); __ j(RuntimeAddress(oop_copy_entry)); @@ -1955,8 +1955,8 @@ class StubGenerator: public StubCodeGenerator { __ add(from, from, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); __ shadd(to, dst_pos, dst, t0, LogBytesPerHeapOop); __ add(to, to, arrayOopDesc::base_offset_in_bytes(T_OBJECT)); - __ sign_extend(count, length, 32); // length (reloaded) - const Register sco_temp = c_rarg3; // this register is free now + __ sext(count, length, 32); // length (reloaded) + const Register sco_temp = c_rarg3; // this register is free now assert_different_registers(from, to, count, sco_temp, dst_klass, scratch_src_klass); @@ -2022,7 +2022,7 @@ class StubGenerator: public StubCodeGenerator { // Zero extend value // 8 bit -> 16 bit - __ andi(value, value, 0xff); + __ zext(value, value, 8); __ mv(tmp_reg, value); __ slli(tmp_reg, tmp_reg, 8); __ orr(value, value, tmp_reg); @@ -2039,7 +2039,7 @@ class StubGenerator: public StubCodeGenerator { shift = 1; // Zero extend value // 16 bit -> 32 bit - __ andi(value, value, 0xffff); + __ zext(value, value, 16); __ mv(tmp_reg, value); __ slli(tmp_reg, tmp_reg, 16); __ orr(value, value, tmp_reg); @@ -2099,9 +2099,8 @@ class StubGenerator: public StubCodeGenerator { __ srliw(cnt_words, count, 3 - shift); // number of words // 32 bit -> 64 bit - __ andi(value, value, 0xffffffff); - __ mv(tmp_reg, value); - __ slli(tmp_reg, tmp_reg, 32); + __ zext(value, value, 32); + __ slli(tmp_reg, value, 32); __ orr(value, value, tmp_reg); __ slli(tmp_reg, cnt_words, 3 - shift); @@ -2569,11 +2568,12 @@ class StubGenerator: public StubCodeGenerator { // Find the first different characters in the longwords and // compute their difference. __ bind(CALCULATE_DIFFERENCE); - __ ctzc_bit(tmp4, tmp3); + // count bits of trailing zero chars + __ ctzc_bits(tmp4, tmp3); __ srl(tmp1, tmp1, tmp4); __ srl(tmp2, tmp2, tmp4); - __ andi(tmp1, tmp1, 0xFFFF); - __ andi(tmp2, tmp2, 0xFFFF); + __ zext(tmp1, tmp1, 16); + __ zext(tmp2, tmp2, 16); __ sub(result, tmp1, tmp2); __ bind(DONE); __ ret(); @@ -2704,28 +2704,30 @@ class StubGenerator: public StubCodeGenerator { // Find the first different characters in the longwords and // compute their difference. __ bind(DIFF2); - __ ctzc_bit(tmp3, tmp4, isLL); // count zero from lsb to msb + // count bits of trailing zero chars + __ ctzc_bits(tmp3, tmp4, isLL); __ srl(tmp5, tmp5, tmp3); __ srl(cnt1, cnt1, tmp3); if (isLL) { - __ andi(tmp5, tmp5, 0xFF); - __ andi(cnt1, cnt1, 0xFF); + __ zext(tmp5, tmp5, 8); + __ zext(cnt1, cnt1, 8); } else { - __ andi(tmp5, tmp5, 0xFFFF); - __ andi(cnt1, cnt1, 0xFFFF); + __ zext(tmp5, tmp5, 16); + __ zext(cnt1, cnt1, 16); } __ sub(result, tmp5, cnt1); __ j(LENGTH_DIFF); __ bind(DIFF); - __ ctzc_bit(tmp3, tmp4, isLL); // count zero from lsb to msb + // count bits of trailing zero chars + __ ctzc_bits(tmp3, tmp4, isLL); __ srl(tmp1, tmp1, tmp3); __ srl(tmp2, tmp2, tmp3); if (isLL) { - __ andi(tmp1, tmp1, 0xFF); - __ andi(tmp2, tmp2, 0xFF); + __ zext(tmp1, tmp1, 8); + __ zext(tmp2, tmp2, 8); } else { - __ andi(tmp1, tmp1, 0xFFFF); - __ andi(tmp2, tmp2, 0xFFFF); + __ zext(tmp1, tmp1, 16); + __ zext(tmp2, tmp2, 16); } __ sub(result, tmp1, tmp2); __ j(LENGTH_DIFF); @@ -2787,7 +2789,8 @@ class StubGenerator: public StubCodeGenerator { __ sub(haystack_len, haystack_len, needle_len); // first is needle[0] - __ andi(first, ch1, needle_isL ? 0xFF : 0xFFFF, first); + __ zext(first, ch1, needle_isL ? 8 : 16); + uint64_t mask0101 = UCONST64(0x0101010101010101); uint64_t mask0001 = UCONST64(0x0001000100010001); __ mv(mask1, haystack_isL ? mask0101 : mask0001); @@ -2862,7 +2865,8 @@ class StubGenerator: public StubCodeGenerator { __ beqz(match_mask, NOMATCH); __ bind(L_SMALL_HAS_ZERO_LOOP); - __ ctzc_bit(trailing_zeros, match_mask, haystack_isL, ch2, tmp); // count trailing zeros + // count bits of trailing zero chars + __ ctzc_bits(trailing_zeros, match_mask, haystack_isL, ch2, tmp); __ addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15); __ mv(ch2, wordSize / haystack_chr_size); __ ble(needle_len, ch2, L_SMALL_CMP_LOOP_LAST_CMP2); @@ -2881,7 +2885,8 @@ class StubGenerator: public StubCodeGenerator { __ bind(L_SMALL_CMP_LOOP_NOMATCH); __ beqz(match_mask, NOMATCH); - __ ctzc_bit(trailing_zeros, match_mask, haystack_isL, tmp, ch2); + // count bits of trailing zero chars + __ ctzc_bits(trailing_zeros, match_mask, haystack_isL, tmp, ch2); __ addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15); __ add(result, result, 1); __ add(haystack, haystack, haystack_chr_size); @@ -2900,7 +2905,8 @@ class StubGenerator: public StubCodeGenerator { __ align(OptoLoopAlignment); __ bind(L_HAS_ZERO); - __ ctzc_bit(trailing_zeros, match_mask, haystack_isL, tmp, ch2); + // count bits of trailing zero chars + __ ctzc_bits(trailing_zeros, match_mask, haystack_isL, tmp, ch2); __ addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15); __ slli(needle_len, needle_len, BitsPerByte * wordSize / 2); __ orr(haystack_len, haystack_len, needle_len); // restore needle_len(32bits) @@ -2929,7 +2935,8 @@ class StubGenerator: public StubCodeGenerator { __ bind(L_CMP_LOOP_NOMATCH); __ beqz(match_mask, L_HAS_ZERO_LOOP_NOMATCH); - __ ctzc_bit(trailing_zeros, match_mask, haystack_isL, needle_len, ch2); // find next "first" char index + // count bits of trailing zero chars + __ ctzc_bits(trailing_zeros, match_mask, haystack_isL, needle_len, ch2); __ addi(trailing_zeros, trailing_zeros, haystack_isL ? 7 : 15); __ add(haystack, haystack, haystack_chr_size); __ j(L_HAS_ZERO_LOOP); @@ -2963,7 +2970,7 @@ class StubGenerator: public StubCodeGenerator { __ andi(result, result, haystack_isL ? -8 : -4); __ slli(tmp, match_mask, haystack_chr_shift); __ sub(haystack, haystack, tmp); - __ sign_extend(haystack_len, haystack_len, 32); + __ sext(haystack_len, haystack_len, 32); __ j(L_LOOP_PROCEED); __ align(OptoLoopAlignment); @@ -5044,7 +5051,7 @@ class StubGenerator: public StubCodeGenerator { __ rolw_imm(cur_w, cur_w, 1, t0); // copy the cur_w value to ws[8] - __ zero_extend(cur_w, cur_w, 32); + __ zext(cur_w, cur_w, 32); __ orr(ws[idx/2], ws[idx/2], cur_w); // shift the w't registers, so they start from ws[0] again. @@ -5151,11 +5158,11 @@ class StubGenerator: public StubCodeGenerator { assert_different_registers(a, b, c, d, e, prev_ab, prev_cd, prev_e, t0); __ slli(t0, b, 32); - __ zero_extend(prev_ab, a, 32); + __ zext(prev_ab, a, 32); __ orr(prev_ab, prev_ab, t0); __ slli(t0, d, 32); - __ zero_extend(prev_cd, c, 32); + __ zext(prev_cd, c, 32); __ orr(prev_cd, prev_cd, t0); __ mv(prev_e, e); @@ -5285,11 +5292,11 @@ class StubGenerator: public StubCodeGenerator { } // store back the state. - __ zero_extend(a, a, 32); + __ zext(a, a, 32); __ slli(b, b, 32); __ orr(a, a, b); __ sd(a, Address(state, 0)); - __ zero_extend(c, c, 32); + __ zext(c, c, 32); __ slli(d, d, 32); __ orr(c, c, d); __ sd(c, Address(state, 8)); @@ -5963,7 +5970,7 @@ class StubGenerator: public StubCodeGenerator { // s1 is initialized to the lower 16 bits of adler // s2 is initialized to the upper 16 bits of adler __ srliw(s2, adler, 16); // s2 = ((adler >> 16) & 0xffff) - __ zero_extend(s1, adler, 16); // s1 = (adler & 0xffff) + __ zext(s1, adler, 16); // s1 = (adler & 0xffff) // The pipelined loop needs at least 16 elements for 1 iteration // It does check this, but it is more effective to skip to the cleanup loop diff --git a/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp b/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp index 2e062cab605..bc67de54c4b 100644 --- a/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp +++ b/src/hotspot/cpu/riscv/templateInterpreterGenerator_riscv.cpp @@ -361,7 +361,7 @@ address TemplateInterpreterGenerator::generate_ArrayIndexOutOfBounds_handler() { // setup parameters // convention: expect aberrant index in register x11 - __ zero_extend(c_rarg2, x11, 32); + __ zext(c_rarg2, x11, 32); // convention: expect array in register x13 __ mv(c_rarg1, x13); __ call_VM(noreg, diff --git a/src/hotspot/cpu/riscv/templateTable_riscv.cpp b/src/hotspot/cpu/riscv/templateTable_riscv.cpp index e583579d618..e51604569f6 100644 --- a/src/hotspot/cpu/riscv/templateTable_riscv.cpp +++ b/src/hotspot/cpu/riscv/templateTable_riscv.cpp @@ -722,7 +722,7 @@ void TemplateTable::index_check(Register array, Register index) { __ mv(x11, index); } Label ok; - __ sign_extend(index, index, 32); + __ sext(index, index, 32); __ bltu(index, length, ok); __ mv(x13, array); __ mv(t1, Interpreter::_throw_ArrayIndexOutOfBoundsException_entry); @@ -740,7 +740,7 @@ void TemplateTable::iaload() { __ add(x11, x11, arrayOopDesc::base_offset_in_bytes(T_INT) >> 2); __ shadd(x10, x11, x10, t0, 2); __ access_load_at(T_INT, IN_HEAP | IS_ARRAY, x10, Address(x10), noreg, noreg); - __ sign_extend(x10, x10, 32); + __ sext(x10, x10, 32); } void TemplateTable::laload() { @@ -1545,7 +1545,7 @@ void TemplateTable::convert() { // Conversion switch (bytecode()) { case Bytecodes::_i2l: - __ sign_extend(x10, x10, 32); + __ sext(x10, x10, 32); break; case Bytecodes::_i2f: __ fcvt_s_w(f10, x10); @@ -1554,16 +1554,16 @@ void TemplateTable::convert() { __ fcvt_d_w(f10, x10); break; case Bytecodes::_i2b: - __ sign_extend(x10, x10, 8); + __ sext(x10, x10, 8); break; case Bytecodes::_i2c: - __ zero_extend(x10, x10, 16); + __ zext(x10, x10, 16); break; case Bytecodes::_i2s: - __ sign_extend(x10, x10, 16); + __ sext(x10, x10, 16); break; case Bytecodes::_l2i: - __ sign_extend(x10, x10, 32); + __ sext(x10, x10, 32); break; case Bytecodes::_l2f: __ fcvt_s_l(f10, x10); @@ -1783,7 +1783,7 @@ void TemplateTable::if_0cmp(Condition cc) { // assume branch is more often taken than not (loops use backward branches) Label not_taken; - __ sign_extend(x10, x10, 32); + __ sext(x10, x10, 32); switch (cc) { case equal: __ bnez(x10, not_taken); @@ -1817,7 +1817,7 @@ void TemplateTable::if_icmp(Condition cc) { // assume branch is more often taken than not (loops use backward branches) Label not_taken; __ pop_i(x11); - __ sign_extend(x10, x10, 32); + __ sext(x10, x10, 32); switch (cc) { case equal: __ bne(x11, x10, not_taken); @@ -2573,7 +2573,7 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr __ bnez(t0, notInt); // itos __ access_load_at(T_INT, IN_HEAP, x10, field, noreg, noreg); - __ sign_extend(x10, x10, 32); + __ sext(x10, x10, 32); __ push(itos); // Rewrite bytecode to be faster if (rc == may_rewrite) { @@ -3137,7 +3137,7 @@ void TemplateTable::fast_accessfield(TosState state) { break; case Bytecodes::_fast_igetfield: __ access_load_at(T_INT, IN_HEAP, x10, field, noreg, noreg); - __ sign_extend(x10, x10, 32); + __ sext(x10, x10, 32); break; case Bytecodes::_fast_bgetfield: __ access_load_at(T_BYTE, IN_HEAP, x10, field, noreg, noreg); @@ -3183,7 +3183,7 @@ void TemplateTable::fast_xaccess(TosState state) { case itos: __ add(x10, x10, x11); __ access_load_at(T_INT, IN_HEAP, x10, Address(x10, 0), noreg, noreg); - __ sign_extend(x10, x10, 32); + __ sext(x10, x10, 32); break; case atos: __ add(x10, x10, x11); diff --git a/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp b/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp index f998e86256f..c12f883ab58 100644 --- a/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp +++ b/src/hotspot/cpu/s390/c1_LIRGenerator_s390.cpp @@ -227,19 +227,25 @@ void LIRGenerator::cmp_reg_mem(LIR_Condition condition, LIR_Opr reg, LIR_Opr bas } bool LIRGenerator::strength_reduce_multiply(LIR_Opr left, jint c, LIR_Opr result, LIR_Opr tmp) { + juint u_value = (juint)c; if (tmp->is_valid()) { - if (is_power_of_2(c + 1)) { + if (is_power_of_2(u_value + 1)) { __ move(left, tmp); - __ shift_left(left, log2i_exact(c + 1), left); + __ shift_left(left, log2i_exact(u_value + 1), left); __ sub(left, tmp, result); return true; - } else if (is_power_of_2(c - 1)) { + } else if (is_power_of_2(u_value - 1)) { __ move(left, tmp); - __ shift_left(left, log2i_exact(c - 1), left); + __ shift_left(left, log2i_exact(u_value - 1), left); __ add(left, tmp, result); return true; } } + + if (c == -1) { + __ negate(left, result); + return true; + } return false; } @@ -496,8 +502,8 @@ void LIRGenerator::do_ArithmeticOp_Int(ArithmeticOp* x) { if (x->op() == Bytecodes::_imul) { bool use_tmp = false; if (right_arg->is_constant()) { - int iconst = right_arg->get_jint_constant(); - if (is_power_of_2(iconst - 1) || is_power_of_2(iconst + 1)) { + juint u_const = (juint)right_arg->get_jint_constant(); + if (is_power_of_2(u_const - 1) || is_power_of_2(u_const + 1)) { use_tmp = true; } } diff --git a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp index c8393fe0e60..faa24bc8807 100644 --- a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.cpp @@ -83,9 +83,11 @@ void C2_MacroAssembler::load_narrow_klass_compact_c2(Register dst, Address src) // Exactly the number of characters indicated by the return value have been written to dst. // If precise is false, a few characters more than indicated by the return value may have been // written to the dst array. In any failure case, The result value indexes the first invalid character. -unsigned int C2_MacroAssembler::string_compress(Register result, Register src, Register dst, Register cnt, - Register tmp, bool precise, bool toASCII) { - assert_different_registers(Z_R0, Z_R1, result, src, dst, cnt, tmp); +unsigned int C2_MacroAssembler::string_compress(Register result, Register Rsrc, Register Rdst, Register Rcnt, + Register tmp, bool precise, bool toASCII, VectorRegister Vtmp1, VectorRegister Vtmp2, + VectorRegister Vmask, VectorRegister Vzero, VectorRegister Vsrc_first, VectorRegister v21, + VectorRegister v22, VectorRegister Vsrc_last) { + assert_different_registers(Z_R0, Z_R1, result, Rsrc, Rdst, Rcnt, tmp); unsigned short char_mask = 0xff00; // all selected bits must be '0' for a char to be valid unsigned int mask_ix_l = 0; // leftmost one bit pos in mask @@ -104,10 +106,7 @@ unsigned int C2_MacroAssembler::string_compress(Register result, Register src, R } int block_start = offset(); - Register Rsrc = src; - Register Rdst = dst; Register Rix = tmp; - Register Rcnt = cnt; Register Rmask = result; // holds incompatibility check mask until result value is stored. Label ScalarShortcut, AllDone; @@ -169,7 +168,6 @@ unsigned int C2_MacroAssembler::string_compress(Register result, Register src, R #endif clear_reg(Z_R0); // make sure register is properly initialized. -#if 0 if (VM_Version::has_VectorFacility()) { const int min_vcnt = 32; // Minimum #characters required to use vector instructions. // Otherwise just do nothing in vector mode. @@ -178,13 +176,6 @@ unsigned int C2_MacroAssembler::string_compress(Register result, Register src, R const int log_min_vcnt = exact_log2(min_vcnt); Label VectorLoop, VectorDone, VectorBreak; - VectorRegister Vtmp1 = Z_V16; - VectorRegister Vtmp2 = Z_V17; - VectorRegister Vmask = Z_V18; - VectorRegister Vzero = Z_V19; - VectorRegister Vsrc_first = Z_V20; - VectorRegister Vsrc_last = Z_V23; - assert((Vsrc_last->encoding() - Vsrc_first->encoding() + 1) == min_vcnt/8, "logic error"); assert(VM_Version::has_DistinctOpnds(), "Assumption when has_VectorFacility()"); z_srak(Rix, Rcnt, log_min_vcnt); // # vector loop iterations @@ -199,8 +190,8 @@ unsigned int C2_MacroAssembler::string_compress(Register result, Register src, R add2reg(Rsrc, min_vcnt*2); //---< check for incompatible character >--- - z_vo(Vtmp1, Z_V20, Z_V21); - z_vo(Vtmp2, Z_V22, Z_V23); + z_vo(Vtmp1, Vsrc_first, v21); + z_vo(Vtmp2, v22, Vsrc_last); z_vo(Vtmp1, Vtmp1, Vtmp2); z_vn(Vtmp1, Vtmp1, Vmask); z_vceqhs(Vtmp1, Vtmp1, Vzero); // all bits selected by mask must be zero for successful compress. @@ -208,8 +199,8 @@ unsigned int C2_MacroAssembler::string_compress(Register result, Register src, R // re-process data from current iteration in break handler. //---< pack & store characters >--- - z_vpkh(Vtmp1, Z_V20, Z_V21); // pack (src1, src2) -> tmp1 - z_vpkh(Vtmp2, Z_V22, Z_V23); // pack (src3, src4) -> tmp2 + z_vpkh(Vtmp1, Vsrc_first, v21); // pack (src1, src2) -> tmp1 + z_vpkh(Vtmp2, v22, Vsrc_last); // pack (src3, src4) -> tmp2 z_vstm(Vtmp1, Vtmp2, 0, Rdst); // store packed string add2reg(Rdst, min_vcnt); @@ -224,7 +215,6 @@ unsigned int C2_MacroAssembler::string_compress(Register result, Register src, R bind(VectorDone); } -#endif { const int min_cnt = 8; // Minimum #characters required to use unrolled loop. @@ -419,7 +409,9 @@ unsigned int C2_MacroAssembler::string_inflate_trot(Register src, Register dst, // Note: // cnt is signed int. Do not rely on high word! // counts # characters, not bytes. -unsigned int C2_MacroAssembler::string_inflate(Register src, Register dst, Register cnt, Register tmp) { +unsigned int C2_MacroAssembler::string_inflate(Register src, Register dst, Register cnt, Register tmp, + VectorRegister v20, VectorRegister v21, VectorRegister v22, + VectorRegister v23, VectorRegister v24, VectorRegister v25) { assert_different_registers(Z_R0, Z_R1, src, dst, cnt, tmp); BLOCK_COMMENT("string_inflate {"); @@ -463,7 +455,6 @@ unsigned int C2_MacroAssembler::string_inflate(Register src, Register dst, Regis #endif clear_reg(Z_R0); // make sure register is properly initialized. -#if 0 if (VM_Version::has_VectorFacility()) { const int min_vcnt = 32; // Minimum #characters required to use vector instructions. // Otherwise just do nothing in vector mode. @@ -478,21 +469,20 @@ unsigned int C2_MacroAssembler::string_inflate(Register src, Register dst, Regis z_sllg(Z_R0, Rix, log_min_vcnt); // remember #chars that will be processed by vector loop bind(VectorLoop); - z_vlm(Z_V20, Z_V21, 0, Rsrc); // get next 32 characters (single-byte) + z_vlm(v20, v21, 0, Rsrc); // get next 32 characters (single-byte) add2reg(Rsrc, min_vcnt); - z_vuplhb(Z_V22, Z_V20); // V2 <- (expand) V0(high) - z_vupllb(Z_V23, Z_V20); // V3 <- (expand) V0(low) - z_vuplhb(Z_V24, Z_V21); // V4 <- (expand) V1(high) - z_vupllb(Z_V25, Z_V21); // V5 <- (expand) V1(low) - z_vstm(Z_V22, Z_V25, 0, Rdst); // store next 32 bytes + z_vuplhb(v22, v20); // V2 <- (expand) V0(high) + z_vupllb(v23, v20); // V3 <- (expand) V0(low) + z_vuplhb(v24, v21); // V4 <- (expand) V1(high) + z_vupllb(v25, v21); // V5 <- (expand) V1(low) + z_vstm(v22, v25, 0, Rdst); // store next 32 bytes add2reg(Rdst, min_vcnt*2); z_brct(Rix, VectorLoop); bind(VectorDone); } -#endif const int min_cnt = 8; // Minimum #characters required to use unrolled scalar loop. // Otherwise just do nothing in unrolled scalar mode. @@ -611,7 +601,9 @@ unsigned int C2_MacroAssembler::string_inflate(Register src, Register dst, Regis // Kills: tmp, Z_R0, Z_R1. // Note: // len is signed int. Counts # characters, not bytes. -unsigned int C2_MacroAssembler::string_inflate_const(Register src, Register dst, Register tmp, int len) { +unsigned int C2_MacroAssembler::string_inflate_const(Register src, Register dst, Register tmp, int len , + VectorRegister v20, VectorRegister v21, VectorRegister v22, + VectorRegister v23, VectorRegister v24, VectorRegister v25) { assert_different_registers(Z_R0, Z_R1, src, dst, tmp); BLOCK_COMMENT("string_inflate_const {"); @@ -627,7 +619,6 @@ unsigned int C2_MacroAssembler::string_inflate_const(Register src, Register dst, bool restore_inputs = false; bool workreg_clear = false; -#if 0 if ((len >= 32) && VM_Version::has_VectorFacility()) { const int min_vcnt = 32; // Minimum #characters required to use vector instructions. // Otherwise just do nothing in vector mode. @@ -638,12 +629,12 @@ unsigned int C2_MacroAssembler::string_inflate_const(Register src, Register dst, Label VectorLoop; if (iterations == 1) { - z_vlm(Z_V20, Z_V21, 0+src_off, Rsrc); // get next 32 characters (single-byte) - z_vuplhb(Z_V22, Z_V20); // V2 <- (expand) V0(high) - z_vupllb(Z_V23, Z_V20); // V3 <- (expand) V0(low) - z_vuplhb(Z_V24, Z_V21); // V4 <- (expand) V1(high) - z_vupllb(Z_V25, Z_V21); // V5 <- (expand) V1(low) - z_vstm(Z_V22, Z_V25, 0+dst_off, Rdst); // store next 32 bytes + z_vlm(v20, v21, 0+src_off, Rsrc); // get next 32 characters (single-byte) + z_vuplhb(v22, v20); // V2 <- (expand) V0(high) + z_vupllb(v23, v20); // V3 <- (expand) V0(low) + z_vuplhb(v24, v21); // V4 <- (expand) V1(high) + z_vupllb(v25, v21); // V5 <- (expand) V1(low) + z_vstm(v22, v25, 0+dst_off, Rdst); // store next 32 bytes src_off += min_vcnt; dst_off += min_vcnt*2; @@ -652,14 +643,14 @@ unsigned int C2_MacroAssembler::string_inflate_const(Register src, Register dst, z_lgfi(Rix, len>>log_min_vcnt); bind(VectorLoop); - z_vlm(Z_V20, Z_V21, 0, Rsrc); // get next 32 characters (single-byte) + z_vlm(v20, v21, 0, Rsrc); // get next 32 characters (single-byte) add2reg(Rsrc, min_vcnt); - z_vuplhb(Z_V22, Z_V20); // V2 <- (expand) V0(high) - z_vupllb(Z_V23, Z_V20); // V3 <- (expand) V0(low) - z_vuplhb(Z_V24, Z_V21); // V4 <- (expand) V1(high) - z_vupllb(Z_V25, Z_V21); // V5 <- (expand) V1(low) - z_vstm(Z_V22, Z_V25, 0, Rdst); // store next 32 bytes + z_vuplhb(v22, v20); // V2 <- (expand) V0(high) + z_vupllb(v23, v20); // V3 <- (expand) V0(low) + z_vuplhb(v24, v21); // V4 <- (expand) V1(high) + z_vupllb(v25, v21); // V5 <- (expand) V1(low) + z_vstm(v22, v25, 0, Rdst); // store next 32 bytes add2reg(Rdst, min_vcnt*2); z_brct(Rix, VectorLoop); @@ -675,15 +666,14 @@ unsigned int C2_MacroAssembler::string_inflate_const(Register src, Register dst, nprocessed += iterations << log_min_vcnt; assert(iterations == 1, "must be!"); - z_vl(Z_V20, 0+src_off, Z_R0, Rsrc); // get next 16 characters (single-byte) - z_vuplhb(Z_V22, Z_V20); // V2 <- (expand) V0(high) - z_vupllb(Z_V23, Z_V20); // V3 <- (expand) V0(low) - z_vstm(Z_V22, Z_V23, 0+dst_off, Rdst); // store next 32 bytes + z_vl(v20, 0+src_off, Z_R0, Rsrc); // get next 16 characters (single-byte) + z_vuplhb(v22, v20); // V2 <- (expand) V0(high) + z_vupllb(v23, v20); // V3 <- (expand) V0(low) + z_vstm(v22, v23, 0+dst_off, Rdst); // store next 32 bytes src_off += min_vcnt; dst_off += min_vcnt*2; } -#endif if ((len-nprocessed) > 8) { const int min_cnt = 8; // Minimum #characters required to use unrolled scalar loop. diff --git a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.hpp b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.hpp index 26c3c9a2bb5..abf0db8e520 100644 --- a/src/hotspot/cpu/s390/c2_MacroAssembler_s390.hpp +++ b/src/hotspot/cpu/s390/c2_MacroAssembler_s390.hpp @@ -44,8 +44,10 @@ // Kills: tmp, Z_R0, Z_R1. // Early clobber: result. // Boolean precise controls accuracy of result value. - unsigned int string_compress(Register result, Register src, Register dst, Register cnt, - Register tmp, bool precise, bool toASCII); + unsigned int string_compress(Register result, Register Rsrc, Register Rdst, Register Rcnt, + Register tmp, bool precise, bool toASCII, VectorRegister Vtmp1, VectorRegister Vtmp2, + VectorRegister Vmask, VectorRegister Vzero, VectorRegister Vsrc_first, VectorRegister v21, + VectorRegister v22, VectorRegister Vsrc_last); // Inflate byte[] to char[]. unsigned int string_inflate_trot(Register src, Register dst, Register cnt, Register tmp); @@ -54,14 +56,16 @@ // Restores: src, dst // Uses: cnt // Kills: tmp, Z_R0, Z_R1. - unsigned int string_inflate(Register src, Register dst, Register cnt, Register tmp); + unsigned int string_inflate(Register src, Register dst, Register cnt, Register tmp, VectorRegister v20, VectorRegister v21, + VectorRegister v22, VectorRegister v23, VectorRegister v24, VectorRegister v25); // Inflate byte[] to char[], length known at compile time. // Restores: src, dst // Kills: tmp, Z_R0, Z_R1. // Note: // len is signed int. Counts # characters, not bytes. - unsigned int string_inflate_const(Register src, Register dst, Register tmp, int len); + unsigned int string_inflate_const(Register src, Register dst, Register tmp, int len , VectorRegister v20, VectorRegister v21, + VectorRegister v22, VectorRegister v23, VectorRegister v24, VectorRegister v25); unsigned int count_positives(Register result, Register src, Register cnt, Register tmp); diff --git a/src/hotspot/cpu/s390/frame_s390.hpp b/src/hotspot/cpu/s390/frame_s390.hpp index b6e4726cd45..3a6b3f33a55 100644 --- a/src/hotspot/cpu/s390/frame_s390.hpp +++ b/src/hotspot/cpu/s390/frame_s390.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016, 2023 SAP SE. All rights reserved. + * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/s390/frame_s390.inline.hpp b/src/hotspot/cpu/s390/frame_s390.inline.hpp index 62e202337fe..d29106cfc40 100644 --- a/src/hotspot/cpu/s390/frame_s390.inline.hpp +++ b/src/hotspot/cpu/s390/frame_s390.inline.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016 SAP SE. All rights reserved. + * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/s390/nativeInst_s390.hpp b/src/hotspot/cpu/s390/nativeInst_s390.hpp index 8003e1d42f2..fcae833769f 100644 --- a/src/hotspot/cpu/s390/nativeInst_s390.hpp +++ b/src/hotspot/cpu/s390/nativeInst_s390.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016 SAP SE. All rights reserved. + * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/s390/s390.ad b/src/hotspot/cpu/s390/s390.ad index 6fb73a0e64c..d6ab89a61d2 100644 --- a/src/hotspot/cpu/s390/s390.ad +++ b/src/hotspot/cpu/s390/s390.ad @@ -762,6 +762,56 @@ reg_class z_v_reg( Z_VR31, Z_VR31_H, Z_VR31_J, Z_VR31_K ); +// class for vector register v16 +reg_class z_vreg_16( + Z_VR16, Z_VR16_H, Z_VR16_J, Z_VR16_K +); + +// class for vector register v17 +reg_class z_vreg_17( + Z_VR17, Z_VR17_H, Z_VR17_J, Z_VR17_K +); + +// class for vector register v18 +reg_class z_vreg_18( + Z_VR18, Z_VR18_H, Z_VR18_J, Z_VR18_K +); + +// class for vector register v19 +reg_class z_vreg_19( + Z_VR19, Z_VR19_H, Z_VR19_J, Z_VR19_K +); + +// class for vector register v20 +reg_class z_vreg_20( + Z_VR20, Z_VR20_H, Z_VR20_J, Z_VR20_K +); + +// class for vector register v21 +reg_class z_vreg_21( + Z_VR21, Z_VR21_H, Z_VR21_J, Z_VR21_K +); + +// class for vector register v22 +reg_class z_vreg_22( + Z_VR22, Z_VR22_H, Z_VR22_J, Z_VR22_K +); + +// class for vector register v23 +reg_class z_vreg_23( + Z_VR23, Z_VR23_H, Z_VR23_J, Z_VR23_K +); + +// class for vector register v24 +reg_class z_vreg_24( + Z_VR24, Z_VR24_H, Z_VR24_J, Z_VR24_K +); + +// class for vector register v25 +reg_class z_vreg_25( + Z_VR25, Z_VR25_H, Z_VR25_J, Z_VR25_K +); + %} //----------DEFINITION BLOCK--------------------------------------------------- @@ -2690,11 +2740,89 @@ ins_attrib ins_should_rematerialize(false); operand vecX() %{ constraint(ALLOC_IN_RC(z_v_reg)); match(VecX); + match(v16TempReg); + match(v17TempReg); + match(v18TempReg); + match(v19TempReg); + match(v20TempReg); + match(v21TempReg); + match(v22TempReg); + match(v23TempReg); + match(v24TempReg); + match(v25TempReg); + format %{ %} + interface(REG_INTER); +%} + +operand v16TempReg() %{ + constraint(ALLOC_IN_RC(z_vreg_16)); + match(VecX); + format %{ %} + interface(REG_INTER); +%} +operand v17TempReg() %{ + constraint(ALLOC_IN_RC(z_vreg_17)); + match(VecX); format %{ %} interface(REG_INTER); %} +operand v18TempReg() %{ + constraint(ALLOC_IN_RC(z_vreg_18)); + match(VecX); + format %{ %} + interface(REG_INTER); +%} + +operand v19TempReg() %{ + constraint(ALLOC_IN_RC(z_vreg_19)); + match(VecX); + format %{ %} + interface(REG_INTER); +%} + +operand v20TempReg() %{ + constraint(ALLOC_IN_RC(z_vreg_20)); + match(VecX); + format %{ %} + interface(REG_INTER); +%} + +operand v21TempReg() %{ + constraint(ALLOC_IN_RC(z_vreg_21)); + match(VecX); + format %{ %} + interface(REG_INTER); +%} + +operand v22TempReg() %{ + constraint(ALLOC_IN_RC(z_vreg_22)); + match(VecX); + format %{ %} + interface(REG_INTER); +%} + +operand v23TempReg() %{ + constraint(ALLOC_IN_RC(z_vreg_23)); + match(VecX); + format %{ %} + interface(REG_INTER); +%} + +operand v24TempReg() %{ + constraint(ALLOC_IN_RC(z_vreg_24)); + match(VecX); + format %{ %} + interface(REG_INTER); +%} + +operand v25TempReg() %{ + constraint(ALLOC_IN_RC(z_vreg_25)); + match(VecX); + format %{ %} + interface(REG_INTER); +%} //---------------------------------------------- // SIGNED (shorter than INT) immediate operands @@ -10477,14 +10605,17 @@ instruct indexOf_UL(iRegP haystack, rarg2RegI haycnt, iRegP needle, rarg5RegI ne %} // char[] to byte[] compression -instruct string_compress(iRegP src, iRegP dst, iRegI result, iRegI len, iRegI tmp, flagsReg cr) %{ +instruct string_compress(iRegP src, iRegP dst, iRegI result, iRegI len, iRegI tmp, v16TempReg v16, v17TempReg v17, v18TempReg v18, + v19TempReg v19, v20TempReg v20, v21TempReg v21, v22TempReg v22, v23TempReg v23, flagsReg cr) %{ match(Set result (StrCompressedCopy src (Binary dst len))); - effect(TEMP_DEF result, TEMP tmp, KILL cr); // R0, R1 are killed, too. + effect(TEMP_DEF result, TEMP tmp, TEMP v16, TEMP v17, TEMP v18, TEMP v19, TEMP v20, TEMP v21, TEMP v22, TEMP v23, KILL cr); // R0, R1 are killed, too. ins_cost(300); format %{ "String Compress $src->$dst($len) -> $result" %} ins_encode %{ __ string_compress($result$$Register, $src$$Register, $dst$$Register, $len$$Register, - $tmp$$Register, true, false); + $tmp$$Register, true, false, $v16$$VectorRegister, $v17$$VectorRegister, $v18$$VectorRegister, + $v19$$VectorRegister, $v20$$VectorRegister, $v21$$VectorRegister, $v22$$VectorRegister, + $v23$$VectorRegister); %} ins_pipe(pipe_class_dummy); %} @@ -10503,25 +10634,31 @@ instruct string_compress(iRegP src, iRegP dst, iRegI result, iRegI len, iRegI tm //%} // byte[] to char[] inflation -instruct string_inflate(Universe dummy, iRegP src, iRegP dst, iRegI len, iRegI tmp, flagsReg cr) %{ +instruct string_inflate(Universe dummy, iRegP src, iRegP dst, iRegI len, iRegI tmp, v20TempReg v20, v21TempReg v21, v22TempReg v22, v23TempReg v23, + v24TempReg v24, v25TempReg v25, flagsReg cr) %{ match(Set dummy (StrInflatedCopy src (Binary dst len))); - effect(TEMP tmp, KILL cr); // R0, R1 are killed, too. + effect(TEMP tmp, TEMP v20, TEMP v21, TEMP v22, TEMP v23, TEMP v24, TEMP v25, KILL cr); // R0, R1 are killed, too. ins_cost(300); format %{ "String Inflate $src->$dst($len)" %} ins_encode %{ - __ string_inflate($src$$Register, $dst$$Register, $len$$Register, $tmp$$Register); + __ string_inflate($src$$Register, $dst$$Register, $len$$Register, $tmp$$Register, $v20$$VectorRegister, + $v21$$VectorRegister, $v22$$VectorRegister, $v23$$VectorRegister, $v24$$VectorRegister, + $v25$$VectorRegister); %} ins_pipe(pipe_class_dummy); %} // byte[] to char[] inflation -instruct string_inflate_const(Universe dummy, iRegP src, iRegP dst, iRegI tmp, immI len, flagsReg cr) %{ +instruct string_inflate_const(Universe dummy, iRegP src, iRegP dst, iRegI tmp, immI len, v20TempReg v20, v21TempReg v21, v22TempReg v22, v23TempReg v23, + v24TempReg v24, v25TempReg v25, flagsReg cr) %{ match(Set dummy (StrInflatedCopy src (Binary dst len))); - effect(TEMP tmp, KILL cr); // R0, R1 are killed, too. + effect(TEMP tmp, TEMP v20, TEMP v21, TEMP v22, TEMP v23, TEMP v24, TEMP v25, KILL cr); // R0, R1 are killed, too. ins_cost(300); format %{ "String Inflate (constLen) $src->$dst($len)" %} ins_encode %{ - __ string_inflate_const($src$$Register, $dst$$Register, $tmp$$Register, $len$$constant); + __ string_inflate_const($src$$Register, $dst$$Register, $tmp$$Register, $len$$constant , $v20$$VectorRegister, + $v21$$VectorRegister, $v22$$VectorRegister, $v23$$VectorRegister, $v24$$VectorRegister, + $v25$$VectorRegister); %} ins_pipe(pipe_class_dummy); %} @@ -10539,29 +10676,37 @@ instruct count_positives(iRegP ary1, iRegI len, iRegI result, iRegI tmp, flagsRe %} // encode char[] to byte[] in ISO_8859_1 -instruct encode_iso_array(iRegP src, iRegP dst, iRegI result, iRegI len, iRegI tmp, flagsReg cr) %{ +instruct encode_iso_array(iRegP src, iRegP dst, iRegI result, iRegI len, iRegI tmp, v16TempReg v16, v17TempReg v17, v18TempReg v18, v19TempReg v19, v20TempReg v20, v21TempReg v21, + v22TempReg v22, v23TempReg v23, flagsReg cr) %{ predicate(!((EncodeISOArrayNode*)n)->is_ascii()); match(Set result (EncodeISOArray src (Binary dst len))); - effect(TEMP_DEF result, TEMP tmp, KILL cr); // R0, R1 are killed, too. + effect(TEMP_DEF result, TEMP tmp, TEMP v16, TEMP v17, TEMP v18, TEMP v19, + TEMP v20, TEMP v21, TEMP v22, TEMP v23, KILL cr); // R0, R1 are killed, too. ins_cost(300); format %{ "Encode iso array $src->$dst($len) -> $result" %} ins_encode %{ __ string_compress($result$$Register, $src$$Register, $dst$$Register, $len$$Register, - $tmp$$Register, true, false); + $tmp$$Register, true, false, $v16$$VectorRegister, $v17$$VectorRegister, $v18$$VectorRegister, + $v19$$VectorRegister, $v20$$VectorRegister, $v21$$VectorRegister, $v22$$VectorRegister, + $v23$$VectorRegister); %} ins_pipe(pipe_class_dummy); %} // encode char[] to byte[] in ASCII -instruct encode_ascii_array(iRegP src, iRegP dst, iRegI result, iRegI len, iRegI tmp, flagsReg cr) %{ +instruct encode_ascii_array(iRegP src, iRegP dst, iRegI result, iRegI len, iRegI tmp, v16TempReg v16, v17TempReg v17, v18TempReg v18, v19TempReg v19, v20TempReg v20, v21TempReg v21, + v22TempReg v22, v23TempReg v23, flagsReg cr) %{ predicate(((EncodeISOArrayNode*)n)->is_ascii()); match(Set result (EncodeISOArray src (Binary dst len))); - effect(TEMP_DEF result, TEMP tmp, KILL cr); // R0, R1 are killed, too. + effect(TEMP_DEF result, TEMP tmp, TEMP v16, TEMP v17, TEMP v18, TEMP v19, + TEMP v20, TEMP v21, TEMP v22, TEMP v23, KILL cr); // R0, R1 are killed, too. ins_cost(300); format %{ "Encode ascii array $src->$dst($len) -> $result" %} ins_encode %{ __ string_compress($result$$Register, $src$$Register, $dst$$Register, $len$$Register, - $tmp$$Register, true, true); + $tmp$$Register, true, true, $v16$$VectorRegister, $v17$$VectorRegister, $v18$$VectorRegister, + $v19$$VectorRegister, $v20$$VectorRegister, $v21$$VectorRegister, $v22$$VectorRegister, + $v23$$VectorRegister); %} ins_pipe(pipe_class_dummy); %} diff --git a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp index 4871706aadd..1c4089d5beb 100644 --- a/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp +++ b/src/hotspot/cpu/s390/templateInterpreterGenerator_s390.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016, 2023 SAP SE. All rights reserved. + * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/x86/c2_intelJccErratum_x86.cpp b/src/hotspot/cpu/x86/c2_intelJccErratum_x86.cpp index e03e04339a1..f726a831c9f 100644 --- a/src/hotspot/cpu/x86/c2_intelJccErratum_x86.cpp +++ b/src/hotspot/cpu/x86/c2_intelJccErratum_x86.cpp @@ -25,7 +25,6 @@ #include "precompiled.hpp" #include "asm/macroAssembler.hpp" #include "c2_intelJccErratum_x86.hpp" -#include "opto/cfgnode.hpp" #include "opto/compile.hpp" #include "opto/machnode.hpp" #include "opto/node.hpp" diff --git a/src/hotspot/cpu/zero/frame_zero.cpp b/src/hotspot/cpu/zero/frame_zero.cpp index f049c4bda25..7c65387f238 100644 --- a/src/hotspot/cpu/zero/frame_zero.cpp +++ b/src/hotspot/cpu/zero/frame_zero.cpp @@ -125,10 +125,10 @@ bool frame::safe_for_sender(JavaThread *thread) { bool frame::is_interpreted_frame_valid(JavaThread *thread) const { assert(is_interpreted_frame(), "Not an interpreted frame"); // These are reasonable sanity checks - if (fp() == 0 || (intptr_t(fp()) & (wordSize-1)) != 0) { + if (fp() == nullptr || (intptr_t(fp()) & (wordSize-1)) != 0) { return false; } - if (sp() == 0 || (intptr_t(sp()) & (wordSize-1)) != 0) { + if (sp() == nullptr || (intptr_t(sp()) & (wordSize-1)) != 0) { return false; } // These are hacks to keep us out of trouble. diff --git a/src/hotspot/os/aix/attachListener_aix.cpp b/src/hotspot/os/aix/attachListener_aix.cpp index bf11d813e06..721901bb0e2 100644 --- a/src/hotspot/os/aix/attachListener_aix.cpp +++ b/src/hotspot/os/aix/attachListener_aix.cpp @@ -39,7 +39,7 @@ #include #ifndef UNIX_PATH_MAX -#define UNIX_PATH_MAX sizeof(((struct sockaddr_un *)0)->sun_path) +#define UNIX_PATH_MAX sizeof(sockaddr_un::sun_path) #endif // The attach mechanism on AIX uses a UNIX domain socket. An attach listener diff --git a/src/hotspot/os/aix/osThread_aix.cpp b/src/hotspot/os/aix/osThread_aix.cpp index c424b044c09..86d9821e5a5 100644 --- a/src/hotspot/os/aix/osThread_aix.cpp +++ b/src/hotspot/os/aix/osThread_aix.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/os/aix/osThread_aix.hpp b/src/hotspot/os/aix/osThread_aix.hpp index 514e554101e..771c2c19e45 100644 --- a/src/hotspot/os/aix/osThread_aix.hpp +++ b/src/hotspot/os/aix/osThread_aix.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2013 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/os/aix/porting_aix.hpp b/src/hotspot/os/aix/porting_aix.hpp index 15f1e0afc54..a1a22d81471 100644 --- a/src/hotspot/os/aix/porting_aix.hpp +++ b/src/hotspot/os/aix/porting_aix.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/os/bsd/memMapPrinter_macosx.cpp b/src/hotspot/os/bsd/memMapPrinter_macosx.cpp new file mode 100644 index 00000000000..33c30ab6f70 --- /dev/null +++ b/src/hotspot/os/bsd/memMapPrinter_macosx.cpp @@ -0,0 +1,383 @@ +/* + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#if defined(__APPLE__) + +#include "precompiled.hpp" + +#include "nmt/memMapPrinter.hpp" +#include "runtime/os.hpp" +#include "utilities/align.hpp" +#include "utilities/globalDefinitions.hpp" +#include "utilities/powerOfTwo.hpp" + +#include +#include +#include +#include +#include + +#include +#include +#include + +// maximum number of mapping records returned +static const int MAX_REGIONS_RETURNED = 1000000; + +// ::mmap() on MacOS is a layer on top of Mach system calls, and will allocate in 128MB chunks. +// This code will coalesce a series of identical 128GB chunks (maybe followed by one smaller chunk +// with identical flags) into one. +// Unfortunately, two or more identically allocated contiguous sections will appear as one, if the +// first section is size 128MB. vmmap(1) has the same issue. +static const int MACOS_PARTIAL_ALLOCATION_SIZE = 128 * M; + +class MappingInfo { + proc_regioninfo _rinfo; +public: + const char* _address; + size_t _size; + stringStream _share_buffer; + stringStream _type_buffer; + stringStream _protect_buffer; + stringStream _file_name; + const char* _tag_text; + + MappingInfo() : _address(nullptr), _size(0), _tag_text(nullptr) {} + + void reset() { + _share_buffer.reset(); + _protect_buffer.reset(); + _type_buffer.reset(); + _file_name.reset(); + _tag_text = nullptr; + } + + bool canCombine(const proc_regionwithpathinfo& mem_info) { + const proc_regioninfo& n = mem_info.prp_prinfo; + bool cc = _rinfo.pri_size == MACOS_PARTIAL_ALLOCATION_SIZE + && n.pri_address == (_rinfo.pri_address + _size) + && n.pri_protection == _rinfo.pri_protection + && n.pri_max_protection == _rinfo.pri_max_protection + && n.pri_user_tag == _rinfo.pri_user_tag + && n.pri_share_mode == _rinfo.pri_share_mode + && n.pri_offset == 0; + return cc; + } + + void combineWithFollowing(const proc_regionwithpathinfo& mem_info) { + _size += mem_info.prp_prinfo.pri_size; + } + + void process(const proc_regionwithpathinfo& mem_info) { + reset(); + + _rinfo = mem_info.prp_prinfo; + + _address = (const char*) _rinfo.pri_address; + _size = _rinfo.pri_size; + + if (mem_info.prp_vip.vip_path[0] != '\0') { + _file_name.print_raw(mem_info.prp_vip.vip_path); + } + // proc_regionfilename() seems to give bad results, so we don't try to use it here. + + char prot[4]; + char maxprot[4]; + rwbits(_rinfo.pri_protection, prot); + rwbits(_rinfo.pri_max_protection, maxprot); + _protect_buffer.print("%s/%s", prot, maxprot); + + get_share_mode(_share_buffer, _rinfo); + _tag_text = tagToStr(_rinfo.pri_user_tag); + } + + static void get_share_mode(outputStream& out, const proc_regioninfo& rinfo) { + static const char* share_strings[] = { + "cow", "pvt", "---", "shr", "tsh", "p/a", "s/a", "lpg" + }; + assert(SM_COW == 1 && SM_LARGE_PAGE == (sizeof(share_strings)/sizeof(share_strings[0])), "share_mode contants are out of range"); // the +1 offset is intentional; see below + const bool valid_share_mode = rinfo.pri_share_mode >= SM_COW && rinfo.pri_share_mode <= SM_LARGE_PAGE; + if (valid_share_mode) { + int share_mode = rinfo.pri_share_mode; + out.print_raw(share_strings[share_mode - 1]); + } else { + out.print_cr("invalid pri_share_mode (%d)", rinfo.pri_share_mode); + assert(valid_share_mode, "invalid pri_share_mode (%d)", rinfo.pri_share_mode); + } + } + +#define X1(TAG, DESCR) X2(TAG, DESCR) +#define X2(TAG, DESCRIPTION) case VM_MEMORY_ ## TAG: return # DESCRIPTION; + static const char* tagToStr(uint32_t user_tag) { + switch (user_tag) { + case 0: + return 0; + X1(MALLOC, malloc); + X1(MALLOC_SMALL, malloc_small); + X1(MALLOC_LARGE, malloc_large); + X1(MALLOC_HUGE, malloc_huge); + X1(SBRK, sbrk); + X1(REALLOC, realloc); + X1(MALLOC_TINY, malloc_tiny); + X1(MALLOC_LARGE_REUSABLE, malloc_large_reusable); + X1(MALLOC_LARGE_REUSED, malloc_lage_reused); + X1(ANALYSIS_TOOL, analysis_tool); + X1(MALLOC_NANO, malloc_nano); + X1(MALLOC_MEDIUM, malloc_medium); + X1(MALLOC_PROB_GUARD, malloc_prob_guard); + X1(MACH_MSG, malloc_msg); + X1(IOKIT, IOKit); + X1(STACK, stack); + X1(GUARD, guard); + X1(SHARED_PMAP, shared_pmap); + X1(DYLIB, dylib); + X1(UNSHARED_PMAP, unshared_pmap); + X2(APPKIT, AppKit); + X2(FOUNDATION, Foundation); + X2(COREGRAPHICS, CoreGraphics); + X2(CORESERVICES, CoreServices); // is also VM_MEMORY_CARBON + X2(JAVA, Java); + X2(COREDATA, CoreData); + X1(COREDATA_OBJECTIDS, CodeData_objectids); + X1(ATS, ats); + X1(DYLD, dyld); + X1(DYLD_MALLOC, dyld_malloc); + X1(SQLITE, sqlite); + X1(JAVASCRIPT_CORE, javascript_core); + X1(JAVASCRIPT_JIT_EXECUTABLE_ALLOCATOR, javascript_jit_executable_allocator); + X1(JAVASCRIPT_JIT_REGISTER_FILE, javascript_jit_register_file); + X1(OPENCL, OpenCL); + X2(COREIMAGE, CoreImage); + X2(IMAGEIO, ImageIO); + X2(COREPROFILE, CoreProfile); + X1(APPLICATION_SPECIFIC_1, application_specific_1); + X1(APPLICATION_SPECIFIC_16, application_specific_16); + X1(OS_ALLOC_ONCE, os_alloc_once); + X1(GENEALOGY, genealogy); + default: + static char buffer[30]; + snprintf(buffer, sizeof(buffer), "user_tag=0x%x(%d)", user_tag, user_tag); + return buffer; + } + } + + static void rwbits(int rw, char bits[4]) { + bits[0] = rw & VM_PROT_READ ? 'r' : '-'; + bits[1] = rw & VM_PROT_WRITE ? 'w' : '-'; + bits[2] = rw & VM_PROT_EXECUTE ? 'x' : '-'; + bits[3] = 0; + } +}; + +class ProcSmapsSummary { + unsigned _num_mappings; + size_t _private; + size_t _committed; // combined committed size + size_t _reserved; // reserved but not committed + size_t _shared; // combined shared size + size_t _swapped_out; // combined amount of swapped-out memory +public: + ProcSmapsSummary() : _num_mappings(0), _private(0), + _committed(0), _shared(0), _swapped_out(0) {} + + void add_mapping(const proc_regioninfo& region_info) { + _num_mappings++; + + bool is_private = region_info.pri_share_mode == SM_PRIVATE + || region_info.pri_share_mode == SM_PRIVATE_ALIASED; + bool is_shared = region_info.pri_share_mode == SM_SHARED + || region_info.pri_share_mode == SM_SHARED_ALIASED + || region_info.pri_share_mode == SM_TRUESHARED + || region_info.pri_share_mode == SM_COW; + bool is_committed = region_info.pri_share_mode == SM_EMPTY + && region_info.pri_max_protection == VM_PROT_ALL + && ((region_info.pri_protection & VM_PROT_DEFAULT) == VM_PROT_DEFAULT); + bool is_reserved = region_info.pri_share_mode == SM_EMPTY + && region_info.pri_max_protection == VM_PROT_ALL + && region_info.pri_protection == VM_PROT_NONE; + + _private += is_private ? region_info.pri_size : 0; + _shared += is_shared ? region_info.pri_size : 0; + _swapped_out += region_info.pri_pages_swapped_out; + _committed += is_committed ? region_info.pri_size : 0; + _reserved += is_reserved ? region_info.pri_size : 0; + } + + void print_on(const MappingPrintSession& session) const { + outputStream* st = session.out(); + + st->print_cr("Number of mappings: %u", _num_mappings); + + task_vm_info vm_info; + mach_msg_type_number_t num_out = TASK_VM_INFO_COUNT; + kern_return_t err = task_info(mach_task_self(), TASK_VM_INFO, (task_info_t)(&vm_info), &num_out); + if (err == KERN_SUCCESS) { + st->print_cr(" vsize: %llu (%llu%s)", vm_info.virtual_size, PROPERFMTARGS(vm_info.virtual_size)); + st->print_cr(" rss: %llu (%llu%s)", vm_info.resident_size, PROPERFMTARGS(vm_info.resident_size)); + st->print_cr(" peak rss: %llu (%llu%s)", vm_info.resident_size_peak, PROPERFMTARGS(vm_info.resident_size_peak)); + st->print_cr(" page size: %d (%ld%s)", vm_info.page_size, PROPERFMTARGS((size_t)vm_info.page_size)); + } else { + st->print_cr("error getting vm_info %d", err); + } + st->print_cr(" reserved: %zu (" PROPERFMT ")", _reserved, PROPERFMTARGS(_reserved)); + st->print_cr(" committed: %zu (" PROPERFMT ")", _committed, PROPERFMTARGS(_committed)); + st->print_cr(" private: %zu (" PROPERFMT ")", _private, PROPERFMTARGS(_private)); + st->print_cr(" shared: %zu (" PROPERFMT ")", _shared, PROPERFMTARGS(_shared)); + st->print_cr(" swapped out: %zu (" PROPERFMT ")", _swapped_out * vm_info.page_size, PROPERFMTARGS(_swapped_out * vm_info.page_size)); + } +}; + +class ProcSmapsPrinter { + const MappingPrintSession& _session; +public: + ProcSmapsPrinter(const MappingPrintSession& session) : + _session(session) + {} + + void print_single_mapping(const proc_regioninfo& region_info, const MappingInfo& mapping_info) const { + outputStream* st = _session.out(); +#define INDENT_BY(n) \ + if (st->fill_to(n) == 0) { \ + st->print(" "); \ + } + st->print("%#014.12llx-%#014.12llx", (uint64_t)(mapping_info._address), (uint64_t)(mapping_info._address + mapping_info._size)); + INDENT_BY(38); + st->print("%12ld", mapping_info._size); + INDENT_BY(51); + st->print("%s", mapping_info._protect_buffer.base()); + INDENT_BY(59); + st->print("%s", mapping_info._share_buffer.base()); + st->print("%s", mapping_info._type_buffer.base()); + INDENT_BY(64); + st->print("%#11llx", region_info.pri_offset); + INDENT_BY(77); + if (_session.print_nmt_info_for_region((const void*)mapping_info._address, (const void*)(mapping_info._address + mapping_info._size))) { + st->print(" "); + } else { + const char* tag = mapping_info._tag_text; + if (tag != nullptr) { + st->print("[%s] ", tag); + } + } + + st->print_raw(mapping_info._file_name.base()); + st->cr(); + +#undef INDENT_BY + } + + void print_legend() const { + outputStream* st = _session.out(); + st->print_cr("from, to, vsize: address range and size"); + st->print_cr("prot: protection:"); + st->print_cr(" rwx: read / write / execute"); + st->print_cr("share: share mode:"); + st->print_cr(" cow: copy on write"); + st->print_cr(" pvt: private"); + st->print_cr(" shr: shared"); + st->print_cr(" tsh: true shared"); + st->print_cr(" p/a: private aliased"); + st->print_cr(" s/a: shared aliased"); + st->print_cr(" lpg: large page"); + st->print_cr("offset: offset from start of allocation block"); + st->print_cr("vminfo: VM information (requires NMT)"); + st->print_cr("file: file mapped, if mapping is not anonymous"); + { + streamIndentor si(st, 16); + _session.print_nmt_flag_legend(); + } + st->print_cr("file: file mapped, if mapping is not anonymous"); + } + + void print_header() const { + outputStream* st = _session.out(); + // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 + // 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 + // 0x000102890000-0x000102898000 32768 r--/r-- cow 0xc000 /Users/simont/dev/openjdk/jdk/build/macos-aarch64-fastdebug-shenandoah/images/jdk/bin/java + st->print_cr("from to vsize prot share offset vminfo/file"); + st->print_cr("=================================================================================================="); + } +}; + +static bool is_interesting(const proc_regionwithpathinfo& info) { + return info.prp_prinfo.pri_share_mode != SM_EMPTY + || info.prp_prinfo.pri_user_tag != 0 + || info.prp_vip.vip_path[0] != '\0' + || info.prp_prinfo.pri_protection != 0 + || info.prp_prinfo.pri_max_protection != 0; +} + +void MemMapPrinter::pd_print_all_mappings(const MappingPrintSession& session) { + + ProcSmapsPrinter printer(session); + ProcSmapsSummary summary; + outputStream* const st = session.out(); + const pid_t pid = getpid(); + + printer.print_legend(); + st->cr(); + printer.print_header(); + + proc_regionwithpathinfo region_info_with_path; + MappingInfo mapping_info; + uint64_t address = 0; + int region_count = 0; + while (true) { + if (++region_count > MAX_REGIONS_RETURNED) { + st->print_cr("limit of %d regions reached (results inaccurate)", region_count); + break; + } + ::bzero(®ion_info_with_path, sizeof(region_info_with_path)); + int retval = proc_pidinfo(pid, PROC_PIDREGIONPATHINFO, (uint64_t)address, ®ion_info_with_path, sizeof(region_info_with_path)); + if (retval <= 0) { + break; + } else if (retval < (int)sizeof(region_info_with_path)) { + st->print_cr("proc_pidinfo() returned %d", retval); + assert(false, "proc_pidinfo() returned %d", retval); + } + proc_regioninfo& region_info = region_info_with_path.prp_prinfo; + if (is_interesting(region_info_with_path)) { + if (mapping_info.canCombine(region_info_with_path)) { + mapping_info.combineWithFollowing(region_info_with_path); + } else { + // print previous mapping info + // avoid printing the empty info at the start + if (mapping_info._size != 0) { + printer.print_single_mapping(region_info, mapping_info); + } + summary.add_mapping(region_info); + mapping_info.process(region_info_with_path); + } + } + assert(region_info.pri_size > 0, "size of region is 0"); + address = region_info.pri_address + region_info.pri_size; + } + printer.print_single_mapping(region_info_with_path.prp_prinfo, mapping_info); + summary.add_mapping(region_info_with_path.prp_prinfo); + st->cr(); + summary.print_on(session); + st->cr(); +} +#endif // __APPLE__ \ No newline at end of file diff --git a/src/hotspot/os/posix/attachListener_posix.cpp b/src/hotspot/os/posix/attachListener_posix.cpp index bdd97afd47e..fea2075296a 100644 --- a/src/hotspot/os/posix/attachListener_posix.cpp +++ b/src/hotspot/os/posix/attachListener_posix.cpp @@ -43,7 +43,7 @@ #ifndef AIX #ifndef UNIX_PATH_MAX -#define UNIX_PATH_MAX sizeof(((struct sockaddr_un *)0)->sun_path) +#define UNIX_PATH_MAX sizeof(sockaddr_un::sun_path) #endif // The attach mechanism on Linux and BSD uses a UNIX domain socket. An attach @@ -76,17 +76,7 @@ class PosixAttachListener: AllStatic { static bool _atexit_registered; - // reads a request from the given connected socket - static PosixAttachOperation* read_request(int s); - public: - enum { - ATTACH_PROTOCOL_VER = 1 // protocol version - }; - enum { - ATTACH_ERROR_BADVERSION = 101 // error codes - }; - static void set_path(char* path) { if (path == nullptr) { _path[0] = '\0'; @@ -107,25 +97,61 @@ class PosixAttachListener: AllStatic { static bool has_path() { return _has_path; } static int listener() { return _listener; } - // write the given buffer to a socket - static int write_fully(int s, char* buf, size_t len); - static PosixAttachOperation* dequeue(); }; +class SocketChannel : public AttachOperation::RequestReader, public AttachOperation::ReplyWriter { +private: + int _socket; +public: + SocketChannel(int socket) : _socket(socket) {} + ~SocketChannel() { + close(); + } + + bool opened() const { + return _socket != -1; + } + + void close() { + if (opened()) { + ::close(_socket); + _socket = -1; + } + } + + // RequestReader + int read(void* buffer, int size) override { + ssize_t n; + RESTARTABLE(::read(_socket, buffer, (size_t)size), n); + return checked_cast(n); + } + + // ReplyWriter + int write(const void* buffer, int size) override { + ssize_t n; + RESTARTABLE(::write(_socket, buffer, size), n); + return checked_cast(n); + } + // called after writing all data + void flush() override { + ::shutdown(_socket, SHUT_RDWR); + } +}; + class PosixAttachOperation: public AttachOperation { private: // the connection to the client - int _socket; + SocketChannel _socket_channel; public: - void complete(jint res, bufferedStream* st); + void complete(jint res, bufferedStream* st) override; - void set_socket(int s) { _socket = s; } - int socket() const { return _socket; } + PosixAttachOperation(int socket) : AttachOperation(), _socket_channel(socket) { + } - PosixAttachOperation(char* name) : AttachOperation(name) { - set_socket(-1); + bool read_request() { + return AttachOperation::read_request(&_socket_channel, &_socket_channel); } }; @@ -135,35 +161,6 @@ bool PosixAttachListener::_has_path; volatile int PosixAttachListener::_listener = -1; bool PosixAttachListener::_atexit_registered = false; -// Supporting class to help split a buffer into individual components -class ArgumentIterator : public StackObj { - private: - char* _pos; - char* _end; - public: - ArgumentIterator(char* arg_buffer, size_t arg_size) { - _pos = arg_buffer; - _end = _pos + arg_size - 1; - } - char* next() { - if (*_pos == '\0') { - // advance the iterator if possible (null arguments) - if (_pos < _end) { - _pos += 1; - } - return nullptr; - } - char* res = _pos; - char* next_pos = strchr(_pos, '\0'); - if (next_pos < _end) { - next_pos++; - } - _pos = next_pos; - return res; - } -}; - - // atexit hook to stop listener and unlink the file that it is // bound too. extern "C" { @@ -249,103 +246,6 @@ int PosixAttachListener::init() { return 0; } -// Given a socket that is connected to a peer we read the request and -// create an AttachOperation. As the socket is blocking there is potential -// for a denial-of-service if the peer does not response. However this happens -// after the peer credentials have been checked and in the worst case it just -// means that the attach listener thread is blocked. -// -PosixAttachOperation* PosixAttachListener::read_request(int s) { - char ver_str[8]; - os::snprintf_checked(ver_str, sizeof(ver_str), "%d", ATTACH_PROTOCOL_VER); - - // The request is a sequence of strings so we first figure out the - // expected count and the maximum possible length of the request. - // The request is: - // 00000 - // where is the protocol version (1), is the command - // name ("load", "datadump", ...), and is an argument - int expected_str_count = 2 + AttachOperation::arg_count_max; - const size_t max_len = (sizeof(ver_str) + 1) + (AttachOperation::name_length_max + 1) + - AttachOperation::arg_count_max*(AttachOperation::arg_length_max + 1); - - char buf[max_len]; - int str_count = 0; - - // Read until all (expected) strings have been read, the buffer is - // full, or EOF. - - size_t off = 0; - size_t left = max_len; - - do { - ssize_t n; - RESTARTABLE(read(s, buf+off, left), n); - assert(n <= checked_cast(left), "buffer was too small, impossible!"); - buf[max_len - 1] = '\0'; - if (n == -1) { - return nullptr; // reset by peer or other error - } - if (n == 0) { - break; - } - for (ssize_t i=0; i so check it now to - // check for protocol mismatch - if (str_count == 1) { - if ((strlen(buf) != strlen(ver_str)) || - (atoi(buf) != ATTACH_PROTOCOL_VER)) { - char msg[32]; - os::snprintf_checked(msg, sizeof(msg), "%d\n", ATTACH_ERROR_BADVERSION); - write_fully(s, msg, strlen(msg)); - return nullptr; - } - } - } - } - off += n; - left -= n; - } while (left > 0 && str_count < expected_str_count); - - if (str_count != expected_str_count) { - return nullptr; // incomplete request - } - - // parse request - - ArgumentIterator args(buf, (max_len)-left); - - // version already checked - char* v = args.next(); - - char* name = args.next(); - if (name == nullptr || strlen(name) > AttachOperation::name_length_max) { - return nullptr; - } - - PosixAttachOperation* op = new PosixAttachOperation(name); - - for (int i=0; iset_arg(i, nullptr); - } else { - if (strlen(arg) > AttachOperation::arg_length_max) { - delete op; - return nullptr; - } - op->set_arg(i, arg); - } - } - - op->set_socket(s); - return op; -} - // Dequeue an operation // // In the Linux and BSD implementations, there is only a single operation and @@ -400,9 +300,9 @@ PosixAttachOperation* PosixAttachListener::dequeue() { #endif // peer credential look okay so we read the request - PosixAttachOperation* op = read_request(s); - if (op == nullptr) { - ::close(s); + PosixAttachOperation* op = new PosixAttachOperation(s); + if (!op->read_request()) { + delete op; continue; } else { return op; @@ -410,21 +310,6 @@ PosixAttachOperation* PosixAttachListener::dequeue() { } } -// write the given buffer to the socket -int PosixAttachListener::write_fully(int s, char* buf, size_t len) { - do { - ssize_t n = ::write(s, buf, len); - if (n == -1) { - if (errno != EINTR) return -1; - } else { - buf += n; - len -= n; - } - } - while (len > 0); - return 0; -} - // Complete an operation by sending the operation result and any result // output to the client. At this time the socket is in blocking mode so // potentially we can block if there is a lot of data and the client is @@ -437,19 +322,7 @@ void PosixAttachOperation::complete(jint result, bufferedStream* st) { JavaThread* thread = JavaThread::current(); ThreadBlockInVM tbivm(thread); - // write operation result - char msg[32]; - os::snprintf_checked(msg, sizeof(msg), "%d\n", result); - int rc = PosixAttachListener::write_fully(this->socket(), msg, strlen(msg)); - - // write any result data - if (rc == 0) { - PosixAttachListener::write_fully(this->socket(), (char*) st->base(), st->size()); - ::shutdown(this->socket(), 2); - } - - // done - ::close(this->socket()); + write_reply(&_socket_channel, result, st); delete this; } @@ -490,6 +363,8 @@ void AttachListener::vm_start() { } int AttachListener::pd_init() { + AttachListener::set_supported_version(ATTACH_API_V2); + JavaThread* thread = JavaThread::current(); ThreadBlockInVM tbivm(thread); diff --git a/src/hotspot/os/posix/perfMemory_posix.cpp b/src/hotspot/os/posix/perfMemory_posix.cpp index 4eb46169878..5fbd5e76c5a 100644 --- a/src/hotspot/os/posix/perfMemory_posix.cpp +++ b/src/hotspot/os/posix/perfMemory_posix.cpp @@ -1053,7 +1053,7 @@ static char* mmap_create_shared(size_t size) { return nullptr; } - mapAddress = (char*)::mmap((char*)0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); + mapAddress = (char*)::mmap(nullptr, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); result = ::close(fd); assert(result != OS_ERR, "could not close file"); @@ -1208,7 +1208,7 @@ static void mmap_attach_shared(int vmid, char** addr, size_t* sizep, TRAPS) { assert(size > 0, "unexpected size <= 0"); - char* mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0); + char* mapAddress = (char*)::mmap(nullptr, size, mmap_prot, MAP_SHARED, fd, 0); int result = ::close(fd); assert(result != OS_ERR, "could not close file"); diff --git a/src/hotspot/os/windows/attachListener_windows.cpp b/src/hotspot/os/windows/attachListener_windows.cpp index fa45c98ced2..8423fe42b75 100644 --- a/src/hotspot/os/windows/attachListener_windows.cpp +++ b/src/hotspot/os/windows/attachListener_windows.cpp @@ -152,7 +152,7 @@ class Win32AttachOperation: public AttachOperation { } bool read_request() { - return AttachOperation::read_request(&_pipe); + return AttachOperation::read_request(&_pipe, &_pipe); } public: diff --git a/src/hotspot/os/windows/memMapPrinter_windows.cpp b/src/hotspot/os/windows/memMapPrinter_windows.cpp index eb6b24a9d13..ff27aea02c5 100644 --- a/src/hotspot/os/windows/memMapPrinter_windows.cpp +++ b/src/hotspot/os/windows/memMapPrinter_windows.cpp @@ -197,8 +197,9 @@ class MappingInfoPrinter { st->print_cr("state: region state and type:"); st->print_cr(" state: committed / reserved"); st->print_cr(" type: image / mapped / private"); + st->print_cr("offset: offset from start of allocation block"); + st->print_cr("vminfo: VM information (requires NMT)"); st->print_cr("file: file mapped, if mapping is not anonymous"); - st->print_cr("vm info: VM information (requires NMT)"); { streamIndentor si(st, 16); _session.print_nmt_flag_legend(); diff --git a/src/hotspot/os_cpu/aix_ppc/javaThread_aix_ppc.cpp b/src/hotspot/os_cpu/aix_ppc/javaThread_aix_ppc.cpp index 3ec846460a1..94e0c387a81 100644 --- a/src/hotspot/os_cpu/aix_ppc/javaThread_aix_ppc.cpp +++ b/src/hotspot/os_cpu/aix_ppc/javaThread_aix_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2014 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * Copyright (c) 2022, IBM Corp. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff --git a/src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp b/src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp index 53e5631fc2b..6102f70f06b 100644 --- a/src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp +++ b/src/hotspot/os_cpu/linux_aarch64/vm_version_linux_aarch64.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -185,7 +185,14 @@ static bool read_fully(const char *fname, char *buf, size_t buflen) { assert(buflen >= 1, "invalid argument"); int fd = os::open(fname, O_RDONLY, 0); if (fd != -1) { + PRAGMA_DIAG_PUSH + PRAGMA_NONNULL_IGNORED + // Suppress false positive gcc warning, which may be an example of + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87489 + // The warning also hasn't been seen with vanilla gcc release, so may also + // involve some distro-specific gcc patch. ssize_t read_sz = ::read(fd, buf, buflen); + PRAGMA_DIAG_POP ::close(fd); // Skip if the contents is just "\n" because some machine only sets diff --git a/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp b/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp index 71d3aaddaec..f9fc6cec7fa 100644 --- a/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp +++ b/src/hotspot/os_cpu/linux_ppc/javaThread_linux_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2022 SAP SE. All rights reserved. + * Copyright (c) 2012, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp b/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp index bc8e3d10431..d599359d529 100644 --- a/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp +++ b/src/hotspot/os_cpu/linux_s390/os_linux_s390.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016, 2023 SAP SE. All rights reserved. + * Copyright (c) 2016, 2024 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/share/c1/c1_Compilation.hpp b/src/hotspot/share/c1/c1_Compilation.hpp index 0ac0a4d4169..5f554496f93 100644 --- a/src/hotspot/share/c1/c1_Compilation.hpp +++ b/src/hotspot/share/c1/c1_Compilation.hpp @@ -30,8 +30,6 @@ #include "code/exceptionHandlerTable.hpp" #include "compiler/compiler_globals.hpp" #include "compiler/compilerDefinitions.inline.hpp" -#include "compiler/compilerDirectives.hpp" -#include "memory/resourceArea.hpp" #include "runtime/deoptimization.hpp" class CompilationFailureInfo; diff --git a/src/hotspot/share/c1/c1_FrameMap.hpp b/src/hotspot/share/c1/c1_FrameMap.hpp index 2a7533e499f..1fd7dd3edff 100644 --- a/src/hotspot/share/c1/c1_FrameMap.hpp +++ b/src/hotspot/share/c1/c1_FrameMap.hpp @@ -25,13 +25,11 @@ #ifndef SHARE_C1_C1_FRAMEMAP_HPP #define SHARE_C1_C1_FRAMEMAP_HPP -#include "asm/macroAssembler.hpp" #include "c1/c1_Defs.hpp" #include "c1/c1_LIR.hpp" #include "code/vmreg.hpp" #include "memory/allocation.hpp" #include "runtime/frame.hpp" -#include "runtime/synchronizer.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" diff --git a/src/hotspot/share/c1/c1_GraphBuilder.cpp b/src/hotspot/share/c1/c1_GraphBuilder.cpp index 0179923bc30..9925c592f6f 100644 --- a/src/hotspot/share/c1/c1_GraphBuilder.cpp +++ b/src/hotspot/share/c1/c1_GraphBuilder.cpp @@ -41,12 +41,8 @@ #include "interpreter/bytecode.hpp" #include "jfr/jfrEvents.hpp" #include "memory/resourceArea.hpp" -#include "oops/oop.inline.hpp" #include "runtime/sharedRuntime.hpp" -#include "runtime/vm_version.hpp" -#include "utilities/bitMap.inline.hpp" #include "utilities/checkedCast.hpp" -#include "utilities/powerOfTwo.hpp" #include "utilities/macros.hpp" #if INCLUDE_JFR #include "jfr/jfr.hpp" diff --git a/src/hotspot/share/c1/c1_IR.hpp b/src/hotspot/share/c1/c1_IR.hpp index 48286315df8..9dfcb8419c3 100644 --- a/src/hotspot/share/c1/c1_IR.hpp +++ b/src/hotspot/share/c1/c1_IR.hpp @@ -27,8 +27,6 @@ #include "c1/c1_Instruction.hpp" #include "ci/ciExceptionHandler.hpp" -#include "ci/ciMethod.hpp" -#include "ci/ciStreams.hpp" #include "memory/allocation.hpp" // An XHandler is a C1 internal description for an exception handler diff --git a/src/hotspot/share/c1/c1_LIRAssembler.cpp b/src/hotspot/share/c1/c1_LIRAssembler.cpp index 51fb851d00c..0fa4b3a4c93 100644 --- a/src/hotspot/share/c1/c1_LIRAssembler.cpp +++ b/src/hotspot/share/c1/c1_LIRAssembler.cpp @@ -30,7 +30,6 @@ #include "c1/c1_LIRAssembler.hpp" #include "c1/c1_MacroAssembler.hpp" #include "c1/c1_ValueStack.hpp" -#include "ci/ciInstance.hpp" #include "compiler/compilerDefinitions.inline.hpp" #include "compiler/oopMap.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/share/c1/c1_LIRGenerator.hpp b/src/hotspot/share/c1/c1_LIRGenerator.hpp index 518cd5fa5e7..a66758054d7 100644 --- a/src/hotspot/share/c1/c1_LIRGenerator.hpp +++ b/src/hotspot/share/c1/c1_LIRGenerator.hpp @@ -28,9 +28,7 @@ #include "c1/c1_Decorators.hpp" #include "c1/c1_Instruction.hpp" #include "c1/c1_LIR.hpp" -#include "ci/ciMethodData.hpp" #include "gc/shared/barrierSet.hpp" -#include "jfr/support/jfrIntrinsics.hpp" #include "utilities/macros.hpp" #include "utilities/sizes.hpp" diff --git a/src/hotspot/share/c1/c1_Optimizer.cpp b/src/hotspot/share/c1/c1_Optimizer.cpp index dd428a5895b..d33e4d28bd0 100644 --- a/src/hotspot/share/c1/c1_Optimizer.cpp +++ b/src/hotspot/share/c1/c1_Optimizer.cpp @@ -23,9 +23,7 @@ */ #include "precompiled.hpp" -#include "c1/c1_Canonicalizer.hpp" #include "c1/c1_Optimizer.hpp" -#include "c1/c1_ValueMap.hpp" #include "c1/c1_ValueSet.hpp" #include "c1/c1_ValueStack.hpp" #include "memory/resourceArea.hpp" diff --git a/src/hotspot/share/c1/c1_RangeCheckElimination.cpp b/src/hotspot/share/c1/c1_RangeCheckElimination.cpp index c2397d4a399..a4c2976d26f 100644 --- a/src/hotspot/share/c1/c1_RangeCheckElimination.cpp +++ b/src/hotspot/share/c1/c1_RangeCheckElimination.cpp @@ -26,13 +26,9 @@ #include "c1/c1_ValueStack.hpp" #include "c1/c1_RangeCheckElimination.hpp" #include "c1/c1_IR.hpp" -#include "c1/c1_Canonicalizer.hpp" -#include "c1/c1_ValueMap.hpp" #include "ci/ciMethodData.hpp" #include "runtime/deoptimization.hpp" -#ifdef ASSERT #include "utilities/bitMap.inline.hpp" -#endif // Macros for the Trace and the Assertion flag #ifdef ASSERT diff --git a/src/hotspot/share/c1/c1_Runtime1.cpp b/src/hotspot/share/c1/c1_Runtime1.cpp index 3ebd1f42f36..4ef2f8f3b0a 100644 --- a/src/hotspot/share/c1/c1_Runtime1.cpp +++ b/src/hotspot/share/c1/c1_Runtime1.cpp @@ -26,7 +26,6 @@ #include "asm/codeBuffer.hpp" #include "c1/c1_CodeStubs.hpp" #include "c1/c1_Defs.hpp" -#include "c1/c1_FrameMap.hpp" #include "c1/c1_LIRAssembler.hpp" #include "c1/c1_MacroAssembler.hpp" #include "c1/c1_Runtime1.hpp" @@ -35,7 +34,6 @@ #include "classfile/vmSymbols.hpp" #include "code/codeBlob.hpp" #include "code/compiledIC.hpp" -#include "code/pcDesc.hpp" #include "code/scopeDesc.hpp" #include "code/vtableStubs.hpp" #include "compiler/compilationPolicy.hpp" @@ -48,12 +46,10 @@ #include "interpreter/interpreter.hpp" #include "jfr/support/jfrIntrinsics.hpp" #include "logging/log.hpp" -#include "memory/allocation.inline.hpp" #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/access.inline.hpp" -#include "oops/klass.inline.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/objArrayKlass.hpp" #include "oops/oop.inline.hpp" @@ -67,7 +63,6 @@ #include "runtime/sharedRuntime.hpp" #include "runtime/stackWatermarkSet.hpp" #include "runtime/stubRoutines.hpp" -#include "runtime/threadCritical.hpp" #include "runtime/vframe.inline.hpp" #include "runtime/vframeArray.hpp" #include "runtime/vm_version.hpp" diff --git a/src/hotspot/share/c1/c1_Runtime1.hpp b/src/hotspot/share/c1/c1_Runtime1.hpp index 6aed71fdfe5..5f1ae4333bc 100644 --- a/src/hotspot/share/c1/c1_Runtime1.hpp +++ b/src/hotspot/share/c1/c1_Runtime1.hpp @@ -29,7 +29,6 @@ #include "code/stubs.hpp" #include "interpreter/interpreter.hpp" #include "memory/allStatic.hpp" -#include "runtime/deoptimization.hpp" #include "runtime/stubDeclarations.hpp" class StubAssembler; diff --git a/src/hotspot/share/c1/c1_ValueMap.cpp b/src/hotspot/share/c1/c1_ValueMap.cpp index e7993a8db5b..d9e1e11a3b8 100644 --- a/src/hotspot/share/c1/c1_ValueMap.cpp +++ b/src/hotspot/share/c1/c1_ValueMap.cpp @@ -23,11 +23,11 @@ */ #include "precompiled.hpp" -#include "c1/c1_Canonicalizer.hpp" #include "c1/c1_IR.hpp" #include "c1/c1_ValueMap.hpp" #include "c1/c1_ValueSet.hpp" #include "c1/c1_ValueStack.hpp" +#include "utilities/bitMap.inline.hpp" #ifndef PRODUCT diff --git a/src/hotspot/share/c1/c1_ValueSet.hpp b/src/hotspot/share/c1/c1_ValueSet.hpp index afd8d081dc5..442261def0a 100644 --- a/src/hotspot/share/c1/c1_ValueSet.hpp +++ b/src/hotspot/share/c1/c1_ValueSet.hpp @@ -26,9 +26,7 @@ #define SHARE_C1_C1_VALUESET_HPP #include "c1/c1_Instruction.hpp" -#include "memory/allocation.hpp" #include "utilities/bitMap.hpp" -#include "utilities/bitMap.inline.hpp" // A ValueSet is a simple abstraction on top of a BitMap representing // a set of Instructions. Currently it assumes that the number of diff --git a/src/hotspot/share/c1/c1_ValueType.hpp b/src/hotspot/share/c1/c1_ValueType.hpp index 488b3372518..62757ddc1a1 100644 --- a/src/hotspot/share/c1/c1_ValueType.hpp +++ b/src/hotspot/share/c1/c1_ValueType.hpp @@ -26,8 +26,6 @@ #define SHARE_C1_C1_VALUETYPE_HPP #include "c1/c1_Compilation.hpp" -#include "ci/ciConstant.hpp" -#include "ci/ciMethodData.hpp" // type hierarchy class ValueType; diff --git a/src/hotspot/share/cds/archiveBuilder.cpp b/src/hotspot/share/cds/archiveBuilder.cpp index 1cd9d13c3ba..233b333ce68 100644 --- a/src/hotspot/share/cds/archiveBuilder.cpp +++ b/src/hotspot/share/cds/archiveBuilder.cpp @@ -47,6 +47,7 @@ #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/allStatic.hpp" +#include "memory/memoryReserver.hpp" #include "memory/memRegion.hpp" #include "memory/resourceArea.hpp" #include "oops/compressedKlass.inline.hpp" @@ -193,7 +194,7 @@ ArchiveBuilder::~ArchiveBuilder() { delete _klasses; delete _symbols; if (_shared_rs.is_reserved()) { - _shared_rs.release(); + MemoryReserver::release(_shared_rs); } } @@ -347,7 +348,9 @@ size_t ArchiveBuilder::estimate_archive_size() { address ArchiveBuilder::reserve_buffer() { size_t buffer_size = estimate_archive_size(); - ReservedSpace rs(buffer_size, MetaspaceShared::core_region_alignment(), os::vm_page_size()); + ReservedSpace rs = MemoryReserver::reserve(buffer_size, + MetaspaceShared::core_region_alignment(), + os::vm_page_size()); if (!rs.is_reserved()) { log_error(cds)("Failed to reserve " SIZE_FORMAT " bytes of output buffer.", buffer_size); MetaspaceShared::unrecoverable_writing_error(); diff --git a/src/hotspot/share/cds/archiveBuilder.hpp b/src/hotspot/share/cds/archiveBuilder.hpp index e42b2f478ec..0c5262321d0 100644 --- a/src/hotspot/share/cds/archiveBuilder.hpp +++ b/src/hotspot/share/cds/archiveBuilder.hpp @@ -29,6 +29,8 @@ #include "cds/dumpAllocStats.hpp" #include "memory/metaspace.hpp" #include "memory/metaspaceClosure.hpp" +#include "memory/reservedSpace.hpp" +#include "memory/virtualspace.hpp" #include "oops/array.hpp" #include "oops/klass.hpp" #include "runtime/os.hpp" diff --git a/src/hotspot/share/cds/dynamicArchive.hpp b/src/hotspot/share/cds/dynamicArchive.hpp index 479e7daa153..eb5fd5f9aba 100644 --- a/src/hotspot/share/cds/dynamicArchive.hpp +++ b/src/hotspot/share/cds/dynamicArchive.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * 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,7 +29,6 @@ #include "classfile/compactHashtable.hpp" #include "memory/allStatic.hpp" #include "memory/memRegion.hpp" -#include "memory/virtualspace.hpp" #include "oops/array.hpp" #include "oops/oop.hpp" #include "utilities/exceptions.hpp" diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index 594d8817322..c87081d9d14 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -347,6 +347,7 @@ void SharedClassPathEntry::init(bool is_modules_image, _type = jar_entry; _timestamp = st.st_mtime; _from_class_path_attr = cpe->from_class_path_attr(); + _is_multi_release = cpe->is_multi_release_jar(); } _filesize = st.st_size; _is_module_path = is_module_path; @@ -2219,7 +2220,7 @@ address FileMapInfo::heap_region_dumptime_address() { assert(CDSConfig::is_using_archive(), "runtime only"); assert(is_aligned(r->mapping_offset(), sizeof(HeapWord)), "must be"); if (UseCompressedOops) { - return /*dumptime*/ narrow_oop_base() + r->mapping_offset(); + return /*dumptime*/ (address)((uintptr_t)narrow_oop_base() + r->mapping_offset()); } else { return heap_region_requested_address(); } @@ -2245,7 +2246,7 @@ address FileMapInfo::heap_region_requested_address() { // Runtime base = 0x4000 and shift is also 0. If we map this region at 0x5000, then // the value P can remain 0x1200. The decoded address = (0x4000 + (0x1200 << 0)) = 0x5200, // which is the runtime location of the referenced object. - return /*runtime*/ CompressedOops::base() + r->mapping_offset(); + return /*runtime*/ (address)((uintptr_t)CompressedOops::base() + r->mapping_offset()); } else { // This was the hard-coded requested base address used at dump time. With uncompressed oops, // the heap range is assigned by the OS so we will most likely have to relocate anyway, no matter @@ -2680,7 +2681,7 @@ ClassPathEntry* FileMapInfo::get_classpath_entry_for_jvmti(int i, TRAPS) { jio_snprintf(msg, strlen(path) + 127, "error in finding JAR file %s", path); THROW_MSG_(vmSymbols::java_io_IOException(), msg, nullptr); } else { - ent = ClassLoader::create_class_path_entry(THREAD, path, &st, false, false); + ent = ClassLoader::create_class_path_entry(THREAD, path, &st, false, false, scpe->is_multi_release()); if (ent == nullptr) { char *msg = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, strlen(path) + 128); jio_snprintf(msg, strlen(path) + 127, "error in opening JAR file %s", path); @@ -2715,7 +2716,7 @@ ClassFileStream* FileMapInfo::open_stream_for_jvmti(InstanceKlass* ik, Handle cl name->utf8_length()); ClassLoaderData* loader_data = ClassLoaderData::class_loader_data(class_loader()); ClassFileStream* cfs; - if (class_loader() != nullptr && !cpe->is_modules_image()) { + if (class_loader() != nullptr && !cpe->is_modules_image() && cpe->is_multi_release_jar()) { cfs = get_stream_from_class_loader(class_loader, cpe, file_name, CHECK_NULL); } else { cfs = cpe->open_stream_for_loader(THREAD, file_name, loader_data); diff --git a/src/hotspot/share/cds/filemap.hpp b/src/hotspot/share/cds/filemap.hpp index cabb54769fe..d097cb0eda6 100644 --- a/src/hotspot/share/cds/filemap.hpp +++ b/src/hotspot/share/cds/filemap.hpp @@ -49,6 +49,7 @@ class ClassFileStream; class ClassLoaderData; class ClassPathEntry; class outputStream; +class ReservedSpace; class SharedClassPathEntry : public MetaspaceObj { enum { @@ -64,6 +65,7 @@ class SharedClassPathEntry : public MetaspaceObj { u1 _type; bool _is_module_path; bool _from_class_path_attr; + bool _is_multi_release; time_t _timestamp; // jar timestamp, 0 if is directory, modules image or other int64_t _filesize; // jar/jimage file size, -1 if is directory, -2 if other Array* _name; @@ -71,7 +73,7 @@ class SharedClassPathEntry : public MetaspaceObj { public: SharedClassPathEntry() : _type(0), _is_module_path(false), - _from_class_path_attr(false), _timestamp(0), + _from_class_path_attr(false), _is_multi_release(false), _timestamp(0), _filesize(0), _name(nullptr), _manifest(nullptr) {} static int size() { static_assert(is_aligned(sizeof(SharedClassPathEntry), wordSize), "must be"); @@ -92,6 +94,7 @@ class SharedClassPathEntry : public MetaspaceObj { bool is_jar() const { return _type == jar_entry; } bool is_non_existent() const { return _type == non_existent_entry; } bool from_class_path_attr() { return _from_class_path_attr; } + bool is_multi_release() { return _is_multi_release; } time_t timestamp() const { return _timestamp; } const char* name() const; const char* manifest() const { @@ -479,7 +482,6 @@ class FileMapInfo : public CHeapObj { void unmap_region(int i); void close(); bool is_open() { return _file_open; } - ReservedSpace reserve_shared_memory(); // JVM/TI RedefineClasses() support: // Remap the shared readonly space to shared readwrite, private. diff --git a/src/hotspot/share/cds/metaspaceShared.cpp b/src/hotspot/share/cds/metaspaceShared.cpp index 6348b04cbe1..753160e7ec1 100644 --- a/src/hotspot/share/cds/metaspaceShared.cpp +++ b/src/hotspot/share/cds/metaspaceShared.cpp @@ -62,6 +62,7 @@ #include "logging/log.hpp" #include "logging/logMessage.hpp" #include "logging/logStream.hpp" +#include "memory/memoryReserver.hpp" #include "memory/metaspace.hpp" #include "memory/metaspaceClosure.hpp" #include "memory/resourceArea.hpp" @@ -282,7 +283,7 @@ void MetaspaceShared::initialize_for_static_dump() { SharedBaseAddress = (size_t)_requested_base_address; size_t symbol_rs_size = LP64_ONLY(3 * G) NOT_LP64(128 * M); - _symbol_rs = ReservedSpace(symbol_rs_size, mtClassShared); + _symbol_rs = MemoryReserver::reserve(symbol_rs_size, mtClassShared); if (!_symbol_rs.is_reserved()) { log_error(cds)("Unable to reserve memory for symbols: " SIZE_FORMAT " bytes.", symbol_rs_size); MetaspaceShared::unrecoverable_writing_error(); @@ -1266,7 +1267,9 @@ MapArchiveResult MetaspaceShared::map_archives(FileMapInfo* static_mapinfo, File if (use_requested_addr) { assert(!total_space_rs.is_reserved(), "Should not be reserved for Windows"); log_info(cds)("Windows mmap workaround: releasing archive space."); - archive_space_rs.release(); + MemoryReserver::release(archive_space_rs); + // Mark as not reserved + archive_space_rs = {}; } } MapArchiveResult static_result = map_archive(static_mapinfo, mapped_base_address, archive_space_rs); @@ -1438,8 +1441,10 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma "Archive base address unaligned: " PTR_FORMAT ", needs alignment: %zu.", p2i(base_address), archive_space_alignment); - archive_space_rs = ReservedSpace(archive_space_size, archive_space_alignment, - os::vm_page_size(), (char*)base_address); + archive_space_rs = MemoryReserver::reserve((char*)base_address, + archive_space_size, + archive_space_alignment, + os::vm_page_size()); if (archive_space_rs.is_reserved()) { assert(base_address == nullptr || (address)archive_space_rs.base() == base_address, "Sanity"); @@ -1505,10 +1510,14 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma // caller will not split the combined space for mapping, instead read the archive data // via sequential file IO. address ccs_base = base_address + archive_space_size + gap_size; - archive_space_rs = ReservedSpace(archive_space_size, archive_space_alignment, - os::vm_page_size(), (char*)base_address); - class_space_rs = ReservedSpace(class_space_size, class_space_alignment, - os::vm_page_size(), (char*)ccs_base); + archive_space_rs = MemoryReserver::reserve((char*)base_address, + archive_space_size, + archive_space_alignment, + os::vm_page_size()); + class_space_rs = MemoryReserver::reserve((char*)ccs_base, + class_space_size, + class_space_alignment, + os::vm_page_size()); } if (!archive_space_rs.is_reserved() || !class_space_rs.is_reserved()) { release_reserved_spaces(total_space_rs, archive_space_rs, class_space_rs); @@ -1519,8 +1528,10 @@ char* MetaspaceShared::reserve_address_space_for_archives(FileMapInfo* static_ma MemTracker::record_virtual_memory_tag(class_space_rs.base(), mtClass); } else { if (use_archive_base_addr && base_address != nullptr) { - total_space_rs = ReservedSpace(total_range_size, base_address_alignment, - os::vm_page_size(), (char*) base_address); + total_space_rs = MemoryReserver::reserve((char*) base_address, + total_range_size, + base_address_alignment, + os::vm_page_size()); } else { // We did not manage to reserve at the preferred address, or were instructed to relocate. In that // case we reserve wherever possible, but the start address needs to be encodable as narrow Klass @@ -1568,15 +1579,18 @@ void MetaspaceShared::release_reserved_spaces(ReservedSpace& total_space_rs, ReservedSpace& class_space_rs) { if (total_space_rs.is_reserved()) { log_debug(cds)("Released shared space (archive + class) " INTPTR_FORMAT, p2i(total_space_rs.base())); - total_space_rs.release(); + MemoryReserver::release(total_space_rs); + total_space_rs = {}; } else { if (archive_space_rs.is_reserved()) { log_debug(cds)("Released shared space (archive) " INTPTR_FORMAT, p2i(archive_space_rs.base())); - archive_space_rs.release(); + MemoryReserver::release(archive_space_rs); + archive_space_rs = {}; } if (class_space_rs.is_reserved()) { log_debug(cds)("Released shared space (classes) " INTPTR_FORMAT, p2i(class_space_rs.base())); - class_space_rs.release(); + MemoryReserver::release(class_space_rs); + class_space_rs = {}; } } } diff --git a/src/hotspot/share/cds/metaspaceShared.hpp b/src/hotspot/share/cds/metaspaceShared.hpp index aaa649d3c0f..8c203786491 100644 --- a/src/hotspot/share/cds/metaspaceShared.hpp +++ b/src/hotspot/share/cds/metaspaceShared.hpp @@ -27,6 +27,7 @@ #include "memory/allocation.hpp" #include "memory/memRegion.hpp" +#include "memory/reservedSpace.hpp" #include "memory/virtualspace.hpp" #include "oops/oop.hpp" #include "utilities/macros.hpp" diff --git a/src/hotspot/share/ci/ciTypeFlow.cpp b/src/hotspot/share/ci/ciTypeFlow.cpp index 942b866eb51..36b4a2991cc 100644 --- a/src/hotspot/share/ci/ciTypeFlow.cpp +++ b/src/hotspot/share/ci/ciTypeFlow.cpp @@ -38,7 +38,6 @@ #include "memory/resourceArea.hpp" #include "oops/oop.inline.hpp" #include "opto/compile.hpp" -#include "opto/node.hpp" #include "runtime/deoptimization.hpp" #include "utilities/growableArray.hpp" diff --git a/src/hotspot/share/classfile/classFileError.cpp b/src/hotspot/share/classfile/classFileError.cpp index 901bda5eea3..634a1fbeafb 100644 --- a/src/hotspot/share/classfile/classFileError.cpp +++ b/src/hotspot/share/classfile/classFileError.cpp @@ -45,11 +45,11 @@ void ClassFileParser::classfile_parse_error(const char* msg, TRAPS) const { msg, _class_name->as_C_string()); } +// The caller is required/expected to have a ResourceMark in this case. void ClassFileParser::classfile_parse_error(const char* msg, int index, TRAPS) const { assert(_class_name != nullptr, "invariant"); - ResourceMark rm(THREAD); Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(), msg, index, _class_name->as_C_string()); } @@ -92,6 +92,12 @@ void ClassFileParser::classfile_icce_error(const char* msg, msg, _class_name->as_klass_external_name(), k->external_name()); } +void ClassFileParser::classfile_icce_error(const char* msg, + TRAPS) const { + ResourceMark rm(THREAD); + Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_IncompatibleClassChangeError(), msg); +} + void ClassFileParser::classfile_ucve_error(const char* msg, const Symbol* class_name, u2 major, diff --git a/src/hotspot/share/classfile/classFileParser.cpp b/src/hotspot/share/classfile/classFileParser.cpp index a26831cd783..5c58f200006 100644 --- a/src/hotspot/share/classfile/classFileParser.cpp +++ b/src/hotspot/share/classfile/classFileParser.cpp @@ -3747,6 +3747,12 @@ void ClassFileParser::apply_parsed_class_metadata( this_klass->set_annotations(_combined_annotations); this_klass->set_permitted_subclasses(_permitted_subclasses); this_klass->set_record_components(_record_components); + + // Initialize cached modifier_flags to support Class.getModifiers(). + // This must follow setting inner_class attributes. + int computed_modifiers = this_klass->compute_modifier_flags(); + this_klass->set_modifier_flags(computed_modifiers); + // Delay the setting of _local_interfaces and _transitive_interfaces until after // initialize_supers() in fill_instance_klass(). It is because the _local_interfaces could // be shared with _transitive_interfaces and _transitive_interfaces may be shared with @@ -4064,9 +4070,13 @@ void ClassFileParser::check_super_class_access(const InstanceKlass* this_klass, return; } - if (super_ik->is_sealed() && !super_ik->has_as_permitted_subclass(this_klass)) { - classfile_icce_error("class %s cannot inherit from sealed class %s", super_ik, THREAD); - return; + if (super_ik->is_sealed()) { + stringStream ss; + ResourceMark rm(THREAD); + if (!super_ik->has_as_permitted_subclass(this_klass, ss)) { + classfile_icce_error(ss.as_string(), THREAD); + return; + } } Reflection::VerifyClassAccessResults vca_result = @@ -4111,12 +4121,13 @@ void ClassFileParser::check_super_interface_access(const InstanceKlass* this_kla InstanceKlass* const k = local_interfaces->at(i); assert (k != nullptr && k->is_interface(), "invalid interface"); - if (k->is_sealed() && !k->has_as_permitted_subclass(this_klass)) { - classfile_icce_error(this_klass->is_interface() ? - "class %s cannot extend sealed interface %s" : - "class %s cannot implement sealed interface %s", - k, THREAD); - return; + if (k->is_sealed()) { + stringStream ss; + ResourceMark rm(THREAD); + if (!k->has_as_permitted_subclass(this_klass, ss)) { + classfile_icce_error(ss.as_string(), THREAD); + return; + } } Reflection::VerifyClassAccessResults vca_result = @@ -5167,7 +5178,6 @@ void ClassFileParser::fill_instance_klass(InstanceKlass* ik, Handle module_handle(THREAD, module_entry->module()); // Allocate mirror and initialize static fields - // The create_mirror() call will also call compute_modifiers() java_lang_Class::create_mirror(ik, Handle(THREAD, _loader_data->class_loader()), module_handle, diff --git a/src/hotspot/share/classfile/classFileParser.hpp b/src/hotspot/share/classfile/classFileParser.hpp index e993120d140..8f9f4ebea4d 100644 --- a/src/hotspot/share/classfile/classFileParser.hpp +++ b/src/hotspot/share/classfile/classFileParser.hpp @@ -367,6 +367,10 @@ class ClassFileParser { const Klass* k, TRAPS) const; + // Uses msg directly in the ICCE, with no additional content + void classfile_icce_error(const char* msg, + TRAPS) const; + void classfile_ucve_error(const char* msg, const Symbol* class_name, u2 major, diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index aac312c36a3..83d0e803ee1 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -303,10 +303,11 @@ ClassFileStream* ClassPathDirEntry::open_stream(JavaThread* current, const char* } ClassPathZipEntry::ClassPathZipEntry(jzfile* zip, const char* zip_name, - bool is_boot_append, bool from_class_path_attr) : ClassPathEntry() { + bool is_boot_append, bool from_class_path_attr, bool multi_release) : ClassPathEntry() { _zip = zip; _zip_name = copy_path(zip_name); _from_class_path_attr = from_class_path_attr; + _multi_release = multi_release; } ClassPathZipEntry::~ClassPathZipEntry() { @@ -750,7 +751,8 @@ jzfile* ClassLoader::open_zip_file(const char* canonical_path, char** error_msg, ClassPathEntry* ClassLoader::create_class_path_entry(JavaThread* current, const char *path, const struct stat* st, bool is_boot_append, - bool from_class_path_attr) { + bool from_class_path_attr, + bool is_multi_release) { ClassPathEntry* new_entry = nullptr; if ((st->st_mode & S_IFMT) == S_IFREG) { ResourceMark rm(current); @@ -763,7 +765,7 @@ ClassPathEntry* ClassLoader::create_class_path_entry(JavaThread* current, char* error_msg = nullptr; jzfile* zip = open_zip_file(canonical_path, &error_msg, current); if (zip != nullptr && error_msg == nullptr) { - new_entry = new ClassPathZipEntry(zip, path, is_boot_append, from_class_path_attr); + new_entry = new ClassPathZipEntry(zip, path, is_boot_append, from_class_path_attr, is_multi_release); } else { #if INCLUDE_CDS ClassLoaderExt::set_has_non_jar_in_classpath(); @@ -796,7 +798,7 @@ ClassPathZipEntry* ClassLoader::create_class_path_zip_entry(const char *path, bo jzfile* zip = open_zip_file(canonical_path, &error_msg, thread); if (zip != nullptr && error_msg == nullptr) { // create using canonical path - return new ClassPathZipEntry(zip, canonical_path, is_boot_append, false); + return new ClassPathZipEntry(zip, canonical_path, is_boot_append, false, false); } } } diff --git a/src/hotspot/share/classfile/classLoader.hpp b/src/hotspot/share/classfile/classLoader.hpp index d6780054904..8eb6593f07a 100644 --- a/src/hotspot/share/classfile/classLoader.hpp +++ b/src/hotspot/share/classfile/classLoader.hpp @@ -58,6 +58,8 @@ class ClassPathEntry : public CHeapObj { virtual bool is_modules_image() const { return false; } virtual bool is_jar_file() const { return false; } + virtual bool is_multi_release_jar() const { return false; } + virtual void set_multi_release_jar() {} // Is this entry created from the "Class-path" attribute from a JAR Manifest? virtual bool from_class_path_attr() const { return false; } virtual const char* name() const = 0; @@ -91,11 +93,14 @@ class ClassPathZipEntry: public ClassPathEntry { jzfile* _zip; // The zip archive const char* _zip_name; // Name of zip archive bool _from_class_path_attr; // From the "Class-path" attribute of a jar file + bool _multi_release; // multi-release jar public: bool is_jar_file() const { return true; } + bool is_multi_release_jar() const { return _multi_release; } + void set_multi_release_jar() { _multi_release = true; } bool from_class_path_attr() const { return _from_class_path_attr; } const char* name() const { return _zip_name; } - ClassPathZipEntry(jzfile* zip, const char* zip_name, bool is_boot_append, bool from_class_path_attr); + ClassPathZipEntry(jzfile* zip, const char* zip_name, bool is_boot_append, bool from_class_path_attr, bool multi_release); virtual ~ClassPathZipEntry(); u1* open_entry(JavaThread* current, const char* name, jint* filesize, bool nul_terminate); ClassFileStream* open_stream(JavaThread* current, const char* name); @@ -260,7 +265,8 @@ class ClassLoader: AllStatic { static ClassPathEntry* create_class_path_entry(JavaThread* current, const char *path, const struct stat* st, bool is_boot_append, - bool from_class_path_attr); + bool from_class_path_attr, + bool is_multi_release = false); // Canonicalizes path names, so strcmp will work properly. This is mainly // to avoid confusing the zip library diff --git a/src/hotspot/share/classfile/classLoaderExt.cpp b/src/hotspot/share/classfile/classLoaderExt.cpp index b9e420899c2..f7b2906394d 100644 --- a/src/hotspot/share/classfile/classLoaderExt.cpp +++ b/src/hotspot/share/classfile/classLoaderExt.cpp @@ -244,6 +244,10 @@ void ClassLoaderExt::process_jar_manifest(JavaThread* current, ClassPathEntry* e vm_exit_during_cds_dumping(err_msg("-Xshare:dump does not support Extension-List in JAR manifest: %s", entry->name())); } + if (strstr(manifest, "Multi-Release: true") != nullptr) { + entry->set_multi_release_jar(); + } + char* cp_attr = get_class_path_attr(entry->name(), manifest, manifest_size); if (cp_attr != nullptr && strlen(cp_attr) > 0) { @@ -299,6 +303,7 @@ void ClassLoaderExt::process_jar_manifest(JavaThread* current, ClassPathEntry* e file_start = file_end; } } + return; } void ClassLoaderExt::setup_search_paths(JavaThread* current) { diff --git a/src/hotspot/share/classfile/javaClasses.cpp b/src/hotspot/share/classfile/javaClasses.cpp index c8f6276cb01..1aedb43973c 100644 --- a/src/hotspot/share/classfile/javaClasses.cpp +++ b/src/hotspot/share/classfile/javaClasses.cpp @@ -1113,12 +1113,6 @@ void java_lang_Class::create_mirror(Klass* k, Handle class_loader, assert(k != nullptr, "Use create_basic_type_mirror for primitive types"); assert(k->java_mirror() == nullptr, "should only assign mirror once"); - // Use this moment of initialization to cache modifier_flags also, - // to support Class.getModifiers(). Instance classes recalculate - // the cached flags after the class file is parsed, but before the - // class is put into the system dictionary. - int computed_modifiers = k->compute_modifier_flags(); - k->set_modifier_flags(computed_modifiers); // Class_klass has to be loaded because it is used to allocate // the mirror. if (vmClasses::Class_klass_loaded()) { diff --git a/src/hotspot/share/classfile/moduleEntry.cpp b/src/hotspot/share/classfile/moduleEntry.cpp index af4332ca691..3283e9705b3 100644 --- a/src/hotspot/share/classfile/moduleEntry.cpp +++ b/src/hotspot/share/classfile/moduleEntry.cpp @@ -742,7 +742,7 @@ void ModuleEntryTable::modules_do(ModuleClosure* closure) { void ModuleEntry::print(outputStream* st) { st->print_cr("entry " PTR_FORMAT " name %s module " PTR_FORMAT " loader %s version %s location %s strict %s", p2i(this), - name() == nullptr ? UNNAMED_MODULE : name()->as_C_string(), + name_as_C_string(), p2i(module()), loader_data()->loader_name_and_id(), version() != nullptr ? version()->as_C_string() : "nullptr", diff --git a/src/hotspot/share/classfile/moduleEntry.hpp b/src/hotspot/share/classfile/moduleEntry.hpp index 1100dbf8570..9ad7bde8954 100644 --- a/src/hotspot/share/classfile/moduleEntry.hpp +++ b/src/hotspot/share/classfile/moduleEntry.hpp @@ -185,6 +185,10 @@ class ModuleEntry : public CHeapObj { static ModuleEntry* create_boot_unnamed_module(ClassLoaderData* cld); static ModuleEntry* new_unnamed_module_entry(Handle module_handle, ClassLoaderData* cld); + // Note caller requires ResourceMark + const char* name_as_C_string() { + return is_named() ? name()->as_C_string() : UNNAMED_MODULE; + } void print(outputStream* st = tty); void verify(); diff --git a/src/hotspot/share/classfile/vmIntrinsics.cpp b/src/hotspot/share/classfile/vmIntrinsics.cpp index 5e352e42efb..407cdafaf20 100644 --- a/src/hotspot/share/classfile/vmIntrinsics.cpp +++ b/src/hotspot/share/classfile/vmIntrinsics.cpp @@ -28,10 +28,12 @@ #include "compiler/compilerDirectives.hpp" #include "jvm_constants.h" #include "jvm_io.h" +#ifdef COMPILER2 +#include "opto/c2_globals.hpp" +#endif #include "runtime/vm_version.hpp" #include "utilities/checkedCast.hpp" #include "utilities/tribool.hpp" -#include "utilities/xmlstream.hpp" // These are flag-matching functions: inline bool match_F_R(jshort flags) { diff --git a/src/hotspot/share/code/codeCache.cpp b/src/hotspot/share/code/codeCache.cpp index a0a02c25158..81609c58845 100644 --- a/src/hotspot/share/code/codeCache.cpp +++ b/src/hotspot/share/code/codeCache.cpp @@ -44,6 +44,7 @@ #include "logging/logStream.hpp" #include "memory/allocation.inline.hpp" #include "memory/iterator.hpp" +#include "memory/memoryReserver.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/method.inline.hpp" @@ -318,7 +319,7 @@ void CodeCache::initialize_heaps() { FLAG_SET_ERGO(NonProfiledCodeHeapSize, non_profiled.size); FLAG_SET_ERGO(ReservedCodeCacheSize, cache_size); - ReservedCodeSpace rs = reserve_heap_memory(cache_size, ps); + ReservedSpace rs = reserve_heap_memory(cache_size, ps); // Register CodeHeaps with LSan as we sometimes embed pointers to malloc memory. LSAN_REGISTER_ROOT_REGION(rs.base(), rs.size()); @@ -348,11 +349,12 @@ size_t CodeCache::page_size(bool aligned, size_t min_pages) { os::page_size_for_region_unaligned(ReservedCodeCacheSize, min_pages); } -ReservedCodeSpace CodeCache::reserve_heap_memory(size_t size, size_t rs_ps) { +ReservedSpace CodeCache::reserve_heap_memory(size_t size, size_t rs_ps) { // Align and reserve space for code cache const size_t rs_align = MAX2(rs_ps, os::vm_allocation_granularity()); const size_t rs_size = align_up(size, rs_align); - ReservedCodeSpace rs(rs_size, rs_align, rs_ps); + + ReservedSpace rs = CodeMemoryReserver::reserve(rs_size, rs_align, rs_ps); if (!rs.is_reserved()) { vm_exit_during_initialization(err_msg("Could not reserve enough space for code cache (" SIZE_FORMAT "K)", rs_size/K)); @@ -1130,7 +1132,7 @@ void CodeCache::initialize() { // If InitialCodeCacheSize is equal to ReservedCodeCacheSize, then it's more likely // users want to use the largest available page. const size_t min_pages = (InitialCodeCacheSize == ReservedCodeCacheSize) ? 1 : 8; - ReservedCodeSpace rs = reserve_heap_memory(ReservedCodeCacheSize, page_size(false, min_pages)); + ReservedSpace rs = reserve_heap_memory(ReservedCodeCacheSize, page_size(false, min_pages)); // Register CodeHeaps with LSan as we sometimes embed pointers to malloc memory. LSAN_REGISTER_ROOT_REGION(rs.base(), rs.size()); add_heap(rs, "CodeCache", CodeBlobType::All); diff --git a/src/hotspot/share/code/codeCache.hpp b/src/hotspot/share/code/codeCache.hpp index b724268b650..dbca9aeb25f 100644 --- a/src/hotspot/share/code/codeCache.hpp +++ b/src/hotspot/share/code/codeCache.hpp @@ -79,6 +79,7 @@ class OopClosure; class ShenandoahParallelCodeHeapIterator; class NativePostCallNop; class DeoptimizationScope; +class ReservedSpace; #ifdef LINUX #define DEFAULT_PERFMAP_FILENAME "/tmp/perf-%p.map" @@ -122,7 +123,7 @@ class CodeCache : AllStatic { static CodeHeap* get_code_heap(CodeBlobType code_blob_type); // Returns the CodeHeap for the given CodeBlobType // Returns the name of the VM option to set the size of the corresponding CodeHeap static const char* get_code_heap_flag_name(CodeBlobType code_blob_type); - static ReservedCodeSpace reserve_heap_memory(size_t size, size_t rs_ps); // Reserves one continuous chunk of memory for the CodeHeaps + static ReservedSpace reserve_heap_memory(size_t size, size_t rs_ps); // Reserves one continuous chunk of memory for the CodeHeaps // Iteration static CodeBlob* first_blob(CodeHeap* heap); // Returns the first CodeBlob on the given CodeHeap diff --git a/src/hotspot/share/code/compiledIC.hpp b/src/hotspot/share/code/compiledIC.hpp index 22b93c1760a..37ca090fa9c 100644 --- a/src/hotspot/share/code/compiledIC.hpp +++ b/src/hotspot/share/code/compiledIC.hpp @@ -28,7 +28,6 @@ #include "code/nativeInst.hpp" #include "interpreter/linkResolver.hpp" #include "runtime/safepointVerifiers.hpp" -#include "opto/c2_MacroAssembler.hpp" //----------------------------------------------------------------------------- // The CompiledIC represents a compiled inline cache. diff --git a/src/hotspot/share/code/vtableStubs.cpp b/src/hotspot/share/code/vtableStubs.cpp index aa9319db63b..6a0c52ae828 100644 --- a/src/hotspot/share/code/vtableStubs.cpp +++ b/src/hotspot/share/code/vtableStubs.cpp @@ -40,9 +40,6 @@ #include "runtime/sharedRuntime.hpp" #include "utilities/align.hpp" #include "utilities/powerOfTwo.hpp" -#ifdef COMPILER2 -#include "opto/matcher.hpp" -#endif // ----------------------------------------------------------------------------------------- // Implementation of VtableStub diff --git a/src/hotspot/share/compiler/compilerDefinitions.inline.hpp b/src/hotspot/share/compiler/compilerDefinitions.inline.hpp index 5557892669d..5d04ef307d0 100644 --- a/src/hotspot/share/compiler/compilerDefinitions.inline.hpp +++ b/src/hotspot/share/compiler/compilerDefinitions.inline.hpp @@ -32,9 +32,7 @@ #include "opto/c2compiler.hpp" #endif #include "compiler/compilerDefinitions.hpp" - #include "compiler/compiler_globals.hpp" -#include "compiler/compilerDefinitions.hpp" #include "runtime/arguments.hpp" inline bool CompilerConfig::is_interpreter_only() { diff --git a/src/hotspot/share/compiler/compilerDirectives.hpp b/src/hotspot/share/compiler/compilerDirectives.hpp index e960fdb1e53..620874508f4 100644 --- a/src/hotspot/share/compiler/compilerDirectives.hpp +++ b/src/hotspot/share/compiler/compilerDirectives.hpp @@ -26,9 +26,7 @@ #define SHARE_COMPILER_COMPILERDIRECTIVES_HPP #include "classfile/vmIntrinsics.hpp" -#include "ci/ciMetadata.hpp" #include "ci/ciMethod.hpp" -#include "compiler/compiler_globals.hpp" #include "compiler/methodMatcher.hpp" #include "opto/phasetype.hpp" #include "utilities/bitMap.hpp" diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index 9c9ef7ff9ee..91fc048e982 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -98,6 +98,7 @@ #include "memory/allocation.hpp" #include "memory/heapInspection.hpp" #include "memory/iterator.hpp" +#include "memory/memoryReserver.hpp" #include "memory/metaspaceUtils.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" @@ -1212,8 +1213,21 @@ G1RegionToSpaceMapper* G1CollectedHeap::create_aux_memory_mapper(const char* des size_t size, size_t translation_factor) { size_t preferred_page_size = os::page_size_for_region_unaligned(size, 1); + + // When a page size is given we don't want to mix large + // and normal pages. If the size is not a multiple of the + // page size it will be aligned up to achieve this. + size_t alignment = os::vm_allocation_granularity(); + if (preferred_page_size != os::vm_page_size()) { + alignment = MAX2(preferred_page_size, alignment); + size = align_up(size, alignment); + } + // Allocate a new reserved space, preferring to use large pages. - ReservedSpace rs(size, preferred_page_size); + ReservedSpace rs = MemoryReserver::reserve(size, + alignment, + preferred_page_size); + size_t page_size = rs.page_size(); G1RegionToSpaceMapper* result = G1RegionToSpaceMapper::create_mapper(rs, @@ -1288,7 +1302,7 @@ jint G1CollectedHeap::initialize() { initialize_reserved_region(heap_rs); // Create the barrier set for the entire reserved region. - G1CardTable* ct = new G1CardTable(heap_rs.region()); + G1CardTable* ct = new G1CardTable(_reserved); G1BarrierSet* bs = new G1BarrierSet(ct); bs->initialize(); assert(bs->is_a(BarrierSet::G1BarrierSet), "sanity"); @@ -1440,7 +1454,7 @@ jint G1CollectedHeap::initialize() { G1InitLogger::print(); - FullGCForwarding::initialize(heap_rs.region()); + FullGCForwarding::initialize(_reserved); return JNI_OK; } diff --git a/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp b/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp index d4200edcdcb..4506fda30da 100644 --- a/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp +++ b/src/hotspot/share/gc/g1/g1ConcurrentMarkBitMap.cpp @@ -26,7 +26,6 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp" #include "gc/g1/g1HeapRegion.hpp" -#include "memory/virtualspace.hpp" G1CMBitMap::G1CMBitMap() : MarkBitMap(), _listener() { _listener.set_bitmap(this); diff --git a/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.hpp b/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.hpp index 52b8ebd31f2..303acf62d0b 100644 --- a/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.hpp +++ b/src/hotspot/share/gc/g1/g1PageBasedVirtualSpace.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * 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,10 +26,10 @@ #define SHARE_GC_G1_G1PAGEBASEDVIRTUALSPACE_HPP #include "memory/memRegion.hpp" -#include "memory/virtualspace.hpp" #include "utilities/align.hpp" #include "utilities/bitMap.hpp" +class ReservedSpace; class WorkerThreads; // Virtual space management helper for a virtual space with an OS page allocation diff --git a/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp b/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp index 4403b4c8dd9..ed43bf94648 100644 --- a/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp +++ b/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp @@ -28,7 +28,7 @@ #include "gc/g1/g1RegionToSpaceMapper.hpp" #include "gc/shared/gc_globals.hpp" #include "memory/allocation.inline.hpp" -#include "memory/virtualspace.hpp" +#include "memory/reservedSpace.hpp" #include "nmt/memTracker.hpp" #include "runtime/mutexLocker.hpp" #include "utilities/align.hpp" diff --git a/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.hpp b/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.hpp index 5ef0f8ec5ab..823fa549f36 100644 --- a/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.hpp +++ b/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.hpp @@ -29,6 +29,7 @@ #include "memory/allocation.hpp" #include "utilities/debug.hpp" +class ReservedSpace; class WorkerThreads; class G1MappingChangedListener { diff --git a/src/hotspot/share/gc/parallel/objectStartArray.cpp b/src/hotspot/share/gc/parallel/objectStartArray.cpp index 2a0f12ec70e..2637a9d2b88 100644 --- a/src/hotspot/share/gc/parallel/objectStartArray.cpp +++ b/src/hotspot/share/gc/parallel/objectStartArray.cpp @@ -25,7 +25,7 @@ #include "precompiled.hpp" #include "gc/parallel/objectStartArray.inline.hpp" #include "gc/shared/cardTableBarrierSet.hpp" -#include "nmt/memTracker.hpp" +#include "memory/memoryReserver.hpp" #include "oops/oop.inline.hpp" #include "runtime/java.hpp" #include "utilities/align.hpp" @@ -47,7 +47,7 @@ void ObjectStartArray::initialize(MemRegion reserved_region) { // Do not use large-pages for the backing store. The one large page region // will be used for the heap proper. - ReservedSpace backing_store(bytes_to_reserve, mtGC); + ReservedSpace backing_store = MemoryReserver::reserve(bytes_to_reserve, mtGC); if (!backing_store.is_reserved()) { vm_exit_during_initialization("Could not reserve space for ObjectStartArray"); } diff --git a/src/hotspot/share/gc/parallel/parMarkBitMap.cpp b/src/hotspot/share/gc/parallel/parMarkBitMap.cpp index 46a178500e5..db06cc78521 100644 --- a/src/hotspot/share/gc/parallel/parMarkBitMap.cpp +++ b/src/hotspot/share/gc/parallel/parMarkBitMap.cpp @@ -26,6 +26,7 @@ #include "gc/parallel/parMarkBitMap.inline.hpp" #include "gc/parallel/psCompactionManager.inline.hpp" #include "gc/parallel/psParallelCompact.inline.hpp" +#include "memory/memoryReserver.hpp" #include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" @@ -42,11 +43,14 @@ ParMarkBitMap::initialize(MemRegion covered_region) const size_t raw_bytes = words * sizeof(idx_t); const size_t page_sz = os::page_size_for_region_aligned(raw_bytes, 10); const size_t granularity = os::vm_allocation_granularity(); - _reserved_byte_size = align_up(raw_bytes, MAX2(page_sz, granularity)); + const size_t rs_align = MAX2(page_sz, granularity); + + _reserved_byte_size = align_up(raw_bytes, rs_align); + + ReservedSpace rs = MemoryReserver::reserve(_reserved_byte_size, + rs_align, + page_sz); - const size_t rs_align = page_sz == os::vm_page_size() ? 0 : - MAX2(page_sz, granularity); - ReservedSpace rs(_reserved_byte_size, rs_align, page_sz); const size_t used_page_sz = rs.page_size(); os::trace_page_sizes("Mark Bitmap", raw_bytes, raw_bytes, rs.base(), rs.size(), used_page_sz); @@ -68,7 +72,9 @@ ParMarkBitMap::initialize(MemRegion covered_region) delete _virtual_space; _virtual_space = nullptr; // Release memory reserved in the space. - rs.release(); + if (rs.is_reserved()) { + MemoryReserver::release(rs); + } } return false; } diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp index f2693349b1f..6b1b25dd6aa 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp @@ -45,8 +45,8 @@ #include "memory/iterator.hpp" #include "memory/metaspaceCounters.hpp" #include "memory/metaspaceUtils.hpp" +#include "memory/reservedSpace.hpp" #include "memory/universe.hpp" -#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "runtime/cpuTimeCounters.hpp" #include "runtime/handles.inline.hpp" @@ -74,7 +74,7 @@ jint ParallelScavengeHeap::initialize() { ReservedSpace young_rs = heap_rs.last_part(MaxOldSize, GenAlignment); assert(young_rs.size() == MaxNewSize, "Didn't reserve all of the heap"); - PSCardTable* card_table = new PSCardTable(heap_rs.region()); + PSCardTable* card_table = new PSCardTable(_reserved); card_table->initialize(old_rs.base(), young_rs.base()); CardTableBarrierSet* const barrier_set = new CardTableBarrierSet(card_table); @@ -130,7 +130,7 @@ jint ParallelScavengeHeap::initialize() { ParallelInitLogger::print(); - FullGCForwarding::initialize(heap_rs.region()); + FullGCForwarding::initialize(_reserved); return JNI_OK; } diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp index 22d1296507d..b4151f9b8fa 100644 --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp @@ -44,6 +44,7 @@ class MemoryPool; class PSAdaptiveSizePolicy; class PSCardTable; class PSHeapSummary; +class ReservedSpace; // ParallelScavengeHeap is the implementation of CollectedHeap for Parallel GC. // diff --git a/src/hotspot/share/gc/parallel/psOldGen.hpp b/src/hotspot/share/gc/parallel/psOldGen.hpp index 6fc86eb2d29..c2ae50bfcf8 100644 --- a/src/hotspot/share/gc/parallel/psOldGen.hpp +++ b/src/hotspot/share/gc/parallel/psOldGen.hpp @@ -33,6 +33,8 @@ #include "runtime/mutexLocker.hpp" #include "runtime/safepoint.hpp" +class ReservedSpace; + class PSOldGen : public CHeapObj { friend class VMStructs; private: diff --git a/src/hotspot/share/gc/parallel/psParallelCompact.cpp b/src/hotspot/share/gc/parallel/psParallelCompact.cpp index 4fbf6cee4df..1aadcbeba33 100644 --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp @@ -70,6 +70,7 @@ #include "gc/shared/workerUtils.hpp" #include "logging/log.hpp" #include "memory/iterator.inline.hpp" +#include "memory/memoryReserver.hpp" #include "memory/metaspaceUtils.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" @@ -240,11 +241,14 @@ ParallelCompactData::create_vspace(size_t count, size_t element_size) const size_t raw_bytes = count * element_size; const size_t page_sz = os::page_size_for_region_aligned(raw_bytes, 10); const size_t granularity = os::vm_allocation_granularity(); - _reserved_byte_size = align_up(raw_bytes, MAX2(page_sz, granularity)); + const size_t rs_align = MAX2(page_sz, granularity); + + _reserved_byte_size = align_up(raw_bytes, rs_align); + + ReservedSpace rs = MemoryReserver::reserve(_reserved_byte_size, + rs_align, + page_sz); - const size_t rs_align = page_sz == os::vm_page_size() ? 0 : - MAX2(page_sz, granularity); - ReservedSpace rs(_reserved_byte_size, rs_align, page_sz); os::trace_page_sizes("Parallel Compact Data", raw_bytes, raw_bytes, rs.base(), rs.size(), page_sz); @@ -257,7 +261,10 @@ ParallelCompactData::create_vspace(size_t count, size_t element_size) } delete vspace; // Release memory reserved in the space. - rs.release(); + if (rs.is_reserved()) { + MemoryReserver::release(rs); + rs = {}; + } } return nullptr; diff --git a/src/hotspot/share/gc/parallel/psVirtualspace.cpp b/src/hotspot/share/gc/parallel/psVirtualspace.cpp index a4d686d8670..ee8a564e306 100644 --- a/src/hotspot/share/gc/parallel/psVirtualspace.cpp +++ b/src/hotspot/share/gc/parallel/psVirtualspace.cpp @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "gc/parallel/psVirtualspace.hpp" -#include "memory/virtualspace.hpp" +#include "memory/reservedSpace.hpp" #include "runtime/os.hpp" #include "utilities/align.hpp" diff --git a/src/hotspot/share/gc/parallel/psVirtualspace.hpp b/src/hotspot/share/gc/parallel/psVirtualspace.hpp index e2cb08160be..4c2aa8eef3f 100644 --- a/src/hotspot/share/gc/parallel/psVirtualspace.hpp +++ b/src/hotspot/share/gc/parallel/psVirtualspace.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * 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 @@ #define SHARE_GC_PARALLEL_PSVIRTUALSPACE_HPP #include "memory/allocation.hpp" +#include "memory/reservedSpace.hpp" #include "memory/virtualspace.hpp" // VirtualSpace for the parallel scavenge collector. diff --git a/src/hotspot/share/gc/parallel/psYoungGen.hpp b/src/hotspot/share/gc/parallel/psYoungGen.hpp index 6e256e81d97..e6e73b8aee2 100644 --- a/src/hotspot/share/gc/parallel/psYoungGen.hpp +++ b/src/hotspot/share/gc/parallel/psYoungGen.hpp @@ -31,6 +31,8 @@ #include "gc/parallel/psVirtualspace.hpp" #include "gc/parallel/spaceCounters.hpp" +class ReservedSpace; + class PSYoungGen : public CHeapObj { friend class VMStructs; friend class ParallelScavengeHeap; diff --git a/src/hotspot/share/gc/serial/defNewGeneration.cpp b/src/hotspot/share/gc/serial/defNewGeneration.cpp index 3792bb5a721..f78a766c4c3 100644 --- a/src/hotspot/share/gc/serial/defNewGeneration.cpp +++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp @@ -47,6 +47,7 @@ #include "gc/shared/weakProcessor.hpp" #include "logging/log.hpp" #include "memory/iterator.inline.hpp" +#include "memory/reservedSpace.hpp" #include "memory/resourceArea.hpp" #include "oops/instanceRefKlass.hpp" #include "oops/oop.inline.hpp" diff --git a/src/hotspot/share/gc/serial/generation.hpp b/src/hotspot/share/gc/serial/generation.hpp index e13b42956e1..8c9da3b42b7 100644 --- a/src/hotspot/share/gc/serial/generation.hpp +++ b/src/hotspot/share/gc/serial/generation.hpp @@ -54,6 +54,7 @@ class DefNewGeneration; class GCMemoryManager; class ContiguousSpace; class OopClosure; +class ReservedSpace; class Generation: public CHeapObj { friend class VMStructs; diff --git a/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp b/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp index 8d257c0bf33..bfb4a65baa6 100644 --- a/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp +++ b/src/hotspot/share/gc/serial/serialBlockOffsetTable.cpp @@ -28,8 +28,8 @@ #include "gc/shared/collectedHeap.inline.hpp" #include "logging/log.hpp" #include "memory/iterator.hpp" +#include "memory/memoryReserver.hpp" #include "memory/universe.hpp" -#include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "runtime/java.hpp" #include "runtime/os.hpp" @@ -47,7 +47,7 @@ SerialBlockOffsetTable::SerialBlockOffsetTable(MemRegion reserved, size_t init_word_size): _reserved(reserved) { size_t size = compute_size(reserved.word_size()); - ReservedSpace rs(size, mtGC); + ReservedSpace rs = MemoryReserver::reserve(size, mtGC); if (!rs.is_reserved()) { vm_exit_during_initialization("Could not reserve enough space for heap offset array"); } diff --git a/src/hotspot/share/gc/serial/serialHeap.cpp b/src/hotspot/share/gc/serial/serialHeap.cpp index 81cc59146da..23f1df6fc66 100644 --- a/src/hotspot/share/gc/serial/serialHeap.cpp +++ b/src/hotspot/share/gc/serial/serialHeap.cpp @@ -63,6 +63,7 @@ #include "memory/iterator.hpp" #include "memory/metaspaceCounters.hpp" #include "memory/metaspaceUtils.hpp" +#include "memory/reservedSpace.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/oop.inline.hpp" @@ -189,7 +190,7 @@ jint SerialHeap::initialize() { ReservedSpace young_rs = heap_rs.first_part(MaxNewSize, GenAlignment); ReservedSpace old_rs = heap_rs.last_part(MaxNewSize, GenAlignment); - _rem_set = new CardTableRS(heap_rs.region()); + _rem_set = new CardTableRS(_reserved); _rem_set->initialize(young_rs.base(), old_rs.base()); CardTableBarrierSet *bs = new CardTableBarrierSet(_rem_set); diff --git a/src/hotspot/share/gc/shared/cardTable.cpp b/src/hotspot/share/gc/shared/cardTable.cpp index 53d98ba817e..29ec67359bb 100644 --- a/src/hotspot/share/gc/shared/cardTable.cpp +++ b/src/hotspot/share/gc/shared/cardTable.cpp @@ -29,7 +29,7 @@ #include "gc/shared/gc_globals.hpp" #include "gc/shared/space.hpp" #include "logging/log.hpp" -#include "memory/virtualspace.hpp" +#include "memory/memoryReserver.hpp" #include "nmt/memTracker.hpp" #include "runtime/init.hpp" #include "runtime/java.hpp" @@ -80,15 +80,14 @@ void CardTable::initialize(void* region0_start, void* region1_start) { HeapWord* low_bound = _whole_heap.start(); HeapWord* high_bound = _whole_heap.end(); - const size_t rs_align = _page_size == os::vm_page_size() ? 0 : - MAX2(_page_size, os::vm_allocation_granularity()); - ReservedSpace heap_rs(_byte_map_size, rs_align, _page_size); + const size_t rs_align = MAX2(_page_size, os::vm_allocation_granularity()); + ReservedSpace rs = MemoryReserver::reserve(_byte_map_size, rs_align, _page_size); - MemTracker::record_virtual_memory_tag((address)heap_rs.base(), mtGC); + MemTracker::record_virtual_memory_tag((address)rs.base(), mtGC); os::trace_page_sizes("Card Table", num_bytes, num_bytes, - heap_rs.base(), heap_rs.size(), _page_size); - if (!heap_rs.is_reserved()) { + rs.base(), rs.size(), _page_size); + if (!rs.is_reserved()) { vm_exit_during_initialization("Could not reserve enough space for the " "card marking array"); } @@ -97,7 +96,7 @@ void CardTable::initialize(void* region0_start, void* region1_start) { // then add it to _byte_map_base, i.e. // // _byte_map = _byte_map_base + (uintptr_t(low_bound) >> card_shift) - _byte_map = (CardValue*) heap_rs.base(); + _byte_map = (CardValue*) rs.base(); _byte_map_base = _byte_map - (uintptr_t(low_bound) >> _card_shift); assert(byte_for(low_bound) == &_byte_map[0], "Checking start of map"); assert(byte_for(high_bound-1) <= &_byte_map[last_valid_index()], "Checking end of map"); diff --git a/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp b/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp index 1277cd99293..c448d759408 100644 --- a/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp +++ b/src/hotspot/share/gc/shared/cardTableBarrierSet.cpp @@ -30,7 +30,6 @@ #include "gc/shared/collectedHeap.hpp" #include "gc/shared/space.hpp" #include "logging/log.hpp" -#include "memory/virtualspace.hpp" #include "nmt/memTracker.hpp" #include "oops/oop.inline.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/share/gc/shared/collectedHeap.cpp b/src/hotspot/share/gc/shared/collectedHeap.cpp index 3f0447b6558..e35748b3669 100644 --- a/src/hotspot/share/gc/shared/collectedHeap.cpp +++ b/src/hotspot/share/gc/shared/collectedHeap.cpp @@ -45,6 +45,7 @@ #include "memory/classLoaderMetaspace.hpp" #include "memory/metaspace.hpp" #include "memory/metaspaceUtils.hpp" +#include "memory/reservedSpace.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" #include "oops/instanceMirrorKlass.hpp" diff --git a/src/hotspot/share/gc/shared/genArguments.cpp b/src/hotspot/share/gc/shared/genArguments.cpp index 76f9f6d4052..c94ca56722f 100644 --- a/src/hotspot/share/gc/shared/genArguments.cpp +++ b/src/hotspot/share/gc/shared/genArguments.cpp @@ -37,7 +37,11 @@ size_t MinNewSize = 0; size_t MinOldSize = 0; size_t MaxOldSize = 0; -size_t OldSize = 0; +// If InitialHeapSize or MinHeapSize is not set on cmdline, this variable, +// together with NewSize, is used to derive them. +// Using the same value when it was a configurable flag to avoid breakage. +// See more in JDK-8346005 +size_t OldSize = ScaleForWordSize(4*M); size_t GenAlignment = 0; diff --git a/src/hotspot/share/gc/shared/generationCounters.cpp b/src/hotspot/share/gc/shared/generationCounters.cpp index 05460ea8898..a0d0e529990 100644 --- a/src/hotspot/share/gc/shared/generationCounters.cpp +++ b/src/hotspot/share/gc/shared/generationCounters.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. * 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 @@ #include "gc/shared/generationCounters.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" +#include "memory/virtualspace.hpp" #include "runtime/perfData.hpp" void GenerationCounters::initialize(const char* name, int ordinal, int spaces, diff --git a/src/hotspot/share/gc/shared/generationCounters.hpp b/src/hotspot/share/gc/shared/generationCounters.hpp index 292ea61d46d..603d9850a73 100644 --- a/src/hotspot/share/gc/shared/generationCounters.hpp +++ b/src/hotspot/share/gc/shared/generationCounters.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. * 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,9 +25,11 @@ #ifndef SHARE_GC_SHARED_GENERATIONCOUNTERS_HPP #define SHARE_GC_SHARED_GENERATIONCOUNTERS_HPP -#include "memory/virtualspace.hpp" +#include "memory/allocation.hpp" #include "runtime/perfDataTypes.hpp" +class VirtualSpace; + // A GenerationCounter is a holder class for performance counters // that track a generation diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCardTable.cpp b/src/hotspot/share/gc/shenandoah/shenandoahCardTable.cpp index 6ecb93717df..692144344d0 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCardTable.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCardTable.cpp @@ -26,8 +26,10 @@ #include "gc/shenandoah/shenandoahCardTable.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" -#include "runtime/init.hpp" +#include "memory/memoryReserver.hpp" +#include "memory/reservedSpace.hpp" #include "nmt/memTracker.hpp" +#include "runtime/init.hpp" void ShenandoahCardTable::initialize() { size_t num_cards = cards_required(_whole_heap.word_size()); @@ -41,9 +43,9 @@ void ShenandoahCardTable::initialize() { HeapWord* high_bound = _whole_heap.end(); // ReservedSpace constructor would assert rs_align >= os::vm_page_size(). - const size_t rs_align = _page_size == os::vm_page_size() ? 0 : MAX2(_page_size, granularity); + const size_t rs_align = MAX2(_page_size, granularity); - ReservedSpace write_space(_byte_map_size, rs_align, _page_size); + ReservedSpace write_space = MemoryReserver::reserve(_byte_map_size, rs_align, _page_size); initialize(write_space); // The assembler store_check code will do an unsigned shift of the oop, @@ -58,7 +60,7 @@ void ShenandoahCardTable::initialize() { _write_byte_map = _byte_map; _write_byte_map_base = _byte_map_base; - ReservedSpace read_space(_byte_map_size, rs_align, _page_size); + ReservedSpace read_space = MemoryReserver::reserve(_byte_map_size, rs_align, _page_size); initialize(read_space); _read_byte_map = (CardValue*) read_space.base(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp index 124ab1958eb..4d521d2e7f0 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.cpp @@ -32,8 +32,8 @@ #include "gc/shenandoah/shenandoahHeapRegion.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegionSet.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" -#include "runtime/atomic.hpp" #include "nmt/memTracker.hpp" +#include "runtime/atomic.hpp" #include "utilities/copy.hpp" ShenandoahCollectionSet::ShenandoahCollectionSet(ShenandoahHeap* heap, ReservedSpace space, char* heap_base) : diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp index ae1971f30d6..4f9f6fc2052 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.hpp @@ -26,11 +26,12 @@ #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_HPP #define SHARE_GC_SHENANDOAH_SHENANDOAHCOLLECTIONSET_HPP -#include "memory/allocation.hpp" -#include "memory/virtualspace.hpp" #include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" #include "gc/shenandoah/shenandoahPadding.hpp" +#include "memory/allocation.hpp" +#include "memory/reservedSpace.hpp" +#include "memory/virtualspace.hpp" class ShenandoahCollectionSet : public CHeapObj { friend class ShenandoahHeap; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp index 3aaa23adca7..89a04d23cec 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.cpp @@ -792,7 +792,7 @@ HeapWord* ShenandoahFreeSet::allocate_single(ShenandoahAllocRequest& req, bool& // Free set maintains mutator and collector partitions. Normally, each allocates only from its partition, // except in special cases when the collector steals regions from the mutator partition. - // Overwrite with non-zero (non-NULL) values only if necessary for allocation bookkeeping. + // Overwrite with non-zero (non-null) values only if necessary for allocation bookkeeping. switch (req.type()) { case ShenandoahAllocRequest::_alloc_tlab: diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.cpp index 81bb5c56a86..9dcdf002b7e 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalEvacuationTask.cpp @@ -202,7 +202,7 @@ void ShenandoahGenerationalEvacuationTask::promote_in_place(ShenandoahHeapRegion while (obj_addr < tams) { oop obj = cast_to_oop(obj_addr); if (marking_context->is_marked(obj)) { - assert(obj->klass() != nullptr, "klass should not be NULL"); + assert(obj->klass() != nullptr, "klass should not be null"); // This thread is responsible for registering all objects in this region. No need for lock. scanner->register_object_without_lock(obj_addr); obj_addr += obj->size(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp index 5b8afc52b93..2ad35fcb288 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahGenerationalHeap.cpp @@ -180,8 +180,8 @@ void ShenandoahGenerationalHeap::gc_threads_do(ThreadClosure* tcl) const { } void ShenandoahGenerationalHeap::stop() { - regulator_thread()->stop(); ShenandoahHeap::stop(); + regulator_thread()->stop(); } void ShenandoahGenerationalHeap::evacuate_collection_set(bool concurrent) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index c1bc9dc6616..d75a9234a63 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -28,7 +28,6 @@ #include "cds/archiveHeapWriter.hpp" #include "classfile/systemDictionary.hpp" -#include "code/codeCache.hpp" #include "gc/shared/classUnloadingContext.hpp" #include "gc/shared/fullGCForwarding.hpp" @@ -86,9 +85,10 @@ #include "gc/shenandoah/shenandoahJfrSupport.hpp" #endif - +#include "memory/allocation.hpp" #include "memory/allocation.hpp" #include "memory/classLoaderMetaspace.hpp" +#include "memory/memoryReserver.hpp" #include "memory/metaspaceUtils.hpp" #include "memory/universe.hpp" #include "nmt/mallocTracker.hpp" @@ -156,6 +156,19 @@ class ShenandoahPretouchBitmapTask : public WorkerTask { } }; +static ReservedSpace reserve(size_t size, size_t preferred_page_size) { + // When a page size is given we don't want to mix large + // and normal pages. If the size is not a multiple of the + // page size it will be aligned up to achieve this. + size_t alignment = os::vm_allocation_granularity(); + if (preferred_page_size != os::vm_page_size()) { + alignment = MAX2(preferred_page_size, alignment); + size = align_up(size, alignment); + } + + return MemoryReserver::reserve(size, alignment, preferred_page_size); +} + jint ShenandoahHeap::initialize() { // // Figure out heap sizing @@ -281,7 +294,7 @@ jint ShenandoahHeap::initialize() { "Bitmap slices should be page-granular: bps = " SIZE_FORMAT ", page size = " SIZE_FORMAT, _bitmap_bytes_per_slice, bitmap_page_size); - ReservedSpace bitmap(_bitmap_size, bitmap_page_size); + ReservedSpace bitmap = reserve(_bitmap_size, bitmap_page_size); os::trace_page_sizes_for_requested_size("Mark Bitmap", bitmap_size_orig, bitmap_page_size, bitmap.base(), @@ -301,7 +314,7 @@ jint ShenandoahHeap::initialize() { _marking_context = new ShenandoahMarkingContext(_heap_region, _bitmap_region, _num_regions); if (ShenandoahVerify) { - ReservedSpace verify_bitmap(_bitmap_size, bitmap_page_size); + ReservedSpace verify_bitmap = reserve(_bitmap_size, bitmap_page_size); os::trace_page_sizes_for_requested_size("Verify Bitmap", bitmap_size_orig, bitmap_page_size, verify_bitmap.base(), @@ -319,7 +332,7 @@ jint ShenandoahHeap::initialize() { // Reserve aux bitmap for use in object_iterate(). We don't commit it here. size_t aux_bitmap_page_size = bitmap_page_size; - ReservedSpace aux_bitmap(_bitmap_size, aux_bitmap_page_size); + ReservedSpace aux_bitmap = reserve(_bitmap_size, aux_bitmap_page_size); os::trace_page_sizes_for_requested_size("Aux Bitmap", bitmap_size_orig, aux_bitmap_page_size, aux_bitmap.base(), @@ -337,7 +350,7 @@ jint ShenandoahHeap::initialize() { size_t region_storage_size = align_up(region_storage_size_orig, MAX2(region_page_size, os::vm_allocation_granularity())); - ReservedSpace region_storage(region_storage_size, region_page_size); + ReservedSpace region_storage = reserve(region_storage_size, region_page_size); os::trace_page_sizes_for_requested_size("Region Storage", region_storage_size_orig, region_page_size, region_storage.base(), @@ -363,7 +376,7 @@ jint ShenandoahHeap::initialize() { for (uintptr_t addr = min; addr <= max; addr <<= 1u) { char* req_addr = (char*)addr; assert(is_aligned(req_addr, cset_align), "Should be aligned"); - cset_rs = ReservedSpace(cset_size, cset_align, cset_page_size, req_addr); + cset_rs = MemoryReserver::reserve(req_addr, cset_size, cset_align, cset_page_size); if (cset_rs.is_reserved()) { assert(cset_rs.base() == req_addr, "Allocated where requested: " PTR_FORMAT ", " PTR_FORMAT, p2i(cset_rs.base()), addr); _collection_set = new ShenandoahCollectionSet(this, cset_rs, sh_rs.base()); @@ -372,7 +385,7 @@ jint ShenandoahHeap::initialize() { } if (_collection_set == nullptr) { - cset_rs = ReservedSpace(cset_size, cset_align, os::vm_page_size()); + cset_rs = MemoryReserver::reserve(cset_size, cset_align, os::vm_page_size()); _collection_set = new ShenandoahCollectionSet(this, cset_rs, sh_rs.base()); } os::trace_page_sizes_for_requested_size("Collection Set", @@ -545,7 +558,6 @@ ShenandoahHeap::ShenandoahHeap(ShenandoahCollectorPolicy* policy) : _pacer(nullptr), _verifier(nullptr), _phase_timings(nullptr), - _mmu_tracker(), _monitoring_support(nullptr), _memory_pool(nullptr), _stw_memory_manager("Shenandoah Pauses"), @@ -639,6 +651,8 @@ class ShenandoahInitWorkerGCLABClosure : public ThreadClosure { void ShenandoahHeap::post_initialize() { CollectedHeap::post_initialize(); + + // Schedule periodic task to report on gc thread CPU utilization _mmu_tracker.initialize(); MutexLocker ml(Threads_lock); @@ -2050,6 +2064,9 @@ void ShenandoahHeap::stop() { // Step 0. Notify policy to disable event recording and prevent visiting gc threads during shutdown _shenandoah_policy->record_shutdown(); + // Step 0a. Stop reporting on gc thread cpu utilization + mmu_tracker()->stop(); + // Step 1. Notify control thread that we are in shutdown. // Note that we cannot do that with stop(), because stop() is blocking and waits for the actual shutdown. // Doing stop() here would wait for the normal GC cycle to complete, never falling through to cancel below. @@ -2734,4 +2751,3 @@ void ShenandoahHeap::log_heap_status(const char* msg) const { global_generation()->log_status(msg); } } - diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp index f4cbdbdd493..d9cec36e6c9 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.cpp @@ -48,6 +48,7 @@ class ThreadTimeAccumulator : public ThreadClosure { size_t total_time; ThreadTimeAccumulator() : total_time(0) {} void do_thread(Thread* thread) override { + assert(!thread->has_terminated(), "Cannot get cpu time for terminated thread: " UINTX_FORMAT, thread->osthread()->thread_id_for_printing()); total_time += os::thread_cpu_time(thread); } }; @@ -65,7 +66,6 @@ ShenandoahMmuTracker::ShenandoahMmuTracker() : } ShenandoahMmuTracker::~ShenandoahMmuTracker() { - _mmu_periodic_task->disenroll(); delete _mmu_periodic_task; } @@ -175,6 +175,10 @@ void ShenandoahMmuTracker::report() { log_debug(gc)("Periodic Sample: GCU = %.3f%%, MU = %.3f%% during most recent %.1fs", gcu * 100, mu * 100, time_delta); } +void ShenandoahMmuTracker::stop() const { + _mmu_periodic_task->disenroll(); +} + void ShenandoahMmuTracker::initialize() { // initialize static data _active_processors = os::initial_active_processor_count(); diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.hpp b/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.hpp index 53b6fdada55..89dbf921cd4 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMmuTracker.hpp @@ -101,6 +101,10 @@ class ShenandoahMmuTracker { // GCPauseIntervalMillis and defaults to 5 seconds. This method computes // the MMU over the elapsed interval and records it in a running average. void report(); + + // Unenrolls the periodic task that collects CPU utilization for GC threads. This must happen _before_ the + // gc threads are stopped and terminated. + void stop() const; }; #endif //SHARE_GC_SHENANDOAH_SHENANDOAHMMUTRACKER_HPP diff --git a/src/hotspot/share/gc/z/zUtils.cpp b/src/hotspot/share/gc/z/zUtils.cpp index 3804baad595..7997242f391 100644 --- a/src/hotspot/share/gc/z/zUtils.cpp +++ b/src/hotspot/share/gc/z/zUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * 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,8 +25,6 @@ #include "gc/z/zUtils.hpp" #include "runtime/nonJavaThread.hpp" -#include - const char* ZUtils::thread_name() { const Thread* const thread = Thread::current(); if (thread->is_Named_thread()) { @@ -38,5 +36,7 @@ const char* ZUtils::thread_name() { } void ZUtils::fill(uintptr_t* addr, size_t count, uintptr_t value) { - std::fill_n(addr, count, value); + for (size_t i = 0; i < count; ++i) { + addr[i] = value; + } } diff --git a/src/hotspot/share/interpreter/interpreterRuntime.cpp b/src/hotspot/share/interpreter/interpreterRuntime.cpp index cb85513eed0..9d953d9db54 100644 --- a/src/hotspot/share/interpreter/interpreterRuntime.cpp +++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp @@ -77,9 +77,6 @@ #include "utilities/checkedCast.hpp" #include "utilities/copy.hpp" #include "utilities/events.hpp" -#ifdef COMPILER2 -#include "opto/runtime.hpp" -#endif // Helper class to access current interpreter state class LastFrameAccessor : public StackObj { diff --git a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.cpp b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.cpp index 55e1e2ac374..29cd6a17b13 100644 --- a/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.cpp +++ b/src/hotspot/share/jfr/recorder/stacktrace/jfrStackTrace.cpp @@ -163,10 +163,10 @@ static RegisterMap::WalkContinuation walk_continuation(JavaThread* jt) { } JfrVframeStream::JfrVframeStream(JavaThread* jt, const frame& fr, bool stop_at_java_call_stub, bool async_mode) : - vframeStreamCommon(RegisterMap(jt, - RegisterMap::UpdateMap::skip, - RegisterMap::ProcessFrames::skip, - walk_continuation(jt))), + vframeStreamCommon(jt, + RegisterMap::UpdateMap::skip, + RegisterMap::ProcessFrames::skip, + walk_continuation(jt)), _vthread(JfrThreadLocal::is_vthread(jt)), _cont_entry(_vthread ? jt->last_continuation() : nullptr), _async_mode(async_mode) { diff --git a/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp b/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp index 000ab5e235a..6130de655bd 100644 --- a/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp +++ b/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "jfr/recorder/storage/jfrVirtualMemory.hpp" +#include "memory/memoryReserver.hpp" #include "memory/virtualspace.hpp" #include "nmt/memTracker.hpp" #include "runtime/globals.hpp" @@ -97,14 +98,16 @@ JfrVirtualMemorySegment::JfrVirtualMemorySegment() : JfrVirtualMemorySegment::~JfrVirtualMemorySegment() { decommit(); - _rs.release(); + if (_rs.is_reserved()) { + MemoryReserver::release(_rs); + } } bool JfrVirtualMemorySegment::initialize(size_t reservation_size_request_bytes) { assert(is_aligned(reservation_size_request_bytes, os::vm_allocation_granularity()), "invariant"); - _rs = ReservedSpace(reservation_size_request_bytes, - os::vm_allocation_granularity(), - os::vm_page_size()); + _rs = MemoryReserver::reserve(reservation_size_request_bytes, + os::vm_allocation_granularity(), + os::vm_page_size()); if (!_rs.is_reserved()) { return false; } diff --git a/src/hotspot/share/memory/heap.cpp b/src/hotspot/share/memory/heap.cpp index f88f5c4dc12..1f0db3f08b5 100644 --- a/src/hotspot/share/memory/heap.cpp +++ b/src/hotspot/share/memory/heap.cpp @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "memory/heap.hpp" -#include "nmt/memTracker.hpp" +#include "memory/memoryReserver.hpp" #include "oops/oop.inline.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/os.hpp" @@ -223,7 +223,7 @@ bool CodeHeap::reserve(ReservedSpace rs, size_t committed_size, size_t segment_s const size_t committed_segments_size = align_to_page_size(_number_of_committed_segments); // reserve space for _segmap - ReservedSpace seg_rs(reserved_segments_size, mtCode); + ReservedSpace seg_rs = MemoryReserver::reserve(reserved_segments_size, mtCode); if (!_segmap.initialize(seg_rs, committed_segments_size)) { return false; } diff --git a/src/hotspot/share/memory/heap.hpp b/src/hotspot/share/memory/heap.hpp index a7b9b95050d..e54f99c8c54 100644 --- a/src/hotspot/share/memory/heap.hpp +++ b/src/hotspot/share/memory/heap.hpp @@ -31,6 +31,8 @@ #include "runtime/atomic.hpp" #include "utilities/macros.hpp" +class ReservedSpace; + // Blocks class HeapBlock { diff --git a/src/hotspot/share/memory/memoryReserver.cpp b/src/hotspot/share/memory/memoryReserver.cpp new file mode 100644 index 00000000000..b8774c30ab0 --- /dev/null +++ b/src/hotspot/share/memory/memoryReserver.cpp @@ -0,0 +1,693 @@ +/* + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "jvm.h" +#include "logging/log.hpp" +#include "memory/memoryReserver.hpp" +#include "oops/compressedOops.hpp" +#include "oops/markWord.hpp" +#include "runtime/globals_extension.hpp" +#include "runtime/java.hpp" +#include "runtime/os.hpp" +#include "utilities/formatBuffer.hpp" +#include "utilities/globalDefinitions.hpp" +#include "utilities/powerOfTwo.hpp" + +static void sanity_check_size_and_alignment(size_t size, size_t alignment) { + assert(size > 0, "Precondition"); + + DEBUG_ONLY(const size_t granularity = os::vm_allocation_granularity()); + assert(is_aligned(size, granularity), "size not aligned to os::vm_allocation_granularity()"); + + assert(alignment >= granularity, "Must be set"); + assert(is_power_of_2(alignment), "not a power of 2"); + assert(is_aligned(alignment, granularity), "alignment not aligned to os::vm_allocation_granularity()"); +} + +static void sanity_check_page_size(size_t page_size) { + assert(page_size >= os::vm_page_size(), "Invalid page size"); + assert(is_power_of_2(page_size), "Invalid page size"); +} + +static void sanity_check_arguments(size_t size, size_t alignment, size_t page_size) { + sanity_check_size_and_alignment(size, alignment); + sanity_check_page_size(page_size); +} + +static bool large_pages_requested() { + return UseLargePages && + (!FLAG_IS_DEFAULT(UseLargePages) || !FLAG_IS_DEFAULT(LargePageSizeInBytes)); +} + +static void log_on_large_pages_failure(char* req_addr, size_t bytes) { + if (large_pages_requested()) { + // Compressed oops logging. + log_debug(gc, heap, coops)("Reserve regular memory without large pages"); + // JVM style warning that we did not succeed in using large pages. + char msg[128]; + jio_snprintf(msg, sizeof(msg), "Failed to reserve and commit memory using large pages. " + "req_addr: " PTR_FORMAT " bytes: " SIZE_FORMAT, + req_addr, bytes); + warning("%s", msg); + } +} + +static bool use_explicit_large_pages(size_t page_size) { + return !os::can_commit_large_page_memory() && + page_size != os::vm_page_size(); +} + +static char* reserve_memory_inner(char* requested_address, + size_t size, + size_t alignment, + bool exec, + MemTag mem_tag) { + // If the memory was requested at a particular address, use + // os::attempt_reserve_memory_at() to avoid mapping over something + // important. If the reservation fails, return null. + if (requested_address != nullptr) { + assert(is_aligned(requested_address, alignment), + "Requested address " PTR_FORMAT " must be aligned to " SIZE_FORMAT, + p2i(requested_address), alignment); + return os::attempt_reserve_memory_at(requested_address, size, exec, mem_tag); + } + + // Optimistically assume that the OS returns an aligned base pointer. + // When reserving a large address range, most OSes seem to align to at + // least 64K. + char* base = os::reserve_memory(size, exec, mem_tag); + if (is_aligned(base, alignment)) { + return base; + } + + // Base not aligned, retry. + if (!os::release_memory(base, size)) { + fatal("os::release_memory failed"); + } + + // Map using the requested alignment. + return os::reserve_memory_aligned(size, alignment, exec); +} + +ReservedSpace MemoryReserver::reserve_memory(char* requested_address, + size_t size, + size_t alignment, + bool exec, + MemTag mem_tag) { + char* base = reserve_memory_inner(requested_address, size, alignment, exec, mem_tag); + + if (base != nullptr) { + return ReservedSpace(base, size, alignment, os::vm_page_size(), exec, false /* special */); + } + + // Failed + return {}; +} + +ReservedSpace MemoryReserver::reserve_memory_special(char* requested_address, + size_t size, + size_t alignment, + size_t page_size, + bool exec) { + log_trace(pagesize)("Attempt special mapping: size: " SIZE_FORMAT "%s, " + "alignment: " SIZE_FORMAT "%s", + byte_size_in_exact_unit(size), exact_unit_for_byte_size(size), + byte_size_in_exact_unit(alignment), exact_unit_for_byte_size(alignment)); + + char* base = os::reserve_memory_special(size, alignment, page_size, requested_address, exec); + + if (base != nullptr) { + assert(is_aligned(base, alignment), + "reserve_memory_special() returned an unaligned address, " + "base: " PTR_FORMAT " alignment: " SIZE_FORMAT_X, + p2i(base), alignment); + + return ReservedSpace(base, size, alignment, page_size, exec, true /* special */); + } + + // Failed + return {}; +} + +ReservedSpace MemoryReserver::reserve(char* requested_address, + size_t size, + size_t alignment, + size_t page_size, + bool executable, + MemTag mem_tag) { + sanity_check_arguments(size, alignment, page_size); + + // Reserve the memory. + + // There are basically three different cases that we need to handle: + // 1. Mapping backed by a file + // 2. Mapping backed by explicit large pages + // 3. Mapping backed by normal pages or transparent huge pages + // The first two have restrictions that requires the whole mapping to be + // committed up front. To record this the ReservedSpace is marked 'special'. + + // == Case 1 == + // This case is contained within the HeapReserver + + // == Case 2 == + if (use_explicit_large_pages(page_size)) { + // System can't commit large pages i.e. use transparent huge pages and + // the caller requested large pages. To satisfy this request we use + // explicit large pages and these have to be committed up front to ensure + // no reservations are lost. + do { + ReservedSpace reserved = reserve_memory_special(requested_address, size, alignment, page_size, executable); + if (reserved.is_reserved()) { + // Successful reservation using large pages. + return reserved; + } + page_size = os::page_sizes().next_smaller(page_size); + } while (page_size > os::vm_page_size()); + + // Failed to reserve explicit large pages, do proper logging. + log_on_large_pages_failure(requested_address, size); + // Now fall back to normal reservation. + assert(page_size == os::vm_page_size(), "inv"); + } + + // == Case 3 == + return reserve_memory(requested_address, size, alignment, executable, mem_tag); +} + +ReservedSpace MemoryReserver::reserve(char* requested_address, + size_t size, + size_t alignment, + size_t page_size, + MemTag mem_tag) { + return reserve(requested_address, + size, + alignment, + page_size, + !ExecMem, + mem_tag); +} + + +ReservedSpace MemoryReserver::reserve(size_t size, + size_t alignment, + size_t page_size, + MemTag mem_tag) { + return reserve(nullptr /* requested_address */, + size, + alignment, + page_size, + mem_tag); +} + +ReservedSpace MemoryReserver::reserve(size_t size, + MemTag mem_tag) { + // Want to use large pages where possible. If the size is + // not large page aligned the mapping will be a mix of + // large and normal pages. + size_t page_size = os::page_size_for_region_unaligned(size, 1); + size_t alignment = os::vm_allocation_granularity(); + + return reserve(size, + alignment, + page_size, + mem_tag); +} + +bool MemoryReserver::release(const ReservedSpace& reserved) { + assert(reserved.is_reserved(), "Precondition"); + + if (reserved.special()) { + return os::release_memory_special(reserved.base(), reserved.size()); + } else { + return os::release_memory(reserved.base(), reserved.size()); + } +} + +static char* map_memory_to_file(char* requested_address, + size_t size, + size_t alignment, + int fd, + MemTag mem_tag) { + // If the memory was requested at a particular address, use + // os::attempt_reserve_memory_at() to avoid mapping over something + // important. If the reservation fails, return null. + if (requested_address != nullptr) { + assert(is_aligned(requested_address, alignment), + "Requested address " PTR_FORMAT " must be aligned to " SIZE_FORMAT, + p2i(requested_address), alignment); + return os::attempt_map_memory_to_file_at(requested_address, size, fd, mem_tag); + } + + // Optimistically assume that the OS returns an aligned base pointer. + // When reserving a large address range, most OSes seem to align to at + // least 64K. + char* base = os::map_memory_to_file(size, fd); + if (is_aligned(base, alignment)) { + return base; + } + + + // Base not aligned, retry. + if (!os::unmap_memory(base, size)) { + fatal("os::unmap_memory failed"); + } + + // Map using the requested alignment. + return os::map_memory_to_file_aligned(size, alignment, fd, mem_tag); +} + +ReservedSpace FileMappedMemoryReserver::reserve(char* requested_address, + size_t size, + size_t alignment, + int fd, + MemTag mem_tag) { + sanity_check_size_and_alignment(size, alignment); + + char* base = map_memory_to_file(requested_address, size, alignment, fd, mem_tag); + + if (base != nullptr) { + return ReservedSpace(base, size, alignment, os::vm_page_size(), !ExecMem, true /* special */); + } + + // Failed + return {}; +} + +ReservedSpace CodeMemoryReserver::reserve(size_t size, + size_t alignment, + size_t page_size) { + return MemoryReserver::reserve(nullptr /* requested_address */, + size, + alignment, + page_size, + ExecMem, + mtCode); +} + +ReservedHeapSpace HeapReserver::Instance::reserve_uncompressed_oops_heap(size_t size, + size_t alignment, + size_t page_size) { + ReservedSpace reserved = reserve_memory(size, alignment, page_size); + + if (reserved.is_reserved()) { + return ReservedHeapSpace(reserved, 0 /* noaccess_prefix */); + } + + // Failed + return {}; +} + + +static int maybe_create_file(const char* heap_allocation_directory) { + if (heap_allocation_directory == nullptr) { + return -1; + } + + int fd = os::create_file_for_heap(heap_allocation_directory); + if (fd == -1) { + vm_exit_during_initialization( + err_msg("Could not create file for Heap at location %s", heap_allocation_directory)); + } + + return fd; +} + +HeapReserver::Instance::Instance(const char* heap_allocation_directory) + : _fd(maybe_create_file(heap_allocation_directory)) {} + +HeapReserver::Instance::~Instance() { + if (_fd != -1) { + ::close(_fd); + } +} + +ReservedSpace HeapReserver::Instance::reserve_memory(size_t size, + size_t alignment, + size_t page_size, + char* requested_address) { + + // There are basically three different cases that we need to handle below: + // 1. Mapping backed by a file + // 2. Mapping backed by explicit large pages + // 3. Mapping backed by normal pages or transparent huge pages + // The first two have restrictions that requires the whole mapping to be + // committed up front. To record this the ReservedSpace is marked 'special'. + + // == Case 1 == + if (_fd != -1) { + // When there is a backing file directory for this space then whether + // large pages are allocated is up to the filesystem of the backing file. + // So UseLargePages is not taken into account for this reservation. + // + // If requested, let the user know that explicit large pages can't be used. + if (use_explicit_large_pages(page_size) && large_pages_requested()) { + log_debug(gc, heap)("Cannot allocate explicit large pages for Java Heap when AllocateHeapAt option is set."); + } + + // Always return, not possible to fall back to reservation not using a file. + return FileMappedMemoryReserver::reserve(requested_address, size, alignment, _fd, mtJavaHeap); + } + + // == Case 2 & 3 == + return MemoryReserver::reserve(requested_address, size, alignment, page_size, mtJavaHeap); +} + +// Compressed oop support is not relevant in 32bit builds. +#ifdef _LP64 + +void HeapReserver::Instance::release(const ReservedSpace& reserved) { + if (reserved.is_reserved()) { + if (_fd == -1) { + if (reserved.special()) { + os::release_memory_special(reserved.base(), reserved.size()); + } else{ + os::release_memory(reserved.base(), reserved.size()); + } + } else { + os::unmap_memory(reserved.base(), reserved.size()); + } + } +} + +// Tries to allocate memory of size 'size' at address requested_address with alignment 'alignment'. +// Does not check whether the reserved memory actually is at requested_address, as the memory returned +// might still fulfill the wishes of the caller. +// Assures the memory is aligned to 'alignment'. +ReservedSpace HeapReserver::Instance::try_reserve_memory(size_t size, + size_t alignment, + size_t page_size, + char* requested_address) { + // Try to reserve the memory for the heap. + log_trace(gc, heap, coops)("Trying to allocate at address " PTR_FORMAT + " heap of size " SIZE_FORMAT_X, + p2i(requested_address), + size); + + ReservedSpace reserved = reserve_memory(size, alignment, page_size, requested_address); + + if (reserved.is_reserved()) { + // Check alignment constraints. + assert(reserved.alignment() == alignment, "Unexpected"); + assert(is_aligned(reserved.base(), alignment), "Unexpected"); + return reserved; + } + + // Failed + return {}; +} + +ReservedSpace HeapReserver::Instance::try_reserve_range(char *highest_start, + char *lowest_start, + size_t attach_point_alignment, + char *aligned_heap_base_min_address, + char *upper_bound, + size_t size, + size_t alignment, + size_t page_size) { + const size_t attach_range = highest_start - lowest_start; + // Cap num_attempts at possible number. + // At least one is possible even for 0 sized attach range. + const uint64_t num_attempts_possible = (attach_range / attach_point_alignment) + 1; + const uint64_t num_attempts_to_try = MIN2((uint64_t)HeapSearchSteps, num_attempts_possible); + + const size_t stepsize = (attach_range == 0) ? // Only one try. + (size_t) highest_start : align_up(attach_range / num_attempts_to_try, attach_point_alignment); + + // Try attach points from top to bottom. + for (char* attach_point = highest_start; + attach_point >= lowest_start && attach_point <= highest_start; // Avoid wrap around. + attach_point -= stepsize) { + ReservedSpace reserved = try_reserve_memory(size, alignment, page_size, attach_point); + + if (reserved.is_reserved()) { + if (reserved.base() >= aligned_heap_base_min_address && + size <= (uintptr_t)(upper_bound - reserved.base())) { + // Got a successful reservation. + return reserved; + } + + release(reserved); + } + } + + // Failed + return {}; +} + +#define SIZE_64K ((uint64_t) UCONST64( 0x10000)) +#define SIZE_256M ((uint64_t) UCONST64( 0x10000000)) +#define SIZE_32G ((uint64_t) UCONST64( 0x800000000)) + +// Helper for heap allocation. Returns an array with addresses +// (OS-specific) which are suited for disjoint base mode. Array is +// null terminated. +static char** get_attach_addresses_for_disjoint_mode() { + static uint64_t addresses[] = { + 2 * SIZE_32G, + 3 * SIZE_32G, + 4 * SIZE_32G, + 8 * SIZE_32G, + 10 * SIZE_32G, + 1 * SIZE_64K * SIZE_32G, + 2 * SIZE_64K * SIZE_32G, + 3 * SIZE_64K * SIZE_32G, + 4 * SIZE_64K * SIZE_32G, + 16 * SIZE_64K * SIZE_32G, + 32 * SIZE_64K * SIZE_32G, + 34 * SIZE_64K * SIZE_32G, + 0 + }; + + // Sort out addresses smaller than HeapBaseMinAddress. This assumes + // the array is sorted. + uint i = 0; + while (addresses[i] != 0 && + (addresses[i] < OopEncodingHeapMax || addresses[i] < HeapBaseMinAddress)) { + i++; + } + uint start = i; + + // Avoid more steps than requested. + i = 0; + while (addresses[start+i] != 0) { + if (i == HeapSearchSteps) { + addresses[start+i] = 0; + break; + } + i++; + } + + return (char**) &addresses[start]; +} + +// Create protection page at the beginning of the space. +static ReservedSpace establish_noaccess_prefix(const ReservedSpace& reserved, size_t noaccess_prefix) { + assert(reserved.alignment() >= os::vm_page_size(), "must be at least page size big"); + assert(reserved.is_reserved(), "should only be called on a reserved memory area"); + + if (reserved.end() > (char *)OopEncodingHeapMax) { + if (true + WIN64_ONLY(&& !UseLargePages) + AIX_ONLY(&& (os::Aix::supports_64K_mmap_pages() || os::vm_page_size() == 4*K))) { + // Protect memory at the base of the allocated region. + if (!os::protect_memory(reserved.base(), noaccess_prefix, os::MEM_PROT_NONE, reserved.special())) { + fatal("cannot protect protection page"); + } + log_debug(gc, heap, coops)("Protected page at the reserved heap base: " + PTR_FORMAT " / " INTX_FORMAT " bytes", + p2i(reserved.base()), + noaccess_prefix); + assert(CompressedOops::use_implicit_null_checks() == true, "not initialized?"); + } else { + CompressedOops::set_use_implicit_null_checks(false); + } + } + + return reserved.last_part(noaccess_prefix); +} + +ReservedHeapSpace HeapReserver::Instance::reserve_compressed_oops_heap(const size_t size, size_t alignment, size_t page_size) { + const size_t noaccess_prefix_size = lcm(os::vm_page_size(), alignment); + const size_t granularity = os::vm_allocation_granularity(); + + assert(size + noaccess_prefix_size <= OopEncodingHeapMax, "can not allocate compressed oop heap for this size"); + assert(is_aligned(size, granularity), "size not aligned to os::vm_allocation_granularity()"); + + assert(alignment >= os::vm_page_size(), "alignment too small"); + assert(is_aligned(alignment, granularity), "alignment not aligned to os::vm_allocation_granularity()"); + assert(is_power_of_2(alignment), "not a power of 2"); + + // The necessary attach point alignment for generated wish addresses. + // This is needed to increase the chance of attaching for mmap and shmat. + // AIX is the only platform that uses System V shm for reserving virtual memory. + // In this case, the required alignment of the allocated size (64K) and the alignment + // of possible start points of the memory region (256M) differ. + // This is not reflected by os_allocation_granularity(). + // The logic here is dual to the one in pd_reserve_memory in os_aix.cpp + const size_t os_attach_point_alignment = + AIX_ONLY(os::vm_page_size() == 4*K ? 4*K : 256*M) + NOT_AIX(os::vm_allocation_granularity()); + + const size_t attach_point_alignment = lcm(alignment, os_attach_point_alignment); + + char* aligned_heap_base_min_address = align_up((char*)HeapBaseMinAddress, alignment); + size_t noaccess_prefix = ((aligned_heap_base_min_address + size) > (char*)OopEncodingHeapMax) ? + noaccess_prefix_size : 0; + + ReservedSpace reserved{}; + + // Attempt to alloc at user-given address. + if (!FLAG_IS_DEFAULT(HeapBaseMinAddress)) { + reserved = try_reserve_memory(size + noaccess_prefix, alignment, page_size, aligned_heap_base_min_address); + if (reserved.base() != aligned_heap_base_min_address) { // Enforce this exact address. + release(reserved); + reserved = {}; + } + } + + // Keep heap at HeapBaseMinAddress. + if (!reserved.is_reserved()) { + + // Try to allocate the heap at addresses that allow efficient oop compression. + // Different schemes are tried, in order of decreasing optimization potential. + // + // For this, try_reserve_heap() is called with the desired heap base addresses. + // A call into the os layer to allocate at a given address can return memory + // at a different address than requested. Still, this might be memory at a useful + // address. try_reserve_heap() always returns this allocated memory, as only here + // the criteria for a good heap are checked. + + // Attempt to allocate so that we can run without base and scale (32-Bit unscaled compressed oops). + // Give it several tries from top of range to bottom. + if (aligned_heap_base_min_address + size <= (char *)UnscaledOopHeapMax) { + + // Calc address range within we try to attach (range of possible start addresses). + char* const highest_start = align_down((char *)UnscaledOopHeapMax - size, attach_point_alignment); + char* const lowest_start = align_up(aligned_heap_base_min_address, attach_point_alignment); + reserved = try_reserve_range(highest_start, lowest_start, attach_point_alignment, + aligned_heap_base_min_address, (char *)UnscaledOopHeapMax, size, alignment, page_size); + } + + // zerobased: Attempt to allocate in the lower 32G. + char *zerobased_max = (char *)OopEncodingHeapMax; + + // Give it several tries from top of range to bottom. + if (aligned_heap_base_min_address + size <= zerobased_max && // Zerobased theoretical possible. + ((!reserved.is_reserved()) || // No previous try succeeded. + (reserved.end() > zerobased_max))) { // Unscaled delivered an arbitrary address. + + // Release previous reservation + release(reserved); + + // Calc address range within we try to attach (range of possible start addresses). + char *const highest_start = align_down(zerobased_max - size, attach_point_alignment); + // Need to be careful about size being guaranteed to be less + // than UnscaledOopHeapMax due to type constraints. + char *lowest_start = aligned_heap_base_min_address; + uint64_t unscaled_end = UnscaledOopHeapMax - size; + if (unscaled_end < UnscaledOopHeapMax) { // unscaled_end wrapped if size is large + lowest_start = MAX2(lowest_start, (char*)unscaled_end); + } + lowest_start = align_up(lowest_start, attach_point_alignment); + reserved = try_reserve_range(highest_start, lowest_start, attach_point_alignment, + aligned_heap_base_min_address, zerobased_max, size, alignment, page_size); + } + + // Now we go for heaps with base != 0. We need a noaccess prefix to efficiently + // implement null checks. + noaccess_prefix = noaccess_prefix_size; + + // Try to attach at addresses that are aligned to OopEncodingHeapMax. Disjointbase mode. + char** addresses = get_attach_addresses_for_disjoint_mode(); + int i = 0; + while ((addresses[i] != nullptr) && // End of array not yet reached. + ((!reserved.is_reserved()) || // No previous try succeeded. + (reserved.end() > zerobased_max && // Not zerobased or unscaled address. + // Not disjoint address. + !CompressedOops::is_disjoint_heap_base_address((address)reserved.base())))) { + + // Release previous reservation + release(reserved); + + char* const attach_point = addresses[i]; + assert(attach_point >= aligned_heap_base_min_address, "Flag support broken"); + reserved = try_reserve_memory(size + noaccess_prefix, alignment, page_size, attach_point); + i++; + } + + // Last, desperate try without any placement. + if (!reserved.is_reserved()) { + log_trace(gc, heap, coops)("Trying to allocate at address null heap of size " SIZE_FORMAT_X, size + noaccess_prefix); + assert(alignment >= os::vm_page_size(), "Unexpected"); + reserved = reserve_memory(size + noaccess_prefix, alignment, page_size); + } + } + + // No more reserve attempts + + if (reserved.is_reserved()) { + // Successfully found and reserved memory for the heap. + + if (reserved.size() > size) { + // We reserved heap memory with a noaccess prefix. + + assert(reserved.size() == size + noaccess_prefix, "Prefix should be included"); + // It can happen we get a zerobased/unscaled heap with noaccess prefix, + // if we had to try at arbitrary address. + reserved = establish_noaccess_prefix(reserved, noaccess_prefix); + assert(reserved.size() == size, "Prefix should be gone"); + return ReservedHeapSpace(reserved, noaccess_prefix); + } + + // We reserved heap memory without a noaccess prefix. + return ReservedHeapSpace(reserved, 0 /* noaccess_prefix */); + } + + // Failed + return {}; +} + +#endif // _LP64 + +ReservedHeapSpace HeapReserver::Instance::reserve_heap(size_t size, size_t alignment, size_t page_size) { + if (UseCompressedOops) { +#ifdef _LP64 + return reserve_compressed_oops_heap(size, alignment, page_size); +#endif + } else { + return reserve_uncompressed_oops_heap(size, alignment, page_size); + } +} + +ReservedHeapSpace HeapReserver::reserve(size_t size, size_t alignment, size_t page_size, const char* heap_allocation_directory) { + sanity_check_arguments(size, alignment, page_size); + + assert(alignment != 0, "Precondition"); + assert(is_aligned(size, alignment), "Precondition"); + + Instance instance(heap_allocation_directory); + + return instance.reserve_heap(size, alignment, page_size); +} diff --git a/src/hotspot/share/memory/memoryReserver.hpp b/src/hotspot/share/memory/memoryReserver.hpp new file mode 100644 index 00000000000..1e16ec252a9 --- /dev/null +++ b/src/hotspot/share/memory/memoryReserver.hpp @@ -0,0 +1,147 @@ +/* + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_MEMORY_MEMORYRESERVER_HPP +#define SHARE_MEMORY_MEMORYRESERVER_HPP + +#include "memory/allStatic.hpp" +#include "memory/reservedSpace.hpp" +#include "nmt/memTag.hpp" +#include "utilities/globalDefinitions.hpp" + +class MemoryReserver : AllStatic { + static ReservedSpace reserve_memory(char* requested_address, + size_t size, + size_t alignment, + bool exec, + MemTag mem_tag); + + static ReservedSpace reserve_memory_special(char* requested_address, + size_t size, + size_t alignment, + size_t page_size, + bool exec); + +public: + // Final destination + static ReservedSpace reserve(char* requested_address, + size_t size, + size_t alignment, + size_t page_size, + bool executable, + MemTag mem_tag); + + // Convenience overloads + + static ReservedSpace reserve(char* requested_address, + size_t size, + size_t alignment, + size_t page_size, + MemTag mem_tag = mtNone); + + static ReservedSpace reserve(size_t size, + size_t alignment, + size_t page_size, + MemTag mem_tag = mtNone); + + static ReservedSpace reserve(size_t size, + MemTag mem_tag); + + // Release reserved memory + static bool release(const ReservedSpace& reserved); +}; + +class CodeMemoryReserver : AllStatic { +public: + static ReservedSpace reserve(size_t size, + size_t alignment, + size_t page_size); +}; + +class FileMappedMemoryReserver : AllStatic { +public: + static ReservedSpace reserve(char* requested_address, + size_t size, + size_t alignment, + int fd, + MemTag mem_tag); +}; + +class HeapReserver : AllStatic { + class Instance { + const int _fd; + + NONCOPYABLE(Instance); + + ReservedSpace reserve_memory(size_t size, + size_t alignment, + size_t page_size, + char* requested_address = nullptr); + + void release(const ReservedSpace& reserved); + + // CompressedOops support +#ifdef _LP64 + + ReservedSpace try_reserve_memory(size_t size, + size_t alignment, + size_t page_size, + char* requested_address); + + ReservedSpace try_reserve_range(char *highest_start, + char *lowest_start, + size_t attach_point_alignment, + char *aligned_heap_base_min_address, + char *upper_bound, + size_t size, + size_t alignment, + size_t page_size); + + ReservedHeapSpace reserve_compressed_oops_heap(size_t size, + size_t alignment, + size_t page_size); + +#endif // _LP64 + + ReservedHeapSpace reserve_uncompressed_oops_heap(size_t size, + size_t alignment, + size_t page_size); + + public: + Instance(const char* heap_allocation_directory); + ~Instance(); + + ReservedHeapSpace reserve_heap(size_t size, + size_t alignment, + size_t page_size); + }; // Instance + +public: + static ReservedHeapSpace reserve(size_t size, + size_t alignment, + size_t page_size, + const char* heap_allocation_directory); +}; + +#endif // SHARE_MEMORY_MEMORYRESERVER_HPP diff --git a/src/hotspot/share/memory/metaspace.cpp b/src/hotspot/share/memory/metaspace.cpp index aa592a3a6aa..ccfda8257d3 100644 --- a/src/hotspot/share/memory/metaspace.cpp +++ b/src/hotspot/share/memory/metaspace.cpp @@ -32,6 +32,7 @@ #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/classLoaderMetaspace.hpp" +#include "memory/memoryReserver.hpp" #include "memory/metaspace.hpp" #include "memory/metaspace/chunkHeaderPool.hpp" #include "memory/metaspace/chunkManager.hpp" @@ -57,11 +58,11 @@ #include "runtime/globals_extension.hpp" #include "runtime/init.hpp" #include "runtime/java.hpp" +#include "runtime/mutexLocker.hpp" #include "utilities/copy.hpp" #include "utilities/debug.hpp" #include "utilities/formatBuffer.hpp" #include "utilities/globalDefinitions.hpp" -#include "virtualspace.hpp" using metaspace::ChunkManager; using metaspace::CommitLimiter; @@ -597,17 +598,20 @@ ReservedSpace Metaspace::reserve_address_space_for_compressed_classes(size_t siz } // Wrap resulting range in ReservedSpace - ReservedSpace rs; if (result != nullptr) { log_debug(metaspace, map)("Mapped at " PTR_FORMAT, p2i(result)); assert(is_aligned(result, Metaspace::reserve_alignment()), "Alignment too small for metaspace"); - rs = ReservedSpace::space_for_range(result, size, Metaspace::reserve_alignment(), - os::vm_page_size(), false, false); + + return ReservedSpace(result, + size, + Metaspace::reserve_alignment(), + os::vm_page_size(), + !ExecMem, + false /* special */); } else { log_debug(metaspace, map)("Failed to map."); - rs = ReservedSpace(); + return {}; } - return rs; } #endif // _LP64 @@ -760,8 +764,12 @@ void Metaspace::global_initialize() { "(must be aligned to " SIZE_FORMAT_X ").", CompressedClassSpaceBaseAddress, Metaspace::reserve_alignment())); } - rs = ReservedSpace(size, Metaspace::reserve_alignment(), - os::vm_page_size() /* large */, (char*)base); + + rs = MemoryReserver::reserve((char*)base, + size, + Metaspace::reserve_alignment(), + os::vm_page_size()); + if (rs.is_reserved()) { log_info(metaspace)("Successfully forced class space address to " PTR_FORMAT, p2i(base)); } else { @@ -1021,4 +1029,3 @@ bool Metaspace::is_in_shared_metaspace(const void* ptr) { bool Metaspace::is_in_nonclass_metaspace(const void* ptr) { return VirtualSpaceList::vslist_nonclass()->contains((MetaWord*)ptr); } - diff --git a/src/hotspot/share/memory/metaspace.hpp b/src/hotspot/share/memory/metaspace.hpp index 7adebfd826b..293782c0d75 100644 --- a/src/hotspot/share/memory/metaspace.hpp +++ b/src/hotspot/share/memory/metaspace.hpp @@ -26,7 +26,6 @@ #define SHARE_MEMORY_METASPACE_HPP #include "memory/allocation.hpp" -#include "memory/virtualspace.hpp" #include "runtime/globals.hpp" #include "utilities/exceptions.hpp" #include "utilities/globalDefinitions.hpp" @@ -36,6 +35,7 @@ class MetaspaceShared; class MetaspaceTracer; class Mutex; class outputStream; +class ReservedSpace; ////////////////// Metaspace /////////////////////// diff --git a/src/hotspot/share/memory/metaspace/metaspaceContext.hpp b/src/hotspot/share/memory/metaspace/metaspaceContext.hpp index c773c6385b3..6601810ce8d 100644 --- a/src/hotspot/share/memory/metaspace/metaspaceContext.hpp +++ b/src/hotspot/share/memory/metaspace/metaspaceContext.hpp @@ -28,10 +28,10 @@ #include "memory/allocation.hpp" #include "memory/metaspace/counters.hpp" -#include "memory/virtualspace.hpp" #include "utilities/debug.hpp" class outputStream; +class ReservedSpace; namespace metaspace { diff --git a/src/hotspot/share/memory/metaspace/testHelpers.cpp b/src/hotspot/share/memory/metaspace/testHelpers.cpp index b974f06f243..fdf7bb1ba60 100644 --- a/src/hotspot/share/memory/metaspace/testHelpers.cpp +++ b/src/hotspot/share/memory/metaspace/testHelpers.cpp @@ -24,6 +24,7 @@ */ #include "precompiled.hpp" +#include "memory/memoryReserver.hpp" #include "memory/metaspace/chunkManager.hpp" #include "memory/metaspace/metaspaceArena.hpp" #include "memory/metaspace/metaspaceArenaGrowthPolicy.hpp" @@ -82,7 +83,7 @@ MetaspaceTestContext::MetaspaceTestContext(const char* name, size_t commit_limit reserve_limit, Metaspace::reserve_alignment_words()); if (reserve_limit > 0) { // have reserve limit -> non-expandable context - _rs = ReservedSpace(reserve_limit * BytesPerWord, Metaspace::reserve_alignment(), os::vm_page_size()); + _rs = MemoryReserver::reserve(reserve_limit * BytesPerWord, Metaspace::reserve_alignment(), os::vm_page_size()); _context = MetaspaceContext::create_nonexpandable_context(name, _rs, &_commit_limiter); } else { // no reserve limit -> expandable vslist @@ -96,7 +97,7 @@ MetaspaceTestContext::~MetaspaceTestContext() { MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag); delete _context; if (_rs.is_reserved()) { - _rs.release(); + MemoryReserver::release(_rs); } } diff --git a/src/hotspot/share/memory/metaspace/testHelpers.hpp b/src/hotspot/share/memory/metaspace/testHelpers.hpp index 65d5ee47512..ce77b53c24f 100644 --- a/src/hotspot/share/memory/metaspace/testHelpers.hpp +++ b/src/hotspot/share/memory/metaspace/testHelpers.hpp @@ -31,7 +31,7 @@ #include "memory/metaspace/commitLimiter.hpp" #include "memory/metaspace/counters.hpp" #include "memory/metaspace/metaspaceContext.hpp" -#include "memory/virtualspace.hpp" +#include "memory/reservedSpace.hpp" #include "utilities/globalDefinitions.hpp" // This is just convenience classes for metaspace-related tests diff --git a/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp b/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp index 83a591e4cad..77b943609bc 100644 --- a/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp +++ b/src/hotspot/share/memory/metaspace/virtualSpaceNode.cpp @@ -26,6 +26,7 @@ #include "precompiled.hpp" #include "gc/shared/gc_globals.hpp" #include "logging/log.hpp" +#include "memory/memoryReserver.hpp" #include "memory/metaspace.hpp" #include "memory/metaspace/chunkHeaderPool.hpp" #include "memory/metaspace/chunklevel.hpp" @@ -253,9 +254,10 @@ VirtualSpaceNode* VirtualSpaceNode::create_node(size_t word_size, SizeCounter* commit_words_counter) { DEBUG_ONLY(assert_is_aligned(word_size, chunklevel::MAX_CHUNK_WORD_SIZE);) - ReservedSpace rs(word_size * BytesPerWord, - Settings::virtual_space_node_reserve_alignment_words() * BytesPerWord, - os::vm_page_size()); + + ReservedSpace rs = MemoryReserver::reserve(word_size * BytesPerWord, + Settings::virtual_space_node_reserve_alignment_words() * BytesPerWord, + os::vm_page_size()); if (!rs.is_reserved()) { vm_exit_out_of_memory(word_size * BytesPerWord, OOM_MMAP_ERROR, "Failed to reserve memory for metaspace"); } @@ -286,7 +288,9 @@ VirtualSpaceNode::~VirtualSpaceNode() { UL(debug, ": dies."); if (_owns_rs) { - _rs.release(); + if (_rs.is_reserved()) { + MemoryReserver::release(_rs); + } } // Update counters in vslist diff --git a/src/hotspot/share/memory/metaspace/virtualSpaceNode.hpp b/src/hotspot/share/memory/metaspace/virtualSpaceNode.hpp index ab991853712..2ab8f840c3a 100644 --- a/src/hotspot/share/memory/metaspace/virtualSpaceNode.hpp +++ b/src/hotspot/share/memory/metaspace/virtualSpaceNode.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -32,7 +32,7 @@ #include "memory/metaspace/counters.hpp" #include "memory/metaspace/metaspaceSettings.hpp" #include "memory/metaspace/rootChunkArea.hpp" -#include "memory/virtualspace.hpp" +#include "memory/reservedSpace.hpp" #include "utilities/bitMap.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/memory/reservedSpace.cpp b/src/hotspot/share/memory/reservedSpace.cpp new file mode 100644 index 00000000000..90bc00843d1 --- /dev/null +++ b/src/hotspot/share/memory/reservedSpace.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "memory/reservedSpace.hpp" +#include "runtime/os.hpp" +#include "utilities/align.hpp" + +#ifdef ASSERT +void ReservedSpace::sanity_checks() { + assert(is_aligned(_base, os::vm_allocation_granularity()), "Unaligned base"); + assert(is_aligned(_base, _alignment), "Unaligned base"); + assert(is_aligned(_size, os::vm_page_size()), "Unaligned size"); + assert(os::page_sizes().contains(_page_size), "Invalid pagesize"); +} +#endif diff --git a/src/hotspot/share/memory/reservedSpace.hpp b/src/hotspot/share/memory/reservedSpace.hpp new file mode 100644 index 00000000000..1b466a98583 --- /dev/null +++ b/src/hotspot/share/memory/reservedSpace.hpp @@ -0,0 +1,159 @@ +/* + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef SHARE_MEMORY_RESERVEDSPACE_HPP +#define SHARE_MEMORY_RESERVEDSPACE_HPP + +#include "utilities/align.hpp" +#include "utilities/debug.hpp" +#include "utilities/globalDefinitions.hpp" + +// ReservedSpace is a data structure for describing a reserved contiguous address range. + +class ReservedSpace { + char* _base; + size_t _size; + size_t _alignment; + size_t _page_size; + bool _executable; + bool _special; + + void sanity_checks() NOT_DEBUG_RETURN; + +public: + // Constructor for non-reserved memory. + ReservedSpace() + : _base(nullptr), + _size(0), + _alignment(0), + _page_size(0), + _executable(false), + _special(false) {} + + // Main constructor + ReservedSpace(char* base, + size_t size, + size_t alignment, + size_t page_size, + bool executable, + bool special) + : _base(base), + _size(size), + _alignment(alignment), + _page_size(page_size), + _executable(executable), + _special(special) { + sanity_checks(); + } + + bool is_reserved() const { + return _base != nullptr; + } + + char* base() const { + return _base; + } + + size_t size() const { + return _size; + } + + char* end() const { + return _base + _size; + } + + size_t alignment() const { + return _alignment; + } + + size_t page_size() const { + return _page_size; + } + + bool executable() const { + return _executable; + } + + bool special() const { + return _special; + } + + ReservedSpace partition(size_t offset, size_t partition_size, size_t alignment) const { + assert(offset + partition_size <= size(), "partition failed"); + + char* const partition_base = base() + offset; + assert(is_aligned(partition_base, alignment), "partition base must be aligned"); + + return ReservedSpace(partition_base, + partition_size, + alignment, + _page_size, + _executable, + _special); + } + + ReservedSpace partition(size_t offset, size_t partition_size) const { + return partition(offset, partition_size, _alignment); + } + + ReservedSpace first_part(size_t split_offset, size_t alignment) const { + return partition(0, split_offset, alignment); + } + + ReservedSpace first_part(size_t split_offset) const { + return first_part(split_offset, _alignment); + } + + ReservedSpace last_part (size_t split_offset, size_t alignment) const { + return partition(split_offset, _size - split_offset, alignment); + } + + ReservedSpace last_part (size_t split_offset) const { + return last_part(split_offset, _alignment); + } +}; + +// Class encapsulating behavior specific to memory reserved for the Java heap. +class ReservedHeapSpace : public ReservedSpace { +private: + const size_t _noaccess_prefix; + +public: + // Constructor for non-reserved memory. + ReservedHeapSpace() + : ReservedSpace(), + _noaccess_prefix() {} + + ReservedHeapSpace(const ReservedSpace& reserved, size_t noaccess_prefix) + : ReservedSpace(reserved), + _noaccess_prefix(noaccess_prefix) {} + + size_t noaccess_prefix() const { return _noaccess_prefix; } + + // Returns the base to be used for compression, i.e. so that null can be + // encoded safely and implicit null checks can work. + char* compressed_oop_base() const { return base() - _noaccess_prefix; } +}; + +#endif // SHARE_MEMORY_RESERVEDSPACE_HPP diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp index ad4dd045bcb..d8a3ff820db 100644 --- a/src/hotspot/share/memory/universe.cpp +++ b/src/hotspot/share/memory/universe.cpp @@ -50,6 +50,7 @@ #include "gc/shared/tlab_globals.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" +#include "memory/memoryReserver.hpp" #include "memory/metadataFactory.hpp" #include "memory/metaspaceClosure.hpp" #include "memory/metaspaceCounters.hpp" @@ -956,11 +957,18 @@ ReservedHeapSpace Universe::reserve_heap(size_t heap_size, size_t alignment) { } // Now create the space. - ReservedHeapSpace total_rs(total_reserved, alignment, page_size, AllocateHeapAt); + ReservedHeapSpace rhs = HeapReserver::reserve(total_reserved, alignment, page_size, AllocateHeapAt); + + if (rhs.is_reserved()) { + assert(total_reserved == rhs.size(), "must be exactly of required size"); + assert(is_aligned(rhs.base(),alignment),"must be exactly of required alignment"); + + assert(markWord::encode_pointer_as_mark(rhs.base()).decode_pointer() == rhs.base(), + "area must be distinguishable from marks for mark-sweep"); + assert(markWord::encode_pointer_as_mark(&rhs.base()[rhs.size()]).decode_pointer() == + &rhs.base()[rhs.size()], + "area must be distinguishable from marks for mark-sweep"); - if (total_rs.is_reserved()) { - assert((total_reserved == total_rs.size()) && ((uintptr_t)total_rs.base() % alignment == 0), - "must be exactly of required size and alignment"); // We are good. if (AllocateHeapAt != nullptr) { @@ -968,12 +976,12 @@ ReservedHeapSpace Universe::reserve_heap(size_t heap_size, size_t alignment) { } if (UseCompressedOops) { - CompressedOops::initialize(total_rs); + CompressedOops::initialize(rhs); } - Universe::calculate_verify_data((HeapWord*)total_rs.base(), (HeapWord*)total_rs.end()); + Universe::calculate_verify_data((HeapWord*)rhs.base(), (HeapWord*)rhs.end()); - return total_rs; + return rhs; } vm_exit_during_initialization( @@ -982,7 +990,6 @@ ReservedHeapSpace Universe::reserve_heap(size_t heap_size, size_t alignment) { // satisfy compiler ShouldNotReachHere(); - return ReservedHeapSpace(0, 0, os::vm_page_size()); } OopStorage* Universe::vm_weak() { diff --git a/src/hotspot/share/memory/universe.hpp b/src/hotspot/share/memory/universe.hpp index 0a3b9eaae01..69f8642d6da 100644 --- a/src/hotspot/share/memory/universe.hpp +++ b/src/hotspot/share/memory/universe.hpp @@ -26,6 +26,7 @@ #define SHARE_MEMORY_UNIVERSE_HPP #include "gc/shared/verifyOption.hpp" +#include "memory/reservedSpace.hpp" #include "oops/array.hpp" #include "oops/oopHandle.hpp" #include "runtime/handles.hpp" @@ -42,7 +43,6 @@ class CollectedHeap; class DeferredObjAllocEvent; class OopStorage; -class ReservedHeapSpace; class SerializeClosure; class Universe: AllStatic { @@ -51,7 +51,6 @@ class Universe: AllStatic { friend class oopDesc; friend class ClassLoader; friend class SystemDictionary; - friend class ReservedHeapSpace; friend class VMStructs; friend class VM_PopulateDumpSharedSpace; friend class Metaspace; diff --git a/src/hotspot/share/memory/virtualspace.cpp b/src/hotspot/share/memory/virtualspace.cpp index 0e4e4a4660d..73f74e0b9ef 100644 --- a/src/hotspot/share/memory/virtualspace.cpp +++ b/src/hotspot/share/memory/virtualspace.cpp @@ -23,648 +23,13 @@ */ #include "precompiled.hpp" -#include "logging/log.hpp" -#include "memory/resourceArea.hpp" +#include "gc/shared/gc_globals.hpp" +#include "memory/reservedSpace.hpp" #include "memory/virtualspace.hpp" -#include "nmt/memTracker.hpp" -#include "oops/compressedKlass.hpp" -#include "oops/compressedOops.hpp" -#include "oops/markWord.hpp" -#include "oops/oop.inline.hpp" -#include "runtime/globals_extension.hpp" -#include "runtime/java.hpp" #include "runtime/os.hpp" #include "utilities/align.hpp" -#include "utilities/formatBuffer.hpp" -#include "utilities/powerOfTwo.hpp" - -// ReservedSpace - -// Dummy constructor -ReservedSpace::ReservedSpace() : _base(nullptr), _size(0), _noaccess_prefix(0), - _alignment(0), _special(false), _fd_for_heap(-1), _executable(false) { -} - -ReservedSpace::ReservedSpace(size_t size, MemTag mem_tag) : _fd_for_heap(-1) { - // Want to use large pages where possible. If the size is - // not large page aligned the mapping will be a mix of - // large and normal pages. - size_t page_size = os::page_size_for_region_unaligned(size, 1); - size_t alignment = os::vm_allocation_granularity(); - initialize(size, alignment, page_size, nullptr, false, mem_tag); -} - -ReservedSpace::ReservedSpace(size_t size, size_t preferred_page_size) : _fd_for_heap(-1) { - // When a page size is given we don't want to mix large - // and normal pages. If the size is not a multiple of the - // page size it will be aligned up to achieve this. - size_t alignment = os::vm_allocation_granularity(); - if (preferred_page_size != os::vm_page_size()) { - alignment = MAX2(preferred_page_size, alignment); - size = align_up(size, alignment); - } - initialize(size, alignment, preferred_page_size, nullptr, false); -} - -ReservedSpace::ReservedSpace(size_t size, - size_t alignment, - size_t page_size, - char* requested_address) : _fd_for_heap(-1) { - initialize(size, alignment, page_size, requested_address, false); -} - -ReservedSpace::ReservedSpace(char* base, size_t size, size_t alignment, size_t page_size, - bool special, bool executable) : _fd_for_heap(-1) { - assert((size % os::vm_allocation_granularity()) == 0, - "size not allocation aligned"); - initialize_members(base, size, alignment, page_size, special, executable); -} - -// Helper method -static char* attempt_map_or_reserve_memory_at(char* base, size_t size, int fd, bool executable, MemTag mem_tag) { - if (fd != -1) { - return os::attempt_map_memory_to_file_at(base, size, fd); - } - return os::attempt_reserve_memory_at(base, size, executable, mem_tag); -} - -// Helper method -static char* map_or_reserve_memory(size_t size, int fd, bool executable, MemTag mem_tag) { - if (fd != -1) { - return os::map_memory_to_file(size, fd); - } - return os::reserve_memory(size, executable, mem_tag); -} - -// Helper method -static char* map_or_reserve_memory_aligned(size_t size, size_t alignment, int fd, bool executable) { - if (fd != -1) { - return os::map_memory_to_file_aligned(size, alignment, fd); - } - return os::reserve_memory_aligned(size, alignment, executable); -} - -// Helper method -static void unmap_or_release_memory(char* base, size_t size, bool is_file_mapped) { - if (is_file_mapped) { - if (!os::unmap_memory(base, size)) { - fatal("os::unmap_memory failed"); - } - } else if (!os::release_memory(base, size)) { - fatal("os::release_memory failed"); - } -} - -// Helper method -static bool failed_to_reserve_as_requested(char* base, char* requested_address) { - if (base == requested_address || requested_address == nullptr) { - return false; // did not fail - } - - if (base != nullptr) { - // Different reserve address may be acceptable in other cases - // but for compressed oops heap should be at requested address. - assert(UseCompressedOops, "currently requested address used only for compressed oops"); - log_debug(gc, heap, coops)("Reserved memory not at requested address: " PTR_FORMAT " vs " PTR_FORMAT, p2i(base), p2i(requested_address)); - } - return true; -} - -static bool use_explicit_large_pages(size_t page_size) { - return !os::can_commit_large_page_memory() && - page_size != os::vm_page_size(); -} - -static bool large_pages_requested() { - return UseLargePages && - (!FLAG_IS_DEFAULT(UseLargePages) || !FLAG_IS_DEFAULT(LargePageSizeInBytes)); -} - -static void log_on_large_pages_failure(char* req_addr, size_t bytes) { - if (large_pages_requested()) { - // Compressed oops logging. - log_debug(gc, heap, coops)("Reserve regular memory without large pages"); - // JVM style warning that we did not succeed in using large pages. - char msg[128]; - jio_snprintf(msg, sizeof(msg), "Failed to reserve and commit memory using large pages. " - "req_addr: " PTR_FORMAT " bytes: " SIZE_FORMAT, - req_addr, bytes); - warning("%s", msg); - } -} - -static char* reserve_memory(char* requested_address, const size_t size, - const size_t alignment, int fd, bool exec, MemTag mem_tag) { - char* base; - // If the memory was requested at a particular address, use - // os::attempt_reserve_memory_at() to avoid mapping over something - // important. If the reservation fails, return null. - if (requested_address != nullptr) { - assert(is_aligned(requested_address, alignment), - "Requested address " PTR_FORMAT " must be aligned to " SIZE_FORMAT, - p2i(requested_address), alignment); - base = attempt_map_or_reserve_memory_at(requested_address, size, fd, exec, mem_tag); - } else { - // Optimistically assume that the OS returns an aligned base pointer. - // When reserving a large address range, most OSes seem to align to at - // least 64K. - base = map_or_reserve_memory(size, fd, exec, mem_tag); - // Check alignment constraints. This is only needed when there is - // no requested address. - if (!is_aligned(base, alignment)) { - // Base not aligned, retry. - unmap_or_release_memory(base, size, fd != -1 /*is_file_mapped*/); - // Map using the requested alignment. - base = map_or_reserve_memory_aligned(size, alignment, fd, exec); - } - } - - return base; -} - -static char* reserve_memory_special(char* requested_address, const size_t size, - const size_t alignment, const size_t page_size, bool exec) { - - log_trace(pagesize)("Attempt special mapping: size: " SIZE_FORMAT "%s, " - "alignment: " SIZE_FORMAT "%s", - byte_size_in_exact_unit(size), exact_unit_for_byte_size(size), - byte_size_in_exact_unit(alignment), exact_unit_for_byte_size(alignment)); - - char* base = os::reserve_memory_special(size, alignment, page_size, requested_address, exec); - if (base != nullptr) { - // Check alignment constraints. - assert(is_aligned(base, alignment), - "reserve_memory_special() returned an unaligned address, base: " PTR_FORMAT - " alignment: " SIZE_FORMAT_X, - p2i(base), alignment); - } - return base; -} - -void ReservedSpace::clear_members() { - initialize_members(nullptr, 0, 0, 0, false, false); -} - -void ReservedSpace::initialize_members(char* base, size_t size, size_t alignment, - size_t page_size, bool special, bool executable) { - _base = base; - _size = size; - _alignment = alignment; - _page_size = page_size; - _special = special; - _executable = executable; - _noaccess_prefix = 0; -} - -void ReservedSpace::reserve(size_t size, - size_t alignment, - size_t page_size, - char* requested_address, - bool executable, - MemTag mem_tag) { - assert(is_aligned(size, alignment), "Size must be aligned to the requested alignment"); - - // There are basically three different cases that we need to handle below: - // 1. Mapping backed by a file - // 2. Mapping backed by explicit large pages - // 3. Mapping backed by normal pages or transparent huge pages - // The first two have restrictions that requires the whole mapping to be - // committed up front. To record this the ReservedSpace is marked 'special'. - - // == Case 1 == - if (_fd_for_heap != -1) { - // When there is a backing file directory for this space then whether - // large pages are allocated is up to the filesystem of the backing file. - // So UseLargePages is not taken into account for this reservation. - char* base = reserve_memory(requested_address, size, alignment, _fd_for_heap, executable, mem_tag); - if (base != nullptr) { - initialize_members(base, size, alignment, os::vm_page_size(), true, executable); - } - // Always return, not possible to fall back to reservation not using a file. - return; - } - - // == Case 2 == - if (use_explicit_large_pages(page_size)) { - // System can't commit large pages i.e. use transparent huge pages and - // the caller requested large pages. To satisfy this request we use - // explicit large pages and these have to be committed up front to ensure - // no reservations are lost. - do { - char* base = reserve_memory_special(requested_address, size, alignment, page_size, executable); - if (base != nullptr) { - // Successful reservation using large pages. - initialize_members(base, size, alignment, page_size, true, executable); - return; - } - page_size = os::page_sizes().next_smaller(page_size); - } while (page_size > os::vm_page_size()); - - // Failed to reserve explicit large pages, do proper logging. - log_on_large_pages_failure(requested_address, size); - // Now fall back to normal reservation. - assert(page_size == os::vm_page_size(), "inv"); - } - - // == Case 3 == - char* base = reserve_memory(requested_address, size, alignment, -1, executable, mem_tag); - if (base != nullptr) { - // Successful mapping. - initialize_members(base, size, alignment, page_size, false, executable); - } -} - -void ReservedSpace::initialize(size_t size, - size_t alignment, - size_t page_size, - char* requested_address, - bool executable, - MemTag mem_tag) { - const size_t granularity = os::vm_allocation_granularity(); - assert((size & (granularity - 1)) == 0, - "size not aligned to os::vm_allocation_granularity()"); - assert((alignment & (granularity - 1)) == 0, - "alignment not aligned to os::vm_allocation_granularity()"); - assert(alignment == 0 || is_power_of_2((intptr_t)alignment), - "not a power of 2"); - assert(page_size >= os::vm_page_size(), "Invalid page size"); - assert(is_power_of_2(page_size), "Invalid page size"); - - clear_members(); - - if (size == 0) { - return; - } - - // Adjust alignment to not be 0. - alignment = MAX2(alignment, os::vm_page_size()); - - // Reserve the memory. - reserve(size, alignment, page_size, requested_address, executable, mem_tag); - - // Check that the requested address is used if given. - if (failed_to_reserve_as_requested(_base, requested_address)) { - // OS ignored the requested address, release the reservation. - release(); - return; - } -} - -ReservedSpace ReservedSpace::first_part(size_t partition_size, size_t alignment) { - assert(partition_size <= size(), "partition failed"); - ReservedSpace result(base(), partition_size, alignment, page_size(), special(), executable()); - return result; -} - -ReservedSpace ReservedSpace::last_part(size_t partition_size, size_t alignment) { - assert(partition_size <= size(), "partition failed"); - ReservedSpace result(base() + partition_size, size() - partition_size, - alignment, page_size(), special(), executable()); - return result; -} - -ReservedSpace ReservedSpace::partition(size_t offset, size_t partition_size, size_t alignment) { - assert(offset + partition_size <= size(), "partition failed"); - ReservedSpace result(base() + offset, partition_size, alignment, page_size(), special(), executable()); - return result; -} - -void ReservedSpace::release() { - if (is_reserved()) { - char *real_base = _base - _noaccess_prefix; - const size_t real_size = _size + _noaccess_prefix; - if (special()) { - if (_fd_for_heap != -1) { - os::unmap_memory(real_base, real_size); - } else { - os::release_memory_special(real_base, real_size); - } - } else{ - os::release_memory(real_base, real_size); - } - clear_members(); - } -} - -// Put a ReservedSpace over an existing range -ReservedSpace ReservedSpace::space_for_range(char* base, size_t size, size_t alignment, - size_t page_size, bool special, bool executable) { - assert(is_aligned(base, os::vm_allocation_granularity()), "Unaligned base"); - assert(is_aligned(size, os::vm_page_size()), "Unaligned size"); - assert(os::page_sizes().contains(page_size), "Invalid pagesize"); - ReservedSpace space; - space.initialize_members(base, size, alignment, page_size, special, executable); - return space; -} - -// Compressed oop support is not relevant in 32bit builds. -#ifdef _LP64 - -static size_t noaccess_prefix_size(size_t alignment) { - return lcm(os::vm_page_size(), alignment); -} - -void ReservedHeapSpace::establish_noaccess_prefix() { - assert(_alignment >= os::vm_page_size(), "must be at least page size big"); - _noaccess_prefix = noaccess_prefix_size(_alignment); - - if (base() && base() + _size > (char *)OopEncodingHeapMax) { - if (true - WIN64_ONLY(&& !UseLargePages) - AIX_ONLY(&& (os::Aix::supports_64K_mmap_pages() || os::vm_page_size() == 4*K))) { - // Protect memory at the base of the allocated region. - // If special, the page was committed (only matters on windows) - if (!os::protect_memory(_base, _noaccess_prefix, os::MEM_PROT_NONE, _special)) { - fatal("cannot protect protection page"); - } - log_debug(gc, heap, coops)("Protected page at the reserved heap base: " - PTR_FORMAT " / " INTX_FORMAT " bytes", - p2i(_base), - _noaccess_prefix); - assert(CompressedOops::use_implicit_null_checks() == true, "not initialized?"); - } else { - CompressedOops::set_use_implicit_null_checks(false); - } - } - - _base += _noaccess_prefix; - _size -= _noaccess_prefix; - assert(((uintptr_t)_base % _alignment == 0), "must be exactly of required alignment"); -} - -// Tries to allocate memory of size 'size' at address requested_address with alignment 'alignment'. -// Does not check whether the reserved memory actually is at requested_address, as the memory returned -// might still fulfill the wishes of the caller. -// Assures the memory is aligned to 'alignment'. -// NOTE: If ReservedHeapSpace already points to some reserved memory this is freed, first. -void ReservedHeapSpace::try_reserve_heap(size_t size, - size_t alignment, - size_t page_size, - char* requested_address) { - if (_base != nullptr) { - // We tried before, but we didn't like the address delivered. - release(); - } - - // Try to reserve the memory for the heap. - log_trace(gc, heap, coops)("Trying to allocate at address " PTR_FORMAT - " heap of size " SIZE_FORMAT_X, - p2i(requested_address), - size); - - reserve(size, alignment, page_size, requested_address, false, mtJavaHeap); - - // Check alignment constraints. - if (is_reserved() && !is_aligned(_base, _alignment)) { - // Base not aligned, retry. - release(); - } -} - -void ReservedHeapSpace::try_reserve_range(char *highest_start, - char *lowest_start, - size_t attach_point_alignment, - char *aligned_heap_base_min_address, - char *upper_bound, - size_t size, - size_t alignment, - size_t page_size) { - const size_t attach_range = highest_start - lowest_start; - // Cap num_attempts at possible number. - // At least one is possible even for 0 sized attach range. - const uint64_t num_attempts_possible = (attach_range / attach_point_alignment) + 1; - const uint64_t num_attempts_to_try = MIN2((uint64_t)HeapSearchSteps, num_attempts_possible); - - const size_t stepsize = (attach_range == 0) ? // Only one try. - (size_t) highest_start : align_up(attach_range / num_attempts_to_try, attach_point_alignment); - - // Try attach points from top to bottom. - char* attach_point = highest_start; - while (attach_point >= lowest_start && - attach_point <= highest_start && // Avoid wrap around. - ((_base == nullptr) || - (_base < aligned_heap_base_min_address || _base + size > upper_bound))) { - try_reserve_heap(size, alignment, page_size, attach_point); - attach_point -= stepsize; - } -} - -#define SIZE_64K ((uint64_t) UCONST64( 0x10000)) -#define SIZE_256M ((uint64_t) UCONST64( 0x10000000)) -#define SIZE_32G ((uint64_t) UCONST64( 0x800000000)) - -// Helper for heap allocation. Returns an array with addresses -// (OS-specific) which are suited for disjoint base mode. Array is -// null terminated. -static char** get_attach_addresses_for_disjoint_mode() { - static uint64_t addresses[] = { - 2 * SIZE_32G, - 3 * SIZE_32G, - 4 * SIZE_32G, - 8 * SIZE_32G, - 10 * SIZE_32G, - 1 * SIZE_64K * SIZE_32G, - 2 * SIZE_64K * SIZE_32G, - 3 * SIZE_64K * SIZE_32G, - 4 * SIZE_64K * SIZE_32G, - 16 * SIZE_64K * SIZE_32G, - 32 * SIZE_64K * SIZE_32G, - 34 * SIZE_64K * SIZE_32G, - 0 - }; - - // Sort out addresses smaller than HeapBaseMinAddress. This assumes - // the array is sorted. - uint i = 0; - while (addresses[i] != 0 && - (addresses[i] < OopEncodingHeapMax || addresses[i] < HeapBaseMinAddress)) { - i++; - } - uint start = i; - - // Avoid more steps than requested. - i = 0; - while (addresses[start+i] != 0) { - if (i == HeapSearchSteps) { - addresses[start+i] = 0; - break; - } - i++; - } - - return (char**) &addresses[start]; -} - -void ReservedHeapSpace::initialize_compressed_heap(const size_t size, size_t alignment, size_t page_size) { - guarantee(size + noaccess_prefix_size(alignment) <= OopEncodingHeapMax, - "can not allocate compressed oop heap for this size"); - guarantee(alignment == MAX2(alignment, os::vm_page_size()), "alignment too small"); - - const size_t granularity = os::vm_allocation_granularity(); - assert((size & (granularity - 1)) == 0, - "size not aligned to os::vm_allocation_granularity()"); - assert((alignment & (granularity - 1)) == 0, - "alignment not aligned to os::vm_allocation_granularity()"); - assert(alignment == 0 || is_power_of_2((intptr_t)alignment), - "not a power of 2"); - - // The necessary attach point alignment for generated wish addresses. - // This is needed to increase the chance of attaching for mmap and shmat. - // AIX is the only platform that uses System V shm for reserving virtual memory. - // In this case, the required alignment of the allocated size (64K) and the alignment - // of possible start points of the memory region (256M) differ. - // This is not reflected by os_allocation_granularity(). - // The logic here is dual to the one in pd_reserve_memory in os_aix.cpp - const size_t os_attach_point_alignment = - AIX_ONLY(os::vm_page_size() == 4*K ? 4*K : 256*M) - NOT_AIX(os::vm_allocation_granularity()); - - const size_t attach_point_alignment = lcm(alignment, os_attach_point_alignment); - - char *aligned_heap_base_min_address = (char *)align_up((void *)HeapBaseMinAddress, alignment); - size_t noaccess_prefix = ((aligned_heap_base_min_address + size) > (char*)OopEncodingHeapMax) ? - noaccess_prefix_size(alignment) : 0; - - // Attempt to alloc at user-given address. - if (!FLAG_IS_DEFAULT(HeapBaseMinAddress)) { - try_reserve_heap(size + noaccess_prefix, alignment, page_size, aligned_heap_base_min_address); - if (_base != aligned_heap_base_min_address) { // Enforce this exact address. - release(); - } - } - - // Keep heap at HeapBaseMinAddress. - if (_base == nullptr) { - - // Try to allocate the heap at addresses that allow efficient oop compression. - // Different schemes are tried, in order of decreasing optimization potential. - // - // For this, try_reserve_heap() is called with the desired heap base addresses. - // A call into the os layer to allocate at a given address can return memory - // at a different address than requested. Still, this might be memory at a useful - // address. try_reserve_heap() always returns this allocated memory, as only here - // the criteria for a good heap are checked. - - // Attempt to allocate so that we can run without base and scale (32-Bit unscaled compressed oops). - // Give it several tries from top of range to bottom. - if (aligned_heap_base_min_address + size <= (char *)UnscaledOopHeapMax) { - - // Calc address range within we try to attach (range of possible start addresses). - char* const highest_start = align_down((char *)UnscaledOopHeapMax - size, attach_point_alignment); - char* const lowest_start = align_up(aligned_heap_base_min_address, attach_point_alignment); - try_reserve_range(highest_start, lowest_start, attach_point_alignment, - aligned_heap_base_min_address, (char *)UnscaledOopHeapMax, size, alignment, page_size); - } - - // zerobased: Attempt to allocate in the lower 32G. - char *zerobased_max = (char *)OopEncodingHeapMax; - - // Give it several tries from top of range to bottom. - if (aligned_heap_base_min_address + size <= zerobased_max && // Zerobased theoretical possible. - ((_base == nullptr) || // No previous try succeeded. - (_base + size > zerobased_max))) { // Unscaled delivered an arbitrary address. - - // Calc address range within we try to attach (range of possible start addresses). - char *const highest_start = align_down(zerobased_max - size, attach_point_alignment); - // Need to be careful about size being guaranteed to be less - // than UnscaledOopHeapMax due to type constraints. - char *lowest_start = aligned_heap_base_min_address; - uint64_t unscaled_end = UnscaledOopHeapMax - size; - if (unscaled_end < UnscaledOopHeapMax) { // unscaled_end wrapped if size is large - lowest_start = MAX2(lowest_start, (char*)unscaled_end); - } - lowest_start = align_up(lowest_start, attach_point_alignment); - try_reserve_range(highest_start, lowest_start, attach_point_alignment, - aligned_heap_base_min_address, zerobased_max, size, alignment, page_size); - } - - // Now we go for heaps with base != 0. We need a noaccess prefix to efficiently - // implement null checks. - noaccess_prefix = noaccess_prefix_size(alignment); - - // Try to attach at addresses that are aligned to OopEncodingHeapMax. Disjointbase mode. - char** addresses = get_attach_addresses_for_disjoint_mode(); - int i = 0; - while ((addresses[i] != nullptr) && // End of array not yet reached. - ((_base == nullptr) || // No previous try succeeded. - (_base + size > (char *)OopEncodingHeapMax && // Not zerobased or unscaled address. - !CompressedOops::is_disjoint_heap_base_address((address)_base)))) { // Not disjoint address. - char* const attach_point = addresses[i]; - assert(attach_point >= aligned_heap_base_min_address, "Flag support broken"); - try_reserve_heap(size + noaccess_prefix, alignment, page_size, attach_point); - i++; - } - - // Last, desperate try without any placement. - if (_base == nullptr) { - log_trace(gc, heap, coops)("Trying to allocate at address null heap of size " SIZE_FORMAT_X, size + noaccess_prefix); - initialize(size + noaccess_prefix, alignment, page_size, nullptr, false, mtJavaHeap); - } - } -} - -#endif // _LP64 - -ReservedHeapSpace::ReservedHeapSpace(size_t size, size_t alignment, size_t page_size, const char* heap_allocation_directory) : ReservedSpace() { - - if (size == 0) { - return; - } - - if (heap_allocation_directory != nullptr) { - _fd_for_heap = os::create_file_for_heap(heap_allocation_directory); - if (_fd_for_heap == -1) { - vm_exit_during_initialization( - err_msg("Could not create file for Heap at location %s", heap_allocation_directory)); - } - // When there is a backing file directory for this space then whether - // large pages are allocated is up to the filesystem of the backing file. - // If requested, let the user know that explicit large pages can't be used. - if (use_explicit_large_pages(page_size) && large_pages_requested()) { - log_debug(gc, heap)("Cannot allocate explicit large pages for Java Heap when AllocateHeapAt option is set."); - } - } - - // Heap size should be aligned to alignment, too. - guarantee(is_aligned(size, alignment), "set by caller"); - - if (UseCompressedOops) { -#ifdef _LP64 - initialize_compressed_heap(size, alignment, page_size); - if (_size > size) { - // We allocated heap with noaccess prefix. - // It can happen we get a zerobased/unscaled heap with noaccess prefix, - // if we had to try at arbitrary address. - establish_noaccess_prefix(); - } -#else - ShouldNotReachHere(); -#endif // _LP64 - } else { - initialize(size, alignment, page_size, nullptr, false, mtJavaHeap); - } - - assert(markWord::encode_pointer_as_mark(_base).decode_pointer() == _base, - "area must be distinguishable from marks for mark-sweep"); - assert(markWord::encode_pointer_as_mark(&_base[size]).decode_pointer() == &_base[size], - "area must be distinguishable from marks for mark-sweep"); - - if (_fd_for_heap != -1) { - ::close(_fd_for_heap); - } -} - -MemRegion ReservedHeapSpace::region() const { - return MemRegion((HeapWord*)base(), (HeapWord*)end()); -} - -// Reserve space for code segment. Same as Java heap only we mark this as -// executable. -ReservedCodeSpace::ReservedCodeSpace(size_t r_size, - size_t rs_align, - size_t rs_page_size) : ReservedSpace() { - initialize(r_size, rs_align, rs_page_size, /*requested address*/ nullptr, /*executable*/ true, mtCode); -} +#include "utilities/debug.hpp" +#include "utilities/ostream.hpp" // VirtualSpace diff --git a/src/hotspot/share/memory/virtualspace.hpp b/src/hotspot/share/memory/virtualspace.hpp index c78953912b3..d5abf13b720 100644 --- a/src/hotspot/share/memory/virtualspace.hpp +++ b/src/hotspot/share/memory/virtualspace.hpp @@ -25,143 +25,11 @@ #ifndef SHARE_MEMORY_VIRTUALSPACE_HPP #define SHARE_MEMORY_VIRTUALSPACE_HPP -#include "memory/memRegion.hpp" -#include "nmt/memTag.hpp" #include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" class outputStream; - -// ReservedSpace is a data structure for reserving a contiguous address range. - -class ReservedSpace { - friend class VMStructs; - protected: - char* _base; - size_t _size; - size_t _noaccess_prefix; - size_t _alignment; - size_t _page_size; - bool _special; - int _fd_for_heap; - private: - bool _executable; - - // ReservedSpace - ReservedSpace(char* base, size_t size, size_t alignment, - size_t page_size, bool special, bool executable); - protected: - // Helpers to clear and set members during initialization. Two members - // require special treatment: - // * _fd_for_heap - The fd is set once and should not be cleared - // even if the reservation has to be retried. - // * _noaccess_prefix - Used for compressed heaps and updated after - // the reservation is initialized. Always set to - // 0 during initialization. - void clear_members(); - void initialize_members(char* base, size_t size, size_t alignment, - size_t page_size, bool special, bool executable); - - void initialize(size_t size, size_t alignment, size_t page_size, - char* requested_address, bool executable, MemTag mem_tag = mtNone); - - void reserve(size_t size, size_t alignment, size_t page_size, - char* requested_address, bool executable, MemTag mem_tag); - public: - // Constructor - ReservedSpace(); - // Initialize the reserved space with the given size. Depending on the size - // a suitable page size and alignment will be used. - ReservedSpace(size_t size, MemTag mem_tag); - // Initialize the reserved space with the given size. The preferred_page_size - // is used as the minimum page size/alignment. This may waste some space if - // the given size is not aligned to that value, as the reservation will be - // aligned up to the final alignment in this case. - ReservedSpace(size_t size, size_t preferred_page_size); - ReservedSpace(size_t size, size_t alignment, size_t page_size, - char* requested_address = nullptr); - - // Accessors - char* base() const { return _base; } - size_t size() const { return _size; } - char* end() const { return _base + _size; } - size_t alignment() const { return _alignment; } - size_t page_size() const { return _page_size; } - bool special() const { return _special; } - bool executable() const { return _executable; } - size_t noaccess_prefix() const { return _noaccess_prefix; } - bool is_reserved() const { return _base != nullptr; } - void release(); - - // Splitting - // This splits the space into two spaces, the first part of which will be returned. - ReservedSpace first_part(size_t partition_size, size_t alignment); - ReservedSpace last_part (size_t partition_size, size_t alignment); - ReservedSpace partition (size_t offset, size_t partition_size, size_t alignment); - - // These simply call the above using the default alignment. - inline ReservedSpace first_part(size_t partition_size); - inline ReservedSpace last_part (size_t partition_size); - inline ReservedSpace partition (size_t offset, size_t partition_size); - - bool contains(const void* p) const { - return (base() <= ((char*)p)) && (((char*)p) < (base() + size())); - } - - // Put a ReservedSpace over an existing range - static ReservedSpace space_for_range(char* base, size_t size, size_t alignment, - size_t page_size, bool special, bool executable); -}; - -ReservedSpace ReservedSpace::first_part(size_t partition_size) -{ - return first_part(partition_size, alignment()); -} - -ReservedSpace ReservedSpace::last_part(size_t partition_size) -{ - return last_part(partition_size, alignment()); -} - -ReservedSpace ReservedSpace::partition(size_t offset, size_t partition_size) -{ - return partition(offset, partition_size, alignment()); -} - -// Class encapsulating behavior specific of memory space reserved for Java heap. -class ReservedHeapSpace : public ReservedSpace { - private: - - // Compressed oop support is not relevant in 32bit builds. -#ifdef _LP64 - - void try_reserve_heap(size_t size, size_t alignment, size_t page_size, - char *requested_address); - void try_reserve_range(char *highest_start, char *lowest_start, - size_t attach_point_alignment, char *aligned_HBMA, - char *upper_bound, size_t size, size_t alignment, size_t page_size); - void initialize_compressed_heap(const size_t size, size_t alignment, size_t page_size); - // Create protection page at the beginning of the space. - void establish_noaccess_prefix(); - -#endif // _LP64 - - public: - // Constructor. Tries to find a heap that is good for compressed oops. - // heap_allocation_directory is the path to the backing memory for Java heap. When set, Java heap will be allocated - // on the device which is managed by the file system where the directory resides. - ReservedHeapSpace(size_t size, size_t forced_base_alignment, size_t page_size, const char* heap_allocation_directory = nullptr); - // Returns the base to be used for compression, i.e. so that null can be - // encoded safely and implicit null checks can work. - char *compressed_oop_base() const { return _base - _noaccess_prefix; } - MemRegion region() const; -}; - -// Class encapsulating behavior specific memory space for Code -class ReservedCodeSpace : public ReservedSpace { - public: - // Constructor - ReservedCodeSpace(size_t r_size, size_t rs_align, size_t page_size); -}; +class ReservedSpace; // VirtualSpace is data structure for committing a previously reserved address range in smaller chunks. diff --git a/src/hotspot/share/nmt/memMapPrinter.cpp b/src/hotspot/share/nmt/memMapPrinter.cpp index 34ddb7a8713..8f1a4569e22 100644 --- a/src/hotspot/share/nmt/memMapPrinter.cpp +++ b/src/hotspot/share/nmt/memMapPrinter.cpp @@ -25,7 +25,7 @@ #include "precompiled.hpp" -#if defined(LINUX) || defined(_WIN64) +#if defined(LINUX) || defined(_WIN64) || defined(__APPLE__) #include "gc/shared/collectedHeap.hpp" #include "logging/logAsyncWriter.hpp" @@ -172,7 +172,8 @@ static bool vma_touches_thread_stack(const void* from, const void* to, const Thr // Very rarely however is a VMA backing a thread stack folded together with another adjacent VMA by the // kernel. That can happen, e.g., for non-java threads that don't have guard pages. // Therefore we go for the simplest way here and check for intersection between VMA and thread stack. - return range_intersects(from, to, (const void*)t->stack_end(), (const void*)t->stack_base()); + // Note it is possible to encounter a brand new thread that has not yet initialized its stack fields. + return range_intersects(from, to, (const void*)t->stack_end(), (const void*)t->stack_base_or_null()); } struct GCThreadClosure : public ThreadClosure { diff --git a/src/hotspot/share/nmt/memMapPrinter.hpp b/src/hotspot/share/nmt/memMapPrinter.hpp index 7f3ef9abca8..34897a0c75c 100644 --- a/src/hotspot/share/nmt/memMapPrinter.hpp +++ b/src/hotspot/share/nmt/memMapPrinter.hpp @@ -30,7 +30,7 @@ #include "nmt/memTag.hpp" #include "utilities/globalDefinitions.hpp" -#if defined(LINUX) || defined(_WIN64) +#if defined(LINUX) || defined(_WIN64) || defined(__APPLE__) class outputStream; class CachedNMTInformation; diff --git a/src/hotspot/share/oops/arrayKlass.cpp b/src/hotspot/share/oops/arrayKlass.cpp index fd362ae8a06..54b02cfd948 100644 --- a/src/hotspot/share/oops/arrayKlass.cpp +++ b/src/hotspot/share/oops/arrayKlass.cpp @@ -198,10 +198,6 @@ objArrayOop ArrayKlass::allocate_arrayArray(int n, int length, TRAPS) { return o; } -jint ArrayKlass::compute_modifier_flags() const { - return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC; -} - // JVMTI support jint ArrayKlass::jvmti_class_status() const { diff --git a/src/hotspot/share/oops/arrayKlass.hpp b/src/hotspot/share/oops/arrayKlass.hpp index 1c1d01fc32a..5bfe46573d3 100644 --- a/src/hotspot/share/oops/arrayKlass.hpp +++ b/src/hotspot/share/oops/arrayKlass.hpp @@ -118,10 +118,6 @@ class ArrayKlass: public Klass { // Return a handle. static void complete_create_array_klass(ArrayKlass* k, Klass* super_klass, ModuleEntry* module, TRAPS); - - // jvm support - jint compute_modifier_flags() const; - // JVMTI support jint jvmti_class_status() const; diff --git a/src/hotspot/share/oops/compressedKlass.cpp b/src/hotspot/share/oops/compressedKlass.cpp index 97415cf6e85..21c28af8766 100644 --- a/src/hotspot/share/oops/compressedKlass.cpp +++ b/src/hotspot/share/oops/compressedKlass.cpp @@ -278,7 +278,7 @@ void CompressedKlassPointers::initialize(address addr, size_t len) { if (!set_klass_decode_mode()) { // Give fatal error if this is a specified address - if ((address)CompressedClassSpaceBaseAddress == _base) { + if (CompressedClassSpaceBaseAddress == (size_t)_base) { vm_exit_during_initialization( err_msg("CompressedClassSpaceBaseAddress=" PTR_FORMAT " given with shift %d, cannot be used to encode class pointers", CompressedClassSpaceBaseAddress, _shift)); diff --git a/src/hotspot/share/oops/compressedKlass.hpp b/src/hotspot/share/oops/compressedKlass.hpp index f0615283f33..dd54c8130eb 100644 --- a/src/hotspot/share/oops/compressedKlass.hpp +++ b/src/hotspot/share/oops/compressedKlass.hpp @@ -258,9 +258,15 @@ class CompressedKlassPointers : public AllStatic { is_aligned(addr, klass_alignment_in_bytes()); } - // Check that with the given base, shift and range, aarch64 an encode and decode the klass pointer. - static bool check_klass_decode_mode(address base, int shift, const size_t range) NOT_AARCH64({ return true;}); - static bool set_klass_decode_mode() NOT_AARCH64({ return true;}); // can be called after initialization +#if defined(AARCH64) && !defined(ZERO) + // Check that with the given base, shift and range, aarch64 code can encode and decode the klass pointer. + static bool check_klass_decode_mode(address base, int shift, const size_t range); + // Called after initialization. + static bool set_klass_decode_mode(); +#else + static bool check_klass_decode_mode(address base, int shift, const size_t range) { return true; } + static bool set_klass_decode_mode() { return true; } +#endif }; #endif // SHARE_OOPS_COMPRESSEDKLASS_HPP diff --git a/src/hotspot/share/oops/compressedOops.cpp b/src/hotspot/share/oops/compressedOops.cpp index ec41dd85219..5532b406b6d 100644 --- a/src/hotspot/share/oops/compressedOops.cpp +++ b/src/hotspot/share/oops/compressedOops.cpp @@ -26,9 +26,9 @@ #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/memRegion.hpp" +#include "memory/reservedSpace.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" -#include "memory/virtualspace.hpp" #include "oops/compressedOops.hpp" #include "gc/shared/collectedHeap.hpp" #include "runtime/arguments.hpp" @@ -66,7 +66,7 @@ void CompressedOops::initialize(const ReservedHeapSpace& heap_space) { set_base((address)heap_space.compressed_oop_base()); } - _heap_address_range = heap_space.region(); + _heap_address_range = MemRegion((HeapWord*)heap_space.base(), (HeapWord*)heap_space.end()); LogTarget(Debug, gc, heap, coops) lt; if (lt.is_enabled()) { diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index 9cf48da91b6..ce46da55f98 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -97,8 +97,9 @@ #include "utilities/dtrace.hpp" #include "utilities/events.hpp" #include "utilities/macros.hpp" -#include "utilities/stringUtils.hpp" +#include "utilities/nativeStackPrinter.hpp" #include "utilities/pair.hpp" +#include "utilities/stringUtils.hpp" #ifdef COMPILER1 #include "c1/c1_Compiler.hpp" #endif @@ -211,8 +212,10 @@ bool InstanceKlass::has_nest_member(JavaThread* current, InstanceKlass* k) const return false; } -// Called to verify that k is a permitted subclass of this class -bool InstanceKlass::has_as_permitted_subclass(const InstanceKlass* k) const { +// Called to verify that k is a permitted subclass of this class. +// The incoming stringStream is used to format the messages for error logging and for the caller +// to use for exception throwing. +bool InstanceKlass::has_as_permitted_subclass(const InstanceKlass* k, stringStream& ss) const { Thread* current = Thread::current(); assert(k != nullptr, "sanity check"); assert(_permitted_subclasses != nullptr && _permitted_subclasses != Universe::the_empty_short_array(), @@ -220,22 +223,34 @@ bool InstanceKlass::has_as_permitted_subclass(const InstanceKlass* k) const { if (log_is_enabled(Trace, class, sealed)) { ResourceMark rm(current); - log_trace(class, sealed)("Checking for permitted subclass of %s in %s", + log_trace(class, sealed)("Checking for permitted subclass %s in %s", k->external_name(), this->external_name()); } // Check that the class and its super are in the same module. if (k->module() != this->module()) { - ResourceMark rm(current); - log_trace(class, sealed)("Check failed for same module of permitted subclass %s and sealed class %s", - k->external_name(), this->external_name()); + ss.print("Failed same module check: subclass %s is in module '%s' with loader %s, " + "and sealed class %s is in module '%s' with loader %s", + k->external_name(), + k->module()->name_as_C_string(), + k->module()->loader_data()->loader_name_and_id(), + this->external_name(), + this->module()->name_as_C_string(), + this->module()->loader_data()->loader_name_and_id()); + log_trace(class, sealed)(" - %s", ss.as_string()); return false; } if (!k->is_public() && !is_same_class_package(k)) { - ResourceMark rm(current); - log_trace(class, sealed)("Check failed, subclass %s not public and not in the same package as sealed class %s", - k->external_name(), this->external_name()); + ss.print("Failed same package check: non-public subclass %s is in package '%s' with classloader %s, " + "and sealed class %s is in package '%s' with classloader %s", + k->external_name(), + k->package() != nullptr ? k->package()->name()->as_C_string() : "unnamed", + k->module()->loader_data()->loader_name_and_id(), + this->external_name(), + this->package() != nullptr ? this->package()->name()->as_C_string() : "unnamed", + this->module()->loader_data()->loader_name_and_id()); + log_trace(class, sealed)(" - %s", ss.as_string()); return false; } @@ -247,7 +262,10 @@ bool InstanceKlass::has_as_permitted_subclass(const InstanceKlass* k) const { return true; } } - log_trace(class, sealed)("- class is NOT a permitted subclass!"); + + ss.print("Failed listed permitted subclass check: class %s is not a permitted subclass of %s", + k->external_name(), this->external_name()); + log_trace(class, sealed)(" - %s", ss.as_string()); return false; } @@ -4009,14 +4027,9 @@ void InstanceKlass::print_class_load_cause_logging() const { stringStream stack_stream; char buf[O_BUFLEN]; address lastpc = nullptr; - if (os::platform_print_native_stack(&stack_stream, nullptr, buf, O_BUFLEN, lastpc)) { - // We have printed the native stack in platform-specific code, - // so nothing else to do in this case. - } else { - frame f = os::current_frame(); - VMError::print_native_stack(&stack_stream, f, current, true /*print_source_info */, - -1 /* max stack_stream */, buf, O_BUFLEN); - } + NativeStackPrinter nsp(current); + nsp.print_stack(&stack_stream, buf, sizeof(buf), lastpc, + true /* print_source_info */, -1 /* max stack */); LogMessage(class, load, cause, native) msg; NonInterleavingLogStream info_stream{LogLevelType::Info, msg}; diff --git a/src/hotspot/share/oops/instanceKlass.hpp b/src/hotspot/share/oops/instanceKlass.hpp index 13b50859ee3..8209a692a82 100644 --- a/src/hotspot/share/oops/instanceKlass.hpp +++ b/src/hotspot/share/oops/instanceKlass.hpp @@ -456,8 +456,10 @@ class InstanceKlass: public Klass { // Check if this klass is a nestmate of k - resolves this nest-host and k's bool has_nestmate_access_to(InstanceKlass* k, TRAPS); - // Called to verify that k is a permitted subclass of this class - bool has_as_permitted_subclass(const InstanceKlass* k) const; + // Called to verify that k is a permitted subclass of this class. + // The incoming stringStream is used for logging, and for the caller to create + // a detailed exception message on failure. + bool has_as_permitted_subclass(const InstanceKlass* k, stringStream& ss) const; enum InnerClassAttributeOffset { // From http://mirror.eng/products/jdk/1.1/docs/guide/innerclasses/spec/innerclasses.doc10.html#18814 diff --git a/src/hotspot/share/oops/objArrayKlass.cpp b/src/hotspot/share/oops/objArrayKlass.cpp index 0697901d174..04bc374e522 100644 --- a/src/hotspot/share/oops/objArrayKlass.cpp +++ b/src/hotspot/share/oops/objArrayKlass.cpp @@ -140,6 +140,9 @@ ObjArrayKlass::ObjArrayKlass(int n, Klass* element_klass, Symbol* name) : ArrayK set_layout_helper(array_layout_helper(T_OBJECT)); assert(is_array_klass(), "sanity"); assert(is_objArray_klass(), "sanity"); + + // Compute modifier flags after bottom_klass and element_klass are initialized. + set_modifier_flags(compute_modifier_flags()); } size_t ObjArrayKlass::oop_size(oop obj) const { @@ -340,10 +343,8 @@ void ObjArrayKlass::metaspace_pointers_do(MetaspaceClosure* it) { jint ObjArrayKlass::compute_modifier_flags() const { // The modifier for an objectArray is the same as its element - if (element_klass() == nullptr) { - assert(Universe::is_bootstrapping(), "partial objArray only at startup"); - return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC; - } + assert (element_klass() != nullptr, "should be initialized"); + // Return the flags of the bottom element type. jint element_flags = bottom_klass()->compute_modifier_flags(); diff --git a/src/hotspot/share/oops/typeArrayKlass.cpp b/src/hotspot/share/oops/typeArrayKlass.cpp index ddf60d4382e..8ca6a49fc46 100644 --- a/src/hotspot/share/oops/typeArrayKlass.cpp +++ b/src/hotspot/share/oops/typeArrayKlass.cpp @@ -75,6 +75,10 @@ TypeArrayKlass* TypeArrayKlass::allocate(ClassLoaderData* loader_data, BasicType return new (loader_data, size, THREAD) TypeArrayKlass(type, name); } +jint TypeArrayKlass::compute_modifier_flags() const { + return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC; +} + TypeArrayKlass::TypeArrayKlass(BasicType type, Symbol* name) : ArrayKlass(name, Kind) { set_layout_helper(array_layout_helper(type)); assert(is_array_klass(), "sanity"); @@ -84,6 +88,9 @@ TypeArrayKlass::TypeArrayKlass(BasicType type, Symbol* name) : ArrayKlass(name, assert(size() >= TypeArrayKlass::header_size(), "bad size"); set_class_loader_data(ClassLoaderData::the_null_class_loader_data()); + + // Compute modifier flags. + set_modifier_flags(compute_modifier_flags()); } typeArrayOop TypeArrayKlass::allocate_common(int length, bool do_zero, TRAPS) { diff --git a/src/hotspot/share/oops/typeArrayKlass.hpp b/src/hotspot/share/oops/typeArrayKlass.hpp index ae23c5324af..9dc3ed607fe 100644 --- a/src/hotspot/share/oops/typeArrayKlass.hpp +++ b/src/hotspot/share/oops/typeArrayKlass.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * 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,6 +73,8 @@ class TypeArrayKlass : public ArrayKlass { // Copying void copy_array(arrayOop s, int src_pos, arrayOop d, int dst_pos, int length, TRAPS); + jint compute_modifier_flags() const; + // Oop iterators. Since there are no oops in TypeArrayKlasses, // these functions only return the size of the object. diff --git a/src/hotspot/share/opto/c2compiler.hpp b/src/hotspot/share/opto/c2compiler.hpp index 01c7de3a971..868372568af 100644 --- a/src/hotspot/share/opto/c2compiler.hpp +++ b/src/hotspot/share/opto/c2compiler.hpp @@ -26,7 +26,12 @@ #define SHARE_OPTO_C2COMPILER_HPP #include "compiler/abstractCompiler.hpp" -#include "opto/output.hpp" + +// Define the initial sizes for allocation of the resizable code buffer +enum { + initial_const_capacity = 4 * 1024 +}; + class C2Compiler : public AbstractCompiler { private: diff --git a/src/hotspot/share/opto/compile.hpp b/src/hotspot/share/opto/compile.hpp index 7c251bd4bd9..223e7033761 100644 --- a/src/hotspot/share/opto/compile.hpp +++ b/src/hotspot/share/opto/compile.hpp @@ -946,11 +946,9 @@ class Compile : public Phase { Node_Notes* default_node_notes() const { return _default_node_notes; } void set_default_node_notes(Node_Notes* n) { _default_node_notes = n; } - Node_Notes* node_notes_at(int idx) { - return locate_node_notes(_node_note_array, idx, false); - } - inline bool set_node_notes_at(int idx, Node_Notes* value); + Node_Notes* node_notes_at(int idx); + inline bool set_node_notes_at(int idx, Node_Notes* value); // Copy notes from source to dest, if they exist. // Overwrite dest only if source provides something. // Return true if information was moved. diff --git a/src/hotspot/share/opto/library_call.cpp b/src/hotspot/share/opto/library_call.cpp index 096f0a20bd1..40b19eecd9f 100644 --- a/src/hotspot/share/opto/library_call.cpp +++ b/src/hotspot/share/opto/library_call.cpp @@ -50,6 +50,7 @@ #include "opto/runtime.hpp" #include "opto/rootnode.hpp" #include "opto/subnode.hpp" +#include "opto/vectornode.hpp" #include "prims/jvmtiExport.hpp" #include "prims/jvmtiThreadState.hpp" #include "prims/unsafe.hpp" diff --git a/src/hotspot/share/opto/loopTransform.cpp b/src/hotspot/share/opto/loopTransform.cpp index a33d89993ad..d8d7be5c89c 100644 --- a/src/hotspot/share/opto/loopTransform.cpp +++ b/src/hotspot/share/opto/loopTransform.cpp @@ -1748,20 +1748,11 @@ void PhaseIdealLoop::create_assertion_predicates_at_loop(CountedLoopNode* source CountedLoopNode* target_loop_head, const NodeInLoopBody& _node_in_loop_body, const bool clone_template) { - Node* init = target_loop_head->init_trip(); - Node* stride = target_loop_head->stride(); - LoopNode* target_outer_loop_head = target_loop_head->skip_strip_mined(); - Node* target_loop_entry = target_outer_loop_head->in(LoopNode::EntryControl); - CreateAssertionPredicatesVisitor create_assertion_predicates_visitor(init, stride, target_loop_entry, this, - _node_in_loop_body, clone_template); + CreateAssertionPredicatesVisitor create_assertion_predicates_visitor(target_loop_head, this, _node_in_loop_body, + clone_template); Node* source_loop_entry = source_loop_head->skip_strip_mined()->in(LoopNode::EntryControl); PredicateIterator predicate_iterator(source_loop_entry); predicate_iterator.for_each(create_assertion_predicates_visitor); - if (create_assertion_predicates_visitor.has_created_predicates()) { - IfTrueNode* last_created_predicate_success_proj = create_assertion_predicates_visitor.last_created_success_proj(); - _igvn.replace_input_of(target_outer_loop_head, LoopNode::EntryControl, last_created_predicate_success_proj); - set_idom(target_outer_loop_head, last_created_predicate_success_proj, dom_depth(target_outer_loop_head)); - } } //------------------------------do_unroll-------------------------------------- // Unroll the loop body one step - make each trip do 2 iterations. diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp index da059f8c820..acafea3fce8 100644 --- a/src/hotspot/share/opto/loopnode.hpp +++ b/src/hotspot/share/opto/loopnode.hpp @@ -1367,6 +1367,12 @@ class PhaseIdealLoop : public PhaseTransform { public: void register_control(Node* n, IdealLoopTree *loop, Node* pred, bool update_body = true); + // Replace the control input of 'node' with 'new_control' and set the dom depth to the one of 'new_control'. + void replace_control(Node* node, Node* new_control) { + _igvn.replace_input_of(node, 0, new_control); + set_idom(node, new_control, dom_depth(new_control)); + } + void replace_loop_entry(LoopNode* loop_head, Node* new_entry) { _igvn.replace_input_of(loop_head, LoopNode::EntryControl, new_entry); set_idom(loop_head, new_entry, dom_depth(new_entry)); diff --git a/src/hotspot/share/opto/mathexactnode.hpp b/src/hotspot/share/opto/mathexactnode.hpp index cc15b2ad983..a324110c6f1 100644 --- a/src/hotspot/share/opto/mathexactnode.hpp +++ b/src/hotspot/share/opto/mathexactnode.hpp @@ -25,11 +25,8 @@ #ifndef SHARE_OPTO_MATHEXACTNODE_HPP #define SHARE_OPTO_MATHEXACTNODE_HPP -#include "opto/multnode.hpp" -#include "opto/node.hpp" #include "opto/addnode.hpp" #include "opto/subnode.hpp" -#include "opto/type.hpp" class PhaseGVN; diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp index bb95601f9e7..8ff778ed493 100644 --- a/src/hotspot/share/opto/node.hpp +++ b/src/hotspot/share/opto/node.hpp @@ -1999,6 +1999,10 @@ Compile::locate_node_notes(GrowableArray* arr, return arr->at(block_idx) + (idx & (_node_notes_block_size-1)); } +inline Node_Notes* Compile::node_notes_at(int idx) { + return locate_node_notes(_node_note_array, idx, false); +} + inline bool Compile::set_node_notes_at(int idx, Node_Notes* value) { if (value == nullptr || value->is_clear()) diff --git a/src/hotspot/share/opto/output.cpp b/src/hotspot/share/opto/output.cpp index 260aa7e635d..eb91ff7ea64 100644 --- a/src/hotspot/share/opto/output.cpp +++ b/src/hotspot/share/opto/output.cpp @@ -24,7 +24,6 @@ #include "precompiled.hpp" #include "asm/assembler.inline.hpp" -#include "asm/macroAssembler.inline.hpp" #include "code/compiledIC.hpp" #include "code/debugInfo.hpp" #include "code/debugInfoRec.hpp" @@ -34,7 +33,6 @@ #include "compiler/oopMap.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/c2/barrierSetC2.hpp" -#include "memory/allocation.inline.hpp" #include "memory/allocation.hpp" #include "opto/ad.hpp" #include "opto/block.hpp" @@ -48,10 +46,7 @@ #include "opto/optoreg.hpp" #include "opto/output.hpp" #include "opto/regalloc.hpp" -#include "opto/runtime.hpp" -#include "opto/subnode.hpp" #include "opto/type.hpp" -#include "runtime/handles.inline.hpp" #include "runtime/sharedRuntime.hpp" #include "utilities/macros.hpp" #include "utilities/powerOfTwo.hpp" diff --git a/src/hotspot/share/opto/output.hpp b/src/hotspot/share/opto/output.hpp index 503f5414dc4..432ad3638b2 100644 --- a/src/hotspot/share/opto/output.hpp +++ b/src/hotspot/share/opto/output.hpp @@ -54,11 +54,6 @@ class PhaseCFG; #define DEBUG_ARG(x) #endif -// Define the initial sizes for allocation of the resizable code buffer -enum { - initial_const_capacity = 4 * 1024 -}; - class BufferSizingData { public: int _stub; diff --git a/src/hotspot/share/opto/predicates.cpp b/src/hotspot/share/opto/predicates.cpp index 1a023d04b68..a9cd1e638c1 100644 --- a/src/hotspot/share/opto/predicates.cpp +++ b/src/hotspot/share/opto/predicates.cpp @@ -878,6 +878,19 @@ void Predicates::dump_for_loop(LoopNode* loop_node) { } #endif // NOT PRODUCT +CreateAssertionPredicatesVisitor::CreateAssertionPredicatesVisitor(CountedLoopNode* target_loop_head, + PhaseIdealLoop* phase, + const NodeInLoopBody& node_in_loop_body, + const bool clone_template) + : _init(target_loop_head->init_trip()), + _stride(target_loop_head->stride()), + _old_target_loop_entry(target_loop_head->skip_strip_mined()->in(LoopNode::EntryControl)), + _current_predicate_chain_head(target_loop_head->skip_strip_mined()), // Initially no predicates, yet. + _phase(phase), + _has_hoisted_check_parse_predicates(false), + _node_in_loop_body(node_in_loop_body), + _clone_template(clone_template) {} + // Keep track of whether we are in the correct Predicate Block where Template Assertion Predicates can be found. // The PredicateIterator will always start at the loop entry and first visits the Loop Limit Check Predicate Block. void CreateAssertionPredicatesVisitor::visit(const ParsePredicate& parse_predicate) { @@ -894,22 +907,27 @@ void CreateAssertionPredicatesVisitor::visit(const TemplateAssertionPredicate& t return; } if (_clone_template) { - _new_control = clone_template_and_replace_init_input(template_assertion_predicate); + IfTrueNode* cloned_template_success_proj = clone_template_and_replace_init_input(template_assertion_predicate); + initialize_from_template(template_assertion_predicate, cloned_template_success_proj); + _current_predicate_chain_head = cloned_template_success_proj->in(0); + } else { + IfTrueNode* initialized_success_proj = initialize_from_template(template_assertion_predicate, _old_target_loop_entry); + _current_predicate_chain_head = initialized_success_proj->in(0); } - _new_control = initialize_from_template(template_assertion_predicate); } // Create an Initialized Assertion Predicate from the provided Template Assertion Predicate. IfTrueNode* CreateAssertionPredicatesVisitor::initialize_from_template( - const TemplateAssertionPredicate& template_assertion_predicate) const { + const TemplateAssertionPredicate& template_assertion_predicate, Node* new_control) const { DEBUG_ONLY(template_assertion_predicate.verify();) IfNode* template_head = template_assertion_predicate.head(); InitializedAssertionPredicateCreator initialized_assertion_predicate_creator(_phase); IfTrueNode* initialized_predicate = initialized_assertion_predicate_creator.create_from_template(template_head, - _new_control, + new_control, _init, _stride); DEBUG_ONLY(InitializedAssertionPredicate::verify(initialized_predicate);) template_assertion_predicate.rewire_loop_data_dependencies(initialized_predicate, _node_in_loop_body, _phase); + rewire_to_old_predicate_chain_head(initialized_predicate); return initialized_predicate; } @@ -917,8 +935,46 @@ IfTrueNode* CreateAssertionPredicatesVisitor::initialize_from_template( IfTrueNode* CreateAssertionPredicatesVisitor::clone_template_and_replace_init_input( const TemplateAssertionPredicate& template_assertion_predicate) { OpaqueLoopInitNode* opaque_init = new OpaqueLoopInitNode(_phase->C, _init); - _phase->register_new_node(opaque_init, _new_control); - return template_assertion_predicate.clone_and_replace_init(_new_control, opaque_init, _phase); + _phase->register_new_node(opaque_init, _old_target_loop_entry); + return template_assertion_predicate.clone_and_replace_init(_old_target_loop_entry, opaque_init, _phase); +} + +// Rewire the newly created predicates to the old predicate chain head (i.e. '_current_predicate_chain_head') by +// rewiring the current control input of '_current_predicate_chain_head' from '_old_target_loop_entry' to +// 'initialized_assertion_predicate_success_proj'. This is required because we walk the predicate chain from the loop +// up and clone Template Assertion Predicates on the fly: +// +// x +// | old target +// Template Assertion loop entry +// Predicate 1 old target clone | \ +// | loop entry TAP 2 | cloned Template Assertion +// Template Assertion | ======> | Predicate 2 +// Predicate 2 target loop | +// | target loop #_current_predicate_chain_head +// source loop +// +// +// old target old target +// loop entry loop entry +// | \ rewire | +// | cloned Template Assertion to old cloned Template Assertion #current_predicate +// initialize | Predicate 2 predicate Predicate 2 _chain_head (new) +// TAP 2 | | chain head | +// ======> | Initialized Assertion ======> Initialized Assertion +// | Predicate 2 Predicate 2 +// | | +// target loop #_current_predicate_chain_head target loop +// +void CreateAssertionPredicatesVisitor::rewire_to_old_predicate_chain_head( + Node* initialized_assertion_predicate_success_proj) const { + if (_current_predicate_chain_head->is_Loop()) { + assert(_current_predicate_chain_head->in(LoopNode::EntryControl) == _old_target_loop_entry, "must be old loop entry"); + _phase->replace_loop_entry(_current_predicate_chain_head->as_Loop(), initialized_assertion_predicate_success_proj); + } else { + assert(_current_predicate_chain_head->in(0) == _old_target_loop_entry, "must be old loop entry"); + _phase->replace_control(_current_predicate_chain_head, initialized_assertion_predicate_success_proj); + } } // Clone the Template Assertion Predicate and set a new input for the OpaqueLoopStrideNode. @@ -951,9 +1007,8 @@ IfTrueNode* UpdateStrideForAssertionPredicates::initialize_from_updated_template void UpdateStrideForAssertionPredicates::connect_initialized_assertion_predicate( Node* new_control_out, IfTrueNode* initialized_success_proj) const { if (new_control_out->is_Loop()) { - _phase->igvn().replace_input_of(new_control_out, LoopNode::EntryControl, initialized_success_proj); + _phase->replace_loop_entry(new_control_out->as_Loop(), initialized_success_proj); } else { - _phase->igvn().replace_input_of(new_control_out, 0, initialized_success_proj); + _phase->replace_control(new_control_out, initialized_success_proj); } - _phase->set_idom(new_control_out, initialized_success_proj, _phase->dom_depth(new_control_out)); } diff --git a/src/hotspot/share/opto/predicates.hpp b/src/hotspot/share/opto/predicates.hpp index ef27c093290..bc8c1a8ebdc 100644 --- a/src/hotspot/share/opto/predicates.hpp +++ b/src/hotspot/share/opto/predicates.hpp @@ -984,46 +984,26 @@ class CreateAssertionPredicatesVisitor : public PredicateVisitor { Node* const _init; Node* const _stride; Node* const _old_target_loop_entry; - Node* _new_control; + Node* _current_predicate_chain_head; PhaseIdealLoop* const _phase; bool _has_hoisted_check_parse_predicates; const NodeInLoopBody& _node_in_loop_body; const bool _clone_template; IfTrueNode* clone_template_and_replace_init_input(const TemplateAssertionPredicate& template_assertion_predicate); - IfTrueNode* initialize_from_template(const TemplateAssertionPredicate& template_assertion_predicate) const; + IfTrueNode* initialize_from_template(const TemplateAssertionPredicate& template_assertion_predicate, + Node* new_control) const; + void rewire_to_old_predicate_chain_head(Node* initialized_assertion_predicate_success_proj) const; public: - CreateAssertionPredicatesVisitor(Node* init, Node* stride, Node* new_control, PhaseIdealLoop* phase, - const NodeInLoopBody& node_in_loop_body, const bool clone_template) - : _init(init), - _stride(stride), - _old_target_loop_entry(new_control), - _new_control(new_control), - _phase(phase), - _has_hoisted_check_parse_predicates(false), - _node_in_loop_body(node_in_loop_body), - _clone_template(clone_template) {} + CreateAssertionPredicatesVisitor(CountedLoopNode* target_loop_head, PhaseIdealLoop* phase, + const NodeInLoopBody& node_in_loop_body, bool clone_template); NONCOPYABLE(CreateAssertionPredicatesVisitor); using PredicateVisitor::visit; void visit(const ParsePredicate& parse_predicate) override; void visit(const TemplateAssertionPredicate& template_assertion_predicate) override; - - // Did we create any new Initialized Assertion Predicates? - bool has_created_predicates() const { - return _new_control != _old_target_loop_entry; - } - - // Return the last created node by this visitor or the originally provided 'new_control' to the visitor if there was - // no new node created (i.e. no Template Assertion Predicates found). - IfTrueNode* last_created_success_proj() const { - assert(has_created_predicates(), "should only be queried if new nodes have been created"); - assert(_new_control->unique_ctrl_out_or_null() == nullptr, "no control outputs, yet"); - assert(_new_control->is_IfTrue(), "Assertion Predicates only have IfTrue on success proj"); - return _new_control->as_IfTrue(); - } }; // This visitor collects all Template Assertion Predicates If nodes or the corresponding Opaque nodes, depending on the diff --git a/src/hotspot/share/opto/runtime.hpp b/src/hotspot/share/opto/runtime.hpp index da08fc0f386..dc608cf746a 100644 --- a/src/hotspot/share/opto/runtime.hpp +++ b/src/hotspot/share/opto/runtime.hpp @@ -28,8 +28,6 @@ #include "code/codeBlob.hpp" #include "opto/machnode.hpp" #include "opto/optoreg.hpp" -#include "opto/type.hpp" -#include "runtime/deoptimization.hpp" #include "runtime/stubDeclarations.hpp" #include "runtime/vframe.hpp" diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp index ce37e5604fa..51b320c8047 100644 --- a/src/hotspot/share/opto/vectorIntrinsics.cpp +++ b/src/hotspot/share/opto/vectorIntrinsics.cpp @@ -1386,8 +1386,9 @@ bool LibraryCallKit::inline_vector_reduction() { int opc = VectorSupport::vop2ideal(opr->get_con(), elem_bt); int sopc = ReductionNode::opcode(opc, elem_bt); + // Ensure reduction operation for lanewise operation // When using mask, mask use type needs to be VecMaskUseLoad. - if (!arch_supports_vector(sopc, num_elem, elem_bt, is_masked_op ? VecMaskUseLoad : VecMaskNotUsed)) { + if (sopc == opc || !arch_supports_vector(sopc, num_elem, elem_bt, is_masked_op ? VecMaskUseLoad : VecMaskNotUsed)) { log_if_needed(" ** not supported: arity=1 op=%d/reduce vlen=%d etype=%s is_masked_op=%d", sopc, num_elem, type2name(elem_bt), is_masked_op ? 1 : 0); return false; diff --git a/src/hotspot/share/prims/forte.cpp b/src/hotspot/share/prims/forte.cpp index 2edaae66158..a7f48faba13 100644 --- a/src/hotspot/share/prims/forte.cpp +++ b/src/hotspot/share/prims/forte.cpp @@ -92,10 +92,10 @@ static bool is_decipherable_interpreted_frame(JavaThread* thread, vframeStreamForte::vframeStreamForte(JavaThread *jt, frame fr, bool stop_at_java_call_stub) - : vframeStreamCommon(RegisterMap(jt, - RegisterMap::UpdateMap::skip, - RegisterMap::ProcessFrames::skip, - RegisterMap::WalkContinuation::skip)) { + : vframeStreamCommon(jt, + RegisterMap::UpdateMap::skip, + RegisterMap::ProcessFrames::skip, + RegisterMap::WalkContinuation::skip) { _reg_map.set_async(true); _stop_at_java_call_stub = stop_at_java_call_stub; _frame = fr; diff --git a/src/hotspot/share/prims/jvm.cpp b/src/hotspot/share/prims/jvm.cpp index ebe0c0ca5d9..12c7898f4cf 100644 --- a/src/hotspot/share/prims/jvm.cpp +++ b/src/hotspot/share/prims/jvm.cpp @@ -3319,8 +3319,9 @@ JVM_END // VM Raw monitors (not to be confused with JvmtiRawMonitors) are a simple mutual exclusion // lock (not actually monitors: no wait/notify) that is exported by the VM for use by JDK // library code. They may be used by JavaThreads and non-JavaThreads and do not participate -// in the safepoint protocol, thread suspension, thread interruption, or anything of that -// nature. JavaThreads will be "in native" when using this API from JDK code. +// in the safepoint protocol, thread suspension, thread interruption, or most things of that +// nature, except JavaThreads will be blocked by VM_Exit::block_if_vm_exited if the VM has +// shutdown. JavaThreads will be "in native" when using this API from JDK code. JNIEXPORT void* JNICALL JVM_RawMonitorCreate(void) { diff --git a/src/hotspot/share/prims/jvmtiAgentList.hpp b/src/hotspot/share/prims/jvmtiAgentList.hpp index d53f5e63d9b..9aaa12cdd5c 100644 --- a/src/hotspot/share/prims/jvmtiAgentList.hpp +++ b/src/hotspot/share/prims/jvmtiAgentList.hpp @@ -61,7 +61,6 @@ class JvmtiAgentList : AllStatic { private: static JvmtiAgent* _list; - static Iterator all(); static void initialize(); static void convert_xrun_agents(); @@ -82,6 +81,7 @@ class JvmtiAgentList : AllStatic { static JvmtiAgent* lookup(JvmtiEnv* env, void* f_ptr); + static Iterator all(); static Iterator agents() NOT_JVMTI({ Iterator it; return it; }); static Iterator java_agents(); static Iterator native_agents(); diff --git a/src/hotspot/share/prims/jvmtiEnv.cpp b/src/hotspot/share/prims/jvmtiEnv.cpp index ff3dad67960..554b4baf7b2 100644 --- a/src/hotspot/share/prims/jvmtiEnv.cpp +++ b/src/hotspot/share/prims/jvmtiEnv.cpp @@ -2696,7 +2696,7 @@ JvmtiEnv::GetClassModifiers(oop k_mirror, jint* modifiers_ptr) { if (!java_lang_Class::is_primitive(k_mirror)) { Klass* k = java_lang_Class::as_Klass(k_mirror); NULL_CHECK(k, JVMTI_ERROR_INVALID_CLASS); - result = k->compute_modifier_flags(); + result = k->modifier_flags(); // Reset the deleted ACC_SUPER bit (deleted in compute_modifier_flags()). if (k->is_super()) { diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index d08afc3f332..a4b1d0ece6d 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -51,6 +51,7 @@ #include "jvmtifiles/jvmtiEnv.hpp" #include "logging/log.hpp" #include "memory/iterator.hpp" +#include "memory/memoryReserver.hpp" #include "memory/metadataFactory.hpp" #include "memory/metaspace/testHelpers.hpp" #include "memory/metaspaceUtils.hpp" @@ -299,7 +300,7 @@ WB_END WB_ENTRY(void, WB_ReadFromNoaccessArea(JNIEnv* env, jobject o)) size_t granularity = os::vm_allocation_granularity(); - ReservedHeapSpace rhs(100 * granularity, granularity, os::vm_page_size()); + ReservedHeapSpace rhs = HeapReserver::reserve(100 * granularity, granularity, os::vm_page_size(), nullptr); VirtualSpace vs; vs.initialize(rhs, 50 * granularity); @@ -326,7 +327,7 @@ WB_END static jint wb_stress_virtual_space_resize(size_t reserved_space_size, size_t magnitude, size_t iterations) { size_t granularity = os::vm_allocation_granularity(); - ReservedHeapSpace rhs(reserved_space_size * granularity, granularity, os::vm_page_size()); + ReservedHeapSpace rhs = HeapReserver::reserve(reserved_space_size * granularity, granularity, os::vm_page_size(), nullptr); VirtualSpace vs; if (!vs.initialize(rhs, 0)) { tty->print_cr("Failed to initialize VirtualSpace. Can't proceed."); diff --git a/src/hotspot/share/runtime/frame.cpp b/src/hotspot/share/runtime/frame.cpp index 738b89e77bd..0029a555d26 100644 --- a/src/hotspot/share/runtime/frame.cpp +++ b/src/hotspot/share/runtime/frame.cpp @@ -1558,6 +1558,39 @@ void frame::describe(FrameValues& values, int frame_no, const RegisterMap* reg_m #endif +/** + * Gets the caller frame of `fr` for thread `t`. + * + * @returns an invalid frame (i.e. fr.pc() === 0) if the caller cannot be obtained + */ +frame frame::next_frame(frame fr, Thread* t) { + // Compiled code may use EBP register on x86 so it looks like + // non-walkable C frame. Use frame.sender() for java frames. + frame invalid; + if (t != nullptr && t->is_Java_thread()) { + // Catch very first native frame by using stack address. + // For JavaThread stack_base and stack_size should be set. + if (!t->is_in_full_stack((address)(fr.real_fp() + 1))) { + return invalid; + } + if (fr.is_interpreted_frame() || (fr.cb() != nullptr && fr.cb()->frame_size() > 0)) { + RegisterMap map(JavaThread::cast(t), + RegisterMap::UpdateMap::skip, + RegisterMap::ProcessFrames::include, + RegisterMap::WalkContinuation::skip); // No update + return fr.sender(&map); + } else { + // is_first_C_frame() does only simple checks for frame pointer, + // it will pass if java compiled code has a pointer in EBP. + if (os::is_first_C_frame(&fr)) return invalid; + return os::get_sender_for_C_frame(&fr); + } + } else { + if (os::is_first_C_frame(&fr)) return invalid; + return os::get_sender_for_C_frame(&fr); + } +} + #ifndef PRODUCT void FrameValues::describe(int owner, intptr_t* location, const char* description, int priority) { diff --git a/src/hotspot/share/runtime/frame.hpp b/src/hotspot/share/runtime/frame.hpp index 0363d7305d2..1c24e5b63c7 100644 --- a/src/hotspot/share/runtime/frame.hpp +++ b/src/hotspot/share/runtime/frame.hpp @@ -440,6 +440,7 @@ class frame { void interpreter_frame_print_on(outputStream* st) const; void print_on_error(outputStream* st, char* buf, int buflen, bool verbose = false) const; static void print_C_frame(outputStream* st, char* buf, int buflen, address pc); + static frame next_frame(frame fr, Thread* t); // For native stack walking #ifndef PRODUCT // Add annotated descriptions of memory locations belonging to this frame to values diff --git a/src/hotspot/share/runtime/javaThread.cpp b/src/hotspot/share/runtime/javaThread.cpp index 7f332638ee0..86aa62fd3fb 100644 --- a/src/hotspot/share/runtime/javaThread.cpp +++ b/src/hotspot/share/runtime/javaThread.cpp @@ -100,6 +100,7 @@ #include "utilities/dtrace.hpp" #include "utilities/events.hpp" #include "utilities/macros.hpp" +#include "utilities/nativeStackPrinter.hpp" #include "utilities/preserveException.hpp" #include "utilities/spinYield.hpp" #include "utilities/vmError.hpp" @@ -1772,15 +1773,10 @@ void JavaThread::print_jni_stack() { tty->print_cr("Unable to print native stack - out of memory"); return; } + NativeStackPrinter nsp(this); address lastpc = nullptr; - if (os::platform_print_native_stack(tty, nullptr, buf, O_BUFLEN, lastpc)) { - // We have printed the native stack in platform-specific code, - // so nothing else to do in this case. - } else { - frame f = os::current_frame(); - VMError::print_native_stack(tty, f, this, true /*print_source_info */, - -1 /* max stack */, buf, O_BUFLEN); - } + nsp.print_stack(tty, buf, O_BUFLEN, lastpc, + true /*print_source_info */, -1 /* max stack */ ); } else { print_active_stack_on(tty); } diff --git a/src/hotspot/share/runtime/objectMonitor.cpp b/src/hotspot/share/runtime/objectMonitor.cpp index c95fb5d5f0c..0f288baf0dd 100644 --- a/src/hotspot/share/runtime/objectMonitor.cpp +++ b/src/hotspot/share/runtime/objectMonitor.cpp @@ -597,10 +597,11 @@ void ObjectMonitor::enter_with_contention_mark(JavaThread *current, ObjectMonito enter_event.commit(); } - ContinuationEntry* ce = current->last_continuation(); - if (ce != nullptr && ce->is_virtual_thread()) { - assert(result != freeze_ok, "sanity check"); - current->post_vthread_pinned_event(&vthread_pinned_event, "Contended monitor enter", result); + if (current->current_waiting_monitor() == nullptr) { + ContinuationEntry* ce = current->last_continuation(); + if (ce != nullptr && ce->is_virtual_thread()) { + current->post_vthread_pinned_event(&vthread_pinned_event, "Contended monitor enter", result); + } } OM_PERFDATA_OP(ContendedLockAttempts, inc()); @@ -1819,11 +1820,6 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) { post_monitor_wait_event(&wait_event, this, node._notifier_tid, millis, ret == OS_TIMEOUT); } - if (ce != nullptr && ce->is_virtual_thread()) { - assert(result != freeze_ok, "sanity check"); - current->post_vthread_pinned_event(&vthread_pinned_event, "Object.wait", result); - } - OrderAccess::fence(); assert(!has_owner(current), "invariant"); @@ -1863,6 +1859,10 @@ void ObjectMonitor::wait(jlong millis, bool interruptible, TRAPS) { assert(!has_successor(current), "invariant"); assert_mark_word_consistency(); + if (ce != nullptr && ce->is_virtual_thread()) { + current->post_vthread_pinned_event(&vthread_pinned_event, "Object.wait", result); + } + // check if the notification happened if (!WasNotified) { // no, it could be timeout or Thread.interrupt() or both diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index f631556858f..f9f3c4e1458 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -49,6 +49,7 @@ #include "oops/oop.inline.hpp" #include "prims/jvm_misc.hpp" #include "prims/jvmtiAgent.hpp" +#include "prims/jvmtiAgentList.hpp" #include "runtime/arguments.hpp" #include "runtime/atomic.hpp" #include "runtime/frame.inline.hpp" @@ -1121,6 +1122,31 @@ void os::print_environment_variables(outputStream* st, const char** env_list) { } } +void os::print_jvmti_agent_info(outputStream* st) { +#if INCLUDE_JVMTI + const JvmtiAgentList::Iterator it = JvmtiAgentList::all(); + if (it.has_next()) { + st->print_cr("JVMTI agents:"); + } else { + st->print_cr("JVMTI agents: none"); + } + while (it.has_next()) { + const JvmtiAgent* agent = it.next(); + if (agent != nullptr) { + const char* dyninfo = agent->is_dynamic() ? "dynamic " : ""; + const char* instrumentinfo = agent->is_instrument_lib() ? "instrumentlib " : ""; + const char* loadinfo = agent->is_loaded() ? "loaded" : "not loaded"; + const char* initinfo = agent->is_initialized() ? "initialized" : "not initialized"; + const char* optionsinfo = agent->options(); + const char* pathinfo = agent->os_lib_path(); + if (optionsinfo == nullptr) optionsinfo = "none"; + if (pathinfo == nullptr) pathinfo = "none"; + st->print_cr("%s path:%s, %s, %s, %s%soptions:%s", agent->name(), pathinfo, loadinfo, initinfo, dyninfo, instrumentinfo, optionsinfo); + } + } +#endif +} + void os::print_register_info(outputStream* st, const void* context) { int continuation = 0; print_register_info(st, context, continuation); diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index 8bfda7db653..242959034af 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -813,6 +813,7 @@ class os: AllStatic { static void print_summary_info(outputStream* st, char* buf, size_t buflen); static void print_memory_info(outputStream* st); static void print_dll_info(outputStream* st); + static void print_jvmti_agent_info(outputStream* st); static void print_environment_variables(outputStream* st, const char** env_list); static void print_context(outputStream* st, const void* context); static void print_tos_pc(outputStream* st, const void* context); diff --git a/src/hotspot/share/runtime/thread.hpp b/src/hotspot/share/runtime/thread.hpp index 82f31ece479..513294688c6 100644 --- a/src/hotspot/share/runtime/thread.hpp +++ b/src/hotspot/share/runtime/thread.hpp @@ -525,6 +525,8 @@ class Thread: public ThreadShadow { public: // Stack overflow support address stack_base() const DEBUG_ONLY(;) NOT_DEBUG({ return _stack_base; }) + // Needed for code that can query a new thread before the stack has been set. + address stack_base_or_null() const { return _stack_base; } void set_stack_base(address base) { _stack_base = base; } size_t stack_size() const { return _stack_size; } void set_stack_size(size_t size) { _stack_size = size; } diff --git a/src/hotspot/share/runtime/vframe.cpp b/src/hotspot/share/runtime/vframe.cpp index fbf82c69673..30b3a203a5f 100644 --- a/src/hotspot/share/runtime/vframe.cpp +++ b/src/hotspot/share/runtime/vframe.cpp @@ -94,10 +94,11 @@ vframe* vframe::new_vframe(const frame* f, const RegisterMap* reg_map, JavaThrea } vframe* vframe::sender() const { - RegisterMap temp_map = *register_map(); assert(is_top(), "just checking"); if (_fr.is_empty()) return nullptr; if (_fr.is_entry_frame() && _fr.is_first_frame()) return nullptr; + + RegisterMap temp_map = *register_map(); frame s = _fr.real_sender(&temp_map); if (s.is_first_frame()) return nullptr; return vframe::new_vframe(&s, &temp_map, thread()); @@ -493,10 +494,10 @@ void vframeStreamCommon::found_bad_method_frame() const { #endif vframeStream::vframeStream(JavaThread* thread, Handle continuation_scope, bool stop_at_java_call_stub) - : vframeStreamCommon(RegisterMap(thread, - RegisterMap::UpdateMap::include, - RegisterMap::ProcessFrames::include, - RegisterMap::WalkContinuation::include)) { + : vframeStreamCommon(thread, + RegisterMap::UpdateMap::include, + RegisterMap::ProcessFrames::include, + RegisterMap::WalkContinuation::include) { _stop_at_java_call_stub = stop_at_java_call_stub; _continuation_scope = continuation_scope; @@ -514,7 +515,7 @@ vframeStream::vframeStream(JavaThread* thread, Handle continuation_scope, bool s } vframeStream::vframeStream(oop continuation, Handle continuation_scope) - : vframeStreamCommon(RegisterMap(continuation, RegisterMap::UpdateMap::include)) { + : vframeStreamCommon(continuation) { _stop_at_java_call_stub = false; _continuation_scope = continuation_scope; @@ -530,6 +531,10 @@ vframeStream::vframeStream(oop continuation, Handle continuation_scope) } } +vframeStreamCommon::vframeStreamCommon(oop continuation) + : _reg_map(continuation, RegisterMap::UpdateMap::include), _cont_entry(nullptr) { + _thread = _reg_map.thread(); +} // Step back n frames, skip any pseudo frames in between. // This function is used in Class.forName, Class.newInstance, and Method.Invoke. diff --git a/src/hotspot/share/runtime/vframe.hpp b/src/hotspot/share/runtime/vframe.hpp index c2a777c1556..de3fca7246b 100644 --- a/src/hotspot/share/runtime/vframe.hpp +++ b/src/hotspot/share/runtime/vframe.hpp @@ -281,7 +281,8 @@ class vframeStreamCommon : StackObj { public: // Constructor - inline vframeStreamCommon(RegisterMap reg_map); + inline vframeStreamCommon(JavaThread* thread, RegisterMap::UpdateMap update_map, RegisterMap::ProcessFrames process_frames, RegisterMap::WalkContinuation walk_cont); + vframeStreamCommon(oop continuation); // Accessors Method* method() const { return _method; } diff --git a/src/hotspot/share/runtime/vframe.inline.hpp b/src/hotspot/share/runtime/vframe.inline.hpp index e7f9edbc232..54dbb44ebd4 100644 --- a/src/hotspot/share/runtime/vframe.inline.hpp +++ b/src/hotspot/share/runtime/vframe.inline.hpp @@ -34,7 +34,11 @@ #include "runtime/handles.inline.hpp" #include "runtime/javaThread.inline.hpp" -inline vframeStreamCommon::vframeStreamCommon(RegisterMap reg_map) : _reg_map(reg_map), _cont_entry(nullptr) { +inline vframeStreamCommon::vframeStreamCommon(JavaThread* thread, + RegisterMap::UpdateMap update_map, + RegisterMap::ProcessFrames process_frames, + RegisterMap::WalkContinuation walk_cont) + : _reg_map(thread, update_map, process_frames, walk_cont), _cont_entry(nullptr) { _thread = _reg_map.thread(); } @@ -109,10 +113,10 @@ inline void vframeStreamCommon::next() { } inline vframeStream::vframeStream(JavaThread* thread, bool stop_at_java_call_stub, bool process_frame, bool vthread_carrier) - : vframeStreamCommon(RegisterMap(thread, - RegisterMap::UpdateMap::include, - process_frame ? RegisterMap::ProcessFrames::include : RegisterMap::ProcessFrames::skip , - RegisterMap::WalkContinuation::include)) { + : vframeStreamCommon(thread, + RegisterMap::UpdateMap::include, + process_frame ? RegisterMap::ProcessFrames::include : RegisterMap::ProcessFrames::skip , + RegisterMap::WalkContinuation::include) { _stop_at_java_call_stub = stop_at_java_call_stub; if (!thread->has_last_Java_frame()) { diff --git a/src/hotspot/share/runtime/vframeArray.cpp b/src/hotspot/share/runtime/vframeArray.cpp index 1b26abf7402..bf195311f48 100644 --- a/src/hotspot/share/runtime/vframeArray.cpp +++ b/src/hotspot/share/runtime/vframeArray.cpp @@ -43,9 +43,6 @@ #include "runtime/vframe_hp.hpp" #include "utilities/copy.hpp" #include "utilities/events.hpp" -#ifdef COMPILER2 -#include "opto/runtime.hpp" -#endif int vframeArrayElement:: bci(void) const { return (_bci == SynchronizationEntryBCI ? 0 : _bci); } diff --git a/src/hotspot/share/runtime/vframe_hp.cpp b/src/hotspot/share/runtime/vframe_hp.cpp index 49ed47835d6..0c7e63d07fc 100644 --- a/src/hotspot/share/runtime/vframe_hp.cpp +++ b/src/hotspot/share/runtime/vframe_hp.cpp @@ -45,10 +45,6 @@ #include "runtime/stubRoutines.hpp" #include "runtime/vframeArray.hpp" #include "runtime/vframe_hp.hpp" -#ifdef COMPILER2 -#include "opto/matcher.hpp" -#endif - // ------------- compiledVFrame -------------- diff --git a/src/hotspot/share/runtime/vmOperations.cpp b/src/hotspot/share/runtime/vmOperations.cpp index a3f632ca496..64ffabec0c1 100644 --- a/src/hotspot/share/runtime/vmOperations.cpp +++ b/src/hotspot/share/runtime/vmOperations.cpp @@ -611,12 +611,16 @@ void VM_Exit::doit() { void VM_Exit::wait_if_vm_exited() { - if (_vm_exited && - Thread::current_or_null() != _shutdown_thread) { - // _vm_exited is set at safepoint, and the Threads_lock is never released - // so we will block here until the process dies. - Threads_lock->lock(); - ShouldNotReachHere(); + if (_vm_exited) { + // Need to check for an unattached thread as only attached threads + // can acquire the lock. + Thread* current = Thread::current_or_null(); + if (current != nullptr && current != _shutdown_thread) { + // _vm_exited is set at safepoint, and the Threads_lock is never released + // so we will block here until the process dies. + Threads_lock->lock(); + ShouldNotReachHere(); + } } } diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index eaf259cedba..f5cb2805c8e 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -2029,8 +2029,6 @@ /* HotSpot specific JVM_ACC constants from global anon enum */ \ /************************************************************/ \ \ - declare_constant(JVM_ACC_WRITTEN_FLAGS) \ - \ declare_constant(JVM_CONSTANT_Utf8) \ declare_constant(JVM_CONSTANT_Unicode) \ declare_constant(JVM_CONSTANT_Integer) \ diff --git a/src/hotspot/share/services/attachListener.cpp b/src/hotspot/share/services/attachListener.cpp index 8cf5c31b0b3..0d67268ec38 100644 --- a/src/hotspot/share/services/attachListener.cpp +++ b/src/hotspot/share/services/attachListener.cpp @@ -525,7 +525,7 @@ AttachAPIVersion AttachListener::get_supported_version() { } -int AttachOperation::RequestReader::read_uint() { +int AttachOperation::RequestReader::read_uint(bool may_be_empty) { const int MAX_VALUE = INT_MAX / 20; char ch; int value = 0; @@ -534,7 +534,9 @@ int AttachOperation::RequestReader::read_uint() { if (n != 1) { // IO errors (n < 0) are logged by read(). if (n == 0) { // EOF - log_error(attach)("Failed to read int value: EOF"); + if (!may_be_empty || value != 0) { // value != 0 means this is not the 1st read + log_error(attach)("Failed to read int value: EOF"); + } } return -1; } @@ -615,8 +617,11 @@ bool AttachOperation::read_request_data(AttachOperation::RequestReader* reader, return true; } -bool AttachOperation::read_request(RequestReader* reader) { - uint ver = reader->read_uint(); +bool AttachOperation::read_request(RequestReader* reader, ReplyWriter* error_writer) { + int ver = reader->read_uint(true); // do not log error if this is "empty" connection + if (ver < 0) { + return false; + } int buffer_size = 0; // Read conditions: int min_str_count = 0; // expected number of strings in the request @@ -631,6 +636,7 @@ bool AttachOperation::read_request(RequestReader* reader) { case ATTACH_API_V2: // 000(0)* (any number of arguments) if (AttachListener::get_supported_version() < 2) { log_error(attach)("Failed to read request: v2 is unsupported or disabled"); + write_reply(error_writer, ATTACH_ERROR_BADVERSION, "v2 is unsupported or disabled"); return false; } @@ -652,10 +658,26 @@ bool AttachOperation::read_request(RequestReader* reader) { break; default: log_error(attach)("Failed to read request: unknown version (%d)", ver); + write_reply(error_writer, ATTACH_ERROR_BADVERSION, "unknown version"); return false; } - return read_request_data(reader, buffer_size, min_str_count, min_read_size); + bool result = read_request_data(reader, buffer_size, min_str_count, min_read_size); + if (result && ver == ATTACH_API_V1) { + // We know the whole request does not exceed buffer_size, + // for v1 also name/arguments should not exceed name_length_max/arg_length_max. + if (strlen(name()) > AttachOperation::name_length_max) { + log_error(attach)("Failed to read request: operation name is too long"); + return false; + } + for (int i = 0; i < arg_count(); i++) { + if (strlen(arg(i)) > AttachOperation::arg_length_max) { + log_error(attach)("Failed to read request: operation argument is too long"); + return false; + } + } + } + return result; } bool AttachOperation::ReplyWriter::write_fully(const void* buffer, int size) { @@ -671,16 +693,23 @@ bool AttachOperation::ReplyWriter::write_fully(const void* buffer, int size) { return true; } -bool AttachOperation::write_reply(ReplyWriter* writer, jint result, bufferedStream* result_stream) { - char msg[32]; - os::snprintf_checked(msg, sizeof(msg), "%d\n", result); - if (!writer->write_fully(msg, (int)strlen(msg))) { +bool AttachOperation::write_reply(ReplyWriter * writer, jint result, const char* message, int message_len) { + if (message_len < 0) { + message_len = (int)strlen(message); + } + char buf[32]; + os::snprintf_checked(buf, sizeof(buf), "%d\n", result); + if (!writer->write_fully(buf, (int)strlen(buf))) { return false; } - if (!writer->write_fully(result_stream->base(), (int)result_stream->size())) { + if (!writer->write_fully(message, message_len)) { return false; } writer->flush(); return true; } +bool AttachOperation::write_reply(ReplyWriter* writer, jint result, bufferedStream* result_stream) { + return write_reply(writer, result, result_stream->base(), (int)result_stream->size()); +} + diff --git a/src/hotspot/share/services/attachListener.hpp b/src/hotspot/share/services/attachListener.hpp index 093fa410d12..c98491b6ec6 100644 --- a/src/hotspot/share/services/attachListener.hpp +++ b/src/hotspot/share/services/attachListener.hpp @@ -70,8 +70,8 @@ Version 2 (since jdk24): attach operations may have any number of arguments of a If the target VM does not support version 2, client uses version 1 to enqueue operations. */ enum AttachAPIVersion: int { - ATTACH_API_V1 = 1, - ATTACH_API_V2 = 2 + ATTACH_API_V1 = 1, + ATTACH_API_V2 = 2 }; class AttachListenerThread : public JavaThread { @@ -164,6 +164,10 @@ class AttachOperation: public CHeapObj { arg_length_max = 1024, // maximum length of argument arg_count_max = 3 // maximum number of arguments }; + // error codes (reported as status to clients) + enum { + ATTACH_ERROR_BADVERSION = 101 + }; // name of special operation that can be enqueued when all // clients detach @@ -231,6 +235,8 @@ class AttachOperation: public CHeapObj { // complete operation by sending result code and any result data to the client virtual void complete(jint result, bufferedStream* result_stream) = 0; + class ReplyWriter; // forward declaration + // Helper classes/methods for platform-specific implementations. class RequestReader { public: @@ -239,11 +245,16 @@ class AttachOperation: public CHeapObj { virtual int read(void* buffer, int size) = 0; // Reads unsigned value, returns -1 on error. - int read_uint(); + // + // Attach client can make sanity connect/disconnect. + // In that case we get "premature EOF" error. + // If may_be_empty is true, the error is not logged. + int read_uint(bool may_be_empty = false); }; // Reads standard operation request (v1 or v2). - bool read_request(RequestReader* reader); + // Some errors known by clients are reported to error_writer. + bool read_request(RequestReader* reader, ReplyWriter* error_writer); class ReplyWriter { public: @@ -256,6 +267,7 @@ class AttachOperation: public CHeapObj { }; // Writes standard operation reply (to be called from 'complete' method). + bool write_reply(ReplyWriter* writer, jint result, const char* message, int message_len = -1); bool write_reply(ReplyWriter* writer, jint result, bufferedStream* result_stream); private: diff --git a/src/hotspot/share/services/diagnosticCommand.cpp b/src/hotspot/share/services/diagnosticCommand.cpp index e4dff47c84f..3b52f0edc72 100644 --- a/src/hotspot/share/services/diagnosticCommand.cpp +++ b/src/hotspot/share/services/diagnosticCommand.cpp @@ -140,10 +140,10 @@ void DCmd::register_dcmds(){ DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); #endif // LINUX -#if defined(LINUX) || defined(_WIN64) +#if defined(LINUX) || defined(_WIN64) || defined(__APPLE__) DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true,false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true,false)); -#endif // LINUX or WINDOWS +#endif // LINUX or WINDOWS or MacOS DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); @@ -1158,7 +1158,7 @@ void CompilationMemoryStatisticDCmd::execute(DCmdSource source, TRAPS) { CompilationMemoryStatistic::print_all_by_size(output(), human_readable, minsize); } -#if defined(LINUX) || defined(_WIN64) +#if defined(LINUX) || defined(_WIN64) || defined(__APPLE__) SystemMapDCmd::SystemMapDCmd(outputStream* output, bool heap) : DCmd(output, heap) {} diff --git a/src/hotspot/share/services/diagnosticCommand.hpp b/src/hotspot/share/services/diagnosticCommand.hpp index 83e818e16d2..212a8996d0a 100644 --- a/src/hotspot/share/services/diagnosticCommand.hpp +++ b/src/hotspot/share/services/diagnosticCommand.hpp @@ -822,14 +822,14 @@ class CompilationMemoryStatisticDCmd: public DCmdWithParser { virtual void execute(DCmdSource source, TRAPS); }; -#if defined(LINUX) || defined(_WIN64) +#if defined(LINUX) || defined(_WIN64) || defined(__APPLE__) class SystemMapDCmd : public DCmd { public: SystemMapDCmd(outputStream* output, bool heap); static const char* name() { return "System.map"; } static const char* description() { - return "Prints an annotated process memory map of the VM process (linux and Windows only)."; + return "Prints an annotated process memory map of the VM process (linux, Windows and MacOS only)."; } static const char* impact() { return "Medium; can be high for very large java heaps."; } virtual void execute(DCmdSource source, TRAPS); @@ -842,12 +842,12 @@ class SystemDumpMapDCmd : public DCmdWithParser { SystemDumpMapDCmd(outputStream* output, bool heap); static const char* name() { return "System.dump_map"; } static const char* description() { - return "Dumps an annotated process memory map to an output file (linux and Windows only)."; + return "Dumps an annotated process memory map to an output file (linux, Windows and MacOS only)."; } static const char* impact() { return "Medium; can be high for very large java heaps."; } virtual void execute(DCmdSource source, TRAPS); }; -#endif // LINUX or WINDOWS +#endif // LINUX, WINDOWS or MACOS #endif // SHARE_SERVICES_DIAGNOSTICCOMMAND_HPP diff --git a/src/hotspot/share/utilities/debug.cpp b/src/hotspot/share/utilities/debug.cpp index 07e93ca5710..61743be7dfc 100644 --- a/src/hotspot/share/utilities/debug.cpp +++ b/src/hotspot/share/utilities/debug.cpp @@ -61,6 +61,7 @@ #include "utilities/formatBuffer.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" +#include "utilities/nativeStackPrinter.hpp" #include "utilities/unsigned5.hpp" #include "utilities/vmError.hpp" @@ -645,10 +646,11 @@ void help() { extern "C" DEBUGEXPORT void pns(void* sp, void* fp, void* pc) { // print native stack Command c("pns"); static char buf[O_BUFLEN]; - Thread* t = Thread::current_or_null(); // Call generic frame constructor (certain arguments may be ignored) frame fr(sp, fp, pc); - VMError::print_native_stack(tty, fr, t, false, -1, buf, sizeof(buf)); + NativeStackPrinter nsp(Thread::current_or_null()); + nsp.print_stack_from_frame(tty, fr, buf, sizeof(buf), + false /* print_source_info */, -1 /* max stack */); } // @@ -663,14 +665,9 @@ extern "C" DEBUGEXPORT void pns2() { // print native stack Command c("pns2"); static char buf[O_BUFLEN]; address lastpc = nullptr; - if (os::platform_print_native_stack(tty, nullptr, buf, sizeof(buf), lastpc)) { - // We have printed the native stack in platform-specific code, - // so nothing else to do in this case. - } else { - Thread* t = Thread::current_or_null(); - frame fr = os::current_frame(); - VMError::print_native_stack(tty, fr, t, false, -1, buf, sizeof(buf)); - } + NativeStackPrinter nsp(Thread::current_or_null()); + nsp.print_stack(tty, buf, sizeof(buf), lastpc, + false /* print_source_info */, -1 /* max stack */); } #endif diff --git a/src/hotspot/share/utilities/nativeStackPrinter.cpp b/src/hotspot/share/utilities/nativeStackPrinter.cpp new file mode 100644 index 00000000000..6f94722213c --- /dev/null +++ b/src/hotspot/share/utilities/nativeStackPrinter.cpp @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "precompiled.hpp" +#include "runtime/frame.inline.hpp" +#include "runtime/os.inline.hpp" +#include "utilities/decoder.hpp" +#include "utilities/globalDefinitions.hpp" +#include "utilities/nativeStackPrinter.hpp" +#include "utilities/ostream.hpp" + +bool NativeStackPrinter::print_stack(outputStream* st, char* buf, int buf_size, + address& lastpc, bool print_source_info, + int max_frames) { + if (os::platform_print_native_stack(st, _context, buf, buf_size, lastpc)) { + return true; + } else { + print_stack_from_frame(st, buf, buf_size, print_source_info, max_frames); + return false; + } +} + +void NativeStackPrinter::print_stack_from_frame(outputStream* st, frame fr, + char* buf, int buf_size, + bool print_source_info, int max_frames) { + // see if it's a valid frame + if (fr.pc()) { + st->print_cr("Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)"); + const int limit = max_frames == -1 ? StackPrintLimit + : MIN2(max_frames, StackPrintLimit); + int count = 0; + while (count++ < limit) { + fr.print_on_error(st, buf, buf_size); + if (fr.pc()) { // print source file and line, if available + char filename[128]; + int line_no; + if (count == 1 && _lineno != 0) { + // We have source information for the first frame for internal errors, + // there is no need to parse it from the symbols. + st->print(" (%s:%d)", _filename, _lineno); + } else if (print_source_info && + Decoder::get_source_info(fr.pc(), filename, sizeof(filename), &line_no, count != 1)) { + st->print(" (%s:%d)", filename, line_no); + } + } + st->cr(); + fr = frame::next_frame(fr, _current); + if (fr.pc() == nullptr) { + break; + } + } + + if (count > limit) { + st->print_cr("......"); + } + + } else { + st->print_cr("Native frames: "); + } +} diff --git a/src/hotspot/share/utilities/nativeStackPrinter.hpp b/src/hotspot/share/utilities/nativeStackPrinter.hpp new file mode 100644 index 00000000000..45413381079 --- /dev/null +++ b/src/hotspot/share/utilities/nativeStackPrinter.hpp @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ +#ifndef SHARE_UTILITIES_NATIVESTACKPRINTER_HPP +#define SHARE_UTILITIES_NATIVESTACKPRINTER_HPP + +#include "memory/allocation.hpp" +#include "runtime/frame.hpp" +#include "runtime/os.hpp" +#include "utilities/globalDefinitions.hpp" + +// Forward declarations +class outputStream; +class Thread; + +// Helper class to do native stack printing from various contexts +// including during crash reporting. +// The NativeStackPrinter is created with the basic context information +// available from the caller. Then the print_stack function is called +// to do the actual printing. +class NativeStackPrinter : public StackObj { + Thread* _current; // Current thread if known + const void* _context; // OS crash context if known + const char* _filename; // Source file name if known + int _lineno; // Source file line number if known + + public: + // Creates a NativeStackPrinter using the given additional context + // information: + // - the current thread is used for frame-based stack walking + // - context is the crash context from the OS and can be used to get a frame; + // otherwise os::current_frame() will be used + // - filename and lineno provide details from the fatal error handler so we + // can skip use of the Decoder for the first line (optimization) + NativeStackPrinter(Thread* current_or_null, + const void* context, + const char* filename, + int lineno) : + _current(current_or_null), + _context(context), + _filename(filename), + _lineno(lineno) { + assert((_lineno == 0 && _filename == nullptr) || + (_lineno > 0 && _filename != nullptr), + "file name and line number need to be provided together"); + } + + NativeStackPrinter(Thread* current_or_null) + : NativeStackPrinter(current_or_null, nullptr, nullptr, 0) {} + + // Prints the stack of the current thread to the given stream. + // We first try to print via os::platform_print_native_stack. If that + // succeeds then lastpc is set and we return true. Otherwise we do a + // frame walk to print the stack, and return false. + // - st: the stream to print to + // - buf, buf_size: temporary buffer to use for formatting output + // - print_source_info: see print_stack_from_frame + // - max_frames: see print_stack_from_frame + // + bool print_stack(outputStream* st, char* buf, int buf_size, + address& lastpc, bool print_source_info, + int max_frames); + + // Prints the stack to st by walking the frames starting from + // either the context frame, else the current frame. + // - st: the stream to print to + // - buf, buf_size: temporary buffer to use when printing frames + // - print_source_info: if true obtains source information from the Decoder + // if available. (Useful but may slow down, timeout or + // misfunction in error situations) + // - max_frames: the maximum number of frames to print. -1 means print all. + // However, StackPrintLimit sets a hard limit on the maximum. + void print_stack_from_frame(outputStream* st, frame fr, + char* buf, int buf_size, + bool print_source_info, int max_frames); + + // Prints the stack to st by walking the frames starting from + // either the context frame, else the current frame. + void print_stack_from_frame(outputStream* st, + char* buf, int buf_size, + bool print_source_info, int max_frames) { + frame fr = _context != nullptr ? os::fetch_frame_from_context(_context) + : os::current_frame(); + print_stack_from_frame(st, fr, buf, buf_size, print_source_info, max_frames); + } +}; + +#endif // SHARE_UTILITIES_NATIVESTACKPRINTER_HPP diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index bb57c19c528..b15d6f5fa73 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2017, 2020 SAP SE. All rights reserved. + * Copyright (c) 2017, 2024 SAP SE. All rights reserved. * Copyright (c) 2023, Red Hat, Inc. and/or its affiliates. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -67,6 +67,7 @@ #include "utilities/events.hpp" #include "utilities/globalDefinitions.hpp" #include "utilities/macros.hpp" +#include "utilities/nativeStackPrinter.hpp" #include "utilities/ostream.hpp" #include "utilities/vmError.hpp" #if INCLUDE_JFR @@ -97,7 +98,7 @@ Thread* VMError::_thread; address VMError::_pc; const void* VMError::_siginfo; const void* VMError::_context; -bool VMError::_print_native_stack_used = false; +bool VMError::_print_stack_from_frame_used = false; const char* VMError::_filename; int VMError::_lineno; size_t VMError::_size; @@ -132,7 +133,7 @@ static const char* env_list[] = { // defined on Windows "OS", "PROCESSOR_IDENTIFIER", "_ALT_JAVA_HOME_DIR", "TMP", "TEMP", - (const char *)0 + nullptr // End marker. }; // A simple parser for -XX:OnError, usage: @@ -418,75 +419,6 @@ static const char* find_code_name(address pc) { return nullptr; } -/** - * Gets the caller frame of `fr`. - * - * @returns an invalid frame (i.e. fr.pc() === 0) if the caller cannot be obtained - */ -static frame next_frame(frame fr, Thread* t) { - // Compiled code may use EBP register on x86 so it looks like - // non-walkable C frame. Use frame.sender() for java frames. - frame invalid; - if (t != nullptr && t->is_Java_thread()) { - // Catch very first native frame by using stack address. - // For JavaThread stack_base and stack_size should be set. - if (!t->is_in_full_stack((address)(fr.real_fp() + 1))) { - return invalid; - } - if (fr.is_interpreted_frame() || (fr.cb() != nullptr && fr.cb()->frame_size() > 0)) { - RegisterMap map(JavaThread::cast(t), - RegisterMap::UpdateMap::skip, - RegisterMap::ProcessFrames::include, - RegisterMap::WalkContinuation::skip); // No update - return fr.sender(&map); - } else { - // is_first_C_frame() does only simple checks for frame pointer, - // it will pass if java compiled code has a pointer in EBP. - if (os::is_first_C_frame(&fr)) return invalid; - return os::get_sender_for_C_frame(&fr); - } - } else { - if (os::is_first_C_frame(&fr)) return invalid; - return os::get_sender_for_C_frame(&fr); - } -} - -void VMError::print_native_stack(outputStream* st, frame fr, Thread* t, bool print_source_info, int max_frames, char* buf, int buf_size) { - - // see if it's a valid frame - if (fr.pc()) { - st->print_cr("Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)"); - const int limit = max_frames == -1 ? StackPrintLimit : MIN2(max_frames, StackPrintLimit); - int count = 0; - while (count++ < limit) { - fr.print_on_error(st, buf, buf_size); - if (fr.pc()) { // print source file and line, if available - char filename[128]; - int line_no; - if (count == 1 && _lineno != 0) { - // We have source information of the first frame for internal errors. There is no need to parse it from the symbols. - st->print(" (%s:%d)", get_filename_only(), _lineno); - } else if (print_source_info && - Decoder::get_source_info(fr.pc(), filename, sizeof(filename), &line_no, count != 1)) { - st->print(" (%s:%d)", filename, line_no); - } - } - st->cr(); - fr = next_frame(fr, t); - if (fr.pc() == nullptr) { - break; - } - } - - if (count > limit) { - st->print_cr("......"); - } - - } else { - st->print_cr("Native frames: "); - } -} - static void print_oom_reasons(outputStream* st) { st->print_cr("# Possible reasons:"); st->print_cr("# The system is out of physical RAM or swap space"); @@ -1008,7 +940,10 @@ void VMError::report(outputStream* st, bool _verbose) { st->cr(); STEP_IF("printing native stack (with source info)", _verbose) - if (os::platform_print_native_stack(st, _context, buf, sizeof(buf), lastpc)) { + + NativeStackPrinter nsp(_thread, _context, _filename != nullptr ? get_filename_only() : nullptr, _lineno); + if (nsp.print_stack(st, buf, sizeof(buf), lastpc, + true /*print_source_info */, -1 /* max stack */)) { // We have printed the native stack in platform-specific code // Windows/x64 needs special handling. // Stack walking may get stuck. Try to find the calling code. @@ -1019,19 +954,16 @@ void VMError::report(outputStream* st, bool _verbose) { } } } else { - frame fr = _context ? os::fetch_frame_from_context(_context) - : os::current_frame(); - - print_native_stack(st, fr, _thread, true, -1, buf, sizeof(buf)); - _print_native_stack_used = true; + _print_stack_from_frame_used = true; // frame-based native stack walk done } REATTEMPT_STEP_IF("retry printing native stack (no source info)", _verbose) st->cr(); st->print_cr("Retrying call stack printing without source information..."); - frame fr = _context ? os::fetch_frame_from_context(_context) : os::current_frame(); - print_native_stack(st, fr, _thread, false, -1, buf, sizeof(buf)); - _print_native_stack_used = true; + NativeStackPrinter nsp(_thread, _context, get_filename_only(), _lineno); + nsp.print_stack_from_frame(st, buf, sizeof(buf), + false /*print_source_info */, -1 /* max stack */); + _print_stack_from_frame_used = true; STEP_IF("printing Java stack", _verbose && _thread && _thread->is_Java_thread()) if (_verbose && _thread && _thread->is_Java_thread()) { @@ -1141,7 +1073,7 @@ void VMError::report(outputStream* st, bool _verbose) { } // Scan the native stack - if (!_print_native_stack_used) { + if (!_print_stack_from_frame_used) { // Only try to print code of the crashing frame since // the native stack cannot be walked with next_frame. if (print_code(st, _thread, _pc, true, printed, printed_capacity)) { @@ -1154,7 +1086,7 @@ void VMError::report(outputStream* st, bool _verbose) { if (print_code(st, _thread, fr.pc(), fr.pc() == _pc, printed, printed_capacity)) { printed_len++; } - fr = next_frame(fr, _thread); + fr = frame::next_frame(fr, _thread); } } @@ -1275,6 +1207,12 @@ void VMError::report(outputStream* st, bool _verbose) { os::print_dll_info(st); st->cr(); +#if INCLUDE_JVMTI + STEP_IF("printing jvmti agent info", _verbose) + os::print_jvmti_agent_info(st); + st->cr(); +#endif + STEP_IF("printing native decoder state", _verbose) Decoder::print_state_on(st); st->cr(); @@ -1453,6 +1391,11 @@ void VMError::print_vm_info(outputStream* st) { os::print_dll_info(st); st->cr(); +#if INCLUDE_JVMTI + os::print_jvmti_agent_info(st); + st->cr(); +#endif + // STEP("printing VM options") // VM options @@ -1786,12 +1729,12 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt st->print_cr("]"); } st->print("[stack: "); - frame fr = context ? os::fetch_frame_from_context(context) : os::current_frame(); + NativeStackPrinter nsp(_thread, context, _filename != nullptr ? get_filename_only() : nullptr, _lineno); // Subsequent secondary errors build up stack; to avoid flooding the hs-err file with irrelevant // call stacks, limit the stack we print here (we are only interested in what happened before the // last assert/fault). const int max_stack_size = 15; - print_native_stack(st, fr, _thread, true, max_stack_size, tmp, sizeof(tmp)); + nsp.print_stack_from_frame(st, tmp, sizeof(tmp), true /* print_source_info */, max_stack_size); st->print_cr("]"); } // !recursed recursed = false; // Note: reset outside !recursed diff --git a/src/hotspot/share/utilities/vmError.hpp b/src/hotspot/share/utilities/vmError.hpp index 405cb515896..832f44223be 100644 --- a/src/hotspot/share/utilities/vmError.hpp +++ b/src/hotspot/share/utilities/vmError.hpp @@ -51,9 +51,9 @@ class VMError : public AllStatic { static const void* _context; // ContextRecord on Windows, // ucontext_t on Solaris/Linux - // records if VMError::print_native_stack was used to + // records if frame-based stack walking was used to // print the native stack instead of os::platform_print_native_stack - static bool _print_native_stack_used; + static bool _print_stack_from_frame_used; // additional info for VM internal errors static const char* _filename; @@ -148,12 +148,6 @@ class VMError : public AllStatic { public: - // print_source_info: if true, we try to resolve the source information on platforms that support it - // (useful but may slow down, timeout or misfunction in error situations) - // max_frames: if not -1, overrides StackPrintLimit - static void print_native_stack(outputStream* st, frame fr, Thread* t, bool print_source_info, - int max_frames, char* buf, int buf_size); - // return a string to describe the error static char* error_string(char* buf, int buflen); diff --git a/src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java b/src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java index d6b7d00d360..64b276a1c79 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java @@ -206,7 +206,6 @@ protected void engineInit(AlgorithmParameterSpec paramSpec) this.cipherParam = ((PBEParameterSpec)paramSpec).getParameterSpec(); } - @SuppressWarnings("deprecation") protected void engineInit(byte[] encoded) throws IOException { @@ -239,7 +238,6 @@ protected void engineInit(byte[] encoded) this.pbes2AlgorithmName = "PBEWith" + kdfAlgo + "And" + cipherAlgo; } - @SuppressWarnings("deprecation") private String parseKDF(DerValue keyDerivationFunc) throws IOException { if (!pkcs5PBKDF2_OID.equals(keyDerivationFunc.data.getOID())) { @@ -299,7 +297,6 @@ private String parseKDF(DerValue keyDerivationFunc) throws IOException { return kdfAlgo; } - @SuppressWarnings("deprecation") private String parseES(DerValue encryptionScheme) throws IOException { String cipherAlgo; diff --git a/src/java.base/share/classes/com/sun/crypto/provider/SealedObjectForKeyProtector.java b/src/java.base/share/classes/com/sun/crypto/provider/SealedObjectForKeyProtector.java index b5f5bc89f23..feaeee48836 100644 --- a/src/java.base/share/classes/com/sun/crypto/provider/SealedObjectForKeyProtector.java +++ b/src/java.base/share/classes/com/sun/crypto/provider/SealedObjectForKeyProtector.java @@ -81,7 +81,6 @@ final Key getKey(Cipher c, int maxLength) .getExtObjectInputStream(this, c)) { ois.setObjectInputFilter(new DeserializationChecker(maxLength)); try { - @SuppressWarnings("unchecked") Key t = (Key) ois.readObject(); return t; } catch (InvalidClassException ice) { diff --git a/src/java.base/share/classes/java/lang/foreign/Linker.java b/src/java.base/share/classes/java/lang/foreign/Linker.java index c8e4cf4746b..2f701380314 100644 --- a/src/java.base/share/classes/java/lang/foreign/Linker.java +++ b/src/java.base/share/classes/java/lang/foreign/Linker.java @@ -797,7 +797,7 @@ sealed interface Option * arguments *
  • {@code N}, none of the arguments passed to the function are passed as * variadic arguments
  • - *
  • {@code n}, where {@code 0 < m < N}, the arguments {@code m..N} are passed + *
  • {@code m}, where {@code 0 < m < N}, the arguments {@code m..N-1} are passed * as variadic arguments
  • * * It is important to always use this linker option when linking a diff --git a/src/java.base/share/classes/java/net/Socket.java b/src/java.base/share/classes/java/net/Socket.java index 929e99b5303..8566367a62d 100644 --- a/src/java.base/share/classes/java/net/Socket.java +++ b/src/java.base/share/classes/java/net/Socket.java @@ -569,9 +569,8 @@ void setConnected() { /** * Connects this socket to the server. * - *

    If the endpoint is an unresolved {@link InetSocketAddress}, or the - * connection cannot be established, then the socket is closed, and an - * {@link IOException} is thrown. + *

    If the connection cannot be established, then the socket is closed, + * and an {@link IOException} is thrown. * *

    This method is {@linkplain Thread#interrupt() interruptible} in the * following circumstances: @@ -591,8 +590,8 @@ void setConnected() { * @param endpoint the {@code SocketAddress} * @throws IOException if an error occurs during the connection, the socket * is already connected or the socket is closed - * @throws UnknownHostException if the endpoint is an unresolved - * {@link InetSocketAddress} + * @throws UnknownHostException if the connection could not be established + * because the endpoint is an unresolved {@link InetSocketAddress} * @throws java.nio.channels.IllegalBlockingModeException * if this socket has an associated channel, * and the channel is in non-blocking mode @@ -609,9 +608,8 @@ public void connect(SocketAddress endpoint) throws IOException { * A timeout of zero is interpreted as an infinite timeout. The connection * will then block until established or an error occurs. * - *

    If the endpoint is an unresolved {@link InetSocketAddress}, the - * connection cannot be established, or the timeout expires before the - * connection is established, then the socket is closed, and an + *

    If the connection cannot be established, or the timeout expires + * before the connection is established, then the socket is closed, and an * {@link IOException} is thrown. * *

    This method is {@linkplain Thread#interrupt() interruptible} in the @@ -634,8 +632,8 @@ public void connect(SocketAddress endpoint) throws IOException { * @throws IOException if an error occurs during the connection, the socket * is already connected or the socket is closed * @throws SocketTimeoutException if timeout expires before connecting - * @throws UnknownHostException if the endpoint is an unresolved - * {@link InetSocketAddress} + * @throws UnknownHostException if the connection could not be established + * because the endpoint is an unresolved {@link InetSocketAddress} * @throws java.nio.channels.IllegalBlockingModeException * if this socket has an associated channel, * and the channel is in non-blocking mode @@ -660,12 +658,6 @@ public void connect(SocketAddress endpoint, int timeout) throws IOException { if (!(endpoint instanceof InetSocketAddress epoint)) throw new IllegalArgumentException("Unsupported address type"); - if (epoint.isUnresolved()) { - var uhe = new UnknownHostException(epoint.getHostName()); - closeSuppressingExceptions(uhe); - throw uhe; - } - InetAddress addr = epoint.getAddress(); checkAddress(addr, "connect"); diff --git a/src/java.base/share/classes/java/security/Key.java b/src/java.base/share/classes/java/security/Key.java index 28c0098c064..190a3db2999 100644 --- a/src/java.base/share/classes/java/security/Key.java +++ b/src/java.base/share/classes/java/security/Key.java @@ -115,7 +115,6 @@ public interface Key extends java.io.Serializable { * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = 6603384152749567654L; diff --git a/src/java.base/share/classes/java/security/PrivateKey.java b/src/java.base/share/classes/java/security/PrivateKey.java index 045670ca008..70b6f854592 100644 --- a/src/java.base/share/classes/java/security/PrivateKey.java +++ b/src/java.base/share/classes/java/security/PrivateKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,7 +68,6 @@ public interface PrivateKey extends AsymmetricKey, javax.security.auth.Destroyab * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = 6034044314589513430L; } diff --git a/src/java.base/share/classes/java/security/Provider.java b/src/java.base/share/classes/java/security/Provider.java index da3f53b9632..203ffa82345 100644 --- a/src/java.base/share/classes/java/security/Provider.java +++ b/src/java.base/share/classes/java/security/Provider.java @@ -827,7 +827,7 @@ private Object implReplace(Object key, Object value) { return o; } - @SuppressWarnings("unchecked") // Function must actually operate over strings + // Function must actually operate over strings private void implReplaceAll(BiFunction function) { @@ -847,7 +847,7 @@ private void implReplaceAll(BiFunction remappingFunction) { @@ -864,7 +864,7 @@ private Object implMerge(Object key, Object value, return o; } - @SuppressWarnings("unchecked") // Function must actually operate over strings + // Function must actually operate over strings private Object implCompute(Object key, BiFunction remappingFunction) { @@ -881,7 +881,7 @@ private Object implCompute(Object key, BiFunction mappingFunction) { if (!checkLegacy(key)) return null; @@ -893,7 +893,7 @@ private Object implComputeIfAbsent(Object key, Function remappingFunction) { if (!checkLegacy(key)) return null; diff --git a/src/java.base/share/classes/java/security/PublicKey.java b/src/java.base/share/classes/java/security/PublicKey.java index e93efaf1c5b..9b79cd6908c 100644 --- a/src/java.base/share/classes/java/security/PublicKey.java +++ b/src/java.base/share/classes/java/security/PublicKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -54,7 +54,6 @@ public interface PublicKey extends AsymmetricKey { * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = 7187392471159151072L; } diff --git a/src/java.base/share/classes/java/security/interfaces/DSAPrivateKey.java b/src/java.base/share/classes/java/security/interfaces/DSAPrivateKey.java index efef7daca29..d3f042f2137 100644 --- a/src/java.base/share/classes/java/security/interfaces/DSAPrivateKey.java +++ b/src/java.base/share/classes/java/security/interfaces/DSAPrivateKey.java @@ -52,7 +52,6 @@ public interface DSAPrivateKey extends DSAKey, java.security.PrivateKey { * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = 7776497482533790279L; diff --git a/src/java.base/share/classes/java/security/interfaces/DSAPublicKey.java b/src/java.base/share/classes/java/security/interfaces/DSAPublicKey.java index a58333b38ba..d7fa55a8c8f 100644 --- a/src/java.base/share/classes/java/security/interfaces/DSAPublicKey.java +++ b/src/java.base/share/classes/java/security/interfaces/DSAPublicKey.java @@ -52,7 +52,6 @@ public interface DSAPublicKey extends DSAKey, java.security.PublicKey { * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = 1234526332779022332L; diff --git a/src/java.base/share/classes/java/security/interfaces/ECPrivateKey.java b/src/java.base/share/classes/java/security/interfaces/ECPrivateKey.java index 53c1f358d52..cdb31a90ba0 100644 --- a/src/java.base/share/classes/java/security/interfaces/ECPrivateKey.java +++ b/src/java.base/share/classes/java/security/interfaces/ECPrivateKey.java @@ -48,7 +48,6 @@ public interface ECPrivateKey extends PrivateKey, ECKey { * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = -7896394956925609184L; diff --git a/src/java.base/share/classes/java/security/interfaces/ECPublicKey.java b/src/java.base/share/classes/java/security/interfaces/ECPublicKey.java index d78f863cc76..5cfdab999b1 100644 --- a/src/java.base/share/classes/java/security/interfaces/ECPublicKey.java +++ b/src/java.base/share/classes/java/security/interfaces/ECPublicKey.java @@ -50,7 +50,6 @@ public interface ECPublicKey extends PublicKey, ECKey { * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = -3314988629879632826L; diff --git a/src/java.base/share/classes/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java b/src/java.base/share/classes/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java index a523d36ac70..a15d6db4133 100644 --- a/src/java.base/share/classes/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java +++ b/src/java.base/share/classes/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java @@ -57,7 +57,6 @@ public interface RSAMultiPrimePrivateCrtKey extends RSAPrivateKey { * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = 618058533534628008L; diff --git a/src/java.base/share/classes/java/security/interfaces/RSAPrivateCrtKey.java b/src/java.base/share/classes/java/security/interfaces/RSAPrivateCrtKey.java index 7a8bea29e7e..025145fa625 100644 --- a/src/java.base/share/classes/java/security/interfaces/RSAPrivateCrtKey.java +++ b/src/java.base/share/classes/java/security/interfaces/RSAPrivateCrtKey.java @@ -52,7 +52,6 @@ public interface RSAPrivateCrtKey extends RSAPrivateKey { * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = -5682214253527700368L; diff --git a/src/java.base/share/classes/java/security/interfaces/RSAPrivateKey.java b/src/java.base/share/classes/java/security/interfaces/RSAPrivateKey.java index 8f74b476f99..dad9b375e00 100644 --- a/src/java.base/share/classes/java/security/interfaces/RSAPrivateKey.java +++ b/src/java.base/share/classes/java/security/interfaces/RSAPrivateKey.java @@ -50,7 +50,6 @@ public interface RSAPrivateKey extends java.security.PrivateKey, RSAKey * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = 5187144804936595022L; diff --git a/src/java.base/share/classes/java/security/interfaces/RSAPublicKey.java b/src/java.base/share/classes/java/security/interfaces/RSAPublicKey.java index a02b454abb2..03fe109db5d 100644 --- a/src/java.base/share/classes/java/security/interfaces/RSAPublicKey.java +++ b/src/java.base/share/classes/java/security/interfaces/RSAPublicKey.java @@ -47,7 +47,6 @@ public interface RSAPublicKey extends java.security.PublicKey, RSAKey * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = -8727434096241101194L; diff --git a/src/java.base/share/classes/javax/crypto/SecretKey.java b/src/java.base/share/classes/javax/crypto/SecretKey.java index 6dd6a9be19a..5fa6f7fd44d 100644 --- a/src/java.base/share/classes/javax/crypto/SecretKey.java +++ b/src/java.base/share/classes/javax/crypto/SecretKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -68,6 +68,5 @@ public interface SecretKey extends * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") long serialVersionUID = -4795878709595146952L; } diff --git a/src/java.base/share/classes/javax/crypto/interfaces/DHPrivateKey.java b/src/java.base/share/classes/javax/crypto/interfaces/DHPrivateKey.java index 49a93c02b42..8a252c7f82b 100644 --- a/src/java.base/share/classes/javax/crypto/interfaces/DHPrivateKey.java +++ b/src/java.base/share/classes/javax/crypto/interfaces/DHPrivateKey.java @@ -47,7 +47,6 @@ public interface DHPrivateKey extends DHKey, java.security.PrivateKey { * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = 2211791113380396553L; diff --git a/src/java.base/share/classes/javax/crypto/interfaces/DHPublicKey.java b/src/java.base/share/classes/javax/crypto/interfaces/DHPublicKey.java index 631d8a20e66..f1a748cff24 100644 --- a/src/java.base/share/classes/javax/crypto/interfaces/DHPublicKey.java +++ b/src/java.base/share/classes/javax/crypto/interfaces/DHPublicKey.java @@ -47,7 +47,6 @@ public interface DHPublicKey extends DHKey, java.security.PublicKey { * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = -6628103563352519193L; diff --git a/src/java.base/share/classes/javax/crypto/interfaces/PBEKey.java b/src/java.base/share/classes/javax/crypto/interfaces/PBEKey.java index 20f1e64798f..162d4d85b45 100644 --- a/src/java.base/share/classes/javax/crypto/interfaces/PBEKey.java +++ b/src/java.base/share/classes/javax/crypto/interfaces/PBEKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * 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,6 @@ public interface PBEKey extends javax.crypto.SecretKey { * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = -1430015993304333921L; diff --git a/src/java.base/share/classes/module-info.java b/src/java.base/share/classes/module-info.java index 7486fdd825c..614842e064c 100644 --- a/src/java.base/share/classes/module-info.java +++ b/src/java.base/share/classes/module-info.java @@ -155,7 +155,6 @@ exports jdk.internal.javac to java.compiler, java.desktop, // for ScopedValue - java.se, // for ParticipatesInPreview jdk.compiler, jdk.incubator.vector, // participates in preview features jdk.jartool, // participates in preview features 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 12ab942f91f..1f922b4cf73 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 @@ -24,22 +24,25 @@ # # Translators please note do not translate the options themselves -java.launcher.opt.header = Verwendung: {0} [Optionen] [args...]\n (zur Ausführung einer Klasse)\n oder {0} [Optionen] -jar [args...]\n (zur Ausführung einer JAR-Datei)\n oder {0} [Optionen] -m [/] [args...]\n {0} [Optionen] --module [/] [args...]\n (zur Ausführung der Hauptklasse in einem Modul)\n oder {0} [Optionen] [args]\n (zur Ausführung eines Programms mit einer Quelldatei)\n\n Argumente, die auf die Hauptklasse, die Quelldatei, -jar , -m oder --module\n / folgen, werden als Argumente für die\nHauptklasse übergeben.\n\n Dabei umfasst "Optionen" Folgendes:\n\n +java.launcher.opt.header = Verwendung: {0} [Optionen] [Argumente...]\n (zur Ausführung einer Klasse)\n oder {0} [Optionen] -jar .jar [Argumente...]\n (zur Ausführung einer JAR-Datei)\n oder {0} [Optionen] -m [/] [Argumente...]\n {0} [Optionen] --module [/] [Argumente...]\n (zur Ausführung der Hauptklasse in einem Modul)\n oder {0} [Optionen] .java [Argumente]\n (zur Ausführung eines Programms mit einer Quelldatei)\n\n Argumente, die auf die Hauptklasse, die Quelldatei, -jar .jar, -m oder --module\n / folgen, werden als Argumente für die\nHauptklasse übergeben.\n\n Dabei umfasst "Optionen" Folgendes:\n\n 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\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\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 --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 --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 -Xfuture Aktiviert strengste Prüfungen, als möglicher zukünftiger Standardwert erwartet.\n Diese Option ist veraltet und kann in einem\n zukünftigen Release entfernt werden.\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 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 Beachten Sie, dass die Option -Xverify:none veraltet ist und\n in einem zukünftigen Release entfernt werden kann.\n --add-reads =(,)*\n Aktualisiert , damit gelesen wird, ungeachtet\n der Moduldeklaration. \n kann ALL-UNNAMED sein, um alle unbenannten\n Module zu lesen.\n --add-exports /=(,)*\n Aktualisiert , um in zu exportieren,\n ungeachtet der Moduldeklaration.\n kann ALL-UNNAMED sein, um in alle\n unbenannten Module zu exportieren.\n --add-opens /=(,)*\n Aktualisiert , um in\n zu öffnen, ungeachtet der Moduldeklaration.\n --limit-modules [,...]\n Grenzt die Gesamtmenge der beobachtbaren Module ein\n --patch-module =({0})*\n Überschreibt oder erweitert ein Modul mit Klassen und Ressourcen\n in JAR-Dateien oder Verzeichnissen.\n --source \n Legt die Version der Quelle im Quelldateimodus fest.\n --finalization=\n Steuert, ob die JVM Objekte finalisiert.\n Dabei ist entweder "enabled" oder "disabled".\n Die Finalisierung ist standardmäßig aktiviert.\n --sun-misc-unsafe-memory-access=\n Verwendung der nicht unterstützten API sun.misc.Unsafe zulassen oder verweigern\n ist "allow", "warn", "debug" oder "deny".\n Der Standardwert ist "allow".\n\nDiese zusätzlichen Optionen können jederzeit ohne vorherige Ankündigung geändert werden.\n +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 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 \ + Beachten Sie, dass die Option -Xverify:none veraltet ist und\n in einem zukünftigen Release entfernt werden kann.\n --add-reads =(,)*\n Aktualisiert , damit gelesen wird, ungeachtet\n der Moduldeklaration. \n kann ALL-UNNAMED sein, um alle unbenannten\n Module zu lesen.\n --add-exports /=(,)*\n Aktualisiert , um in zu exportieren,\n ungeachtet der Moduldeklaration.\n kann ALL-UNNAMED sein, um in alle\n unbenannten Module zu exportieren.\n --add-opens /=(,)*\n Aktualisiert , um in\n zu öffnen, ungeachtet der Moduldeklaration.\n --limit-modules [,...]\n Grenzt die Gesamtmenge der beobachtbaren Module ein\n --patch-module =({0})*\n Überschreibt oder erweitert ein Modul mit Klassen und Ressourcen\n in JAR-Dateien oder Verzeichnissen.\n --source \n Legt die Version der Quelle im Quelldateimodus fest.\n --finalization=\n Steuert, ob die JVM Objekte finalisiert.\n Dabei ist entweder "enabled" oder "disabled".\n Die Finalisierung ist standardmäßig aktiviert.\n --sun-misc-unsafe-memory-access=\n Verwendung der nicht unterstützten API sun.misc.Unsafe zulassen oder verweigern\n ist "allow", "warn", "debug" oder "deny".\n Der Standardwert ist "warn".\n\nDiese zusätzlichen Optionen können jederzeit ohne vorherige Ankündigung geändert werden.\n # Translators please note do not translate the options themselves java.launcher.X.macosx.usage=\nDie folgenden Optionen sind für macOS spezifisch:\n -XstartOnFirstThread\n Führt die main()-Methode für den ersten (AppKit-)Thread aus\n -Xdock:name=\n Setzt den im Dock angezeigten Standardanwendungsnamen außer Kraft\n -Xdock:icon=\n Setzt das im Dock angezeigte Standardsymbol außer Kraft\n\n +# Translators please note do not translate the options themselves +java.launcher.opt.concise.header = Verwendung: java [Java-Optionen...] [Anwendungsargumente...]\n\nDabei ist einer der folgenden Werte:\n Zum Ausführen der Hauptmethode einer kompilierten Hauptklasse\n -jar .jar Zum Ausführen der Hauptklasse eines JAR-Archivs\n -m [/] Zum Ausführen der Hauptklasse eines Moduls\n .java Zum Kompilieren und Ausführen eines Quelldateiprogramms\n\nDabei sind die folgenden wichtigen Java-Optionen verfügbar:\n --class-path \n ist eine durch "{0}" getrennte Liste der Verzeichnisse und JAR-Archive, in denen nach Klassendateien gesucht werden soll\n --module-path \n ist eine durch "{0}" getrennte Liste der Verzeichnisse und JAR-Archive, in denen nach Modulen gesucht werden soll\n -version\n Zum Ausgeben der Produktversion in den Fehlerstream und Beenden des Vorgangs\n\nFür weitere Verwendungshilfe: java --help\nFür eine interaktive Java-Umgebung: jshell + java.launcher.bad.option=\nNicht erkannte showSettings-Option: {0}\nGültige Werte: "all", "locale", "properties", "security", "system"(nur Linux), "vm"\nGültige Werte für Unteroption "security": "all", "properties", "providers", "tls"\nSiehe "java -X"\n java.launcher.cls.error1=Fehler: Hauptklasse {0} konnte nicht gefunden oder geladen werden\nUrsache: {1}: {2} java.launcher.cls.error2=Fehler: Hauptmethode in Klasse {0} nicht gefunden. Definieren Sie die Hauptmethode als:\n public static void main(String[] args):\noder eine JavaFX-Anwendung muss {1} erweitern 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 5d5223d49c6..c6f1b8b330a 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 @@ -24,24 +24,27 @@ # # Translators please note do not translate the options themselves -java.launcher.opt.header = 使用方法: {0} [options] [args...]\n (クラスを実行する場合)\n または {0} [options] -jar [args...]\n (jarファイルを実行する場合)\n または {0} [options] -m [/] [args...]\n {0} [options] --module [/] [args...]\n (モジュールのメイン・クラスを実行する場合)\n または {0} [options] [args]\n (ソースファイル・プログラムを実行する場合)\n\n メイン・クラス、ソース・ファイル、-jar 、\n -mまたは--module /に続く引数は、メイン・クラスへの引数として\n 渡されます。\n\n オプションは次のとおりです:\n\n +java.launcher.opt.header = 使用方法: {0} [options] [args...]\n (クラスを実行する場合)\n または {0} [options] -jar .jar [args...]\n (jarファイルを実行する場合)\n または {0} [options] -m [/] [args...]\n {0} [options] --module [/] [args...]\n (モジュールのメイン・クラスを実行する場合)\n または {0} [options] .java [args]\n (ソースファイル・プログラムを実行する場合)\n\n メイン・クラス、ソース・ファイル、-jar .jar、\n-mまたは--module /に続く引数は、メイン・クラスへの引数として\n渡されます。\n\n オプションは次のとおりです:\n\n 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 --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 +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 # 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 -Xfuture 将来のデフォルトを見越して、最も厳密なチェックを有効にします\n このオプションは非推奨であり、将来のリリースで削除される\n 可能性があります。\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 これはテスト・オプションであり、断続的な失敗につながる\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関連のセキュリティ設定を表示して続行します\n -XshowSettings:system\n (Linuxのみ)ホスト・システムまたはコンテナを表示します\n 構成して続行します\n -Xss javaスレッドのスタック・サイズを設定します\n 実際のサイズは、次の倍数に切り上げられる場合があります: \n オペレーティング・システムの要件に応じたシステム・ページ・サイズ。\n -Xverify バイトコード・ベリファイアのモードを設定します\n オプション-Xverify:noneは非推奨になり、\n 将来のリリースで削除される可能性があります。\n --add-reads =(,)*\n モジュール宣言に関係なく、を更新してを\n \ -読み取ります。 \n をALL-UNNAMEDに設定すると、すべての名前のないモジュールを\n 読み取ることができます。\n --add-exports /=(,)*\n モジュール宣言に関係なく、を更新してに\n エクスポートします。\n をALL-UNNAMEDに設定すると、すべての名前のないモジュールに\n エクスポートできます。\n --add-opens /=(,)*\n モジュール宣言に関係なく、を更新してを\n に開きます。\n --limit-modules [,...]\n 参照可能なモジュールの領域を制限します\n --patch-module =({0})*\n JARファイルまたはディレクトリのクラスおよびリソースで\n モジュールをオーバーライドまたは拡張します。\n --source \n ソースファイル・モードでソースのバージョンを設定します。\n --finalization=\n JVMがオブジェクトのファイナライズを実行するかどうかを制御します\n は"enabled"または"disabled"のいずれかです。\n ファイナライズはデフォルトで有効になっています。\n --sun-misc-unsafe-memory-access=\n サポートされていないAPI sun.misc.Unsafeの使用を許可または拒否します\n は"allow"、"warn"、"debug"または"deny"のいずれかです。\n デフォルト値は、"allow"です。\n\nこの追加オプションは予告なしに変更されることがあります。\n +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 \ +これはテスト・オプションであり、断続的な失敗につながる\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関連のセキュリティ設定を表示して続行します\n -XshowSettings:system\n (Linuxのみ)ホスト・システムまたはコンテナを表示します\n 構成して続行します\n -Xss javaスレッドのスタック・サイズを設定します\n 実際のサイズは、次の倍数に切り上げられる場合があります: \n オペレーティング・システムの要件に応じたシステム・ページ・サイズ。\n -Xverify バイトコード・ベリファイアのモードを設定します\n オプション-Xverify:noneは非推奨になり、\n 将来のリリースで削除される可能性があります。\n --add-reads =(,)*\n モジュール宣言に関係なく、を更新してを\n 読み取ります。 \n をALL-UNNAMEDに設定すると、すべての名前のないモジュールを\n 読み取ることができます。\n --add-exports \ +/=(,)*\n モジュール宣言に関係なく、を更新してに\n エクスポートします。\n をALL-UNNAMEDに設定すると、すべての名前のないモジュールに\n エクスポートできます。\n --add-opens /=(,)*\n モジュール宣言に関係なく、を更新してを\n に開きます。\n --limit-modules [,...]\n 参照可能なモジュールの領域を制限します\n --patch-module =({0})*\n JARファイルまたはディレクトリのクラスおよびリソースで\n モジュールをオーバーライドまたは拡張します。\n --source \n ソースファイル・モードでソースのバージョンを設定します。\n --finalization=\n JVMがオブジェクトのファイナライズを実行するかどうかを制御します\n は"enabled"または"disabled"のいずれかです。\n ファイナライズはデフォルトで有効になっています。\n --sun-misc-unsafe-memory-access=\n サポートされていないAPI sun.misc.Unsafeの使用を許可または拒否します\n は"allow"、"warn"、"debug"または"deny"のいずれかです。\n デフォルト値は"warn"です。\n\nこの追加オプションは予告なしに変更されることがあります。\n # Translators please note do not translate the options themselves java.launcher.X.macosx.usage=\n次のオプションはmacOS固有です:\n -XstartOnFirstThread\n main()メソッドを最初(AppKit)のスレッドで実行する\n -Xdock:name=\n Dockに表示されるデフォルト・アプリケーション名をオーバーライドする\n -Xdock:icon=\n Dockに表示されるデフォルト・アイコンをオーバーライドする\n\n +# Translators please note do not translate the options themselves +java.launcher.opt.concise.header = 使用方法: java [java options...] [application arguments...]\n\nは次のいずれかです:\n コンパイルされたメイン・クラスのメイン・メソッドを実行します\n -jar .jar JARアーカイブのメイン・クラスを実行します\n -m [/] モジュールのメイン・クラスを実行します\n .java ソースファイル・プログラムをコンパイルおよび実行します\n\n主要なjavaオプションには次が含まれます:\n --class-path \n は、クラス・ファイルを検索するためのディレクトリおよびJARアーカイブのリストであり、"{0}"で区切られます\n --module-path \n は、モジュールを検索するためのディレクトリおよびJARアーカイブのリストであり、"{0}"で区切られます\n -version\n 製品バージョンをエラー・ストリームに出力し終了します\n\n使用方法についての追加のヘルプの場合: java --help\n対話型のJava環境の場合: jshell + java.launcher.bad.option=\n認識されないshowSettingsオプション: {0}\n有効な値は"all"、"locale"、"properties"、"security"、"system"(Linuxのみ)、"vm"\n有効な"security"サブオプションの値は"all"、"properties"、"providers"、"tls"\n"java -X"を参照してください\n java.launcher.cls.error1=エラー: メイン・クラス{0}を検出およびロードできませんでした\n原因: {1}: {2} java.launcher.cls.error2=エラー: メイン・メソッドがクラス{0}で見つかりません。次のようにメイン・メソッドを定義してください。\n public static void main(String[] args)\nまたはJavaFXアプリケーション・クラスは{1}を拡張する必要があります 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 c156e234cef..56d774b47db 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 @@ -24,22 +24,25 @@ # # Translators please note do not translate the options themselves -java.launcher.opt.header = 用法:{0} [options] [args...]\n (执行类)\n 或 {0} [options] -jar [args...]\n (执行 jar 文件)\n 或 {0} [options] -m [/] [args...]\n {0} [options] --module [/] [args...]\n (执行模块中的主类)\n 或 {0} [options] [args]\n (执行源文件程序)\n\n 将主类、源文件、-jar 、-m 或\n --module / 后的参数作为参数\n 传递到主类。\n\n 其中,选项包括:\n\n +java.launcher.opt.header = 用法:{0} [options] [args...]\n (执行类)\n 或 {0} [options] -jar .jar [args...]\n (执行 jar 文件)\n 或 {0} [options] -m [/] [args...]\n {0} [options] --module [/] [args...]\n (执行模块中的主类)\n 或 {0} [options] .java [args]\n (执行源文件程序)\n\n 将主类、源文件、-jar .jar、-m 或\n --module / 后的参数作为参数\n 传递到主类。\n\n 其中,选项包括:\n\n 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 --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 --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 -Xfuture 启用最严格的检查,预期将来的默认值。\n 此选项已过时,可能会在\n 未来发行版中删除。\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 相关的安全设置并继续\n -XshowSettings:system\n (仅 Linux)显示主机系统或容器\n 配置并继续\n -Xss 设置 Java 线程堆栈大小\n 实际大小可以舍入到\n 操作系统要求的系统页面大小的倍数。\n -Xverify 设置字节码验证器的模式\n 请注意,选项 -Xverify:none 已过时,\n 可能会在未来发行版中删除。\n --add-reads =(,)*\n 更新 以读取 ,而无论\n 模块如何声明。 \n 可以是 ALL-UNNAMED,将读取所有未命名\n 模块。\n --add-exports /=(,)*\n 更新 以将 导出到 ,\n 而无论模块如何声明。\n 可以是 ALL-UNNAMED,将导出到所有\n 未命名模块。\n --add-opens /=(,)*\n 更新 以在 中打开\n ,而无论模块如何声明。\n --limit-modules [,...]\n 限制可观察模块的领域\n --patch-module =({0})*\n 使用 JAR 文件或目录中的类和资源\n 覆盖或增强模块。\n --source \n 设置源文件模式中源的版本。\n --finalization=\n 控制 JVM 是否执行对象最终处理,\n 其中 为 "enabled" 或 "disabled" 之一。\n 默认情况下,最终处理处于启用状态。\n --sun-misc-unsafe-memory-access=\n 允许或拒绝使用不受支持的 API sun.misc.Unsafe\n 为 "allow"、"warn"、"debug" 或 "deny" 之一。\n 默认值为 "allow"。\n\n这些额外选项如有更改, 恕不另行通知。\n +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 \ +相关的安全设置并继续\n -XshowSettings:system\n (仅 Linux)显示主机系统或容器\n 配置并继续\n -Xss 设置 Java 线程堆栈大小\n 实际大小可以舍入到\n 操作系统要求的系统页面大小的倍数。\n -Xverify 设置字节码验证器的模式\n 请注意,选项 -Xverify:none 已过时,\n 可能会在未来发行版中删除。\n --add-reads =(,)*\n 更新 以读取 ,而无论\n 模块如何声明。 \n 可以是 ALL-UNNAMED,将读取所有未命名\n 模块。\n --add-exports /=(,)*\n 更新 以将 导出到 ,\n 而无论模块如何声明。\n 可以是 ALL-UNNAMED,将导出到所有\n 未命名模块。\n --add-opens /=(,)*\n 更新 以在 中打开\n ,而无论模块如何声明。\n --limit-modules [,...]\n 限制可观察模块的领域\n --patch-module =({0})*\n 使用 JAR 文件或目录中的类和资源\n 覆盖或增强模块。\n --source \n 设置源文件模式中源的版本。\n --finalization=\n 控制 JVM 是否执行对象最终处理,\n 其中 为 "enabled" 或 "disabled" 之一。\n 默认情况下,最终处理处于启用状态。\n --sun-misc-unsafe-memory-access=\n 允许或拒绝使用不受支持的 API sun.misc.Unsafe\n 为 "allow"、"warn"、"debug" 或 "deny" 之一。\n 默认值为 "warn"。\n\n这些额外选项如有更改, 恕不另行通知。\n # Translators please note do not translate the options themselves java.launcher.X.macosx.usage=\n以下选项是特定于 macOS 的选项:\n -XstartOnFirstThread\n 在第一个 (AppKit) 线程上运行 main() 方法\n -Xdock:name=\n 覆盖停靠栏中显示的默认应用程序名称\n -Xdock:icon=\n 覆盖停靠栏中显示的默认图标\n\n +# Translators please note do not translate the options themselves +java.launcher.opt.concise.header = 用法:java [java options...] [application arguments...]\n\n其中, 为以下项之一:\n 执行编译的主类的 main 方法\n -jar .jar 执行 JAR 档案的主类\n -m [/] 执行模块的主类\n .java 编译和执行源文件程序\n\n其中,主要的 java 选项包括:\n --class-path \n 其中, 是用于搜索类文件的目录和 JAR 档案列表(以 "{0}" 分隔)\n --module-path \n 其中, 是用于搜索模块的目录和 JAR 档案列表(以 "{0}" 分隔)\n -version\n 将产品版本输出到错误流并退出\n\n获取有关用法的其他帮助: java --help\n获取交互式 Java 环境: jshell + java.launcher.bad.option=\n无法识别的 showSettings 选项:{0}\n有效值为 "all"、"locale"、"properties"、"security"、"system"(仅 Linux)、"vm"\n有效的 "security" 子选项值为 "all"、"properties"、"providers"、"tls"\n请参见 "java -X"\n java.launcher.cls.error1=错误: 找不到或无法加载主类 {0}\n原因: {1}: {2} java.launcher.cls.error2=错误: 在类 {0} 中找不到 main 方法, 请将 main 方法定义为:\n public static void main(String[] args)\n否则 JavaFX 应用程序类必须扩展{1} diff --git a/src/java.base/share/classes/sun/security/internal/interfaces/TlsMasterSecret.java b/src/java.base/share/classes/sun/security/internal/interfaces/TlsMasterSecret.java index 2f91a445ace..36306c26862 100644 --- a/src/java.base/share/classes/sun/security/internal/interfaces/TlsMasterSecret.java +++ b/src/java.base/share/classes/sun/security/internal/interfaces/TlsMasterSecret.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * 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,7 +49,6 @@ public interface TlsMasterSecret extends SecretKey { * ineffectual. Do not use; no replacement. */ @Deprecated - @SuppressWarnings("serial") @java.io.Serial long serialVersionUID = -461748105810469773L; diff --git a/src/java.base/share/classes/sun/security/jca/ProviderConfig.java b/src/java.base/share/classes/sun/security/jca/ProviderConfig.java index ce954b3b6a5..830b18e8fef 100644 --- a/src/java.base/share/classes/sun/security/jca/ProviderConfig.java +++ b/src/java.base/share/classes/sun/security/jca/ProviderConfig.java @@ -149,7 +149,6 @@ public String toString() { /** * Get the provider object. Loads the provider if it is not already loaded. */ - @SuppressWarnings("deprecation") Provider getProvider() { // volatile variable load Provider p = provider; diff --git a/src/java.base/share/classes/sun/security/util/Resources_de.java b/src/java.base/share/classes/sun/security/util/Resources_de.java index 57e2c8da863..0ff218d6390 100644 --- a/src/java.base/share/classes/sun/security/util/Resources_de.java +++ b/src/java.base/share/classes/sun/security/util/Resources_de.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,8 +59,6 @@ public class Resources_de extends java.util.ListResourceBundle { // javax.security.auth.Subject {"NEWLINE", "\n"}, - {"invalid.null.AccessControlContext.provided", - "Ung\u00FCltiger Nullwert f\u00FCr AccessControlContext angegeben"}, {"invalid.null.action.provided", "Ung\u00FCltige Nullaktion angegeben"}, {"invalid.null.Class.provided", "Ung\u00FCltige Nullklasse angegeben"}, {"Subject.", "Subjekt:\n"}, @@ -90,40 +88,9 @@ public class Resources_de extends java.util.ListResourceBundle { {"Login.Failure.all.modules.ignored", "Anmeldefehler: Alle Module werden ignoriert"}, - // sun.security.provider.PolicyFile - - {"java.security.policy.error.parsing.policy.message", - "java.security.policy: Fehler beim Parsen von {0}:\n\t{1}"}, - {"java.security.policy.error.adding.Permission.perm.message", - "java.security.policy: Fehler beim Hinzuf\u00FCgen von Berechtigung, {0}:\n\t{1}"}, - {"java.security.policy.error.adding.Entry.message", - "java.security.policy: Fehler beim Hinzuf\u00FCgen von Eintrag:\n\t{0}"}, - {"alias.name.not.provided.pe.name.", "Aliasname nicht angegeben ({0})"}, - {"unable.to.perform.substitution.on.alias.suffix", - "Substitution f\u00FCr Alias {0} kann nicht ausgef\u00FChrt werden"}, - {"substitution.value.prefix.unsupported", - "Substitutionswert {0} nicht unterst\u00FCtzt"}, - {"SPACE", " "}, - {"LPARAM", "("}, - {"RPARAM", ")"}, - {"type.can.t.be.null","Typ kann nicht null sein"}, - // sun.security.provider.PolicyParser - {"keystorePasswordURL.can.not.be.specified.without.also.specifying.keystore", - "keystorePasswordURL kann nicht ohne Keystore angegeben werden"}, - {"expected.keystore.type", "Keystore-Typ erwartet"}, - {"expected.keystore.provider", "Keystore-Provider erwartet"}, - {"multiple.Codebase.expressions", - "mehrere Codebase-Ausdr\u00FCcke"}, - {"multiple.SignedBy.expressions","mehrere SignedBy-Ausdr\u00FCcke"}, {"duplicate.keystore.domain.name","Keystore-Domainname doppelt vorhanden: {0}"}, {"duplicate.keystore.name","Keystore-Name doppelt vorhanden: {0}"}, - {"SignedBy.has.empty.alias","Leerer Alias in SignedBy"}, - {"can.not.specify.Principal.with.a.wildcard.class.without.a.wildcard.name", - "Principal kann nicht mit einer Platzhalterklasse ohne Platzhalternamen angegeben werden"}, - {"expected.codeBase.or.SignedBy.or.Principal", - "codeBase oder SignedBy oder Principal erwartet"}, - {"expected.permission.entry", "Berechtigungseintrag erwartet"}, {"number.", "Nummer "}, {"expected.expect.read.end.of.file.", "[{0}] erwartet, [Dateiende] gelesen"}, @@ -132,8 +99,6 @@ public class Resources_de extends java.util.ListResourceBundle { {"line.number.msg", "Zeile {0}: {1}"}, {"line.number.expected.expect.found.actual.", "Zeile {0}: [{1}] erwartet, [{2}] gefunden"}, - {"null.principalClass.or.principalName", - "principalClass oder principalName null"}, // sun.security.pkcs11.SunPKCS11 {"PKCS11.Token.providerName.Password.", diff --git a/src/java.base/share/classes/sun/security/util/Resources_ja.java b/src/java.base/share/classes/sun/security/util/Resources_ja.java index 1293a48aabc..3cf3b91a62a 100644 --- a/src/java.base/share/classes/sun/security/util/Resources_ja.java +++ b/src/java.base/share/classes/sun/security/util/Resources_ja.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,8 +59,6 @@ public class Resources_ja extends java.util.ListResourceBundle { // javax.security.auth.Subject {"NEWLINE", "\n"}, - {"invalid.null.AccessControlContext.provided", - "\u7121\u52B9\u306Anull AccessControlContext\u304C\u6307\u5B9A\u3055\u308C\u307E\u3057\u305F"}, {"invalid.null.action.provided", "\u7121\u52B9\u306Anull\u30A2\u30AF\u30B7\u30E7\u30F3\u304C\u6307\u5B9A\u3055\u308C\u307E\u3057\u305F"}, {"invalid.null.Class.provided", "\u7121\u52B9\u306Anull\u30AF\u30E9\u30B9\u304C\u6307\u5B9A\u3055\u308C\u307E\u3057\u305F"}, {"Subject.", "\u30B5\u30D6\u30B8\u30A7\u30AF\u30C8:\n"}, @@ -90,40 +88,9 @@ public class Resources_ja extends java.util.ListResourceBundle { {"Login.Failure.all.modules.ignored", "\u30ED\u30B0\u30A4\u30F3\u5931\u6557: \u3059\u3079\u3066\u306E\u30E2\u30B8\u30E5\u30FC\u30EB\u306F\u7121\u8996\u3055\u308C\u307E\u3059"}, - // sun.security.provider.PolicyFile - - {"java.security.policy.error.parsing.policy.message", - "java.security.policy: {0}\u306E\u69CB\u6587\u89E3\u6790\u30A8\u30E9\u30FC:\n\t{1}"}, - {"java.security.policy.error.adding.Permission.perm.message", - "java.security.policy: \u30A2\u30AF\u30BB\u30B9\u6A29{0}\u306E\u8FFD\u52A0\u30A8\u30E9\u30FC:\n\t{1}"}, - {"java.security.policy.error.adding.Entry.message", - "java.security.policy: \u30A8\u30F3\u30C8\u30EA\u306E\u8FFD\u52A0\u30A8\u30E9\u30FC:\n\t{0}"}, - {"alias.name.not.provided.pe.name.", "\u5225\u540D\u306E\u6307\u5B9A\u304C\u3042\u308A\u307E\u305B\u3093({0})"}, - {"unable.to.perform.substitution.on.alias.suffix", - "\u5225\u540D{0}\u306B\u5BFE\u3057\u3066\u7F6E\u63DB\u64CD\u4F5C\u304C\u3067\u304D\u307E\u305B\u3093"}, - {"substitution.value.prefix.unsupported", - "\u7F6E\u63DB\u5024{0}\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093"}, - {"SPACE", " "}, - {"LPARAM", "("}, - {"RPARAM", ")"}, - {"type.can.t.be.null","\u5165\u529B\u3092null\u306B\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093"}, - // sun.security.provider.PolicyParser - {"keystorePasswordURL.can.not.be.specified.without.also.specifying.keystore", - "\u30AD\u30FC\u30B9\u30C8\u30A2\u3092\u6307\u5B9A\u3057\u306A\u3044\u5834\u5408\u3001keystorePasswordURL\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093"}, - {"expected.keystore.type", "\u4E88\u60F3\u3055\u308C\u305F\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30BF\u30A4\u30D7"}, - {"expected.keystore.provider", "\u4E88\u60F3\u3055\u308C\u305F\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30D7\u30ED\u30D0\u30A4\u30C0"}, - {"multiple.Codebase.expressions", - "\u8907\u6570\u306ECodebase\u5F0F"}, - {"multiple.SignedBy.expressions","\u8907\u6570\u306ESignedBy\u5F0F"}, {"duplicate.keystore.domain.name","\u91CD\u8907\u3059\u308B\u30AD\u30FC\u30B9\u30C8\u30A2\u30FB\u30C9\u30E1\u30A4\u30F3\u540D: {0}"}, {"duplicate.keystore.name","\u91CD\u8907\u3059\u308B\u30AD\u30FC\u30B9\u30C8\u30A2\u540D: {0}"}, - {"SignedBy.has.empty.alias","SignedBy\u306F\u7A7A\u306E\u5225\u540D\u3092\u4FDD\u6301\u3057\u307E\u3059"}, - {"can.not.specify.Principal.with.a.wildcard.class.without.a.wildcard.name", - "\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u540D\u306E\u306A\u3044\u30EF\u30A4\u30EB\u30C9\u30AB\u30FC\u30C9\u30FB\u30AF\u30E9\u30B9\u3092\u4F7F\u7528\u3057\u3066\u3001\u30D7\u30EA\u30F3\u30B7\u30D1\u30EB\u3092\u6307\u5B9A\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093"}, - {"expected.codeBase.or.SignedBy.or.Principal", - "\u4E88\u60F3\u3055\u308C\u305FcodeBase\u3001SignedBy\u307E\u305F\u306FPrincipal"}, - {"expected.permission.entry", "\u4E88\u60F3\u3055\u308C\u305F\u30A2\u30AF\u30BB\u30B9\u6A29\u30A8\u30F3\u30C8\u30EA"}, {"number.", "\u6570 "}, {"expected.expect.read.end.of.file.", "[{0}]\u3067\u306F\u306A\u304F[\u30D5\u30A1\u30A4\u30EB\u306E\u7D42\u308F\u308A]\u304C\u8AAD\u307F\u8FBC\u307E\u308C\u307E\u3057\u305F"}, @@ -132,8 +99,6 @@ public class Resources_ja extends java.util.ListResourceBundle { {"line.number.msg", "\u884C{0}: {1}"}, {"line.number.expected.expect.found.actual.", "\u884C{0}: [{1}]\u3067\u306F\u306A\u304F[{2}]\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F"}, - {"null.principalClass.or.principalName", - "null\u306EprincipalClass\u307E\u305F\u306FprincipalName"}, // sun.security.pkcs11.SunPKCS11 {"PKCS11.Token.providerName.Password.", diff --git a/src/java.base/share/classes/sun/security/util/Resources_zh_CN.java b/src/java.base/share/classes/sun/security/util/Resources_zh_CN.java index 5376ff5efd3..b4f8f7b49df 100644 --- a/src/java.base/share/classes/sun/security/util/Resources_zh_CN.java +++ b/src/java.base/share/classes/sun/security/util/Resources_zh_CN.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,8 +59,6 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { // javax.security.auth.Subject {"NEWLINE", "\n"}, - {"invalid.null.AccessControlContext.provided", - "\u63D0\u4F9B\u4E86\u65E0\u6548\u7684\u7A7A AccessControlContext"}, {"invalid.null.action.provided", "\u63D0\u4F9B\u4E86\u65E0\u6548\u7684\u7A7A\u64CD\u4F5C"}, {"invalid.null.Class.provided", "\u63D0\u4F9B\u4E86\u65E0\u6548\u7684\u7A7A\u7C7B"}, {"Subject.", "\u4E3B\u4F53: \n"}, @@ -90,40 +88,9 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {"Login.Failure.all.modules.ignored", "\u767B\u5F55\u5931\u8D25: \u5FFD\u7565\u6240\u6709\u6A21\u5757"}, - // sun.security.provider.PolicyFile - - {"java.security.policy.error.parsing.policy.message", - "java.security.policy: \u89E3\u6790{0}\u65F6\u51FA\u9519:\n\t{1}"}, - {"java.security.policy.error.adding.Permission.perm.message", - "java.security.policy: \u6DFB\u52A0\u6743\u9650{0}\u65F6\u51FA\u9519:\n\t{1}"}, - {"java.security.policy.error.adding.Entry.message", - "java.security.policy: \u6DFB\u52A0\u6761\u76EE\u65F6\u51FA\u9519:\n\t{0}"}, - {"alias.name.not.provided.pe.name.", "\u672A\u63D0\u4F9B\u522B\u540D ({0})"}, - {"unable.to.perform.substitution.on.alias.suffix", - "\u65E0\u6CD5\u5728\u522B\u540D {0} \u4E0A\u6267\u884C\u66FF\u4EE3"}, - {"substitution.value.prefix.unsupported", - "\u66FF\u4EE3\u503C{0}\u4E0D\u53D7\u652F\u6301"}, - {"SPACE", " "}, - {"LPARAM", "("}, - {"RPARAM", ")"}, - {"type.can.t.be.null","\u7C7B\u578B\u4E0D\u80FD\u4E3A\u7A7A\u503C"}, - // sun.security.provider.PolicyParser - {"keystorePasswordURL.can.not.be.specified.without.also.specifying.keystore", - "\u4E0D\u6307\u5B9A\u5BC6\u94A5\u5E93\u65F6\u65E0\u6CD5\u6307\u5B9A keystorePasswordURL"}, - {"expected.keystore.type", "\u5E94\u4E3A\u5BC6\u94A5\u5E93\u7C7B\u578B"}, - {"expected.keystore.provider", "\u5E94\u4E3A\u5BC6\u94A5\u5E93\u63D0\u4F9B\u65B9"}, - {"multiple.Codebase.expressions", - "\u591A\u4E2A\u4EE3\u7801\u5E93\u8868\u8FBE\u5F0F"}, - {"multiple.SignedBy.expressions","\u591A\u4E2A SignedBy \u8868\u8FBE\u5F0F"}, {"duplicate.keystore.domain.name","\u5BC6\u94A5\u5E93\u57DF\u540D\u91CD\u590D: {0}"}, {"duplicate.keystore.name","\u5BC6\u94A5\u5E93\u540D\u79F0\u91CD\u590D: {0}"}, - {"SignedBy.has.empty.alias","SignedBy \u6709\u7A7A\u522B\u540D"}, - {"can.not.specify.Principal.with.a.wildcard.class.without.a.wildcard.name", - "\u6CA1\u6709\u901A\u914D\u7B26\u540D\u79F0, \u65E0\u6CD5\u4F7F\u7528\u901A\u914D\u7B26\u7C7B\u6307\u5B9A\u4E3B\u7528\u6237"}, - {"expected.codeBase.or.SignedBy.or.Principal", - "\u5E94\u4E3A codeBase, SignedBy \u6216\u4E3B\u7528\u6237"}, - {"expected.permission.entry", "\u5E94\u4E3A\u6743\u9650\u6761\u76EE"}, {"number.", "\u7F16\u53F7 "}, {"expected.expect.read.end.of.file.", "\u5E94\u4E3A [{0}], \u8BFB\u53D6\u7684\u662F [\u6587\u4EF6\u7ED3\u5C3E]"}, @@ -132,8 +99,6 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {"line.number.msg", "\u5217{0}: {1}"}, {"line.number.expected.expect.found.actual.", "\u884C\u53F7 {0}: \u5E94\u4E3A [{1}], \u627E\u5230 [{2}]"}, - {"null.principalClass.or.principalName", - "principalClass \u6216 principalName \u4E3A\u7A7A\u503C"}, // sun.security.pkcs11.SunPKCS11 {"PKCS11.Token.providerName.Password.", diff --git a/src/java.base/share/native/libfallbackLinker/fallbackLinker.c b/src/java.base/share/native/libfallbackLinker/fallbackLinker.c index 5a85fedd774..3f57a2b97cf 100644 --- a/src/java.base/share/native/libfallbackLinker/fallbackLinker.c +++ b/src/java.base/share/native/libfallbackLinker/fallbackLinker.c @@ -165,7 +165,7 @@ Java_jdk_internal_foreign_abi_fallback_LibFallback_doDowncall(JNIEnv* env, jclas static void do_upcall(ffi_cif* cif, void* ret, void** args, void* user_data) { // attach thread JNIEnv* env; - jint result = (*VM)->AttachCurrentThreadAsDaemon(VM, (void**) &env, NULL); + (*VM)->AttachCurrentThreadAsDaemon(VM, (void**) &env, NULL); // call into doUpcall in LibFallback jobject upcall_data = (jobject) user_data; diff --git a/src/java.base/share/native/libnet/net_util.c b/src/java.base/share/native/libnet/net_util.c index d5e94f594fc..a198152563a 100644 --- a/src/java.base/share/native/libnet/net_util.c +++ b/src/java.base/share/native/libnet/net_util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -63,6 +63,10 @@ DEF_JNI_OnLoad(JavaVM *vm, void *reserved) return JNI_EVERSION; /* JNI version not supported */ } + if (NET_PlatformInit() != 0) { + return JNI_ERR; + } + iCls = (*env)->FindClass(env, "java/lang/Boolean"); CHECK_NULL_RETURN(iCls, JNI_VERSION_1_2); mid = (*env)->GetStaticMethodID(env, iCls, "getBoolean", "(Ljava/lang/String;)Z"); diff --git a/src/java.base/share/native/libnet/net_util.h b/src/java.base/share/native/libnet/net_util.h index 06cf448a01d..a1fa9571821 100644 --- a/src/java.base/share/native/libnet/net_util.h +++ b/src/java.base/share/native/libnet/net_util.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -155,6 +155,8 @@ int NET_IsEqual(jbyte* caddr1, jbyte* caddr2); int NET_IsZeroAddr(jbyte* caddr); +int NET_PlatformInit(); + /* Socket operations * * These work just like the system calls, except that they may do some 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 426a3de2845..1713d0a8ccd 100644 --- a/src/java.base/unix/native/libnet/net_util_md.c +++ b/src/java.base/unix/native/libnet/net_util_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -50,6 +50,15 @@ #define IPV6_FLOWINFO_SEND 33 #endif +/* Perform platform specific initialization. + * Returns 0 on success, non-0 on failure */ +int +NET_PlatformInit() +{ + // Not needed on unix + return 0; +} + void NET_ThrowByNameWithLastError(JNIEnv *env, const char *name, const char *defaultDetail) { diff --git a/src/java.base/windows/native/libnet/net_util_md.c b/src/java.base/windows/native/libnet/net_util_md.c index 36927beff3c..410d141e790 100644 --- a/src/java.base/windows/native/libnet/net_util_md.c +++ b/src/java.base/windows/native/libnet/net_util_md.c @@ -101,29 +101,21 @@ static struct { { WSA_OPERATION_ABORTED, 0, "Overlapped operation aborted" }, }; -/* - * Initialize Windows Sockets API support - */ -BOOL WINAPI -DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) +static void at_exit_callback(void) { - WSADATA wsadata; + WSACleanup(); +} - switch (reason) { - case DLL_PROCESS_ATTACH: - if (WSAStartup(MAKEWORD(2,2), &wsadata) != 0) { - return FALSE; - } - break; +/* Perform platform specific initialization. + * Returns 0 on success, non-0 on failure */ +int +NET_PlatformInit() +{ + WSADATA wsadata; - case DLL_PROCESS_DETACH: - WSACleanup(); - break; + atexit(at_exit_callback); - default: - break; - } - return TRUE; + return WSAStartup(MAKEWORD(2,2), &wsadata); } /* diff --git a/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java b/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java index 592482823db..3ca1cd7de8f 100644 --- a/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java +++ b/src/java.desktop/share/classes/java/awt/AWTEventMulticaster.java @@ -110,6 +110,8 @@ public class AWTEventMulticaster implements TextListener, InputMethodListener, HierarchyListener, HierarchyBoundsListener, MouseWheelListener { + private static final int MAX_UNBALANCED_TOP_NODES = 100; + /** * A variable in the event chain (listener-a) */ @@ -952,6 +954,7 @@ public static MouseWheelListener remove(MouseWheelListener l, * If listener-b is null, it returns listener-a * If neither are null, then it creates and returns * a new AWTEventMulticaster instance which chains a with b. + * * @param a event listener-a * @param b event listener-b * @return the resulting listener @@ -959,7 +962,64 @@ public static MouseWheelListener remove(MouseWheelListener l, protected static EventListener addInternal(EventListener a, EventListener b) { if (a == null) return b; if (b == null) return a; - return new AWTEventMulticaster(a, b); + AWTEventMulticaster n = new AWTEventMulticaster(a, b); + if (!needsRebalance(n)) { + return n; + } + + EventListener[] array = getListeners(n, EventListener.class); + return rebalance(array, 0, array.length - 1); + } + + /** + * Return true if the argument represents a binary tree that needs to be rebalanced. + */ + private static boolean needsRebalance(AWTEventMulticaster l) { + int level = 0; + while (true) { + // The criteria for when we need a rebalance is subjective. This method checks + // up to a given threshold of the topmost nodes of a AWTEventMulticaster. If + // they all include one leaf node, then this method returns true. This criteria + // will be met after several consecutive iterations of `addInternal(a, b)` + if (++level > MAX_UNBALANCED_TOP_NODES) { + return true; + } + if (l.a instanceof AWTEventMulticaster aMulti) { + if (l.b instanceof AWTEventMulticaster) { + // we reached a node where both children are AWTEventMulticaster: let's assume + // the current node marks the start of a well-balanced subtree + return false; + } + l = aMulti; + } else if (l.b instanceof AWTEventMulticaster bMulti) { + l = bMulti; + } else { + return false; + } + } + } + + /** + * Recursively create a balanced tree that includes a given range of EventListeners. + * + * @param array the array of the EventListeners to consult + * @param index0 the lowest index (inclusive) that the return value must include + * @param index1 the highest index (inclusive) that the return value must include. + * + * @return a balanced tree. If index0 equals index1 then this returns an EventListener from + * the array provided. Otherwise this returns an AWTEventMulticaster. + */ + private static EventListener rebalance(EventListener[] array, int index0, int index1) { + if (index0 == index1) { + return array[index0]; + } + if (index0 == index1 - 1) { + return new AWTEventMulticaster(array[index0], array[index1]); + } + int mid = (index0 + index1) / 2; + return new AWTEventMulticaster( + rebalance(array, index0, mid), + rebalance(array, mid + 1, index1)); } /** diff --git a/src/java.desktop/share/native/libfreetype/java_freetype.c b/src/java.desktop/share/native/libfreetype/java_freetype.c new file mode 100644 index 00000000000..bf3d8c8e765 --- /dev/null +++ b/src/java.desktop/share/native/libfreetype/java_freetype.c @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * 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. + */ + +#include "jni_util.h" + +/* + * This is needed to mark the bundled freetype library as being part of the JDK, + * which means that for static builds, no additional dynamic library needs to + * be loaded by System.loadLibrary("freetype"). + */ +DEF_STATIC_JNI_OnLoad diff --git a/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c b/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c index f24a4eb9a2c..d6ff51f8018 100644 --- a/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c +++ b/src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c @@ -137,7 +137,9 @@ AWT_OnLoad(JavaVM *vm, void *reserved) } else { /* Get address of this library and the directory containing it. */ dladdr((void *)AWT_OnLoad, &dlinfo); - realpath((char *)dlinfo.dli_fname, buf); + if (realpath((char *)dlinfo.dli_fname, buf) == NULL) { + perror((char *)dlinfo.dli_fname); + } len = strlen(buf); p = strrchr(buf, '/'); diff --git a/src/java.desktop/windows/native/libawt/windows/GDIHashtable.cpp b/src/java.desktop/windows/native/libawt/windows/GDIHashtable.cpp index 18b4ea9edc1..5968607c16e 100644 --- a/src/java.desktop/windows/native/libawt/windows/GDIHashtable.cpp +++ b/src/java.desktop/windows/native/libawt/windows/GDIHashtable.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * 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,8 +26,6 @@ #include "GDIHashtable.h" #include "awt_GDIObject.h" -GDIHashtable::BatchDestructionManager GDIHashtable::manager; - /* * The order of monitor entrance is BatchDestructionManager->List->Hashtable. * GDIHashtable::put() and GDIHashtable::release() are designed to be called @@ -35,12 +33,12 @@ GDIHashtable::BatchDestructionManager GDIHashtable::manager; */ void* GDIHashtable::put(void* key, void* value) { - manager.decrementCounter(); + manager().decrementCounter(); return Hashtable::put(key, value); } void GDIHashtable::release(void* key) { - if (!manager.isBatchingEnabled()) { + if (!manager().isBatchingEnabled()) { void* value = remove(key); DASSERT(value != NULL); m_deleteProc(value); diff --git a/src/java.desktop/windows/native/libawt/windows/GDIHashtable.h b/src/java.desktop/windows/native/libawt/windows/GDIHashtable.h index fff4429ed52..d7195bedf9e 100644 --- a/src/java.desktop/windows/native/libawt/windows/GDIHashtable.h +++ b/src/java.desktop/windows/native/libawt/windows/GDIHashtable.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -162,11 +162,11 @@ class GDIHashtable : public Hashtable { GDIHashtable(const char* name, void (*deleteProc)(void*) = NULL, int initialCapacity = 29, float loadFactor = 0.75) : Hashtable(name, deleteProc, initialCapacity, loadFactor) { - manager.add(this); + manager().add(this); } ~GDIHashtable() { - manager.remove(this); + manager().remove(this); } /** @@ -192,14 +192,17 @@ class GDIHashtable : public Hashtable { /** * Flushes all existing GDIHashtable instances. */ - INLINE static void flushAll() { manager.flushAll(); } + INLINE static void flushAll() { manager().flushAll(); } - INLINE CriticalSection& getManagerLock() { return manager.getLock(); } + INLINE CriticalSection& getManagerLock() { return manager().getLock(); } private: - static BatchDestructionManager manager; + static BatchDestructionManager& manager() { + static BatchDestructionManager manager; + return manager; + } }; #endif // GDIHASHTABLE_H diff --git a/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java b/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java index 555dfdc918b..43606144cd0 100644 --- a/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java +++ b/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java @@ -35,7 +35,6 @@ import com.sun.jmx.mbeanserver.NamedObject; import com.sun.jmx.mbeanserver.Repository; import com.sun.jmx.mbeanserver.Repository.RegistrationContext; -import com.sun.jmx.mbeanserver.Util; import com.sun.jmx.remote.util.EnvHelp; import java.lang.ref.WeakReference; @@ -81,6 +80,8 @@ import javax.management.RuntimeOperationsException; import javax.management.loading.ClassLoaderRepository; +import sun.management.Util; + /** * This is the default class for MBean manipulation on the agent side. It * contains the methods necessary for the creation, registration, and diff --git a/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java b/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java index ffd4d758759..882fcaf809b 100644 --- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java +++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/Repository.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -281,7 +281,7 @@ public void addMBean(final DynamicMBean object, ObjectName name, // Set domain to default if domain is empty and not already set if (dom.length() == 0) - name = Util.newObjectName(domain + name.toString()); + name = sun.management.Util.newObjectName(domain + name.toString()); // Do we have default domain ? if (dom == domain) { // ES: OK (dom & domain are interned) @@ -438,10 +438,9 @@ public Set query(ObjectName pattern, QueryExp query) { if (allNames) result.addAll(moiTb.values()); else - addAllMatching(moiTb, result, Util.newObjectName(domain + name.getCanonicalName())); + addAllMatching(moiTb, result, sun.management.Util.newObjectName(domain + name.getCanonicalName())); return result; } - if (!name.isDomainPattern()) { final Map moiTb = domainTb.get(dom2Match); if (moiTb == null) return Collections.emptySet(); diff --git a/src/java.management/share/classes/com/sun/jmx/mbeanserver/Util.java b/src/java.management/share/classes/com/sun/jmx/mbeanserver/Util.java index 81f306e1dbb..8ef1c99052e 100644 --- a/src/java.management/share/classes/com/sun/jmx/mbeanserver/Util.java +++ b/src/java.management/share/classes/com/sun/jmx/mbeanserver/Util.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,13 +43,6 @@ import javax.management.ObjectName; public class Util { - public static ObjectName newObjectName(String string) { - try { - return new ObjectName(string); - } catch (MalformedObjectNameException e) { - throw new IllegalArgumentException(e); - } - } static Map newMap() { return new HashMap<>(); diff --git a/src/java.management/share/classes/javax/management/MBeanServerDelegate.java b/src/java.management/share/classes/javax/management/MBeanServerDelegate.java index f2346a04d5e..df75fdce9ef 100644 --- a/src/java.management/share/classes/javax/management/MBeanServerDelegate.java +++ b/src/java.management/share/classes/javax/management/MBeanServerDelegate.java @@ -28,7 +28,7 @@ import java.lang.System.Logger.Level; import com.sun.jmx.defaults.JmxProperties; import com.sun.jmx.defaults.ServiceName; -import com.sun.jmx.mbeanserver.Util; +import sun.management.Util; /** * Represents the MBean server from the management point of view. diff --git a/src/java.management/share/classes/javax/management/ObjectName.java b/src/java.management/share/classes/javax/management/ObjectName.java index 4bcda7f0252..f51037cbaf1 100644 --- a/src/java.management/share/classes/javax/management/ObjectName.java +++ b/src/java.management/share/classes/javax/management/ObjectName.java @@ -1222,7 +1222,7 @@ public static ObjectName getInstance(String domain, public static ObjectName getInstance(ObjectName name) { if (name.getClass().equals(ObjectName.class)) return name; - return Util.newObjectName(name.getSerializedNameString()); + return sun.management.Util.newObjectName(name.getSerializedNameString()); } /** @@ -1813,7 +1813,7 @@ public static String unquote(String q) { * * @since 1.6 */ - public static final ObjectName WILDCARD = Util.newObjectName("*:*"); + public static final ObjectName WILDCARD = sun.management.Util.newObjectName("*:*"); // Category : Utilities <=================================== diff --git a/src/java.management/share/classes/sun/management/Util.java b/src/java.management/share/classes/sun/management/Util.java index cad5a2e3892..6ae270b0569 100644 --- a/src/java.management/share/classes/sun/management/Util.java +++ b/src/java.management/share/classes/sun/management/Util.java @@ -49,16 +49,4 @@ public static ObjectName newObjectName(String name) { throw new IllegalArgumentException(e); } } - - // Methods retained temporarily due to usage by jdk.management. - static void checkAccess(ManagementPermission p) { - // no-op - } - - static void checkMonitorAccess() throws SecurityException { - // no-op - } - public static void checkControlAccess() throws SecurityException { - // no-op - } } diff --git a/src/java.se/share/classes/module-info.java b/src/java.se/share/classes/module-info.java index 0fa5a561dec..79b1f746cb0 100644 --- a/src/java.se/share/classes/module-info.java +++ b/src/java.se/share/classes/module-info.java @@ -23,8 +23,6 @@ * questions. */ -import jdk.internal.javac.ParticipatesInPreview; - /** * Defines the API of the Java SE Platform. * @@ -40,7 +38,6 @@ * @moduleGraph * @since 9 */ -@ParticipatesInPreview module java.se { requires transitive java.base; requires transitive java.compiler; diff --git a/src/java.security.jgss/share/classes/sun/security/jgss/krb5/SubjectComber.java b/src/java.security.jgss/share/classes/sun/security/jgss/krb5/SubjectComber.java index f6597bbfeec..26bfe936d0f 100644 --- a/src/java.security.jgss/share/classes/sun/security/jgss/krb5/SubjectComber.java +++ b/src/java.security.jgss/share/classes/sun/security/jgss/krb5/SubjectComber.java @@ -151,8 +151,7 @@ private static Object findAux(Subject subject, String serverPrincipal, Iterator iterator = pcs.iterator(); while (iterator.hasNext()) { Object obj = iterator.next(); - if (!(obj instanceof @SuppressWarnings("unchecked") - KerberosTicket ticket)) { + if (!(obj instanceof KerberosTicket ticket)) { continue; } if (DEBUG != null) { diff --git a/src/java.sql/share/classes/java/sql/SQLPermission.java b/src/java.sql/share/classes/java/sql/SQLPermission.java index 863037502e5..84e41c51a33 100644 --- a/src/java.sql/share/classes/java/sql/SQLPermission.java +++ b/src/java.sql/share/classes/java/sql/SQLPermission.java @@ -32,7 +32,7 @@ * A {@code SQLPermission} object contains * a name (also referred to as a "target name") but no actions * list; there is either a named permission or there is not. - * The target name is the name of the permission (see below). The + * The target name is the name of the permission. The * naming convention follows the hierarchical property naming convention. * In addition, an asterisk * may appear at the end of the name, following a ".", or by itself, to diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java index e4c1a30d525..68cb86eb7fd 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/JCEMapper.java @@ -207,6 +207,22 @@ public static void registerDefaultAlgorithms() { XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA512, new Algorithm("EC", "SHA512withECDSA", "Signature") ); + algorithmsMap.put( + XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_224, + new Algorithm("EC", "SHA3-224withECDSA", "Signature") + ); + algorithmsMap.put( + XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_256, + new Algorithm("EC", "SHA3-256withECDSA", "Signature") + ); + algorithmsMap.put( + XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_384, + new Algorithm("EC", "SHA3-384withECDSA", "Signature") + ); + algorithmsMap.put( + XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_512, + new Algorithm("EC", "SHA3-512withECDSA", "Signature") + ); algorithmsMap.put( XMLSignature.ALGO_ID_SIGNATURE_ECDSA_RIPEMD160, new Algorithm("EC", "RIPEMD160withECDSA", "Signature") diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/MessageDigestAlgorithm.java b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/MessageDigestAlgorithm.java index 17351f0211e..931f3d5553c 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/MessageDigestAlgorithm.java +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/MessageDigestAlgorithm.java @@ -103,7 +103,7 @@ public static MessageDigestAlgorithm getInstance( return new MessageDigestAlgorithm(doc, algorithmURI); } - private static MessageDigest getDigestInstance(String algorithmURI) throws XMLSignatureException { + public static MessageDigest getDigestInstance(String algorithmURI) throws XMLSignatureException { String algorithmID = JCEMapper.translateURItoJCEID(algorithmURI); if (algorithmID == null) { diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java index 439eefb10dc..a74d373244c 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/SignatureAlgorithm.java @@ -494,6 +494,18 @@ public static void registerDefaultAlgorithms() { algorithmHash.put( XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA512, SignatureECDSA.SignatureECDSASHA512.class ); + algorithmHash.put( + XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_224, SignatureECDSA.SignatureECDSASHA3_224.class + ); + algorithmHash.put( + XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_256, SignatureECDSA.SignatureECDSASHA3_256.class + ); + algorithmHash.put( + XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_384, SignatureECDSA.SignatureECDSASHA3_384.class + ); + algorithmHash.put( + XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_512, SignatureECDSA.SignatureECDSASHA3_512.class + ); algorithmHash.put( XMLSignature.ALGO_ID_SIGNATURE_ECDSA_RIPEMD160, SignatureECDSA.SignatureECDSARIPEMD160.class ); diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/ECDSAUtils.java b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/ECDSAUtils.java index 73e02864bd9..4d38b2f07bd 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/ECDSAUtils.java +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/ECDSAUtils.java @@ -770,6 +770,46 @@ public static byte[] convertXMLDSIGtoASN1(byte[] xmldsigBytes) throws IOExceptio "0340340340340340340340340340340340340340340340340340340323c313fab50589703b5ec68d3587fec60d161cc149c1ad4a91", 0x2760) ); + + ecCurveDefinitions.add( + new ECCurveDefinition( + "brainpoolP256r1 [RFC 5639]", + "1.3.36.3.3.2.8.1.1.7", + "a9fb57dba1eea9bc3e660a909d838d726e3bf623d52620282013481d1f6e5377", + "7d5a0975fc2c3057eef67530417affe7fb8055c126dc5c6ce94a4b44f330b5d9", + "26dc5c6ce94a4b44f330b5d9bbd77cbf958416295cf7e1ce6bccdc18ff8c07b6", + "8bd2aeb9cb7e57cb2c4b482ffc81b7afb9de27e1e3bd23c23a4453bd9ace3262", + "547ef835c3dac4fd97f8461a14611dc9c27745132ded8e545c1d54c72f046997", + "a9fb57dba1eea9bc3e660a909d838d718c397aa3b561a6f7901e0e82974856a7", + 1) + ); + + ecCurveDefinitions.add( + new ECCurveDefinition( + "brainpoolP384r1 [RFC 5639]", + "1.3.36.3.3.2.8.1.1.11", + "8cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b412b1da197fb71123acd3a729901d1a71874700133107ec53", + "7bc382c63d8c150c3c72080ace05afa0c2bea28e4fb22787139165efba91f90f8aa5814a503ad4eb04a8c7dd22ce2826", + "04a8c7dd22ce28268b39b55416f0447c2fb77de107dcd2a62e880ea53eeb62d57cb4390295dbc9943ab78696fa504c11", + "1d1c64f068cf45ffa2a63a81b7c13f6b8847a3e77ef14fe3db7fcafe0cbd10e8e826e03436d646aaef87b2e247d4af1e", + "8abe1d7520f9c2a45cb1eb8e95cfd55262b70b29feec5864e19c054ff99129280e4646217791811142820341263c5315", + "8cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b31f166e6cac0425a7cf3ab6af6b7fc3103b883202e9046565", + 1) + ); + + ecCurveDefinitions.add( + new ECCurveDefinition( + "brainpoolP512r1 [RFC 5639]", + "1.3.36.3.3.2.8.1.1.13", + "aadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca703308717d4d9b009bc66842aecda12ae6a380e62881ff2f2d82c68528aa6056583a48f3", + "7830a3318b603b89e2327145ac234cc594cbdd8d3df91610a83441caea9863bc2ded5d5aa8253aa10a2ef1c98b9ac8b57f1117a72bf2c7b9e7c1ac4d77fc94ca", + "3df91610a83441caea9863bc2ded5d5aa8253aa10a2ef1c98b9ac8b57f1117a72bf2c7b9e7c1ac4d77fc94cadc083e67984050b75ebae5dd2809bd638016f723", + "81aee4bdd82ed9645a21322e9c4c6a9385ed9f70b5d916c1b43b62eef4d0098eff3b1f78e2d0d48d50d1687b93b97d5f7c6d5047406a5e688b352209bcb9f822", + "7dde385d566332ecc0eabfa9cf7822fdf209f70024a57b1aa000c55b881f8111b2dcde494a5f485e5bca4bd88a2763aed1ca2b2fa8f0540678cd1e0f3ad80892", + "aadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca70330870553e5c414ca92619418661197fac10471db1d381085ddaddb58796829ca90069", + 1) + ); + } public static String getOIDFromPublicKey(ECPublicKey ecPublicKey) { diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureBaseRSA.java b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureBaseRSA.java index 45dafc3ad38..fc79e0c774e 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureBaseRSA.java +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureBaseRSA.java @@ -66,8 +66,7 @@ public SignatureBaseRSA() throws XMLSignatureException { public SignatureBaseRSA(Provider provider) throws XMLSignatureException { String algorithmID = JCEMapper.translateURItoJCEID(this.engineGetURI()); this.signatureAlgorithm = getSignature(provider, algorithmID); - LOG.debug("Created SignatureRSA using {0} and provider {1}", - algorithmID, signatureAlgorithm.getProvider()); + LOG.debug("Created SignatureRSA using {0}", algorithmID); } Signature getSignature(Provider provider, String algorithmID) diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureECDSA.java b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureECDSA.java index 75a88b8eb13..a90a314ade2 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureECDSA.java +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/algorithms/implementations/SignatureECDSA.java @@ -371,6 +371,110 @@ public String engineGetURI() { } } + /** + * Class SignatureECDSASHA3-224 + * + */ + public static class SignatureECDSASHA3_224 extends SignatureECDSA { + + /** + * Constructor SignatureECDSASHA3-224 + * + * @throws XMLSignatureException + */ + public SignatureECDSASHA3_224() throws XMLSignatureException { + super(); + } + + public SignatureECDSASHA3_224(Provider provider) throws XMLSignatureException { + super(provider); + } + + /** {@inheritDoc} */ + @Override + public String engineGetURI() { + return XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_224; + } + } + + /** + * Class SignatureECDSASHA3-256 + * + */ + public static class SignatureECDSASHA3_256 extends SignatureECDSA { + + /** + * Constructor SignatureECDSASHA3-256 + * + * @throws XMLSignatureException + */ + public SignatureECDSASHA3_256() throws XMLSignatureException { + super(); + } + + public SignatureECDSASHA3_256(Provider provider) throws XMLSignatureException { + super(provider); + } + + /** {@inheritDoc} */ + @Override + public String engineGetURI() { + return XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_256; + } + } + + /** + * Class SignatureECDSASHA3-384 + * + */ + public static class SignatureECDSASHA3_384 extends SignatureECDSA { + + /** + * Constructor SignatureECDSASHA3-384 + * + * @throws XMLSignatureException + */ + public SignatureECDSASHA3_384() throws XMLSignatureException { + super(); + } + + public SignatureECDSASHA3_384(Provider provider) throws XMLSignatureException { + super(provider); + } + + /** {@inheritDoc} */ + @Override + public String engineGetURI() { + return XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_384; + } + } + + /** + * Class SignatureECDSASHA3-512 + * + */ + public static class SignatureECDSASHA3_512 extends SignatureECDSA { + + /** + * Constructor SignatureECDSASHA3-512 + * + * @throws XMLSignatureException + */ + public SignatureECDSASHA3_512() throws XMLSignatureException { + super(); + } + + public SignatureECDSASHA3_512(Provider provider) throws XMLSignatureException { + super(provider); + } + + /** {@inheritDoc} */ + @Override + public String engineGetURI() { + return XMLSignature.ALGO_ID_SIGNATURE_ECDSA_SHA3_512; + } + } + /** * Class SignatureECDSARIPEMD160 */ diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java index 62f25d1298d..01dd2ed16d7 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/KeyInfo.java @@ -32,15 +32,7 @@ import javax.crypto.SecretKey; import com.sun.org.apache.xml.internal.security.exceptions.XMLSecurityException; -import com.sun.org.apache.xml.internal.security.keys.content.DEREncodedKeyValue; -import com.sun.org.apache.xml.internal.security.keys.content.KeyInfoReference; -import com.sun.org.apache.xml.internal.security.keys.content.KeyName; -import com.sun.org.apache.xml.internal.security.keys.content.KeyValue; -import com.sun.org.apache.xml.internal.security.keys.content.MgmtData; -import com.sun.org.apache.xml.internal.security.keys.content.PGPData; -import com.sun.org.apache.xml.internal.security.keys.content.RetrievalMethod; -import com.sun.org.apache.xml.internal.security.keys.content.SPKIData; -import com.sun.org.apache.xml.internal.security.keys.content.X509Data; +import com.sun.org.apache.xml.internal.security.keys.content.*; import com.sun.org.apache.xml.internal.security.keys.content.keyvalues.DSAKeyValue; import com.sun.org.apache.xml.internal.security.keys.content.keyvalues.RSAKeyValue; import com.sun.org.apache.xml.internal.security.keys.keyresolver.KeyResolver; @@ -50,7 +42,6 @@ import com.sun.org.apache.xml.internal.security.transforms.Transforms; import com.sun.org.apache.xml.internal.security.utils.Constants; import com.sun.org.apache.xml.internal.security.utils.ElementProxy; -import com.sun.org.apache.xml.internal.security.utils.SignatureElementProxy; import com.sun.org.apache.xml.internal.security.utils.XMLUtils; import org.w3c.dom.Attr; import org.w3c.dom.Document; @@ -88,7 +79,7 @@ * contains the corresponding type. * */ -public class KeyInfo extends SignatureElementProxy { +public class KeyInfo extends ElementProxy { private static final com.sun.org.slf4j.internal.Logger LOG = com.sun.org.slf4j.internal.LoggerFactory.getLogger(KeyInfo.class); @@ -231,12 +222,24 @@ public void add(RSAKeyValue rsakeyvalue) { } /** - * Method add + * Method adds public key encoded as KeyValue. If public key type is not supported by KeyValue, then + * DEREncodedKeyValue is used. If public key type is not supported by DEREncodedKeyValue, then + * IllegalArgumentException is thrown. * - * @param pk + * @param pk public key to be added to KeyInfo */ - public void add(PublicKey pk) { - this.add(new KeyValue(getDocument(), pk)); + public void add(PublicKey pk) { + + if (KeyValue.isSupportedKeyType(pk)) { + this.add(new KeyValue(getDocument(), pk)); + return; + } + + try { + this.add(new DEREncodedKeyValue(getDocument(), pk)); + } catch (XMLSecurityException ex) { + throw new IllegalArgumentException(ex); + } } /** @@ -772,6 +775,7 @@ public boolean containsKeyInfoReference() { return this.lengthKeyInfoReference() > 0; } + /** * This method returns the public key. * @@ -1188,4 +1192,10 @@ public void addStorageResolver(StorageResolver storageResolver) { public String getBaseLocalName() { return Constants._TAG_KEYINFO; } + + /** {@inheritDoc} */ + @Override + public String getBaseNamespace() { + return Constants.SignatureSpecNS; + } } diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/DEREncodedKeyValue.java b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/DEREncodedKeyValue.java index 823a5036680..2b5b55a3d04 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/DEREncodedKeyValue.java +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/DEREncodedKeyValue.java @@ -41,7 +41,10 @@ public class DEREncodedKeyValue extends Signature11ElementProxy implements KeyInfoContent { /** JCA algorithm key types supported by this implementation. */ - private static final String[] supportedKeyTypes = { "RSA", "DSA", "EC"}; + private static final String[] supportedKeyTypes = { "RSA", "DSA", "EC", + "DiffieHellman", "DH", "XDH", "X25519", "X448", + "EdDSA", "Ed25519", "Ed448", + "RSASSA-PSS"}; /** * Constructor DEREncodedKeyValue @@ -144,5 +147,4 @@ protected byte[] getEncodedDER(PublicKey publicKey) throws XMLSecurityException throw new XMLSecurityException(e, "DEREncodedKeyValue.UnsupportedPublicKey", exArgs); } } - } diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyValue.java b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyValue.java index ee999e65783..d1eb890f885 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyValue.java +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/KeyValue.java @@ -41,7 +41,6 @@ * (section 6.4). The KeyValue element may include externally defined public * keys values represented as PCDATA or element types from an external * namespace. - * */ public class KeyValue extends SignatureElementProxy implements KeyInfoContent { @@ -120,6 +119,20 @@ public KeyValue(Document doc, PublicKey pk) { } } + /** + * Verifies that the XML KeyValue encoding is supported for the given key type. If the + * encoding is supported, it returns true else false. + * + * @return true if the public key has a KeyValue encoding, false otherwise. + */ + public static boolean isSupportedKeyType(PublicKey publicKey) { + + return publicKey instanceof java.security.interfaces.DSAPublicKey + || publicKey instanceof java.security.interfaces.RSAPublicKey + || publicKey instanceof java.security.interfaces.ECPublicKey; + + } + /** * Constructor KeyValue * diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/ECKeyValue.java b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/ECKeyValue.java index 839d9e4285d..9bc6e55d7e5 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/ECKeyValue.java +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/keys/content/keyvalues/ECKeyValue.java @@ -91,6 +91,45 @@ public class ECKeyValue extends Signature11ElementProxy implements KeyValueConte 1 ); + /* Supported curve brainpoolP256r1 */ + private static final Curve BRAINPOOLP256R1 = initializeCurve( + "brainpoolP256r1 [RFC 5639]", + "1.3.36.3.3.2.8.1.1.7", + "A9FB57DBA1EEA9BC3E660A909D838D726E3BF623D52620282013481D1F6E5377", + "7D5A0975FC2C3057EEF67530417AFFE7FB8055C126DC5C6CE94A4B44F330B5D9", + "26DC5C6CE94A4B44F330B5D9BBD77CBF958416295CF7E1CE6BCCDC18FF8C07B6", + "8BD2AEB9CB7E57CB2C4B482FFC81B7AFB9DE27E1E3BD23C23A4453BD9ACE3262", + "547EF835C3DAC4FD97F8461A14611DC9C27745132DED8E545C1D54C72F046997", + "A9FB57DBA1EEA9BC3E660A909D838D718C397AA3B561A6F7901E0E82974856A7", + 1 + ); + + /* Supported curve brainpoolP384r1 */ + private static final Curve BRAINPOOLP384R1 = initializeCurve( + "brainpoolP384r1 [RFC 5639]", + "1.3.36.3.3.2.8.1.1.11", + "8CB91E82A3386D280F5D6F7E50E641DF152F7109ED5456B412B1DA197FB71123ACD3A729901D1A71874700133107EC53", + "7BC382C63D8C150C3C72080ACE05AFA0C2BEA28E4FB22787139165EFBA91F90F8AA5814A503AD4EB04A8C7DD22CE2826", + "04A8C7DD22CE28268B39B55416F0447C2FB77DE107DCD2A62E880EA53EEB62D57CB4390295DBC9943AB78696FA504C11", + "1D1C64F068CF45FFA2A63A81B7C13F6B8847A3E77EF14FE3DB7FCAFE0CBD10E8E826E03436D646AAEF87B2E247D4AF1E", + "8ABE1D7520F9C2A45CB1EB8E95CFD55262B70B29FEEC5864E19C054FF99129280E4646217791811142820341263C5315", + "8CB91E82A3386D280F5D6F7E50E641DF152F7109ED5456B31F166E6CAC0425A7CF3AB6AF6B7FC3103B883202E9046565", + 1 + ); + + /* Supported curve brainpoolP512r1 */ + private static final Curve BRAINPOOLP512R1 = initializeCurve( + "brainpoolP512r1 [RFC 5639]", + "1.3.36.3.3.2.8.1.1.13", + "AADD9DB8DBE9C48B3FD4E6AE33C9FC07CB308DB3B3C9D20ED6639CCA703308717D4D9B009BC66842AECDA12AE6A380E62881FF2F2D82C68528AA6056583A48F3", + "7830A3318B603B89E2327145AC234CC594CBDD8D3DF91610A83441CAEA9863BC2DED5D5AA8253AA10A2EF1C98B9AC8B57F1117A72BF2C7B9E7C1AC4D77FC94CA", + "3DF91610A83441CAEA9863BC2DED5D5AA8253AA10A2EF1C98B9AC8B57F1117A72BF2C7B9E7C1AC4D77FC94CADC083E67984050B75EBAE5DD2809BD638016F723", + "81AEE4BDD82ED9645A21322E9C4C6A9385ED9F70B5D916C1B43B62EEF4D0098EFF3B1F78E2D0D48D50D1687B93B97D5F7C6D5047406A5E688B352209BCB9F822", + "7DDE385D566332ECC0EABFA9CF7822FDF209F70024A57B1AA000C55B881F8111B2DCDE494A5F485E5BCA4BD88A2763AED1CA2B2FA8F0540678CD1E0F3AD80892", + "AADD9DB8DBE9C48B3FD4E6AE33C9FC07CB308DB3B3C9D20ED6639CCA70330870553E5C414CA92619418661197FAC10471DB1D381085DDADDB58796829CA90069", + 1 + ); + private static Curve initializeCurve(String name, String oid, String sfield, String a, String b, String x, String y, String n, int h) { @@ -264,7 +303,13 @@ private static String getCurveOid(ECParameterSpec params) { match = SECP384R1; } else if (matchCurve(params, SECP521R1)) { match = SECP521R1; - } else { + } else if (matchCurve(params, BRAINPOOLP256R1)) { + match = BRAINPOOLP256R1; + } else if (matchCurve(params, BRAINPOOLP384R1)) { + match = BRAINPOOLP384R1; + } else if (matchCurve(params, BRAINPOOLP512R1)) { + match = BRAINPOOLP512R1; + }else { return null; } return match.getObjectId(); @@ -332,6 +377,12 @@ private static ECParameterSpec getECParameterSpec(String oid) { return SECP384R1; } else if (oid.equals(SECP521R1.getObjectId())) { return SECP521R1; + } else if (oid.equals(BRAINPOOLP256R1.getObjectId())) { + return BRAINPOOLP256R1; + } else if (oid.equals(BRAINPOOLP384R1.getObjectId())) { + return BRAINPOOLP384R1; + } else if (oid.equals(BRAINPOOLP512R1.getObjectId())) { + return BRAINPOOLP512R1; } else { return null; } diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_de.properties b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_de.properties index 3d4306e988f..0871ffdaffa 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_de.properties +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_de.properties @@ -30,7 +30,7 @@ algorithms.HMACOutputLengthMax = HMACOutputLength darf nicht grosser als {0} sei algorithms.HMACOutputLengthMin = HMACOutputLength darf nicht kleiner als {0} sein algorithms.HMACOutputLengthOnlyForHMAC = Die HMACOutputLength kann nur bei HMAC integrit\u00e4ts Algorithmen angegeben werden algorithms.MissingRSAPSSParams = RSAPSSParams is a required Element for http://www.w3.org/2007/05/xmldsig-more#rsa-pss -algorithms.NoSuchAlgorithm = Der Algorithmus {0} ist nicht verf\u00fcgbar. +algorithms.NoSuchAlgorithmNoEx = Der Algorithmus {0} ist nicht verf\u00fcgbar. algorithms.NoSuchAlgorithm = Der Algorithmus {0} ist nicht verf\u00fcgbar. Original Nachricht war\: {1} algorithms.NoSuchMap = Algorithmus URI "{0}" konnte auf keinen JCE Algorithmus gemappt werden algorithms.NoSuchProvider = Der angegebene Provider {0} existiert nicht. Original Nachricht war\: {1} diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java index cfa545e5826..b84556de077 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/signature/XMLSignature.java @@ -209,6 +209,23 @@ public final class XMLSignature extends SignatureElementProxy { public static final String ALGO_ID_SIGNATURE_EDDSA_ED448 = "http://www.w3.org/2021/04/xmldsig-more#eddsa-ed448"; + + /**Signature - SHA3-224withECDSA */ + public static final String ALGO_ID_SIGNATURE_ECDSA_SHA3_224 = + "http://www.w3.org/2021/04/xmldsig-more#ecdsa-sha3-224"; + + /**Signature - SHA3-256withECDSA */ + public static final String ALGO_ID_SIGNATURE_ECDSA_SHA3_256 = + "http://www.w3.org/2021/04/xmldsig-more#ecdsa-sha3-256"; + + /**Signature - SHA3-384withECDSA */ + public static final String ALGO_ID_SIGNATURE_ECDSA_SHA3_384 = + "http://www.w3.org/2021/04/xmldsig-more#ecdsa-sha3-384"; + + /**Signature - SHA3-512withECDSA */ + public static final String ALGO_ID_SIGNATURE_ECDSA_SHA3_512 = + "http://www.w3.org/2021/04/xmldsig-more#ecdsa-sha3-512"; + /** Signature - Optional RSASSA-PSS */ public static final String ALGO_ID_SIGNATURE_RSA_PSS = Constants.XML_DSIG_NS_MORE_07_05 + "rsa-pss"; diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/Constants.java b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/Constants.java index d584eac32d1..5ec3e293252 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/Constants.java +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/Constants.java @@ -71,6 +71,9 @@ public final class Constants { /** The (newer) URL for more algorithms **/ public static final String XML_DSIG_NS_MORE_07_05 = "http://www.w3.org/2007/05/xmldsig-more#"; + /** The 2021 xmldsig-more URL for Internet Engineering Task Force (IETF) algorithms **/ + public static final String XML_DSIG_NS_MORE_21_04 = "http://www.w3.org/2021/04/xmldsig-more#"; + /** The URI for XML spec*/ public static final String XML_LANG_SPACE_SpecNS = "http://www.w3.org/XML/1998/namespace"; @@ -144,6 +147,9 @@ public final class Constants { /** Tag of Element MaskGenerationFunction **/ public static final String _TAG_MGF = "MaskGenerationFunction"; + /** Tag of Element Salt **/ + public static final String _TAG_SALT = "Salt"; + /** Tag of Element SaltLength **/ public static final String _TAG_SALTLENGTH = "SaltLength"; diff --git a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java index 6f061fc9772..b68a56fd8b9 100644 --- a/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java +++ b/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/ElementProxy.java @@ -512,6 +512,9 @@ public static void registerDefaultPrefixes() throws XMLSecurityException { "http://www.nue.et-inf.uni-siegen.de/~geuer-pollmann/#xpathFilter", "xx" ); setNamespacePrefix("http://www.w3.org/2009/xmldsig11#", "dsig11"); + setNamespacePrefix("http://www.w3.org/2001/04/xmldsig-more", "rfc4051"); + setNamespacePrefix("http://www.w3.org/2007/05/xmldsig-more#", "rfc6931"); + setNamespacePrefix("http://www.w3.org/2021/04/xmldsig-more#", "rfc9231"); } /** diff --git a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureMethod.java b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureMethod.java index bf7bb59c9e1..f9b683c838c 100644 --- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureMethod.java +++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -312,6 +312,42 @@ public interface SignatureMethod extends XMLStructure, AlgorithmMethod { "http://www.w3.org/2007/05/xmldsig-more#sha3-512-rsa-MGF1"; + /** + * The + * ECDSA-SHA3-224 signature method algorithm URI. + * + * @since 25 + */ + String ECDSA_SHA3_224 = + "http://www.w3.org/2021/04/xmldsig-more#ecdsa-sha3-224"; + + /** + * The + * ECDSA-SHA3-256 signature method algorithm URI. + * + * @since 25 + */ + String ECDSA_SHA3_256 = + "http://www.w3.org/2021/04/xmldsig-more#ecdsa-sha3-256"; + + /** + * The + * ECDSA-SHA3-384 signature method algorithm URI. + * + * @since 25 + */ + String ECDSA_SHA3_384 = + "http://www.w3.org/2021/04/xmldsig-more#ecdsa-sha3-384"; + + /** + * The + * ECDSA-SHA3-512 signature method algorithm URI. + * + * @since 25 + */ + String ECDSA_SHA3_512 = + "http://www.w3.org/2021/04/xmldsig-more#ecdsa-sha3-512"; + /** * Returns the algorithm-specific input parameters of this * SignatureMethod. diff --git a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java index cec1224affa..2ce4858bc81 100644 --- a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java +++ b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java @@ -81,7 +81,7 @@ public KeyValue newKeyValue(PublicKey key) throws KeyException { String algorithm = key.getAlgorithm(); if ("DSA".equals(algorithm)) { return new DOMKeyValue.DSA((DSAPublicKey) key); - } else if ("RSA".equals(algorithm)) { + } else if ("RSA".equals(algorithm) || "RSASSA-PSS".equals(algorithm)) { return new DOMKeyValue.RSA((RSAPublicKey) key); } else if ("EC".equals(algorithm)) { return new DOMKeyValue.EC((ECPublicKey) key); diff --git a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java index 0933c21bfd3..738ab64693c 100644 --- a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java +++ b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java @@ -241,6 +241,33 @@ RSAPublicKey unmarshalKeyValue(Element kvtElem) RSAPublicKeySpec spec = new RSAPublicKeySpec(modulus, exponent); return (RSAPublicKey) generatePublicKey(rsakf, spec); } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof KeyValue)) { + return false; + } + // This equality test allows RSA keys that have different + // algorithms (ex: RSA and RSASSA-PSS) to be equal as long + // as the key is the same. + try { + PublicKey otherKey = ((KeyValue)obj).getPublicKey(); + if (!(otherKey instanceof RSAPublicKey)) { + return false; + } + RSAPublicKey otherRSAKey = (RSAPublicKey)otherKey; + RSAPublicKey rsaKey = (RSAPublicKey)getPublicKey(); + return rsaKey.getPublicExponent().equals( + otherRSAKey.getPublicExponent()) + && rsaKey.getModulus().equals(otherRSAKey.getModulus()); + } catch (KeyException ke) { + // no practical way to determine if the keys are equal + return false; + } + } } static final class DSA extends DOMKeyValue { @@ -369,6 +396,42 @@ static final class EC extends DOMKeyValue { 1 ); + private static final Curve BRAINPOOLP256R1 = initializeCurve( + "brainpoolP256r1 [RFC 5639]", + "1.3.36.3.3.2.8.1.1.7", + "A9FB57DBA1EEA9BC3E660A909D838D726E3BF623D52620282013481D1F6E5377", + "7D5A0975FC2C3057EEF67530417AFFE7FB8055C126DC5C6CE94A4B44F330B5D9", + "26DC5C6CE94A4B44F330B5D9BBD77CBF958416295CF7E1CE6BCCDC18FF8C07B6", + "8BD2AEB9CB7E57CB2C4B482FFC81B7AFB9DE27E1E3BD23C23A4453BD9ACE3262", + "547EF835C3DAC4FD97F8461A14611DC9C27745132DED8E545C1D54C72F046997", + "A9FB57DBA1EEA9BC3E660A909D838D718C397AA3B561A6F7901E0E82974856A7", + 1 + ); + + private static final Curve BRAINPOOLP384R1 = initializeCurve( + "brainpoolP384r1 [RFC 5639]", + "1.3.36.3.3.2.8.1.1.11", + "8CB91E82A3386D280F5D6F7E50E641DF152F7109ED5456B412B1DA197FB71123ACD3A729901D1A71874700133107EC53", + "7BC382C63D8C150C3C72080ACE05AFA0C2BEA28E4FB22787139165EFBA91F90F8AA5814A503AD4EB04A8C7DD22CE2826", + "04A8C7DD22CE28268B39B55416F0447C2FB77DE107DCD2A62E880EA53EEB62D57CB4390295DBC9943AB78696FA504C11", + "1D1C64F068CF45FFA2A63A81B7C13F6B8847A3E77EF14FE3DB7FCAFE0CBD10E8E826E03436D646AAEF87B2E247D4AF1E", + "8ABE1D7520F9C2A45CB1EB8E95CFD55262B70B29FEEC5864E19C054FF99129280E4646217791811142820341263C5315", + "8CB91E82A3386D280F5D6F7E50E641DF152F7109ED5456B31F166E6CAC0425A7CF3AB6AF6B7FC3103B883202E9046565", + 1 + ); + + private static final Curve BRAINPOOLP512R1 = initializeCurve( + "brainpoolP512r1 [RFC 5639]", + "1.3.36.3.3.2.8.1.1.13", + "AADD9DB8DBE9C48B3FD4E6AE33C9FC07CB308DB3B3C9D20ED6639CCA703308717D4D9B009BC66842AECDA12AE6A380E62881FF2F2D82C68528AA6056583A48F3", + "7830A3318B603B89E2327145AC234CC594CBDD8D3DF91610A83441CAEA9863BC2DED5D5AA8253AA10A2EF1C98B9AC8B57F1117A72BF2C7B9E7C1AC4D77FC94CA", + "3DF91610A83441CAEA9863BC2DED5D5AA8253AA10A2EF1C98B9AC8B57F1117A72BF2C7B9E7C1AC4D77FC94CADC083E67984050B75EBAE5DD2809BD638016F723", + "81AEE4BDD82ED9645A21322E9C4C6A9385ED9F70B5D916C1B43B62EEF4D0098EFF3B1F78E2D0D48D50D1687B93B97D5F7C6D5047406A5E688B352209BCB9F822", + "7DDE385D566332ECC0EABFA9CF7822FDF209F70024A57B1AA000C55B881F8111B2DCDE494A5F485E5BCA4BD88A2763AED1CA2B2FA8F0540678CD1E0F3AD80892", + "AADD9DB8DBE9C48B3FD4E6AE33C9FC07CB308DB3B3C9D20ED6639CCA70330870553E5C414CA92619418661197FAC10471DB1D381085DDADDB58796829CA90069", + 1 + ); + private static Curve initializeCurve(String name, String oid, String sfield, String a, String b, String x, String y, String n, int h) { @@ -448,6 +511,12 @@ private static String getCurveOid(ECParameterSpec params) { match = SECP384R1; } else if (matchCurve(params, SECP521R1)) { match = SECP521R1; + } else if (matchCurve(params, BRAINPOOLP256R1)) { + match = BRAINPOOLP256R1; + } else if (matchCurve(params, BRAINPOOLP384R1)) { + match = BRAINPOOLP384R1; + } else if (matchCurve(params, BRAINPOOLP512R1)) { + match = BRAINPOOLP512R1; } else { return null; } @@ -485,7 +554,7 @@ void marshalPublicKey(Node parent, Document doc, String dsPrefix, DOMUtils.setAttribute(namedCurveElem, "URI", "urn:oid:" + oid); String qname = (prefix == null || prefix.length() == 0) ? "xmlns" : "xmlns:" + prefix; - namedCurveElem.setAttributeNS("http://www.w3.org/2000/xmlns/", + ecKeyValueElem.setAttributeNS("http://www.w3.org/2000/xmlns/", qname, XMLDSIG_11_XMLNS); ecKeyValueElem.appendChild(namedCurveElem); String encoded = XMLUtils.encodeToString(ecPublicKey); @@ -555,6 +624,12 @@ private static ECParameterSpec getECParameterSpec(String oid) { return SECP384R1; } else if (oid.equals(SECP521R1.getObjectId())) { return SECP521R1; + } else if (oid.equals(BRAINPOOLP256R1.getObjectId())) { + return BRAINPOOLP256R1; + } else if (oid.equals(BRAINPOOLP384R1.getObjectId())) { + return BRAINPOOLP384R1; + } else if (oid.equals(BRAINPOOLP512R1.getObjectId())) { + return BRAINPOOLP512R1; } else { return null; } diff --git a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java index 5e44ccaeae8..6523b93935d 100644 --- a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java +++ b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureMethod.java @@ -100,6 +100,14 @@ public abstract class DOMSignatureMethod extends AbstractDOMSignatureMethod { "http://www.w3.org/2021/04/xmldsig-more#eddsa-ed25519"; static final String ED448 = "http://www.w3.org/2021/04/xmldsig-more#eddsa-ed448"; + static final String ECDSA_SHA3_224 = + "http://www.w3.org/2021/04/xmldsig-more#ecdsa-sha3-224"; + static final String ECDSA_SHA3_256 = + "http://www.w3.org/2021/04/xmldsig-more#ecdsa-sha3-256"; + static final String ECDSA_SHA3_384 = + "http://www.w3.org/2021/04/xmldsig-more#ecdsa-sha3-384"; + static final String ECDSA_SHA3_512 = + "http://www.w3.org/2021/04/xmldsig-more#ecdsa-sha3-512"; // see RFC 6931 for these algorithm definitions static final String ECDSA_RIPEMD160 = @@ -241,6 +249,14 @@ static SignatureMethod unmarshal(Element smElem) throws MarshalException { return new SHA384withECDSA(smElem); } else if (alg.equals(ECDSA_SHA512)) { return new SHA512withECDSA(smElem); + } else if (alg.equals(ECDSA_SHA3_224)) { + return new SHA3_224withECDSA(smElem); + } else if (alg.equals(ECDSA_SHA3_256)) { + return new SHA3_256withECDSA(smElem); + } else if (alg.equals(ECDSA_SHA3_384)) { + return new SHA3_384withECDSA(smElem); + } else if (alg.equals(ECDSA_SHA3_512)) { + return new SHA3_512withECDSA(smElem); } else if (alg.equals(ECDSA_RIPEMD160)) { return new RIPEMD160withECDSA(smElem); } else if (alg.equals(SignatureMethod.HMAC_SHA1)) { @@ -1160,6 +1176,94 @@ String getJCAFallbackAlgorithm() { } } + static final class SHA3_224withECDSA extends AbstractECDSASignatureMethod { + SHA3_224withECDSA(AlgorithmParameterSpec params) + throws InvalidAlgorithmParameterException { + super(params); + } + SHA3_224withECDSA(Element dmElem) throws MarshalException { + super(dmElem); + } + @Override + public String getAlgorithm() { + return ECDSA_SHA3_224; + } + @Override + String getJCAAlgorithm() { + return "SHA3-224withECDSAinP1363Format"; + } + @Override + String getJCAFallbackAlgorithm() { + return "SHA3-224withECDSA"; + } + } + + static final class SHA3_256withECDSA extends AbstractECDSASignatureMethod { + SHA3_256withECDSA(AlgorithmParameterSpec params) + throws InvalidAlgorithmParameterException { + super(params); + } + SHA3_256withECDSA(Element dmElem) throws MarshalException { + super(dmElem); + } + @Override + public String getAlgorithm() { + return ECDSA_SHA3_256; + } + @Override + String getJCAAlgorithm() { + return "SHA3-256withECDSAinP1363Format"; + } + @Override + String getJCAFallbackAlgorithm() { + return "SHA3-256withECDSA"; + } + } + + static final class SHA3_384withECDSA extends AbstractECDSASignatureMethod { + SHA3_384withECDSA(AlgorithmParameterSpec params) + throws InvalidAlgorithmParameterException { + super(params); + } + SHA3_384withECDSA(Element dmElem) throws MarshalException { + super(dmElem); + } + @Override + public String getAlgorithm() { + return ECDSA_SHA3_384; + } + @Override + String getJCAAlgorithm() { + return "SHA3-384withECDSAinP1363Format"; + } + @Override + String getJCAFallbackAlgorithm() { + return "SHA3-384withECDSA"; + } + } + + static final class SHA3_512withECDSA extends AbstractECDSASignatureMethod { + SHA3_512withECDSA(AlgorithmParameterSpec params) + throws InvalidAlgorithmParameterException { + super(params); + } + SHA3_512withECDSA(Element dmElem) throws MarshalException { + super(dmElem); + } + @Override + public String getAlgorithm() { + return ECDSA_SHA3_512; + } + @Override + String getJCAAlgorithm() { + return "SHA3-512withECDSAinP1363Format"; + } + @Override + String getJCAFallbackAlgorithm() { + return "SHA3-512withECDSA"; + } + } + static final class RIPEMD160withECDSA extends AbstractECDSASignatureMethod { RIPEMD160withECDSA(AlgorithmParameterSpec params) throws InvalidAlgorithmParameterException { diff --git a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java index 119bf16bc32..52ccc84d1d0 100644 --- a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java +++ b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java @@ -345,6 +345,14 @@ public SignatureMethod newSignatureMethod(String algorithm, return new DOMSignatureMethod.SHA384withECDSA(params); } else if (algorithm.equals(DOMSignatureMethod.ECDSA_SHA512)) { return new DOMSignatureMethod.SHA512withECDSA(params); + } else if (algorithm.equals(DOMSignatureMethod.ECDSA_SHA3_224)) { + return new DOMSignatureMethod.SHA3_224withECDSA(params); + } else if (algorithm.equals(DOMSignatureMethod.ECDSA_SHA3_256)) { + return new DOMSignatureMethod.SHA3_256withECDSA(params); + } else if (algorithm.equals(DOMSignatureMethod.ECDSA_SHA3_384)) { + return new DOMSignatureMethod.SHA3_384withECDSA(params); + } else if (algorithm.equals(DOMSignatureMethod.ECDSA_SHA3_512)) { + return new DOMSignatureMethod.SHA3_512withECDSA(params); } else if (algorithm.equals(DOMSignatureMethod.ECDSA_RIPEMD160)) { return new DOMSignatureMethod.RIPEMD160withECDSA(params); } else if (algorithm.equals(DOMSignatureMethod.ED25519)) { diff --git a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java index 2982291c8e2..670d7b0c867 100644 --- a/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java +++ b/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/XMLDSigRI.java @@ -142,7 +142,7 @@ public Object newInstance(Object ctrParamObj) @SuppressWarnings("removal") public XMLDSigRI() { // This is the JDK XMLDSig provider, synced from - // Apache Santuario XML Security for Java, version 3.0.3 + // Apache Santuario XML Security for Java, version 3.0.5 super("XMLDSig", VER, INFO); final Provider p = this; diff --git a/src/java.xml.crypto/share/legal/santuario.md b/src/java.xml.crypto/share/legal/santuario.md index 768f0c7b144..4421e16df25 100644 --- a/src/java.xml.crypto/share/legal/santuario.md +++ b/src/java.xml.crypto/share/legal/santuario.md @@ -1,4 +1,4 @@ -## Apache Santuario v3.0.3 +## Apache Santuario v3.0.5 ### Apache 2.0 License ``` @@ -211,7 +211,7 @@ limitations under the License. ``` Apache Santuario - XML Security for Java -Copyright 1999-2023 The Apache Software Foundation +Copyright 1999-2024 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). @@ -223,5 +223,5 @@ The development of this software was partly funded by the European Commission in the project in the ISIS Programme. This product contains software that is -copyright (c) 2021, Oracle and/or its affiliates. +copyright (c) 2021, 2023, Oracle and/or its affiliates. ``` diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties index 1a915f243fb..9126efd4674 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_de.properties @@ -315,8 +315,8 @@ # Implementation limits - EntityExpansionLimit=JAXP00010001: Der Parser hat mehr als {0} Entityerweiterungen in diesem Dokument gefunden. Dies ist der von JDK vorgeschriebene Grenzwert. - ElementAttributeLimit=JAXP00010002: Element "{0}" hat mehr als {1} Attribute. "{1}" ist der von JDK vorgeschriebene Grenzwert. + EntityExpansionLimit=JAXP00010001: Der Parser hat mehr als {0} Entityerweiterungen in diesem Dokument gefunden. Das ist der von "{1}" vorgeschriebene Grenzwert. + ElementAttributeLimit=JAXP00010002: Element "{0}" hat mehr als {1} Attribute. "{1}" ist der von "{2}" vorgeschriebene Grenzwert. MaxEntitySizeLimit=JAXP00010003: Die Länge von Entity "{0}" ist "{1}" und überschreitet den Grenzwert "{2}", der von "{3}" festgelegt wurde. TotalEntitySizeLimit=JAXP00010004: Die akkumulierte Größe von Entitys ist "{0}" und überschreitet den Grenzwert "{1}", der von "{2}" festgelegt wurde. MaxXMLNameLimit=JAXP00010005: Die Länge von Entity "{0}" ist "{1}" und überschreitet den Grenzwert "{2}", der von "{3}" festgelegt wurde. diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ja.properties b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ja.properties index bbfbb9c26f5..d474ef6423e 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ja.properties +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_ja.properties @@ -315,8 +315,8 @@ # Implementation limits - EntityExpansionLimit=JAXP00010001: パーサーによって、このドキュメント内で"{0}"を超えるエンティティ拡張が検出されました。これは、JDKによる制限です。 - ElementAttributeLimit=JAXP00010002: 要素"{0}"に"{1}"を超える属性が存在します。"{1}"は、JDKによる制限です。 + EntityExpansionLimit=JAXP00010001: パーサーによって、このドキュメント内で"{0}"を超えるエンティティ拡張が検出されました。これは、"{1}"による制限です。 + ElementAttributeLimit=JAXP00010002: 要素"{0}"に"{1}"を超える属性が存在します。"{1}"は、"{2}"で設定された制限です。 MaxEntitySizeLimit=JAXP00010003: エンティティ"{0}"の長さは"{1}"で、"{3}"で設定された制限"{2}"を超えています。 TotalEntitySizeLimit=JAXP00010004: エンティティの累積サイズ"{0}"は、"{2}"で設定された制限"{1}"を超えました。 MaxXMLNameLimit=JAXP00010005: エンティティ"{0}"の長さは"{1}"で、"{3}"で設定された制限"{2}"を超えています。 diff --git a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_CN.properties b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_CN.properties index af7fd26aa38..048442236e0 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_CN.properties +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages_zh_CN.properties @@ -315,8 +315,8 @@ # Implementation limits - EntityExpansionLimit=JAXP00010001: 解析器在此文档中遇到多个 "{0}" 实体扩展; 这是 JDK 施加的限制。 - ElementAttributeLimit=JAXP00010002: 元素 "{0}" 具有多个 "{1}" 属性, "{1}" 是 JDK 施加的限制。 + EntityExpansionLimit=JAXP00010001:解析器在此文档中遇到多个 "{0}" 实体扩展;这是 "{1}" 施加的限制。 + ElementAttributeLimit=JAXP00010002:元素 "{0}" 具有多个 "{1}" 属性,"{1}" 是 "{2}" 设置的限制。 MaxEntitySizeLimit=JAXP00010003: 实体 "{0}" 的长度为 "{1}", 超过了 "{3}" 设置的 "{2}" 限制。 TotalEntitySizeLimit=JAXP00010004: 实体的累计大小为 "{0}", 超过了 "{2}" 设置的 "{1}" 限制。 MaxXMLNameLimit=JAXP00010005: 实体 "{0}" 的长度为 "{1}", 超过了 "{3}" 设置的 "{2}" 限制。 diff --git a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java index 69cd4dcdb99..52cfd97d7c2 100644 --- a/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java +++ b/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java @@ -56,6 +56,7 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { private static final Path ROOT_TMP = Path.of("root/tmp"); String socket_path; + private int ver = VERSION_1; // updated in ctor depending on detectVersion result /** * Attaches to the target VM @@ -122,14 +123,18 @@ public class VirtualMachineImpl extends HotSpotVirtualMachine { // bogus process checkPermissions(socket_path); - // Check that we can connect to the process - // - this ensures we throw the permission denied error now rather than - // later when we attempt to enqueue a command. - int s = socket(); - try { - connect(s, socket_path); - } finally { - close(s); + if (isAPIv2Enabled()) { + ver = detectVersion(); + } else { + // Check that we can connect to the process + // - this ensures we throw the permission denied error now rather than + // later when we attempt to enqueue a command. + int s = socket(); + try { + connect(s, socket_path); + } finally { + close(s); + } } } @@ -144,14 +149,10 @@ public void detach() throws IOException { } } - // protocol version - private static final String PROTOCOL_VERSION = "1"; - /** * Execute the given command in the target VM. */ InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOException { - assert args.length <= 3; // includes null checkNulls(args); // did we detach? @@ -175,18 +176,9 @@ InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOEx IOException ioe = null; // connected - write request - // try { - writeString(s, PROTOCOL_VERSION); - writeString(s, cmd); - - for (int i = 0; i < 3; i++) { - if (i < args.length && args[i] != null) { - writeString(s, (String)args[i]); - } else { - writeString(s, ""); - } - } + SocketOutputStream writer = new SocketOutputStream(s); + writeCommand(writer, ver, cmd, args); } catch (IOException x) { ioe = x; } @@ -202,6 +194,17 @@ InputStream execute(String cmd, Object ... args) throws AgentLoadException, IOEx return sis; } + private static class SocketOutputStream implements AttachOutputStream { + private int fd; + public SocketOutputStream(int fd) { + this.fd = fd; + } + @Override + public void write(byte[] buffer, int offset, int length) throws IOException { + VirtualMachineImpl.write(fd, buffer, offset, length); + } + } + /* * InputStream for the socket connection to get target VM */ @@ -273,20 +276,6 @@ private String findTargetProcessTmpDirectory(long pid, long ns_pid) throws Attac return (Files.isWritable(procPidRoot) ? procPidRoot : TMPDIR).toString(); } - /* - * Write/sends the given to the target VM. String is transmitted in - * UTF-8 encoding. - */ - private void writeString(int fd, String s) throws IOException { - if (s.length() > 0) { - byte[] b = s.getBytes(UTF_8); - VirtualMachineImpl.write(fd, b, 0, b.length); - } - byte b[] = new byte[1]; - b[0] = 0; - write(fd, b, 0, 1); - } - // Return the inner most namespaced PID if there is one, // otherwise return the original PID. private long getNamespacePid(long pid) throws AttachNotSupportedException, IOException { diff --git a/src/jdk.compiler/share/classes/com/sun/source/tree/CaseTree.java b/src/jdk.compiler/share/classes/com/sun/source/tree/CaseTree.java index 62fa36fa6b7..335ede1d7f6 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/tree/CaseTree.java +++ b/src/jdk.compiler/share/classes/com/sun/source/tree/CaseTree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java b/src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java index 4b7df6185d6..845203c8735 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java +++ b/src/jdk.compiler/share/classes/com/sun/source/tree/Tree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/source/tree/TreeVisitor.java b/src/jdk.compiler/share/classes/com/sun/source/tree/TreeVisitor.java index b7851d8ff9a..a2a33ccf8eb 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/tree/TreeVisitor.java +++ b/src/jdk.compiler/share/classes/com/sun/source/tree/TreeVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/source/tree/YieldTree.java b/src/jdk.compiler/share/classes/com/sun/source/tree/YieldTree.java index eeda36d84ae..360debca7e4 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/tree/YieldTree.java +++ b/src/jdk.compiler/share/classes/com/sun/source/tree/YieldTree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/source/util/Plugin.java b/src/jdk.compiler/share/classes/com/sun/source/util/Plugin.java index aee626929f4..7fcce4285fe 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/util/Plugin.java +++ b/src/jdk.compiler/share/classes/com/sun/source/util/Plugin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/source/util/SimpleTreeVisitor.java b/src/jdk.compiler/share/classes/com/sun/source/util/SimpleTreeVisitor.java index 1a123a49faa..77305d56b1e 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/util/SimpleTreeVisitor.java +++ b/src/jdk.compiler/share/classes/com/sun/source/util/SimpleTreeVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java b/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java index 4327c6f5f31..29e81c206e0 100644 --- a/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java +++ b/src/jdk.compiler/share/classes/com/sun/source/util/TreeScanner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacScope.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacScope.java index 9b3a50a035a..18f9859e62b 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacScope.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacScope.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java index 972d6a1075b..655f58bfee5 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -719,7 +719,6 @@ private void scanPlatformPath(PackageSymbol p) throws IOException { EnumSet.of(JavaFileObject.Kind.CLASS))); } // where - @SuppressWarnings("fallthrough") private void fillIn(PackageSymbol p, Location location, Iterable files) diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Directive.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Directive.java index cf942dab5cd..f41866ddb6a 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Directive.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Directive.java @@ -76,7 +76,7 @@ public static int value(Set s) { @Override public String toString() { - return String.format("ACC_%s (0x%04x", name(), value); + return String.format("ACC_%s (0x%04x)", name(), value); } } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java index a2937b73a14..b7fac8948c9 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Flags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java index 2491cd31f0d..5923af86579 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java index 622c13d8b47..e28c0fe60f8 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java @@ -28,12 +28,16 @@ import java.util.Arrays; import java.util.EnumSet; import java.util.Map; +import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; import com.sun.tools.javac.code.Symbol.*; import com.sun.tools.javac.main.Option; import com.sun.tools.javac.util.Context; +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; +import com.sun.tools.javac.util.JCDiagnostic.LintWarning; import com.sun.tools.javac.util.List; +import com.sun.tools.javac.util.Log; import com.sun.tools.javac.util.Options; import com.sun.tools.javac.util.Pair; @@ -359,8 +363,14 @@ public enum LintCategory { map.put(option, this); } - static LintCategory get(String option) { - return map.get(option); + /** + * Get the {@link LintCategory} having the given command line option. + * + * @param option lint category option string + * @return corresponding {@link LintCategory}, or empty if none exists + */ + public static Optional get(String option) { + return Optional.ofNullable(map.get(option)); } public final String option; @@ -385,6 +395,15 @@ public boolean isSuppressed(LintCategory lc) { return suppressedValues.contains(lc); } + /** + * Helper method. Log a lint warning if its lint category is enabled. + */ + public void logIfEnabled(Log log, DiagnosticPosition pos, LintWarning warning) { + if (isEnabled(warning.getLintCategory())) { + log.warning(pos, warning); + } + } + protected static class AugmentVisitor implements Attribute.Visitor { private final Context context; private Symtab syms; @@ -429,9 +448,8 @@ private void suppress(LintCategory lc) { public void visitConstant(Attribute.Constant value) { if (value.type.tsym == syms.stringType.tsym) { - LintCategory lc = LintCategory.get((String) (value.value)); - if (lc != null) - suppress(lc); + LintCategory.get((String)value.value) + .ifPresent(this::suppress); } } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java index c66e1758616..4ce9147f6f5 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java @@ -30,11 +30,13 @@ import com.sun.tools.javac.code.Symbol.ModuleSymbol; import com.sun.tools.javac.jvm.Target; import com.sun.tools.javac.resources.CompilerProperties.Errors; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.resources.CompilerProperties.Warnings; import com.sun.tools.javac.util.Assert; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import com.sun.tools.javac.util.JCDiagnostic.Error; +import com.sun.tools.javac.util.JCDiagnostic.LintWarning; import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition; import com.sun.tools.javac.util.JCDiagnostic.Warning; import com.sun.tools.javac.util.Log; @@ -150,7 +152,9 @@ public boolean participatesInPreview(Symtab syms, ModuleSymbol m) { // s participates in the preview API return syms.java_base.exports.stream() .filter(ed -> ed.packge.fullname == names.jdk_internal_javac) - .anyMatch(ed -> ed.modules.contains(m)); + .anyMatch(ed -> ed.modules.contains(m)) || + //the specification lists the java.se module as participating in preview: + m.name == names.java_se; } /** @@ -175,8 +179,8 @@ public void warnPreview(DiagnosticPosition pos, Feature feature) { if (!lint.isSuppressed(LintCategory.PREVIEW)) { sourcesWithPreviewFeatures.add(log.currentSourceFile()); previewHandler.report(pos, feature.isPlural() ? - Warnings.PreviewFeatureUsePlural(feature.nameFragment()) : - Warnings.PreviewFeatureUse(feature.nameFragment())); + LintWarnings.PreviewFeatureUsePlural(feature.nameFragment()) : + LintWarnings.PreviewFeatureUse(feature.nameFragment())); } } @@ -188,8 +192,8 @@ public void warnPreview(DiagnosticPosition pos, Feature feature) { public void warnPreview(JavaFileObject classfile, int majorVersion) { Assert.check(isEnabled()); if (lint.isEnabled(LintCategory.PREVIEW)) { - log.mandatoryWarning(LintCategory.PREVIEW, null, - Warnings.PreviewFeatureUseClassfile(classfile, majorVersionToSource.get(majorVersion).name)); + log.mandatoryWarning(null, + LintWarnings.PreviewFeatureUseClassfile(classfile, majorVersionToSource.get(majorVersion).name)); } } @@ -197,7 +201,7 @@ public void markUsesPreview(DiagnosticPosition pos) { sourcesWithPreviewFeatures.add(log.currentSourceFile()); } - public void reportPreviewWarning(DiagnosticPosition pos, Warning warnKey) { + public void reportPreviewWarning(DiagnosticPosition pos, LintWarning warnKey) { previewHandler.report(pos, warnKey); } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Printer.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Printer.java index f59392c658b..d9781f19c5d 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Printer.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Printer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java index 99f0645cd5c..ec71f71f6fa 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Symbol.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1694,7 +1694,6 @@ public List getPermittedSubclasses() { /** A class for variable symbols */ - @SuppressWarnings("preview") public static class VarSymbol extends Symbol implements VariableElement { /** The variable's declaration position. diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java index 7bcef30a3f9..bd2ea704831 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Type.java @@ -361,7 +361,6 @@ public List getMetadata() { /** * Get the type metadata of the given kind associated with this type (if any). */ - @SuppressWarnings("unchecked") public M getMetadata(Class metadataClass) { return getMetadata(metadataClass, Function.identity(), null); } @@ -2133,7 +2132,6 @@ public final void addBound(InferenceBound ib, Type bound, Types types) { addBound(ib, bound, types, false); } - @SuppressWarnings("fallthrough") private void addBound(InferenceBound ib, Type bound, Types types, boolean update) { if (kind == Kind.CAPTURED && !update) { //Captured inference variables bounds must not be updated during incorporation, diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java index 886da9fd6ba..90b9744d296 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeAnnotations.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeTag.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeTag.java index 51d3deec88b..0b97b119119 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeTag.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/TypeTag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java index 3545ebcc278..1bc1e078c1a 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java index d117573ce9d..6a6e345365c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Analyzer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -611,7 +611,6 @@ public void scan() { } @Override - @SuppressWarnings("unchecked") public void scan(JCTree tree) { if (tree != null) { for (StatementAnalyzer analyzer : analyzers) { 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 62f7c15a95f..19379480643 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 @@ -58,6 +58,7 @@ import com.sun.tools.javac.resources.CompilerProperties.Errors; import com.sun.tools.javac.resources.CompilerProperties.Fragments; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.resources.CompilerProperties.Warnings; import com.sun.tools.javac.tree.*; import com.sun.tools.javac.tree.JCTree.*; @@ -1938,8 +1939,8 @@ private Symbol enumConstant(JCTree tree, Type enumType) { public void visitSynchronized(JCSynchronized tree) { chk.checkRefType(tree.pos(), attribExpr(tree.lock, env)); - if (env.info.lint.isEnabled(LintCategory.SYNCHRONIZATION) && isValueBased(tree.lock.type)) { - log.warning(LintCategory.SYNCHRONIZATION, tree.pos(), Warnings.AttemptToSynchronizeOnInstanceOfValueBasedClass); + if (isValueBased(tree.lock.type)) { + env.info.lint.logIfEnabled(log, tree.pos(), LintWarnings.AttemptToSynchronizeOnInstanceOfValueBasedClass); } attribStat(tree.body, env); result = null; @@ -2045,9 +2046,8 @@ void checkAutoCloseable(DiagnosticPosition pos, Env env, Type resou } if (close.kind == MTH && close.overrides(syms.autoCloseableClose, resource.tsym, types, true) && - chk.isHandled(syms.interruptedExceptionType, types.memberType(resource, close).getThrownTypes()) && - env.info.lint.isEnabled(LintCategory.TRY)) { - log.warning(LintCategory.TRY, pos, Warnings.TryResourceThrowsInterruptedExc(resource)); + chk.isHandled(syms.interruptedExceptionType, types.memberType(resource, close).getThrownTypes())) { + env.info.lint.logIfEnabled(log, pos, LintWarnings.TryResourceThrowsInterruptedExc(resource)); } } } @@ -2587,10 +2587,6 @@ public void visitApply(JCMethodInvocation tree) { chk.checkRefType(qualifier.pos(), attribExpr(qualifier, localEnv, encl)); - } else if (methName == names._super) { - // qualifier omitted; check for existence - // of an appropriate implicit qualifier. - checkNewInnerClass(tree.meth.pos(), localEnv, site, true); } } else if (tree.meth.hasTag(SELECT)) { log.error(tree.meth.pos(), @@ -2598,6 +2594,15 @@ public void visitApply(JCMethodInvocation tree) { attribExpr(((JCFieldAccess) tree.meth).selected, localEnv, site); } + if (tree.meth.hasTag(IDENT)) { + // non-qualified super(...) call; check whether explicit constructor + // invocation is well-formed. If the super class is an inner class, + // make sure that an appropriate implicit qualifier exists. If the super + // class is a local class, make sure that the current class is defined + // in the same context as the local class. + checkNewInnerClass(tree.meth.pos(), localEnv, site, true); + } + // if we're calling a java.lang.Enum constructor, // prefix the implicit String and int parameters if (site.tsym == syms.enumSym) @@ -3065,7 +3070,7 @@ public void report(DiagnosticPosition _unused, JCDiagnostic details) { } void checkNewInnerClass(DiagnosticPosition pos, Env env, Type type, boolean isSuper) { - boolean isLocal = type.tsym.owner.kind == MTH; + boolean isLocal = type.tsym.owner.kind == VAR || type.tsym.owner.kind == MTH; if ((type.tsym.flags() & (INTERFACE | ENUM | RECORD)) != 0 || (!isLocal && !type.tsym.isInner()) || (isSuper && env.enclClass.sym.isAnonymous())) { @@ -4441,9 +4446,8 @@ public void visitSelect(JCFieldAccess tree) { ((VarSymbol)sitesym).isResourceVariable() && sym.kind == MTH && sym.name.equals(names.close) && - sym.overrides(syms.autoCloseableClose, sitesym.type.tsym, types, true) && - env.info.lint.isEnabled(LintCategory.TRY)) { - log.warning(LintCategory.TRY, tree, Warnings.TryExplicitCloseCall); + sym.overrides(syms.autoCloseableClose, sitesym.type.tsym, types, true)) { + env.info.lint.logIfEnabled(log, tree, LintWarnings.TryExplicitCloseCall); } // Disallow selecting a type from an expression @@ -4470,9 +4474,9 @@ public void visitSelect(JCFieldAccess tree) { // If the qualified item is not a type and the selected item is static, report // a warning. Make allowance for the class of an array type e.g. Object[].class) if (!sym.owner.isAnonymous()) { - chk.warnStatic(tree, Warnings.StaticNotQualifiedByType(sym.kind.kindName(), sym.owner)); + chk.lint.logIfEnabled(log, tree, LintWarnings.StaticNotQualifiedByType(sym.kind.kindName(), sym.owner)); } else { - chk.warnStatic(tree, Warnings.StaticNotQualifiedByType2(sym.kind.kindName())); + chk.lint.logIfEnabled(log, tree, LintWarnings.StaticNotQualifiedByType2(sym.kind.kindName())); } } @@ -4685,7 +4689,7 @@ else if (ownOuter.hasTag(CLASS) && site != ownOuter) { if (s != null && s.isRaw() && !types.isSameType(v.type, v.erasure(types))) { - chk.warnUnchecked(tree.pos(), Warnings.UncheckedAssignToVar(v, s)); + chk.warnUnchecked(tree.pos(), LintWarnings.UncheckedAssignToVar(v, s)); } } // The computed type of a variable is the type of the @@ -4883,7 +4887,7 @@ public Type checkMethod(Type site, if (s != null && s.isRaw() && !types.isSameTypes(sym.type.getParameterTypes(), sym.erasure(types).getParameterTypes())) { - chk.warnUnchecked(env.tree.pos(), Warnings.UncheckedCallMbrOfRawType(sym, s)); + chk.warnUnchecked(env.tree.pos(), LintWarnings.UncheckedCallMbrOfRawType(sym, s)); } } @@ -4933,7 +4937,7 @@ public Type checkMethod(Type site, argtypes = argtypes.map(checkDeferredMap); if (noteWarner.hasNonSilentLint(LintCategory.UNCHECKED)) { - chk.warnUnchecked(env.tree.pos(), Warnings.UncheckedMethInvocationApplied(kindName(sym), + chk.warnUnchecked(env.tree.pos(), LintWarnings.UncheckedMethInvocationApplied(kindName(sym), sym.name, rs.methodArguments(sym.type.getParameterTypes()), rs.methodArguments(argtypes.map(checkDeferredMap)), diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java index f121849457c..2a7b339f258 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/AttrContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java index 3f675cad651..a5b4186659b 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java @@ -28,7 +28,6 @@ import java.util.*; import java.util.function.BiConsumer; import java.util.function.BiPredicate; -import java.util.function.Consumer; import java.util.function.Predicate; import java.util.function.Supplier; import java.util.function.ToIntBiFunction; @@ -50,13 +49,14 @@ import com.sun.tools.javac.resources.CompilerProperties.Errors; import com.sun.tools.javac.resources.CompilerProperties.Fragments; import com.sun.tools.javac.resources.CompilerProperties.Warnings; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.tree.*; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import com.sun.tools.javac.util.JCDiagnostic.Error; import com.sun.tools.javac.util.JCDiagnostic.Fragment; -import com.sun.tools.javac.util.JCDiagnostic.Warning; +import com.sun.tools.javac.util.JCDiagnostic.LintWarning; import com.sun.tools.javac.util.List; import com.sun.tools.javac.code.Lint; @@ -79,11 +79,8 @@ import static com.sun.tools.javac.tree.JCTree.Tag.*; import javax.lang.model.element.Element; -import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.DeclaredType; -import javax.lang.model.type.TypeMirror; -import javax.lang.model.util.ElementFilter; import javax.lang.model.util.ElementKindVisitor14; /** Type checking helper class for the attribution phase. @@ -122,7 +119,7 @@ public class Check { // The set of lint options currently in effect. It is initialized // from the context, and then is set/reset as needed by Attr as it // visits all the various parts of the trees during attribution. - private Lint lint; + Lint lint; // The method being analyzed in Attr - it is set/reset as needed by // Attr as it visits new method declarations. @@ -251,16 +248,16 @@ void warnDeprecated(DiagnosticPosition pos, Symbol sym) { if (sym.isDeprecatedForRemoval()) { if (!lint.isSuppressed(LintCategory.REMOVAL)) { if (sym.kind == MDL) { - removalHandler.report(pos, Warnings.HasBeenDeprecatedForRemovalModule(sym)); + removalHandler.report(pos, LintWarnings.HasBeenDeprecatedForRemovalModule(sym)); } else { - removalHandler.report(pos, Warnings.HasBeenDeprecatedForRemoval(sym, sym.location())); + removalHandler.report(pos, LintWarnings.HasBeenDeprecatedForRemoval(sym, sym.location())); } } } else if (!lint.isSuppressed(LintCategory.DEPRECATION)) { if (sym.kind == MDL) { - deprecationHandler.report(pos, Warnings.HasBeenDeprecatedModule(sym)); + deprecationHandler.report(pos, LintWarnings.HasBeenDeprecatedModule(sym)); } else { - deprecationHandler.report(pos, Warnings.HasBeenDeprecated(sym, sym.location())); + deprecationHandler.report(pos, LintWarnings.HasBeenDeprecated(sym, sym.location())); } } } @@ -269,7 +266,7 @@ void warnDeprecated(DiagnosticPosition pos, Symbol sym) { * @param pos Position to be used for error reporting. * @param msg A Warning describing the problem. */ - public void warnPreviewAPI(DiagnosticPosition pos, Warning warnKey) { + public void warnPreviewAPI(DiagnosticPosition pos, LintWarning warnKey) { if (!lint.isSuppressed(LintCategory.PREVIEW)) preview.reportPreviewWarning(pos, warnKey); } @@ -280,7 +277,7 @@ public void warnPreviewAPI(DiagnosticPosition pos, Warning warnKey) { */ public void warnDeclaredUsingPreview(DiagnosticPosition pos, Symbol sym) { if (!lint.isSuppressed(LintCategory.PREVIEW)) - preview.reportPreviewWarning(pos, Warnings.DeclaredUsingPreview(kindName(sym), sym)); + preview.reportPreviewWarning(pos, LintWarnings.DeclaredUsingPreview(kindName(sym), sym)); } /** Log a preview warning. @@ -288,40 +285,18 @@ public void warnDeclaredUsingPreview(DiagnosticPosition pos, Symbol sym) { * @param msg A Warning describing the problem. */ public void warnRestrictedAPI(DiagnosticPosition pos, Symbol sym) { - if (lint.isEnabled(LintCategory.RESTRICTED)) - log.warning(LintCategory.RESTRICTED, pos, Warnings.RestrictedMethod(sym.enclClass(), sym)); + lint.logIfEnabled(log, pos, LintWarnings.RestrictedMethod(sym.enclClass(), sym)); } /** Warn about unchecked operation. * @param pos Position to be used for error reporting. * @param msg A string describing the problem. */ - public void warnUnchecked(DiagnosticPosition pos, Warning warnKey) { + public void warnUnchecked(DiagnosticPosition pos, LintWarning warnKey) { if (!lint.isSuppressed(LintCategory.UNCHECKED)) uncheckedHandler.report(pos, warnKey); } - /** Warn about unsafe vararg method decl. - * @param pos Position to be used for error reporting. - */ - void warnUnsafeVararg(DiagnosticPosition pos, Warning warnKey) { - if (lint.isEnabled(LintCategory.VARARGS)) - log.warning(LintCategory.VARARGS, pos, warnKey); - } - - public void warnStatic(DiagnosticPosition pos, Warning warnKey) { - if (lint.isEnabled(LintCategory.STATIC)) - log.warning(LintCategory.STATIC, pos, warnKey); - } - - /** Warn about division by integer constant zero. - * @param pos Position to be used for error reporting. - */ - void warnDivZero(DiagnosticPosition pos) { - if (lint.isEnabled(LintCategory.DIVZERO)) - log.warning(LintCategory.DIVZERO, pos, Warnings.DivZero); - } - /** * Report any deferred diagnostics. */ @@ -674,9 +649,7 @@ public void checkRedundantCast(Env env, final JCTypeCast tree) { && !(ignoreAnnotatedCasts && TreeInfo.containsTypeAnnotation(tree.clazz)) && !is292targetTypeCast(tree)) { deferredLintHandler.report(_l -> { - if (lint.isEnabled(LintCategory.CAST)) - log.warning(LintCategory.CAST, - tree.pos(), Warnings.RedundantCast(tree.clazz.type)); + lint.logIfEnabled(log, tree.pos(), LintWarnings.RedundantCast(tree.clazz.type)); }); } } @@ -981,13 +954,13 @@ void checkVarargsMethodDecl(Env env, JCMethodDecl tree) { } } else if (hasTrustMeAnno && varargElemType != null && types.isReifiable(varargElemType)) { - warnUnsafeVararg(tree, Warnings.VarargsRedundantTrustmeAnno( + lint.logIfEnabled(log, tree, LintWarnings.VarargsRedundantTrustmeAnno( syms.trustMeType.tsym, diags.fragment(Fragments.VarargsTrustmeOnReifiableVarargs(varargElemType)))); } else if (!hasTrustMeAnno && varargElemType != null && !types.isReifiable(varargElemType)) { - warnUnchecked(tree.params.head.pos(), Warnings.UncheckedVarargsNonReifiableType(varargElemType)); + warnUnchecked(tree.params.head.pos(), LintWarnings.UncheckedVarargsNonReifiableType(varargElemType)); } } //where @@ -1074,7 +1047,7 @@ Type checkMethod(final Type mtype, if (!types.isReifiable(argtype) && (sym.baseSymbol().attribute(syms.trustMeType.tsym) == null || !isTrustMeAllowedOnMethod(sym))) { - warnUnchecked(env.tree.pos(), Warnings.UncheckedGenericArrayCreation(argtype)); + warnUnchecked(env.tree.pos(), LintWarnings.UncheckedGenericArrayCreation(argtype)); } TreeInfo.setVarargsElement(env.tree, types.elemtype(argtype)); } @@ -1350,11 +1323,7 @@ && checkDisjoint(pos, flags, private void warnOnExplicitStrictfp(DiagnosticPosition pos) { DiagnosticPosition prevLintPos = deferredLintHandler.setPos(pos); try { - deferredLintHandler.report(_l -> { - if (lint.isEnabled(LintCategory.STRICTFP)) { - log.warning(LintCategory.STRICTFP, - pos, Warnings.Strictfp); } - }); + deferredLintHandler.report(_ -> lint.logIfEnabled(log, pos, LintWarnings.Strictfp)); } finally { deferredLintHandler.setPos(prevLintPos); } @@ -1569,13 +1538,11 @@ public void validateTrees(List trees, boolean checkRaw, boolea } void checkRaw(JCTree tree, Env env) { - if (lint.isEnabled(LintCategory.RAW) && - tree.type.hasTag(CLASS) && + if (tree.type.hasTag(CLASS) && !TreeInfo.isDiamond(tree) && !withinAnonConstr(env) && tree.type.isRaw()) { - log.warning(LintCategory.RAW, - tree.pos(), Warnings.RawClassUse(tree.type, tree.type.tsym.type)); + lint.logIfEnabled(log, tree.pos(), LintWarnings.RawClassUse(tree.type, tree.type.tsym.type)); } } //where @@ -1877,7 +1844,7 @@ void checkOverride(JCTree tree, return; } else if (overrideWarner.hasNonSilentLint(LintCategory.UNCHECKED)) { warnUnchecked(TreeInfo.diagnosticPositionFor(m, tree), - Warnings.OverrideUncheckedRet(uncheckedOverrides(m, other), mtres, otres)); + LintWarnings.OverrideUncheckedRet(uncheckedOverrides(m, other), mtres, otres)); } // Error if overriding method throws an exception not reported @@ -1893,17 +1860,16 @@ void checkOverride(JCTree tree, } else if (unhandledUnerased.nonEmpty()) { warnUnchecked(TreeInfo.diagnosticPositionFor(m, tree), - Warnings.OverrideUncheckedThrown(cannotOverride(m, other), unhandledUnerased.head)); + LintWarnings.OverrideUncheckedThrown(cannotOverride(m, other), unhandledUnerased.head)); return; } // Optional warning if varargs don't agree - if ((((m.flags() ^ other.flags()) & Flags.VARARGS) != 0) - && lint.isEnabled(LintCategory.OVERRIDES)) { - log.warning(TreeInfo.diagnosticPositionFor(m, tree), + if ((((m.flags() ^ other.flags()) & Flags.VARARGS) != 0)) { + lint.logIfEnabled(log, TreeInfo.diagnosticPositionFor(m, tree), ((m.flags() & Flags.VARARGS) != 0) - ? Warnings.OverrideVarargsMissing(varargsOverrides(m, other)) - : Warnings.OverrideVarargsExtra(varargsOverrides(m, other))); + ? LintWarnings.OverrideVarargsMissing(varargsOverrides(m, other)) + : LintWarnings.OverrideVarargsExtra(varargsOverrides(m, other))); } // Warn if instance method overrides bridge method (compiler spec ??) @@ -2247,8 +2213,8 @@ private void checkClassOverrideEqualsAndHash(DiagnosticPosition pos, someClass, false, equalsHasCodeFilter) != hashCodeAtObject; if (overridesEquals && !overridesHashCode) { - log.warning(LintCategory.OVERRIDES, pos, - Warnings.OverrideEqualsButNotHashcode(someClass)); + log.warning(pos, + LintWarnings.OverrideEqualsButNotHashcode(someClass)); } } } @@ -2310,7 +2276,7 @@ public void checkModuleName (JCModuleDecl tree) { String moduleNameComponentString = componentName.toString(); int nameLength = moduleNameComponentString.length(); if (nameLength > 0 && Character.isDigit(moduleNameComponentString.charAt(nameLength - 1))) { - log.warning(Lint.LintCategory.MODULE, pos, Warnings.PoorChoiceForModuleName(componentName)); + log.warning(pos, LintWarnings.PoorChoiceForModuleName(componentName)); } } } @@ -2781,8 +2747,8 @@ void checkPotentiallyAmbiguousOverloads(JCClassDecl tree, Type site) { tree.pos(); // Log the warning - log.warning(LintCategory.OVERLOADS, pos, - Warnings.PotentiallyAmbiguousOverload( + log.warning(pos, + LintWarnings.PotentiallyAmbiguousOverload( m1.asMemberOf(site, types), m1.location(), m2.asMemberOf(site, types), m2.location())); @@ -3002,12 +2968,12 @@ void checkAccessFromSerializableElement(final JCTree tree, boolean isLambda) { isEffectivelyNonPublic(sym)) { if (isLambda) { if (belongsToRestrictedPackage(sym)) { - log.warning(LintCategory.SERIAL, tree.pos(), - Warnings.AccessToMemberFromSerializableLambda(sym)); + log.warning(tree.pos(), + LintWarnings.AccessToMemberFromSerializableLambda(sym)); } } else { log.warning(tree.pos(), - Warnings.AccessToMemberFromSerializableElement(sym)); + LintWarnings.AccessToMemberFromSerializableElement(sym)); } } } @@ -3790,14 +3756,13 @@ void checkDeprecatedAnnotation(DiagnosticPosition pos, Symbol s) { (s.flags() & DEPRECATED) != 0 && !syms.deprecatedType.isErroneous() && s.attribute(syms.deprecatedType.tsym) == null) { - log.warning(LintCategory.DEP_ANN, - pos, Warnings.MissingDeprecatedAnnotation); + log.warning(pos, LintWarnings.MissingDeprecatedAnnotation); } // Note: @Deprecated has no effect on local variables, parameters and package decls. if (lint.isEnabled(LintCategory.DEPRECATION) && !s.isDeprecatableViaAnnotation()) { if (!syms.deprecatedType.isErroneous() && s.attribute(syms.deprecatedType.tsym) != null) { - log.warning(LintCategory.DEPRECATION, pos, - Warnings.DeprecatedAnnotationHasNoEffect(Kinds.kindName(s))); + log.warning(pos, + LintWarnings.DeprecatedAnnotationHasNoEffect(Kinds.kindName(s))); } } } @@ -3857,10 +3822,10 @@ void checkPreview(DiagnosticPosition pos, Symbol other, Type site, Symbol s) { log.error(pos, Errors.IsPreview(s)); } else { preview.markUsesPreview(pos); - deferredLintHandler.report(_l -> warnPreviewAPI(pos, Warnings.IsPreview(s))); + deferredLintHandler.report(_l -> warnPreviewAPI(pos, LintWarnings.IsPreview(s))); } } else { - deferredLintHandler.report(_l -> warnPreviewAPI(pos, Warnings.IsPreviewReflective(s))); + deferredLintHandler.report(_l -> warnPreviewAPI(pos, LintWarnings.IsPreviewReflective(s))); } } if (preview.declaredUsingPreviewFeature(s)) { @@ -4148,7 +4113,7 @@ void checkDivZero(final DiagnosticPosition pos, Symbol operator, Type operand) { int opc = ((OperatorSymbol)operator).opcode; if (opc == ByteCodes.idiv || opc == ByteCodes.imod || opc == ByteCodes.ldiv || opc == ByteCodes.lmod) { - deferredLintHandler.report(_l -> warnDivZero(pos)); + deferredLintHandler.report(_ -> lint.logIfEnabled(log, pos, LintWarnings.DivZero)); } } } @@ -4161,11 +4126,8 @@ void checkDivZero(final DiagnosticPosition pos, Symbol operator, Type operand) { */ void checkLossOfPrecision(final DiagnosticPosition pos, Type found, Type req) { if (found.isNumeric() && req.isNumeric() && !types.isAssignable(found, req)) { - deferredLintHandler.report(_l -> { - if (lint.isEnabled(LintCategory.LOSSY_CONVERSIONS)) - log.warning(LintCategory.LOSSY_CONVERSIONS, - pos, Warnings.PossibleLossOfPrecision(found, req)); - }); + deferredLintHandler.report(_ -> + lint.logIfEnabled(log, pos, LintWarnings.PossibleLossOfPrecision(found, req))); } } @@ -4173,9 +4135,9 @@ void checkLossOfPrecision(final DiagnosticPosition pos, Type found, Type req) { * Check for empty statements after if */ void checkEmptyIf(JCIf tree) { - if (tree.thenpart.hasTag(SKIP) && tree.elsepart == null && - lint.isEnabled(LintCategory.EMPTY)) - log.warning(LintCategory.EMPTY, tree.thenpart.pos(), Warnings.EmptyIf); + if (tree.thenpart.hasTag(SKIP) && tree.elsepart == null) { + lint.logIfEnabled(log, tree.thenpart.pos(), LintWarnings.EmptyIf); + } } /** Check that symbol is unique in given scope. @@ -4317,13 +4279,12 @@ private boolean isCanonical(JCTree tree) { /** Check that an auxiliary class is not accessed from any other file than its own. */ void checkForBadAuxiliaryClassAccess(DiagnosticPosition pos, Env env, ClassSymbol c) { - if (lint.isEnabled(Lint.LintCategory.AUXILIARYCLASS) && - (c.flags() & AUXILIARY) != 0 && + if ((c.flags() & AUXILIARY) != 0 && rs.isAccessible(env, c) && !fileManager.isSameFile(c.sourcefile, env.toplevel.sourcefile)) { - log.warning(pos, - Warnings.AuxiliaryClassAccessedFromOutsideOfItsSourceFile(c, c.sourcefile)); + lint.logIfEnabled(log, pos, + LintWarnings.AuxiliaryClassAccessedFromOutsideOfItsSourceFile(c, c.sourcefile)); } } @@ -4365,11 +4326,8 @@ void checkDefaultConstructor(ClassSymbol c, DiagnosticPosition pos) { // Warning may be suppressed by // annotations; check again for being // enabled in the deferred context. - deferredLintHandler.report(_l -> { - if (lint.isEnabled(LintCategory.MISSING_EXPLICIT_CTOR)) - log.warning(LintCategory.MISSING_EXPLICIT_CTOR, - pos, Warnings.MissingExplicitCtor(c, pkg, modle)); - }); + deferredLintHandler.report(_ -> + lint.logIfEnabled(log, pos, LintWarnings.MissingExplicitCtor(c, pkg, modle))); } else { return; } @@ -4398,14 +4356,14 @@ public void warn(LintCategory lint) { if (warned) return; // suppress redundant diagnostics switch (lint) { case UNCHECKED: - Check.this.warnUnchecked(pos(), Warnings.ProbFoundReq(diags.fragment(uncheckedKey), found, expected)); + Check.this.warnUnchecked(pos(), LintWarnings.ProbFoundReq(diags.fragment(uncheckedKey), found, expected)); break; case VARARGS: if (method != null && method.attribute(syms.trustMeType.tsym) != null && isTrustMeAllowedOnMethod(method) && !types.isReifiable(method.type.getParameterTypes().last())) { - Check.this.warnUnsafeVararg(pos(), Warnings.VarargsUnsafeUseVarargsParam(method.params.last())); + Check.this.lint.logIfEnabled(log, pos(), LintWarnings.VarargsUnsafeUseVarargsParam(method.params.last())); } break; default: @@ -4660,7 +4618,7 @@ private boolean isAPISymbol(Symbol sym) { } private void checkVisible(DiagnosticPosition pos, Symbol what, PackageSymbol inPackage, boolean inSuperType) { if (!isAPISymbol(what) && !inSuperType) { //package private/private element - log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessible(kindName(what), what, what.packge().modle)); + log.warning(pos, LintWarnings.LeaksNotAccessible(kindName(what), what, what.packge().modle)); return ; } @@ -4669,13 +4627,13 @@ private void checkVisible(DiagnosticPosition pos, Symbol what, PackageSymbol inP ExportsDirective inExport = findExport(inPackage); if (whatExport == null) { //package not exported: - log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessibleUnexported(kindName(what), what, what.packge().modle)); + log.warning(pos, LintWarnings.LeaksNotAccessibleUnexported(kindName(what), what, what.packge().modle)); return ; } if (whatExport.modules != null) { if (inExport.modules == null || !whatExport.modules.containsAll(inExport.modules)) { - log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessibleUnexportedQualified(kindName(what), what, what.packge().modle)); + log.warning(pos, LintWarnings.LeaksNotAccessibleUnexportedQualified(kindName(what), what, what.packge().modle)); } } @@ -4697,36 +4655,32 @@ private void checkVisible(DiagnosticPosition pos, Symbol what, PackageSymbol inP } } - log.warning(LintCategory.EXPORTS, pos, Warnings.LeaksNotAccessibleNotRequiredTransitive(kindName(what), what, what.packge().modle)); + log.warning(pos, LintWarnings.LeaksNotAccessibleNotRequiredTransitive(kindName(what), what, what.packge().modle)); } } void checkModuleExists(final DiagnosticPosition pos, ModuleSymbol msym) { if (msym.kind != MDL) { - deferredLintHandler.report(_l -> { - if (lint.isEnabled(LintCategory.MODULE)) - log.warning(LintCategory.MODULE, pos, Warnings.ModuleNotFound(msym)); - }); + deferredLintHandler.report(_ -> + lint.logIfEnabled(log, pos, LintWarnings.ModuleNotFound(msym))); } } void checkPackageExistsForOpens(final DiagnosticPosition pos, PackageSymbol packge) { if (packge.members().isEmpty() && ((packge.flags() & Flags.HAS_RESOURCE) == 0)) { - deferredLintHandler.report(_l -> { - if (lint.isEnabled(LintCategory.OPENS)) - log.warning(pos, Warnings.PackageEmptyOrNotFound(packge)); - }); + deferredLintHandler.report(_ -> + lint.logIfEnabled(log, pos, LintWarnings.PackageEmptyOrNotFound(packge))); } } void checkModuleRequires(final DiagnosticPosition pos, final RequiresDirective rd) { if ((rd.module.flags() & Flags.AUTOMATIC_MODULE) != 0) { - deferredLintHandler.report(_l -> { + deferredLintHandler.report(_ -> { if (rd.isTransitive() && lint.isEnabled(LintCategory.REQUIRES_TRANSITIVE_AUTOMATIC)) { - log.warning(pos, Warnings.RequiresTransitiveAutomatic); - } else if (lint.isEnabled(LintCategory.REQUIRES_AUTOMATIC)) { - log.warning(pos, Warnings.RequiresAutomatic); + log.warning(pos, LintWarnings.RequiresTransitiveAutomatic); + } else { + lint.logIfEnabled(log, pos, LintWarnings.RequiresAutomatic); } }); } @@ -5024,7 +4978,7 @@ public Void visitTypeAsClass(TypeElement e, } if (svuidSym == null) { - log.warning(LintCategory.SERIAL, p.pos(), Warnings.MissingSVUID(c)); + log.warning(p.pos(), LintWarnings.MissingSVUID(c)); } // Check for serialPersistentFields to gate checks for @@ -5051,9 +5005,9 @@ public Void visitTypeAsClass(TypeElement e, // Note per JLS arrays are // serializable even if the // component type is not. - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(enclosed, tree), - Warnings.NonSerializableInstanceField); + log.warning( + TreeInfo.diagnosticPositionFor(enclosed, tree), + LintWarnings.NonSerializableInstanceField); } else if (varType.hasTag(ARRAY)) { ArrayType arrayType = (ArrayType)varType; Type elementType = arrayType.elemtype; @@ -5062,9 +5016,9 @@ public Void visitTypeAsClass(TypeElement e, elementType = arrayType.elemtype; } if (!canBeSerialized(elementType)) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(enclosed, tree), - Warnings.NonSerializableInstanceFieldArray(elementType)); + log.warning( + TreeInfo.diagnosticPositionFor(enclosed, tree), + LintWarnings.NonSerializableInstanceFieldArray(elementType)); } } } @@ -5147,8 +5101,8 @@ private void checkCtorAccess(JCClassDecl tree, ClassSymbol c) { } } } - log.warning(LintCategory.SERIAL, tree.pos(), - Warnings.ExternalizableMissingPublicNoArgCtor); + log.warning(tree.pos(), + LintWarnings.ExternalizableMissingPublicNoArgCtor); } else { // Approximate access to the no-arg constructor up in // the superclass chain by checking that the @@ -5175,8 +5129,8 @@ private void checkCtorAccess(JCClassDecl tree, ClassSymbol c) { // Handle nested classes and implicit this$0 (supertype.getNestingKind() == NestingKind.MEMBER && ((supertype.flags() & STATIC) == 0))) - log.warning(LintCategory.SERIAL, tree.pos(), - Warnings.SerializableMissingAccessNoArgCtor(supertype.getQualifiedName())); + log.warning(tree.pos(), + LintWarnings.SerializableMissingAccessNoArgCtor(supertype.getQualifiedName())); } } } @@ -5194,43 +5148,43 @@ private void checkSerialVersionUID(JCClassDecl tree, Element e, VarSymbol svuid) // fields. if ((svuid.flags() & (STATIC | FINAL)) != (STATIC | FINAL)) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(svuid, tree), - Warnings.ImproperSVUID((Symbol)e)); + log.warning( + TreeInfo.diagnosticPositionFor(svuid, tree), + LintWarnings.ImproperSVUID((Symbol)e)); } // check svuid has type long if (!svuid.type.hasTag(LONG)) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(svuid, tree), - Warnings.LongSVUID((Symbol)e)); + log.warning( + TreeInfo.diagnosticPositionFor(svuid, tree), + LintWarnings.LongSVUID((Symbol)e)); } if (svuid.getConstValue() == null) - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(svuid, tree), - Warnings.ConstantSVUID((Symbol)e)); + log.warning( + TreeInfo.diagnosticPositionFor(svuid, tree), + LintWarnings.ConstantSVUID((Symbol)e)); } private void checkSerialPersistentFields(JCClassDecl tree, Element e, VarSymbol spf) { // To be effective, serialPersisentFields must be private, static, and final. if ((spf.flags() & (PRIVATE | STATIC | FINAL)) != (PRIVATE | STATIC | FINAL)) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(spf, tree), - Warnings.ImproperSPF); + log.warning( + TreeInfo.diagnosticPositionFor(spf, tree), + LintWarnings.ImproperSPF); } if (!types.isSameType(spf.type, OSF_TYPE)) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(spf, tree), - Warnings.OSFArraySPF); + log.warning( + TreeInfo.diagnosticPositionFor(spf, tree), + LintWarnings.OSFArraySPF); } if (isExternalizable((Type)(e.asType()))) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(spf, tree), - Warnings.IneffectualSerialFieldExternalizable); + log.warning( + TreeInfo.diagnosticPositionFor(spf, tree), + LintWarnings.IneffectualSerialFieldExternalizable); } // Warn if serialPersistentFields is initialized to a @@ -5240,8 +5194,8 @@ private void checkSerialPersistentFields(JCClassDecl tree, Element e, VarSymbol JCVariableDecl variableDef = (JCVariableDecl) spfDecl; JCExpression initExpr = variableDef.init; if (initExpr != null && TreeInfo.isNull(initExpr)) { - log.warning(LintCategory.SERIAL, initExpr.pos(), - Warnings.SPFNullInit); + log.warning(initExpr.pos(), + LintWarnings.SPFNullInit); } } } @@ -5319,24 +5273,24 @@ private void checkReadExternalRecord(JCClassDecl tree, Element e, MethodSymbol m private void checkExternMethodRecord(JCClassDecl tree, Element e, MethodSymbol method, Type argType, boolean isExtern) { if (isExtern && isExternMethod(tree, e, method, argType)) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.IneffectualExternalizableMethodRecord(method.getSimpleName().toString())); + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.IneffectualExternalizableMethodRecord(method.getSimpleName().toString())); } } void checkPrivateNonStaticMethod(JCClassDecl tree, MethodSymbol method) { var flags = method.flags(); if ((flags & PRIVATE) == 0) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.SerialMethodNotPrivate(method.getSimpleName())); + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.SerialMethodNotPrivate(method.getSimpleName())); } if ((flags & STATIC) != 0) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.SerialMethodStatic(method.getSimpleName())); + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.SerialMethodStatic(method.getSimpleName())); } } @@ -5359,18 +5313,18 @@ public Void visitTypeAsEnum(TypeElement e, case FIELD -> { var field = (VarSymbol)enclosed; if (serialFieldNames.contains(name)) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(field, tree), - Warnings.IneffectualSerialFieldEnum(name)); + log.warning( + TreeInfo.diagnosticPositionFor(field, tree), + LintWarnings.IneffectualSerialFieldEnum(name)); } } case METHOD -> { var method = (MethodSymbol)enclosed; if (serialMethodNames.contains(name)) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.IneffectualSerialMethodEnum(name)); + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.IneffectualSerialMethodEnum(name)); } if (isExtern) { @@ -5408,9 +5362,9 @@ private void checkReadExternalEnum(JCClassDecl tree, Element e, MethodSymbol met private void checkExternMethodEnum(JCClassDecl tree, Element e, MethodSymbol method, Type argType) { if (isExternMethod(tree, e, method, argType)) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.IneffectualExternMethodEnum(method.getSimpleName().toString())); + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.IneffectualExternMethodEnum(method.getSimpleName().toString())); } } @@ -5440,9 +5394,9 @@ public Void visitTypeAsInterface(TypeElement e, name = field.getSimpleName().toString(); switch(name) { case "serialPersistentFields" -> { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(field, tree), - Warnings.IneffectualSerialFieldInterface); + log.warning( + TreeInfo.diagnosticPositionFor(field, tree), + LintWarnings.IneffectualSerialFieldInterface); } case "serialVersionUID" -> { @@ -5480,9 +5434,9 @@ private void checkPrivateMethod(JCClassDecl tree, Element e, MethodSymbol method) { if ((method.flags() & PRIVATE) == 0) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.NonPrivateMethodWeakerAccess); + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.NonPrivateMethodWeakerAccess); } } @@ -5490,9 +5444,9 @@ private void checkDefaultIneffective(JCClassDecl tree, Element e, MethodSymbol method) { if ((method.flags() & DEFAULT) == DEFAULT) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.DefaultIneffective); + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.DefaultIneffective); } } @@ -5537,9 +5491,9 @@ public Void visitTypeAsRecord(TypeElement e, var field = (VarSymbol)enclosed; switch(name) { case "serialPersistentFields" -> { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(field, tree), - Warnings.IneffectualSerialFieldRecord); + log.warning( + TreeInfo.diagnosticPositionFor(field, tree), + LintWarnings.IneffectualSerialFieldRecord); } case "serialVersionUID" -> { @@ -5561,9 +5515,9 @@ public Void visitTypeAsRecord(TypeElement e, default -> { if (serialMethodNames.contains(name)) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.IneffectualSerialMethodRecord(name)); + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.IneffectualSerialMethodRecord(name)); } }} }}}); @@ -5575,9 +5529,9 @@ void checkConcreteInstanceMethod(JCClassDecl tree, Element enclosing, MethodSymbol method) { if ((method.flags() & (STATIC | ABSTRACT)) != 0) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.SerialConcreteInstanceMethod(method.getSimpleName())); + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.SerialConcreteInstanceMethod(method.getSimpleName())); } } @@ -5592,9 +5546,9 @@ private void checkReturnType(JCClassDecl tree, // checking. Type rtype = method.getReturnType(); if (!types.isSameType(expectedReturnType, rtype)) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.SerialMethodUnexpectedReturnType(method.getSimpleName(), + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.SerialMethodUnexpectedReturnType(method.getSimpleName(), rtype, expectedReturnType)); } } @@ -5608,17 +5562,17 @@ private void checkOneArg(JCClassDecl tree, var parameters= method.getParameters(); if (parameters.size() != 1) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.SerialMethodOneArg(method.getSimpleName(), parameters.size())); + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.SerialMethodOneArg(method.getSimpleName(), parameters.size())); return; } Type parameterType = parameters.get(0).asType(); if (!types.isSameType(parameterType, expectedType)) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.SerialMethodParameterType(method.getSimpleName(), + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.SerialMethodParameterType(method.getSimpleName(), expectedType, parameterType)); } @@ -5637,18 +5591,18 @@ private boolean hasExactlyOneArgWithType(JCClassDecl tree, private void checkNoArgs(JCClassDecl tree, Element enclosing, MethodSymbol method) { var parameters = method.getParameters(); if (!parameters.isEmpty()) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(parameters.get(0), tree), - Warnings.SerialMethodNoArgs(method.getSimpleName())); + log.warning( + TreeInfo.diagnosticPositionFor(parameters.get(0), tree), + LintWarnings.SerialMethodNoArgs(method.getSimpleName())); } } private void checkExternalizable(JCClassDecl tree, Element enclosing, MethodSymbol method) { // If the enclosing class is externalizable, warn for the method if (isExternalizable((Type)enclosing.asType())) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.IneffectualSerialMethodExternalizable(method.getSimpleName())); + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.IneffectualSerialMethodExternalizable(method.getSimpleName())); } return; } @@ -5675,9 +5629,9 @@ private void checkExceptions(JCClassDecl tree, } } if (!declared) { - log.warning(LintCategory.SERIAL, - TreeInfo.diagnosticPositionFor(method, tree), - Warnings.SerialMethodUnexpectedException(method.getSimpleName(), + log.warning( + TreeInfo.diagnosticPositionFor(method, tree), + LintWarnings.SerialMethodUnexpectedException(method.getSimpleName(), thrownType)); } } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/CompileStates.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/CompileStates.java index cbeedfcbade..b9cab47d8ab 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/CompileStates.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/CompileStates.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java index 1042a9747ba..a5744c65f20 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java index df28548152a..175cceeeb7f 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java @@ -34,11 +34,11 @@ import java.util.Set; import java.util.function.Consumer; -import com.sun.source.tree.CaseTree; import com.sun.source.tree.LambdaExpressionTree.BodyKind; import com.sun.tools.javac.code.*; import com.sun.tools.javac.code.Scope.WriteableScope; import com.sun.tools.javac.resources.CompilerProperties.Errors; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.resources.CompilerProperties.Warnings; import com.sun.tools.javac.tree.*; import com.sun.tools.javac.util.*; @@ -60,8 +60,6 @@ import static com.sun.tools.javac.tree.JCTree.Tag.*; import com.sun.tools.javac.util.JCDiagnostic.Fragment; import java.util.Arrays; -import java.util.Collections; -import java.util.IdentityHashMap; import java.util.Iterator; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -726,11 +724,9 @@ public void visitSwitch(JCSwitch tree) { } // Warn about fall-through if lint switch fallthrough enabled. if (alive == Liveness.ALIVE && - lint.isEnabled(Lint.LintCategory.FALLTHROUGH) && c.stats.nonEmpty() && l.tail.nonEmpty()) - log.warning(Lint.LintCategory.FALLTHROUGH, - l.tail.head.pos(), - Warnings.PossibleFallThroughIntoCase); + lint.logIfEnabled(log, l.tail.head.pos(), + LintWarnings.PossibleFallThroughIntoCase); } tree.isExhaustive = tree.hasUnconditionalPattern || TreeInfo.isErrorEnumSwitch(tree.selector, tree.cases); @@ -1237,11 +1233,8 @@ public void visitTry(JCTry tree) { scanStat(tree.finalizer); tree.finallyCanCompleteNormally = alive != Liveness.DEAD; if (alive == Liveness.DEAD) { - if (lint.isEnabled(Lint.LintCategory.FINALLY)) { - log.warning(Lint.LintCategory.FINALLY, - TreeInfo.diagEndPos(tree.finalizer), - Warnings.FinallyCannotComplete); - } + lint.logIfEnabled(log, TreeInfo.diagEndPos(tree.finalizer), + LintWarnings.FinallyCannotComplete); } else { while (exits.nonEmpty()) { pendingExits.append(exits.next()); @@ -2863,8 +2856,8 @@ public void visitTry(JCTry tree) { lint.isEnabled(Lint.LintCategory.TRY)) { for (JCVariableDecl resVar : resourceVarDecls) { if (unrefdResources.includes(resVar.sym) && !resVar.sym.isUnnamedVariable()) { - log.warning(Lint.LintCategory.TRY, resVar.pos(), - Warnings.TryResourceNotReferenced(resVar.sym)); + log.warning(resVar.pos(), + LintWarnings.TryResourceNotReferenced(resVar.sym)); unrefdResources.remove(resVar.sym); } } @@ -3289,7 +3282,6 @@ void markDead() { //do nothing } - @SuppressWarnings("fallthrough") void checkEffectivelyFinal(DiagnosticPosition pos, VarSymbol sym) { if (currentTree != null && sym.owner.kind == MTH && @@ -3310,7 +3302,6 @@ int getCurrentTreeStartPosition() { : currentTree.getStartPosition(); } - @SuppressWarnings("fallthrough") void letInit(JCTree tree) { tree = TreeInfo.skipParens(tree); if (tree.hasTag(IDENT) || tree.hasTag(SELECT)) { diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java index d590c62f27f..137dfa7c3c5 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Infer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java index 35cd9a25ae4..ea7806ef032 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/InferenceContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java index 62117583a96..d2219bb08b8 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java index bfad334d194..f389134c477 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Modules.java @@ -52,7 +52,6 @@ import javax.tools.StandardLocation; import com.sun.source.tree.ModuleTree.ModuleKind; -import com.sun.tools.javac.code.ClassFinder; import com.sun.tools.javac.code.DeferredLintHandler; import com.sun.tools.javac.code.Directive; import com.sun.tools.javac.code.Directive.ExportsDirective; @@ -88,6 +87,7 @@ import com.sun.tools.javac.jvm.Target; import com.sun.tools.javac.main.Option; import com.sun.tools.javac.resources.CompilerProperties.Errors; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.resources.CompilerProperties.Warnings; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.JCCompilationUnit; @@ -1023,7 +1023,7 @@ public UsesProvidesVisitor(ModuleSymbol msym, Env env) { this.env = env; } - @Override @SuppressWarnings("unchecked") + @Override public void visitModuleDef(JCModuleDecl tree) { msym.directives = List.nil(); msym.provides = List.nil(); @@ -1275,8 +1275,8 @@ private void setupAllModules() { if (lintOptions) { for (ModuleSymbol msym : limitMods) { if (!observable.contains(msym)) { - log.warning(LintCategory.OPTIONS, - Warnings.ModuleForOptionNotFound(Option.LIMIT_MODULES, msym)); + log.warning( + LintWarnings.ModuleForOptionNotFound(Option.LIMIT_MODULES, msym)); } } } @@ -1381,7 +1381,7 @@ private void setupAllModules() { .collect(Collectors.joining(",")); if (!incubatingModules.isEmpty()) { - log.warning(Warnings.IncubatingModules(incubatingModules)); + log.warning(LintWarnings.IncubatingModules(incubatingModules)); } } @@ -1731,8 +1731,8 @@ private boolean isKnownModule(ModuleSymbol msym, Set unknownModule if (!unknownModules.contains(msym)) { if (lintOptions) { - log.warning(LintCategory.OPTIONS, - Warnings.ModuleForOptionNotFound(Option.ADD_EXPORTS, msym)); + log.warning( + LintWarnings.ModuleForOptionNotFound(Option.ADD_EXPORTS, msym)); } unknownModules.add(msym); } @@ -1770,7 +1770,7 @@ private void initAddReads() { ModuleSymbol msym = syms.enterModule(names.fromString(sourceName)); if (!allModules.contains(msym)) { if (lintOptions) { - log.warning(Warnings.ModuleForOptionNotFound(Option.ADD_READS, msym)); + log.warning(LintWarnings.ModuleForOptionNotFound(Option.ADD_READS, msym)); } continue; } @@ -1790,7 +1790,7 @@ private void initAddReads() { targetModule = syms.enterModule(names.fromString(targetName)); if (!allModules.contains(targetModule)) { if (lintOptions) { - log.warning(LintCategory.OPTIONS, Warnings.ModuleForOptionNotFound(Option.ADD_READS, targetModule)); + log.warning(LintWarnings.ModuleForOptionNotFound(Option.ADD_READS, targetModule)); } continue; } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Operators.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Operators.java index ee487f2a034..0eea70195da 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Operators.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Operators.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -274,7 +274,6 @@ abstract class OperatorHelper { /** An array of operator symbol suppliers (used to lazily populate the symbol list). */ List> operatorSuppliers = List.nil(); - @SuppressWarnings("varargs") OperatorHelper(Tag tag) { this.name = operatorName(tag); } 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 43a0c61a069..82a419e3265 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 @@ -3834,7 +3834,7 @@ Symbol findSelfContaining(DiagnosticPosition pos, */ Symbol findLocalClassOwner(Env env, TypeSymbol c) { Symbol owner = c.owner; - Assert.check(owner.kind == MTH); + Assert.check(owner.kind == MTH || owner.kind == VAR); Env env1 = env; boolean staticOnly = false; while (env1.outer != null) { @@ -3846,7 +3846,9 @@ Symbol findLocalClassOwner(Env env, TypeSymbol c) { if (isStatic(env1)) staticOnly = true; env1 = env1.outer; } - return methodNotFound; + return owner.kind == MTH ? + methodNotFound : + varNotFound; } /** @@ -5191,7 +5193,6 @@ DeferredAttrContext deferredAttrContext(Symbol sym, InferenceContext inferenceCo * while inapplicable candidates contain further details about the * reason why the method has been considered inapplicable. */ - @SuppressWarnings("overrides") class Candidate { final MethodResolutionPhase step; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java index c063058d11c..e1bf92a7f7b 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * 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,12 +31,10 @@ import java.util.LinkedHashMap; import java.util.EnumSet; import java.util.HashSet; -import java.util.Map.Entry; import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.function.BiPredicate; import java.util.function.Consumer; import java.util.function.Function; @@ -53,6 +51,7 @@ import com.sun.tools.javac.code.Symtab; import com.sun.tools.javac.code.Type; import com.sun.tools.javac.code.Types; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.resources.CompilerProperties.Warnings; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.JCTree.*; @@ -63,7 +62,6 @@ import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; import com.sun.tools.javac.util.List; import com.sun.tools.javac.util.Log; -import com.sun.tools.javac.util.Name; import com.sun.tools.javac.util.Names; import com.sun.tools.javac.util.Pair; @@ -424,12 +422,12 @@ private boolean currentClassIsExternallyExtendable() { previous = warning; // Emit warnings showing the entire stack trace - JCDiagnostic.Warning key = Warnings.PossibleThisEscape; + JCDiagnostic.Warning key = LintWarnings.PossibleThisEscape; int remain = warning.length; do { DiagnosticPosition pos = warning[--remain]; - log.warning(Lint.LintCategory.THIS_ESCAPE, pos, key); - key = Warnings.PossibleThisEscapeLocation; + log.warning(pos, key); + key = LintWarnings.PossibleThisEscapeLocation; } while (remain > 0); } warningList.clear(); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TreeHasher.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TreeHasher.java index 1f7691c5183..6109a9fd9a8 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TreeHasher.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TreeHasher.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2018, Google LLC. All rights reserved. - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java index 3999cf0c36b..646db6a6bf3 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java @@ -29,8 +29,6 @@ import java.io.InputStream; import java.lang.ref.SoftReference; import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.net.URL; import java.net.URLClassLoader; import java.nio.ByteBuffer; @@ -41,7 +39,6 @@ import java.nio.charset.CodingErrorAction; import java.nio.charset.IllegalCharsetNameException; import java.nio.charset.UnsupportedCharsetException; -import java.nio.file.Files; import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.util.Collection; @@ -56,13 +53,12 @@ import javax.tools.JavaFileObject; import javax.tools.JavaFileObject.Kind; -import com.sun.tools.javac.code.Lint.LintCategory; import com.sun.tools.javac.main.Option; import com.sun.tools.javac.main.OptionHelper; import com.sun.tools.javac.main.OptionHelper.GrumpyHelper; import com.sun.tools.javac.resources.CompilerProperties.Errors; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.resources.CompilerProperties.Warnings; -import com.sun.tools.javac.util.Abort; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.DefinedBy; import com.sun.tools.javac.util.DefinedBy.Api; @@ -529,6 +525,6 @@ synchronized void newOutputToPath(Path path) throws IOException { // Check whether we've already opened this file for output if (!outputFilesWritten.add(realPath)) - log.warning(LintCategory.OUTPUT_FILE_CLASH, Warnings.OutputFileClash(path)); + log.warning(LintWarnings.OutputFileClash(path)); } } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java index 9da2052b9f3..3a6ed52cc79 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java @@ -77,10 +77,10 @@ import javax.tools.StandardJavaFileManager.PathFactory; import javax.tools.StandardLocation; +import com.sun.tools.javac.code.Lint; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import jdk.internal.jmod.JmodFile; -import com.sun.tools.javac.code.Lint; -import com.sun.tools.javac.code.Lint.LintCategory; import com.sun.tools.javac.main.Option; import com.sun.tools.javac.resources.CompilerProperties.Errors; import com.sun.tools.javac.resources.CompilerProperties.Warnings; @@ -224,7 +224,7 @@ private Iterable getPathEntries(String searchPath, Path emptyPathDefault) entries.add(getPath(s)); } catch (IllegalArgumentException e) { if (warn) { - log.warning(LintCategory.PATH, Warnings.InvalidPath(s)); + log.warning(LintWarnings.InvalidPath(s)); } } } @@ -319,8 +319,8 @@ public SearchPath addDirectories(String dirs) { private void addDirectory(Path dir, boolean warn) { if (!Files.isDirectory(dir)) { if (warn) { - log.warning(Lint.LintCategory.PATH, - Warnings.DirPathElementNotFound(dir)); + log.warning( + LintWarnings.DirPathElementNotFound(dir)); } return; } @@ -365,8 +365,8 @@ public void addFile(Path file, boolean warn) { if (!fsInfo.exists(file)) { /* No such file or directory exists */ if (warn) { - log.warning(Lint.LintCategory.PATH, - Warnings.PathElementNotFound(file)); + log.warning( + LintWarnings.PathElementNotFound(file)); } super.add(file); return; @@ -388,14 +388,14 @@ public void addFile(Path file, boolean warn) { try { FileSystems.newFileSystem(file, (ClassLoader)null).close(); if (warn) { - log.warning(Lint.LintCategory.PATH, - Warnings.UnexpectedArchiveFile(file)); + log.warning( + LintWarnings.UnexpectedArchiveFile(file)); } } catch (IOException | ProviderNotFoundException e) { // FIXME: include e.getLocalizedMessage in warning if (warn) { - log.warning(Lint.LintCategory.PATH, - Warnings.InvalidArchiveFile(file)); + log.warning( + LintWarnings.InvalidArchiveFile(file)); } return; } @@ -1660,9 +1660,9 @@ void add(Map> map, Path prefix, Path suffix) { if (!Files.isDirectory(prefix)) { if (warn) { Warning key = Files.exists(prefix) - ? Warnings.DirPathElementNotDirectory(prefix) - : Warnings.DirPathElementNotFound(prefix); - log.warning(Lint.LintCategory.PATH, key); + ? LintWarnings.DirPathElementNotDirectory(prefix) + : LintWarnings.DirPathElementNotFound(prefix); + log.warning(key); } return; } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java index f70b96697b3..7147e972898 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java @@ -64,6 +64,7 @@ import com.sun.tools.javac.main.Option; import com.sun.tools.javac.resources.CompilerProperties.Errors; import com.sun.tools.javac.resources.CompilerProperties.Fragments; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.resources.CompilerProperties.Warnings; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.ByteBuffer.UnderflowException; @@ -855,8 +856,8 @@ protected boolean accepts(AttributeKind kind) { if (lintClassfile && !warnedAttrs.contains(name)) { JavaFileObject prev = log.useSource(currentClassFile); try { - log.warning(LintCategory.CLASSFILE, (DiagnosticPosition) null, - Warnings.FutureAttr(name, version.major, version.minor, majorVersion, minorVersion)); + log.warning((DiagnosticPosition) null, + LintWarnings.FutureAttr(name, version.major, version.minor, majorVersion, minorVersion)); } finally { log.useSource(prev); } @@ -1610,7 +1611,7 @@ void readParameterAnnotations(Symbol meth) { //the RuntimeVisibleParameterAnnotations and RuntimeInvisibleParameterAnnotations //provide annotations for a different number of parameters, ignore: if (lintClassfile) { - log.warning(LintCategory.CLASSFILE, Warnings.RuntimeVisibleInvisibleParamAnnotationsMismatch(currentClassFile)); + log.warning(LintWarnings.RuntimeVisibleInvisibleParamAnnotationsMismatch(currentClassFile)); } for (int pnum = 0; pnum < numParameters; pnum++) { readAnnotations(); @@ -2078,9 +2079,9 @@ MethodSymbol findAccessMethod(Type container, Name name) { try { if (lintClassfile) { if (failure == null) { - log.warning(Warnings.AnnotationMethodNotFound(container, name)); + log.warning(LintWarnings.AnnotationMethodNotFound(container, name)); } else { - log.warning(Warnings.AnnotationMethodNotFoundReason(container, + log.warning(LintWarnings.AnnotationMethodNotFoundReason(container, name, failure.getDetailValue()));//diagnostic, if present } @@ -2960,7 +2961,7 @@ void adjustParameterAnnotations(MethodSymbol sym, Type methodDescriptor, private void dropParameterAnnotations() { parameterAnnotations = null; if (lintClassfile) { - log.warning(LintCategory.CLASSFILE, Warnings.RuntimeInvisibleParameterAnnotations(currentClassFile)); + log.warning(LintWarnings.RuntimeInvisibleParameterAnnotations(currentClassFile)); } } /** diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java index 703e1cb0c9c..8e8dfd00058 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Code.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java index b9bfe587c6c..b21a7f190c9 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/JNIWriter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/JNIWriter.java index 2de0e330796..0d6f2a6e9e1 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/JNIWriter.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/JNIWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -339,7 +339,6 @@ && isNative(md2)) { } } } - @SuppressWarnings("fallthrough") protected final String jniType(Type t) { switch (t.getKind()) { case ARRAY: { @@ -442,7 +441,6 @@ static enum EncoderType { JNI, SIGNATURE } - @SuppressWarnings("fallthrough") static String encode(CharSequence name, EncoderType mtype) { StringBuilder result = new StringBuilder(100); int length = name.length(); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/PoolWriter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/PoolWriter.java index bfdb9775e11..c90fbab788c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/PoolWriter.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/PoolWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java index 07ee62eb75e..36376456c4b 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/MemoryClassLoader.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/MemoryClassLoader.java index e87c0a4681f..f87fc88fdff 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/MemoryClassLoader.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/MemoryClassLoader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java index 2af50832f96..1e8b85eb143 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Arguments.java @@ -63,6 +63,7 @@ import com.sun.tools.javac.platform.PlatformUtils; import com.sun.tools.javac.resources.CompilerProperties.Errors; import com.sun.tools.javac.resources.CompilerProperties.Fragments; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.resources.CompilerProperties.Warnings; import com.sun.tools.javac.util.Context; import com.sun.tools.javac.util.JCDiagnostic; @@ -497,7 +498,7 @@ public boolean validate() { if (lintPaths) { Path outDirParent = outDir.getParent(); if (outDirParent != null && Files.exists(outDirParent.resolve("module-info.class"))) { - log.warning(LintCategory.PATH, Warnings.OutdirIsInExplodedModule(outDir)); + log.warning(LintWarnings.OutdirIsInExplodedModule(outDir)); } } } @@ -571,10 +572,10 @@ public boolean validate() { if (fm instanceof BaseFileManager baseFileManager) { if (source.compareTo(Source.JDK8) <= 0) { if (baseFileManager.isDefaultBootClassPath()) - log.warning(LintCategory.OPTIONS, Warnings.SourceNoBootclasspath(source.name, releaseNote(source, targetString))); + log.warning(LintWarnings.SourceNoBootclasspath(source.name, releaseNote(source, targetString))); } else { if (baseFileManager.isDefaultSystemModulesPath()) - log.warning(LintCategory.OPTIONS, Warnings.SourceNoSystemModulesPath(source.name, releaseNote(source, targetString))); + log.warning(LintWarnings.SourceNoSystemModulesPath(source.name, releaseNote(source, targetString))); } } } @@ -584,14 +585,14 @@ public boolean validate() { if (source.compareTo(Source.MIN) < 0) { log.error(Errors.OptionRemovedSource(source.name, Source.MIN.name)); } else if (source == Source.MIN && lintOptions) { - log.warning(LintCategory.OPTIONS, Warnings.OptionObsoleteSource(source.name)); + log.warning(LintWarnings.OptionObsoleteSource(source.name)); obsoleteOptionFound = true; } if (target.compareTo(Target.MIN) < 0) { log.error(Errors.OptionRemovedTarget(target, Target.MIN)); } else if (target == Target.MIN && lintOptions) { - log.warning(LintCategory.OPTIONS, Warnings.OptionObsoleteTarget(target)); + log.warning(LintWarnings.OptionObsoleteTarget(target)); obsoleteOptionFound = true; } @@ -625,7 +626,7 @@ public boolean validate() { } if (obsoleteOptionFound && lintOptions) { - log.warning(LintCategory.OPTIONS, Warnings.OptionObsoleteSuppression); + log.warning(LintWarnings.OptionObsoleteSuppression); } SourceVersion sv = Source.toSourceVersion(source); @@ -636,7 +637,7 @@ public boolean validate() { validateDefaultModuleForCreatedFiles(sv); if (lintOptions && options.isSet(Option.ADD_OPENS)) { - log.warning(LintCategory.OPTIONS, Warnings.AddopensIgnored); + log.warning(LintWarnings.AddopensIgnored); } return !errors && (log.nerrors == 0); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java index 274ac029b92..96cf4049533 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/main/JavaCompiler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java index b02150c738c..0e73bbebf7a 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/model/AnnotationProxyMaker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -220,7 +220,7 @@ public void visitArray(Attribute.Array a) { } } - @SuppressWarnings({"unchecked", "rawtypes"}) + @SuppressWarnings("unchecked") public void visitEnum(Attribute.Enum e) { if (returnClass.isEnum()) { String constName = e.value.toString(); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java index 71e39a6a408..db9d327dc07 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/model/JavacTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java index a38658a315e..b25ca99eb88 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java @@ -33,14 +33,13 @@ import com.sun.tools.javac.file.JavacFileManager; import com.sun.tools.javac.parser.Tokens.Comment.CommentStyle; import com.sun.tools.javac.resources.CompilerProperties.Errors; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.resources.CompilerProperties.Warnings; import com.sun.tools.javac.tree.EndPosTable; -import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.JCDiagnostic.*; import java.nio.CharBuffer; -import java.util.Iterator; import java.util.Set; import static com.sun.tools.javac.parser.Tokens.*; @@ -222,13 +221,12 @@ protected void lexError(DiagnosticFlag flags, int pos, JCDiagnostic.Error key) { /** * Report an error at the given position using the provided arguments. * - * @param lc lint category. * @param pos position in input buffer. * @param key error key to report. */ - protected void lexWarning(LintCategory lc, int pos, JCDiagnostic.Warning key) { + protected void lexWarning(int pos, JCDiagnostic.Warning key) { DiagnosticPosition dp = new SimpleDiagnosticPosition(pos) ; - log.warning(lc, dp, key); + log.warning(dp, key); } /** @@ -1075,12 +1073,12 @@ public Token readToken() { Set checks = TextBlockSupport.checkWhitespace(string); if (checks.contains(TextBlockSupport.WhitespaceChecks.INCONSISTENT)) { - lexWarning(LintCategory.TEXT_BLOCKS, pos, - Warnings.InconsistentWhiteSpaceIndentation); + lexWarning(pos, + LintWarnings.InconsistentWhiteSpaceIndentation); } if (checks.contains(TextBlockSupport.WhitespaceChecks.TRAILING)) { - lexWarning(LintCategory.TEXT_BLOCKS, pos, - Warnings.TrailingWhiteSpaceWillBeRemoved); + lexWarning(pos, + LintWarnings.TrailingWhiteSpaceWillBeRemoved); } } // Remove incidental indentation. diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java index d975a6c927a..703c510675c 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java @@ -42,6 +42,7 @@ import com.sun.tools.javac.parser.Tokens.*; import com.sun.tools.javac.resources.CompilerProperties.Errors; import com.sun.tools.javac.resources.CompilerProperties.Fragments; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.resources.CompilerProperties.Warnings; import com.sun.tools.javac.tree.*; import com.sun.tools.javac.tree.JCTree.*; @@ -669,8 +670,8 @@ void reportDanglingDocComment(Comment c) { deferredLintHandler.report(lint -> { if (lint.isEnabled(Lint.LintCategory.DANGLING_DOC_COMMENTS) && !shebang(c, pos)) { - log.warning(Lint.LintCategory.DANGLING_DOC_COMMENTS, - pos, Warnings.DanglingDocComment); + log.warning( + pos, LintWarnings.DanglingDocComment); } }); } @@ -2833,7 +2834,6 @@ public JCBlock block() { * LocalVariableDeclarationStatement * = { FINAL | '@' Annotation } Type VariableDeclarators ";" */ - @SuppressWarnings("fallthrough") List blockStatements() { //todo: skip to anchor on error(?) int lastErrPos = -1; @@ -2891,7 +2891,6 @@ JCStatement parseStatementAsBlock() { /**This method parses a statement appearing inside a block. */ - @SuppressWarnings("fallthrough") List blockStatement() { //todo: skip to anchor on error(?) Comment dc; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java index d4121080506..c78694082c8 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -107,7 +107,6 @@ public class UnicodeReader { * @param array array containing contents of source. * @param length length of meaningful content in buffer. */ - @SuppressWarnings("this-escape") protected UnicodeReader(ScannerFactory sf, char[] array, int length) { this(sf.log, array, length); } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java index 1c3f8ba96f8..3f30bee31f9 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacFiler.java @@ -57,6 +57,7 @@ import com.sun.tools.javac.code.Symtab; import com.sun.tools.javac.comp.Modules; import com.sun.tools.javac.model.JavacElements; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.resources.CompilerProperties.Warnings; import com.sun.tools.javac.util.*; import com.sun.tools.javac.util.DefinedBy.Api; @@ -492,7 +493,7 @@ private JavaFileObject createSourceOrClassFile(ModuleSymbol mod, boolean isSourc String base = name.substring(periodIndex); String extn = (isSourceFile ? ".java" : ".class"); if (base.equals(extn)) - log.warning(Warnings.ProcSuspiciousClassName(name, extn)); + log.warning(LintWarnings.ProcSuspiciousClassName(name, extn)); } } checkNameAndExistence(mod, name, isSourceFile); @@ -708,7 +709,7 @@ private void checkName(String name) throws FilerException { private void checkName(String name, boolean allowUnnamedPackageInfo) throws FilerException { if (!SourceVersion.isName(name) && !isPackageInfo(name, allowUnnamedPackageInfo)) { if (lint) - log.warning(Warnings.ProcIllegalFileName(name)); + log.warning(LintWarnings.ProcIllegalFileName(name)); throw new FilerException("Illegal name " + name); } } @@ -737,11 +738,11 @@ private void checkNameAndExistence(ModuleSymbol mod, String typename, boolean al containedInInitialInputs(typename); if (alreadySeen) { if (lint) - log.warning(Warnings.ProcTypeRecreate(typename)); + log.warning(LintWarnings.ProcTypeRecreate(typename)); throw new FilerException("Attempt to recreate a file for type " + typename); } if (lint && existing != null) { - log.warning(Warnings.ProcTypeAlreadyExists(typename)); + log.warning(LintWarnings.ProcTypeAlreadyExists(typename)); } if (!mod.isUnnamed() && !typename.contains(".")) { throw new FilerException("Attempt to create a type in unnamed package of a named module: " + typename); @@ -771,7 +772,7 @@ private boolean containedInInitialInputs(String typename) { private void checkFileReopening(FileObject fileObject, boolean forWriting) throws FilerException { if (isInFileObjectHistory(fileObject, forWriting)) { if (lint) - log.warning(Warnings.ProcFileReopening(fileObject.getName())); + log.warning(LintWarnings.ProcFileReopening(fileObject.getName())); throw new FilerException("Attempt to reopen a file for path " + fileObject.getName()); } if (forWriting) diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java index 4ea1c488875..23e1e348cf9 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java @@ -66,6 +66,7 @@ import com.sun.tools.javac.platform.PlatformDescription; import com.sun.tools.javac.platform.PlatformDescription.PluginInfo; import com.sun.tools.javac.resources.CompilerProperties.Errors; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.resources.CompilerProperties.Warnings; import com.sun.tools.javac.tree.*; import com.sun.tools.javac.tree.JCTree.*; @@ -648,7 +649,7 @@ static class ProcessorState { add(importStringToPattern(allowModules, annotationPattern, processor, log, lint)); if (lint && !patternAdded) { - log.warning(Warnings.ProcDuplicateSupportedAnnotation(annotationPattern, + log.warning(LintWarnings.ProcDuplicateSupportedAnnotation(annotationPattern, p.getClass().getName())); } } @@ -662,7 +663,7 @@ static class ProcessorState { if (lint && supportedAnnotationPatterns.contains(MatchingUtils.validImportStringToPattern("*")) && supportedAnnotationPatterns.size() > 1) { - log.warning(Warnings.ProcRedundantTypesWithWildcard(p.getClass().getName())); + log.warning(LintWarnings.ProcRedundantTypesWithWildcard(p.getClass().getName())); } supportedOptionNames = new LinkedHashSet<>(); @@ -670,7 +671,7 @@ static class ProcessorState { if (checkOptionName(optionName, log)) { boolean optionAdded = supportedOptionNames.add(optionName); if (lint && !optionAdded) { - log.warning(Warnings.ProcDuplicateOptionName(optionName, + log.warning(LintWarnings.ProcDuplicateOptionName(optionName, p.getClass().getName())); } } @@ -891,7 +892,7 @@ private void discoverAndRunProcs(Set annotationsPresent, // Remove annotations processed by javac unmatchedAnnotations.keySet().removeAll(platformAnnotations); if (unmatchedAnnotations.size() > 0) { - log.warning(Warnings.ProcAnnotationsWithoutProcessors(unmatchedAnnotations.keySet())); + log.warning(LintWarnings.ProcAnnotationsWithoutProcessors(unmatchedAnnotations.keySet())); } } @@ -1688,7 +1689,7 @@ private static Pattern importStringToPattern(boolean allowModules, String s, Pro private static Pattern warnAndNoMatches(String s, Processor p, Log log, boolean lint) { if (lint) { - log.warning(Warnings.ProcMalformedSupportedString(s, p.getClass().getName())); + log.warning(LintWarnings.ProcMalformedSupportedString(s, p.getClass().getName())); } return noMatches; // won't match any valid identifier } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties index 96944f698dd..ef20152cc7d 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -708,9 +708,11 @@ compiler.err.not.in.profile=\ compiler.warn.forward.ref=\ reference to variable ''{0}'' before it has been initialized +# lint: this-escape compiler.warn.possible.this.escape=\ possible ''this'' escape before subclass is fully initialized +# lint: this-escape compiler.warn.possible.this.escape.location=\ previous possible ''this'' escape happens here via invocation @@ -731,9 +733,11 @@ compiler.err.illegal.line.end.in.char.lit=\ compiler.err.illegal.text.block.open=\ illegal text block open delimiter sequence, missing line terminator +# lint: text-blocks compiler.warn.inconsistent.white.space.indentation=\ inconsistent white space indentation +# lint: text-blocks compiler.warn.trailing.white.space.will.be.removed=\ trailing white space will be removed @@ -1591,6 +1595,7 @@ compiler.err.multi-module.outdir.cannot.be.exploded.module=\ in multi-module mode, the output directory cannot be an exploded module: {0} # 0: path +# lint: path compiler.warn.outdir.is.in.exploded.module=\ the output directory is within an exploded module: {0} @@ -1658,6 +1663,7 @@ compiler.warn.file.from.future=\ Modification date is in the future for file {0} # 0: path +# lint: output-file-clash compiler.warn.output.file.clash=\ output file written more than once: {0} @@ -1870,47 +1876,59 @@ compiler.warn.lintOption=\ [{0}]\u0020 # 0: symbol +# lint: serial compiler.warn.constant.SVUID=\ serialVersionUID must be constant in class {0} +# lint: dangling-doc-comments compiler.warn.dangling.doc.comment=\ documentation comment is not attached to any declaration # 0: path +# lint: path compiler.warn.dir.path.element.not.found=\ bad path element "{0}": no such directory # 0: file name +# lint: path compiler.warn.dir.path.element.not.directory=\ bad path element "{0}": not a directory # 0: symbol, 1: symbol, 2: symbol +# lint: missing-explicit-ctor compiler.warn.missing-explicit-ctor=\ class {0} in exported package {1} declares no explicit constructors, thereby exposing a default constructor to clients of module {2} +# lint: strictfp compiler.warn.strictfp=\ as of release 17, all floating-point expressions are evaluated strictly and ''strictfp'' is not required +# lint: finally compiler.warn.finally.cannot.complete=\ finally clause cannot complete normally # 0: name +# lint: module compiler.warn.poor.choice.for.module.name=\ module name component {0} should avoid terminal digits # 0: string +# lint: incubating compiler.warn.incubating.modules=\ using incubating module(s): {0} # 0: symbol, 1: symbol +# lint: deprecation compiler.warn.has.been.deprecated=\ {0} in {1} has been deprecated # 0: symbol, 1: symbol +# lint: removal compiler.warn.has.been.deprecated.for.removal=\ {0} in {1} has been deprecated and marked for removal # 0: symbol +# lint: preview compiler.warn.is.preview=\ {0} is a preview API and may be removed in a future release. @@ -1920,19 +1938,23 @@ compiler.err.is.preview=\ (use --enable-preview to enable preview APIs) # 0: symbol +# lint: preview compiler.warn.is.preview.reflective=\ {0} is a reflective preview API and may be removed in a future release. # 0: symbol, 1: symbol +# lint: restricted compiler.warn.restricted.method=\ {0}.{1} is a restricted method.\n\ (Restricted methods are unsafe and, if used incorrectly, might crash the Java runtime or corrupt memory) # 0: symbol +# lint: deprecation compiler.warn.has.been.deprecated.module=\ module {0} has been deprecated # 0: symbol +# lint: removal compiler.warn.has.been.deprecated.for.removal.module=\ module {0} has been deprecated and marked for removal @@ -1944,12 +1966,15 @@ compiler.warn.illegal.char.for.encoding=\ unmappable character for encoding {0} # 0: symbol +# lint: serial compiler.warn.improper.SVUID=\ serialVersionUID must be declared static final in class {0} +# lint: serial compiler.warn.improper.SPF=\ serialPersistentFields must be declared private static final to be effective +# lint: serial compiler.warn.SPF.null.init=\ serialPersistentFields ineffective if initialized to null.\n\ Initialize to an empty array to indicate no fields @@ -1972,112 +1997,141 @@ compiler.warn.unreachable.catch.1=\ thrown types {0} have already been caught # 0: symbol +# lint: serial compiler.warn.long.SVUID=\ serialVersionUID must be of type long in class {0} +# lint: serial compiler.warn.OSF.array.SPF=\ serialPersistentFields must be of type java.io.ObjectStreamField[] to be effective # 0: symbol +# lint: serial compiler.warn.missing.SVUID=\ serializable class {0} has no definition of serialVersionUID # 0: name +# lint: serial compiler.warn.serializable.missing.access.no.arg.ctor=\ cannot access a no-arg constructor in first non-serializable superclass {0} # 0: name +# lint: serial compiler.warn.serial.method.not.private=\ serialization-related method {0} not declared private # 0: name +# lint: serial compiler.warn.serial.concrete.instance.method=\ serialization-related method {0} must be a concrete instance method to be effective, neither abstract nor static # 0: name +# lint: serial compiler.warn.serial.method.static=\ serialization-related method {0} declared static; must instead be an instance method to be effective # 0: name +# lint: serial compiler.warn.serial.method.no.args=\ to be effective serialization-related method {0} must have no parameters # 0: name, 1: number +# lint: serial compiler.warn.serial.method.one.arg=\ to be effective serialization-related method {0} must have exactly one parameter rather than {1} parameters # 0: name, 1: type, 2: type +# lint: serial compiler.warn.serial.method.parameter.type=\ sole parameter of serialization-related method {0} must have type {1} to be effective rather than type {2} # 0: name, 1: type, 2: type +# lint: serial compiler.warn.serial.method.unexpected.return.type=\ serialization-related method {0} declared with a return type of {1} rather than expected type {2}.\n\ As declared, the method will be ineffective for serialization # 0: name, 1: type +# lint: serial compiler.warn.serial.method.unexpected.exception=\ serialization-related method {0} declared to throw an unexpected type {1} +# lint: serial compiler.warn.ineffectual.serial.field.interface=\ serialPersistentFields is not effective in an interface # 0: string +# lint: serial compiler.warn.ineffectual.serial.field.enum=\ serialization-related field {0} is not effective in an enum class # 0: string +# lint: serial compiler.warn.ineffectual.serial.method.enum=\ serialization-related method {0} is not effective in an enum class # 0: string +# lint: serial compiler.warn.ineffectual.extern.method.enum=\ externalization-related method {0} is not effective in an enum class +# lint: serial compiler.warn.ineffectual.serial.field.record=\ serialPersistentFields is not effective in a record class # 0: string +# lint: serial compiler.warn.ineffectual.serial.method.record=\ serialization-related method {0} is not effective in a record class # 0: string +# lint: serial compiler.warn.ineffectual.externalizable.method.record=\ externalization-related method {0} is not effective in a record class # 0: name +# lint: serial compiler.warn.ineffectual.serial.method.externalizable=\ serialization-related method {0} is not effective in an Externalizable class +# lint: serial compiler.warn.ineffectual.serial.field.externalizable=\ serialPersistentFields is not effective in an Externalizable class +# lint: serial compiler.warn.externalizable.missing.public.no.arg.ctor=\ an Externalizable class needs a public no-arg constructor +# lint: serial compiler.warn.non.serializable.instance.field=\ non-transient instance field of a serializable class declared with a non-serializable type # 0: type +# lint: serial compiler.warn.non.serializable.instance.field.array=\ non-transient instance field of a serializable class declared with an array having a non-serializable base component type {0} +# lint: serial compiler.warn.non.private.method.weaker.access=\ serialization-related method declared non-private in an interface will prevent\n\ classes implementing the interface from declaring the method as private +# lint: serial compiler.warn.default.ineffective=\ serialization-related default method from an interface will not be run by serialization for an implementing class # 0: symbol, 1: symbol, 2: symbol, 3: symbol +# lint: overloads compiler.warn.potentially.ambiguous.overload=\ {0} in {1} is potentially ambiguous with {2} in {3} # 0: message segment +# lint: overrides compiler.warn.override.varargs.missing=\ {0}; overridden method has no ''...'' # 0: message segment +# lint: overrides compiler.warn.override.varargs.extra=\ {0}; overriding method is missing ''...'' @@ -2090,13 +2144,16 @@ compiler.warn.pkg-info.already.seen=\ a package-info.java file has already been seen for package {0} # 0: path +# lint: path compiler.warn.path.element.not.found=\ bad path element "{0}": no such file or directory +# lint: fallthrough compiler.warn.possible.fall-through.into.case=\ possible fall-through into case # 0: type +# lint: cast compiler.warn.redundant.cast=\ redundant cast to {0} @@ -2114,18 +2171,22 @@ compiler.warn.invalid.utf8.in.classfile=\ {0}: classfile contains invalid UTF-8: {1} # 0: kind name, 1: symbol +# lint: static compiler.warn.static.not.qualified.by.type=\ static {0} should be qualified by type name, {1}, instead of by an expression # 0: kind name +# lint: static compiler.warn.static.not.qualified.by.type2=\ static {0} should not be used as a member of an anonymous class # 0: string, 1: fragment +# lint: options compiler.warn.source.no.bootclasspath=\ bootstrap class path is not set in conjunction with -source {0}\n{1} # 0: string, 1: fragment +# lint: options compiler.warn.source.no.system.modules.path=\ location of system modules is not set in conjunction with -source {0}\n{1} @@ -2150,10 +2211,12 @@ compiler.misc.source.no.system.modules.path.with.target=\ --release {0} is recommended instead of -source {0} -target {1} because it sets the location of system modules automatically # 0: string +# lint: options compiler.warn.option.obsolete.source=\ source value {0} is obsolete and will be removed in a future release # 0: target +# lint: options compiler.warn.option.obsolete.target=\ target value {0} is obsolete and will be removed in a future release @@ -2165,16 +2228,20 @@ compiler.err.option.removed.source=\ compiler.err.option.removed.target=\ Target option {0} is no longer supported. Use {1} or later. +# lint: options compiler.warn.option.obsolete.suppression=\ To suppress warnings about obsolete options, use -Xlint:-options. # 0: name, 1: number, 2: number, 3: number, 4: number +# lint: classfile compiler.warn.future.attr=\ {0} attribute introduced in version {1}.{2} class files is ignored in version {3}.{4} class files +# lint: requires-automatic compiler.warn.requires.automatic=\ requires directive for an automatic module +# lint: requires-transitive-automatic compiler.warn.requires.transitive.automatic=\ requires transitive directive for an automatic module @@ -2184,22 +2251,27 @@ compiler.warn.proc.package.does.not.exist=\ package {0} does not exist # 0: string +# lint: processing compiler.warn.proc.file.reopening=\ Attempt to create a file for ''{0}'' multiple times # 0: string +# lint: processing compiler.warn.proc.type.already.exists=\ A file for type ''{0}'' already exists on the sourcepath or classpath # 0: string +# lint: processing compiler.warn.proc.type.recreate=\ Attempt to create a file for type ''{0}'' multiple times # 0: string +# lint: processing compiler.warn.proc.illegal.file.name=\ Cannot create file for illegal name ''{0}''. # 0: string, 1: string +# lint: processing compiler.warn.proc.suspicious.class.name=\ Creating file for a type whose name ends in {1}: ''{0}'' @@ -2208,10 +2280,12 @@ compiler.warn.proc.file.create.last.round=\ File for type ''{0}'' created in the last round will not be subject to annotation processing. # 0: string, 1: string +# lint: processing compiler.warn.proc.malformed.supported.string=\ Malformed string ''{0}'' for a supported annotation interface returned by processor ''{1}'' # 0: set of string +# lint: processing compiler.warn.proc.annotations.without.processors=\ No processor claimed any of these annotations: {0} @@ -2220,15 +2294,18 @@ compiler.warn.proc.processor.incompatible.source.version=\ Supported source version ''{0}'' from annotation processor ''{1}'' less than -source ''{2}'' # 0: string, 1: string +# lint: processing compiler.warn.proc.duplicate.option.name=\ Duplicate supported option ''{0}'' returned by annotation processor ''{1}'' # 0: string, 1: string +# lint: processing compiler.warn.proc.duplicate.supported.annotation=\ Duplicate supported annotation interface ''{0}'' returned by annotation processor ''{1}'' # 0: string +# lint: processing compiler.warn.proc.redundant.types.with.wildcard=\ Annotation processor ''{0}'' redundantly supports both ''*'' and other annotation interfaces @@ -2256,57 +2333,71 @@ compiler.warn.proc.unclosed.type.files=\ compiler.warn.proc.unmatched.processor.options=\ The following options were not recognized by any processor: ''{0}'' +# lint: try compiler.warn.try.explicit.close.call=\ explicit call to close() on an auto-closeable resource # 0: symbol +# lint: try compiler.warn.try.resource.not.referenced=\ auto-closeable resource {0} is never referenced in body of corresponding try statement # 0: type +# lint: try compiler.warn.try.resource.throws.interrupted.exc=\ auto-closeable resource {0} has a member method close() that could throw InterruptedException +# lint: unchecked compiler.warn.unchecked.assign=\ unchecked assignment: {0} to {1} # 0: symbol, 1: type +# lint: unchecked compiler.warn.unchecked.assign.to.var=\ unchecked assignment to variable {0} as member of raw type {1} # 0: symbol, 1: type +# lint: unchecked compiler.warn.unchecked.call.mbr.of.raw.type=\ unchecked call to {0} as a member of the raw type {1} +# lint: unchecked compiler.warn.unchecked.cast.to.type=\ unchecked cast to type {0} # 0: kind name, 1: name, 2: object, 3: object, 4: kind name, 5: symbol +# lint: unchecked compiler.warn.unchecked.meth.invocation.applied=\ unchecked method invocation: {0} {1} in {4} {5} is applied to given types\n\ required: {2}\n\ found: {3} # 0: type +# lint: unchecked compiler.warn.unchecked.generic.array.creation=\ unchecked generic array creation for varargs parameter of type {0} # 0: type +# lint: unchecked compiler.warn.unchecked.varargs.non.reifiable.type=\ Possible heap pollution from parameterized vararg type {0} # 0: symbol +# lint: varargs compiler.warn.varargs.unsafe.use.varargs.param=\ Varargs method could cause heap pollution from non-reifiable varargs parameter {0} +# lint: dep-ann compiler.warn.missing.deprecated.annotation=\ deprecated item is not annotated with @Deprecated # 0: kind name +# lint: deprecation compiler.warn.deprecated.annotation.has.no.effect=\ @Deprecated annotation has no effect on this {0} declaration # 0: string +# lint: path compiler.warn.invalid.path=\ Invalid filename: {0} @@ -2319,10 +2410,12 @@ compiler.err.invalid.path=\ # 0: path +# lint: path compiler.warn.invalid.archive.file=\ Unexpected file on path: {0} # 0: path +# lint: path compiler.warn.unexpected.archive.file=\ Unexpected extension for archive file: {0} @@ -2330,17 +2423,21 @@ compiler.warn.unexpected.archive.file=\ compiler.err.no.zipfs.for.archive=\ No file system provider is available to handle this file: {0} +# lint: divzero compiler.warn.div.zero=\ division by zero +# lint: empty compiler.warn.empty.if=\ empty statement after if # 0: type, 1: name +# lint: classfile compiler.warn.annotation.method.not.found=\ Cannot find annotation method ''{1}()'' in type ''{0}'' # 0: type, 1: name, 2: message segment +# lint: classfile compiler.warn.annotation.method.not.found.reason=\ Cannot find annotation method ''{1}()'' in type ''{0}'': {2} @@ -2359,6 +2456,7 @@ compiler.warn.unknown.enum.constant.reason=\ reason: {3} # 0: type, 1: type +# lint: rawtypes compiler.warn.raw.class.use=\ found raw type: {0}\n\ missing type arguments for generic class {1} @@ -2376,14 +2474,17 @@ compiler.warn.method.redundant.typeargs=\ Redundant type arguments in method call. # 0: symbol, 1: message segment +# lint: varargs compiler.warn.varargs.redundant.trustme.anno=\ Redundant {0} annotation. {1} # 0: symbol +# lint: serial compiler.warn.access.to.member.from.serializable.element=\ access to member {0} from serializable element can be publicly accessible to untrusted code # 0: symbol +# lint: serial compiler.warn.access.to.member.from.serializable.lambda=\ access to member {0} from serializable lambda can be publicly accessible to untrusted code @@ -2541,12 +2642,14 @@ compiler.misc.bad.enclosing.method=\ bad enclosing method attribute for class {0} # 0: file name +# lint: classfile compiler.warn.runtime.visible.invisible.param.annotations.mismatch=\ the length of parameters in RuntimeVisibleParameterAnnotations attribute and \ RuntimeInvisibleParameterAnnotations attribute in: {0} \ do not match, ignoring both attributes # 0: file name +# lint: classfile compiler.warn.runtime.invisible.parameter.annotations=\ the RuntimeVisibleParameterAnnotations and RuntimeInvisibleParameterAnnotations attributes \ in: {0} \ @@ -2673,6 +2776,7 @@ compiler.misc.prob.found.req=\ incompatible types: {0} # 0: message segment, 1: type, 2: type +# lint: unchecked compiler.warn.prob.found.req=\ {0}\n\ required: {2}\n\ @@ -2687,6 +2791,7 @@ compiler.misc.possible.loss.of.precision=\ possible lossy conversion from {0} to {1} # 0: type, 1: type +# lint: lossy-conversions compiler.warn.possible.loss.of.precision=\ implicit cast from {0} to {1} in compound assignment is possibly lossy @@ -2862,6 +2967,7 @@ compiler.misc.varargs.argument.mismatch=\ ##### # 0: symbol or type, 1: file name +# lint: auxiliaryclass compiler.warn.auxiliary.class.accessed.from.outside.of.its.source.file=\ auxiliary class {0} in {1} should not be accessed from outside its own source file @@ -3066,16 +3172,19 @@ compiler.err.override.incompatible.ret=\ return type {1} is not compatible with {2} # 0: message segment, 1: type, 2: type +# lint: unchecked compiler.warn.override.unchecked.ret=\ {0}\n\ return type requires unchecked conversion from {1} to {2} # 0: message segment, 1: type +# lint: unchecked compiler.warn.override.unchecked.thrown=\ {0}\n\ overridden method does not throw {1} # 0: symbol +# lint: overrides compiler.warn.override.equals.but.not.hashcode=\ Class {0} overrides equals, but neither it nor any superclass overrides hashCode method @@ -3168,14 +3277,17 @@ compiler.err.preview.feature.disabled.classfile=\ (use --enable-preview to allow loading of class files which contain preview features) # 0: message segment (feature) +# lint: preview compiler.warn.preview.feature.use=\ {0} is a preview feature and may be removed in a future release. # 0: message segment (feature) +# lint: preview compiler.warn.preview.feature.use.plural=\ {0} are a preview feature and may be removed in a future release. # 0: file object (classfile), 1: string (expected version) +# lint: preview compiler.warn.preview.feature.use.classfile=\ class file for {0} uses preview features of Java SE {1}. @@ -3245,6 +3357,7 @@ compiler.misc.feature.flexible.constructors=\ compiler.misc.feature.module.imports=\ module imports +# L10N: do not localize: transitive compiler.misc.feature.java.base.transitive=\ transitive modifier for java.base @@ -3558,6 +3671,7 @@ compiler.err.module.not.found=\ module not found: {0} # 0: symbol +# lint: module compiler.warn.module.not.found=\ module not found: {0} @@ -3653,6 +3767,7 @@ compiler.err.package.empty.or.not.found=\ package is empty or does not exist: {0} # 0: symbol +# lint: opens compiler.warn.package.empty.or.not.found=\ package is empty or does not exist: {0} @@ -3736,6 +3851,7 @@ compiler.err.bad.name.for.option=\ bad name in value for {0} option: ''{1}'' # 0: option name, 1: symbol +# lint: options compiler.warn.module.for.option.not.found=\ module name in {0} option not found: {1} @@ -3751,6 +3867,7 @@ compiler.err.add.exports.with.release=\ compiler.err.add.reads.with.release=\ adding read edges for system module {0} is not allowed with --release +# lint: options compiler.warn.addopens.ignored=\ --add-opens has no effect at compile time @@ -3770,7 +3887,7 @@ compiler.misc.cant.resolve.modules=\ cannot resolve modules compiler.misc.bad.requires.flag=\ - bad requires flag: {0} + invalid flag for "requires java.base": {0} # 0: string compiler.err.invalid.module.specifier=\ @@ -3781,15 +3898,19 @@ compiler.warn.service.provided.but.not.exported.or.used=\ service interface provided but not exported or used # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible=\ {0} {1} in module {2} is not accessible to clients that require this module # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible.unexported=\ {0} {1} in module {2} is not exported # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible.not.required.transitive=\ {0} {1} in module {2} is not indirectly exported using ''requires transitive'' # 0: kind name, 1: symbol, 2: symbol +# lint: exports compiler.warn.leaks.not.accessible.unexported.qualified=\ {0} {1} in module {2} may not be visible to all clients that require this module @@ -4119,9 +4240,11 @@ compiler.err.incorrect.number.of.nested.patterns=\ found: {1} # 0: kind name, 1: symbol +# lint: preview compiler.warn.declared.using.preview=\ {0} {1} is declared using a preview feature, which may be removed in a future release. +# lint: synchronization compiler.warn.attempt.to.synchronize.on.instance.of.value.based.class=\ attempt to synchronize on an instance of a value-based class 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 33063b6558d..130a644da94 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 @@ -635,6 +635,9 @@ compiler.err.limit.stack=Code erfordert zu viel Stack compiler.err.limit.string=Konstantenzeichenfolge zu lang +# 0: symbol +compiler.err.annotation.array.too.large=Annotationsarrayelement zu groß in "{0}" + # 0: string compiler.err.limit.string.overflow=UTF8-Darstellung für Zeichenfolge "{0}..." ist zu lang für den Konstantenpool @@ -656,9 +659,6 @@ compiler.misc.unexpected.ret.val=Unerwarteter Rückgabewert # 0: set of flag compiler.err.mod.not.allowed.here=Modifikator {0} hier nicht zulässig -# 0: name -compiler.err.modifier.not.allowed.here=Modifikator {0} hier nicht zulässig - compiler.err.intf.not.allowed.here=Schnittstelle hier nicht zulässig # 0: symbol, 1: symbol @@ -781,9 +781,6 @@ compiler.err.not.def.access.class.intf.cant.access.reason={1}.{0} in Package {2} # 0: symbol, 1: symbol, 2: symbol, 3: message segment compiler.misc.not.def.access.class.intf.cant.access.reason={1}.{0} in Package {2} ist nicht zugänglich\n({3}) -# 0: symbol, 1: list of type, 2: type -compiler.misc.cant.access.inner.cls.constr=Zugriff auf Konstruktor {0}({1}) nicht möglich\nEinschließende Instanz vom Typ {2} ist nicht im Geltungsbereich - # 0: symbol, 1: symbol compiler.err.not.def.public.cant.access={0} ist nicht öffentlich in {1}. Zugriff von externem Package nicht möglich @@ -1148,6 +1145,10 @@ compiler.err.file.sb.on.source.or.patch.path.for.module=Datei muss sich im Quell compiler.err.no.java.lang=Package java.lang kann in Plattformklassen nicht gefunden werden +compiler.err.statement.not.expected=Anweisungen werden außerhalb von Methoden und Initializern nicht erwartet + +compiler.err.class.method.or.field.expected=Klasse, Schnittstelle, Annotationstyp, Enumeration, Datensatz, Methode oder Feld erwartet + ##### # Fatal Errors @@ -1589,6 +1590,7 @@ compiler.warn.proc.duplicate.option.name=Doppelte unterstützte Option "{0}" von # 0: string, 1: string compiler.warn.proc.duplicate.supported.annotation=Doppelte unterstützte Annotationsschnittstelle "{0}" von Annotationsprozessor "{1}" zurückgegeben + # 0: string compiler.warn.proc.redundant.types.with.wildcard=Annotationsprozessor "{0}" unterstützt redundant sowohl "*" als auch andere Annotationsschnittstellen @@ -1671,6 +1673,9 @@ compiler.warn.annotation.method.not.found=Annotationsmethode "{1}()" kann nicht # 0: type, 1: name, 2: message segment compiler.warn.annotation.method.not.found.reason=Annotationsmethode "{1}()" kann nicht in Typ "{0}" gefunden werden: {2} +# 0: list of annotation, 1: symbol, 2: name, 3: message segment +compiler.err.cant.attach.type.annotations=Typannotationen {0} können nicht an {1}.{2} angehängt werden:\n{3} + # 0: file object, 1: symbol, 2: name compiler.warn.unknown.enum.constant=Unbekannte Enum-Konstante {1}.{2} @@ -1806,7 +1811,11 @@ compiler.misc.bad.enclosing.class=Ungültige einschließende Klasse für {0}: {1 # 0: symbol compiler.misc.bad.enclosing.method=Ungültiges einschließendes Methodenattribut für Klasse {0} -compiler.misc.bad.runtime.invisible.param.annotations=Ungültiges RuntimeInvisibleParameterAnnotations-Attribut: {0} +# 0: file name +compiler.warn.runtime.visible.invisible.param.annotations.mismatch=Die Längen der Parameter im RuntimeVisibleParameterAnnotations-Attribut und RuntimeInvisibleParameterAnnotations-Attribut in {0} stimmen nicht überein. Beide Attribute werden ignoriert + +# 0: file name +compiler.warn.runtime.invisible.parameter.annotations=Die Attribute RuntimeVisibleParameterAnnotations und RuntimeInvisibleParameterAnnotations in {0} können nicht den Parametern der Methode zugeordnet werden compiler.misc.bad.const.pool.tag=Ungültiges Konstantenpooltag: {0} @@ -2038,6 +2047,10 @@ compiler.err.abstract.cant.be.accessed.directly={0} {1} in {2} ist abstrakt und # 0: symbol kind, 1: symbol compiler.err.non-static.cant.be.ref={0} {1} ist nicht statisch und kann nicht aus einem statischen Kontext referenziert werden +## The first argument ({0}) is a "kindname". +# 0: symbol kind, 1: symbol +compiler.err.local.cant.be.inst.static={0} {1} ist lokal und kann nicht aus einem statischen Kontext instanziiert werden + # 0: symbol kind, 1: symbol compiler.misc.bad.static.method.in.unbound.lookup=Unerwartete statische {0} {1} in ungebundenem Lookup gefunden @@ -2286,6 +2299,9 @@ compiler.misc.feature.flexible.constructors=Flexible Konstruktoren compiler.misc.feature.module.imports=Modulimporte +# L10N: do not localize: transitive +compiler.misc.feature.java.base.transitive=transitive Modifikator für java.base + compiler.warn.underscore.as.identifier=Ab Release 9 ist "_" ein Schlüsselwort und kann nicht als ID verwendet werden compiler.err.underscore.as.identifier=Ab Release 9 ist "_" ein Schlüsselwort und kann nicht als ID verwendet werden 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 818b5fb7066..2c108edf692 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 @@ -635,6 +635,9 @@ compiler.err.limit.stack=コードが要求するスタックが多すぎます compiler.err.limit.string=定数文字列が長すぎます +# 0: symbol +compiler.err.annotation.array.too.large="{0}"の注釈配列要素が大きすぎます + # 0: string compiler.err.limit.string.overflow=文字列"{0}..."のUTF8表現が、定数プールに対して長すぎます @@ -656,9 +659,6 @@ compiler.misc.unexpected.ret.val=予期しない戻り値 # 0: set of flag compiler.err.mod.not.allowed.here=修飾子{0}をここで使用することはできません -# 0: name -compiler.err.modifier.not.allowed.here=修飾子{0}をここで使用することはできません - compiler.err.intf.not.allowed.here=ここではインタフェースは許可されません # 0: symbol, 1: symbol @@ -781,9 +781,6 @@ compiler.err.not.def.access.class.intf.cant.access.reason=パッケージ{2}の{ # 0: symbol, 1: symbol, 2: symbol, 3: message segment compiler.misc.not.def.access.class.intf.cant.access.reason=パッケージ{2}の{1}.{0}にはアクセスできません\n({3}) -# 0: symbol, 1: list of type, 2: type -compiler.misc.cant.access.inner.cls.constr=コンストラクタ{0}({1})にアクセスできません\n内部クラスを囲む型{2}のインスタンスがスコープ内にありません - # 0: symbol, 1: symbol compiler.err.not.def.public.cant.access={1}の{0}はpublicではありません。パッケージ外からはアクセスできません @@ -1148,6 +1145,10 @@ compiler.err.file.sb.on.source.or.patch.path.for.module=ファイルは、ソー compiler.err.no.java.lang=プラットフォーム・クラスでパッケージjava.langを検出できません +compiler.err.statement.not.expected=文はメソッドおよびイニシャライザの外では必要ありません + +compiler.err.class.method.or.field.expected=クラス、インタフェース、注釈型、列挙、レコード、メソッドまたはフィールドが必要です + ##### # Fatal Errors @@ -1589,6 +1590,7 @@ compiler.warn.proc.duplicate.option.name=重複するサポート対象オプシ # 0: string, 1: string compiler.warn.proc.duplicate.supported.annotation=重複するサポート対象注釈インタフェース''{0}''が注釈プロセッサ''{1}''によって返されました + # 0: string compiler.warn.proc.redundant.types.with.wildcard=注釈プロセッサ''{0}''は''*''と他の注釈インタフェースを重複してサポートします @@ -1671,6 +1673,9 @@ compiler.warn.annotation.method.not.found=タイプ''{0}''内に注釈メソッ # 0: type, 1: name, 2: message segment compiler.warn.annotation.method.not.found.reason=タイプ''{0}''内に注釈メソッド''{1}()''が見つかりません: {2} +# 0: list of annotation, 1: symbol, 2: name, 3: message segment +compiler.err.cant.attach.type.annotations=タイプ注釈{0}を{1}.{2}に添付できません:\n{3} + # 0: file object, 1: symbol, 2: name compiler.warn.unknown.enum.constant=不明な列挙型定数です{1}.{2} @@ -1806,7 +1811,11 @@ compiler.misc.bad.enclosing.class={0}の内部クラスが不正です: {1} # 0: symbol compiler.misc.bad.enclosing.method=クラス{0}の囲んでいるメソッド属性が不正です -compiler.misc.bad.runtime.invisible.param.annotations=RuntimeInvisibleParameterAnnotations属性が不正です: {0} +# 0: file name +compiler.warn.runtime.visible.invisible.param.annotations.mismatch={0}内のRuntimeVisibleParameterAnnotations属性およびRuntimeInvisibleParameterAnnotations属性内のパラメータの長さが一致しません。両方の属性を無視します + +# 0: file name +compiler.warn.runtime.invisible.parameter.annotations={0}内のRuntimeVisibleParameterAnnotationsおよびRuntimeInvisibleParameterAnnotations属性をメソッドのパラメータにマップできません compiler.misc.bad.const.pool.tag=定数プール・タグ{0}が不正です @@ -2038,6 +2047,10 @@ compiler.err.abstract.cant.be.accessed.directly=抽象{0}である{1}({2}内)に # 0: symbol kind, 1: symbol compiler.err.non-static.cant.be.ref=staticでない{0} {1}をstaticコンテキストから参照することはできません +## The first argument ({0}) is a "kindname". +# 0: symbol kind, 1: symbol +compiler.err.local.cant.be.inst.static=ローカル{0} {1}をstaticコンテキストからインスタンス化できません + # 0: symbol kind, 1: symbol compiler.misc.bad.static.method.in.unbound.lookup=非バインド検索で予期しない静的な{0} {1}が見つかりました @@ -2286,6 +2299,9 @@ compiler.misc.feature.flexible.constructors=柔軟なコンストラクタ compiler.misc.feature.module.imports=モジュール・インポート +# L10N: do not localize: transitive +compiler.misc.feature.java.base.transitive=java.baseの推移的修飾子 + compiler.warn.underscore.as.identifier=リリース9から''_''はキーワードなので識別子として使用することはできません compiler.err.underscore.as.identifier=リリース9から''_''はキーワードなので識別子として使用することはできません 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 54298cb23b9..c841c3715fc 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 @@ -635,6 +635,9 @@ compiler.err.limit.stack=代码需要过多堆栈 compiler.err.limit.string=常量字符串过长 +# 0: symbol +compiler.err.annotation.array.too.large="{0}" 中的批注数组元素太大 + # 0: string compiler.err.limit.string.overflow=对于常量池来说, 字符串 "{0}..." 的 UTF8 表示过长 @@ -656,9 +659,6 @@ compiler.misc.unexpected.ret.val=意外的返回值 # 0: set of flag compiler.err.mod.not.allowed.here=此处不允许使用修饰符{0} -# 0: name -compiler.err.modifier.not.allowed.here=此处不允许使用修饰符{0} - compiler.err.intf.not.allowed.here=此处不允许使用接口 # 0: symbol, 1: symbol @@ -781,9 +781,6 @@ compiler.err.not.def.access.class.intf.cant.access.reason=程序包 {2} 中的 { # 0: symbol, 1: symbol, 2: symbol, 3: message segment compiler.misc.not.def.access.class.intf.cant.access.reason=程序包 {2} 中的 {1}.{0} 不可访问\n({3}) -# 0: symbol, 1: list of type, 2: type -compiler.misc.cant.access.inner.cls.constr=无法访问构造器 {0}({1})\n作用域中没有类型为{2}的封闭实例 - # 0: symbol, 1: symbol compiler.err.not.def.public.cant.access={0}在{1}中不是公共的; 无法从外部程序包中对其进行访问 @@ -1148,6 +1145,10 @@ compiler.err.file.sb.on.source.or.patch.path.for.module=文件应在源路径或 compiler.err.no.java.lang=在平台类中找不到程序包 java.lang +compiler.err.statement.not.expected=语句不应在方法和初始化程序外部 + +compiler.err.class.method.or.field.expected=需要类、接口、批注类型、枚举、记录、方法或字段 + ##### # Fatal Errors @@ -1589,6 +1590,7 @@ compiler.warn.proc.duplicate.option.name=批注处理程序 ''{1}'' 返回重复 # 0: string, 1: string compiler.warn.proc.duplicate.supported.annotation=批注处理程序 ''{1}'' 返回重复的受支持批注接口 ''{0}'' + # 0: string compiler.warn.proc.redundant.types.with.wildcard=批注处理程序 ''{0}'' 重复支持 ''*'' 和其他批注接口 @@ -1671,6 +1673,9 @@ compiler.warn.annotation.method.not.found=无法找到类型 ''{0}'' 的批注 # 0: type, 1: name, 2: message segment compiler.warn.annotation.method.not.found.reason=无法找到类型 ''{0}'' 的批注方法 ''{1}()'': {2} +# 0: list of annotation, 1: symbol, 2: name, 3: message segment +compiler.err.cant.attach.type.annotations=无法将类型批注 {0} 附加到 {1}.{2}:\n{3} + # 0: file object, 1: symbol, 2: name compiler.warn.unknown.enum.constant=未知的枚举常量 {1}.{2} @@ -1806,7 +1811,11 @@ compiler.misc.bad.enclosing.class={0}的封闭类错误: {1} # 0: symbol compiler.misc.bad.enclosing.method=类 {0} 的封闭方法属性错误 -compiler.misc.bad.runtime.invisible.param.annotations=错误的 RuntimeInvisibleParameterAnnotations 属性: {0} +# 0: file name +compiler.warn.runtime.visible.invisible.param.annotations.mismatch={0} 中 RuntimeVisibleParameterAnnotations 属性和 RuntimeInvisibleParameterAnnotations 属性中的参数长度不匹配,将忽略这两个属性 + +# 0: file name +compiler.warn.runtime.invisible.parameter.annotations={0} 中的 RuntimeVisibleParameterAnnotations 属性和 RuntimeInvisibleParameterAnnotations 属性无法映射到方法的参数 compiler.misc.bad.const.pool.tag=错误的常量池标记: {0} @@ -2038,6 +2047,10 @@ compiler.err.abstract.cant.be.accessed.directly=无法直接访问{2}中的抽 # 0: symbol kind, 1: symbol compiler.err.non-static.cant.be.ref=无法从静态上下文中引用非静态 {0} {1} +## The first argument ({0}) is a "kindname". +# 0: symbol kind, 1: symbol +compiler.err.local.cant.be.inst.static=无法从静态上下文实例化本地 {0} {1} + # 0: symbol kind, 1: symbol compiler.misc.bad.static.method.in.unbound.lookup=在未绑定查找中找到意外的静态 {0} {1} @@ -2286,6 +2299,9 @@ compiler.misc.feature.flexible.constructors=灵活构造器 compiler.misc.feature.module.imports=模块导入 +# L10N: do not localize: transitive +compiler.misc.feature.java.base.transitive=java.base 的过渡修饰符 + compiler.warn.underscore.as.identifier=从发行版 9 开始, ''_'' 为关键字, 不能用作标识符 compiler.err.underscore.as.identifier=从发行版 9 开始, ''_'' 为关键字, 不能用作标识符 @@ -2738,7 +2754,7 @@ compiler.misc.local=本地 # errors related to records # record components -compiler.err.record.cant.declare.field.modifiers=记录组件不能具有限定符 +compiler.err.record.cant.declare.field.modifiers=记录组件不能具有修饰符 # 0: symbol compiler.err.illegal.record.component.name=记录组件名称 {0} 非法 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 00b64b1f099..447695c9cf8 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 @@ -102,7 +102,7 @@ javac.opt.Xlint.all=Alle Warnungen aktivieren javac.opt.Xlint.none=Alle Warnungen deaktivieren #L10N: do not localize: -Xlint javac.opt.arg.Xlint=(,)* -javac.opt.Xlint.custom=Warnungen, die aktiviert oder deaktiviert werden sollen, durch Komma getrennt.\nStellen Sie einem Schlüssel "-" voran, um die angegebene Warnung zu deaktivieren.\nVerwenden Sie --help-lint, um die unterstützten Schlüssel zu sehen. +javac.opt.Xlint.custom=Warnungen, die aktiviert oder deaktiviert werden sollen, durch Komma getrennt.\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.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. @@ -187,7 +187,7 @@ javac.opt.Xdoclint.custom=Aktiviert oder deaktiviert bestimmte Prüfungen auf Pr javac.opt.Xdoclint.package.args = [-](,[-])* -javac.opt.Xdoclint.package.desc=Aktiviert oder deaktiviert Prüfungen in bestimmten Packages. Jedes ist entweder der\nqualifizierte Name eines Packages oder ein Packagenamenspräfix, gefolgt von ".*",\ndas sich auf alle Subpackages des angegebenen Packages bezieht. Jedem \nkann "-" vorangestellt werden, um Prüfungen für die angegebenen Packages zu deaktivieren. +javac.opt.Xdoclint.package.desc=Aktiviert oder deaktiviert Prüfungen in bestimmten Packages. Jedes ist entweder\nein qualifizierter Packagename oder ein Packagenamenspräfix, gefolgt von ".*",\ndas sich auf alle Subpackages des angegebenen Packages bezieht. Jedem \nkann "-" vorangestellt werden, um Prüfungen für die angegebenen Packages zu deaktivieren. javac.opt.Xstdout=Leitet die Standardausgabe um javac.opt.X=Gibt Hilfe zu zusätzlichen Optionen aus 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 4eb259b23cc..c215ad5eeba 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 @@ -102,7 +102,7 @@ javac.opt.Xlint.all=すべての警告を有効にします javac.opt.Xlint.none=すべての警告を無効にします #L10N: do not localize: -Xlint javac.opt.arg.Xlint=(,)* -javac.opt.Xlint.custom=有効または無効にする警告(カンマ区切り)。\n指定した警告を無効にするには、キーの前に'-'を指定します。\nサポートされているキーを表示するには--help-lintを使用します。 +javac.opt.Xlint.custom=有効または無効にする警告(カンマ区切り)。\n指定した警告を無効にするには、キーの前に''-''を指定します。\nサポートされているキーを表示するには--help-lintを使用します。 javac.opt.Xlint.desc.auxiliaryclass=ソース・ファイルで非表示になっているが他のファイルから使用されている補助クラスについて警告します。 javac.opt.Xlint.desc.cast=不要なキャストの使用について警告します。 @@ -187,7 +187,7 @@ javac.opt.Xdoclint.custom=javadocコメントの問題に関する特定のチ javac.opt.Xdoclint.package.args = [-](,[-])* -javac.opt.Xdoclint.package.desc=特定のパッケージのチェックを有効または無効にします。各は、\nパッケージの修飾された名前、またはパッケージ名の接頭辞の後に'.*'を\n指定(指定したパッケージのすべてのサブパッケージに拡張)したものです。各\nの前に'-'を指定すると、指定した1つ以上のパッケージに関するチェックを無効にできます。 +javac.opt.Xdoclint.package.desc=特定のパッケージのチェックを有効または無効にします。各は、\n修飾されたパッケージ名、またはパッケージ名の接頭辞の後に''.*''を\n指定(指定したパッケージのすべてのサブパッケージに拡張)したものです。各\nの前に''-''を指定すると、指定した1つ以上のパッケージに関するチェックを無効にできます。 javac.opt.Xstdout=標準出力をリダイレクトする javac.opt.X=追加オプションのヘルプを出力します @@ -216,7 +216,7 @@ javac.opt.module.version=コンパイルするモジュールのバージョン javac.opt.arg.module.version=<バージョン> javac.opt.inherit_runtime_environment=実行時環境からモジュール・システム構成オプションを継承します。 javac.opt.default.module.for.created.files=何も指定されていないか、推定型の場合、注釈プロセッサによって作成されるファイルのターゲット・モジュールをフォールバックします。 -javac.opt.lineDocComments='///'で行を開始すると、ドキュメンテーション・コメントのサポートが無効化されます +javac.opt.lineDocComments=''///''で行を開始すると、ドキュメンテーション・コメントのサポートが無効化されます ## messages 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 8cbddae86f6..1593280fd4d 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 @@ -87,7 +87,7 @@ javac.opt.arg.default.module.for.created.files= javac.opt.maxerrs=设置要输出的错误的最大数目 javac.opt.maxwarns=设置要输出的警告的最大数目 -javac.opt.nogj=语言中不接受泛型 +javac.opt.nogj=该语言不接受泛型 javac.opt.moreinfo=输出类型变量的扩展信息 javac.opt.printsearch=输出有关搜索类文件的位置的信息 javac.opt.prompt=在每次出错后停止 @@ -101,8 +101,8 @@ javac.opt.Xlint=启用建议的警告 javac.opt.Xlint.all=启用所有警告 javac.opt.Xlint.none=禁用所有警告 #L10N: do not localize: -Xlint -javac.opt.arg.Xlint=<密钥>(,<密钥>)* -javac.opt.Xlint.custom=要启用或禁用的警告,使用逗号分隔。\n在关键字前面加上 '-' 可禁用指定的警告。\n使用 --help-lint 可查看受支持的关键字。 +javac.opt.arg.Xlint=(,)* +javac.opt.Xlint.custom=要启用或禁用的警告(以逗号分隔)。\n在关键字前面加上 ''-'' 可禁用指定的警告。\n使用 --help-lint 可查看受支持的关键字。 javac.opt.Xlint.desc.auxiliaryclass=有关辅助类在源文件中隐藏, 但在其他文件中使用的警告。 javac.opt.Xlint.desc.cast=有关使用了不必要转换的警告。 @@ -187,7 +187,7 @@ javac.opt.Xdoclint.custom=为 javadoc 注释中的问题启用或禁用特定检 javac.opt.Xdoclint.package.args = [-]<程序包>(,[-]<程序包>)* -javac.opt.Xdoclint.package.desc=在特定的程序包中启用或禁用检查。每个 <程序包> 是\n程序包的限定名称,或程序包名称前缀后跟 '.*'\n(这将扩展到给定程序包的所有子程序包)。在每个 <程序包>\n前面加上 '-' 可以为指定程序包禁用检查。 +javac.opt.Xdoclint.package.desc=在特定的程序包中启用或禁用检查。每个 <程序包> 是\n限定的程序包名称,或程序包名称前缀后跟 ''.*''\n(这将扩展到给定程序包的所有子程序包)。在每个 <程序包>\n前面加上 ''-'' 可对指定程序包禁用检查。 javac.opt.Xstdout=重定向标准输出 javac.opt.X=输出额外选项的帮助 @@ -216,7 +216,7 @@ javac.opt.module.version=指定正在编译的模块版本 javac.opt.arg.module.version=<版本> javac.opt.inherit_runtime_environment=从运行时环境继承模块系统配置选项。 javac.opt.default.module.for.created.files=由批注处理程序创建的文件的备用目标模块 (如果未指定或推断任何模块)。 -javac.opt.lineDocComments=禁用对带有以 '///' 开头的行的文档注释的支持 +javac.opt.lineDocComments=禁用对带有以 ''///'' 开头的行的文档注释的支持 ## messages diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java index a2837013506..de86b7e2c57 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java @@ -886,7 +886,6 @@ public List getTypeParameters() { public List getImplementsClause() { return implementing; } - @SuppressWarnings("removal") @DefinedBy(Api.COMPILER_TREE) public List getPermitsClause() { return permitting; diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java index d9d55e16528..7fa2889c7d2 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java index d303b5f710f..59730448bf5 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractLog.java @@ -29,7 +29,6 @@ import java.util.Map; import javax.tools.JavaFileObject; -import com.sun.tools.javac.code.Lint.LintCategory; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag; import com.sun.tools.javac.util.JCDiagnostic.Error; import com.sun.tools.javac.util.JCDiagnostic.Note; @@ -155,21 +154,14 @@ public void error(DiagnosticFlag flag, int pos, Error errorKey) { report(diags.error(flag, source, wrap(pos), errorKey)); } - /** Report a warning, unless suppressed by the -nowarn option or the - * maximum number of warnings has been reached. - * @param warningKey The key for the localized warning message. + /** + * Report a lint warning, unless suppressed by the -nowarn option or the + * maximum number of warnings has been reached. + * + * @param warningKey The key for the localized warning message. */ public void warning(Warning warningKey) { - report(diags.warning(null, source, null, warningKey)); - } - - /** Report a lint warning, unless suppressed by the -nowarn option or the - * maximum number of warnings has been reached. - * @param lc The lint category for the diagnostic - * @param warningKey The key for the localized warning message. - */ - public void warning(LintCategory lc, Warning warningKey) { - report(diags.warning(lc, null, null, warningKey)); + report(diags.warning(source, null, warningKey)); } /** Report a warning, unless suppressed by the -nowarn option or the @@ -178,17 +170,7 @@ public void warning(LintCategory lc, Warning warningKey) { * @param warningKey The key for the localized warning message. */ public void warning(DiagnosticPosition pos, Warning warningKey) { - report(diags.warning(null, source, pos, warningKey)); - } - - /** Report a lint warning, unless suppressed by the -nowarn option or the - * maximum number of warnings has been reached. - * @param lc The lint category for the diagnostic - * @param pos The source position at which to report the warning. - * @param warningKey The key for the localized warning message. - */ - public void warning(LintCategory lc, DiagnosticPosition pos, Warning warningKey) { - report(diags.warning(lc, source, pos, warningKey)); + report(diags.warning(source, pos, warningKey)); } /** Report a warning, unless suppressed by the -nowarn option or the @@ -197,7 +179,7 @@ public void warning(LintCategory lc, DiagnosticPosition pos, Warning warningKey) * @param warningKey The key for the localized warning message. */ public void warning(int pos, Warning warningKey) { - report(diags.warning(null, source, wrap(pos), warningKey)); + report(diags.warning(source, wrap(pos), warningKey)); } /** Report a warning. @@ -205,16 +187,7 @@ public void warning(int pos, Warning warningKey) { * @param warningKey The key for the localized warning message. */ public void mandatoryWarning(DiagnosticPosition pos, Warning warningKey) { - report(diags.mandatoryWarning(null, source, pos, warningKey)); - } - - /** Report a warning. - * @param lc The lint category for the diagnostic - * @param pos The source position at which to report the warning. - * @param warningKey The key for the localized warning message. - */ - public void mandatoryWarning(LintCategory lc, DiagnosticPosition pos, Warning warningKey) { - report(diags.mandatoryWarning(lc, source, pos, warningKey)); + report(diags.mandatoryWarning(source, pos, warningKey)); } /** Provide a non-fatal notification, unless suppressed by the -nowarn option. diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java index 3f779175540..053a24e39ce 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/JCDiagnostic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -111,7 +111,7 @@ public JCDiagnostic error( */ public JCDiagnostic error( DiagnosticFlag flag, DiagnosticSource source, DiagnosticPosition pos, Error errorKey) { - JCDiagnostic diag = create(null, EnumSet.copyOf(defaultErrorFlags), source, pos, errorKey); + JCDiagnostic diag = create(EnumSet.copyOf(defaultErrorFlags), source, pos, errorKey); if (flag != null) { diag.setFlag(flag); } @@ -130,21 +130,19 @@ public JCDiagnostic error( public JCDiagnostic mandatoryWarning( LintCategory lc, DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { - return mandatoryWarning(lc, source, pos, warningKey(key, args)); + return mandatoryWarning(source, pos, warningKey(lc, key, args)); } /** * Create a warning diagnostic that will not be hidden by the -nowarn or -Xlint:none options. - * @param lc The lint category for the diagnostic * @param source The source of the compilation unit, if any, in which to report the warning. * @param pos The source position at which to report the warning. * @param warningKey The key for the localized warning message. * @see MandatoryWarningHandler */ public JCDiagnostic mandatoryWarning( - LintCategory lc, DiagnosticSource source, DiagnosticPosition pos, Warning warningKey) { - return create(lc, EnumSet.of(DiagnosticFlag.MANDATORY), source, pos, warningKey); + return create(EnumSet.of(DiagnosticFlag.MANDATORY), source, pos, warningKey); } /** @@ -158,20 +156,19 @@ public JCDiagnostic mandatoryWarning( */ public JCDiagnostic warning( LintCategory lc, DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { - return warning(lc, source, pos, warningKey(key, args)); + return warning(source, pos, warningKey(lc, key, args)); } /** * Create a warning diagnostic. - * @param lc The lint category for the diagnostic * @param source The source of the compilation unit, if any, in which to report the warning. * @param pos The source position at which to report the warning. * @param warningKey The key for the localized warning message. * @see MandatoryWarningHandler */ public JCDiagnostic warning( - LintCategory lc, DiagnosticSource source, DiagnosticPosition pos, Warning warningKey) { - return create(lc, EnumSet.noneOf(DiagnosticFlag.class), source, pos, warningKey); + DiagnosticSource source, DiagnosticPosition pos, Warning warningKey) { + return create(EnumSet.noneOf(DiagnosticFlag.class), source, pos, warningKey); } /** @@ -191,7 +188,7 @@ public JCDiagnostic mandatoryNote(DiagnosticSource source, String key, Object... * @see MandatoryWarningHandler */ public JCDiagnostic mandatoryNote(DiagnosticSource source, Note noteKey) { - return create(null, EnumSet.of(DiagnosticFlag.MANDATORY), source, null, noteKey); + return create(EnumSet.of(DiagnosticFlag.MANDATORY), source, null, noteKey); } /** @@ -212,7 +209,7 @@ public JCDiagnostic note( */ public JCDiagnostic note( DiagnosticSource source, DiagnosticPosition pos, Note noteKey) { - return create(null, EnumSet.noneOf(DiagnosticFlag.class), source, pos, noteKey); + return create(EnumSet.noneOf(DiagnosticFlag.class), source, pos, noteKey); } /** @@ -229,7 +226,7 @@ public JCDiagnostic fragment(String key, Object... args) { * @param fragmentKey The key for the localized subdiagnostic message. */ public JCDiagnostic fragment(Fragment fragmentKey) { - return create(null, EnumSet.noneOf(DiagnosticFlag.class), null, null, fragmentKey); + return create(EnumSet.noneOf(DiagnosticFlag.class), null, null, fragmentKey); } /** @@ -243,7 +240,7 @@ public JCDiagnostic fragment(Fragment fragmentKey) { */ public JCDiagnostic create( DiagnosticType kind, DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { - return create(null, EnumSet.noneOf(DiagnosticFlag.class), source, pos, DiagnosticInfo.of(kind, prefix, key, args)); + return create(EnumSet.noneOf(DiagnosticFlag.class), source, pos, DiagnosticInfo.of(kind, prefix, key, args)); } /** @@ -258,7 +255,7 @@ public JCDiagnostic create( */ public JCDiagnostic create( DiagnosticType kind, DiagnosticSource source, DiagnosticPosition pos, String key, UnaryOperator rewriter, Object... args) { - return create(null, EnumSet.noneOf(DiagnosticFlag.class), source, pos, DiagnosticInfo.of(kind, prefix, key, args), rewriter); + return create(EnumSet.noneOf(DiagnosticFlag.class), source, pos, DiagnosticInfo.of(kind, prefix, key, args), rewriter); } /** @@ -270,7 +267,7 @@ public JCDiagnostic create( */ public JCDiagnostic create( DiagnosticSource source, DiagnosticPosition pos, DiagnosticInfo diagnosticInfo) { - return create(null, EnumSet.noneOf(DiagnosticFlag.class), source, pos, diagnosticInfo); + return create(EnumSet.noneOf(DiagnosticFlag.class), source, pos, diagnosticInfo); } /** @@ -285,30 +282,31 @@ public JCDiagnostic create( */ public JCDiagnostic create(DiagnosticType kind, LintCategory lc, Set flags, DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) { - return create(lc, flags, source, pos, DiagnosticInfo.of(kind, prefix, key, args)); + return create(flags, source, pos, DiagnosticInfo.of(kind, lc, prefix, key, args)); } /** * Create a new diagnostic with given key. - * @param lc The lint category, if applicable, or null * @param flags The set of flags for the diagnostic * @param source The source of the compilation unit, if any, in which to report the message. * @param pos The source position at which to report the message. * @param diagnosticInfo The key for the localized message. */ public JCDiagnostic create( - LintCategory lc, Set flags, DiagnosticSource source, DiagnosticPosition pos, DiagnosticInfo diagnosticInfo) { - return new JCDiagnostic(formatter, normalize(diagnosticInfo), lc, flags, source, pos); + Set flags, DiagnosticSource source, DiagnosticPosition pos, DiagnosticInfo diagnosticInfo) { + return new JCDiagnostic(formatter, normalize(diagnosticInfo), flags, source, pos); } public JCDiagnostic create( - LintCategory lc, Set flags, DiagnosticSource source, DiagnosticPosition pos, DiagnosticInfo diagnosticInfo, UnaryOperator rewriter) { - return new JCDiagnostic(formatter, normalize(diagnosticInfo), lc, flags, source, pos, rewriter); + Set flags, DiagnosticSource source, DiagnosticPosition pos, DiagnosticInfo diagnosticInfo, UnaryOperator rewriter) { + return new JCDiagnostic(formatter, normalize(diagnosticInfo), flags, source, pos, rewriter); } //where DiagnosticInfo normalize(DiagnosticInfo diagnosticInfo) { //replace all nested FragmentKey with full-blown JCDiagnostic objects - return DiagnosticInfo.of(diagnosticInfo.type, diagnosticInfo.prefix, diagnosticInfo.code, + LintCategory category = diagnosticInfo instanceof LintWarning lintWarning ? + lintWarning.category : null; + return DiagnosticInfo.of(diagnosticInfo.type, category, diagnosticInfo.prefix, diagnosticInfo.code, Stream.of(diagnosticInfo.args).map(o -> { return (o instanceof Fragment frag) ? fragment(frag) : o; @@ -325,8 +323,8 @@ public Error errorKey(String code, Object... args) { /** * Create a new warning key. */ - Warning warningKey(String code, Object... args) { - return (Warning)DiagnosticInfo.of(WARNING, prefix, code, args); + Warning warningKey(LintCategory lintCategory, String code, Object... args) { + return (Warning)DiagnosticInfo.of(WARNING, lintCategory, prefix, code, args); } /** @@ -356,10 +354,10 @@ Fragment fragmentKey(String code, Object... args) { public static JCDiagnostic fragment(String key, Object... args) { return new JCDiagnostic(getFragmentFormatter(), DiagnosticInfo.of(FRAGMENT, + null, "compiler", key, args), - null, EnumSet.noneOf(DiagnosticFlag.class), null, null); @@ -464,7 +462,6 @@ public enum DiagnosticFlag { private final DiagnosticPosition position; private final DiagnosticInfo diagnosticInfo; private final Set flags; - private final LintCategory lintCategory; /** source line position (set lazily) */ private SourcePosition sourcePosition; @@ -537,11 +534,17 @@ public String key() { * Static factory method; build a custom diagnostic key using given kind, prefix, code and args. */ public static DiagnosticInfo of(DiagnosticType type, String prefix, String code, Object... args) { + return of(type, null, prefix, code, args); + } + + public static DiagnosticInfo of(DiagnosticType type, LintCategory lc, String prefix, String code, Object... args) { switch (type) { case ERROR: return new Error(prefix, code, args); case WARNING: - return new Warning(prefix, code, args); + return lc == null ? + new Warning(prefix, code, args) : + new LintWarning(lc, prefix, code, args); case NOTE: return new Note(prefix, code, args); case FRAGMENT: @@ -583,12 +586,28 @@ public Error(String prefix, String key, Object... args) { /** * Class representing warning diagnostic keys. */ - public static final class Warning extends DiagnosticInfo { + public static sealed class Warning extends DiagnosticInfo { public Warning(String prefix, String key, Object... args) { super(DiagnosticType.WARNING, prefix, key, args); } } + /** + * Class representing lint warning diagnostic keys. + */ + public static final class LintWarning extends Warning { + final LintCategory category; + + public LintWarning(LintCategory category, String prefix, String key, Object... args) { + super(prefix, key, args); + this.category = category; + } + + public LintCategory getLintCategory() { + return category; + } + } + /** * Class representing note diagnostic keys. */ @@ -614,31 +633,27 @@ public record AnnotatedType(Type type) {} * Create a diagnostic object. * @param formatter the formatter to use for the diagnostic * @param diagnosticInfo the diagnostic key - * @param lc the lint category for the diagnostic * @param source the name of the source file, or null if none. * @param pos the character offset within the source file, if given. */ protected JCDiagnostic(DiagnosticFormatter formatter, DiagnosticInfo diagnosticInfo, - LintCategory lc, Set flags, DiagnosticSource source, DiagnosticPosition pos) { - this(formatter, diagnosticInfo, lc, flags, source, pos, null); + this(formatter, diagnosticInfo, flags, source, pos, null); } /** * Create a diagnostic object. * @param formatter the formatter to use for the diagnostic * @param diagnosticInfo the diagnostic key - * @param lc the lint category for the diagnostic * @param source the name of the source file, or null if none. * @param pos the character offset within the source file, if given. * @param rewriter the rewriter function used if this diagnostic needs to be rewritten */ protected JCDiagnostic(DiagnosticFormatter formatter, DiagnosticInfo diagnosticInfo, - LintCategory lc, Set flags, DiagnosticSource source, DiagnosticPosition pos, @@ -648,7 +663,6 @@ protected JCDiagnostic(DiagnosticFormatter formatter, this.defaultFormatter = formatter; this.diagnosticInfo = diagnosticInfo; - this.lintCategory = lc; this.flags = flags; this.source = source; this.position = pos; @@ -687,14 +701,15 @@ public boolean isMandatory() { * Check whether this diagnostic has an associated lint category. */ public boolean hasLintCategory() { - return (lintCategory != null); + return getLintCategory() != null; } /** * Get the associated lint category, or null if none. */ public LintCategory getLintCategory() { - return lintCategory; + return diagnosticInfo instanceof LintWarning lintWarning ? + lintWarning.category : null; } /** @@ -870,7 +885,6 @@ public static class MultilineDiagnostic extends JCDiagnostic { public MultilineDiagnostic(JCDiagnostic other, List subdiagnostics) { super(other.defaultFormatter, other.diagnosticInfo, - other.getLintCategory(), other.flags, other.getDiagnosticSource(), other.position); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java index ceb5614ed0f..d2d726f3f26 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/List.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -151,7 +151,7 @@ public static List of(A x1, A x2, A x3) { /** Construct a list consisting of given elements. */ - @SuppressWarnings({"varargs", "unchecked"}) + @SuppressWarnings("unchecked") public static List of(A x1, A x2, A x3, A... rest) { return new List<>(x1, new List<>(x2, new List<>(x3, from(rest)))); } diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java index 1491c65180c..5423d19b600 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Log.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java index 9fe9590ef35..636563621a4 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/MandatoryWarningHandler.java @@ -33,6 +33,7 @@ import com.sun.tools.javac.code.Lint.LintCategory; import com.sun.tools.javac.code.Source; import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; +import com.sun.tools.javac.util.JCDiagnostic.LintWarning; import com.sun.tools.javac.util.JCDiagnostic.Note; import com.sun.tools.javac.util.JCDiagnostic.Warning; @@ -126,8 +127,9 @@ public MandatoryWarningHandler(Log log, Source source, boolean verbose, /** * Report a mandatory warning. */ - public void report(DiagnosticPosition pos, Warning warnKey) { + public void report(DiagnosticPosition pos, LintWarning warnKey) { JavaFileObject currentSource = log.currentSourceFile(); + Assert.check(warnKey.getLintCategory() == lintCategory); if (verbose) { if (sourcesWithReportedWarnings == null) @@ -259,9 +261,9 @@ public void reportDeferredDiagnostic() { private void logMandatoryWarning(DiagnosticPosition pos, Warning warnKey) { // Note: the following log methods are safe if lintCategory is null. if (enforceMandatory) - log.mandatoryWarning(lintCategory, pos, warnKey); + log.mandatoryWarning(pos, warnKey); else - log.warning(lintCategory, pos, warnKey); + log.warning(pos, warnKey); } /** diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java index 6c48490cf16..d9aec7c4592 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Names.java @@ -127,6 +127,7 @@ public static Names instance(Context context) { // module names public final Name java_base; + public final Name java_se; public final Name jdk_unsupported; // attribute names @@ -315,6 +316,7 @@ public Names(Context context) { // module names java_base = fromString("java.base"); + java_se = fromString("java.se"); jdk_unsupported = fromString("jdk.unsupported"); // attribute names diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java index 3bc5c671bfd..fa81ce7ba75 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -652,7 +652,6 @@ public static class RichConfiguration extends ForwardingDiagnosticFormatter.Forw /** set of enabled rich formatter's features */ protected java.util.EnumSet features; - @SuppressWarnings("fallthrough") public RichConfiguration(Options options, AbstractDiagnosticFormatter formatter) { super(formatter.getConfiguration()); features = formatter.isRaw() ? EnumSet.noneOf(RichFormatterFeature.class) : diff --git a/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver.properties b/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver.properties index 2da648dcb25..2dfa103409e 100644 --- a/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver.properties +++ b/src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java index ed08978c0ea..32f99b3fd5a 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -107,7 +107,6 @@ protected void engineInit(AlgorithmParameterSpec params, // compatibility, it is nonsensical for an anonymous class to define a // serialVersionUID. Suppress warnings relative to missing serialVersionUID // field in the anonymous subclass of serializable SecretKey. - @SuppressWarnings("serial") private static final SecretKey NULL_KEY = new SecretKey() { public byte[] getEncoded() { return new byte[0]; diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java index dabdbd950a8..0fe33c8231d 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -103,10 +103,6 @@ public int getClassStatus() { return JVMDIClassStatus.VERIFIED | JVMDIClassStatus.PREPARED | JVMDIClassStatus.INITIALIZED; } - public long computeModifierFlags() { - return JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC; - } - public long getArrayHeaderInBytes() { return Bits.maskBits(getLayoutHelper() >> LH_HEADER_SIZE_SHIFT, 0xFF); } diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java index e3c35f08991..05d511d422f 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java @@ -434,46 +434,6 @@ private static synchronized void initialize(TypeDataBase db) { } } - // refer to compute_modifier_flags in VM code. - public long computeModifierFlags() { - long access = getAccessFlags(); - // But check if it happens to be member class. - U2Array innerClassList = getInnerClasses(); - int length = (innerClassList == null)? 0 : innerClassList.length(); - if (length > 0) { - if (Assert.ASSERTS_ENABLED) { - Assert.that(length % InnerClassAttributeOffset.innerClassNextOffset == 0 || - length % InnerClassAttributeOffset.innerClassNextOffset == EnclosingMethodAttributeOffset.enclosingMethodAttributeSize, - "just checking"); - } - for (int i = 0; i < length; i += InnerClassAttributeOffset.innerClassNextOffset) { - if (i == length - EnclosingMethodAttributeOffset.enclosingMethodAttributeSize) { - break; - } - int ioff = innerClassList.at(i + - InnerClassAttributeOffset.innerClassInnerClassInfoOffset); - // 'ioff' can be zero. - // refer to JVM spec. section 4.7.5. - if (ioff != 0) { - // only look at classes that are already loaded - // since we are looking for the flags for our self. - Symbol name = getConstants().getKlassNameAt(ioff); - - if (name.equals(getName())) { - // This is really a member class - access = innerClassList.at(i + - InnerClassAttributeOffset.innerClassAccessFlagsOffset); - break; - } - } - } // for inner classes - } - - // Remember to strip ACC_SUPER bit - return (access & (~JVM_ACC_SUPER)) & JVM_ACC_WRITTEN_FLAGS; - } - - // whether given Symbol is name of an inner/nested Klass of this Klass? // anonymous and local classes are excluded. public boolean isInnerClassName(Symbol sym) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java index 5947e32861e..1b8a9d0ef69 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/Klass.java @@ -133,23 +133,6 @@ public long traceID() { return traceIDField.getJLong(addr); } - // computed access flags - takes care of inner classes etc. - // This is closer to actual source level than getAccessFlags() etc. - public long computeModifierFlags() { - return 0L; // Unless overridden, modifier_flags is 0. - } - - // same as JVM_GetClassModifiers - public final long getClassModifiers() { - // unlike the VM counterpart we never have to deal with primitive type, - // because we operator on Klass and not an instance of java.lang.Class. - long flags = computeModifierFlags(); - if (isSuper()) { - flags |= JVM_ACC_SUPER; - } - return flags; - } - // subclass check public boolean isSubclassOf(Klass k) { if (k != null) { diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjArrayKlass.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjArrayKlass.java index 0075cc77940..7bd1064a82e 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjArrayKlass.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjArrayKlass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * 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,19 +60,6 @@ public ObjArrayKlass(Address addr) { public Klass getElementKlass() { return (Klass) elementKlass.getValue(this); } public Klass getBottomKlass() { return (Klass) bottomKlass.getValue(this); } - public long computeModifierFlags() { - long elementFlags = getElementKlass().computeModifierFlags(); - long arrayFlags = 0L; - if ((elementFlags & (JVM_ACC_PUBLIC | JVM_ACC_PROTECTED)) != 0) { - // The array type is public if the component type is public or protected - arrayFlags = JVM_ACC_ABSTRACT | JVM_ACC_FINAL | JVM_ACC_PUBLIC; - } else { - // The array type is private if the component type is private - arrayFlags = JVM_ACC_ABSTRACT | JVM_ACC_FINAL; - } - return arrayFlags; - } - public void iterateFields(MetadataVisitor visitor) { super.iterateFields(visitor); visitor.doMetadata(elementKlass, true); diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java index eab5d5c15ae..bbf9d148e66 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ByteVector.java @@ -2427,6 +2427,7 @@ ByteVector sliceTemplate(int origin) { final > ByteVector rearrangeTemplate(Class shuffletype, S shuffle) { + Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, byte.class, length(), this, shuffle, null, @@ -2452,7 +2453,7 @@ ByteVector rearrangeTemplate(Class shuffletype, Class masktype, S shuffle, M m) { - + Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, byte.class, length(), @@ -2868,6 +2869,10 @@ private static ReductionOperation> reductionOperati toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> (byte) Math.min(a, b))); case VECTOR_OP_MAX: return (v, m) -> toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (byte) Math.max(a, b))); + case VECTOR_OP_UMIN: return (v, m) -> + toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> (byte) VectorMath.minUnsigned(a, b))); + case VECTOR_OP_UMAX: return (v, m) -> + toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (byte) VectorMath.maxUnsigned(a, b))); case VECTOR_OP_AND: return (v, m) -> toBits(v.rOp((byte)-1, m, (i, a, b) -> (byte)(a & b))); case VECTOR_OP_OR: return (v, m) -> diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java index 8065bf915a5..a217bec2dc7 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/DoubleVector.java @@ -2257,6 +2257,7 @@ DoubleVector sliceTemplate(int origin) { final > DoubleVector rearrangeTemplate(Class shuffletype, S shuffle) { + Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, double.class, length(), this, shuffle, null, @@ -2282,7 +2283,7 @@ DoubleVector rearrangeTemplate(Class shuffletype, Class masktype, S shuffle, M m) { - + Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, double.class, length(), diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java index ab056d1c397..1b2ca02e247 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/FloatVector.java @@ -2269,6 +2269,7 @@ FloatVector sliceTemplate(int origin) { final > FloatVector rearrangeTemplate(Class shuffletype, S shuffle) { + Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, float.class, length(), this, shuffle, null, @@ -2294,7 +2295,7 @@ FloatVector rearrangeTemplate(Class shuffletype, Class masktype, S shuffle, M m) { - + Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, float.class, length(), diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java index 063b0c0d8e8..eee30600bac 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/IntVector.java @@ -2412,6 +2412,7 @@ IntVector sliceTemplate(int origin) { final > IntVector rearrangeTemplate(Class shuffletype, S shuffle) { + Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, int.class, length(), this, shuffle, null, @@ -2437,7 +2438,7 @@ IntVector rearrangeTemplate(Class shuffletype, Class masktype, S shuffle, M m) { - + Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, int.class, length(), @@ -2853,6 +2854,10 @@ private static ReductionOperation> reductionOpera toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> (int) Math.min(a, b))); case VECTOR_OP_MAX: return (v, m) -> toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (int) Math.max(a, b))); + case VECTOR_OP_UMIN: return (v, m) -> + toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> (int) VectorMath.minUnsigned(a, b))); + case VECTOR_OP_UMAX: return (v, m) -> + toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (int) VectorMath.maxUnsigned(a, b))); case VECTOR_OP_AND: return (v, m) -> toBits(v.rOp((int)-1, m, (i, a, b) -> (int)(a & b))); case VECTOR_OP_OR: return (v, m) -> diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java index cde68c8fb38..637e9c02874 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/LongVector.java @@ -2278,6 +2278,7 @@ LongVector sliceTemplate(int origin) { final > LongVector rearrangeTemplate(Class shuffletype, S shuffle) { + Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, long.class, length(), this, shuffle, null, @@ -2303,7 +2304,7 @@ LongVector rearrangeTemplate(Class shuffletype, Class masktype, S shuffle, M m) { - + Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, long.class, length(), @@ -2719,6 +2720,10 @@ private static ReductionOperation> reductionOperati toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> (long) Math.min(a, b))); case VECTOR_OP_MAX: return (v, m) -> toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (long) Math.max(a, b))); + case VECTOR_OP_UMIN: return (v, m) -> + toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> (long) VectorMath.minUnsigned(a, b))); + case VECTOR_OP_UMAX: return (v, m) -> + toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (long) VectorMath.maxUnsigned(a, b))); case VECTOR_OP_AND: return (v, m) -> toBits(v.rOp((long)-1, m, (i, a, b) -> (long)(a & b))); case VECTOR_OP_OR: return (v, m) -> diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java index 3cf848f31d0..cf9031d613c 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/ShortVector.java @@ -2428,6 +2428,7 @@ ShortVector sliceTemplate(int origin) { final > ShortVector rearrangeTemplate(Class shuffletype, S shuffle) { + Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, short.class, length(), this, shuffle, null, @@ -2453,7 +2454,7 @@ ShortVector rearrangeTemplate(Class shuffletype, Class masktype, S shuffle, M m) { - + Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, short.class, length(), @@ -2869,6 +2870,10 @@ private static ReductionOperation> reductionOpera toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> (short) Math.min(a, b))); case VECTOR_OP_MAX: return (v, m) -> toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (short) Math.max(a, b))); + case VECTOR_OP_UMIN: return (v, m) -> + toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> (short) VectorMath.minUnsigned(a, b))); + case VECTOR_OP_UMAX: return (v, m) -> + toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> (short) VectorMath.maxUnsigned(a, b))); case VECTOR_OP_AND: return (v, m) -> toBits(v.rOp((short)-1, m, (i, a, b) -> (short)(a & b))); case VECTOR_OP_OR: return (v, m) -> diff --git a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template index 835868e61cd..c7598ac40a3 100644 --- a/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template +++ b/src/jdk.incubator.vector/share/classes/jdk/incubator/vector/X-Vector.java.template @@ -2824,6 +2824,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { final > $abstractvectortype$ rearrangeTemplate(Class shuffletype, S shuffle) { + Objects.requireNonNull(shuffle); return VectorSupport.rearrangeOp( getClass(), shuffletype, null, $type$.class, length(), this, shuffle, null, @@ -2849,7 +2850,7 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { Class masktype, S shuffle, M m) { - + Objects.requireNonNull(shuffle); m.check(masktype, this); return VectorSupport.rearrangeOp( getClass(), shuffletype, masktype, $type$.class, length(), @@ -3406,6 +3407,12 @@ public abstract class $abstractvectortype$ extends AbstractVector<$Boxtype$> { toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> ($type$) Math.min(a, b))); case VECTOR_OP_MAX: return (v, m) -> toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> ($type$) Math.max(a, b))); +#if[!FP] + case VECTOR_OP_UMIN: return (v, m) -> + toBits(v.rOp(MAX_OR_INF, m, (i, a, b) -> ($type$) VectorMath.minUnsigned(a, b))); + case VECTOR_OP_UMAX: return (v, m) -> + toBits(v.rOp(MIN_OR_INF, m, (i, a, b) -> ($type$) VectorMath.maxUnsigned(a, b))); +#end[!FP] #if[BITWISE] case VECTOR_OP_AND: return (v, m) -> toBits(v.rOp(($type$)-1, m, (i, a, b) -> ($type$)(a & b))); diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java index 6a9167e687b..93956a5a525 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/hotspot/HotSpotConstantPool.java @@ -798,11 +798,10 @@ public JavaField lookupField(int rawIndex, ResolvedJavaMethod method, int opcode HotSpotResolvedObjectTypeImpl resolvedHolder; try { resolvedHolder = compilerToVM().resolveFieldInPool(this, rawIndex, (HotSpotResolvedJavaMethodImpl) method, (byte) opcode, info); - } catch (Throwable t) { - resolvedHolder = null; + } catch (Throwable cause) { + return new UnresolvedJavaField(fieldHolder, lookupUtf8(getNameRefIndexAt(nameAndTypeIndex)), type, cause); } if (resolvedHolder == null) { - // There was an exception resolving the field or it returned null so return an unresolved field. return new UnresolvedJavaField(fieldHolder, lookupUtf8(getNameRefIndexAt(nameAndTypeIndex)), type); } final int flags = info[0]; diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/UnresolvedJavaField.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/UnresolvedJavaField.java index 9a28b8c60ef..d3c874ca26b 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/UnresolvedJavaField.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/UnresolvedJavaField.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * 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,10 +31,27 @@ public final class UnresolvedJavaField implements JavaField { private final JavaType holder; private final JavaType type; - public UnresolvedJavaField(JavaType holder, String name, JavaType type) { + /** + * The reason field resolution failed. Can be null. + */ + private final Throwable cause; + + public UnresolvedJavaField(JavaType holder, String name, JavaType type, Throwable cause) { this.name = name; this.type = type; this.holder = holder; + this.cause = cause; + } + + public UnresolvedJavaField(JavaType holder, String name, JavaType type) { + this(holder, name, type, null); + } + + /** + * Gets the exception, if any, representing the reason field resolution resulted in this object. + */ + public Throwable getCause() { + return cause; } @Override diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/UnresolvedJavaMethod.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/UnresolvedJavaMethod.java index e2888c31ba6..1ec73cc8030 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/UnresolvedJavaMethod.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/UnresolvedJavaMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * 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,10 +31,27 @@ public final class UnresolvedJavaMethod implements JavaMethod { private final Signature signature; protected JavaType holder; - public UnresolvedJavaMethod(String name, Signature signature, JavaType holder) { + /** + * The reason method resolution failed. Can be null. + */ + private final Throwable cause; + + public UnresolvedJavaMethod(String name, Signature signature, JavaType holder, Throwable cause) { this.name = name; this.holder = holder; this.signature = signature; + this.cause = cause; + } + + public UnresolvedJavaMethod(String name, Signature signature, JavaType holder) { + this(name, signature, holder, null); + } + + /** + * Gets the exception, if any, representing the reason method resolution resulted in this object. + */ + public Throwable getCause() { + return cause; } @Override diff --git a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/UnresolvedJavaType.java b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/UnresolvedJavaType.java index 845887369e3..1740744b4b1 100644 --- a/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/UnresolvedJavaType.java +++ b/src/jdk.internal.vm.ci/share/classes/jdk/vm/ci/meta/UnresolvedJavaType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,13 +28,19 @@ public final class UnresolvedJavaType implements JavaType { private final String name; + /** + * The reason type resolution failed. Can be null. + */ + private final Throwable cause; + @Override public String getName() { return name; } - private UnresolvedJavaType(String name) { + private UnresolvedJavaType(String name, Throwable cause) { this.name = name; + this.cause = cause; assert name.length() == 1 && JavaKind.fromPrimitiveOrVoidTypeChar(name.charAt(0)) != null || name.charAt(0) == '[' || name.charAt(name.length() - 1) == ';' : name; } @@ -42,20 +48,34 @@ private UnresolvedJavaType(String name) { * Creates an unresolved type for a valid {@link JavaType#getName() type name}. */ public static UnresolvedJavaType create(String name) { - return new UnresolvedJavaType(name); + return new UnresolvedJavaType(name, null); + } + + /** + * Creates an unresolved type for a valid {@link JavaType#getName() type name}. + */ + public static UnresolvedJavaType create(String name, Throwable cause) { + return new UnresolvedJavaType(name, cause); + } + + /** + * Gets the exception, if any, representing the reason type resolution resulted in this object. + */ + public Throwable getCause() { + return cause; } @Override public JavaType getComponentType() { if (getName().charAt(0) == '[') { - return new UnresolvedJavaType(getName().substring(1)); + return new UnresolvedJavaType(getName().substring(1), null); } return null; } @Override public JavaType getArrayClass() { - return new UnresolvedJavaType('[' + getName()); + return new UnresolvedJavaType('[' + getName(), null); } @Override diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_de.java b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_de.java index b11c491be14..9e7e0c81b21 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_de.java +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_de.java @@ -164,6 +164,7 @@ public class Resources_de extends java.util.ListResourceBundle { {"history.with.ts", "- Von \"%1$s\" signiert\n Digestalgorithmus: %2$s\n Signaturalgorithmus: %3$s, %4$s\n Zeitstempel von \"%6$s\" am %5$tc\n Digestalgorithmus f\u00FCr Zeitstempel: %7$s\n Signaturalgorithmus f\u00FCr Zeitstempel: %8$s, %9$s"}, {"history.without.ts", "- Von \"%1$s\" signiert\n Digestalgorithmus: %2$s\n Signaturalgorithmus: %3$s, %4$s"}, + {"history.nonexistent.entries", " Warnung: Nicht vorhandene signierte Eintr\u00E4ge: "}, {"history.unparsable", "- Signaturbezogene Datei %s kann nicht geparst werden"}, {"history.nosf", "- Signaturbezogene Datei META-INF/%s.SF fehlt"}, {"history.nobk", "- Blockdatei f\u00FCr signaturbezogene Datei META-INF/%s.SF fehlt"}, @@ -178,6 +179,7 @@ public class Resources_de extends java.util.ListResourceBundle { {"key.bit.disabled", "%d-Bit-Schl\u00FCssel (deaktiviert)"}, {"key.bit.eccurve.disabled", "%1$d-Bit-%2$s-Schl\u00FCssel (deaktiviert)"}, {"unknown.size", "unbekannte Gr\u00F6\u00DFe"}, + {"nonexistent.entries.found", "Diese JAR-Datei enth\u00E4lt signierte Eintr\u00E4ge f\u00FCr Dateien, die nicht vorhanden sind. Weitere Details finden Sie in der Verbose-Ausgabe (-verbose)."}, {"external.file.attributes.detected", "POSIX-Dateiberechtigung und/oder Symlink-Attribute erkannt. Diese Attribute werden bei der Signatur ignoriert und sind nicht durch die Signatur gesch\u00FCtzt."}, {"jarsigner.", "jarsigner: "}, diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java index 3754d864ce1..315180339b2 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_ja.java @@ -164,6 +164,7 @@ public class Resources_ja extends java.util.ListResourceBundle { {"history.with.ts", "- \u7F72\u540D\u8005: \"%1$s\"\n \u30C0\u30A4\u30B8\u30A7\u30B9\u30C8\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0: %2$s\n \u7F72\u540D\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0: %3$s\u3001%4$s\n \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u4ED8\u52A0\u8005: \"%6$s\" \u65E5\u6642: %5$tc\n \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u306E\u30C0\u30A4\u30B8\u30A7\u30B9\u30C8\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0: %7$s\n \u30BF\u30A4\u30E0\u30B9\u30BF\u30F3\u30D7\u306E\u7F72\u540D\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0: %8$s\u3001%9$s"}, {"history.without.ts", "- \u7F72\u540D\u8005: \"%1$s\"\n \u30C0\u30A4\u30B8\u30A7\u30B9\u30C8\u30FB\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0: %2$s\n \u7F72\u540D\u30A2\u30EB\u30B4\u30EA\u30BA\u30E0: %3$s\u3001%4$s"}, + {"history.nonexistent.entries", " \u8B66\u544A: \u5B58\u5728\u3057\u306A\u3044\u7F72\u540D\u6E08\u30A8\u30F3\u30C8\u30EA: "}, {"history.unparsable", "- \u7F72\u540D\u95A2\u9023\u30D5\u30A1\u30A4\u30EB%s\u3092\u89E3\u6790\u3067\u304D\u307E\u305B\u3093"}, {"history.nosf", "- \u7F72\u540D\u95A2\u9023\u30D5\u30A1\u30A4\u30EBMETA-INF/%s.SF\u304C\u3042\u308A\u307E\u305B\u3093"}, {"history.nobk", "- \u7F72\u540D\u95A2\u9023\u30D5\u30A1\u30A4\u30EBMETA-INF/%s.SF\u306E\u30D6\u30ED\u30C3\u30AF\u30FB\u30D5\u30A1\u30A4\u30EB\u304C\u3042\u308A\u307E\u305B\u3093"}, @@ -178,6 +179,7 @@ public class Resources_ja extends java.util.ListResourceBundle { {"key.bit.disabled", "%d\u30D3\u30C3\u30C8\u30FB\u30AD\u30FC (\u7121\u52B9)"}, {"key.bit.eccurve.disabled", "%1$d\u30D3\u30C3\u30C8%2$s\u30AD\u30FC(\u7121\u52B9)"}, {"unknown.size", "\u4E0D\u660E\u30B5\u30A4\u30BA"}, + {"nonexistent.entries.found", "\u3053\u306Ejar\u306B\u306F\u3001\u5B58\u5728\u3057\u306A\u3044\u30D5\u30A1\u30A4\u30EB\u306E\u7F72\u540D\u6E08\u30A8\u30F3\u30C8\u30EA\u304C\u542B\u307E\u308C\u307E\u3059\u3002\u8A73\u7D30\u306F\u3001-verbose\u51FA\u529B\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002"}, {"external.file.attributes.detected", "POSIX\u30D5\u30A1\u30A4\u30EB\u6A29\u9650\u307E\u305F\u306Fsymlink(\u3042\u308B\u3044\u306F\u305D\u306E\u4E21\u65B9)\u306E\u5C5E\u6027\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\u7F72\u540D\u4E2D\u306F\u3053\u308C\u3089\u306E\u5C5E\u6027\u306F\u7121\u8996\u3055\u308C\u3001\u7F72\u540D\u306B\u3088\u3063\u3066\u4FDD\u8B77\u3055\u308C\u307E\u305B\u3093\u3002"}, {"jarsigner.", "jarsigner: "}, diff --git a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java index 9e76346fca2..843ac92f6a7 100644 --- a/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java +++ b/src/jdk.jartool/share/classes/sun/security/tools/jarsigner/Resources_zh_CN.java @@ -164,6 +164,7 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {"history.with.ts", "- \u7531 \"%1$s\" \u7B7E\u540D\n \u6458\u8981\u7B97\u6CD5: %2$s\n \u7B7E\u540D\u7B97\u6CD5: %3$s, %4$s\n \u7531 \"%6$s\" \u4E8E %5$tc \u52A0\u65F6\u95F4\u6233\n \u65F6\u95F4\u6233\u6458\u8981\u7B97\u6CD5: %7$s\n \u65F6\u95F4\u6233\u7B7E\u540D\u7B97\u6CD5: %8$s, %9$s"}, {"history.without.ts", "- \u7531 \"%1$s\" \u7B7E\u540D\n \u6458\u8981\u7B97\u6CD5: %2$s\n \u7B7E\u540D\u7B97\u6CD5: %3$s, %4$s"}, + {"history.nonexistent.entries", "\u8B66\u544A\uFF1A\u4E0D\u5B58\u5728\u7684\u7B7E\u540D\u6761\u76EE\uFF1A "}, {"history.unparsable", "- \u65E0\u6CD5\u89E3\u6790\u7684\u4E0E\u7B7E\u540D\u76F8\u5173\u7684\u6587\u4EF6 %s"}, {"history.nosf", "- \u7F3A\u5C11\u4E0E\u7B7E\u540D\u76F8\u5173\u7684\u6587\u4EF6 META-INF/%s.SF"}, {"history.nobk", "- \u4E0E\u7B7E\u540D\u76F8\u5173\u7684\u6587\u4EF6 META-INF/%s.SF \u7F3A\u5C11\u5757\u6587\u4EF6"}, @@ -178,6 +179,7 @@ public class Resources_zh_CN extends java.util.ListResourceBundle { {"key.bit.disabled", "%d \u4F4D\u5BC6\u94A5\uFF08\u7981\u7528\uFF09"}, {"key.bit.eccurve.disabled", "%1$d \u4F4D %2$s \u5BC6\u94A5\uFF08\u7981\u7528\uFF09"}, {"unknown.size", "\u672A\u77E5\u5927\u5C0F"}, + {"nonexistent.entries.found", "\u6B64 jar \u7684\u6587\u4EF6\u5305\u542B\u4E0D\u5B58\u5728\u7684\u7B7E\u540D\u6761\u76EE\u3002\u6709\u5173\u66F4\u591A\u8BE6\u7EC6\u4FE1\u606F\uFF0C\u8BF7\u53C2\u89C1 -verbose \u8F93\u51FA\u3002"}, {"external.file.attributes.detected", "\u68C0\u6D4B\u5230 POSIX \u6587\u4EF6\u6743\u9650\u548C/\u6216 symlink \u5C5E\u6027\u3002\u8FD9\u4E9B\u5C5E\u6027\u5728\u8FDB\u884C\u7B7E\u540D\u65F6\u4F1A\u88AB\u5FFD\u7565\uFF0C\u4E0D\u53D7\u8BE5\u7B7E\u540D\u7684\u4FDD\u62A4\u3002"}, {"jarsigner.", "jarsigner: "}, diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/FingerPrint.java b/src/jdk.jartool/share/classes/sun/tools/jar/FingerPrint.java index beb97ae5fd8..a703b8b69c1 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/FingerPrint.java +++ b/src/jdk.jartool/share/classes/sun/tools/jar/FingerPrint.java @@ -131,6 +131,14 @@ public String className() { return attrs.name; } + public int classMajorVersion() { + return attrs.majorVersion; // ..., 53, 54, ... + } + + public int classReleaseVersion() { + return attrs.majorVersion - 44; // ..., 53 -> 9, 54 -> 10, ... + } + public int mrversion() { return mrversion; } diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/Main.java b/src/jdk.jartool/share/classes/sun/tools/jar/Main.java index d6cc2dbcdde..02afd5fdbcb 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/Main.java +++ b/src/jdk.jartool/share/classes/sun/tools/jar/Main.java @@ -152,7 +152,6 @@ public int hashCode() { * flag0: no zip compression (store only) * Mflag: DO NOT generate a manifest file (just ZIP) * iflag: generate jar index - * nflag: Perform jar normalization at the end * pflag: preserve/don't strip leading slash and .. component from file name * dflag: print module descriptor * kflag: keep existing file @@ -210,18 +209,8 @@ static String getMsg(String key) { } } - static String formatMsg(String key, String arg) { + static String formatMsg(String key, String... args) { String msg = getMsg(key); - String[] args = new String[1]; - args[0] = arg; - return MessageFormat.format(msg, (Object[]) args); - } - - static String formatMsg2(String key, String arg, String arg1) { - String msg = getMsg(key); - String[] args = new String[2]; - args[0] = arg; - args[1] = arg1; return MessageFormat.format(msg, (Object[]) args); } @@ -431,8 +420,9 @@ public synchronized boolean run(String[] args) { file = new File(fname); } else { file = createTemporaryFile("tmpJar", ".jar"); - try (InputStream in = new FileInputStream(FileDescriptor.in)) { - Files.copy(in, file.toPath()); + try (InputStream in = new FileInputStream(FileDescriptor.in); + OutputStream os = Files.newOutputStream(file.toPath())) { + in.transferTo(os); } } ok = validateJar(file); @@ -459,7 +449,7 @@ private boolean validateJar(File file) throws IOException { try (ZipFile zf = new ZipFile(file)) { return Validator.validate(this, zf); } catch (IOException e) { - error(formatMsg2("error.validator.jarfile.exception", fname, e.getMessage())); + error(formatMsg("error.validator.jarfile.exception", fname, e.getMessage())); return true; } } @@ -840,7 +830,7 @@ private void expand(File dir, String[] files, Set cpaths, int version) // the entry starts with VERSIONS_DIR and version != BASE_VERSION, // which means the "[dirs|files]" in --release v [dirs|files] // includes VERSIONS_DIR-ed entries --> warning and skip (?) - error(formatMsg2("error.release.unexpected.versioned.entry", + error(formatMsg("error.release.unexpected.versioned.entry", name, String.valueOf(version))); ok = false; return; @@ -1264,8 +1254,7 @@ void addFile(ZipOutputStream zos, Entry entry) throws IOException { if (vflag) { size = e.getSize(); long csize = e.getCompressedSize(); - out.print(formatMsg2("out.size", String.valueOf(size), - String.valueOf(csize))); + out.print(formatMsg("out.size", String.valueOf(size), String.valueOf(csize))); if (e.getMethod() == ZipEntry.DEFLATED) { long ratio = 0; if (size != 0) { diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java b/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java index 4201039ca78..3bb5e9a2a5e 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java +++ b/src/jdk.jartool/share/classes/sun/tools/jar/Validator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -51,7 +51,6 @@ import static sun.tools.jar.Main.MODULE_INFO; import static sun.tools.jar.Main.getMsg; import static sun.tools.jar.Main.formatMsg; -import static sun.tools.jar.Main.formatMsg2; import static sun.tools.jar.Main.toBinaryName; final class Validator { @@ -164,7 +163,15 @@ public void validateBase(Map fps) { public void validateVersioned(Map fps) { fps.values().forEach( fp -> { - + // all versioned entries must be compatible with their release target number + if (fp.mrversion() < fp.classReleaseVersion()) { + errorAndInvalid(formatMsg("error.release.value.toohigh.versioned.entry", + fp.entryName(), // META-INF/versions/9/com/foo/Bar.class has class file version + String.valueOf(fp.classMajorVersion()), // 69, but class file version + String.valueOf(fp.mrversion() + 44), // 53 or less is required to target release + String.valueOf(fp.mrversion()))); // 9 of the Java Platform + return; + } // validate the versioned module-info if (MODULE_INFO.equals(fp.basename())) { checkModuleDescriptor(fp.entryName()); @@ -310,7 +317,7 @@ private boolean checkClassName(FingerPrint fp) { if (fp.className().equals(className(fp.basename()))) { return true; } - error(formatMsg2("error.validator.names.mismatch", + error(formatMsg("error.validator.names.mismatch", fp.entryName(), fp.className().replace("/", "."))); return isValid = false; } diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties index c7b34abb340..676c16c445a 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties @@ -90,6 +90,8 @@ error.release.value.toosmall=\ release {0} not valid, must be >= 9 error.release.unexpected.versioned.entry=\ unexpected versioned entry {0} for release {1} +error.release.value.toohigh.versioned.entry=\ + {0} has class file version {1}, but class file version {2} or less is required to target release {3} of the Java Platform error.date.notvalid=\ date {0} is not a valid ISO-8601 extended offset date-time with optional time-zone error.date.out.of.range=\ @@ -282,10 +284,6 @@ main.help.opt.any.verbose=\ \ -v, --verbose Generate verbose output on standard output main.help.opt.create=\ \ Operation modifiers valid only in create mode:\n -main.help.opt.create.normalize=\ -\ -n, --normalize Normalize information in the new jar archive\n\ -\ after creation. This option is deprecated, and is\n\ -\ planned for removal in a future JDK release main.help.opt.create.update=\ \ Operation modifiers valid only in create and update mode:\n main.help.opt.create.update.main-class=\ 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 85f8bb9fe29..e81bda89ef3 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 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. # 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,8 @@ error.write.file=Fehler beim Schreiben in vorhandener JAR-Datei error.create.dir={0}: Verzeichnis konnte nicht erstellt werden error.incorrect.length=Falsche Länge bei der Verarbeitung: {0} error.create.tempfile=Es konnte keine temporäre Datei erstellt werden +error.extract.multiple.dest.dir=Sie können die Option "-C" oder "--dir" nicht mehrmals mit der Option "-x" angeben +error.extract.pflag.not.allowed=Sie können nicht "-Px" mit der Option "-C" oder "--dir" angeben error.hash.dep=Abhängigkeiten bei Hashing-Modul {0}. Modul {1} kann nicht im Modulpfad gefunden werden error.module.options.without.info=--module-version oder --hash-modules ohne module-info.class error.no.operative.descriptor=Kein operativer Deskriptor für Release: {0} @@ -83,6 +85,7 @@ warn.validator.concealed.public.class=Warnung: Eintrag {0} ist eine öffentliche warn.release.unexpected.versioned.entry=Unerwarteter versionierter Eintrag {0} warn.index.is.ignored=Der JAR-Index (META-INF/INDEX.LIST) wird seit JDK 18 zur Laufzeit ignoriert warn.flag.is.deprecated=Warnung: Die Option {0} ist veraltet und wird möglicherweise ignoriert oder in einem zukünftigen Release entfernt\n +warn.option.is.ignored=Warnung: Die Option "{0}" ist mit der aktuellen Verwendung nicht gültig und wird ignoriert. out.added.manifest=Manifest wurde hinzugefügt out.added.module-info=module-info hinzugefügt: {0} out.automodule=Kein Moduldeskriptor gefunden. Automatisches Modul wurde abgeleitet. @@ -94,10 +97,12 @@ out.deflated=({0} % verkleinert) out.stored=(0 % gespeichert) out.create=\ erstellt: {0} out.extracted=extrahiert: {0} +out.kept=\ übersprungen: {0} vorhanden out.inflated=\ vergrößert: {0} out.size=(ein = {0}) (aus = {1}) +out.extract.dir=Extrahieren in Verzeichnis: {0} -usage.compat=Kompatibilitätsschnittstelle\nVerwendung: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files] ...\nOptionen:\n -c erstellt ein neues Archiv (einschließlich fehlender übergeordneter Verzeichnisse)\n -t listet das Inhaltsverzeichnis für das Archiv auf\n -x extrahiert die benannten (oder alle) Dateien aus dem Archiv\n -u aktualisiert ein vorhandenes Archiv\n -v generiert Verbose-Ausgabe zur Standardausgabe\n -f gibt den Archivdateinamen an\n -m schließt Manifestinformationen aus der angegebenen Manifestdatei ein\n -e gibt den Anwendungseinstiegspunkt für Standalone-Anwendungen an,\n die in einer ausführbaren JAR-Datei gebündelt sind\n -0 speichert nur, keine ZIP-Komprimierung\n -P behält die vorangestellten Komponenten "/" (absoluter Pfad) und ".." (übergeordnetes Verzeichnis) aus Dateinamen bei\n -M generiert keine Manifestdatei für die Einträge\n -i generiert Indexinformationen für die angegebenen JAR-Dateien\n -C wechselt zum angegebenen Verzeichnis und schließt die folgende Datei ein\nDateien, die Verzeichnisse sind, werden rekursiv verarbeitet.\nDie Namen der Manifestdatei, der Archivdatei und des Einstiegspunkts werden\nin der gleichen Reihenfolge wie die Flags "m", "f" und "e" angegeben.\n\nBeispiel 1: Zwei Klassendateien in einem Archiv namens classes.jar archivieren: \n jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Die vorhandene Manifestdatei "mymanifest" verwenden und alle\n Dateien im Verzeichnis "foo/" in "classes.jar" archivieren: \n jar cvfm classes.jar mymanifest -C foo/ .\n +usage.compat=Kompatibilitätsschnittstelle\nVerwendung: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files] ...\nOptionen:\n -c erstellt ein neues Archiv (einschließlich fehlender übergeordneter Verzeichnisse)\n -t listet das Inhaltsverzeichnis für das Archiv auf\n -x extrahiert die benannten (oder alle) Dateien aus dem Archiv\n -u aktualisiert ein vorhandenes Archiv\n -v generiert Verbose-Ausgabe zur Standardausgabe\n -f gibt den Archivdateinamen an\n -m schließt Manifestinformationen aus der angegebenen Manifestdatei ein\n -e gibt den Anwendungseinstiegspunkt für Standalone-Anwendungen an,\n die in einer ausführbaren JAR-Datei gebündelt sind\n -0 speichert nur, ohne ZIP-Komprimierung\n -P behält die vorangestellten Komponenten "/" (absoluter Pfad) und ".." (übergeordnetes Verzeichnis) aus Dateinamen bei\n -M generiert keine Manifestdatei für die Einträge\n -i generiert Indexinformationen für die angegebenen JAR-Dateien\n -C wechselt zum angegebenen Verzeichnis und schließt die folgende Datei ein\nDateien, die Verzeichnisse sind, werden rekursiv verarbeitet.\nBei Verwendung im Extraktionsmodus wird die JAR-Datei in das angegebene Verzeichnis extrahiert\nDie Namen der Manifestdatei, der Archivdatei und des Einstiegspunkts werden\nin der gleichen Reihenfolge wie die Kennzeichen "m", "f" und "e" angegeben.\n\nBeispiel 1: Zwei Klassendateien in einem Archiv namens classes.jar archivieren: \n jar cvf classes.jar Foo.class Bar.class \nBeispiel 2: Die vorhandene Manifestdatei "mymanifest" verwenden und alle\n Dateien im Verzeichnis "foo/" in "classes.jar" archivieren: \n jar cvfm classes.jar mymanifest -C foo/ .\n main.usage.summary=Verwendung: jar [OPTION...] [ [--release VERSION] [-C dir] Dateien] ... main.usage.summary.try=Verwenden Sie "jar --help", um weitere Informationen anzuzeigen. @@ -108,14 +113,13 @@ main.help.opt.main.create=\ -c, --create Erstellt das Archiv. Wen main.help.opt.main.generate-index=\ -i, --generate-index=FILE Generiert Indexinformationen für die angegebenen\n JAR-Archive. Diese Option ist veraltet und wird möglicherweise in \n einem zukünftigen Release entfernt. main.help.opt.main.list=\ -t, --list Das Inhaltsverzeichnis für das Archiv auflisten main.help.opt.main.update=\ -u, --update Ein vorhandenes JAR-Archiv aktualisieren -main.help.opt.main.extract=\ -x, --extract Benannte (oder alle) Dateien aus dem Archiv extrahieren +main.help.opt.main.extract=\ -x, --extract Extrahiert benannte (oder alle) Dateien aus dem Archiv.\n Wenn eine Datei mit demselben Namen mehrmals im\n Archiv enthalten ist, wird jede Kopie extrahiert. Dabei überschreiben (ersetzen) neuere Kopien\n ältere Kopien, es sei denn, "-k" ist angegeben. main.help.opt.main.describe-module=\ -d, --describe-module Gibt den Moduldeskriptor oder automatischen Modulnamen aus main.help.opt.main.validate=\ --validate Validiert den Inhalt des JAR-Archivs. Diese Option\n validiert, dass die von einem Multi-Release-JAR-Archiv\n exportierte API über die verschiedenen Releaseversionen\n hinweg konsistent ist. -main.help.opt.any=\ In jedem Modus gültige Vorgangsmodifikatoren:\n\n -C DIR Zum angegebenen Verzeichnis wechseln und die folgende\n Datei aufnehmen +main.help.opt.any=\ In jedem Modus gültige Vorgangsmodifikatoren:\n\n -C DIR Zum angegebenen Verzeichnis wechseln und die folgende\n Datei aufnehmen. Bei Verwendung im Extraktionsmodus wird\n die JAR-Datei in das angegebene Verzeichnis extrahiert main.help.opt.any.file=\ -f, --file=FILE Der Name der Archivdatei. Wenn Sie dies auslassen, wird entweder stdin oder\n stdout verwendet, je nach Vorgang\n --release VERSION Speichert alle der folgenden Dateien in einem versionierten Verzeichnis\n der JAR-Datei (d.h. META-INF/versions/VERSION/) main.help.opt.any.verbose=\ -v, --verbose Verbose-Ausgabe bei Standardausgabe generieren main.help.opt.create=\ Vorgangsmodifikatoren, die nur im Erstellungsmodus gültig sind:\n -main.help.opt.create.normalize=\ -n, --normalize Normalisiert Informationen im neuen JAR-Archiv\n nach der Erstellung. Diese Option ist veraltet, und ihre\n Entfernung in einem künftigen JDK-Release ist geplant main.help.opt.create.update=\ Vorgangsmodifikatoren, die nur im Erstellungs- und Aktualisierungsmodus gültig sind:\n main.help.opt.create.update.main-class=\ -e, --main-class=CLASSNAME Der Anwendungseinstiegspunkt für Standalone-\n Anwendungen, die in einem modularen oder ausführbaren\n JAR-Archiv gebündelt sind main.help.opt.create.update.manifest=\ -m, --manifest=FILE Die Manifestinformationen aus der angegebenen\n Manifestdatei aufnehmen @@ -128,8 +132,12 @@ main.help.opt.create.update.warn-if-resolved=\ --warn-if-resolved Hinwe main.help.opt.create.update.index=\ Vorgangsmodifikatoren, die nur im Erstellungs-, Aktualisierungs- und Indexgenerierungsmodus gültig sind:\n main.help.opt.create.update.index.no-compress=\ -0, --no-compress Nur speichern, keine ZIP-Komprimierung verwenden main.help.opt.create.update.index.date=\ --date=TIMESTAMP Zeitstempel im erweiterten Datums-/Uhrzeitformat mit Zeitunterschied\n und optionaler Zeitzone nach ISO-8601, zur Verwendung für die Zeitstempel von\n Einträgen, z.B. "2022-02-12T12:30:00-05:00" +main.help.opt.extract=\ Vorgangsmodifikatoren, die nur im Extraktionsmodus gültig sind:\n +main.help.opt.extract.keep-old-files=\ -k, --keep-old-files Vorhandene Dateien nicht überschreiben.\n Wenn bereits ein JAR-Dateieintrag mit demselben Namen im\n Zielverzeichnis vorhanden ist, wird die vorhandene Datei nicht überschrieben.\n Wenn eine Datei also mehrmals in einem\n Archiv enthalten ist, werden ältere Kopien nicht durch neuere Kopien überschrieben.\n Beachten Sie zudem, dass bei einigen Dateisystemen die Groß-/Kleinschreibung ignoriert wird. main.help.opt.other=\ Weitere Optionen:\n main.help.opt.other.help=\ -?, -h, --help[:compat] Gibt diese Meldung oder optional die Kompatibilität, Hilfe an main.help.opt.other.help-extra=\ --help-extra Hilfe zu zusätzlichen Optionen main.help.opt.other.version=\ --version Programmversion ausgeben main.help.postopt=\ Ein Archiv ist ein modulares JAR-Archiv, wenn der Moduldeskriptor "module-info.class"\n in der Root der angegebenen Verzeichnisse oder in der Root des JAR-Archivs selbst\n vorhanden ist. Die folgenden Vorgänge sind nur gültig, wenn Sie ein modulares JAR-Archiv\n erstellen oder ein vorhandenes nicht modulares JAR-Archiv aktualisieren: "--module-version",\n "--hash-modules" und "--modulepath".\n\n Obligatorische oder optionale Argumente zu langen Optionen sind auch für die jeweils\n zugehörigen kurzen Optionen obligatorisch oder optional. +main.help.opt.extract=\ Vorgangsmodifikatoren, die nur im Extraktionsmodus gültig sind:\n +main.help.opt.extract.dir=\ --dir Verzeichnis, in das die JAR-Datei extrahiert wird diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_es.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_es.properties index 481259dfb1c..0e392cf9b7e 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_es.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_es.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -106,7 +106,6 @@ main.help.opt.any=\ Modificadores de operación válidos en cualquier modo:\n\n main.help.opt.any.file=\ -f, --file=FILE El nombre del archivo. Si se omite, se usa stdin o\n stdout en función de la operación\n --release VERSION Se colocan todos los archivos siguientes en un directorio con versión\n del archivo jar (es decir, META-INF/versions/VERSION/) main.help.opt.any.verbose=\ -v, --verbose Generar salida verbose en salida estándar main.help.opt.create=\ Modificadores de operación válidos solo en el modo de creación:\n -main.help.opt.create.normalize=\ -n, --normalize Normalizar información en el nuevo archivo jar\n después de la creación main.help.opt.create.update=\ Modificadores de operación válidos solo en el modo de creación y de actualización:\n main.help.opt.create.update.main-class=\ -e, --main-class=CLASSNAME Punto de entrada de la aplicación para aplicaciones\n autónomas agrupadas en un archivo jar modular o\n ejecutable main.help.opt.create.update.manifest=\ -m, --manifest=FILE Incluir la información de manifiesto del archivo\n de manifiesto proporcionado diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_fr.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_fr.properties index 4a1a8ce4c1b..cc1886eb18c 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_fr.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_fr.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -106,7 +106,6 @@ main.help.opt.any=\ Modificateurs d'opération valides pour tous les modes :\n\n main.help.opt.any.file=\ -f, --file=FILE Nom du fichier d'archive. Lorsqu'il est omis, stdin ou\n stdout est utilisé en fonction de l'opération\n --release VERSION Place tous les fichiers suivants dans un répertoire avec numéro de version\n du fichier JAR (à savoir META-INF/versions/VERSION/) main.help.opt.any.verbose=\ -v, --verbose Génère une sortie en mode verbose d'une sortie standard main.help.opt.create=\ Modificateurs d'opération valides uniquement en mode create :\n -main.help.opt.create.normalize=\ -n, --normalize Normaliser des informations dans la nouvelle archive JAR\n après la création main.help.opt.create.update=\ Modificateurs d'opération valides uniquement en modes create et update :\n main.help.opt.create.update.main-class=\ -e, --main-class=CLASSNAME Point d'entrée d'une application en mode autonome\n intégrée à une archive JAR modulaire\n ou exécutable main.help.opt.create.update.manifest=\ -m, --manifest=FILE Inclut les informations de manifeste du fichier\n manifeste donné diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_it.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_it.properties index ff36367cfe9..4d70d1a8835 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_it.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_it.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -106,7 +106,6 @@ main.help.opt.any=\ Modificatori di funzionamento validi in qualsiasi modalità: main.help.opt.any.file=\ -f, --file=FILE Il nome file dell'archivio. Se omesso, viene usato stdin o\n stdout in base all'operazione\n --release VERSION Posiziona tutti i file successivi in una directory con controllo delle versioni\n del file jar (ad esempio, META-INF/versions/VERSION/) main.help.opt.any.verbose=\ -v, --verbose Genera l'output descrittivo nell'output standard main.help.opt.create=\ Modificatori di funzionamento validi solo nella modalità di creazione:\n -main.help.opt.create.normalize=\ -n, --normalize Normalizza le informazioni nel nuovo archivio jar\n dopo la creazione main.help.opt.create.update=\ Modificatori di funzionamento validi solo nella modalità di creazione e aggiornamento:\n main.help.opt.create.update.main-class=\ -e, --main-class=CLASSNAME Punto di ingresso per le applicazioni\n stand-alone incluse nell'archivio jar modulare o\n eseguibile main.help.opt.create.update.manifest=\ -m, --manifest=FILE Include le informazioni sul file manifest dal file\n manifest specificato 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 0444689acd3..5be71c2e424 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 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. # 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,8 @@ error.write.file=既存jarファイルの書込み中にエラーが発生しま error.create.dir=ディレクトリ{0}を作成できませんでした error.incorrect.length={0}の処理中に不正な長さがありました error.create.tempfile=一時ファイルを作成できませんでした +error.extract.multiple.dest.dir='-x'オプションでは複数の'-C'または'--dir'を指定できません +error.extract.pflag.not.allowed='-C'または'--dir'オプションでは'-Px'を指定できません error.hash.dep=モジュール{0}依存性のハッシュでモジュール{1}がモジュール・パスに見つかりません error.module.options.without.info=--module-versionまたは--hash-modulesのいずれかでmodule-info.classがありません error.no.operative.descriptor=リリースの操作ディスクリプタはありません: {0} @@ -83,6 +85,7 @@ warn.validator.concealed.public.class=警告 : エントリ{0}は、隠しパッ warn.release.unexpected.versioned.entry=予期しないバージョニング済エントリ{0} warn.index.is.ignored=JDK 18以降、JAR索引(META-INF/INDEX.LIST)は実行時に無視されます warn.flag.is.deprecated=警告: {0}オプションは非推奨であり、今後のリリースで無視または削除される可能性があります\n +warn.option.is.ignored=警告: {0}オプションは、現在の使用状況では有効ではありません。無視されます。 out.added.manifest=マニフェストが追加されました out.added.module-info=module-infoが追加されました: {0} out.automodule=モジュール・ディスクリプタが見つかりません。自動モジュールが導出されました。 @@ -94,10 +97,12 @@ out.deflated=({0}%収縮されました) out.stored=(0%格納されました) out.create=\ {0}が作成されました out.extracted={0}が抽出されました +out.kept=\ スキップされました: {0}が存在します out.inflated=\ {0}が展開されました out.size=(入={0})(出={1}) +out.extract.dir=ディレクトリに抽出しています: {0} -usage.compat=互換性インタフェース:\n使用方法: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files] ...\nオプション:\n -c アーカイブを新規作成する(欠落している親ディレクトリを含む)\n -t アーカイブの内容を一覧表示する\n -x 指定の(またはすべての)ファイルをアーカイブから抽出する\n -u 既存アーカイブを更新する\n -v 標準出力に詳細な出力を生成する\n -f アーカイブ・ファイル名を指定する\n -m 指定のマニフェスト・ファイルからマニフェスト情報を取り込む\n -e 実行可能jarファイルにバンドルされたスタンドアロン・アプリケーションの \n エントリ・ポイントを指定する\n -0 格納のみ。ZIP圧縮を使用しない\n -P ファイル名の先頭の'/' (絶対パス)および".." (親ディレクトリ)コンポーネントを保持する\n -M エントリのマニフェスト・ファイルを作成しない\n -i 指定のjarファイルの索引情報を生成する\n -C 指定のディレクトリに変更し、次のファイルを取り込む\nファイルがディレクトリの場合は再帰的に処理されます。\nマニフェスト・ファイル名、アーカイブ・ファイル名およびエントリ・ポイント名は、\nフラグ'm'、'f'、'e'の指定と同じ順番で指定する必要があります。\n\n例1: 2つのクラス・ファイルをアーカイブclasses.jarに保存する: \n jar cvf classes.jar Foo.class Bar.class \n例2: 既存のマニフェスト・ファイル'mymanifest'を使用し、foo/ディレクトリの\n 全ファイルを'classes.jar'にアーカイブする: \n jar cvfm classes.jar mymanifest -C foo/ .\n +usage.compat=互換性インタフェース:\n使用方法: jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files] ...\nオプション:\n -c アーカイブを新規作成する(欠落している親ディレクトリを含む)\n -t アーカイブの内容を一覧表示する\n -x 指定の(またはすべての)ファイルをアーカイブから抽出する\n -u 既存アーカイブを更新する\n -v 標準出力に詳細な出力を生成する\n -f アーカイブ・ファイル名を指定する\n -m 指定のマニフェスト・ファイルからマニフェスト情報を取り込む\n -e 実行可能jarファイルにバンドルされたスタンドアロン・アプリケーションの \n エントリ・ポイントを指定する\n -0 格納のみ。ZIP圧縮を使用しない\n -P ファイル名の先頭の'/' (絶対パス)および".." (親ディレクトリ)コンポーネントを保持する\n -M エントリのマニフェスト・ファイルを作成しない\n -i 指定のjarファイルの索引情報を生成する\n -C 指定のディレクトリに変更し、次のファイルを取り込む\nファイルがディレクトリの場合は再帰的に処理されます。\n抽出モードで使用される場合、jarを指定のディレクトリに抽出します\nマニフェスト・ファイル名、アーカイブ・ファイル名およびエントリ・ポイント名は、\nフラグ'm'、'f'、'e'の指定と同じ順番で指定する必要があります。\n\n例1: 2つのクラス・ファイルをアーカイブclasses.jarに保存する: \n jar cvf classes.jar Foo.class Bar.class \n例2: 既存のマニフェスト・ファイル'mymanifest'を使用し、foo/ディレクトリの\n 全ファイルを'classes.jar'にアーカイブする: \n jar cvfm classes.jar mymanifest -C foo/ .\n main.usage.summary=使用方法: jar [OPTION...] [ [--release VERSION] [-C dir] files] ... main.usage.summary.try=詳細は、`jar --help'を実行してください。 @@ -108,14 +113,13 @@ main.help.opt.main.create=\ -c、--create アーカイブを作 main.help.opt.main.generate-index=\ -i, --generate-index=FILE 指定したjarアーカイブの索引情報を生成します。\n このオプションは非推奨であり、今後のリリースで\n 削除される可能性があります。 main.help.opt.main.list=\ -t、--list アーカイブの内容を一覧表示します main.help.opt.main.update=\ -u、--update 既存のjarアーカイブを更新します -main.help.opt.main.extract=\ -x、--extract 指定の(またはすべての)ファイルをアーカイブから抽出します +main.help.opt.main.extract=\ -x、--extract 指定の(またはすべての)ファイルをアーカイブから抽出します。\n 同じ名前のファイルがアーカイブに複数回出現する場合、\n 各コピーが抽出され、後のコピーにより、前のコピーが\n 上書き(置換)されます(-kが指定されている場合以外)。 main.help.opt.main.describe-module=\ -d, --describe-module モジュール・ディスクリプタまたは自動モジュール名を出力します main.help.opt.main.validate=\ --validate jarアーカイブの内容を検証します。このオプションは\n 複数リリースのjarアーカイブでエクスポートされたAPIが\n すべての異なるリリース・バージョンで一貫していることを\n 検証します。 -main.help.opt.any=\ どのモードでも有効な操作修飾子:\n\n -C DIR 指定のディレクトリに変更し、次のファイルを\n 取り込みます +main.help.opt.any=\ どのモードでも有効な操作修飾子:\n\n -C DIR 指定のディレクトリに変更し、次のファイルを\n 取り込みます。抽出モードで使用されている場合、jarを\n 指定のディレクトリに抽出します main.help.opt.any.file=\ -f、--file=FILE アーカイブ・ファイル名。省略した場合、stdinまたは\n stdoutのいずれかが操作に基づいて使用されます\n --release VERSION 次のすべてのファイルをjarのバージョニングされたディレクトリ\n (つまり、META-INF/versions/VERSION/)に配置します main.help.opt.any.verbose=\ -v、--verbose 標準出力に詳細な出力を生成します main.help.opt.create=\ 作成モードでのみ有効な操作修飾子:\n -main.help.opt.create.normalize=\ -n, --normalize 新しいjarアーカイブの作成後、含まれる情報を\n 正規化します。このオプションは非推奨であり、\n 今後のJDKリリースで削除される予定です main.help.opt.create.update=\ 作成または更新モードでのみ有効な操作修飾子:\n main.help.opt.create.update.main-class=\ -e、--main-class=CLASSNAME モジュラまたは実行可能なjarアーカイブに\n バンドルされたスタンドアロン・アプリケーションの\n アプリケーション・エントリ・ポイント main.help.opt.create.update.manifest=\ -m、--manifest=FILE 指定のマニフェスト・ファイルからマニフェスト情報を\n 取り込みます @@ -128,8 +132,12 @@ main.help.opt.create.update.warn-if-resolved=\ --warn-if-resolved モ main.help.opt.create.update.index=\ 作成、更新および索引生成モードでのみ有効な操作修飾子:\n main.help.opt.create.update.index.no-compress=\ -0, --no-compress 格納のみ。ZIP圧縮を使用しません main.help.opt.create.update.index.date=\ --date=TIMESTAMP オプションのタイムゾーン形式を指定したISO-8601拡張オフセット\n の日時のタイムスタンプ。エントリのタイムスタンプの使用例は、\n "2022-02-12T12:30:00-05:00"です +main.help.opt.extract=\ 抽出モードでのみ有効な操作修飾子:\n +main.help.opt.extract.keep-old-files=\ -k、--keep-old-files 既存のファイルを上書きしません。\n 同じ名前のJarファイル・エントリがターゲット・ディレクトリに\n 存在する場合、既存のファイルは上書きされません。\n 結果として、ファイルがアーカイブ内に複数回出現する場合、\n 後のコピーによって前のコピーは上書きされません。\n また、一部のファイル・システムでは、大/小文字が区別される場合があることに注意してください。 main.help.opt.other=\ その他のオプション:\n main.help.opt.other.help=\ -?、-h、--help[:compat] これ(オプションで互換性)をhelpに指定します main.help.opt.other.help-extra=\ --help-extra 追加オプションのヘルプを提供します main.help.opt.other.version=\ --version プログラム・バージョンを出力します main.help.postopt=\ モジュール・ディスクリプタ'module-info.class'が指定のディレクトリのルートまたは\n jarアーカイブ自体のルートにある場合、アーカイブはモジュラjarです。\n 次の操作は、モジュラjarの作成時または既存の非モジュラjarの更新時に\n のみ有効です: '--module-version'、\n '--hash-modules'および'--module-path'。\n\n ロング・オプションへの必須またはオプションの引数は、対応するショート・オプション\n に対しても必須またはオプションになります。 +main.help.opt.extract=\ 抽出モードでのみ有効な操作修飾子:\n +main.help.opt.extract.dir=\ --dir jarが抽出されるディレクトリ diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ko.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ko.properties index e16815575ec..22fb3d99f8d 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ko.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_ko.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -106,7 +106,6 @@ main.help.opt.any=\ 모든 모드에서 적합한 작업 수정자:\n\n -C DIR main.help.opt.any.file=\ -f, --file=FILE 아카이브 파일 이름입니다. 생략할 경우 작업에 따라 \n stdin 또는 stdout이 사용됩니다.\n --release VERSION 다음 모든 파일을 버전 지정된 jar 디렉토리\n (예: META-INF/versions/VERSION/)에 배치합니다. main.help.opt.any.verbose=\ -v, --verbose 표준 출력에 상세 정보 출력을 생성합니다. main.help.opt.create=\ 생성 모드에서만 적합한 작업 수정자:\n -main.help.opt.create.normalize=\ -n, --normalize 생성 후 새 jar 아카이브에서 정보를\n 정규화합니다. main.help.opt.create.update=\ 생성 및 업데이트 모드에서만 적합한 작업 수정자:\n main.help.opt.create.update.main-class=\ -e, --main-class=CLASSNAME 모듈형 또는 실행형 jar 아카이브에 번들로\n 제공된 독립형 애플리케이션의 애플리케이션\n 시작 지점입니다. main.help.opt.create.update.manifest=\ -m, --manifest=FILE 지정된 Manifest 파일의 Manifest 정보를\n 포함합니다. diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_pt_BR.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_pt_BR.properties index ec2b82ae603..a306a064afe 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_pt_BR.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_pt_BR.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -106,7 +106,6 @@ main.help.opt.any=\ Modificadores de operação válidos em qualquer modo:\n\n main.help.opt.any.file=\ -f, --file=FILE O nome do arquivo compactado. Quando omitido, stdin ou\n stdout será usado com base na operação\n --release VERSION Coloca todos os arquivos a seguir em um diretório com controle de versão\n do arquivo jar (i.e. META-INF/versions/VERSION/) main.help.opt.any.verbose=\ -v, --verbose Gera saída detalhada na saída padrão main.help.opt.create=\ Modificadores de operação válidos somente no modo de criação:\n -main.help.opt.create.normalize=\ -n, --normalize Normaliza as informações no novo arquivo compactado jar\n após a criação main.help.opt.create.update=\ Modificadores de operação válidos somente no modo de criação e atualização:\n main.help.opt.create.update.main-class=\ -e, --main-class=CLASSNAME O ponto de entrada do aplicativo para aplicativos\n stand-alone empacotados em um arquivo compactado jar modular\n ou executável main.help.opt.create.update.manifest=\ -m, --manifest=FILE Inclui as informações de manifesto provenientes do arquivo de\n manifesto em questão diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_sv.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_sv.properties index dda86c486a3..d42d77d5dc7 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_sv.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_sv.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -106,7 +106,6 @@ main.help.opt.any=\ Åtgärdsmodifierare som är giltiga i alla lägen:\n\n -C main.help.opt.any.file=\ -f, --file=FILE Namnet på arkivfilen. När det utelämnas används stdin eller\n stdout beroende på åtgärden\n --release VERSION Placerar alla följande filer i en versionshanterad katalog\n i jar-filen (t.ex. META-INF/versions/VERSION/) main.help.opt.any.verbose=\ -v, --verbose Generera utförliga utdata till standardutdata main.help.opt.create=\ Åtgärdsmodifierare som endast är giltiga i läget create:\n -main.help.opt.create.normalize=\ -n, --normalize Normalisera informationen i det nya jar-arkivet\n när det har skapats main.help.opt.create.update=\ Åtgärdsmodifierare som endast är giltiga i lägena create och update:\n main.help.opt.create.update.main-class=\ -e, --main-class=CLASSNAME Applikationsingångspunkten för fristående\n applikationer paketerad i ett modulärt, eller körbart,\n jar-arkiv main.help.opt.create.update.manifest=\ -m, --manifest=FILE Inkludera manifestinformationen från den angivna\n manifestfilen 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 06167a5b895..1f652d87029 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 @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. # 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,8 @@ error.write.file=写入现有的 jar 文件时出错 error.create.dir={0}: 无法创建目录 error.incorrect.length=处理时遇到不正确的长度: {0} error.create.tempfile=无法创建临时文件 +error.extract.multiple.dest.dir=不能与 '-x' 选项一起多次指定 '-C' 或 '--dir' 选项 +error.extract.pflag.not.allowed=不能与 '-C' 或 '--dir' 选项一起指定 '-Px' error.hash.dep=正在对模块 {0} 的被依赖对象执行散列处理, 在模块路径中找不到模块 {1} error.module.options.without.info=--module-version 或 --hash-modules 之一没有 module-info.class error.no.operative.descriptor=没有发行版的有效描述符: {0} @@ -83,6 +85,7 @@ warn.validator.concealed.public.class=警告: 条目 {0} 是已隐藏程序包 warn.release.unexpected.versioned.entry=意外的版本化条目 {0} warn.index.is.ignored=自 JDK 18 起,在运行时忽略 JAR 索引 (META-INF/INDEX.LIST) warn.flag.is.deprecated=警告:{0} 选项已过时,可能会在未来发行版中忽略或删除。\n +warn.option.is.ignored=警告:{0} 选项对于当前用法无效,将忽略它。 out.added.manifest=已添加清单 out.added.module-info=已添加 module-info: {0} out.automodule=找不到模块描述符。已派生自动模块。 @@ -94,10 +97,12 @@ out.deflated=(压缩了 {0}%) out.stored=(存储了 0%) out.create=\ 已创建: {0} out.extracted=已提取: {0} +out.kept=\ 已跳过:{0} 已存在 out.inflated=\ 已解压: {0} out.size=(输入 = {0}) (输出 = {1}) +out.extract.dir=提取到目录:{0} -usage.compat=兼容性接口:\n用法:jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files] ...\n选项:\n -c 创建新档案(包括缺少的父目录)\n -t 列出档案目录\n -x 从档案中提取指定的(或所有)文件\n -u 更新现有档案\n -v 在标准输出中生成详细输出\n -f 指定档案文件名\n -m 包含指定清单文件中的清单信息\n -e 为捆绑到可执行 jar 文件的独立应用程序\n 指定应用程序入口点\n -0 仅存储;不使用任何 ZIP 压缩\n -P 保留文件名中的前导 '/'(绝对路径)和 ".."(父目录)组成部分\n -M 不创建条目的清单文件\n -i 为指定的 jar 文件生成索引信息\n -C 更改为指定的目录并包含以下文件\n如果任何文件为目录,则对其进行递归处理。\n清单文件名、档案文件名和入口点名称的指定顺序\n与 'm', 'f' 和 'e' 标记的指定顺序相同。\n\n示例 1:将两个类文件归档到一个名为 classes.jar 的档案中:\n jar cvf classes.jar Foo.class Bar.class \n示例 2:使用现有的清单文件 'mymanifest' 并\n 将 foo/ 目录中的所有文件归档到 'classes.jar' 中:\n jar cvfm classes.jar mymanifest -C foo/。\n +usage.compat=兼容性接口:\n用法:jar {ctxui}[vfmn0PMe] [jar-file] [manifest-file] [entry-point] [-C dir] files] ...\n选项:\n -c 创建新档案(包括缺少的父目录)\n -t 列出档案目录\n -x 从档案中提取指定的(或所有)文件\n -u 更新现有档案\n -v 在标准输出中生成详细输出\n -f 指定档案文件名\n -m 包含指定清单文件中的清单信息\n -e 为捆绑到可执行 jar 文件的独立应用程序\n 指定应用程序入口点\n -0 仅存储;不使用任何 ZIP 压缩\n -P 保留文件名中的前导 '/'(绝对路径)和 ".."(父目录)组成部分\n -M 不创建条目的清单文件\n -i 为指定的 jar 文件生成索引信息\n -C 更改为指定的目录并包含以下文件\n如果任何文件为目录,则对其进行递归处理。\n在提取模式下使用时,将 jar 提取到指定目录\n清单文件名、档案文件名和入口点名称的指定顺序\n与 'm'、'f' 和 'e' 标记的指定顺序相同。\n\n示例 1:将两个类文件归档到一个名为 classes.jar 的档案中:\n jar cvf classes.jar Foo.class Bar.class \n示例 2:使用现有的清单文件 'mymanifest' 并\n 将 foo/ 目录中的所有文件归档到 'classes.jar' 中:\n jar cvfm classes.jar mymanifest -C foo/。\n main.usage.summary=用法: jar [OPTION...] [ [--release VERSION] [-C dir] files] ... main.usage.summary.try=尝试使用 `jar --help' 获取详细信息。 @@ -108,14 +113,13 @@ main.help.opt.main.create=\ -c, --create 创建档案。通过 -f main.help.opt.main.generate-index=\ -i, --generate-index=FILE 生成指定 jar 档案的索引信息。\n 此选项已过时,\n 可能会在未来发行版中删除。 main.help.opt.main.list=\ -t, --list 列出档案的目录 main.help.opt.main.update=\ -u, --update 更新现有 jar 档案 -main.help.opt.main.extract=\ -x, --extract 从档案中提取指定的 (或全部) 文件 +main.help.opt.main.extract=\ -x, --extract 从档案中提取指定的(或所有)文件。\n 如果某个同名的文件在档案中出现多次,\n 则将提取每个副本,除非指定 -k,否则\n 后面的副本将覆盖(替换)前面的副本。 main.help.opt.main.describe-module=\ -d, --describe-module 输出模块描述符或自动模块名称 main.help.opt.main.validate=\ --validate 验证 jar 档案的内容。此选项\n 将验证由多发行版 jar 档案导出\n 的 API 在所有不同的发行版本中\n 是否一致。 -main.help.opt.any=\ 在任意模式下有效的操作修饰符:\n\n -C DIR 更改为指定的目录并包含\n 以下文件 +main.help.opt.any=\ 在任意模式下有效的操作修饰符:\n\n -C DIR 更改为指定目录并包含\n 以下文件。在提取模式下使用时,\n 将 jar 提取到指定目录 main.help.opt.any.file=\ -f, --file=FILE 档案文件名。省略时, 基于操作\n 使用 stdin 或 stdout\n --release VERSION 将下面的所有文件都放在\n jar 的版本化目录中 (即 META-INF/versions/VERSION/) main.help.opt.any.verbose=\ -v, --verbose 在标准输出中生成详细输出 main.help.opt.create=\ 仅在创建模式下有效的操作修饰符:\n -main.help.opt.create.normalize=\ -n, --normalize 创建后在新的 jar 档案中\n 规范化信息。此选项已过时,\n 计划在未来的 JDK 发行版中删除 main.help.opt.create.update=\ 在创建和更新模式下有效的操作修饰符:\n main.help.opt.create.update.main-class=\ -e, --main-class=CLASSNAME 捆绑到模块化或可执行 \n jar 档案的独立应用程序\n 的应用程序入口点 main.help.opt.create.update.manifest=\ -m, --manifest=FILE 包含指定清单文件中的\n 清单信息 @@ -128,8 +132,12 @@ main.help.opt.create.update.warn-if-resolved=\ --warn-if-resolved 提 main.help.opt.create.update.index=\ 只在创建, 更新和生成索引模式下有效的操作修饰符:\n main.help.opt.create.update.index.no-compress=\ -0, --no-compress 仅存储; 不使用 ZIP 压缩 main.help.opt.create.update.index.date=\ --date=TIMESTAMP 具有可选时区的 ISO-8601 扩展偏移\n 日期时间格式的时间戳(用于条目的时间戳),\n 例如,"2022-02-12T12:30:00-05:00" +main.help.opt.extract=\ 仅在提取模式下有效的操作修饰符:\n +main.help.opt.extract.keep-old-files=\ -k, --keep-old-files 不覆盖现有文件。\n 如果目标目录中存在同名的 Jar 文件\n 条目,将不覆盖现有文件。\n 因此,如果某个文件在档案中出现多次,\n 后面的副本不会覆盖前面的副本。\n 另请注意,一些文件系统可能不区分大小写。 main.help.opt.other=\ 其他选项:\n main.help.opt.other.help=\ -?, -h, --help[:compat] 提供此帮助,也可以选择性地提供兼容性帮助 main.help.opt.other.help-extra=\ --help-extra 提供额外选项的帮助 main.help.opt.other.version=\ --version 输出程序版本 main.help.postopt=\ 如果模块描述符 'module-info.class' 位于指定目录的\n 根目录中, 或者位于 jar 档案本身的根目录中, 则\n 该档案是一个模块化 jar。以下操作只在创建模块化 jar,\n 或更新现有的非模块化 jar 时有效: '--module-version',\n '--hash-modules' 和 '--module-path'。\n\n 如果为长选项提供了必需参数或可选参数, 则它们对于\n 任何对应的短选项也是必需或可选的。 +main.help.opt.extract=\ 仅在提取模式下有效的操作修饰符:\n +main.help.opt.extract.dir=\ --dir jar 将提取到其中的目录 diff --git a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_TW.properties b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_TW.properties index d1251510bda..4dc23a09389 100644 --- a/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_TW.properties +++ b/src/jdk.jartool/share/classes/sun/tools/jar/resources/jar_zh_TW.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -106,7 +106,6 @@ main.help.opt.any=\ 可在任何模式下使用的作業修飾條件:\n\n -C DI main.help.opt.any.file=\ -f, --file=FILE 存檔檔案名稱。如果省略,會根據作業使用\n stdin 或 stdout\n --release VERSION 將所有下列檔案放置在 jar 的啟動多版本\n 功能目錄中 (例如 META-INF/versions/VERSION/) main.help.opt.any.verbose=\ -v, --verbose 在標準輸出中產生詳細輸出 main.help.opt.create=\ 只能在建立模式使用的作業修飾條件:\n -main.help.opt.create.normalize=\ -n, --normalize 建立新的 jar 存檔之後,將其中的資訊\n 標準化 main.help.opt.create.update=\ 只能在建立和更新模式下使用的作業修飾條件:\n main.help.opt.create.update.main-class=\ -e, --main-class=CLASSNAME 隨附於模組化或可執行\n jar 存檔中獨立應用程式的\n 應用程式進入點 main.help.opt.create.update.manifest=\ -m, --manifest=FILE 包含指定資訊清單檔案中的資訊清單\n 資訊 diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/StandardDoclet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/StandardDoclet.java index 69db8f0800c..8f5fec1e4b9 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/StandardDoclet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/doclet/StandardDoclet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java index 7efaec87692..15f55d18cc0 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractExecutableMemberWriter.java @@ -31,7 +31,6 @@ import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; -import javax.lang.model.element.TypeParameterElement; import javax.lang.model.element.VariableElement; import javax.lang.model.type.DeclaredType; import javax.lang.model.type.ExecutableType; @@ -43,7 +42,6 @@ import jdk.javadoc.internal.html.Content; import jdk.javadoc.internal.html.ContentBuilder; import jdk.javadoc.internal.html.Entity; -import jdk.javadoc.internal.html.HtmlTag; import jdk.javadoc.internal.html.HtmlTree; import jdk.javadoc.internal.html.Text; @@ -94,7 +92,6 @@ protected AbstractExecutableMemberWriter(SubWriterHolderWriter writer) { */ protected Content getTypeParameters(ExecutableElement member) { HtmlLinkInfo linkInfo = new HtmlLinkInfo(configuration, LINK_TYPE_PARAMS_AND_BOUNDS, member) - .addLineBreaksInTypeParameters(true) .showTypeParameterAnnotations(true); return writer.getTypeParameterLinks(linkInfo); } @@ -129,7 +126,15 @@ protected void addSummaryLink(HtmlLinkInfo.Kind context, TypeElement te, Element @Override protected void addInheritedSummaryLink(TypeElement te, Element member, Content target) { - target.add(writer.getDocLink(PLAIN, te, member, name(member))); + // Use method name as link label, but add signature as title attribute + String name = name(member); + ExecutableElement ee = (ExecutableElement) member; + String title = name + utils.makeSignature(ee, typeElement, false, true); + target.add(writer.getLink(new HtmlLinkInfo(configuration, PLAIN, te) + .label(name) + .fragment(htmlIds.forMember(ee).getFirst().name()) + .targetMember(member) + .title(title))); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java index 59a8f589230..4f2e17aa876 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractMemberWriter.java @@ -52,8 +52,8 @@ import jdk.javadoc.internal.html.Content; import jdk.javadoc.internal.html.ContentBuilder; import jdk.javadoc.internal.html.Entity; -import jdk.javadoc.internal.html.HtmlTag; import jdk.javadoc.internal.html.HtmlTree; +import jdk.javadoc.internal.html.Text; import static jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable.Kind.ANNOTATION_TYPE_MEMBER; import static jdk.javadoc.internal.doclets.toolkit.util.VisibleMemberTable.Kind.ANNOTATION_TYPE_MEMBER_OPTIONAL; @@ -717,4 +717,19 @@ protected Content getMemberListItem(Content memberContent) { return writer.getMemberListItem(memberContent); } + /** + * {@return a link to the member summary section of class or interface {@code element} indicated + * by {@code summaryKind} with the simple type name as link label, or the fully qualified type name + * if the class or interface is not linkable} + */ + protected Content getMemberSummaryLinkOrFQN(TypeElement element, VisibleMemberTable.Kind summaryKind) { + if (utils.isLinkable(element)) { + return writer.getLink((new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.PLAIN, element) + .label(utils.getSimpleName(element)) + .fragment(HtmlIds.forMemberSummary(summaryKind).name()))); + } else { + return Text.of(utils.getFullyQualifiedName(element)); + } + } + } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractOverviewIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractOverviewIndexWriter.java index c466a2fcb5a..12e6fbab469 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractOverviewIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractOverviewIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java index 915dbd7627a..a6f3ac7dd28 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AbstractTreeWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java index 68ee6d98857..ea0ea1f79fe 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java index 2c9539d3c30..b80be46aa24 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllPackagesIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java index d10478fb3ba..c2a63be654d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassUseWriter.java @@ -106,7 +106,6 @@ public ClassUseWriter(HtmlConfiguration configuration, pkgToPackageAnnotations = new TreeSet<>(comparators.classUseComparator()); pkgToPackageAnnotations.addAll(mapper.classToPackageAnnotations.get(typeElement)); } - configuration.currentTypeElement = typeElement; this.pkgSet = new TreeSet<>(comparators.packageComparator()); this.pkgToClassTypeParameter = pkgDivide(mapper.classToClassTypeParam); this.pkgToSubclassTypeParameter = pkgDivide(mapper.classToSubclassTypeParam); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriter.java index d934a9aab63..d56616dfc91 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ClassWriter.java @@ -94,7 +94,6 @@ public ClassWriter(HtmlConfiguration configuration, TypeElement typeElement, ClassTree classTree) { super(configuration, configuration.docPaths.forClass(typeElement)); this.typeElement = typeElement; - configuration.currentTypeElement = typeElement; this.classTree = classTree; pHelper = new PropertyUtils.PropertyHelper(configuration, typeElement); @@ -506,7 +505,7 @@ protected Content getClassInfo(Content classInfo) { } @Override - public TypeElement getCurrentPageElement() { + public TypeElement getCurrentTypeElement() { return typeElement; } @@ -740,16 +739,14 @@ private Content getClassLinks(HtmlLinkInfo.Kind context, Collection list) { } // TODO: should we simply split this method up to avoid instanceof ? if (type instanceof TypeElement te) { - Content link = getLink( - new HtmlLinkInfo(configuration, context, te)); - content.add(HtmlTree.CODE(link)); + content.add(getLink( + new HtmlLinkInfo(configuration, context, te))); } else { - Content link = getLink( - new HtmlLinkInfo(configuration, context, ((TypeMirror)type))); - content.add(HtmlTree.CODE(link)); + content.add(getLink( + new HtmlLinkInfo(configuration, context, ((TypeMirror)type)))); } } - return content; + return HtmlTree.CODE(content); } /** diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriter.java index 213078712eb..c71d62d57e4 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/FieldWriter.java @@ -230,8 +230,7 @@ protected Table createSummaryTable() { @Override public void addInheritedSummaryLabel(TypeElement typeElement, Content content) { - Content classLink = writer.getPreQualifiedClassLink( - HtmlLinkInfo.Kind.PLAIN, typeElement); + Content classLink = getMemberSummaryLinkOrFQN(typeElement, VisibleMemberTable.Kind.FIELDS); Content label; if (options.summarizeOverriddenMethods()) { label = Text.of(utils.isClass(typeElement) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java index ca20d065a1e..97c9e2669e0 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -104,11 +104,6 @@ public class HtmlConfiguration extends BaseConfiguration { */ public DocPath topFile = DocPath.empty; - /** - * The TypeElement for the class file getting generated. - */ - public TypeElement currentTypeElement = null; // Set this TypeElement in the ClassWriter. - /** * The collections of items for the main index. * This field is only initialized if {@code options.createIndex()} 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 3f20c7dfd76..c2b048b54e0 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 @@ -1024,11 +1024,10 @@ public String getEnclosingPackageName(TypeElement te) { } /** - * Return the main type element of the current page or null for pages that don't have one. - * - * @return the type element of the current page. + * {@return the type element documented by this writer if it is a {@code ClassWriter}, + * or null for any other kind of writer} */ - public TypeElement getCurrentPageElement() { + public TypeElement getCurrentTypeElement() { return null; } @@ -1912,7 +1911,7 @@ private boolean shouldRedirectRelativeLinks(Element element) { // Retrieve the element of this writer if it is a "primary" writer for an element. // Note: It would be nice to have getCurrentPageElement() return package and module elements // in their respective writers, but other uses of the method are only interested in TypeElements. - Element currentPageElement = getCurrentPageElement(); + Element currentPageElement = getCurrentTypeElement(); if (currentPageElement == null) { if (this instanceof PackageWriter packageWriter) { currentPageElement = packageWriter.packageElement; @@ -1951,7 +1950,7 @@ public Content invalidTagOutput(String summary, Optional detail) { */ private boolean inSamePackage(Element element) { Element currentPageElement = (this instanceof PackageWriter packageWriter) - ? packageWriter.packageElement : getCurrentPageElement(); + ? packageWriter.packageElement : getCurrentTypeElement(); return currentPageElement != null && !utils.isModule(element) && Objects.equals(utils.containingPackage(currentPageElement), utils.containingPackage(element)); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlLinkFactory.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlLinkFactory.java index 54da5af14a9..d404fdaab94 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlLinkFactory.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlLinkFactory.java @@ -236,20 +236,16 @@ public Content visitDeclared(DeclaredType type, HtmlLinkInfo linkInfo) { protected Content getClassLink(HtmlLinkInfo linkInfo) { BaseConfiguration configuration = m_writer.configuration; TypeElement typeElement = linkInfo.getTypeElement(); - // Create a tool tip if we are linking to a class or interface. Don't - // create one if we are linking to a member. - String title = ""; - String fragment = linkInfo.getFragment(); - boolean hasFragment = fragment != null && !fragment.isEmpty(); - if (!hasFragment) { - boolean isTypeLink = linkInfo.getType() != null && - utils.isTypeVariable(utils.getComponentType(linkInfo.getType())); - title = getClassToolTip(typeElement, isTypeLink); - if (isTypeLink) { - linkInfo.fragment(m_writer.configuration.htmlIds.forTypeParam( - utils.getTypeName(utils.getComponentType(linkInfo.getType()), false), - typeElement).name()); - } + // Create a tool tip if we are linking to a class or interface, or one of + // its summary sections. Don't create one if we are linking to a member. + boolean isPageOrSummaryLink = linkInfo.isPageOrSummaryLink(); + TypeMirror type = linkInfo.getType(); + if (type != null && utils.isTypeVariable(utils.getComponentType(type))) { + linkInfo.fragment(m_writer.configuration.htmlIds.forTypeParam( + utils.getTypeName(utils.getComponentType(type), false), typeElement).name()) + .title(getClassToolTip(typeElement, true)); + } else if (isPageOrSummaryLink) { + linkInfo.title(getClassToolTip(typeElement, false)); } Content label = linkInfo.getClassLinkLabel(configuration); if (linkInfo.getContext() == HtmlLinkInfo.Kind.SHOW_TYPE_PARAMS_IN_LABEL) { @@ -261,7 +257,7 @@ protected Content getClassLink(HtmlLinkInfo linkInfo) { Element previewTarget; ExecutableElement restrictedTarget; boolean showPreview = !linkInfo.isSkipPreview(); - if (!hasFragment && showPreview) { + if (isPageOrSummaryLink && showPreview) { flags = utils.elementFlags(typeElement); previewTarget = typeElement; restrictedTarget = null; @@ -274,7 +270,7 @@ protected Content getClassLink(HtmlLinkInfo linkInfo) { TypeElement enclosing = utils.getEnclosingTypeElement(linkInfo.getTargetMember()); Set enclosingFlags = utils.elementFlags(enclosing); if (flags.contains(ElementFlag.PREVIEW) && enclosingFlags.contains(ElementFlag.PREVIEW)) { - if (enclosing.equals(m_writer.getCurrentPageElement())) { + if (enclosing.equals(m_writer.getCurrentTypeElement())) { //skip the PREVIEW tag: flags = EnumSet.copyOf(flags); flags.remove(ElementFlag.PREVIEW); @@ -298,10 +294,10 @@ protected Content getClassLink(HtmlLinkInfo linkInfo) { if (utils.isIncluded(typeElement)) { if (configuration.isGeneratedDoc(typeElement) && !utils.hasHiddenTag(typeElement)) { DocPath fileName = getPath(linkInfo); - if (linkInfo.linkToSelf() || typeElement != m_writer.getCurrentPageElement()) { + if (linkInfo.linkToSelf() || typeElement != m_writer.getCurrentTypeElement()) { link.add(m_writer.links.createLink( fileName.fragment(linkInfo.getFragment()), - label, linkInfo.getStyle(), title)); + label, linkInfo.getStyle(), linkInfo.getTitle())); addSuperscript(link, flags, fileName, null, previewTarget, restrictedTarget); return link; } @@ -461,11 +457,12 @@ private HtmlLinkInfo getBoundsLinkInfo(HtmlLinkInfo linkInfo, TypeMirror bound) * Given a class, return the appropriate tool tip. * * @param typeElement the class to get the tool tip for. + * @param isTypeParamLink true if link target is a type parameter * @return the tool tip for the appropriate class. */ - private String getClassToolTip(TypeElement typeElement, boolean isTypeLink) { + private String getClassToolTip(TypeElement typeElement, boolean isTypeParamLink) { Resources resources = m_writer.configuration.getDocResources(); - if (isTypeLink) { + if (isTypeParamLink) { return resources.getText("doclet.Href_Type_Param_Title", utils.getSimpleName(typeElement)); } else if (utils.isPlainInterface(typeElement)){ diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlLinkInfo.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlLinkInfo.java index 0b7be8fe656..9b568673191 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlLinkInfo.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlLinkInfo.java @@ -31,7 +31,6 @@ import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeMirror; -import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyles; import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; import jdk.javadoc.internal.doclets.toolkit.util.Utils; import jdk.javadoc.internal.html.Content; @@ -110,6 +109,9 @@ public enum Kind { // The label for the link. private Content label; + // The title attribute for the link + private String title; + // True if we should print the type bounds for the type parameter. private boolean showTypeBounds = true; @@ -123,9 +125,6 @@ public enum Kind { // True iff the preview flags should be skipped for this link. private boolean skipPreview; - // True if type parameters should be separated by hard line breaks. - private boolean addLineBreaksInTypeParameters = false; - // True if additional tags should be added to type parameters private boolean addLineBreakOpportunitiesInTypeParameters = false; @@ -183,7 +182,6 @@ public HtmlLinkInfo forType(TypeMirror type) { linkInfo.showTypeBounds = showTypeBounds; linkInfo.linkTypeParameters = linkTypeParameters; linkInfo.linkToSelf = linkToSelf; - linkInfo.addLineBreaksInTypeParameters = addLineBreaksInTypeParameters; linkInfo.showTypeParameterAnnotations = showTypeParameterAnnotations; linkInfo.skipPreview = skipPreview; return linkInfo; @@ -264,6 +262,23 @@ public HtmlStyle getStyle() { return style; } + /** + * Sets the title attribute for the link. + * @param title the value of the title attribute + * @return this object + */ + public HtmlLinkInfo title(String title) { + this.title = title; + return this; + } + + /** + * {@return the value of the title attribute} + */ + public String getTitle() { + return title; + } + /** * Set whether or not this is a link to a varargs parameter. * @param varargs the new value @@ -299,20 +314,10 @@ public String getFragment() { } /** - * Sets the addLineBreaksInTypeParameters flag for this link. - * @param addLineBreaksInTypeParameters the new value - * @return this object - */ - public HtmlLinkInfo addLineBreaksInTypeParameters(boolean addLineBreaksInTypeParameters) { - this.addLineBreaksInTypeParameters = addLineBreaksInTypeParameters; - return this; - } - - /** - * {@return true if type parameters should be separated by line breaks} + * {@return {@code true} if the link target is the top level page or one of its summary sections} */ - public boolean addLineBreaksInTypeParameters() { - return addLineBreaksInTypeParameters; + public boolean isPageOrSummaryLink() { + return fragment == null || fragment.isEmpty() || fragment.endsWith("-summary"); } /** @@ -506,7 +511,6 @@ public String toString() { ", showTypeBounds=" + showTypeBounds + ", linkTypeParameters=" + linkTypeParameters + ", linkToSelf=" + linkToSelf + - ", addLineBreaksInTypeParameters=" + addLineBreaksInTypeParameters + ", showTypeParameterAnnotations=" + showTypeParameterAnnotations + ", context=" + context + ", fragment=" + fragment + diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java index a7afd9db85d..2ad39dbf94c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MarkerComments.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MarkerComments.java index 78696cc320e..fac6ed76e48 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MarkerComments.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MarkerComments.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriter.java index 9325bc07a6d..1f3cfe26801 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/MethodWriter.java @@ -306,8 +306,7 @@ protected Table createSummaryTable() { @Override public void addInheritedSummaryLabel(TypeElement typeElement, Content content) { - Content classLink = writer.getPreQualifiedClassLink( - HtmlLinkInfo.Kind.PLAIN, typeElement); + Content classLink = getMemberSummaryLinkOrFQN(typeElement, VisibleMemberTable.Kind.METHODS); Content label; if (options.summarizeOverriddenMethods()) { label = Text.of(utils.isClass(typeElement) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java index 86e81b77ddd..25f6a46b1ef 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ModuleIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriter.java index 12d4dcbd663..8368172430e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NestedClassWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -105,7 +105,7 @@ protected Table createSummaryTable() { @Override public void addInheritedSummaryLabel(TypeElement typeElement, Content content) { - Content classLink = writer.getPreQualifiedClassLink(HtmlLinkInfo.Kind.PLAIN, typeElement); + Content classLink = getMemberSummaryLinkOrFQN(typeElement, VisibleMemberTable.Kind.NESTED_CLASSES); Content label; if (options.summarizeOverriddenMethods()) { label = Text.of(utils.isPlainInterface(typeElement) @@ -135,7 +135,7 @@ protected void addSummaryLink(HtmlLinkInfo.Kind context, TypeElement typeElement @Override protected void addInheritedSummaryLink(TypeElement typeElement, Element member, Content target) { target.add( - writer.getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.LINK_TYPE_PARAMS_AND_BOUNDS, + writer.getLink(new HtmlLinkInfo(configuration, HtmlLinkInfo.Kind.SHOW_TYPE_PARAMS, (TypeElement)member))); } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java index fd257fc06f4..375bfd27609 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriter.java index 7365b9b3b8f..294923f43a1 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PropertyWriter.java @@ -259,8 +259,7 @@ protected Table createSummaryTable() { @Override public void addInheritedSummaryLabel(TypeElement typeElement, Content content) { - Content classLink = writer.getPreQualifiedClassLink( - HtmlLinkInfo.Kind.PLAIN, typeElement); + Content classLink = getMemberSummaryLinkOrFQN(typeElement, VisibleMemberTable.Kind.PROPERTIES); Content label; if (options.summarizeOverriddenMethods()) { label = Text.of(utils.isClass(typeElement) diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/RestrictedListWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/RestrictedListWriter.java index ec629a227a3..8f78027bed2 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/RestrictedListWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/RestrictedListWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerialFieldWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerialFieldWriter.java index ef9810f7374..7de92d08214 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerialFieldWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerialFieldWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerialMethodWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerialMethodWriter.java index 4ce7d662abb..62758bf3f07 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerialMethodWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerialMethodWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriter.java index 09fa5ed347c..118f6efd0d6 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SerializedFormWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java index aa20fc8c9ae..68d2bc8b4d0 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java index 0e09920b7b1..6ba40145e8f 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TableHeader.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TableHeader.java index e1c42062c21..52ca845d26e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TableHeader.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TableHeader.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java index 8af3b7016ce..124fbce3c7f 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/TreeWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactory.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactory.java index d656fe35293..2b2a1232137 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactory.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/WriterFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocument.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocument.java index 051cbfd0042..a7181ac7f67 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocument.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlDocument.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/package-info.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/package-info.java index efad5fc0fe9..aa5873098f6 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/package-info.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it 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 c444f387a65..b4d3f94bad5 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 @@ -135,6 +135,9 @@ doclet.Preview_Label=Vorschau doclet.Preview_Mark=PREVIEW doclet.Restricted_Methods=Eingeschränkte Methoden doclet.Restricted_Mark=RESTRICTED +doclet.searchTag=Suchtag +doclet.searchTags=Tags suchen +doclet.searchTagsSummary=Übersicht über Suchtags doclet.Terminally_Deprecated=Endgültig veraltet doclet.Terminally_Deprecated_Elements=Endgültig veraltete Elemente doclet.Terminally_Deprecated_In_Release=Endgültig veraltet in {0} @@ -169,6 +172,7 @@ doclet.Interfaces=Schnittstellen doclet.Enclosing_Class=Umschließende Klasse: doclet.Enclosing_Interface=Umschließende Schnittstelle: doclet.Inheritance_Tree=Vererbungsbaum +doclet.DefinedIn=Definiert in doclet.ReferencedIn=Referenziert in doclet.Section=Abschnitt doclet.External_Specification=Externe Spezifikation @@ -256,6 +260,8 @@ doclet.help.all_packages.body=Die Seite {0} enthält einen alphabetischen Index doclet.help.serial_form.body=Jede serialisierbare oder externalisierbare Klasse verfügt über eine Beschreibung der zugehörigen Serialisierungsfelder und -methoden. Diese Informationen sind eher für Implementierer als für Benutzer der API von Interesse. Die Navigationsleiste enthält zwar keinen Link, Sie können diese Informationen jedoch abrufen, indem Sie zu einer beliebigen serialisierten Klasse navigieren und im Abschnitt "Siehe auch" der Klassenbeschreibung auf "Serialisierte Form" klicken. # 0: link to Constant Values page doclet.help.constants.body=Auf der Seite {0} sind die statischen endgültigen Felder und deren Werte aufgeführt. +# 0: link to Search Tags page +doclet.help.searchTags.body=Auf der Seite "{0}" werden die in der Dokumentation definierten Suchtags aufgelistet. # 0: link to System Properties page doclet.help.systemProperties.body=Die Seite {0} listet Referenzen auf Systemeigenschaften auf. # 0: link to External Specifications page @@ -323,7 +329,9 @@ doclet.ReflectivePreviewAPI={0} bezieht sich auf mindestens eine reflektive Vors doclet.UsesDeclaredUsingPreview={0} bezieht sich auf mindestens einen Typ, der mit einem Vorschaufeature der Programmiersprache Java deklariert wird: {1}. doclet.PreviewTrailingNote1=Programme können {0} nur verwenden, wenn Vorschaufeatures aktiviert sind. doclet.PreviewTrailingNote2=Vorschaufeatures können in künftigen Releases entfernt oder zu permanenten Features der Java-Plattform hochgestuft werden. -doclet.RestrictedLeadingNote={0} ist eine eingeschränkte Methode der Java-Plattform. +doclet.PreviewJavaSERequiresTransitiveJavaBase=Indirekte Exporte aus dem Modul java.base sind mit der Direktive requires transitive java.base verknüpft. Das ist ein Vorschaufeature der Java-Sprache.
    Programme können requires transitive java.base nur verwenden, wenn Vorschaufeatures aktiviert sind.
    Vorschaufeatures können in einem zukünftigen Release entfernt oder zu permanenten Features der Java-Plattform hochgestuft werden.
    +doclet.RestrictedMethod=eingeschränkte Methode +doclet.RestrictedLeadingNote={0} ist eine {1} der Java-Plattform. doclet.RestrictedTrailingNote1=Programme können {0} nur verwenden, wenn der Zugriff auf eingeschränkte Methoden aktiviert ist. doclet.RestrictedTrailingNote2=Eingeschränkte Methoden sind nicht sicher und können bei falscher Verwendung die JVM zum Absturz bringen oder zu einer Beschädigung des Arbeitsspeichers führen. doclet.Declared_Using_Preview.SEALED=Verschlüsselte Klassen @@ -362,7 +370,7 @@ doclet.usage.version.description=@version-Absätze aufnehmen doclet.usage.author.description=@author-Absätze aufnehmen -doclet.usage.docfilessubdirs.description=doc-file-Unterverzeichnisse rekursiv kopieren +doclet.usage.docfilessubdirs.description=Ermöglicht Deep Copying von "doc-files"-Verzeichnissen. Unterverzeichnisse und alle\nInhalte werden rekursiv in das Ziel kopiert doclet.usage.splitindex.description=Index in eine Datei pro Buchstabe aufteilen @@ -384,7 +392,7 @@ doclet.usage.header.description=Headertext für jede Seite aufnehmen doclet.usage.html5.description=Generiert eine HTML 5-Ausgabe. Diese Option wird nicht mehr benötigt. doclet.usage.footer.parameters= -doclet.usage.footer.description=Footertext für jede Seite aufnehmen +doclet.usage.footer.description=Diese Option wird nicht mehr unterstützt und gibt eine Warnung aus doclet.usage.top.parameters= doclet.usage.top.description=Oberen Text für jede Seite aufnehmen @@ -406,7 +414,7 @@ doclet.usage.link-platform-properties.parameters=< URL> doclet.usage.link-platform-properties.description=Link zu Plattformdokumentations-URLs, die in der Eigenschaftendatei auf deklariert sind doclet.usage.excludedocfilessubdir.parameters=,,... -doclet.usage.excludedocfilessubdir.description=doc-files-Unterverzeichnisse mit angegebenem Namen ausschließen.\n":" kann überall im Argument als Trennzeichen verwendet werden. +doclet.usage.excludedocfilessubdir.description=Schließen Sie alle "doc-files"-Unterverzeichnisse mit einem angegebenen Namen aus.\n":" kann überall im Argument als Trennzeichen verwendet werden. doclet.usage.group.parameters= ,... doclet.usage.group.description=Angegebene Elemente auf Überblickseite gruppieren.\n":" kann überall im Argument als Trennzeichen verwendet werden. @@ -443,7 +451,7 @@ doclet.usage.nonavbar.description=Navigationsleiste nicht generieren doclet.usage.nooverview.description=Überblickseiten nicht generieren -doclet.usage.serialwarn.description=Warnung wegen @serial-Tag generieren +doclet.usage.serialwarn.description=Gibt Warnungen zur Kompilierzeit für fehlende "@serial"-Tags aus doclet.usage.since.parameters=(,)* doclet.usage.since.description=Dokumentiert die neue und die veraltete API in den angegebenen Releases @@ -452,7 +460,7 @@ doclet.usage.since-label.parameters= doclet.usage.since-label.description=Liefert Text für die Überschrift der Seite "Neue API" doclet.usage.tag.parameters=::
    -doclet.usage.tag.description=Benutzerdefinierte Tags mit einem Argument angeben +doclet.usage.tag.description=Gibt ein benutzerdefiniertes Tag mit einem einzelnen Argument an doclet.usage.taglet.description=Vollqualifizierter Name des zu registrierenden Taglets @@ -468,7 +476,7 @@ doclet.usage.charset.description=Zeichensatz für plattformübergreifende Anzeig doclet.usage.javafx.description=Aktiviert die JavaFX-Funktionalität doclet.usage.helpfile.parameters= -doclet.usage.helpfile.description=Datei aufnehmen, zu der der Hilfelink verlinkt +doclet.usage.helpfile.description=Gibt eine Datei an, die den Text enthält, der beim Klicken auf den\nHilfelink in der Navigationsleiste angezeigt wird doclet.usage.linksource.description=Quelle in HTML generieren @@ -491,7 +499,7 @@ doclet.usage.override-methods.parameters=(detail|summary) doclet.usage.override-methods.description=Außer Kraft gesetzte Methoden im Abschnitt "detail" oder "summary" dokumentieren.\nDer Standardwert ist "detail". -doclet.usage.allow-script-in-comments.description=JavaScript in Optionen und Kommentaren zulassen +doclet.usage.allow-script-in-comments.description=JavaScript in Dokumentationskommentaren und Optionen\nzulassen, die HTML-Code enthalten doclet.usage.xdocrootparent.parameters=< URL> doclet.usage.xdocrootparent.description=Ersetzt alle Vorkommen von @docRoot gefolgt von /.. in doc-Kommentaren durch\n 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 ce56bc16325..31e745301b6 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 @@ -135,6 +135,9 @@ doclet.Preview_Label=プレビュー doclet.Preview_Mark=PREVIEW doclet.Restricted_Methods=制限されたメソッド doclet.Restricted_Mark=RESTRICTED +doclet.searchTag=検索タグ +doclet.searchTags=タグの検索 +doclet.searchTagsSummary=検索タグ・サマリー doclet.Terminally_Deprecated=最終的に非推奨 doclet.Terminally_Deprecated_Elements=最終的に非推奨になった要素 doclet.Terminally_Deprecated_In_Release={0}で最終的に非推奨 @@ -169,6 +172,7 @@ doclet.Interfaces=インタフェース doclet.Enclosing_Class=含まれているクラス: doclet.Enclosing_Interface=含まれているインタフェース: doclet.Inheritance_Tree=継承ツリー +doclet.DefinedIn=定義先 doclet.ReferencedIn=参照 doclet.Section=セクション doclet.External_Specification=外部仕様 @@ -256,6 +260,8 @@ doclet.help.all_packages.body={0}ページには、ドキュメントに含ま doclet.help.serial_form.body=直列化可能または外部化可能な各クラスは、直列化フィールドとメソッドの説明を含みます。この情報は、APIを使用するのではなく、実装するユーザーに役立ちます。ナビゲーション・バーにリンクがない場合、直列化されたクラスに移動して、クラス記述の「関連項目」セクションにある「直列化された形式」をクリックすることにより、この情報を表示できます。 # 0: link to Constant Values page doclet.help.constants.body={0}ページには、static finalフィールドとその値のリストがあります。 +# 0: link to Search Tags page +doclet.help.searchTags.body={0}ページには、ドキュメントに定義されている検索タグがあります。 # 0: link to System Properties page doclet.help.systemProperties.body={0}ページには、システム・プロパティへの参照のリストがあります。 # 0: link to External Specifications page @@ -323,7 +329,9 @@ doclet.ReflectivePreviewAPI={0}は1つ以上のリフレクティブ・プレビ doclet.UsesDeclaredUsingPreview={0}は、Java言語のプレビュー機能を使用して宣言されている、1つ以上のタイプを参照しています: {1}。 doclet.PreviewTrailingNote1=プログラムは、プレビュー機能が有効になっている場合にのみ{0}を使用できます。 doclet.PreviewTrailingNote2=プレビュー機能は将来のリリースで削除されるか、Javaプラットフォームの永続的な機能にアップグレードされる可能性があります。 -doclet.RestrictedLeadingNote={0}はJavaプラットフォームの制限されたメソッドです。 +doclet.PreviewJavaSERequiresTransitiveJavaBase=java.baseモジュールからの間接的エクスポートは、Java言語のプレビュー機能であるrequires transitive java.baseディレクティブに関連付けられています。
    プログラムは、プレビュー機能が有効になっている場合にのみrequires transitive java.baseを使用できます。
    プレビュー機能は将来のリリースで削除されるか、Javaプラットフォームの永続的な機能にアップグレードされる可能性があります。
    +doclet.RestrictedMethod=制限されたメソッド +doclet.RestrictedLeadingNote={0}は、Javaプラットフォームの{1}です。 doclet.RestrictedTrailingNote1=プログラムは、制限されたメソッドへのアクセスが有効になっている場合にのみ{0}を使用できます。 doclet.RestrictedTrailingNote2=制限されたメソッドは安全ではありません。不適切に使用した場合、JVMがクラッシュまたはメモリーが破損する場合があります。 doclet.Declared_Using_Preview.SEALED=シール・クラス @@ -362,7 +370,7 @@ doclet.usage.version.description=@versionパラグラフを含めます doclet.usage.author.description=@authorパラグラフを含めます -doclet.usage.docfilessubdirs.description=doc-fileサブディレクトリを再帰的にコピーします +doclet.usage.docfilessubdirs.description='doc-files'ディレクトリのディープ・コピーを有効にします。\n宛先には、サブディレクトリとそのすべて内容が再帰的にコピーされます doclet.usage.splitindex.description=1字ごとに1ファイルに索引を分割します @@ -384,7 +392,7 @@ doclet.usage.header.description=各ページにヘッダー・テキストを含 doclet.usage.html5.description=HTML 5出力を生成します。このオプションは必須ではなくなりました。 doclet.usage.footer.parameters= -doclet.usage.footer.description=各ページにフッター・テキストを含めます +doclet.usage.footer.description=このオプションはされなくなったため、警告が報告されます doclet.usage.top.parameters= doclet.usage.top.description=各ページに上部テキストを含めます @@ -406,7 +414,7 @@ doclet.usage.link-platform-properties.parameters= doclet.usage.link-platform-properties.description=にあるプロパティ・ファイルで宣言されているプラットフォーム・ドキュメントのURLにリンクします doclet.usage.excludedocfilessubdir.parameters=,,... -doclet.usage.excludedocfilessubdir.description=指定された名前のdoc-filesサブディレクトリをすべて除外します。\n':'も、セパレータとして引数の任意の場所に使用できます。 +doclet.usage.excludedocfilessubdir.description=指定された名前の'doc-files'サブディレクトリをすべて除外します。\n':'も、セパレータとして引数の任意の場所に使用できます。 doclet.usage.group.parameters= ,... doclet.usage.group.description=指定する要素を概要ページにおいてグループ化します。\n':'も、セパレータとして引数の任意の場所に使用できます。 @@ -443,7 +451,7 @@ doclet.usage.nonavbar.description=ナビゲーション・バーを生成しま doclet.usage.nooverview.description=概要ページを生成しません -doclet.usage.serialwarn.description=@serialタグに関する警告を生成しません +doclet.usage.serialwarn.description='@serial'タグがない場合は、コンパイル時に警告を報告します doclet.usage.since.parameters=(,)* doclet.usage.since.description=指定されたリリースの新規および非推奨のAPIをドキュメント化します @@ -468,7 +476,7 @@ doclet.usage.charset.description=生成されるドキュメントのクロス doclet.usage.javafx.description=JavaFX機能を有効にします doclet.usage.helpfile.parameters= -doclet.usage.helpfile.description=ヘルプ・リンクのリンク先ファイルを含めます +doclet.usage.helpfile.description=ナビゲーション・バー内のヘルプ・リンクがクリックされたときに表示される\nテキストを含むファイルを指定します doclet.usage.linksource.description=HTML形式でソースを生成します @@ -491,7 +499,7 @@ doclet.usage.override-methods.parameters=(詳細|要約) doclet.usage.override-methods.description=オーバーライドされたメソッドを詳細または要約セクションでドキュメント化します。\nデフォルトは詳細です。 -doclet.usage.allow-script-in-comments.description=オプションおよびコメントでJavaScriptを許可します +doclet.usage.allow-script-in-comments.description=ドキュメント・コメント、および値がhtml-codeであるオプションで\nJavaScriptを許可します doclet.usage.xdocrootparent.parameters= doclet.usage.xdocrootparent.description=docコメント内の/..が後に続く@docRootのすべてをで置換します 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 c109d4c4237..36e27355b63 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 @@ -135,6 +135,9 @@ doclet.Preview_Label=预览 doclet.Preview_Mark=PREVIEW doclet.Restricted_Methods=受限制的方法 doclet.Restricted_Mark=RESTRICTED +doclet.searchTag=搜索标记 +doclet.searchTags=搜索标记 +doclet.searchTagsSummary=搜索标记概要 doclet.Terminally_Deprecated=最终已过时 doclet.Terminally_Deprecated_Elements=最终已过时的元素 doclet.Terminally_Deprecated_In_Release=最终在 {0} 中已过时 @@ -169,6 +172,7 @@ doclet.Interfaces=接口 doclet.Enclosing_Class=封闭类: doclet.Enclosing_Interface=封闭接口: doclet.Inheritance_Tree=继承树 +doclet.DefinedIn=定义位置 doclet.ReferencedIn=参考位置 doclet.Section=节 doclet.External_Specification=外部规范 @@ -256,6 +260,8 @@ doclet.help.all_packages.body={0} 包含文档中所有程序包的按字母顺 doclet.help.serial_form.body=每个可序列化或可外部化的类都有其序列化字段和方法的说明。此信息对实施(而非使用)API 的人员有用。尽管导航栏中没有链接,但您可以通过下列方式获取此信息:转至任何序列化类,然后单击类说明的“另请参阅”部分中的“序列化形式”。 # 0: link to Constant Values page doclet.help.constants.body={0}页面列出了静态最终字段及其值。 +# 0: link to Search Tags page +doclet.help.searchTags.body={0} 页面列出了文档中定义的搜索标记。 # 0: link to System Properties page doclet.help.systemProperties.body={0} 页面列出了对系统属性的引用。 # 0: link to External Specifications page @@ -323,7 +329,9 @@ doclet.ReflectivePreviewAPI={0} 引用一个或多个反射预览 API:{1}。 doclet.UsesDeclaredUsingPreview={0} 引用一个或多个类型,这些类型是使用 Java 语言 {1} 的预览功能声明的。 doclet.PreviewTrailingNote1=只有在启用了预览功能时,程序才能使用 {0}。 doclet.PreviewTrailingNote2=预览功能可能会在未来发行版中删除,也可能会升级为 Java 平台的永久功能。 -doclet.RestrictedLeadingNote={0} 是 Java 平台的受限制方法。 +doclet.PreviewJavaSERequiresTransitiveJavaBase=来自 java.base 模块的间接导出项与 requires transitive java.base 指令关联,这是 Java 语言的预览功能。
    仅在启用了预览功能时,程序才能使用 requires transitive java.base
    预览功能可能会在未来发行版中删除,也可能会升级为 Java 平台的永久功能。
    +doclet.RestrictedMethod=受限制方法 +doclet.RestrictedLeadingNote={0} 是 Java 平台的 {1}。 doclet.RestrictedTrailingNote1=只有在启用了对受限制方法的访问时,程序才能使用 {0}。 doclet.RestrictedTrailingNote2=受限制的方法不安全,如果使用不当,可能会导致 JVM 崩溃或内存损坏。 doclet.Declared_Using_Preview.SEALED=密封类 @@ -362,7 +370,7 @@ doclet.usage.version.description=包含 @version 段 doclet.usage.author.description=包含 @author 段 -doclet.usage.docfilessubdirs.description=递归复制文档文件子目录 +doclet.usage.docfilessubdirs.description=启用对 'doc-files' 目录的深层复制。\n子目录和所有内容将递归复制到目标 doclet.usage.splitindex.description=将索引分为每个字母对应一个文件 @@ -384,7 +392,7 @@ doclet.usage.header.description=包含每个页面的页眉文本 doclet.usage.html5.description=生成 HTML 5 输出。此选项不再是必需的。 doclet.usage.footer.parameters= -doclet.usage.footer.description=包含每个页面的页脚文本 +doclet.usage.footer.description=此选项不再受支持,并会报告警告 doclet.usage.top.parameters= doclet.usage.top.description=包含每个页面的顶部文本 @@ -406,7 +414,7 @@ doclet.usage.link-platform-properties.parameters= doclet.usage.link-platform-properties.description=链接到位于 的属性文件中声明的平台文档 URL doclet.usage.excludedocfilessubdir.parameters=,,... -doclet.usage.excludedocfilessubdir.description=排除包含给定名称的所有 doc-files 子目录。\n还可以将 ':' 作为分隔符用于参数中的任何位置。 +doclet.usage.excludedocfilessubdir.description=排除包含给定名称的所有 'doc-files' 子目录。\n还可以将 ':' 作为分隔符用于参数中的任何位置。 doclet.usage.group.parameters= ,... doclet.usage.group.description=在概览页面上将指定元素归到一组。\n还可以将 ':' 作为分隔符用于参数中的任何位置。 @@ -443,7 +451,7 @@ doclet.usage.nonavbar.description=不生成导航栏 doclet.usage.nooverview.description=不生成概览页面 -doclet.usage.serialwarn.description=生成有关 @serial 标记的警告 +doclet.usage.serialwarn.description=针对缺少 '@serial' 标记,报告编译时警告 doclet.usage.since.parameters=(,)* doclet.usage.since.description=记录所指定发行版中新增和已过时的 API @@ -452,7 +460,7 @@ doclet.usage.since-label.parameters= doclet.usage.since-label.description=提供要在“新增 API”页的标题中使用的文本 doclet.usage.tag.parameters=::
    -doclet.usage.tag.description=指定单个参数定制标记 +doclet.usage.tag.description=使用单个参数指定定制标记 doclet.usage.taglet.description=要注册的 Taglet 的全限定名称 @@ -468,7 +476,7 @@ doclet.usage.charset.description=用于跨平台查看生成的文档的字符 doclet.usage.javafx.description=启用 JavaFX 功能 doclet.usage.helpfile.parameters= -doclet.usage.helpfile.description=包含帮助链接所链接到的文件 +doclet.usage.helpfile.description=指定一个文件,其中包含在单击导航栏中的\n帮助链接时将显示的文本 doclet.usage.linksource.description=以 HTML 格式生成源文件 @@ -491,7 +499,7 @@ doclet.usage.override-methods.parameters=(detail|summary) doclet.usage.override-methods.description=在详细信息部分或概要部分中记录被覆盖的方法。\n默认值为 'detail'。 -doclet.usage.allow-script-in-comments.description=允许在选项和注释中使用 JavaScript +doclet.usage.allow-script-in-comments.description=允许在文档注释和选项中使用 JavaScript\n其值为 html-code doclet.usage.xdocrootparent.parameters= doclet.usage.xdocrootparent.description=将文档注释中出现的所有后跟 /.. 的 @docRoot 替换为\n diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/BaseTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/BaseTaglet.java index 7b0a4329ee1..dd22274f313 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/BaseTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/BaseTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/DeprecatedTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/DeprecatedTaglet.java index fa30589e59d..dc7a30d8643 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/DeprecatedTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/DeprecatedTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/DocRootTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/DocRootTaglet.java index d4050f6e0ec..f2a62cb83c1 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/DocRootTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/DocRootTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/IndexTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/IndexTaglet.java index 6f5077bb32c..1ce2384067c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/IndexTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/IndexTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/InheritDocTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/InheritDocTaglet.java index 4ba730cca9c..7f8fd7ff741 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/InheritDocTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/InheritDocTaglet.java @@ -133,7 +133,7 @@ private Content retrieveInheritedDocumentation(TagletWriter writer, } } catch (DocFinder.NoOverriddenMethodFound e) { String signature = utils.getSimpleName(method) - + utils.flatSignature(method, writer.getCurrentPageElement()); + + utils.flatSignature(method, writer.getCurrentTypeElement()); messages.warning(method, "doclet.noInheritedDoc", signature); } return replacement; @@ -157,7 +157,7 @@ private Content retrieveInheritedDocumentation(TagletWriter writer, } } else { String signature = utils.getSimpleName(method) - + utils.flatSignature(method, writer.getCurrentPageElement()); + + utils.flatSignature(method, writer.getCurrentTypeElement()); messages.warning(method, "doclet.noInheritedDoc", signature); } return replacement; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.java index 69cabd5427d..1f34a466f0d 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LinkTaglet.java @@ -264,7 +264,7 @@ Content linkSeeReferenceOutput(Element holder, } } String refMemName = refFragment; - if (config.currentTypeElement != containing) { + if (htmlWriter.getCurrentTypeElement() != containing) { refMemName = (utils.isConstructor(refMem)) ? refMemName : utils.getSimpleName(containing) + "." + refMemName; diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LiteralTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LiteralTaglet.java index c0543026f23..42f5fe3b810 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LiteralTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/LiteralTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/ReturnTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/ReturnTaglet.java index b9572afb9bc..994d45b8914 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/ReturnTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/ReturnTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -94,7 +94,7 @@ public Content getAllBlockTagOutput(Element holder, TagletWriter tagletWriter) { List tags = utils.getReturnTrees(holder); // make sure we are not using @return on a method with the void return type - TypeMirror returnType = utils.getReturnType(tagletWriter.getCurrentPageElement(), method); + TypeMirror returnType = utils.getReturnType(tagletWriter.getCurrentTypeElement(), method); if (returnType != null && utils.isVoid(returnType)) { if (!tags.isEmpty() && !config.isDocLintReferenceGroupEnabled()) { messages.warning(holder, "doclet.Return_tag_on_void_method"); diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SummaryTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SummaryTaglet.java index 7912abef0c6..d1f2cbdcf64 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SummaryTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SummaryTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SystemPropertyTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SystemPropertyTaglet.java index 4cab9d90ce0..cac058aabdc 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SystemPropertyTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/SystemPropertyTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/Taglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/Taglet.java index c1c6a56e5cb..a5a565b4da9 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/Taglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/Taglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/TagletWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/TagletWriter.java index 7b6c7060a6f..e0712e2f771 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/TagletWriter.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/TagletWriter.java @@ -201,12 +201,10 @@ public Content invalidTagOutput(String summary, Optional detail) { } /** - * Returns the main type element of the current page or null for pages that don't have one. - * - * @return the type element of the current page or null. + * {@return the type element documented by the current {@code HtmlDocletWriter} (may be null)} */ - public TypeElement getCurrentPageElement() { - return htmlWriter.getCurrentPageElement(); + public TypeElement getCurrentTypeElement() { + return htmlWriter.getCurrentTypeElement(); } /** @@ -411,7 +409,7 @@ public String visitType(TypeElement e, Void p) { public String visitExecutable(ExecutableElement e, Void p) { return utils.getFullyQualifiedName(utils.getEnclosingTypeElement(e)) + "." + utils.getSimpleName(e) - + utils.flatSignature(e, htmlWriter.getCurrentPageElement()); + + utils.flatSignature(e, htmlWriter.getCurrentTypeElement()); } @Override @@ -476,11 +474,11 @@ private boolean isLongOrHasComma(Content c) { // Test if element is the same as or belongs to the current page element private boolean isDifferentTypeElement(Element element) { if (element.getKind().isDeclaredType()) { - return element != getCurrentPageElement(); + return element != getCurrentTypeElement(); } else if (element.getKind() == ElementKind.OTHER) { return false; } else { - return utils.getEnclosingTypeElement(element) != getCurrentPageElement(); + return utils.getEnclosingTypeElement(element) != getCurrentTypeElement(); } } } diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/ThrowsTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/ThrowsTaglet.java index ca4a8c939ab..8c60903d48c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/ThrowsTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/ThrowsTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -211,7 +211,7 @@ public Content getAllBlockTagOutput(Element holder, TagletWriter tagletWriter) { // since {@inheritDoc} in @throws is processed by ThrowsTaglet (this taglet) rather than // InheritDocTaglet, we have to duplicate some of the behavior of the latter taglet String signature = utils.getSimpleName(holder) - + utils.flatSignature((ExecutableElement) holder, tagletWriter.getCurrentPageElement()); + + utils.flatSignature((ExecutableElement) holder, tagletWriter.getCurrentTypeElement()); messages.warning(holder, "doclet.noInheritedDoc", signature); } return tagletWriter.getOutputInstance(); // TODO: consider invalid rather than empty output @@ -235,7 +235,7 @@ private Content getAllBlockTagOutput0(Element holder) } var executable = (ExecutableElement) holder; ExecutableType instantiatedType = utils.asInstantiatedMethodType( - tagletWriter.getCurrentPageElement(), executable); + tagletWriter.getCurrentTypeElement(), executable); List substitutedExceptionTypes = instantiatedType.getThrownTypes(); List originalExceptionTypes = executable.getThrownTypes(); Map typeSubstitutions = getSubstitutedThrownTypes( diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/UserTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/UserTaglet.java index cc5ae21ba29..d1884c53ccf 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/UserTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/UserTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/ValueTaglet.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/ValueTaglet.java index a4fddef0f11..506bec8b517 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/ValueTaglet.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/taglets/ValueTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseOptions.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseOptions.java index a4d5f4fae0e..a1533eb115a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseOptions.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/BaseOptions.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Messages.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Messages.java index 576bf64e751..9d77b390c3e 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Messages.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Messages.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it 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 1b00ea9fbc0..28126387ead 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 @@ -282,7 +282,7 @@ doclet.record_equals_doc.fullbody.tail.both=参照コンポーネントは{@link doclet.record_equals_doc.fullbody.tail.primitive=このレコード・クラスのすべてのコンポーネントは対応するラッパー・クラスのcompareメソッドで比較されます。 -doclet.record_equals_doc.fullbody.tail.reference=このレコード・クラスのすべてのコンポーネントは{@link java.util.Objects#equals(Object,Object) Objects::equals(Object,Object)}と比較されます。 +doclet.record_equals_doc.fullbody.tail.reference=このレコード・クラスのすべてのコンポーネントは{@link java.util.Objects#equals(Object,Object) Objects::equals(Object,Object)}で比較されます。 doclet.record_equals_doc.param_name=比較するオブジェクト 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 e9786173c5f..e2722f1deab 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 @@ -218,7 +218,7 @@ doclet.Annotation_Type_Optional_Members=可选元素 doclet.Annotation_Type_Required_Members=所需元素 doclet.Enum_Constants=枚举常量 doclet.Nested_Classes=嵌套类 -doclet.Modifier=限定符 +doclet.Modifier=修饰符 doclet.Type=类型 doclet.Modifier_and_Type=修饰符和类型 doclet.Implementation=实现: diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java index 81daa41c357..17f98cf05a8 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Extern.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Comment.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Comment.java index 77b456cc7ff..4e57132b5f0 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Comment.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Comment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/DocType.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/DocType.java index 5e6bf502fe1..5444d75c20a 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/DocType.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/DocType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/HtmlId.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/HtmlId.java index a6af1438284..54ad843d03f 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/HtmlId.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/HtmlId.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Script.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Script.java index a5fc1521509..642d74d54e7 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Script.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/html/Script.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/package-info.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/package-info.java index dffb34f1e93..160cd1f81b2 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/package-info.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/package-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java index 8390831b249..b4ee61fc36c 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/JavadocTool.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolEnvironment.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolEnvironment.java index 5eed7cd9268..8c8e06fb616 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolEnvironment.java +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/ToolEnvironment.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it 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 2192bfb3395..4d0e7bae176 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 @@ -50,18 +50,18 @@ 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 Mitglieder (Felder, Methoden usw.) dokumentiert\nwerden, wobei der Wert "public", "protected",\n"package" oder "private" lauten kann. Der Standardwert ist "protected"\nund zeigt öffentliche und geschützte Mitglieder, "public" zeigt nur\nöffentliche Mitglieder, "package" zeigt öffentliche, geschützte und\nPackagemitglieder, und "private" zeigt alle Mitglieder. +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.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. main.opt.show.packages.arg= -main.opt.show.packages.desc=Gibt das Modul an, dessen Packages dokumentiert werden. Mögliche\nWerte sind "exported" oder "all" (exportierte oder alle Packages). +main.opt.show.packages.desc=Gibt an, welche Modulpackages dokumentiert werden. Mögliche\nWerte sind "exported" oder "all" (exportierte oder alle Packages). main.opt.show.module.contents.arg= main.opt.show.module.contents.desc=Gibt die Dokumentationsgranularität von Moduldeklarationen\nan. Mögliche Werte sind "api" oder "all". -main.opt.expand.requires.arg= +main.opt.expand.requires.arg=(transitive|all) main.opt.expand.requires.desc=Anweisungen im Tool zum Erweitern des zu dokumentierenden\nModulsets. Standardmäßig werden nur die Module dokumentiert,\ndie in der Befehlszeile ausdrücklich angegeben werden. Der Wert\n"transitive" schließt zusätzlich alle "requires transitive"-Abhängigkeiten\nder Module ein. Der Wert "all" schließt\nalle Abhängigkeiten der Module ein. main.opt.help.desc=Zeigt die Befehlszeilenoptionen an und beendet diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_ja.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_ja.properties index 1cafe4d6ad5..42765ab4ded 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_ja.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_ja.properties @@ -50,18 +50,18 @@ main.opt.package.desc=package/protected/publicタイプとメンバーを表示 main.opt.private.desc=すべてのタイプとメンバーを表示します。名前のあるモジュールの場合、\nすべてのパッケージとすべてのモジュール詳細を表示します。 main.opt.show.members.arg= -main.opt.show.members.desc=値が"public"、"protected"、"package"または"private"のいずれかの\nどのメンバー(フィールドやメソッドなど)をドキュメント化するかを指定する。\nデフォルトは"protected"で、publicおよびprotectedメンバーが表示され、\n"public"ではpublicメンバーのみが表示されます。"package"では\npublic、protectedおよびpackageメンバーが表示され、"private"\nではすべてのメンバーが表示されます。 +main.opt.show.members.desc=値が"public"、"protected"、"package"または"private"のいずれかの\nどのメンバー(フィールド、メソッドまたはコンストラクタ)をドキュメント化するかを指定する。\nデフォルトは"protected"で、publicおよびprotectedメンバーが表示され、\n"public"ではpublicメンバーのみが表示されます。"package"では\npublic、protectedおよびpackageメンバーが表示され、"private"\nではすべてのメンバーが表示されます。 main.opt.show.types.arg= main.opt.show.types.desc=値が"public"、"protected"、"package"または"private"のいずれかの\nどの型(クラスやインタフェースなど)をドキュメント化するかを指定する。\nデフォルトは"protected"で、publicおよびprotected型が表示され、\n"public"ではpublic型のみが表示されます。"package"では\npublic、protectedおよびpackage型が表示され、"private"\nではすべての型が表示されます。 main.opt.show.packages.arg= -main.opt.show.packages.desc=どのモジュールのパッケージをドキュメント化するかを指定する。使用可能な\n値は、"exported"または"all"パッケージです。 +main.opt.show.packages.desc=どのモジュール・パッケージをドキュメント化するかを指定する。使用可能な\n値は、"exported"または"all"パッケージです。 main.opt.show.module.contents.arg= main.opt.show.module.contents.desc=モジュール宣言のドキュメント化の粒度を指定する。\n使用可能な値は、"api"または"all"です。 -main.opt.expand.requires.arg= +main.opt.expand.requires.arg=(transitive|all) main.opt.expand.requires.desc=ドキュメント化するモジュールのセットを拡張するための\nツールを指定する。デフォルトでは、コマンドラインで明示的に\n指定されたモジュールのみがドキュメント化されます。"transitive"の値は、\nそれらのモジュールのすべての"requires transitive"依存性を追加で\n含めます。"all"の値は、それらのモジュールのすべての依存性を\n含めます。 main.opt.help.desc=コマンドライン・オプションを表示して終了する diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_zh_CN.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_zh_CN.properties index 4ad91361e06..27053b44753 100644 --- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_zh_CN.properties +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/tool/resources/javadoc_zh_CN.properties @@ -50,18 +50,18 @@ main.opt.package.desc=显示程序包/受保护/公共类型和成员。对于 \ main.opt.private.desc=显示所有类型和成员。对于命名模块,\n显示所有程序包和所有模块详细信息。 main.opt.show.members.arg=<值> -main.opt.show.members.desc=指定将文档化的成员 (字段, 方法等), 其值可以\n为 "public", "protected", "package" 或 \n"private" 之一。默认值为 "protected", 该值将\n显示公共和受保护成员, "public" 将仅显示\n公共成员, "package" 将显示公共, 受保护和\n程序包成员, "private" 将显示所有成员。 +main.opt.show.members.desc=指定将文档化的成员(字段、方法或构造器),\n其值可以为 "public"、"protected"、"package" \n或 "private" 之一。默认值为 "protected",此时将\n显示公共和受保护成员,值为 "public" 时将仅显示\n公共成员,值为 "package" 时将显示公共、受保护\n和程序包成员,值为 "private" 时将显示所有成员。 main.opt.show.types.arg=<值> main.opt.show.types.desc=指定将文档化的类型 (类, 接口等), 其值可以\n为 "public", "protected", "package" 或 \n"private" 之一。默认值为 "protected", 该值将\n显示公共和受保护类型, "public" 将仅显示\n公共类型, "package" 将显示公共, 受保护和\n程序包类型, "private" 将显示所有类型。 main.opt.show.packages.arg=<值> -main.opt.show.packages.desc=指定将文档化的模块的程序包。\n可能的值为 "exported" 或 "all" 程序包。 +main.opt.show.packages.desc=指定将文档化的模块程序包。可能的\n值为 "exported" 或 "all" 程序包。 main.opt.show.module.contents.arg=<值> main.opt.show.module.contents.desc=指定模块声明的文档粒度。\n可能的值为 "api" 或 "all"。 -main.opt.expand.requires.arg=<值> +main.opt.expand.requires.arg=(transitive|all) main.opt.expand.requires.desc=指示工具展开要文档化的模块集。\n默认情况下, 将仅文档化命令行中明确\n指定的模块。值 "transitive" 将额外包含\n这些模块的所有 "requires transitive"\n被依赖对象。值 "all" 将包含这些模块\n的所有被依赖对象。 main.opt.help.desc=显示命令行选项并退出 diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_de.properties b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_de.properties index 3575f134dfc..23ccb0eec6c 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_de.properties +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_de.properties @@ -66,7 +66,7 @@ main.opt.version=\ -version Versionsinformationen main.opt.v=\ -v -verbose Gibt zusätzliche Informationen aus -main.opt.l=\ -l Gibt die Zeilennummer und lokale Variablentabellen aus +main.opt.l=\ -l Gibt die Zeilennummer und lokale Variablentabellen aus, kann zusammen mit "-c" verwendet werden main.opt.public=\ -public Zeigt nur öffentliche Klassen und Mitglieder diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_ja.properties b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_ja.properties index a759117f727..fc16a539111 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_ja.properties +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_ja.properties @@ -66,7 +66,7 @@ main.opt.version=\ -version バージョン情報 main.opt.v=\ -v -verbose 追加情報を出力する -main.opt.l=\ -l 行番号とローカル変数表を出力する +main.opt.l=\ -l 行番号とローカル変数表を出力する。-cとの組合せで動作します main.opt.public=\ -public publicクラスおよびメンバーのみを表示する diff --git a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties index bc6137f7f13..3d08cd16755 100644 --- a/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties +++ b/src/jdk.jdeps/share/classes/com/sun/tools/javap/resources/javap_zh_CN.properties @@ -66,7 +66,7 @@ main.opt.version=\ -version 版本信息 main.opt.v=\ -v -verbose 输出附加信息 -main.opt.l=\ -l 输出行号和本地变量表 +main.opt.l=\ -l 输出行号和本地变量表,与 -c 结合使用 main.opt.public=\ -public 仅显示公共类和成员 diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java index 0eda0b5d455..6717d5517d1 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java @@ -49,7 +49,6 @@ import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.Comparator; import java.util.Date; import java.util.HashMap; @@ -378,43 +377,61 @@ public static void createImage(JlinkConfiguration config, // the token for "all modules on the module path" private static final String ALL_MODULE_PATH = "ALL-MODULE-PATH"; private JlinkConfiguration initJlinkConfig() throws BadArgs { - Set roots = new HashSet<>(); - for (String mod : options.addMods) { - if (mod.equals(ALL_MODULE_PATH) && options.modulePath.size() > 0) { - ModuleFinder finder = newModuleFinder(options.modulePath, options.limitMods, Set.of()); - // all observable modules are roots - finder.findAll() - .stream() - .map(ModuleReference::descriptor) - .map(ModuleDescriptor::name) - .forEach(mn -> roots.add(mn)); - } else { - roots.add(mod); - } - } - - ModuleFinder finder = newModuleFinder(options.modulePath, options.limitMods, roots); - if (finder.find("java.base").isEmpty()) { + ModuleFinder appModuleFinder = newModuleFinder(options.modulePath); + ModuleFinder finder = appModuleFinder; + boolean isLinkFromRuntime = false; + if (!appModuleFinder.find("java.base").isPresent()) { + // If the application module finder doesn't contain the + // java.base module we have one of two cases: + // 1. A custom module is being linked into a runtime, but the JDK + // modules have not been provided on the module path. + // 2. We have a run-time image based link. + // + // Distinguish case 2 by adding the default 'jmods' folder and try + // the look-up again. For case 1 this will now find java.base, but + // not for case 2, since the jmods folder is not there or doesn't + // include the java.base module. Path defModPath = getDefaultModulePath(); if (defModPath != null) { options.modulePath.add(defModPath); + finder = newModuleFinder(options.modulePath); + } + // We've just added the default module path ('jmods'). If we still + // don't find java.base, we must resolve JDK modules from the + // current run-time image. + if (!finder.find("java.base").isPresent()) { + // If we don't have a linkable run-time image this is an error + if (!LinkableRuntimeImage.isLinkableRuntime()) { + throw taskHelper.newBadArgs("err.runtime.link.not.linkable.runtime"); + } + isLinkFromRuntime = true; + // JDK modules come from the system module path + finder = ModuleFinder.compose(ModuleFinder.ofSystem(), appModuleFinder); } - finder = newModuleFinder(options.modulePath, options.limitMods, roots); } - boolean isLinkFromRuntime = options.modulePath.isEmpty(); - // In case of custom modules outside the JDK we may - // have a non-empty module path, which must not include - // java.base. If it did, we link using packaged modules from that - // module path. If the module path does not include java.base, we have - // the case where we link from the run-time image. In that case, we take - // the JDK modules from the run-time image (ModuleFinder.ofSystem()). - if (finder.find("java.base").isEmpty()) { - isLinkFromRuntime = true; - ModuleFinder runtimeImageFinder = ModuleFinder.ofSystem(); - finder = combinedFinders(runtimeImageFinder, finder, options.limitMods, roots); + // Sanity check version if we use JMODs + if (!isLinkFromRuntime) { + checkJavaBaseVersion(finder); } + // Determine the roots set + Set roots = new HashSet<>(); + for (String mod : options.addMods) { + if (mod.equals(ALL_MODULE_PATH)) { + ModuleFinder mf = newLimitedFinder(finder, options.limitMods, + Set.of()); + mf.findAll() + .stream() + .map(ModuleReference::descriptor) + .map(ModuleDescriptor::name) + .forEach(mn -> roots.add(mn)); + } else { + roots.add(mod); + } + } + finder = newLimitedFinder(finder, options.limitMods, roots); + // --keep-packaged-modules doesn't make sense as we are not linking // from packaged modules to begin with. if (isLinkFromRuntime && options.packagedModulesPath != null) { @@ -429,48 +446,13 @@ private JlinkConfiguration initJlinkConfig() throws BadArgs { options.generateLinkableRuntime); } - /** - * Creates a combined module finder of {@code finder} and - * {@code runtimeImageFinder} that first looks-up modules in the - * {@code runtimeImageFinder} and if not present in {@code finder}. - * - * @param runtimeImageFinder A system modules finder. - * @param finder A module finder based on packaged modules. - * @param limitMods The set of limited modules for the resulting - * finder (if any). - * @param roots All module roots. - * - * @return A combined finder, or the input finder, potentially applying - * module limits. + /* + * Creates a ModuleFinder for the given module paths. */ - private ModuleFinder combinedFinders(ModuleFinder runtimeImageFinder, - ModuleFinder finder, - Set limitMods, - Set roots) { - ModuleFinder combined = new ModuleFinder() { - - @Override - public Optional find(String name) { - Optional mref = runtimeImageFinder.find(name); - if (mref.isEmpty()) { - return finder.find(name); - } - return mref; - } - - @Override - public Set findAll() { - Set all = new HashSet<>(); - all.addAll(runtimeImageFinder.findAll()); - all.addAll(finder.findAll()); - return Collections.unmodifiableSet(all); - } - }; - // if limitmods is specified then limit the universe - if (limitMods != null && !limitMods.isEmpty()) { - return limitFinder(combined, limitMods, Objects.requireNonNull(roots)); - } - return combined; + public static ModuleFinder newModuleFinder(List paths) { + Runtime.Version version = Runtime.version(); + Path[] entries = paths.toArray(new Path[0]); + return ModulePath.of(version, true, entries); } private void createImage(JlinkConfiguration config) throws Exception { @@ -510,48 +492,81 @@ public static Path getDefaultModulePath() { } /* - * Returns a module finder of the given module path or the system modules - * if the module path is empty that limits the observable modules to those - * in the transitive closure of the modules specified in {@code limitMods} - * plus other modules specified in the {@code roots} set. + * Returns a module finder of the given module finder that limits the + * observable modules to those in the transitive closure of the modules + * specified in {@code limitMods} plus other modules specified in the + * {@code roots} set. + */ + public static ModuleFinder newLimitedFinder(ModuleFinder finder, + Set limitMods, + Set roots) { + // if limitMods is specified then limit the universe + if (limitMods != null && !limitMods.isEmpty()) { + Objects.requireNonNull(roots); + // resolve all root modules + Configuration cf = Configuration.empty() + .resolve(finder, + ModuleFinder.of(), + limitMods); + + // module name -> reference + Map map = new HashMap<>(); + cf.modules().forEach(m -> { + ModuleReference mref = m.reference(); + map.put(mref.descriptor().name(), mref); + }); + + // add the other modules + roots.stream() + .map(finder::find) + .flatMap(Optional::stream) + .forEach(mref -> map.putIfAbsent(mref.descriptor().name(), mref)); + + // set of modules that are observable + Set mrefs = new HashSet<>(map.values()); + + return new ModuleFinder() { + @Override + public Optional find(String name) { + return Optional.ofNullable(map.get(name)); + } + + @Override + public Set findAll() { + return mrefs; + } + }; + } + return finder; + } + + /* + * Checks the version of the module descriptor of java.base for compatibility + * with the current runtime version. * - * @throws IllegalArgumentException if java.base module is present - * but its descriptor has no version + * @throws IllegalArgumentException the descriptor of java.base has no + * version or the java.base version is not the same as the current runtime's + * version. */ - public static ModuleFinder newModuleFinder(List paths, - Set limitMods, - Set roots) - { - Runtime.Version version = Runtime.version(); - Path[] entries = paths.toArray(new Path[0]); - ModuleFinder finder = paths.isEmpty() ? ModuleFinder.ofSystem() - : ModulePath.of(version, true, entries); - if (finder.find("java.base").isPresent()) { - // use the version of java.base module, if present, as - // the release version for multi-release JAR files - ModuleDescriptor.Version v = finder.find("java.base").get() + private static void checkJavaBaseVersion(ModuleFinder finder) { + assert finder.find("java.base").isPresent(); + + // use the version of java.base module, if present, as + // the release version for multi-release JAR files + ModuleDescriptor.Version v = finder.find("java.base").get() .descriptor().version().orElseThrow(() -> - new IllegalArgumentException("No version in java.base descriptor") - ); - - // java.base version is different than the current runtime version - version = Runtime.Version.parse(v.toString()); - if (Runtime.version().feature() != version.feature() || - Runtime.version().interim() != version.interim()) - { - // jlink version and java.base version do not match. - // We do not (yet) support this mode. - throw new IllegalArgumentException(taskHelper.getMessage("err.jlink.version.mismatch", + new IllegalArgumentException("No version in java.base descriptor") + ); + + Runtime.Version version = Runtime.Version.parse(v.toString()); + if (Runtime.version().feature() != version.feature() || + Runtime.version().interim() != version.interim()) { + // jlink version and java.base version do not match. + // We do not (yet) support this mode. + throw new IllegalArgumentException(taskHelper.getMessage("err.jlink.version.mismatch", Runtime.version().feature(), Runtime.version().interim(), version.feature(), version.interim())); - } - } - - // if limitmods is specified then limit the universe - if (limitMods != null && !limitMods.isEmpty()) { - finder = limitFinder(finder, limitMods, Objects.requireNonNull(roots)); } - return finder; } private static void deleteDirectory(Path dir) throws IOException { @@ -611,10 +626,6 @@ private static ImageHelper createImageProvider(JlinkConfiguration config, // Perform some sanity checks for linking from the run-time image if (config.linkFromRuntimeImage()) { - if (!LinkableRuntimeImage.isLinkableRuntime()) { - String msg = taskHelper.getMessage("err.runtime.link.not.linkable.runtime"); - throw new IllegalArgumentException(msg); - } // Do not permit linking from run-time image and also including jdk.jlink module if (cf.findModule(JlinkTask.class.getModule().getName()).isPresent()) { String msg = taskHelper.getMessage("err.runtime.link.jdk.jlink.prohibited"); @@ -773,49 +784,6 @@ private static String findModuleName(Path modInfoPath) { } } - /* - * Returns a ModuleFinder that limits observability to the given root - * modules, their transitive dependences, plus a set of other modules. - */ - public static ModuleFinder limitFinder(ModuleFinder finder, - Set roots, - Set otherMods) { - - // resolve all root modules - Configuration cf = Configuration.empty() - .resolve(finder, - ModuleFinder.of(), - roots); - - // module name -> reference - Map map = new HashMap<>(); - cf.modules().forEach(m -> { - ModuleReference mref = m.reference(); - map.put(mref.descriptor().name(), mref); - }); - - // add the other modules - otherMods.stream() - .map(finder::find) - .flatMap(Optional::stream) - .forEach(mref -> map.putIfAbsent(mref.descriptor().name(), mref)); - - // set of modules that are observable - Set mrefs = new HashSet<>(map.values()); - - return new ModuleFinder() { - @Override - public Optional find(String name) { - return Optional.ofNullable(map.get(name)); - } - - @Override - public Set findAll() { - return mrefs; - } - }; - } - private static Platform targetPlatform(Configuration cf, Map modsPaths, boolean runtimeImageLink) throws IOException { 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 31ed02a693c..7c156a61b3a 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 @@ -62,10 +62,19 @@ main.msg.bug=Eine Ausnahme ist in jlink aufgetreten. Melden Sie in der Java-Bugd main.extended.help=Liste der verfügbaren Plug-ins: main.extended.help.footer=Bei Optionen, die eine erfordern, ist der Wert eine kommagetrennte\nListe von Elementen, die jeweils eines der folgenden Formate verwenden:\n \n glob:\n regex:\n @, wobei der Dateiname der Name einer Datei mit zu verwendenden Mustern ist,\n ein Muster pro Zeile\n\n +main.runtime.image.linking.cap.enabled=aktiviert +main.runtime.image.linking.cap.disabled=deaktiviert +main.runtime.image.linking.cap.sect.header=Funktionen: +main.runtime.image.linking.cap.msg=\ Assemblierung von Laufzeitimage {0} error.prefix=Fehler: warn.prefix=Warnung: +err.runtime.link.not.linkable.runtime=Dieses JDK unterstützt keine Assemblierung vom aktuellen Laufzeitimage +err.runtime.link.jdk.jlink.prohibited=Dieses JDK enthält keine als Pakete verpackten Module und kann nicht verwendet werden, um ein anderes Image mit dem Modul jdk.jlink zu erstellen +err.runtime.link.packaged.mods=Dieses JDK enthält keine als Pakete verpackten Module. "--keep-packaged-modules" wird nicht unterstützt +err.runtime.link.modified.file={0} wurde modifiziert +err.runtime.link.patched.module=Datei {0} nicht im Modulimage gefunden. "--patch-module" wird beim Verknüpfen aus dem Laufzeitimage nicht unterstützt err.empty.module.path=leerer Modulpfad err.jlink.version.mismatch=jlink-Version {0}.{1} stimmt nicht mit Ziel-java.base-Version {2}.{3} überein err.automatic.module:automatisches Modul kann nicht mit jlink verwendet werden: {0} aus {1} @@ -74,7 +83,7 @@ err.launcher.main.class.empty:Launcher-Hauptklassenname darf nicht leer sein: {0 err.launcher.module.name.empty:Launcher-Modulname darf nicht leer sein: {0} err.launcher.value.format:Launcher-Wert muss folgendes Format haben: =[/]: {0} err.output.must.be.specified:--output muss angegeben werden -err.modulepath.must.be.specified:--module-path ist nicht angegeben, und dieses Laufzeitimage enthält nicht das jmods-Verzeichnis. +err.modulepath.must.be.specified:"--module-path" ist nicht angegeben, und dieses Laufzeitimage enthält kein jmods-Verzeichnis err.mods.must.be.specified:keine Module zum {0} angegeben err.path.not.found=Pfad nicht gefunden: {0} err.path.not.valid=ungültiger Pfad: {0} @@ -106,3 +115,6 @@ warn.provider.notfound=Kein Provider für Service angegeben für --suggest-provi no.suggested.providers=Option --bind-services ist angegeben. Keine weiteren Provider vorgeschlagen. suggested.providers.header=Vorgeschlagene Provider providers.header=Provider + +runtime.link.info=Assemblierung basierend auf dem aktuellen Laufzeitimage +runtime.link.jprt.path.extra=(Laufzeitimage) 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 2beac29ca54..66cf161c1fc 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 @@ -62,10 +62,19 @@ main.msg.bug=jlinkで例外が発生しました。データベースで重複 main.extended.help=使用可能なプラグインのリスト: main.extended.help.footer=を必要とするオプションの場合、値は、次の形式のいずれかを使用する、要素のカンマ区切りリストになります:\n \n glob:\n regex:\n @ filenameは、使用するパターンを含むファイル(1行ごとに1パターン)の名前です\n\n +main.runtime.image.linking.cap.enabled=有効 +main.runtime.image.linking.cap.disabled=無効 +main.runtime.image.linking.cap.sect.header=機能: +main.runtime.image.linking.cap.msg=\ ランタイム・イメージ{0}からのリンク error.prefix=エラー: warn.prefix=警告: +err.runtime.link.not.linkable.runtime=このJDKでは、現在のランタイム・イメージからのリンクをサポートしていません +err.runtime.link.jdk.jlink.prohibited=このJDKは、パッケージ化されたモジュールを含んでおらず、jdk.jlinkモジュールによる別のイメージの作成に使用できません +err.runtime.link.packaged.mods=このJDKにはパッケージ化されたモジュールがありません。--keep-packaged-modulesはサポートされていません +err.runtime.link.modified.file={0}が変更されました +err.runtime.link.patched.module=ファイル{0}がモジュール・イメージに見つかりません。ランタイム・イメージからリンクする際、--patch-moduleはサポートされていません err.empty.module.path=空のモジュール・パス err.jlink.version.mismatch=jlinkバージョン{0}.{1}がターゲットのjava.baseバージョン{2}.{3}と一致しません err.automatic.module:jlinkでは自動モジュールは使用できません: {1}からの{0} @@ -74,7 +83,7 @@ err.launcher.main.class.empty:起動ツールのメイン・クラス名は空 err.launcher.module.name.empty:起動ツールのモジュール名は空にできません: {0} err.launcher.value.format:起動ツールの値は=[/]の形式にしてください: {0} err.output.must.be.specified:--outputを指定する必要があります -err.modulepath.must.be.specified:--module-pathが指定されておらず、このランタイム・イメージにjmodsディレクトリが含まれていません。 +err.modulepath.must.be.specified:--module-pathが指定されておらず、このランタイム・イメージにjmodsディレクトリが含まれていません err.mods.must.be.specified:{0}にモジュールが指定されていません err.path.not.found=パスが見つかりません: {0} err.path.not.valid=無効なパス: {0} @@ -106,3 +115,6 @@ warn.provider.notfound=--suggest-providersに指定されたサービスにプ no.suggested.providers=--bind-servicesオプションが指定されています。追加のプロバイダは推奨されません。 suggested.providers.header=推奨プロバイダ providers.header=プロバイダ + +runtime.link.info=現在のランタイム・イメージに基づいてリンク +runtime.link.jprt.path.extra=(ランタイム・イメージ) 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 9bd20e1d843..532e981bfac 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 @@ -62,10 +62,19 @@ main.msg.bug=jlink 中出现异常错误。如果在 Java Bug Database (https:// main.extended.help=可用插件列表: main.extended.help.footer=对于需要 <模式列表> 的选项, 值将为逗号分隔的元素列表, 每个元素使用以下格式之一:\n \n glob:\n regex:<正则表达式模式>\n @<文件名>, 其中“文件名”是包含要使用的模式的文件名, 每行一个模式\n\n +main.runtime.image.linking.cap.enabled=启用 +main.runtime.image.linking.cap.disabled=禁用 +main.runtime.image.linking.cap.sect.header=功能: +main.runtime.image.linking.cap.msg=\ 从运行时映像 {0} 链接 error.prefix=错误: warn.prefix=警告: +err.runtime.link.not.linkable.runtime=此 JDK 不支持从当前运行时映像链接 +err.runtime.link.jdk.jlink.prohibited=此 JDK 不包含打包模块,无法用于使用 jdk.jlink 模块创建其他映像 +err.runtime.link.packaged.mods=此 JDK 没有打包模块。不支持 --keep-packaged-modules +err.runtime.link.modified.file=已修改 {0} +err.runtime.link.patched.module=在模块映像中未找到文件 {0}。从运行时映像链接时,不支持 --patch-module err.empty.module.path=空模块路径 err.jlink.version.mismatch=jlink 版本 {0}.{1} 与目标 java.base 版本 {2}.{3} 不匹配 err.automatic.module:自动模块不能用于来自 {1} 的 jlink: {0} @@ -74,7 +83,7 @@ err.launcher.main.class.empty:启动程序主类名不能为空: {0} err.launcher.module.name.empty:启动程序模块名称不能为空: {0} err.launcher.value.format:启动程序值应使用“<命令>=<模块>[/<主类>]”格式: {0} err.output.must.be.specified:必须指定 --output -err.modulepath.must.be.specified:未指定 --module-path,此运行时映像不包含 jmods 目录。 +err.modulepath.must.be.specified:未指定 --module-path,此运行时映像不包含 jmods 目录 err.mods.must.be.specified:没有将任何模块指定到{0} err.path.not.found=找不到路径: {0} err.path.not.valid=无效路径: {0} @@ -106,3 +115,6 @@ warn.provider.notfound=找不到为 --suggest-providers 指定的服务提供方 no.suggested.providers=指定了 --bind-services 选项。未建议其他提供方。 suggested.providers.header=建议的提供方 providers.header=提供方 + +runtime.link.info=基于当前运行时映像进行链接 +runtime.link.jprt.path.extra=(运行时映像) diff --git a/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_ja.properties b/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_ja.properties index 980c8eb2316..b346d3cde82 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_ja.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_ja.properties @@ -96,8 +96,8 @@ err.module.resolution.fail=解決に失敗しました: {0} err.no.moduleToHash=ハッシュが記録されていません: {0}に一致し、ハッシュを記録するモジュールが見つかりません err.invalid.date=--date {0}は、オプションのタイムゾーン書式: {1}を指定した、有効なISO-8601の拡張オフセットの日時ではありません err.date.out.of.range=--date {0}は有効な範囲1980-01-01T00:00:02Zから2099-12-31T23:59:59Zにありません -err.compress.incorrect=--圧縮値が無効です: {0} -err.compress.wrong.mode=--圧縮を行えるのは作成モードのときのみです +err.compress.incorrect=--compress値が無効です: {0} +err.compress.wrong.mode=--compressを行えるのは作成モードのときのみです warn.invalid.arg=無効なクラス名またはパス名が存在しません: {0} warn.no.module.hashes=ハッシュが記録されていません: {0}に依存するハッシュに対してモジュールが指定されていません warn.ignore.entry=セクション{1}のエントリ{0}を無視します diff --git a/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_zh_CN.properties b/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_zh_CN.properties index 409081fc45b..1cf9d001fa3 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_zh_CN.properties +++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/resources/jmod_zh_CN.properties @@ -96,8 +96,8 @@ err.module.resolution.fail=解析失败: {0} err.no.moduleToHash=未记录散列:找不到与 {0} 匹配的模块来记录散列 err.invalid.date=--date {0} 不是具有可选时区的有效 ISO-8601 扩展偏移日期时间格式:{1} err.date.out.of.range=--date {0} 不在 1980-01-01T00:00:02Z 到 2099-12-31T23:59:59Z 这一有效范围内 -err.compress.incorrect=--压缩值无效:{0} -err.compress.wrong.mode=--仅在使用创建模式时接受压缩 +err.compress.incorrect=--compress 值无效:{0} +err.compress.wrong.mode=仅在使用创建模式时接受 --compress warn.invalid.arg=类名无效或路径名不存在: {0} warn.no.module.hashes=未记录任何散列: 没有为依赖于 {0} 的散列处理指定模块 warn.ignore.entry=正在忽略节 {1} 中的条目 {0} 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 c0aece573e0..f76d3a3743f 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 @@ -93,6 +93,6 @@ message.signing.pkg=Warnung: Zum Signieren von PKG müssen Sie möglicherweise m message.setfile.dmg=Das Festlegen des benutzerdefinierten Symbols für die DMG-Datei wurde übersprungen, weil das Utility "SetFile" nicht gefunden wurde. Durch Installieren von Xcode mit Befehlszeilentools sollte dieses Problem behoben werden. message.install-dir-ignored=Warnung: "--install-dir" wird von DMG nicht unterstützt. Stattdessen wird standardmäßig /Applications verwendet. message.codesign.failed.reason.app.content="codesign" war nicht erfolgreich, und zusätzlicher Anwendungsinhalt wurde über den Parameter "--app-content" angegeben. Wahrscheinlich hat der zusätzliche Inhalt die Integrität des Anwendungs-Bundles beeinträchtigt und den Fehler verursacht. Stellen Sie sicher, das der über den Parameter "--app-content" angegebene Inhalt nicht die Integrität des Anwendungs-Bundles beeinträchtigt, oder fügen Sie ihn im Nachverarbeitungsschritt hinzu. -message.codesign.failed.reason.xcode.tools=Possible reason for "codesign" failure is missing Xcode with command line developer tools. Install Xcode with command line developer tools to see if it resolves the problem. +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. 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 166e7ffb670..5ea13254e93 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 @@ -93,6 +93,6 @@ message.signing.pkg=警告: PKGへの署名の場合、「キーチェーン・ message.setfile.dmg='SetFile'ユーティリティが見つからないため、DMGファイルでのカスタム・アイコンの設定がスキップされました。Xcodeとコマンド・ライン・ツールをインストールすると、この問題は解決されます。 message.install-dir-ignored=警告: "--install-dir"はDMGでサポートされていません。/Applicationsにデフォルト設定されます。 message.codesign.failed.reason.app.content="codesign"が失敗したため、追加のアプリケーション・コンテンツが、"--app-content"パラメータを介して提供されました。追加のコンテンツにより、アプリケーション・バンドルの整合性が損われ、失敗の原因になった可能性があります。"--app-content"パラメータを介して提供されたコンテンツによって、アプリケーション・バンドルの整合性が損われていないことを確認するか、処理後のステップで追加してください。 -message.codesign.failed.reason.xcode.tools=Possible reason for "codesign" failure is missing Xcode with command line developer tools. Install Xcode with command line developer tools to see if it resolves the problem. +message.codesign.failed.reason.xcode.tools="codesign"失敗の考えられる理由は、Xcodeとコマンドライン・デベロッパ・ツールの欠落です。Xcodeとコマンドライン・デベロッパ・ツールをインストールして、問題が解決されるかを確認してください。 warning.unsigned.app.image=警告: 署名されていないapp-imageを使用して署名された{0}を作成します。 warning.per.user.app.image.signed=警告: 事前定義済の署名付きアプリケーション・イメージに"{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 a620e8dacdd..1a262f461ac 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 @@ -93,6 +93,6 @@ message.signing.pkg=警告:要对 PKG 进行签名,可能需要使用“密 message.setfile.dmg=由于未找到 'SetFile' 实用程序,跳过了针对 DMG 文件设置定制图标的操作。安装带命令行工具的 Xcode 应能解决此问题。 message.install-dir-ignored=警告:"--install-dir" 不受 DMG 支持,将默认为 /Applications。 message.codesign.failed.reason.app.content="codesign" 失败,并通过 "--app-content" 参数提供了附加应用程序内容。可能是附加内容破坏了应用程序包的完整性,导致了故障。请确保通过 "--app-content" 参数提供的内容不会破坏应用程序包的完整性,或者在后处理步骤中添加该内容。 -message.codesign.failed.reason.xcode.tools=Possible reason for "codesign" failure is missing Xcode with command line developer tools. Install Xcode with command line developer tools to see if it resolves the problem. +message.codesign.failed.reason.xcode.tools="codesign" 失败可能是因为缺少带命令行开发人员工具的 Xcode。请安装带命令行开发人员工具的 Xcode,看看是否可以解决问题。 warning.unsigned.app.image=警告:使用未签名的 app-image 生成已签名的 {0}。 warning.per.user.app.image.signed=警告:由于预定义的已签名应用程序映像中缺少 "{0}",不支持对已安装应用程序的每用户配置提供支持。 diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/PrettyPrintHandler.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/PrettyPrintHandler.java index ffd5b764103..1fb7c7ff7da 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/PrettyPrintHandler.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/PrettyPrintHandler.java @@ -4,7 +4,9 @@ * * 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. + * 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 diff --git a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlConsumer.java b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlConsumer.java index 429be6aba05..a77c93e9383 100644 --- a/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlConsumer.java +++ b/src/jdk.jpackage/share/classes/jdk/jpackage/internal/util/XmlConsumer.java @@ -4,7 +4,9 @@ * * 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. + * 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 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 ff4168e5d0c..57ad1759bf4 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 @@ -4,7 +4,9 @@ * * 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. + * 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 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 55f2964445f..8428d5d1e7f 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 @@ -4,7 +4,9 @@ * * 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. + * 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 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 e5b7704a92e..3ed0fd67d84 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 @@ -4,7 +4,9 @@ * * 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. + * 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 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 a8119f25bdb..8c2df773eb5 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 @@ -4,7 +4,9 @@ * * 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. + * 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 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 5ca33c22d92..ef1b0a61df7 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 @@ -4,7 +4,9 @@ * * 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. + * 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 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 db6b1d26005..2b5eae43842 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 @@ -4,7 +4,9 @@ * * 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. + * 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 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 7f3fcda536c..7c75c4d9753 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 @@ -4,7 +4,9 @@ * * 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. + * 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 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 2f5ef135875..c69c4729190 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 @@ -4,7 +4,9 @@ * * 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. + * 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 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 27a3e2f30f5..7a2a0fd67cf 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 @@ -4,7 +4,9 @@ * * 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. + * 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 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 dce8ca6176d..31a0ebeab24 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 @@ -40,9 +40,9 @@ resource.overrides-wix-file=Überschreibt WiX-Projektdatei resource.shortcutpromptdlg-wix-file=Dialogfeld für Verknüpfungs-Prompt der WiX-Projektdatei resource.installdirnotemptydlg-wix-file=Nicht leeres Installationsverzeichnis in Dialogfeld für WiX-Projektdatei resource.launcher-as-service-wix-file=WiX-Projektdatei für Serviceinstallationsprogramm -resource.wix-src-conv=XSLT stylesheet converting WiX sources from WiX v3 to WiX v4 format +resource.wix-src-conv=XSLT-Stylesheet zum Konvertieren von WiX-Quellen vom Format WiX v3 in WiX v4 -error.no-wix-tools=Can not find WiX tools. Was looking for WiX v3 light.exe and candle.exe or WiX v4/v5 wix.exe and none was found +error.no-wix-tools=WiX-Tools nicht gefunden. Gesucht wurden WiX v3 light.exe und candle.exe oder WiX v4/v5 wix.exe, aber keine der Dateien wurde gefunden error.no-wix-tools.advice=Laden Sie WiX 3.0 oder höher von https://wixtoolset.org herunter, und fügen Sie es zu PATH hinzu. error.version-string-wrong-format.advice=Setzen Sie den Wert des --app-version-Parameters auf eine gültige ProductVersion des Windows-Installationsprogramms. error.msi-product-version-components=Versionszeichenfolge [{0}] muss zwischen 2 und 4 Komponenten aufweisen. @@ -56,7 +56,7 @@ error.lock-resource=Sperren nicht erfolgreich: {0} error.unlock-resource=Aufheben der Sperre nicht erfolgreich: {0} error.read-wix-l10n-file=Datei {0} konnte nicht geparst werden error.extract-culture-from-wix-l10n-file=Kulturwert konnte nicht aus Datei {0} gelesen werden -error.short-path-conv-fail=Failed to get short version of "{0}" path +error.short-path-conv-fail=Kurze Version des Pfades "{0}" konnte nicht abgerufen werden message.icon-not-ico=Das angegebene Symbol "{0}" ist keine ICO-Datei und wird nicht verwendet. Stattdessen wird das Standardsymbol verwendet. message.potential.windows.defender.issue=Warnung: Windows Defender verhindert eventuell die korrekte Ausführung von jpackage. Wenn ein Problem auftritt, deaktivieren Sie das Echtzeitmonitoring, oder fügen Sie einen Ausschluss für das Verzeichnis "{0}" hinzu. 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 47e5b585869..57391db9087 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 @@ -40,9 +40,9 @@ resource.overrides-wix-file=WiXプロジェクト・ファイルのオーバー resource.shortcutpromptdlg-wix-file=ショートカット・プロンプト・ダイアログWiXプロジェクト・ファイル resource.installdirnotemptydlg-wix-file=インストール・ディレクトリ・ダイアログのWiXプロジェクト・ファイルが空ではありません resource.launcher-as-service-wix-file=サービス・インストーラWiXプロジェクト・ファイル -resource.wix-src-conv=XSLT stylesheet converting WiX sources from WiX v3 to WiX v4 format +resource.wix-src-conv=WiXソースをWiX v3からWiX v4フォーマットに変換するXSLTスタイルシート -error.no-wix-tools=Can not find WiX tools. Was looking for WiX v3 light.exe and candle.exe or WiX v4/v5 wix.exe and none was found +error.no-wix-tools=WiXツールが見つかりません。WiX v3 light.exeとcandle.exeまたはWiX v4/v5 wix.exeを探しましたが、いずれも見つかりませんでした error.no-wix-tools.advice=WiX 3.0以降をhttps://wixtoolset.orgからダウンロードし、PATHに追加します。 error.version-string-wrong-format.advice=--app-versionパラメータの値を有効なWindows Installer ProductVersionに設定します。 error.msi-product-version-components=バージョン文字列[{0}]には、2から4つのコンポーネントが含まれている必要があります。 @@ -56,7 +56,7 @@ error.lock-resource=ロックに失敗しました: {0} error.unlock-resource=ロック解除に失敗しました: {0} error.read-wix-l10n-file={0}ファイルの解析に失敗しました error.extract-culture-from-wix-l10n-file={0}ファイルからのカルチャの値の読取りに失敗しました -error.short-path-conv-fail=Failed to get short version of "{0}" path +error.short-path-conv-fail="{0}"パスの短縮バージョンの取得に失敗しました message.icon-not-ico=指定したアイコン"{0}"はICOファイルではなく、使用されません。デフォルト・アイコンがその位置に使用されます。 message.potential.windows.defender.issue=警告: Windows Defenderが原因でjpackageが機能しないことがあります。問題が発生した場合は、リアルタイム・モニタリングを無効にするか、ディレクトリ"{0}"の除外を追加することにより、問題に対処できます。 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 abd3d13a667..bd93fc5951e 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 @@ -40,9 +40,9 @@ resource.overrides-wix-file=覆盖 WiX 项目文件 resource.shortcutpromptdlg-wix-file=快捷方式提示对话框 WiX 项目文件 resource.installdirnotemptydlg-wix-file=安装目录对话框 WiX 项目文件非空 resource.launcher-as-service-wix-file=服务安装程序 WiX 项目文件 -resource.wix-src-conv=XSLT stylesheet converting WiX sources from WiX v3 to WiX v4 format +resource.wix-src-conv=将 WiX 源码从 WiX v3 格式转换为 WiX v4 格式的 XSLT 样式表 -error.no-wix-tools=Can not find WiX tools. Was looking for WiX v3 light.exe and candle.exe or WiX v4/v5 wix.exe and none was found +error.no-wix-tools=找不到 WiX 工具。已查找 WiX v3 light.exe 和 candle.exe 或 WiX v4/v5 wix.exe,但都未找到 error.no-wix-tools.advice=从 https://wixtoolset.org 下载 WiX 3.0 或更高版本,然后将其添加到 PATH。 error.version-string-wrong-format.advice=将 --app-version 参数的值设置为有效的 Windows Installer ProductVersion。 error.msi-product-version-components=版本字符串 [{0}] 必须包含 2 到 4 个组成部分。 @@ -56,7 +56,7 @@ error.lock-resource=无法锁定:{0} error.unlock-resource=无法解锁:{0} error.read-wix-l10n-file=无法解析 {0} 文件 error.extract-culture-from-wix-l10n-file=无法从 {0} 文件读取文化值 -error.short-path-conv-fail=Failed to get short version of "{0}" path +error.short-path-conv-fail=无法获取简短形式的 "{0}" 路径 message.icon-not-ico=指定的图标 "{0}" 不是 ICO 文件, 不会使用。将使用默认图标代替。 message.potential.windows.defender.issue=警告:Windows Defender 可能会阻止 jpackage 正常工作。如果存在问题,可以通过禁用实时监视或者为目录 "{0}" 添加排除项来解决。 diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/IOContext.java b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/IOContext.java index 7a1234628de..aa1f840c9c3 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/IOContext.java +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/IOContext.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties index 21f30891008..7554b380e5f 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n_de.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -180,7 +180,7 @@ jshell.console.empty = \nLeerer Eintrag. Ein einzelner gültiger Ausdruck oder e jshell.fix.wrong.shortcut =Unerwartetes Zeichen nach Umschalt+Tab.\nVerwenden Sie "I" für automatischen Import, "V" zur Variablenerstellung oder "M" zur Methodenerstellung.\nWeitere Informationen finden Sie unter:\n/help shortcuts -help.usage = Verwendung: jshell

    - * * @exception IOException Any exception thrown by the underlying OutputStream. * @see java.io.ObjectOutputStream#writeStreamHeader() */ @@ -231,7 +222,7 @@ protected void writeObjectOverride(Object obj) */ public abstract void writeFields() throws IOException; - protected abstract boolean enableReplaceObject(boolean enable) throws SecurityException; + protected abstract boolean enableReplaceObject(boolean enable); /*******************************************************************/ /* Write Primitive Data to stream. DataOutput methods. */ diff --git a/test/jdk/java/io/Serializable/subclass/SubclassTest.java b/test/jdk/java/io/Serializable/subclass/SubclassTest.java index c1e8c7d4ac3..4e875d9165f 100644 --- a/test/jdk/java/io/Serializable/subclass/SubclassTest.java +++ b/test/jdk/java/io/Serializable/subclass/SubclassTest.java @@ -31,13 +31,6 @@ * An entire protocol would need to be implemented and written * out before being able to test the input side of the API. * - * Also, would be appropriate that this program verify - * that if SerializablePermission "enableSubclassImplementation" - * is not in the security policy and security is enabled, that - * a security exception is thrown when constructing the - * ObjectOutputStream subclass. - * - * * @compile AbstractObjectInputStream.java AbstractObjectOutputStream.java * @compile XObjectInputStream.java XObjectOutputStream.java * @compile SubclassTest.java @@ -129,8 +122,6 @@ public class SubclassTest { public static void main(String argv[]) throws IOException, ClassNotFoundException { - boolean expectSecurityException = false; - ByteArrayOutputStream baos = new ByteArrayOutputStream(20); XObjectOutputStream os = null; os = new XObjectOutputStream(baos); diff --git a/test/jdk/java/io/Serializable/subclass/XObjectInputStream.java b/test/jdk/java/io/Serializable/subclass/XObjectInputStream.java index 75004b17531..bedea3d6d86 100644 --- a/test/jdk/java/io/Serializable/subclass/XObjectInputStream.java +++ b/test/jdk/java/io/Serializable/subclass/XObjectInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. * 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,20 +73,6 @@ protected final Object readObjectOverride() e.getMessage()); } - //if currentDescriptor.isAssignable(Externalizable.class) { - // Object[] argList = {this}; - // InvokeMethod(currentObject, readExternalMethod, argList); - //} else { - // Does currentDescriptor have a readObject method - // if it does - // invokeMethod(this, readObjectMethod, {this}); - // else - // defaultReadObject(); - //} - // check for replacement on currentObject. - // if toplevel readobject - // doObjectValidations. - } finally { readResult = currentObject; currentObject = prevObject; @@ -245,82 +231,9 @@ public void read(ObjectInputStream in) private Object currentObject; private Class currentClassDescriptor; - - - /****************************************************************/ - - /* CODE LIFTED FROM ObjectStreamClass constuctor. - * ObjectStreamClass.readObjectMethod is private. - * - * Look for the readObject method - * Set the accessible flag on it here. ObjectOutputStream - * will call it as necessary. - */ - public static Method getReadObjectMethod(final Class cl) { - - Method readObjectMethod = - java.security.AccessController.doPrivileged - (new java.security.PrivilegedAction() { - public Method run() { - Method m = null; - try { - Class[] args = {ObjectInputStream.class}; - m = cl.getDeclaredMethod("readObject", args); - int mods = m.getModifiers(); - // Method must be private and non-static - if (!Modifier.isPrivate(mods) || - Modifier.isStatic(mods)) { - m = null; - } else { - m.setAccessible(true); - } - } catch (NoSuchMethodException e) { - m = null; - } - return m; - } - }); - return readObjectMethod; - } - /*************************************************************/ - /* taken verbatim from ObjectInputStream. */ - private static void invokeMethod(final Object obj, final Method m, - final Object[] argList) - throws IOException - { - try { - java.security.AccessController.doPrivileged - (new java.security.PrivilegedExceptionAction() { - public Void run() throws InvocationTargetException, - java.lang.IllegalAccessException { - m.invoke(obj, argList); - return null; - } - }); - } catch (java.security.PrivilegedActionException e) { - Exception ex = e.getException(); - if (ex instanceof InvocationTargetException) { - Throwable t = - ((InvocationTargetException)ex).getTargetException(); - if (t instanceof IOException) - throw (IOException)t; - else if (t instanceof RuntimeException) - throw (RuntimeException) t; - else if (t instanceof Error) - throw (Error) t; - else - throw new Error("interal error"); - } else { - // IllegalAccessException cannot happen - } - } - } - - protected boolean enableResolveObject(boolean enable) - throws SecurityException - { + protected boolean enableResolveObject(boolean enable) { throw new Error("To be implemented"); } diff --git a/test/jdk/java/io/Serializable/subclass/XObjectOutputStream.java b/test/jdk/java/io/Serializable/subclass/XObjectOutputStream.java index 7bed2cfb36d..20c64f049f2 100644 --- a/test/jdk/java/io/Serializable/subclass/XObjectOutputStream.java +++ b/test/jdk/java/io/Serializable/subclass/XObjectOutputStream.java @@ -294,7 +294,7 @@ public void drain() throws IOException {} /********************************************************************/ - /* CODE LIFTED FROM ObjectStreamClass constuctor. + /* CODE LIFTED FROM ObjectStreamClass constructor. * ObjectStreamClass.writeObjectMethod is private. * * Look for the writeObject method @@ -302,30 +302,21 @@ public void drain() throws IOException {} * Subclass of AbstractObjectOutputStream will call it as necessary. */ public static Method getWriteObjectMethod(final Class cl) { - - Method writeObjectMethod = - java.security.AccessController.doPrivileged - (new java.security.PrivilegedAction() { - public Method run() { - Method m = null; - try { - Class[] args = {ObjectOutputStream.class}; - m = cl.getDeclaredMethod("writeObject", args); - int mods = m.getModifiers(); - // Method must be private and non-static - if (!Modifier.isPrivate(mods) || - Modifier.isStatic(mods)) { - m = null; - } else { - m.setAccessible(true); - } - } catch (NoSuchMethodException e) { - m = null; - } - return m; - } - }); - return writeObjectMethod; + try { + Class[] args = {ObjectOutputStream.class}; + Method m = cl.getDeclaredMethod("writeObject", args); + int mods = m.getModifiers(); + // Method must be private and non-static + if (!Modifier.isPrivate(mods) || + Modifier.isStatic(mods)) { + return null; + } else { + m.setAccessible(true); + return m; + } + } catch (NoSuchMethodException e) { + return null; + } } /*************************************************************/ @@ -336,30 +327,19 @@ private static void invokeMethod(final Object obj, final Method m, throws IOException { try { - java.security.AccessController.doPrivileged - (new java.security.PrivilegedExceptionAction() { - public Void run() throws InvocationTargetException, - java.lang.IllegalAccessException { - m.invoke(obj, argList); - return null; - } - }); - } catch (java.security.PrivilegedActionException e) { - Exception ex = e.getException(); - if (ex instanceof InvocationTargetException) { - Throwable t = - ((InvocationTargetException)ex).getTargetException(); - if (t instanceof IOException) - throw (IOException)t; - else if (t instanceof RuntimeException) - throw (RuntimeException) t; - else if (t instanceof Error) - throw (Error) t; - else - throw new Error("interal error"); - } else { - // IllegalAccessException cannot happen - } + m.invoke(obj, argList); + } catch (InvocationTargetException ex) { + Throwable t = ex.getTargetException(); + if (t instanceof IOException) + throw (IOException)t; + else if (t instanceof RuntimeException) + throw (RuntimeException) t; + else if (t instanceof Error) + throw (Error) t; + else + throw new Error("intenral error"); + } catch (IllegalAccessException iae) { + // IllegalAccessException can not happen } } }; diff --git a/test/jdk/java/lang/Thread/virtual/MonitorPinnedEvents.java b/test/jdk/java/lang/Thread/virtual/MonitorPinnedEvents.java new file mode 100644 index 00000000000..bf63404d79e --- /dev/null +++ b/test/jdk/java/lang/Thread/virtual/MonitorPinnedEvents.java @@ -0,0 +1,476 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @summary Test JFR jdk.VirtualThreadPinned event recorded for contended monitor enter + * and Object.wait when pinned + * @requires vm.continuations + * @modules jdk.jfr jdk.management + * @library /test/lib + * @run junit/othervm --enable-native-access=ALL-UNNAMED MonitorPinnedEvents + */ + +import java.io.IOException; +import java.io.PrintStream; +import java.nio.file.Path; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import jdk.jfr.Recording; +import jdk.jfr.consumer.RecordedEvent; +import jdk.jfr.consumer.RecordedFrame; +import jdk.jfr.consumer.RecordedMethod; +import jdk.jfr.consumer.RecordedThread; +import jdk.jfr.consumer.RecordingFile; + +import jdk.test.lib.thread.VThreadPinner; +import jdk.test.lib.thread.VThreadRunner; // ensureParallelism requires jdk.management +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; +import static org.junit.jupiter.api.Assertions.*; + +class MonitorPinnedEvents { + // log to System.err so inlined with JUnit output + private static final PrintStream log = System.err; + + // expected values for "blockingOperation" field in event + private static final String CONTENDED_MONITOR_ENTER = "Contended monitor enter"; + private static final String OBJECT_WAIT = "Object.wait"; + + // expected value for "pinnedReason" field in event + private static final String NATIVE_FRAME = "Native or VM frame on stack"; + + // block or wait for 2s to allow minimum event duration be tested + private static final int DELAY = 2000; + + @BeforeAll + static void setup() { + // need at least two carriers to test pinning + VThreadRunner.ensureParallelism(2); + } + + /** + * Test jdk.VirtualThreadPinned recorded for a contended monitor enter. + */ + @Test + void testContentedMonitorEnter() throws Exception { + try (Recording recording = new Recording()) { + recording.enable("jdk.VirtualThreadPinned"); + recording.start(); + + Thread vthread; + try { + Object lock = new Object(); + + synchronized (lock) { + // start virtual thread that blocks trying to acquire monitor while pinned + var ready = new AtomicBoolean(); + vthread = Thread.ofVirtual().start(() -> { + VThreadPinner.runPinned(() -> { + ready.set(true); + synchronized (lock) { // <--- blocks here while pinned + } + }); + }); + await(ready, vthread, Thread.State.BLOCKED); + + // sleep before releasing to ensure virtual thread is blocked for >= 2s + Thread.sleep(DELAY); + } + vthread.join(); + } finally { + recording.stop(); + } + + // jdk.VirtualThreadPinned event should be recorded + RecordedEvent event = findPinnedEvent(recording); + testEvent(event, vthread, CONTENDED_MONITOR_ENTER, NATIVE_FRAME, DELAY); + } + } + + /** + * Test jdk.VirtualThreadPinned recorded for a contended monitor enter where + * another thread may acquire the monitor when the main thread releases it. If + * the other thread acquires the monitor before the virtual thread then the event + * duration should include the time blocked until the other thread releases it. + */ + @Test + void testContentedMonitorEnter2() throws Exception { + try (Recording recording = new Recording()) { + recording.enable("jdk.VirtualThreadPinned"); + recording.start(); + + // the thread that acquires the monitor after the main thread releases it + var nextOwner = new AtomicReference(); + + Thread vthread; + try { + Object lock = new Object(); + Thread thread2; + synchronized (lock) { + + // start virtual thread that blocks trying to acquire monitor while pinned + var ready1 = new AtomicBoolean(); + vthread = Thread.ofVirtual().start(() -> { + VThreadPinner.runPinned(() -> { + ready1.set(true); + synchronized (lock) { // <--- blocks here while pinned + nextOwner.compareAndSet(null, Thread.currentThread()); + } + }); + }); + await(ready1, vthread, Thread.State.BLOCKED); + + // start platform thread that blocks trying to acquire monitor + thread2 = Thread.ofPlatform().start(() -> { + synchronized (lock) { + if (nextOwner.compareAndSet(null, Thread.currentThread())) { + // delayed release of monitor if acquired before virtual thread + try { + Thread.sleep(DELAY); + } catch (InterruptedException e) { + } + } + } + }); + + } // release lock, vthread or thread2 will acquire + + vthread.join(); + thread2.join(); + } finally { + recording.stop(); + } + + // jdk.VirtualThreadPinned event should be recorded. If the platform thread + // acquired the monitor before the virtual thread then the event duration + // should be >= DELAY. + RecordedEvent event = findPinnedEvent(recording); + Thread winner = nextOwner.get(); + assertNotNull(winner); + int minDuration = winner.isVirtual() ? 0 : DELAY; + testEvent(event, vthread, CONTENDED_MONITOR_ENTER, NATIVE_FRAME, minDuration); + } + } + + /** + * Test jdk.VirtualThreadPinned recorded for Object.wait when notified. + */ + @ParameterizedTest + @ValueSource(booleans = { true, false }) + void testObjectWaitNotify(boolean timed) throws Exception { + testObjectWait(timed, false); + } + + /** + * Test jdk.VirtualThreadPinned recorded for Object.wait when interrupted. + */ + @ParameterizedTest + @ValueSource(booleans = { true, false }) + void testObjectWaitInterrupt(boolean timed) throws Exception { + testObjectWait(timed, true); + } + + /** + * Test jdk.VirtualThreadPinned recorded for Object.wait. + * @param timed true for a timed-wait, false for an untimed-wait + * @param interrupt true to interrupt the thread, false to notify + */ + private void testObjectWait(boolean timed, boolean interrupt) throws Exception { + try (Recording recording = new Recording()) { + recording.enable("jdk.VirtualThreadPinned"); + recording.start(); + + Thread vthread; + try { + Object lock = new Object(); + + // start virtual thread that waits in Object.wait while pinned + var ready = new AtomicBoolean(); + vthread = Thread.ofVirtual().start(() -> { + VThreadPinner.runPinned(() -> { + synchronized (lock) { + ready.set(true); + try { + // wait while pinned + if (timed) { + lock.wait(Long.MAX_VALUE); + } else { + lock.wait(); + } + } catch (InterruptedException e) { + } + } + }); + }); + await(ready, vthread, timed ? Thread.State.TIMED_WAITING : Thread.State.WAITING); + + // sleep to ensure virtual thread waits for >= 2s + Thread.sleep(DELAY); + + // interrupt or notify thread so it resumes execution + if (interrupt) { + vthread.interrupt(); + } else { + synchronized (lock) { + lock.notify(); + } + } + vthread.join(); + } finally { + recording.stop(); + } + + // jdk.VirtualThreadPinned event should be recorded + RecordedEvent event = findPinnedEvent(recording); + testEvent(event, vthread, OBJECT_WAIT, NATIVE_FRAME, DELAY); + } + } + + /** + * Test jdk.VirtualThreadPinned recorded for Object.wait where the virtual thread + * is notified but may block when attempting to reenter. One event should be + * recorded. The event duration should include both the waiting time and the time + * blocked to reenter. + */ + @ParameterizedTest + @ValueSource(booleans = { true, false }) + void testObjectWaitNotify2(boolean timed) throws Exception { + testObjectWait2(timed, false); + } + + /** + * Test jdk.VirtualThreadPinned recorded for Object.wait where the virtual thread + * is interrupted but may block when attempting to reenter. One event should be + * recorded. The event duration should include both the waiting time and the time + * blocked to reenter. + */ + @ParameterizedTest + @ValueSource(booleans = { true, false }) + void testObjectWaitInterrupt2(boolean timed) throws Exception { + testObjectWait2(timed, true); + } + + /** + * Test jdk.VirtualThreadPinned recorded for Object.wait where the virtual thread + * blocks when attempting to reenter. + * @param timed true for a timed-wait, false for an untimed-wait + * @param interrupt true to interrupt the thread, false to notify + */ + private void testObjectWait2(boolean timed, boolean interrupt) throws Exception { + try (Recording recording = new Recording()) { + recording.enable("jdk.VirtualThreadPinned"); + recording.start(); + + // the thread that acquires the monitor after the main thread releases it + var nextOwner = new AtomicReference(); + + Thread vthread; + try { + Object lock = new Object(); + + // start virtual thread that waits in Object.wait while pinned + var ready1 = new AtomicBoolean(); + vthread = Thread.ofVirtual().start(() -> { + VThreadPinner.runPinned(() -> { + boolean notify = !interrupt; + synchronized (lock) { + ready1.set(true); + try { + // wait while pinned + if (timed) { + lock.wait(Long.MAX_VALUE); + } else { + lock.wait(); + } + if (notify) { + nextOwner.compareAndSet(null, Thread.currentThread()); + } + } catch (InterruptedException e) { + if (interrupt) { + nextOwner.compareAndSet(null, Thread.currentThread()); + } + } + } + }); + }); + await(ready1, vthread, timed ? Thread.State.TIMED_WAITING : Thread.State.WAITING); + + // platform thread that blocks on monitor enter + Thread thread2; + synchronized (lock) { + thread2 = Thread.ofPlatform().start(() -> { + synchronized (lock) { // <--- blocks here + if (nextOwner.compareAndSet(null, Thread.currentThread())) { + // delayed release of monitor if acquired before virtual thread + try { + Thread.sleep(DELAY); + } catch (InterruptedException e) { + } + } + } + }); + + // interrupt/notify and release monitor to allow one of the threads to acquire + if (interrupt) { + vthread.interrupt(); + } else { + lock.notify(); + } + } + + vthread.join(); + thread2.join(); + + } finally { + recording.stop(); + } + + // jdk.VirtualThreadPinned event should be recorded. If the platform thread + // acquired the monitor before the virtual thread re-entered then the event + // duration should be >= DELAY. + RecordedEvent event = findPinnedEvent(recording); + Thread winner = nextOwner.get(); + assertNotNull(winner); + int minDuration = winner.isVirtual() ? 0 : DELAY; + testEvent(event, vthread, OBJECT_WAIT, NATIVE_FRAME, minDuration); + } + } + + /** + * Test that the event was recorded by the expected virtual thread, the event has a + * "carrierThread", the "blockingOperation", and "pinnedReason" fields have the + * expected values, and the event duration is >= minDuration. + */ + private void testEvent(RecordedEvent event, + Thread vthread, + String expectedBlockingOp, + String expectedPinnedReason, + int minDuration) { + assertTrue(vthread.isVirtual()); + assertEquals(vthread.threadId(), event.getThread().getId()); + + RecordedThread carrier = event.getValue("carrierThread"); + assertFalse(carrier.isVirtual()); + + assertEquals(expectedBlockingOp, event.getString("blockingOperation")); + assertEquals(expectedPinnedReason, event.getString("pinnedReason")); + + long duration = event.getDuration().toMillis(); + assertTrue(duration >= (minDuration - 100), + "Duration " + duration + "ms, expected >= " + minDuration + "ms"); + } + + /** + * Find the expected jdk.VirtualThreadPinned event in the recording. There may be + * several pinned events recorded by other parts of the system that need to be + * filtered out. + */ + private RecordedEvent findPinnedEvent(Recording recording) throws IOException { + Map> events = find(recording, "jdk.VirtualThreadPinned") + .collect(Collectors.partitioningBy(e -> filtered(topFrameMethod(e)), Collectors.toList())); + List filteredEvents = events.get(Boolean.TRUE); + List pinnedEvents = events.get(Boolean.FALSE); + log.format("%d event(s) recorded%n", filteredEvents.size() + pinnedEvents.size()); + log.println("-- filtered events --"); + log.println(filteredEvents); + log.println("-- remaining pinned events --"); + log.println(pinnedEvents); + assertEquals(1, pinnedEvents.size()); + return pinnedEvents.get(0); + } + + /** + * Pinned events recorded at the following classes/methods should be ignored. + */ + private final Set FILTERED = Set.of( + "java.lang.VirtualThread.*", + "java.lang.ref.ReferenceQueue.poll", + "java.lang.invoke.*", + "jdk.internal.ref.*" + ); + + /** + * Returns true if the given top-frame {@code class.method} should be ignored. + */ + private boolean filtered(String topFrameMethod) { + for (String s : FILTERED) { + if (s.endsWith("*")) { + String prefix = s.substring(0, s.length()-1); + if (topFrameMethod.startsWith(prefix)) { + return true; + } + } else if (s.equals(topFrameMethod)) { + return true; + } + } + return false; + } + + /** + * Returns the {@code class.method} of the top frame in the event's stack trace. + */ + private String topFrameMethod(RecordedEvent event) { + RecordedFrame topFrame = event.getStackTrace().getFrames().get(0); + RecordedMethod method = topFrame.getMethod(); + return method.getType().getName() + "." + method.getName(); + } + + /** + * Returns the events with the given name in the recording. + */ + private Stream find(Recording recording, String name) throws IOException { + Path recordingFile = recording.getDestination(); + if (recordingFile == null) { + ProcessHandle h = ProcessHandle.current(); + recordingFile = Path.of("recording-" + recording.getId() + "-pid" + h.pid() + ".jfr"); + recording.dump(recordingFile); + } + return RecordingFile.readAllEvents(recordingFile) + .stream() + .filter(e -> e.getEventType().getName().equals(name)); + } + + /** + * Waits for ready to become true, then waits for the thread to get to the given state. + */ + private void await(AtomicBoolean ready, + Thread thread, + Thread.State expectedState) throws InterruptedException { + while (!ready.get()) { + Thread.sleep(10); + } + Thread.State state = thread.getState(); + while (state != expectedState) { + Thread.sleep(10); + state = thread.getState(); + } + } +} diff --git a/test/jdk/java/lang/Thread/virtual/Starvation.java b/test/jdk/java/lang/Thread/virtual/Starvation.java index c767cffbdf5..0661d6e608e 100644 --- a/test/jdk/java/lang/Thread/virtual/Starvation.java +++ b/test/jdk/java/lang/Thread/virtual/Starvation.java @@ -22,6 +22,7 @@ */ /* @test + * @requires vm.continuations * @library /test/lib * @bug 8345294 * @run main/othervm --enable-native-access=ALL-UNNAMED Starvation 100000 diff --git a/test/jdk/java/lang/instrument/VerifyLocalVariableTableOnRetransformTest.java b/test/jdk/java/lang/instrument/VerifyLocalVariableTableOnRetransformTest.java index fbca4309cf2..01fa761e77b 100644 --- a/test/jdk/java/lang/instrument/VerifyLocalVariableTableOnRetransformTest.java +++ b/test/jdk/java/lang/instrument/VerifyLocalVariableTableOnRetransformTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * 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,6 +55,7 @@ private String fTargetClassName = "DummyClassWithLVT"; private String classFileName = fTargetClassName + ".class"; private boolean fTargetClassSeen; + private Throwable transformerException; /** * Constructor for VerifyLocalVariableTableOnRetransformTest. @@ -109,9 +110,11 @@ public VerifyLocalVariableTableOnRetransformTest(String name) // make an instance to prove the class was really loaded Object testInstance = target.newInstance(); - // With this call here, we will see the target class once: - // when it gets retransformed. - //addTransformerToManager(fInst, new MyObserver(), true); + // check for unexpected errors (see JDK-8311534) + if (transformerException != null) { + transformerException.printStackTrace(); + throw new RuntimeException("Error in transformer" + transformerException); + } assertTrue(fTargetClassName + " was not seen by transform()", fTargetClassSeen); @@ -247,8 +250,20 @@ private void saveMismatchedBytes(byte[] classfileBuffer) { ProtectionDomain protectionDomain, byte[] classfileBuffer) { - System.out.println(this + ".transform() sees '" + className - + "' of " + classfileBuffer.length + " bytes."); + // String concatenation can cause LinkageError or ClassCircularityError (see JDK-8311534). + // Need to log it for analysis. + try { + System.out.println(this + ".transform() sees '" + className + + "' of " + classfileBuffer.length + " bytes."); + } catch (Throwable t) { + // Try to log. Save the error for handling by main thread if the logging fails. + try { + t.printStackTrace(); + } catch (Throwable t1) { + transformerException = t; + } + return null; + } if (className.equals(fTargetClassName)) { fTargetClassSeen = true; diff --git a/test/jdk/java/lang/management/MemoryMXBean/MemoryTest.java b/test/jdk/java/lang/management/MemoryMXBean/MemoryTest.java index 699be54ec89..72c4655b6d8 100644 --- a/test/jdk/java/lang/management/MemoryMXBean/MemoryTest.java +++ b/test/jdk/java/lang/management/MemoryMXBean/MemoryTest.java @@ -46,17 +46,29 @@ */ /* - * @test + * @test id=Shenandoah * @bug 4530538 - * @summary Basic unit test of MemoryMXBean.getMemoryPools() and - * MemoryMXBean.getMemoryManager(). - * @requires vm.gc == "Shenandoah" + * @summary Shenandoah has a gc mgr bean for cycles and another + * for pauses, they both have one pool. + * @requires vm.gc == "Shenandoah" & vm.opt.ShenandoahGCMode != "generational" * @author Mandy Chung * * @modules jdk.management * @run main MemoryTest 2 1 */ +/* + * @test id=Genshen + * @bug 4530538 + * @summary Shenandoah's generational mode has a gc mgr bean for cycles + * and another for pauses. They both reference the young and old pools. + * @requires vm.gc == "Shenandoah" & vm.opt.ShenandoahGCMode == "generational" + * @author Mandy Chung + * + * @modules jdk.management + * @run main MemoryTest 2 2 + */ + /* * @test * @bug 4530538 diff --git a/test/jdk/java/net/Socket/ConnectFailTest.java b/test/jdk/java/net/Socket/ConnectFailTest.java index 7cc46ce4a4d..f21ed7d132d 100644 --- a/test/jdk/java/net/Socket/ConnectFailTest.java +++ b/test/jdk/java/net/Socket/ConnectFailTest.java @@ -29,6 +29,7 @@ import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; +import java.net.Proxy; import java.net.ServerSocket; import java.net.Socket; import java.net.SocketException; @@ -36,6 +37,7 @@ import java.nio.channels.SocketChannel; import java.util.List; +import static java.net.InetAddress.getLoopbackAddress; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -50,6 +52,8 @@ */ class ConnectFailTest { + // Implementation Note: Explicitly binding on the loopback address to avoid potential unstabilities. + private static final int DEAD_SERVER_PORT = 0xDEAD; private static final InetSocketAddress REFUSING_SOCKET_ADDRESS = Utils.refusingEndpoint(); @@ -83,7 +87,7 @@ void testUnboundSocket(Socket socket) throws IOException { @MethodSource("sockets") void testBoundSocket(Socket socket) throws IOException { try (socket) { - socket.bind(new InetSocketAddress(0)); + socket.bind(new InetSocketAddress(getLoopbackAddress(), 0)); assertTrue(socket.isBound()); assertFalse(socket.isConnected()); assertThrows(IOException.class, () -> socket.connect(REFUSING_SOCKET_ADDRESS)); @@ -132,7 +136,7 @@ void testUnboundSocketWithUnresolvedAddress(Socket socket) throws IOException { @MethodSource("sockets") void testBoundSocketWithUnresolvedAddress(Socket socket) throws IOException { try (socket) { - socket.bind(new InetSocketAddress(0)); + socket.bind(new InetSocketAddress(getLoopbackAddress(), 0)); assertTrue(socket.isBound()); assertFalse(socket.isConnected()); assertThrows(UnknownHostException.class, () -> socket.connect(UNRESOLVED_ADDRESS)); @@ -161,7 +165,8 @@ static List sockets() throws Exception { Socket socket = new Socket(); @SuppressWarnings("resource") Socket channelSocket = SocketChannel.open().socket(); - return List.of(socket, channelSocket); + Socket noProxySocket = new Socket(Proxy.NO_PROXY); + return List.of(socket, channelSocket, noProxySocket); } private static ServerSocket createEphemeralServerSocket() throws IOException { diff --git a/test/jdk/java/net/Socket/ConnectSocksProxyTest.java b/test/jdk/java/net/Socket/ConnectSocksProxyTest.java new file mode 100644 index 00000000000..8bea5ff816e --- /dev/null +++ b/test/jdk/java/net/Socket/ConnectSocksProxyTest.java @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import jdk.test.lib.Utils; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import java.io.IOException; +import java.net.Authenticator; +import java.net.InetSocketAddress; +import java.net.PasswordAuthentication; +import java.net.Proxy; +import java.net.ServerSocket; +import java.net.Socket; +import java.net.SocketException; + +import static java.net.InetAddress.getLoopbackAddress; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/* + * @test + * @bug 8346017 + * @summary Verifies the `connect()` behaviour of a SOCKS proxy socket. In particular, that passing a resolvable + * unresolved address doesn't throw an exception. + * @library /test/lib /java/net/Socks + * @build SocksServer + * @run junit ConnectSocksProxyTest + */ +class ConnectSocksProxyTest { + + // Implementation Note: Explicitly binding on the loopback address to avoid potential unstabilities. + + private static final int DEAD_SERVER_PORT = 0xDEAD; + + private static final InetSocketAddress REFUSING_SOCKET_ADDRESS = Utils.refusingEndpoint(); + + private static final InetSocketAddress UNRESOLVED_ADDRESS = + InetSocketAddress.createUnresolved("no.such.host", DEAD_SERVER_PORT); + + private static final String PROXY_AUTH_USERNAME = "foo"; + + private static final String PROXY_AUTH_PASSWORD = "bar"; + + private static SocksServer PROXY_SERVER; + + private static Proxy PROXY; + + @BeforeAll + static void initAuthenticator() { + Authenticator.setDefault(new Authenticator() { + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(PROXY_AUTH_USERNAME, PROXY_AUTH_PASSWORD.toCharArray()); + } + }); + } + + @BeforeAll + static void initProxyServer() throws IOException { + PROXY_SERVER = new SocksServer(getLoopbackAddress(), 0, false); + PROXY_SERVER.addUser(PROXY_AUTH_USERNAME, PROXY_AUTH_PASSWORD); + PROXY_SERVER.start(); + InetSocketAddress proxyAddress = new InetSocketAddress(getLoopbackAddress(), PROXY_SERVER.getPort()); + PROXY = new Proxy(Proxy.Type.SOCKS, proxyAddress); + } + + @AfterAll + static void stopProxyServer() { + PROXY_SERVER.close(); + } + + @Test + void testUnresolvedAddress() { + assertTrue(UNRESOLVED_ADDRESS.isUnresolved()); + } + + /** + * Verifies that an unbound socket is closed when {@code connect()} fails. + */ + @Test + void testUnboundSocket() throws IOException { + try (Socket socket = createProxiedSocket()) { + assertFalse(socket.isBound()); + assertFalse(socket.isConnected()); + assertThrows(IOException.class, () -> socket.connect(REFUSING_SOCKET_ADDRESS)); + assertTrue(socket.isClosed()); + } + } + + /** + * Verifies that a bound socket is closed when {@code connect()} fails. + */ + @Test + void testBoundSocket() throws IOException { + try (Socket socket = createProxiedSocket()) { + socket.bind(new InetSocketAddress(getLoopbackAddress(), 0)); + assertTrue(socket.isBound()); + assertFalse(socket.isConnected()); + assertThrows(IOException.class, () -> socket.connect(REFUSING_SOCKET_ADDRESS)); + assertTrue(socket.isClosed()); + } + } + + /** + * Verifies that a connected socket is not closed when {@code connect()} fails. + */ + @Test + void testConnectedSocket() throws Throwable { + try (Socket socket = createProxiedSocket(); + ServerSocket serverSocket = createEphemeralServerSocket()) { + socket.connect(serverSocket.getLocalSocketAddress()); + try (Socket _ = serverSocket.accept()) { + assertTrue(socket.isBound()); + assertTrue(socket.isConnected()); + SocketException exception = assertThrows( + SocketException.class, + () -> socket.connect(REFUSING_SOCKET_ADDRESS)); + assertEquals("Already connected", exception.getMessage()); + assertFalse(socket.isClosed()); + } + } + } + + /** + * Delegates to {@link #testUnconnectedSocketWithUnresolvedAddress(boolean, Socket)} using an unbound socket. + */ + @Test + void testUnboundSocketWithUnresolvedAddress() throws IOException { + try (Socket socket = createProxiedSocket()) { + assertFalse(socket.isBound()); + assertFalse(socket.isConnected()); + testUnconnectedSocketWithUnresolvedAddress(false, socket); + } + } + + /** + * Delegates to {@link #testUnconnectedSocketWithUnresolvedAddress(boolean, Socket)} using a bound socket. + */ + @Test + void testBoundSocketWithUnresolvedAddress() throws IOException { + try (Socket socket = createProxiedSocket()) { + socket.bind(new InetSocketAddress(getLoopbackAddress(), 0)); + testUnconnectedSocketWithUnresolvedAddress(true, socket); + } + } + + /** + * Verifies the behaviour of an unconnected socket when {@code connect()} is invoked using an unresolved address. + */ + private static void testUnconnectedSocketWithUnresolvedAddress(boolean bound, Socket socket) throws IOException { + assertEquals(bound, socket.isBound()); + assertFalse(socket.isConnected()); + try (ServerSocket serverSocket = createEphemeralServerSocket()) { + InetSocketAddress unresolvedAddress = InetSocketAddress.createUnresolved( + getLoopbackAddress().getHostAddress(), + serverSocket.getLocalPort()); + socket.connect(unresolvedAddress); + try (Socket _ = serverSocket.accept()) { + assertTrue(socket.isBound()); + assertTrue(socket.isConnected()); + assertFalse(socket.isClosed()); + } + } + } + + /** + * Verifies that a connected socket is not closed when {@code connect()} is invoked using an unresolved address. + */ + @Test + void testConnectedSocketWithUnresolvedAddress() throws Throwable { + try (Socket socket = createProxiedSocket(); + ServerSocket serverSocket = createEphemeralServerSocket()) { + socket.connect(serverSocket.getLocalSocketAddress()); + try (Socket _ = serverSocket.accept()) { + assertTrue(socket.isBound()); + assertTrue(socket.isConnected()); + SocketException exception = assertThrows( + SocketException.class, + () -> socket.connect(UNRESOLVED_ADDRESS)); + assertEquals("Already connected", exception.getMessage()); + assertFalse(socket.isClosed()); + } + } + } + + private static Socket createProxiedSocket() { + return new Socket(PROXY); + } + + private static ServerSocket createEphemeralServerSocket() throws IOException { + return new ServerSocket(0, 0, getLoopbackAddress()); + } + +} diff --git a/test/jdk/java/net/UnixDomainSocketAddress/AddressTest.java b/test/jdk/java/net/UnixDomainSocketAddress/AddressTest.java index 80bc3ae1033..ba55eac46df 100644 --- a/test/jdk/java/net/UnixDomainSocketAddress/AddressTest.java +++ b/test/jdk/java/net/UnixDomainSocketAddress/AddressTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * 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,7 +24,7 @@ /** * @test * @bug 8231358 - * @compile ../../nio/file/spi/TestProvider.java AddressTest.java + * @compile ../../nio/file/spi/testfsp/testfsp/TestProvider.java AddressTest.java * @run testng/othervm AddressTest */ @@ -51,8 +51,8 @@ public class AddressTest { @Test public static void runTest() throws Exception { - TestProvider prov = new TestProvider(FileSystems.getDefault().provider()); - Path path = prov.getPath(URI.create("file:/")); + var fsp = new testfsp.TestProvider(FileSystems.getDefault().provider()); + Path path = fsp.getPath(URI.create("file:/")); assertThrows(IAE, () -> UnixDomainSocketAddress.of(path)); } } diff --git a/test/jdk/java/nio/file/spi/SetDefaultProvider.java b/test/jdk/java/nio/file/spi/SetDefaultProvider.java index 034d6ed6ebd..a8581dc0e7a 100644 --- a/test/jdk/java/nio/file/spi/SetDefaultProvider.java +++ b/test/jdk/java/nio/file/spi/SetDefaultProvider.java @@ -21,13 +21,13 @@ * questions. */ -/** +/* * @test * @bug 4313887 7006126 8142968 8178380 8183320 8210112 8266345 8263940 - * @modules jdk.jartool + * @modules jdk.jartool jdk.jlink * @library /test/lib - * @build SetDefaultProvider TestProvider m/* jdk.test.lib.process.ProcessTools - * @run testng/othervm SetDefaultProvider + * @build testfsp/* testapp/* + * @run junit SetDefaultProvider * @summary Runs tests with -Djava.nio.file.spi.DefaultFileSystemProvider set on * the command line to override the default file system provider */ @@ -37,173 +37,224 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Arrays; import java.util.ArrayList; import java.util.List; import java.util.spi.ToolProvider; import java.util.stream.Stream; import jdk.test.lib.process.ProcessTools; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.BeforeAll; +import static org.junit.jupiter.api.Assertions.*; -import org.testng.annotations.Test; -import static org.testng.Assert.*; - -@Test -public class SetDefaultProvider { +class SetDefaultProvider { private static final String SET_DEFAULT_FSP = - "-Djava.nio.file.spi.DefaultFileSystemProvider=TestProvider"; + "-Djava.nio.file.spi.DefaultFileSystemProvider=testfsp.TestProvider"; private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar") .orElseThrow(() -> new RuntimeException("jar tool not found") ); - private static Path createTempDirectory(String prefix) throws IOException { - Path testDir = Paths.get(System.getProperty("test.dir", ".")); - return Files.createTempDirectory(testDir, prefix); + private static final String TESTFSP = "testfsp"; + private static final String TESTAPP = "testapp"; + private static final String TESTAPP_MAIN = TESTAPP + ".Main"; + + // directory containing testfsp class files + private static String TESTFSP_CLASSES; + + // directory containing testapp class files + private static String TESTAPP_CLASSES; + + @BeforeAll + static void setup() { + TESTFSP_CLASSES = classes(TESTFSP); + TESTAPP_CLASSES = classes(TESTAPP); } /** - * Test override of default FileSystemProvider with the main application - * on the class path. + * Test file system provider exploded on the class path. */ - public void testClassPath() throws Exception { - String moduleClasses = moduleClasses(); - String testClasses = System.getProperty("test.classes"); - String classpath = moduleClasses + File.pathSeparator + testClasses; - int exitValue = exec(SET_DEFAULT_FSP, "-cp", classpath, "p.Main"); - assertEquals(exitValue, 0); + @Test + void testFspOnClassPath1() throws Exception { + exec(SET_DEFAULT_FSP, + "-cp", ofClasspath(TESTFSP_CLASSES, TESTAPP_CLASSES), + TESTAPP_MAIN); } /** - * Test override of default FileSystemProvider with a - * FileSystemProvider jar and the main application on the class path. + * Test file system provider in JAR file on the class path. */ - public void testClassPathWithFileSystemProviderJar() throws Exception { - String testClasses = System.getProperty("test.classes"); - Path jar = Path.of("testFileSystemProvider.jar"); - Files.deleteIfExists(jar); - createFileSystemProviderJar(jar, Path.of(testClasses)); - String classpath = jar + File.pathSeparator + testClasses - + File.separator + "modules" + File.separator + "m"; - int exitValue = exec(SET_DEFAULT_FSP, "-cp", classpath, "p.Main"); - assertEquals(exitValue, 0); + @Test + void testFspOnClassPath2() throws Exception { + String jarFile = createJar("fsp.jar", TESTFSP_CLASSES); + exec(SET_DEFAULT_FSP, + "-cp", ofClasspath(jarFile, TESTAPP_CLASSES), + TESTAPP_MAIN); } /** - * Creates a JAR containing the FileSystemProvider used to override the - * default FileSystemProvider + * Test file system provider in exploded module on the module path. */ - private void createFileSystemProviderJar(Path jar, Path dir) throws IOException { + @Test + void testFspOnModulePath1() throws Exception { + exec(SET_DEFAULT_FSP, + "-p", TESTFSP_CLASSES, + "--add-modules", TESTFSP, + "-cp", TESTAPP_CLASSES, + TESTAPP_MAIN); + } - List args = new ArrayList<>(); - args.add("--create"); - args.add("--file=" + jar); - try (Stream stream = Files.list(dir)) { - List paths = stream - .map(path -> path.getFileName().toString()) - .filter(f -> f.startsWith("TestProvider")) - .toList(); - for(var p : paths) { - args.add("-C"); - args.add(dir.toString()); - args.add(p); - } - } - int ret = JAR_TOOL.run(System.out, System.out, args.toArray(new String[0])); - assertEquals(ret, 0); + /** + * Test file system provider in modular JAR on the module path. + */ + @Test + void testFspOnModulePath2() throws Exception { + String jarFile = createJar("fsp.jar", TESTFSP_CLASSES); + exec(SET_DEFAULT_FSP, + "-p", jarFile, + "--add-modules", TESTFSP, + "-cp", TESTAPP_CLASSES, + TESTAPP_MAIN); } /** - * Test override of default FileSystemProvider with the main application - * on the module path as an exploded module. + * Test file system provider linked into run-time image. */ - public void testExplodedModule() throws Exception { - String modulePath = System.getProperty("jdk.module.path"); - int exitValue = exec(SET_DEFAULT_FSP, "-p", modulePath, "-m", "m/p.Main"); - assertEquals(exitValue, 0); + @Disabled + @Test + void testFspInRuntimeImage() throws Exception { + String image = "image"; + + ToolProvider jlink = ToolProvider.findFirst("jlink").orElseThrow(); + String[] jlinkCmd = { + "--module-path", TESTFSP_CLASSES, + "--add-modules", TESTFSP, + "--output", image + }; + int exitCode = jlink.run(System.out, System.err, jlinkCmd); + assertEquals(0, exitCode); + + String[] javaCmd = { + Path.of(image, "bin", "java").toString(), + SET_DEFAULT_FSP, + "--add-modules", TESTFSP, + "-cp", TESTAPP_CLASSES, + TESTAPP_MAIN + }; + var pb = new ProcessBuilder(javaCmd); + ProcessTools.executeProcess(pb) + .outputTo(System.out) + .errorTo(System.err) + .shouldHaveExitValue(0); } /** - * Test override of default FileSystemProvider with the main application - * on the module path as a modular JAR. + * Test file system provider on class path, application in exploded module on module path. */ - public void testModularJar() throws Exception { - String jarFile = createModularJar(); - int exitValue = exec(SET_DEFAULT_FSP, "-p", jarFile, "-m", "m/p.Main"); - assertEquals(exitValue, 0); + @Test + void testAppOnModulePath1() throws Exception { + exec(SET_DEFAULT_FSP, + "-p", TESTAPP_CLASSES, + "-cp", TESTFSP_CLASSES, + "-m", TESTAPP + "/" + TESTAPP_MAIN); } /** - * Test override of default FileSystemProvider where the main application - * is a module that is patched by an exploded patch. + * Test file system provider on class path, application in modular JAR on module path. */ - public void testExplodedModuleWithExplodedPatch() throws Exception { + @Test + void testAppOnModulePath2() throws Exception { + String jarFile = createJar("testapp.jar", TESTAPP_CLASSES); + exec(SET_DEFAULT_FSP, + "-cp", TESTFSP_CLASSES, + "-p", jarFile, + "-m", TESTAPP + "/" + TESTAPP_MAIN); + } + + /** + * Test file system provider on class path, application in modular JAR on module path + * that is patched with exploded patch. + */ + @Test + void testPatchedAppOnModulePath1() throws Exception { Path patchdir = createTempDirectory("patch"); - String modulePath = System.getProperty("jdk.module.path"); - int exitValue = exec(SET_DEFAULT_FSP, - "--patch-module", "m=" + patchdir, - "-p", modulePath, - "-m", "m/p.Main"); - assertEquals(exitValue, 0); + Files.createFile(patchdir.resolve("aoo.properties")); + exec(SET_DEFAULT_FSP, + "--patch-module", TESTAPP + "=" + patchdir, + "-p", TESTAPP_CLASSES, + "-cp", TESTFSP_CLASSES, + "-m", TESTAPP + "/" + TESTAPP_MAIN); } /** - * Test override of default FileSystemProvider where the main application - * is a module that is patched by an exploded patch. + * Test file system provider on class path, application in modular JAR on module path + * that is patched with patch in JAR file. */ - public void testExplodedModuleWithJarPatch() throws Exception { + @Test + void testPatchedAppOnModulePath2() throws Exception { Path patchdir = createTempDirectory("patch"); - Files.createDirectory(patchdir.resolve("m.properties")); - Path patch = createJarFile(patchdir); - String modulePath = System.getProperty("jdk.module.path"); - int exitValue = exec(SET_DEFAULT_FSP, - "--patch-module", "m=" + patch, - "-p", modulePath, - "-m", "m/p.Main"); - assertEquals(exitValue, 0); + Files.createFile(patchdir.resolve("app.properties")); + String jarFile = createJar("patch.jar", patchdir.toString()); + exec(SET_DEFAULT_FSP, + "--patch-module", TESTAPP + "=" + jarFile, + "-p", TESTAPP_CLASSES, + "-cp", TESTFSP_CLASSES, + "-m", TESTAPP + "/" + TESTAPP_MAIN); } /** - * Returns the directory containing the classes for module "m". + * Returns the directory containing the classes for the given module. */ - private String moduleClasses() { + private static String classes(String mn) { String mp = System.getProperty("jdk.module.path"); - for (String dir : mp.split(File.pathSeparator)) { - Path m = Paths.get(dir, "m"); - if (Files.exists(m)) return m.toString(); - } - fail(); - return null; + return Arrays.stream(mp.split(File.pathSeparator)) + .map(e -> Path.of(e, mn)) + .filter(Files::isDirectory) + .findAny() + .map(Path::toString) + .orElseThrow(); } /** - * Creates a modular JAR containing module "m". + * Returns a class path from the given paths. */ - private String createModularJar() throws Exception { - Path dir = Paths.get(moduleClasses()); - Path jar = createJarFile(dir); - return jar.toString(); + private String ofClasspath(String... paths) { + return String.join(File.pathSeparator, paths); } /** - * Creates a JAR file containing the entries in the given file tree. + * Creates a JAR file from the contains of the given directory. */ - private Path createJarFile(Path dir) throws Exception { - Path jar = createTempDirectory("tmp").resolve("m.jar"); - String[] args = { "--create", "--file=" + jar, "-C", dir.toString(), "." }; - int ret = JAR_TOOL.run(System.out, System.out, args); + private String createJar(String jar, String dir) throws IOException { + List args = new ArrayList<>(); + args.add("--create"); + args.add("--file=" + jar); + args.add("-C"); + args.add(dir); + args.add("."); + int ret = JAR_TOOL.run(System.err, System.err, args.toArray(new String[0])); assertEquals(ret, 0); return jar; } /** - * Invokes the java launcher with the given arguments, returning the exit code. + * Create a temporary directory with the given prefix in the current directory. */ - private int exec(String... args) throws Exception { - return ProcessTools.executeTestJava(args) - .outputTo(System.out) - .errorTo(System.out) - .getExitValue(); + private static Path createTempDirectory(String prefix) throws IOException { + return Files.createTempDirectory(Path.of("."), prefix); + } + + /** + * Invokes the java launcher with the given arguments, throws if the non-0 is returned. + */ + private void exec(String... args) throws Exception { + ProcessTools.executeTestJava(args) + .outputTo(System.err) + .errorTo(System.err) + .shouldHaveExitValue(0); } } diff --git a/test/jdk/java/nio/file/spi/TestDelegation.java b/test/jdk/java/nio/file/spi/TestDelegation.java index 348318a2462..0b9bc9de7f7 100644 --- a/test/jdk/java/nio/file/spi/TestDelegation.java +++ b/test/jdk/java/nio/file/spi/TestDelegation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * 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,8 +41,8 @@ * @test * @summary Verifies that a FileSystemProvider's implementation of the exists * and readAttributesIfExists methods are invoked - * @build TestDelegation TestProvider - * @run testng/othervm TestDelegation + * @compile testfsp/testfsp/TestProvider.java + * @run testng TestDelegation */ public class TestDelegation { @@ -55,7 +55,6 @@ public class TestDelegation { // The FileSystemProvider used by the test private MyProvider myProvider; - /** * Create the FileSystemProvider, the FileSystem and * Path's used by the test. @@ -182,7 +181,7 @@ public void testIsRegularFile(Path p, boolean isFile) { /** * The FileSystemProvider implementation used by the test */ - static class MyProvider extends TestProvider { + static class MyProvider extends testfsp.TestProvider { private final Map> calls = new HashMap<>(); private MyProvider() { diff --git a/test/jdk/java/nio/file/spi/m/module-info.java b/test/jdk/java/nio/file/spi/testapp/module-info.java similarity index 90% rename from test/jdk/java/nio/file/spi/m/module-info.java rename to test/jdk/java/nio/file/spi/testapp/module-info.java index 84480470711..9b8e30c73a6 100644 --- a/test/jdk/java/nio/file/spi/m/module-info.java +++ b/test/jdk/java/nio/file/spi/testapp/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -20,5 +20,5 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -module m { +module testapp { } diff --git a/test/jdk/java/nio/file/spi/m/p/Main.java b/test/jdk/java/nio/file/spi/testapp/testapp/Main.java similarity index 95% rename from test/jdk/java/nio/file/spi/m/p/Main.java rename to test/jdk/java/nio/file/spi/testapp/testapp/Main.java index 4704c679021..f9c3b1e273e 100644 --- a/test/jdk/java/nio/file/spi/m/p/Main.java +++ b/test/jdk/java/nio/file/spi/testapp/testapp/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -package p; +package testapp; import java.io.File; import java.nio.file.FileSystem; diff --git a/test/jdk/java/nio/file/spi/testfsp/module-info.java b/test/jdk/java/nio/file/spi/testfsp/module-info.java new file mode 100644 index 00000000000..d15cf8dfb88 --- /dev/null +++ b/test/jdk/java/nio/file/spi/testfsp/module-info.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +module testfsp { + exports testfsp to java.base; +} diff --git a/test/jdk/java/nio/file/spi/TestProvider.java b/test/jdk/java/nio/file/spi/testfsp/testfsp/TestProvider.java similarity index 99% rename from test/jdk/java/nio/file/spi/TestProvider.java rename to test/jdk/java/nio/file/spi/testfsp/testfsp/TestProvider.java index 27340e46543..54d6a58c4f9 100644 --- a/test/jdk/java/nio/file/spi/TestProvider.java +++ b/test/jdk/java/nio/file/spi/testfsp/testfsp/TestProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,6 +21,8 @@ * questions. */ +package testfsp; + import java.io.File; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; diff --git a/test/jdk/java/time/tck/java/time/TCKZoneId.java b/test/jdk/java/time/tck/java/time/TCKZoneId.java index a1d0065d39e..1e2d3872451 100644 --- a/test/jdk/java/time/tck/java/time/TCKZoneId.java +++ b/test/jdk/java/time/tck/java/time/TCKZoneId.java @@ -96,6 +96,7 @@ public class TCKZoneId extends AbstractTCKTest { //----------------------------------------------------------------------- // SHORT_IDS //----------------------------------------------------------------------- + @Test public void test_constant_OLD_IDS_POST_2024b() { Map ids = ZoneId.SHORT_IDS; assertEquals(ids.get("EST"), "America/Panama"); diff --git a/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java b/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java index ea20840d862..bc5ddb4b627 100644 --- a/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java +++ b/test/jdk/javax/swing/JScrollBar/4865918/bug4865918.java @@ -31,10 +31,13 @@ import java.awt.Dimension; import java.awt.Robot; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; import javax.swing.JFrame; import javax.swing.JScrollBar; import javax.swing.SwingUtilities; -import java.awt.event.MouseEvent; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import java.util.Date; @@ -42,6 +45,7 @@ public class bug4865918 { private static TestScrollBar sbar; private static JFrame frame; + private static final CountDownLatch mousePressLatch = new CountDownLatch(1); public static void main(String[] argv) throws Exception { try { @@ -52,6 +56,9 @@ public static void main(String[] argv) throws Exception { robot.delay(1000); SwingUtilities.invokeAndWait(() -> sbar.pressMouse()); + if (!mousePressLatch.await(2, TimeUnit.SECONDS)) { + throw new RuntimeException("Timed out waiting for mouse press"); + } robot.waitForIdle(); robot.delay(200); @@ -81,6 +88,11 @@ private static void createAndShowGUI() { sbar = new TestScrollBar(JScrollBar.HORIZONTAL, -1, 10, -100, 100); sbar.setPreferredSize(new Dimension(200, 20)); sbar.setBlockIncrement(10); + sbar.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + mousePressLatch.countDown(); + } + }); frame.getContentPane().add(sbar); frame.pack(); diff --git a/test/jdk/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java b/test/jdk/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java index 980a9c9f528..819ba52d270 100644 --- a/test/jdk/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java +++ b/test/jdk/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java @@ -49,6 +49,7 @@ public class bug4278839 { private static JFrame frame; public static void main(String[] args) throws Exception { + int caret; try { robo = new Robot(); @@ -61,24 +62,67 @@ public static void main(String[] args) throws Exception { clickMouse(); robo.waitForIdle(); + robo.delay(250); area.setCaretPosition(0); robo.waitForIdle(); + robo.delay(250); - passed &= moveCaret(true) == 1; - passed &= moveCaret(true) == 5; - passed &= moveCaret(true) == 8; - passed &= moveCaret(true) == 9; - passed &= moveCaret(true) == 13; - passed &= moveCaret(true) == 16; - passed &= moveCaret(true) == 17; - passed &= moveCaret(false) == 16; - passed &= moveCaret(false) == 13; - passed &= moveCaret(false) == 9; - passed &= moveCaret(false) == 8; - passed &= moveCaret(false) == 5; - passed &= moveCaret(false) == 1; - passed &= moveCaret(false) == 0; + passed &= (caret = moveCaret(true)) == 1; + System.out.println(" passed " + passed + + " Expected position 1 actual position " + caret); + + passed &= (caret = moveCaret(true)) == 5; + System.out.println(" passed " + passed + + " Expected position 5 actual position " + caret); + + passed &= (caret = moveCaret(true)) == 8; + System.out.println(" passed " + passed + + " Expected position 8 actual position " + caret); + + passed &= (caret = moveCaret(true)) == 9; + System.out.println(" passed " + passed + + " Expected position 9 actual position " + caret); + + passed &= (caret = moveCaret(true)) == 13; + System.out.println(" passed " + passed + + " Expected position 13 actual position " + caret); + + passed &= (caret = moveCaret(true)) == 16; + System.out.println(" passed " + passed + + " Expected position 16 actual position " + caret); + + passed &= (caret = moveCaret(true)) == 17; + System.out.println(" passed " + passed + + " Expected position 17 actual position " + caret); + + passed &= (caret = moveCaret(false)) == 16; + System.out.println(" passed " + passed + + " Expected position 16 actual position " + caret); + + passed &= (caret = moveCaret(false)) == 13; + System.out.println(" passed " + passed + + " Expected position 13 actual position " + caret); + + passed &= (caret = moveCaret(false)) == 9; + System.out.println(" passed " + passed + + " Expected position 9 actual position " + caret); + + passed &= (caret = moveCaret(false)) == 8; + System.out.println(" passed " + passed + + " Expected position 8 actual position " + caret); + + passed &= (caret = moveCaret(false)) == 5; + System.out.println(" passed " + passed + + " Expected position 5 actual position " + caret); + + passed &= (caret = moveCaret(false)) == 1; + System.out.println(" passed " + passed + + " Expected position 1 actual position " + caret); + + passed &= (caret = moveCaret(false)) == 0; + System.out.println(" passed " + passed + + " Expected position 0 actual position " + caret); } catch (Exception e) { throw new RuntimeException("Test failed because of an exception:", @@ -98,6 +142,7 @@ private static int moveCaret(boolean right) throws Exception { Util.hitKeys(robo, getCtrlKey(), right ? KeyEvent.VK_RIGHT : KeyEvent.VK_LEFT); robo.waitForIdle(); + robo.delay(250); final int[] result = new int[1]; diff --git a/test/jdk/javax/swing/text/StyledEditorKit/4506788/bug4506788.java b/test/jdk/javax/swing/text/StyledEditorKit/4506788/bug4506788.java index e7c31a26d0f..1df40e5714e 100644 --- a/test/jdk/javax/swing/text/StyledEditorKit/4506788/bug4506788.java +++ b/test/jdk/javax/swing/text/StyledEditorKit/4506788/bug4506788.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * 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,98 +29,85 @@ * @run main bug4506788 */ -import java.awt.*; -import java.awt.event.*; -import java.lang.reflect.InvocationTargetException; -import javax.swing.*; -import javax.swing.event.*; -import javax.swing.text.*; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.KeyEvent; +import java.awt.event.InputEvent; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import javax.swing.event.CaretEvent; +import javax.swing.event.CaretListener; +import javax.swing.text.DefaultStyledDocument; +import javax.swing.text.MutableAttributeSet; +import javax.swing.text.SimpleAttributeSet; +import javax.swing.text.StyleConstants; +import javax.swing.text.StyledEditorKit; public class bug4506788 { - private volatile boolean passed = false; - private JEditorPane jep; + private static volatile boolean passed; + private static volatile Point p; + private static volatile Dimension dim; + private static JEditorPane jep; + private static JFrame f; - public static void main(final String[] args) { - bug4506788 app = new bug4506788(); - app.init(); - app.start(); - } - - public void init() { - try { - SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - createAndShowGUI(); - } - }); - } catch (InterruptedException | InvocationTargetException ex) { - ex.printStackTrace(); - throw new RuntimeException("FAILED: SwingUtilities.invokeAndWait method failed then creating and showing GUI"); - } - } - - public void start() { - Robot robot; + public static void main(final String[] args) throws Exception { try { - robot = new Robot(); + Robot robot = new Robot(); robot.setAutoDelay(100); - } catch (AWTException e) { - throw new RuntimeException("Robot could not be created"); - } - - robot.waitForIdle(); - - Point p; - try { - p = getJEPLocOnScreen(); - } catch (Exception e) { - throw new RuntimeException("Could not get JEditorPane location on screen"); - } - - robot.mouseMove(p.x, p.y); - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.mouseRelease(InputEvent.BUTTON1_MASK); - robot.keyPress(KeyEvent.VK_HOME); - robot.keyRelease(KeyEvent.VK_HOME); - robot.keyPress(KeyEvent.VK_RIGHT); - robot.keyRelease(KeyEvent.VK_RIGHT); - robot.keyPress(KeyEvent.VK_X); - robot.keyRelease(KeyEvent.VK_X); - robot.keyPress(KeyEvent.VK_RIGHT); - robot.keyRelease(KeyEvent.VK_RIGHT); - - robot.waitForIdle(); - if (!passed) { - throw new RuntimeException("Test failed."); - } - } + SwingUtilities.invokeAndWait(() -> createAndShowGUI()); - private Point getJEPLocOnScreen() throws Exception { + robot.waitForIdle(); + robot.delay(1000); - final Point[] result = new Point[1]; + SwingUtilities.invokeAndWait(() -> { + p = jep.getLocationOnScreen(); + dim = jep.getSize(); + }); - SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - result[0] = jep.getLocationOnScreen(); + robot.mouseMove(p.x + dim.width / 2, p.y + dim.height / 2); + robot.waitForIdle(); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_HOME); + robot.keyRelease(KeyEvent.VK_HOME); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_RIGHT); + robot.keyRelease(KeyEvent.VK_RIGHT); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_X); + robot.keyRelease(KeyEvent.VK_X); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_RIGHT); + robot.keyRelease(KeyEvent.VK_RIGHT); + robot.waitForIdle(); + + if (!passed) { + throw new RuntimeException("Test failed."); } - }); - - return result[0]; + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } } - private void createAndShowGUI() { + private static void createAndShowGUI() { jep = new JEditorPane(); String text = "abc"; - JFrame f = new JFrame(); + f = new JFrame("bug4506788"); jep.setEditorKit(new StyledEditorKit()); jep.setText(text); jep.addCaretListener(new CaretListener() { @Override public void caretUpdate(CaretEvent e) { + System.out.println("getDot " + e.getDot()); passed = (e.getDot() == 3); } }); diff --git a/test/jdk/javax/xml/crypto/dsig/GenerationTests.java b/test/jdk/javax/xml/crypto/dsig/GenerationTests.java index 7ab2c7f4e93..668a5a50a0a 100644 --- a/test/jdk/javax/xml/crypto/dsig/GenerationTests.java +++ b/test/jdk/javax/xml/crypto/dsig/GenerationTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * 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,7 +24,7 @@ /** * @test * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349 8046949 - * 8046724 8079693 8177334 8205507 8210736 8217878 8241306 8305972 + * 8046724 8079693 8177334 8205507 8210736 8217878 8241306 8305972 8344137 * @summary Basic unit tests for generating XML Signatures with JSR 105 * @modules java.base/sun.security.util * java.base/sun.security.x509 @@ -99,6 +99,7 @@ public class GenerationTests { private static SignatureMethod dsaSha1, dsaSha256, rsaSha1, rsaSha224, rsaSha256, rsaSha384, rsaSha512, ecdsaSha1, ecdsaSha224, ecdsaSha256, ecdsaSha384, ecdsaSha512, + ecdsaSha3_224, ecdsaSha3_256, ecdsaSha3_384, ecdsaSha3_512, hmacSha1, hmacSha224, hmacSha256, hmacSha384, hmacSha512, rsaSha1mgf1, rsaSha224mgf1, rsaSha256mgf1, rsaSha384mgf1, rsaSha512mgf1, rsaSha3_224mgf1, rsaSha3_256mgf1, rsaSha3_384mgf1, rsaSha3_512mgf1, @@ -244,9 +245,9 @@ public class GenerationTests { }) .toArray(String[]::new); - // As of JDK 22, the number of defined algorithms are... + // As of JDK 25, the number of defined algorithms are... static { - if (allSignatureMethods.length != 29 + if (allSignatureMethods.length != 33 || allDigestMethods.length != 9) { System.out.println(Arrays.toString(allSignatureMethods)); System.out.println(Arrays.toString(allDigestMethods)); @@ -305,6 +306,10 @@ public static void main(String args[]) throws Exception { test_create_signature_enveloping_p256_sha256(); test_create_signature_enveloping_p256_sha384(); test_create_signature_enveloping_p256_sha512(); + test_create_signature_enveloping_p256_sha3_224(); + test_create_signature_enveloping_p256_sha3_256(); + test_create_signature_enveloping_p256_sha3_384(); + test_create_signature_enveloping_p256_sha3_512(); test_create_signature_enveloping_p384_sha1(); test_create_signature_enveloping_p521_sha1(); test_create_signature_enveloping_ed25519(); @@ -559,6 +564,10 @@ private static void setup() throws Exception { ecdsaSha256 = fac.newSignatureMethod(SignatureMethod.ECDSA_SHA256, null); ecdsaSha384 = fac.newSignatureMethod(SignatureMethod.ECDSA_SHA384, null); ecdsaSha512 = fac.newSignatureMethod(SignatureMethod.ECDSA_SHA512, null); + ecdsaSha3_224 = fac.newSignatureMethod(SignatureMethod.ECDSA_SHA3_224, null); + ecdsaSha3_256 = fac.newSignatureMethod(SignatureMethod.ECDSA_SHA3_256, null); + ecdsaSha3_384 = fac.newSignatureMethod(SignatureMethod.ECDSA_SHA3_384, null); + ecdsaSha3_512 = fac.newSignatureMethod(SignatureMethod.ECDSA_SHA3_512, null); ed25519 = fac.newSignatureMethod(SignatureMethod.ED25519, null); ed448 = fac.newSignatureMethod(SignatureMethod.ED448, null); @@ -892,6 +901,34 @@ static void test_create_signature_enveloping_p256_sha512() throws Exception { System.out.println(); } + static void test_create_signature_enveloping_p256_sha3_224() throws Exception { + System.out.println("* Generating signature-enveloping-p256-sha3_224.xml"); + test_create_signature_enveloping(sha1, ecdsaSha3_224, p256ki, + getECPrivateKey("P256"), kvks, false, true); + System.out.println(); + } + + static void test_create_signature_enveloping_p256_sha3_256() throws Exception { + System.out.println("* Generating signature-enveloping-p256-sha3_256.xml"); + test_create_signature_enveloping(sha1, ecdsaSha3_256, p256ki, + getECPrivateKey("P256"), kvks, false, true); + System.out.println(); + } + + static void test_create_signature_enveloping_p256_sha3_384() throws Exception { + System.out.println("* Generating signature-enveloping-p256-sha3_384.xml"); + test_create_signature_enveloping(sha1, ecdsaSha3_384, p256ki, + getECPrivateKey("P256"), kvks, false, true); + System.out.println(); + } + + static void test_create_signature_enveloping_p256_sha3_512() throws Exception { + System.out.println("* Generating signature-enveloping-p256-sha3_512.xml"); + test_create_signature_enveloping(sha1, ecdsaSha3_512, p256ki, + getECPrivateKey("P256"), kvks, false, true); + System.out.println(); + } + static void test_create_signature_enveloping_p384_sha1() throws Exception { System.out.println("* Generating signature-enveloping-p384-sha1.xml"); test_create_signature_enveloping(sha1, ecdsaSha1, p384ki, diff --git a/test/jdk/javax/xml/crypto/dsig/PSS.java b/test/jdk/javax/xml/crypto/dsig/PSS.java new file mode 100644 index 00000000000..3b5730577fb --- /dev/null +++ b/test/jdk/javax/xml/crypto/dsig/PSS.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import jdk.test.lib.Asserts; +import jdk.test.lib.security.XMLUtils; + +import javax.xml.crypto.dsig.DigestMethod; +import javax.xml.crypto.dsig.SignatureMethod; +import javax.xml.crypto.dsig.spec.RSAPSSParameterSpec; +import java.security.KeyPairGenerator; +import java.security.spec.MGF1ParameterSpec; +import java.security.spec.PSSParameterSpec; + +/** + * @test + * @bug 8344137 + * @summary check RSASSA-PSS key + * @library /test/lib + * @modules java.xml.crypto + */ +public class PSS { + + public static void main(String[] args) throws Exception { + + var doc = XMLUtils.string2doc("TextRaw"); + var kpg = KeyPairGenerator.getInstance("RSASSA-PSS"); + kpg.initialize(2048); + var keyPair = kpg.generateKeyPair(); + + var pspec = new PSSParameterSpec("SHA-384", "MGF1", + MGF1ParameterSpec.SHA512, 48, + PSSParameterSpec.TRAILER_FIELD_BC); + + var signed = XMLUtils.signer(keyPair.getPrivate(), keyPair.getPublic()) + .dm(DigestMethod.SHA384) + .sm(SignatureMethod.RSA_PSS, new RSAPSSParameterSpec(pspec)) + .sign(doc); + + Asserts.assertTrue(XMLUtils.validator().validate(signed)); + } +} diff --git a/test/jdk/jdk/incubator/vector/Byte128VectorTests.java b/test/jdk/jdk/incubator/vector/Byte128VectorTests.java index 36a140c474a..7c8265169f4 100644 --- a/test/jdk/jdk/incubator/vector/Byte128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte128VectorTests.java @@ -3912,6 +3912,184 @@ static void MAXReduceByte128VectorTestsMasked(IntFunction fa, IntFunctio Byte128VectorTests::MAXReduceMasked, Byte128VectorTests::MAXReduceAllMasked); } + static byte UMINReduce(byte[] a, int idx) { + byte res = Byte.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (byte) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static byte UMINReduceAll(byte[] a) { + byte res = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpProvider") + static void UMINReduceByte128VectorTests(IntFunction fa) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + byte ra = Byte.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Byte128VectorTests::UMINReduce, Byte128VectorTests::UMINReduceAll); + } + + static byte UMINReduceMasked(byte[] a, int idx, boolean[] mask) { + byte res = Byte.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (byte) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static byte UMINReduceAllMasked(byte[] a, boolean[] mask) { + byte res = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpMaskProvider") + static void UMINReduceByte128VectorTestsMasked(IntFunction fa, IntFunction fm) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + byte ra = Byte.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Byte128VectorTests::UMINReduceMasked, Byte128VectorTests::UMINReduceAllMasked); + } + + static byte UMAXReduce(byte[] a, int idx) { + byte res = Byte.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (byte) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static byte UMAXReduceAll(byte[] a) { + byte res = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpProvider") + static void UMAXReduceByte128VectorTests(IntFunction fa) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + byte ra = Byte.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Byte128VectorTests::UMAXReduce, Byte128VectorTests::UMAXReduceAll); + } + + static byte UMAXReduceMasked(byte[] a, int idx, boolean[] mask) { + byte res = Byte.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (byte) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static byte UMAXReduceAllMasked(byte[] a, boolean[] mask) { + byte res = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpMaskProvider") + static void UMAXReduceByte128VectorTestsMasked(IntFunction fa, IntFunction fm) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + byte ra = Byte.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Byte128VectorTests::UMAXReduceMasked, Byte128VectorTests::UMAXReduceAllMasked); + } + static byte FIRST_NONZEROReduce(byte[] a, int idx) { byte res = (byte) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Byte256VectorTests.java b/test/jdk/jdk/incubator/vector/Byte256VectorTests.java index 0ad567b5ee4..0fbbca79f5d 100644 --- a/test/jdk/jdk/incubator/vector/Byte256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte256VectorTests.java @@ -3912,6 +3912,184 @@ static void MAXReduceByte256VectorTestsMasked(IntFunction fa, IntFunctio Byte256VectorTests::MAXReduceMasked, Byte256VectorTests::MAXReduceAllMasked); } + static byte UMINReduce(byte[] a, int idx) { + byte res = Byte.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (byte) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static byte UMINReduceAll(byte[] a) { + byte res = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpProvider") + static void UMINReduceByte256VectorTests(IntFunction fa) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + byte ra = Byte.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Byte256VectorTests::UMINReduce, Byte256VectorTests::UMINReduceAll); + } + + static byte UMINReduceMasked(byte[] a, int idx, boolean[] mask) { + byte res = Byte.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (byte) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static byte UMINReduceAllMasked(byte[] a, boolean[] mask) { + byte res = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpMaskProvider") + static void UMINReduceByte256VectorTestsMasked(IntFunction fa, IntFunction fm) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + byte ra = Byte.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Byte256VectorTests::UMINReduceMasked, Byte256VectorTests::UMINReduceAllMasked); + } + + static byte UMAXReduce(byte[] a, int idx) { + byte res = Byte.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (byte) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static byte UMAXReduceAll(byte[] a) { + byte res = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpProvider") + static void UMAXReduceByte256VectorTests(IntFunction fa) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + byte ra = Byte.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Byte256VectorTests::UMAXReduce, Byte256VectorTests::UMAXReduceAll); + } + + static byte UMAXReduceMasked(byte[] a, int idx, boolean[] mask) { + byte res = Byte.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (byte) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static byte UMAXReduceAllMasked(byte[] a, boolean[] mask) { + byte res = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpMaskProvider") + static void UMAXReduceByte256VectorTestsMasked(IntFunction fa, IntFunction fm) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + byte ra = Byte.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Byte256VectorTests::UMAXReduceMasked, Byte256VectorTests::UMAXReduceAllMasked); + } + static byte FIRST_NONZEROReduce(byte[] a, int idx) { byte res = (byte) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Byte512VectorTests.java b/test/jdk/jdk/incubator/vector/Byte512VectorTests.java index 0edc66dfccc..a17e621a0e6 100644 --- a/test/jdk/jdk/incubator/vector/Byte512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte512VectorTests.java @@ -3912,6 +3912,184 @@ static void MAXReduceByte512VectorTestsMasked(IntFunction fa, IntFunctio Byte512VectorTests::MAXReduceMasked, Byte512VectorTests::MAXReduceAllMasked); } + static byte UMINReduce(byte[] a, int idx) { + byte res = Byte.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (byte) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static byte UMINReduceAll(byte[] a) { + byte res = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpProvider") + static void UMINReduceByte512VectorTests(IntFunction fa) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + byte ra = Byte.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Byte512VectorTests::UMINReduce, Byte512VectorTests::UMINReduceAll); + } + + static byte UMINReduceMasked(byte[] a, int idx, boolean[] mask) { + byte res = Byte.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (byte) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static byte UMINReduceAllMasked(byte[] a, boolean[] mask) { + byte res = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpMaskProvider") + static void UMINReduceByte512VectorTestsMasked(IntFunction fa, IntFunction fm) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + byte ra = Byte.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Byte512VectorTests::UMINReduceMasked, Byte512VectorTests::UMINReduceAllMasked); + } + + static byte UMAXReduce(byte[] a, int idx) { + byte res = Byte.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (byte) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static byte UMAXReduceAll(byte[] a) { + byte res = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpProvider") + static void UMAXReduceByte512VectorTests(IntFunction fa) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + byte ra = Byte.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Byte512VectorTests::UMAXReduce, Byte512VectorTests::UMAXReduceAll); + } + + static byte UMAXReduceMasked(byte[] a, int idx, boolean[] mask) { + byte res = Byte.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (byte) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static byte UMAXReduceAllMasked(byte[] a, boolean[] mask) { + byte res = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpMaskProvider") + static void UMAXReduceByte512VectorTestsMasked(IntFunction fa, IntFunction fm) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + byte ra = Byte.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Byte512VectorTests::UMAXReduceMasked, Byte512VectorTests::UMAXReduceAllMasked); + } + static byte FIRST_NONZEROReduce(byte[] a, int idx) { byte res = (byte) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Byte64VectorTests.java b/test/jdk/jdk/incubator/vector/Byte64VectorTests.java index 98c8382c526..58f1d6295a0 100644 --- a/test/jdk/jdk/incubator/vector/Byte64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Byte64VectorTests.java @@ -3912,6 +3912,184 @@ static void MAXReduceByte64VectorTestsMasked(IntFunction fa, IntFunction Byte64VectorTests::MAXReduceMasked, Byte64VectorTests::MAXReduceAllMasked); } + static byte UMINReduce(byte[] a, int idx) { + byte res = Byte.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (byte) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static byte UMINReduceAll(byte[] a) { + byte res = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpProvider") + static void UMINReduceByte64VectorTests(IntFunction fa) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + byte ra = Byte.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Byte64VectorTests::UMINReduce, Byte64VectorTests::UMINReduceAll); + } + + static byte UMINReduceMasked(byte[] a, int idx, boolean[] mask) { + byte res = Byte.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (byte) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static byte UMINReduceAllMasked(byte[] a, boolean[] mask) { + byte res = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpMaskProvider") + static void UMINReduceByte64VectorTestsMasked(IntFunction fa, IntFunction fm) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + byte ra = Byte.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Byte64VectorTests::UMINReduceMasked, Byte64VectorTests::UMINReduceAllMasked); + } + + static byte UMAXReduce(byte[] a, int idx) { + byte res = Byte.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (byte) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static byte UMAXReduceAll(byte[] a) { + byte res = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpProvider") + static void UMAXReduceByte64VectorTests(IntFunction fa) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + byte ra = Byte.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Byte64VectorTests::UMAXReduce, Byte64VectorTests::UMAXReduceAll); + } + + static byte UMAXReduceMasked(byte[] a, int idx, boolean[] mask) { + byte res = Byte.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (byte) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static byte UMAXReduceAllMasked(byte[] a, boolean[] mask) { + byte res = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpMaskProvider") + static void UMAXReduceByte64VectorTestsMasked(IntFunction fa, IntFunction fm) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + byte ra = Byte.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Byte64VectorTests::UMAXReduceMasked, Byte64VectorTests::UMAXReduceAllMasked); + } + static byte FIRST_NONZEROReduce(byte[] a, int idx) { byte res = (byte) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java b/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java index 2d9d49f32ad..9aaf1b6db95 100644 --- a/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/ByteMaxVectorTests.java @@ -3917,6 +3917,184 @@ static void MAXReduceByteMaxVectorTestsMasked(IntFunction fa, IntFunctio ByteMaxVectorTests::MAXReduceMasked, ByteMaxVectorTests::MAXReduceAllMasked); } + static byte UMINReduce(byte[] a, int idx) { + byte res = Byte.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (byte) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static byte UMINReduceAll(byte[] a) { + byte res = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpProvider") + static void UMINReduceByteMaxVectorTests(IntFunction fa) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + byte ra = Byte.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + ByteMaxVectorTests::UMINReduce, ByteMaxVectorTests::UMINReduceAll); + } + + static byte UMINReduceMasked(byte[] a, int idx, boolean[] mask) { + byte res = Byte.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (byte) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static byte UMINReduceAllMasked(byte[] a, boolean[] mask) { + byte res = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpMaskProvider") + static void UMINReduceByteMaxVectorTestsMasked(IntFunction fa, IntFunction fm) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + byte ra = Byte.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + ByteMaxVectorTests::UMINReduceMasked, ByteMaxVectorTests::UMINReduceAllMasked); + } + + static byte UMAXReduce(byte[] a, int idx) { + byte res = Byte.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (byte) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static byte UMAXReduceAll(byte[] a) { + byte res = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpProvider") + static void UMAXReduceByteMaxVectorTests(IntFunction fa) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + byte ra = Byte.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + ByteMaxVectorTests::UMAXReduce, ByteMaxVectorTests::UMAXReduceAll); + } + + static byte UMAXReduceMasked(byte[] a, int idx, boolean[] mask) { + byte res = Byte.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (byte) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static byte UMAXReduceAllMasked(byte[] a, boolean[] mask) { + byte res = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (byte) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "byteUnaryOpMaskProvider") + static void UMAXReduceByteMaxVectorTestsMasked(IntFunction fa, IntFunction fm) { + byte[] a = fa.apply(SPECIES.length()); + byte[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + byte ra = Byte.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Byte.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ByteVector av = ByteVector.fromArray(SPECIES, a, i); + ra = (byte) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + ByteMaxVectorTests::UMAXReduceMasked, ByteMaxVectorTests::UMAXReduceAllMasked); + } + static byte FIRST_NONZEROReduce(byte[] a, int idx) { byte res = (byte) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Int128VectorTests.java b/test/jdk/jdk/incubator/vector/Int128VectorTests.java index 028e757e853..4f8f296c519 100644 --- a/test/jdk/jdk/incubator/vector/Int128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int128VectorTests.java @@ -3956,6 +3956,184 @@ static void MAXReduceInt128VectorTestsMasked(IntFunction fa, IntFunction< Int128VectorTests::MAXReduceMasked, Int128VectorTests::MAXReduceAllMasked); } + static int UMINReduce(int[] a, int idx) { + int res = Integer.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (int) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static int UMINReduceAll(int[] a) { + int res = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpProvider") + static void UMINReduceInt128VectorTests(IntFunction fa) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + int ra = Integer.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Int128VectorTests::UMINReduce, Int128VectorTests::UMINReduceAll); + } + + static int UMINReduceMasked(int[] a, int idx, boolean[] mask) { + int res = Integer.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (int) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static int UMINReduceAllMasked(int[] a, boolean[] mask) { + int res = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpMaskProvider") + static void UMINReduceInt128VectorTestsMasked(IntFunction fa, IntFunction fm) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + int ra = Integer.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Int128VectorTests::UMINReduceMasked, Int128VectorTests::UMINReduceAllMasked); + } + + static int UMAXReduce(int[] a, int idx) { + int res = Integer.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (int) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static int UMAXReduceAll(int[] a) { + int res = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpProvider") + static void UMAXReduceInt128VectorTests(IntFunction fa) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + int ra = Integer.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Int128VectorTests::UMAXReduce, Int128VectorTests::UMAXReduceAll); + } + + static int UMAXReduceMasked(int[] a, int idx, boolean[] mask) { + int res = Integer.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (int) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static int UMAXReduceAllMasked(int[] a, boolean[] mask) { + int res = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpMaskProvider") + static void UMAXReduceInt128VectorTestsMasked(IntFunction fa, IntFunction fm) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + int ra = Integer.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Int128VectorTests::UMAXReduceMasked, Int128VectorTests::UMAXReduceAllMasked); + } + static int FIRST_NONZEROReduce(int[] a, int idx) { int res = (int) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Int256VectorTests.java b/test/jdk/jdk/incubator/vector/Int256VectorTests.java index 6dab8a39873..312227c54e1 100644 --- a/test/jdk/jdk/incubator/vector/Int256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int256VectorTests.java @@ -3956,6 +3956,184 @@ static void MAXReduceInt256VectorTestsMasked(IntFunction fa, IntFunction< Int256VectorTests::MAXReduceMasked, Int256VectorTests::MAXReduceAllMasked); } + static int UMINReduce(int[] a, int idx) { + int res = Integer.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (int) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static int UMINReduceAll(int[] a) { + int res = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpProvider") + static void UMINReduceInt256VectorTests(IntFunction fa) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + int ra = Integer.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Int256VectorTests::UMINReduce, Int256VectorTests::UMINReduceAll); + } + + static int UMINReduceMasked(int[] a, int idx, boolean[] mask) { + int res = Integer.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (int) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static int UMINReduceAllMasked(int[] a, boolean[] mask) { + int res = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpMaskProvider") + static void UMINReduceInt256VectorTestsMasked(IntFunction fa, IntFunction fm) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + int ra = Integer.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Int256VectorTests::UMINReduceMasked, Int256VectorTests::UMINReduceAllMasked); + } + + static int UMAXReduce(int[] a, int idx) { + int res = Integer.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (int) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static int UMAXReduceAll(int[] a) { + int res = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpProvider") + static void UMAXReduceInt256VectorTests(IntFunction fa) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + int ra = Integer.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Int256VectorTests::UMAXReduce, Int256VectorTests::UMAXReduceAll); + } + + static int UMAXReduceMasked(int[] a, int idx, boolean[] mask) { + int res = Integer.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (int) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static int UMAXReduceAllMasked(int[] a, boolean[] mask) { + int res = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpMaskProvider") + static void UMAXReduceInt256VectorTestsMasked(IntFunction fa, IntFunction fm) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + int ra = Integer.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Int256VectorTests::UMAXReduceMasked, Int256VectorTests::UMAXReduceAllMasked); + } + static int FIRST_NONZEROReduce(int[] a, int idx) { int res = (int) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Int512VectorTests.java b/test/jdk/jdk/incubator/vector/Int512VectorTests.java index 0c86655ff22..3e5b51180b6 100644 --- a/test/jdk/jdk/incubator/vector/Int512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int512VectorTests.java @@ -3956,6 +3956,184 @@ static void MAXReduceInt512VectorTestsMasked(IntFunction fa, IntFunction< Int512VectorTests::MAXReduceMasked, Int512VectorTests::MAXReduceAllMasked); } + static int UMINReduce(int[] a, int idx) { + int res = Integer.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (int) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static int UMINReduceAll(int[] a) { + int res = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpProvider") + static void UMINReduceInt512VectorTests(IntFunction fa) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + int ra = Integer.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Int512VectorTests::UMINReduce, Int512VectorTests::UMINReduceAll); + } + + static int UMINReduceMasked(int[] a, int idx, boolean[] mask) { + int res = Integer.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (int) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static int UMINReduceAllMasked(int[] a, boolean[] mask) { + int res = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpMaskProvider") + static void UMINReduceInt512VectorTestsMasked(IntFunction fa, IntFunction fm) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + int ra = Integer.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Int512VectorTests::UMINReduceMasked, Int512VectorTests::UMINReduceAllMasked); + } + + static int UMAXReduce(int[] a, int idx) { + int res = Integer.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (int) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static int UMAXReduceAll(int[] a) { + int res = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpProvider") + static void UMAXReduceInt512VectorTests(IntFunction fa) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + int ra = Integer.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Int512VectorTests::UMAXReduce, Int512VectorTests::UMAXReduceAll); + } + + static int UMAXReduceMasked(int[] a, int idx, boolean[] mask) { + int res = Integer.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (int) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static int UMAXReduceAllMasked(int[] a, boolean[] mask) { + int res = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpMaskProvider") + static void UMAXReduceInt512VectorTestsMasked(IntFunction fa, IntFunction fm) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + int ra = Integer.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Int512VectorTests::UMAXReduceMasked, Int512VectorTests::UMAXReduceAllMasked); + } + static int FIRST_NONZEROReduce(int[] a, int idx) { int res = (int) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Int64VectorTests.java b/test/jdk/jdk/incubator/vector/Int64VectorTests.java index b2cb3698f62..fccad11d4d6 100644 --- a/test/jdk/jdk/incubator/vector/Int64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Int64VectorTests.java @@ -3956,6 +3956,184 @@ static void MAXReduceInt64VectorTestsMasked(IntFunction fa, IntFunction fa) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + int ra = Integer.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Int64VectorTests::UMINReduce, Int64VectorTests::UMINReduceAll); + } + + static int UMINReduceMasked(int[] a, int idx, boolean[] mask) { + int res = Integer.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (int) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static int UMINReduceAllMasked(int[] a, boolean[] mask) { + int res = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpMaskProvider") + static void UMINReduceInt64VectorTestsMasked(IntFunction fa, IntFunction fm) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + int ra = Integer.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Int64VectorTests::UMINReduceMasked, Int64VectorTests::UMINReduceAllMasked); + } + + static int UMAXReduce(int[] a, int idx) { + int res = Integer.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (int) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static int UMAXReduceAll(int[] a) { + int res = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpProvider") + static void UMAXReduceInt64VectorTests(IntFunction fa) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + int ra = Integer.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Int64VectorTests::UMAXReduce, Int64VectorTests::UMAXReduceAll); + } + + static int UMAXReduceMasked(int[] a, int idx, boolean[] mask) { + int res = Integer.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (int) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static int UMAXReduceAllMasked(int[] a, boolean[] mask) { + int res = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpMaskProvider") + static void UMAXReduceInt64VectorTestsMasked(IntFunction fa, IntFunction fm) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + int ra = Integer.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Int64VectorTests::UMAXReduceMasked, Int64VectorTests::UMAXReduceAllMasked); + } + static int FIRST_NONZEROReduce(int[] a, int idx) { int res = (int) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java b/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java index fc0f6c1c139..3254c2fb86c 100644 --- a/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/IntMaxVectorTests.java @@ -3961,6 +3961,184 @@ static void MAXReduceIntMaxVectorTestsMasked(IntFunction fa, IntFunction< IntMaxVectorTests::MAXReduceMasked, IntMaxVectorTests::MAXReduceAllMasked); } + static int UMINReduce(int[] a, int idx) { + int res = Integer.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (int) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static int UMINReduceAll(int[] a) { + int res = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpProvider") + static void UMINReduceIntMaxVectorTests(IntFunction fa) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + int ra = Integer.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + IntMaxVectorTests::UMINReduce, IntMaxVectorTests::UMINReduceAll); + } + + static int UMINReduceMasked(int[] a, int idx, boolean[] mask) { + int res = Integer.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (int) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static int UMINReduceAllMasked(int[] a, boolean[] mask) { + int res = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpMaskProvider") + static void UMINReduceIntMaxVectorTestsMasked(IntFunction fa, IntFunction fm) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + int ra = Integer.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + IntMaxVectorTests::UMINReduceMasked, IntMaxVectorTests::UMINReduceAllMasked); + } + + static int UMAXReduce(int[] a, int idx) { + int res = Integer.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (int) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static int UMAXReduceAll(int[] a) { + int res = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpProvider") + static void UMAXReduceIntMaxVectorTests(IntFunction fa) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + int ra = Integer.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + IntMaxVectorTests::UMAXReduce, IntMaxVectorTests::UMAXReduceAll); + } + + static int UMAXReduceMasked(int[] a, int idx, boolean[] mask) { + int res = Integer.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (int) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static int UMAXReduceAllMasked(int[] a, boolean[] mask) { + int res = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (int) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "intUnaryOpMaskProvider") + static void UMAXReduceIntMaxVectorTestsMasked(IntFunction fa, IntFunction fm) { + int[] a = fa.apply(SPECIES.length()); + int[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + int ra = Integer.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Integer.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, a, i); + ra = (int) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + IntMaxVectorTests::UMAXReduceMasked, IntMaxVectorTests::UMAXReduceAllMasked); + } + static int FIRST_NONZEROReduce(int[] a, int idx) { int res = (int) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Long128VectorTests.java b/test/jdk/jdk/incubator/vector/Long128VectorTests.java index 3694128877a..09fdc3c1979 100644 --- a/test/jdk/jdk/incubator/vector/Long128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long128VectorTests.java @@ -3978,6 +3978,184 @@ static void MAXReduceLong128VectorTestsMasked(IntFunction fa, IntFunctio Long128VectorTests::MAXReduceMasked, Long128VectorTests::MAXReduceAllMasked); } + static long UMINReduce(long[] a, int idx) { + long res = Long.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (long) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static long UMINReduceAll(long[] a) { + long res = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpProvider") + static void UMINReduceLong128VectorTests(IntFunction fa) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + long ra = Long.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Long128VectorTests::UMINReduce, Long128VectorTests::UMINReduceAll); + } + + static long UMINReduceMasked(long[] a, int idx, boolean[] mask) { + long res = Long.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (long) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static long UMINReduceAllMasked(long[] a, boolean[] mask) { + long res = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpMaskProvider") + static void UMINReduceLong128VectorTestsMasked(IntFunction fa, IntFunction fm) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + long ra = Long.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Long128VectorTests::UMINReduceMasked, Long128VectorTests::UMINReduceAllMasked); + } + + static long UMAXReduce(long[] a, int idx) { + long res = Long.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (long) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static long UMAXReduceAll(long[] a) { + long res = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpProvider") + static void UMAXReduceLong128VectorTests(IntFunction fa) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + long ra = Long.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Long128VectorTests::UMAXReduce, Long128VectorTests::UMAXReduceAll); + } + + static long UMAXReduceMasked(long[] a, int idx, boolean[] mask) { + long res = Long.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (long) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static long UMAXReduceAllMasked(long[] a, boolean[] mask) { + long res = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpMaskProvider") + static void UMAXReduceLong128VectorTestsMasked(IntFunction fa, IntFunction fm) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + long ra = Long.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Long128VectorTests::UMAXReduceMasked, Long128VectorTests::UMAXReduceAllMasked); + } + static long FIRST_NONZEROReduce(long[] a, int idx) { long res = (long) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Long256VectorTests.java b/test/jdk/jdk/incubator/vector/Long256VectorTests.java index 1fc441680fd..7dd0da772ed 100644 --- a/test/jdk/jdk/incubator/vector/Long256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long256VectorTests.java @@ -3978,6 +3978,184 @@ static void MAXReduceLong256VectorTestsMasked(IntFunction fa, IntFunctio Long256VectorTests::MAXReduceMasked, Long256VectorTests::MAXReduceAllMasked); } + static long UMINReduce(long[] a, int idx) { + long res = Long.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (long) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static long UMINReduceAll(long[] a) { + long res = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpProvider") + static void UMINReduceLong256VectorTests(IntFunction fa) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + long ra = Long.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Long256VectorTests::UMINReduce, Long256VectorTests::UMINReduceAll); + } + + static long UMINReduceMasked(long[] a, int idx, boolean[] mask) { + long res = Long.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (long) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static long UMINReduceAllMasked(long[] a, boolean[] mask) { + long res = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpMaskProvider") + static void UMINReduceLong256VectorTestsMasked(IntFunction fa, IntFunction fm) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + long ra = Long.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Long256VectorTests::UMINReduceMasked, Long256VectorTests::UMINReduceAllMasked); + } + + static long UMAXReduce(long[] a, int idx) { + long res = Long.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (long) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static long UMAXReduceAll(long[] a) { + long res = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpProvider") + static void UMAXReduceLong256VectorTests(IntFunction fa) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + long ra = Long.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Long256VectorTests::UMAXReduce, Long256VectorTests::UMAXReduceAll); + } + + static long UMAXReduceMasked(long[] a, int idx, boolean[] mask) { + long res = Long.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (long) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static long UMAXReduceAllMasked(long[] a, boolean[] mask) { + long res = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpMaskProvider") + static void UMAXReduceLong256VectorTestsMasked(IntFunction fa, IntFunction fm) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + long ra = Long.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Long256VectorTests::UMAXReduceMasked, Long256VectorTests::UMAXReduceAllMasked); + } + static long FIRST_NONZEROReduce(long[] a, int idx) { long res = (long) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Long512VectorTests.java b/test/jdk/jdk/incubator/vector/Long512VectorTests.java index 81d538a55c4..360e822e121 100644 --- a/test/jdk/jdk/incubator/vector/Long512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long512VectorTests.java @@ -3978,6 +3978,184 @@ static void MAXReduceLong512VectorTestsMasked(IntFunction fa, IntFunctio Long512VectorTests::MAXReduceMasked, Long512VectorTests::MAXReduceAllMasked); } + static long UMINReduce(long[] a, int idx) { + long res = Long.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (long) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static long UMINReduceAll(long[] a) { + long res = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpProvider") + static void UMINReduceLong512VectorTests(IntFunction fa) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + long ra = Long.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Long512VectorTests::UMINReduce, Long512VectorTests::UMINReduceAll); + } + + static long UMINReduceMasked(long[] a, int idx, boolean[] mask) { + long res = Long.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (long) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static long UMINReduceAllMasked(long[] a, boolean[] mask) { + long res = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpMaskProvider") + static void UMINReduceLong512VectorTestsMasked(IntFunction fa, IntFunction fm) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + long ra = Long.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Long512VectorTests::UMINReduceMasked, Long512VectorTests::UMINReduceAllMasked); + } + + static long UMAXReduce(long[] a, int idx) { + long res = Long.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (long) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static long UMAXReduceAll(long[] a) { + long res = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpProvider") + static void UMAXReduceLong512VectorTests(IntFunction fa) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + long ra = Long.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Long512VectorTests::UMAXReduce, Long512VectorTests::UMAXReduceAll); + } + + static long UMAXReduceMasked(long[] a, int idx, boolean[] mask) { + long res = Long.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (long) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static long UMAXReduceAllMasked(long[] a, boolean[] mask) { + long res = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpMaskProvider") + static void UMAXReduceLong512VectorTestsMasked(IntFunction fa, IntFunction fm) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + long ra = Long.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Long512VectorTests::UMAXReduceMasked, Long512VectorTests::UMAXReduceAllMasked); + } + static long FIRST_NONZEROReduce(long[] a, int idx) { long res = (long) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Long64VectorTests.java b/test/jdk/jdk/incubator/vector/Long64VectorTests.java index 1d85fc510d9..31f6fafea7c 100644 --- a/test/jdk/jdk/incubator/vector/Long64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Long64VectorTests.java @@ -3978,6 +3978,184 @@ static void MAXReduceLong64VectorTestsMasked(IntFunction fa, IntFunction Long64VectorTests::MAXReduceMasked, Long64VectorTests::MAXReduceAllMasked); } + static long UMINReduce(long[] a, int idx) { + long res = Long.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (long) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static long UMINReduceAll(long[] a) { + long res = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpProvider") + static void UMINReduceLong64VectorTests(IntFunction fa) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + long ra = Long.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Long64VectorTests::UMINReduce, Long64VectorTests::UMINReduceAll); + } + + static long UMINReduceMasked(long[] a, int idx, boolean[] mask) { + long res = Long.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (long) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static long UMINReduceAllMasked(long[] a, boolean[] mask) { + long res = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpMaskProvider") + static void UMINReduceLong64VectorTestsMasked(IntFunction fa, IntFunction fm) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + long ra = Long.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Long64VectorTests::UMINReduceMasked, Long64VectorTests::UMINReduceAllMasked); + } + + static long UMAXReduce(long[] a, int idx) { + long res = Long.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (long) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static long UMAXReduceAll(long[] a) { + long res = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpProvider") + static void UMAXReduceLong64VectorTests(IntFunction fa) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + long ra = Long.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Long64VectorTests::UMAXReduce, Long64VectorTests::UMAXReduceAll); + } + + static long UMAXReduceMasked(long[] a, int idx, boolean[] mask) { + long res = Long.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (long) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static long UMAXReduceAllMasked(long[] a, boolean[] mask) { + long res = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpMaskProvider") + static void UMAXReduceLong64VectorTestsMasked(IntFunction fa, IntFunction fm) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + long ra = Long.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Long64VectorTests::UMAXReduceMasked, Long64VectorTests::UMAXReduceAllMasked); + } + static long FIRST_NONZEROReduce(long[] a, int idx) { long res = (long) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java b/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java index bae5b968d79..a3cacbe3251 100644 --- a/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/LongMaxVectorTests.java @@ -3983,6 +3983,184 @@ static void MAXReduceLongMaxVectorTestsMasked(IntFunction fa, IntFunctio LongMaxVectorTests::MAXReduceMasked, LongMaxVectorTests::MAXReduceAllMasked); } + static long UMINReduce(long[] a, int idx) { + long res = Long.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (long) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static long UMINReduceAll(long[] a) { + long res = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpProvider") + static void UMINReduceLongMaxVectorTests(IntFunction fa) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + long ra = Long.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + LongMaxVectorTests::UMINReduce, LongMaxVectorTests::UMINReduceAll); + } + + static long UMINReduceMasked(long[] a, int idx, boolean[] mask) { + long res = Long.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (long) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static long UMINReduceAllMasked(long[] a, boolean[] mask) { + long res = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpMaskProvider") + static void UMINReduceLongMaxVectorTestsMasked(IntFunction fa, IntFunction fm) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + long ra = Long.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + LongMaxVectorTests::UMINReduceMasked, LongMaxVectorTests::UMINReduceAllMasked); + } + + static long UMAXReduce(long[] a, int idx) { + long res = Long.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (long) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static long UMAXReduceAll(long[] a) { + long res = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpProvider") + static void UMAXReduceLongMaxVectorTests(IntFunction fa) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + long ra = Long.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + LongMaxVectorTests::UMAXReduce, LongMaxVectorTests::UMAXReduceAll); + } + + static long UMAXReduceMasked(long[] a, int idx, boolean[] mask) { + long res = Long.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (long) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static long UMAXReduceAllMasked(long[] a, boolean[] mask) { + long res = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (long) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "longUnaryOpMaskProvider") + static void UMAXReduceLongMaxVectorTestsMasked(IntFunction fa, IntFunction fm) { + long[] a = fa.apply(SPECIES.length()); + long[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + long ra = Long.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Long.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + LongVector av = LongVector.fromArray(SPECIES, a, i); + ra = (long) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + LongMaxVectorTests::UMAXReduceMasked, LongMaxVectorTests::UMAXReduceAllMasked); + } + static long FIRST_NONZEROReduce(long[] a, int idx) { long res = (long) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Short128VectorTests.java b/test/jdk/jdk/incubator/vector/Short128VectorTests.java index 2d6a1fd0a5f..967418181bf 100644 --- a/test/jdk/jdk/incubator/vector/Short128VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short128VectorTests.java @@ -3903,6 +3903,184 @@ static void MAXReduceShort128VectorTestsMasked(IntFunction fa, IntFunct Short128VectorTests::MAXReduceMasked, Short128VectorTests::MAXReduceAllMasked); } + static short UMINReduce(short[] a, int idx) { + short res = Short.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (short) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static short UMINReduceAll(short[] a) { + short res = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpProvider") + static void UMINReduceShort128VectorTests(IntFunction fa) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + short ra = Short.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Short128VectorTests::UMINReduce, Short128VectorTests::UMINReduceAll); + } + + static short UMINReduceMasked(short[] a, int idx, boolean[] mask) { + short res = Short.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (short) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static short UMINReduceAllMasked(short[] a, boolean[] mask) { + short res = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpMaskProvider") + static void UMINReduceShort128VectorTestsMasked(IntFunction fa, IntFunction fm) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + short ra = Short.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Short128VectorTests::UMINReduceMasked, Short128VectorTests::UMINReduceAllMasked); + } + + static short UMAXReduce(short[] a, int idx) { + short res = Short.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (short) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static short UMAXReduceAll(short[] a) { + short res = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpProvider") + static void UMAXReduceShort128VectorTests(IntFunction fa) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + short ra = Short.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Short128VectorTests::UMAXReduce, Short128VectorTests::UMAXReduceAll); + } + + static short UMAXReduceMasked(short[] a, int idx, boolean[] mask) { + short res = Short.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (short) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static short UMAXReduceAllMasked(short[] a, boolean[] mask) { + short res = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpMaskProvider") + static void UMAXReduceShort128VectorTestsMasked(IntFunction fa, IntFunction fm) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + short ra = Short.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Short128VectorTests::UMAXReduceMasked, Short128VectorTests::UMAXReduceAllMasked); + } + static short FIRST_NONZEROReduce(short[] a, int idx) { short res = (short) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Short256VectorTests.java b/test/jdk/jdk/incubator/vector/Short256VectorTests.java index fa8ec1f31b6..2386d89e53b 100644 --- a/test/jdk/jdk/incubator/vector/Short256VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short256VectorTests.java @@ -3903,6 +3903,184 @@ static void MAXReduceShort256VectorTestsMasked(IntFunction fa, IntFunct Short256VectorTests::MAXReduceMasked, Short256VectorTests::MAXReduceAllMasked); } + static short UMINReduce(short[] a, int idx) { + short res = Short.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (short) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static short UMINReduceAll(short[] a) { + short res = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpProvider") + static void UMINReduceShort256VectorTests(IntFunction fa) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + short ra = Short.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Short256VectorTests::UMINReduce, Short256VectorTests::UMINReduceAll); + } + + static short UMINReduceMasked(short[] a, int idx, boolean[] mask) { + short res = Short.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (short) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static short UMINReduceAllMasked(short[] a, boolean[] mask) { + short res = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpMaskProvider") + static void UMINReduceShort256VectorTestsMasked(IntFunction fa, IntFunction fm) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + short ra = Short.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Short256VectorTests::UMINReduceMasked, Short256VectorTests::UMINReduceAllMasked); + } + + static short UMAXReduce(short[] a, int idx) { + short res = Short.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (short) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static short UMAXReduceAll(short[] a) { + short res = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpProvider") + static void UMAXReduceShort256VectorTests(IntFunction fa) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + short ra = Short.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Short256VectorTests::UMAXReduce, Short256VectorTests::UMAXReduceAll); + } + + static short UMAXReduceMasked(short[] a, int idx, boolean[] mask) { + short res = Short.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (short) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static short UMAXReduceAllMasked(short[] a, boolean[] mask) { + short res = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpMaskProvider") + static void UMAXReduceShort256VectorTestsMasked(IntFunction fa, IntFunction fm) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + short ra = Short.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Short256VectorTests::UMAXReduceMasked, Short256VectorTests::UMAXReduceAllMasked); + } + static short FIRST_NONZEROReduce(short[] a, int idx) { short res = (short) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Short512VectorTests.java b/test/jdk/jdk/incubator/vector/Short512VectorTests.java index ba6a7dadebd..cb9fc1830b9 100644 --- a/test/jdk/jdk/incubator/vector/Short512VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short512VectorTests.java @@ -3903,6 +3903,184 @@ static void MAXReduceShort512VectorTestsMasked(IntFunction fa, IntFunct Short512VectorTests::MAXReduceMasked, Short512VectorTests::MAXReduceAllMasked); } + static short UMINReduce(short[] a, int idx) { + short res = Short.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (short) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static short UMINReduceAll(short[] a) { + short res = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpProvider") + static void UMINReduceShort512VectorTests(IntFunction fa) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + short ra = Short.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Short512VectorTests::UMINReduce, Short512VectorTests::UMINReduceAll); + } + + static short UMINReduceMasked(short[] a, int idx, boolean[] mask) { + short res = Short.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (short) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static short UMINReduceAllMasked(short[] a, boolean[] mask) { + short res = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpMaskProvider") + static void UMINReduceShort512VectorTestsMasked(IntFunction fa, IntFunction fm) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + short ra = Short.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Short512VectorTests::UMINReduceMasked, Short512VectorTests::UMINReduceAllMasked); + } + + static short UMAXReduce(short[] a, int idx) { + short res = Short.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (short) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static short UMAXReduceAll(short[] a) { + short res = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpProvider") + static void UMAXReduceShort512VectorTests(IntFunction fa) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + short ra = Short.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Short512VectorTests::UMAXReduce, Short512VectorTests::UMAXReduceAll); + } + + static short UMAXReduceMasked(short[] a, int idx, boolean[] mask) { + short res = Short.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (short) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static short UMAXReduceAllMasked(short[] a, boolean[] mask) { + short res = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpMaskProvider") + static void UMAXReduceShort512VectorTestsMasked(IntFunction fa, IntFunction fm) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + short ra = Short.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Short512VectorTests::UMAXReduceMasked, Short512VectorTests::UMAXReduceAllMasked); + } + static short FIRST_NONZEROReduce(short[] a, int idx) { short res = (short) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/Short64VectorTests.java b/test/jdk/jdk/incubator/vector/Short64VectorTests.java index 939da11d53a..64bb5f52329 100644 --- a/test/jdk/jdk/incubator/vector/Short64VectorTests.java +++ b/test/jdk/jdk/incubator/vector/Short64VectorTests.java @@ -3903,6 +3903,184 @@ static void MAXReduceShort64VectorTestsMasked(IntFunction fa, IntFuncti Short64VectorTests::MAXReduceMasked, Short64VectorTests::MAXReduceAllMasked); } + static short UMINReduce(short[] a, int idx) { + short res = Short.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (short) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static short UMINReduceAll(short[] a) { + short res = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpProvider") + static void UMINReduceShort64VectorTests(IntFunction fa) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + short ra = Short.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + Short64VectorTests::UMINReduce, Short64VectorTests::UMINReduceAll); + } + + static short UMINReduceMasked(short[] a, int idx, boolean[] mask) { + short res = Short.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (short) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static short UMINReduceAllMasked(short[] a, boolean[] mask) { + short res = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpMaskProvider") + static void UMINReduceShort64VectorTestsMasked(IntFunction fa, IntFunction fm) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + short ra = Short.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Short64VectorTests::UMINReduceMasked, Short64VectorTests::UMINReduceAllMasked); + } + + static short UMAXReduce(short[] a, int idx) { + short res = Short.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (short) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static short UMAXReduceAll(short[] a) { + short res = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpProvider") + static void UMAXReduceShort64VectorTests(IntFunction fa) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + short ra = Short.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + Short64VectorTests::UMAXReduce, Short64VectorTests::UMAXReduceAll); + } + + static short UMAXReduceMasked(short[] a, int idx, boolean[] mask) { + short res = Short.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (short) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static short UMAXReduceAllMasked(short[] a, boolean[] mask) { + short res = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpMaskProvider") + static void UMAXReduceShort64VectorTestsMasked(IntFunction fa, IntFunction fm) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + short ra = Short.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + Short64VectorTests::UMAXReduceMasked, Short64VectorTests::UMAXReduceAllMasked); + } + static short FIRST_NONZEROReduce(short[] a, int idx) { short res = (short) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java b/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java index ade78e1f3f5..6445443b9d6 100644 --- a/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java +++ b/test/jdk/jdk/incubator/vector/ShortMaxVectorTests.java @@ -3908,6 +3908,184 @@ static void MAXReduceShortMaxVectorTestsMasked(IntFunction fa, IntFunct ShortMaxVectorTests::MAXReduceMasked, ShortMaxVectorTests::MAXReduceAllMasked); } + static short UMINReduce(short[] a, int idx) { + short res = Short.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (short) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static short UMINReduceAll(short[] a) { + short res = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.minUnsigned(res, UMINReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpProvider") + static void UMINReduceShortMaxVectorTests(IntFunction fa) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + short ra = Short.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN)); + } + } + + assertReductionArraysEquals(r, ra, a, + ShortMaxVectorTests::UMINReduce, ShortMaxVectorTests::UMINReduceAll); + } + + static short UMINReduceMasked(short[] a, int idx, boolean[] mask) { + short res = Short.MAX_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (short) VectorMath.minUnsigned(res, a[i]); + } + + return res; + } + + static short UMINReduceAllMasked(short[] a, boolean[] mask) { + short res = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.minUnsigned(res, UMINReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpMaskProvider") + static void UMINReduceShortMaxVectorTestsMasked(IntFunction fa, IntFunction fm) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + short ra = Short.MAX_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMIN, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MAX_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.minUnsigned(ra, av.reduceLanes(VectorOperators.UMIN, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + ShortMaxVectorTests::UMINReduceMasked, ShortMaxVectorTests::UMINReduceAllMasked); + } + + static short UMAXReduce(short[] a, int idx) { + short res = Short.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + res = (short) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static short UMAXReduceAll(short[] a) { + short res = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.maxUnsigned(res, UMAXReduce(a, i)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpProvider") + static void UMAXReduceShortMaxVectorTests(IntFunction fa) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + short ra = Short.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX)); + } + } + + assertReductionArraysEquals(r, ra, a, + ShortMaxVectorTests::UMAXReduce, ShortMaxVectorTests::UMAXReduceAll); + } + + static short UMAXReduceMasked(short[] a, int idx, boolean[] mask) { + short res = Short.MIN_VALUE; + for (int i = idx; i < (idx + SPECIES.length()); i++) { + if (mask[i % SPECIES.length()]) + res = (short) VectorMath.maxUnsigned(res, a[i]); + } + + return res; + } + + static short UMAXReduceAllMasked(short[] a, boolean[] mask) { + short res = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + res = (short) VectorMath.maxUnsigned(res, UMAXReduceMasked(a, i, mask)); + } + + return res; + } + + @Test(dataProvider = "shortUnaryOpMaskProvider") + static void UMAXReduceShortMaxVectorTestsMasked(IntFunction fa, IntFunction fm) { + short[] a = fa.apply(SPECIES.length()); + short[] r = fr.apply(SPECIES.length()); + boolean[] mask = fm.apply(SPECIES.length()); + VectorMask vmask = VectorMask.fromArray(SPECIES, mask, 0); + short ra = Short.MIN_VALUE; + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + r[i] = av.reduceLanes(VectorOperators.UMAX, vmask); + } + } + + for (int ic = 0; ic < INVOC_COUNT; ic++) { + ra = Short.MIN_VALUE; + for (int i = 0; i < a.length; i += SPECIES.length()) { + ShortVector av = ShortVector.fromArray(SPECIES, a, i); + ra = (short) VectorMath.maxUnsigned(ra, av.reduceLanes(VectorOperators.UMAX, vmask)); + } + } + + assertReductionArraysEqualsMasked(r, ra, a, mask, + ShortMaxVectorTests::UMAXReduceMasked, ShortMaxVectorTests::UMAXReduceAllMasked); + } + static short FIRST_NONZEROReduce(short[] a, int idx) { short res = (short) 0; for (int i = idx; i < (idx + SPECIES.length()); i++) { diff --git a/test/jdk/jdk/incubator/vector/gen-template.sh b/test/jdk/jdk/incubator/vector/gen-template.sh index 232de04ba7c..06e89b824cd 100644 --- a/test/jdk/jdk/incubator/vector/gen-template.sh +++ b/test/jdk/jdk/incubator/vector/gen-template.sh @@ -484,6 +484,8 @@ gen_reduction_op "ADD" "+" "" "0" gen_reduction_op "MUL" "*" "" "1" gen_reduction_op_func "MIN" "(\$type\$) Math.min" "" "\$Wideboxtype\$.\$MaxValue\$" gen_reduction_op_func "MAX" "(\$type\$) Math.max" "" "\$Wideboxtype\$.\$MinValue\$" +gen_reduction_op_func "UMIN" "(\$type\$) VectorMath.minUnsigned" "BITWISE" "\$Wideboxtype\$.\$MaxValue\$" +gen_reduction_op_func "UMAX" "(\$type\$) VectorMath.maxUnsigned" "BITWISE" "\$Wideboxtype\$.\$MinValue\$" gen_reduction_op_func "FIRST_NONZERO" "firstNonZero" "" "(\$type\$) 0" # Boolean reductions. diff --git a/test/jdk/jdk/jfr/event/oldobject/TestSanityDefault.java b/test/jdk/jdk/jfr/event/oldobject/TestSanityDefault.java index 7480acb1d1d..30186db8def 100644 --- a/test/jdk/jdk/jfr/event/oldobject/TestSanityDefault.java +++ b/test/jdk/jdk/jfr/event/oldobject/TestSanityDefault.java @@ -35,6 +35,7 @@ * @test * @key jfr * @requires vm.hasJFR + * @requires vm.flagless * @library /test/lib /test/jdk * @summary Purpose of this test is to run leak profiler without command line tweaks or WhiteBox hacks until we succeed * @run main/othervm -Xmx1G jdk.jfr.event.oldobject.TestSanityDefault diff --git a/test/jdk/sun/management/jdp/ClientConnection.java b/test/jdk/sun/management/jdp/ClientConnection.java index 9c74517e49a..77d133106be 100644 --- a/test/jdk/sun/management/jdp/ClientConnection.java +++ b/test/jdk/sun/management/jdp/ClientConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * 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,10 +53,10 @@ public ClientConnection() } - public MulticastSocket connectWithTimeout(int msTimeOut) throws IOException { + public MulticastSocket connectWithTimeout(int msTimeout) throws IOException { MulticastSocket socket = new MulticastSocket(port); socket.joinGroup(address); - socket.setSoTimeout(msTimeOut); + socket.setSoTimeout(msTimeout); return socket; } } diff --git a/test/jdk/sun/management/jdp/DynamicLauncher.java b/test/jdk/sun/management/jdp/DynamicLauncher.java index b79672211b1..8f29e774893 100644 --- a/test/jdk/sun/management/jdp/DynamicLauncher.java +++ b/test/jdk/sun/management/jdp/DynamicLauncher.java @@ -37,7 +37,7 @@ */ public abstract class DynamicLauncher { - private static final int MAX_RETRY_ATTEMPTS = 10; + private static final int MAX_PORT_RETRY_ATTEMPTS = 10; final String jdpName = UUID.randomUUID().toString(); OutputAnalyzer output; @@ -54,7 +54,7 @@ protected void run() throws Exception { try { output.shouldNotContain("Port already in use"); } catch (RuntimeException e) { - if (retries < MAX_RETRY_ATTEMPTS) { + if (retries < MAX_PORT_RETRY_ATTEMPTS) { retries++; tryAgain = true; } @@ -77,8 +77,4 @@ protected OutputAnalyzer runVM() throws Exception { } protected abstract String[] options(); - - protected OutputAnalyzer getProcessOutpoutAnalyzer() { - return output; - } } diff --git a/test/jdk/sun/management/jdp/JdpDefaultsTest.java b/test/jdk/sun/management/jdp/JdpDefaultsTest.java index 1cf76aa58b7..7c17efe0fd0 100644 --- a/test/jdk/sun/management/jdp/JdpDefaultsTest.java +++ b/test/jdk/sun/management/jdp/JdpDefaultsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ protected String[] options() { "-Dcom.sun.management.jmxremote.autodiscovery=true", "-Dcom.sun.management.jdp.pause=1", "-Dcom.sun.management.jdp.name=" + jdpName, - "-Djava.util.logging.SimpleFormatter.format='%1$tF %1$tT %4$-7s %5$s %n'", + "-Djava.util.logging.SimpleFormatter.format=%1$tF %1$tT %4$-7s %5$s %n", testName }; return options; diff --git a/test/jdk/sun/management/jdp/JdpJmxRemoteDynamicPortTest.java b/test/jdk/sun/management/jdp/JdpJmxRemoteDynamicPortTest.java index edf65a79b19..55558a5d88e 100644 --- a/test/jdk/sun/management/jdp/JdpJmxRemoteDynamicPortTest.java +++ b/test/jdk/sun/management/jdp/JdpJmxRemoteDynamicPortTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,7 @@ protected String[] options() { "-Dcom.sun.management.jmxremote.autodiscovery=true", "-Dcom.sun.management.jdp.pause=1", "-Dcom.sun.management.jdp.name=" + jdpName, - "-Djava.util.logging.SimpleFormatter.format='%1$tF %1$tT %4$-7s %5$s %n'", + "-Djava.util.logging.SimpleFormatter.format=%1$tF %1$tT %4$-7s %5$s %n", testName }; return options; diff --git a/test/jdk/sun/management/jdp/JdpJmxRemoteDynamicPortTestCase.java b/test/jdk/sun/management/jdp/JdpJmxRemoteDynamicPortTestCase.java index bb5485ed073..fbc8087a7a5 100644 --- a/test/jdk/sun/management/jdp/JdpJmxRemoteDynamicPortTestCase.java +++ b/test/jdk/sun/management/jdp/JdpJmxRemoteDynamicPortTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * 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 @@ protected void packetFromThisVMReceived(Map payload) throws Exce * It is set to wait for 10 times the defined pause between Jdp packet. See JdpOnTestCase.TIME_OUT_FACTOR. */ @Override - protected void onSocketTimeOut(SocketTimeoutException e) throws Exception { + protected void onSocketTimeout(SocketTimeoutException e) throws Exception { String message = "Timed out waiting for JDP packet. Should arrive within " + connection.pauseInSeconds + " seconds, but waited for " + timeOut + " seconds."; diff --git a/test/jdk/sun/management/jdp/JdpOffTest.java b/test/jdk/sun/management/jdp/JdpOffTest.java index c5f9af4984d..b52222562fe 100644 --- a/test/jdk/sun/management/jdp/JdpOffTest.java +++ b/test/jdk/sun/management/jdp/JdpOffTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * 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,7 +60,7 @@ protected String[] options() { "-Dcom.sun.management.jmxremote.autodiscovery=false", "-Dcom.sun.management.jdp.pause=1", "-Dcom.sun.management.jdp.name=" + jdpName, - "-Djava.util.logging.SimpleFormatter.format='%1$tF %1$tT %4$-7s %5$s %n'", + "-Djava.util.logging.SimpleFormatter.format=%1$tF %1$tT %4$-7s %5$s %n", testName }; return options; diff --git a/test/jdk/sun/management/jdp/JdpOffTestCase.java b/test/jdk/sun/management/jdp/JdpOffTestCase.java index 54bb2bd3c31..6ddeebb8d00 100644 --- a/test/jdk/sun/management/jdp/JdpOffTestCase.java +++ b/test/jdk/sun/management/jdp/JdpOffTestCase.java @@ -49,8 +49,8 @@ protected String initialLogMessage() { * The socket has not received anything, and this is the expected behavior. */ @Override - protected void onSocketTimeOut(SocketTimeoutException e) throws Exception { - log.fine("No packages received. Test passed!"); + protected void onSocketTimeout(SocketTimeoutException e) throws Exception { + log.fine("No packets received. Test passed!"); testPassed = true; } @@ -77,7 +77,7 @@ protected void packetFromThisVMReceived(Map payload) throws Exce /** - * The test should stop after the socket has timed out. See onSocketTimeOut {@link}. + * The test should stop after the socket has timed out. See onSocketTimeout {@link}. */ @Override protected boolean shouldContinue() { diff --git a/test/jdk/sun/management/jdp/JdpOnTestCase.java b/test/jdk/sun/management/jdp/JdpOnTestCase.java index c6d2c30a162..00856bb4f5d 100644 --- a/test/jdk/sun/management/jdp/JdpOnTestCase.java +++ b/test/jdk/sun/management/jdp/JdpOnTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * 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,10 @@ protected void packetFromThisVMReceived(Map payload) { /** * The socket should not timeout. - * It is set to wait for 10 times the defined pause between Jdp packet. See JdpOnTestCase.TIME_OUT_FACTOR. + * It is set to wait for a multiple of the defined pause between Jdp packets. See JdpTestCase.TIME_OUT_FACTOR. */ @Override - protected void onSocketTimeOut(SocketTimeoutException e) throws Exception { + protected void onSocketTimeout(SocketTimeoutException e) throws Exception { String message = "Timed out waiting for JDP packet. Should arrive within " + connection.pauseInSeconds + " seconds, but waited for " + timeOut + " seconds."; diff --git a/test/jdk/sun/management/jdp/JdpSpecificAddressTest.java b/test/jdk/sun/management/jdp/JdpSpecificAddressTest.java index 1bc0cd01dcc..5134321a5c2 100644 --- a/test/jdk/sun/management/jdp/JdpSpecificAddressTest.java +++ b/test/jdk/sun/management/jdp/JdpSpecificAddressTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ protected String[] options() { "-Dcom.sun.management.jdp.name=" + jdpName, "-Dcom.sun.management.jdp.address=224.0.1.2", "-Dcom.sun.management.jdp.port=1234", - "-Djava.util.logging.SimpleFormatter.format='%1$tF %1$tT %4$-7s %5$s %n'", + "-Djava.util.logging.SimpleFormatter.format=%1$tF %1$tT %4$-7s %5$s %n", testName }; return options; diff --git a/test/jdk/sun/management/jdp/JdpTestCase.java b/test/jdk/sun/management/jdp/JdpTestCase.java index f9178b5f07c..71277e1d2ad 100644 --- a/test/jdk/sun/management/jdp/JdpTestCase.java +++ b/test/jdk/sun/management/jdp/JdpTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * 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,10 +40,12 @@ import java.util.logging.Logger; public abstract class JdpTestCase { + + private static final int MAGIC = 0xC0FFEE42; // Jdp magic number. + private static final int BUFFER_LENGTH = 64 * 1024; // max UDP size, except for IPv6 jumbograms. + private static final int TIME_OUT_FACTOR = 10; // Socket times out after a multiple of the jdp pause. + final Logger log = Logger.getLogger("sun.management.jdp"); - final int MAGIC = 0xC0FFEE42; // Jdp magic number. - private static final int BUFFER_LENGTH = 64 * 1024; // max UDP size, except for IPv6 jumbograms. - private final int TIME_OUT_FACTOR = 10; // Socket times out after 10 times the jdp pause. protected int timeOut; private long startTime; protected ClientConnection connection; @@ -74,7 +76,7 @@ public void run() throws Exception { socket.receive(datagram); onReceived(extractUDPpayload(datagram)); } catch (SocketTimeoutException e) { - onSocketTimeOut(e); + onSocketTimeout(e); } if (!shouldContinue()) { @@ -117,7 +119,7 @@ private void onReceived(byte[] packet) throws Exception { /** * This method is executed when the socket has not received any packet for timeOut seconds. */ - abstract protected void onSocketTimeOut(SocketTimeoutException e) throws Exception; + abstract protected void onSocketTimeout(SocketTimeoutException e) throws Exception; /** * This method is executed after a correct Jdp packet has been received. @@ -156,7 +158,7 @@ protected void packetFromOtherVMReceived(Map payload) { * The test should stop if it has been 12 times the jdp.pause. * jdp.pause is how many seconds in between packets. *

    - * This timeout (12 times)is slightly longer than the socket timeout (10 times) on purpose. + * This timeout (12 times) is slightly longer than the socket timeout (10 times) on purpose. * In the off test case, the socket should time out first. * * @return diff --git a/test/jdk/sun/security/tools/jarsigner/compatibility/Compatibility.java b/test/jdk/sun/security/tools/jarsigner/compatibility/Compatibility.java index 7fab7d828ae..9b84f548c70 100644 --- a/test/jdk/sun/security/tools/jarsigner/compatibility/Compatibility.java +++ b/test/jdk/sun/security/tools/jarsigner/compatibility/Compatibility.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -67,6 +67,7 @@ import java.util.stream.Collectors; import java.util.stream.IntStream; +import jdk.security.jarsigner.JarSigner; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.util.JarUtils; @@ -1430,7 +1431,9 @@ private SignItem digestAlgorithm(String digestAlgorithm) { String expectedDigestAlg() { return digestAlgorithm != null ? digestAlgorithm - : jdkInfo.majorVersion >= 20 ? "SHA-384" : "SHA-256"; + : jdkInfo.majorVersion >= 20 + ? JarSigner.Builder.getDefaultDigestAlgorithm() + : "SHA-256"; } private SignItem tsaDigestAlgorithm(String tsaDigestAlgorithm) { @@ -1439,7 +1442,11 @@ private SignItem tsaDigestAlgorithm(String tsaDigestAlgorithm) { } String expectedTsaDigestAlg() { - return tsaDigestAlgorithm != null ? tsaDigestAlgorithm : "SHA-256"; + return tsaDigestAlgorithm != null + ? tsaDigestAlgorithm + : jdkInfo.majorVersion >= 20 + ? JarSigner.Builder.getDefaultDigestAlgorithm() + : "SHA-256"; } private SignItem tsaIndex(int tsaIndex) { diff --git a/test/jdk/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java b/test/jdk/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java index e87c147ab16..06d096de18a 100644 --- a/test/jdk/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java +++ b/test/jdk/sun/security/tools/jarsigner/multiRelease/MVJarSigningTest.java @@ -125,15 +125,15 @@ public static void main(String[] args) throws Throwable { private static void compile (String jarContent_path) throws Throwable { Path classes = Paths.get(USR_DIR, "classes", "base"); Path source = Paths.get(TEST_SRC, jarContent_path, "base", "version"); - CompilerUtils.compile(source, classes); + CompilerUtils.compile(source, classes, "--release", "8"); classes = Paths.get(USR_DIR, "classes", "v9"); source = Paths.get(TEST_SRC, jarContent_path , "v9", "version"); - CompilerUtils.compile(source, classes); + CompilerUtils.compile(source, classes, "--release", "9"); classes = Paths.get(USR_DIR, "classes", "v10"); source = Paths.get(TEST_SRC, jarContent_path, "v10", "version"); - CompilerUtils.compile(source, classes); + CompilerUtils.compile(source, classes, "--release", "10"); } private static OutputAnalyzer jar(String...args) throws Throwable { diff --git a/test/jdk/tools/jar/JarNoFileArgOperations.java b/test/jdk/tools/jar/JarNoFileArgOperations.java new file mode 100644 index 00000000000..1e6c9013e0f --- /dev/null +++ b/test/jdk/tools/jar/JarNoFileArgOperations.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.IOException; +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.jar.JarFile; +import java.util.jar.JarOutputStream; +import java.util.jar.Manifest; +import java.util.zip.ZipEntry; + +import jdk.test.lib.JDKToolFinder; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import static java.nio.charset.StandardCharsets.US_ASCII; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/* + * @test + * @bug 8345506 + * @summary verifies that the "jar" operations that are expected to work + * without the "--file" option work as expected + * @library /test/lib + * @run junit JarNoFileArgOperations + */ +public class JarNoFileArgOperations { + + private static final Path SCRATCH_DIR = Path.of("."); + private static final Path JAR_TOOL = Path.of(JDKToolFinder.getJDKTool("jar")).toAbsolutePath(); + private static final String JAR_ENTRY_NAME = "foobarhello.txt"; + + private static Path SIMPLE_JAR; + + private static void makeSimpleJar(final Path path) throws IOException { + final Manifest manifest = new Manifest(); + manifest.getMainAttributes().putValue("Manifest-Version", "1.0"); + try (OutputStream fos = Files.newOutputStream(path); + JarOutputStream jaros = new JarOutputStream(fos, manifest)) { + jaros.putNextEntry(new ZipEntry(JAR_ENTRY_NAME)); + jaros.write("foobar-8345506".getBytes(US_ASCII)); + jaros.closeEntry(); + } + } + + @BeforeAll + static void beforeAll() throws Exception { + final Path jarFile = Files.createTempFile(SCRATCH_DIR, "8345506", ".jar"); + makeSimpleJar(jarFile); + SIMPLE_JAR = jarFile; + System.out.println("created JAR file " + jarFile); + } + + /* + * Launches "jar --validate" by streaming the JAR file content through the "jar" tool + * process' STDIN and expects that the command completes normally. + */ + @Test + public void testValidate() throws Exception { + System.out.println("launching jar --validate"); + final ProcessBuilder pb = new ProcessBuilder() + .command(JAR_TOOL.toString(), "--validate") + // stream the JAR file content to the jar command through the process' STDIN + .redirectInput(SIMPLE_JAR.toFile()); + final OutputAnalyzer oa = ProcessTools.executeCommand(pb); + oa.shouldHaveExitValue(0); + } + + /* + * Launches "jar --list" and "jar -t" by streaming the JAR file content through the "jar" tool + * process' STDIN and expects that the command completes normally. + */ + @Test + public void testListing() throws Exception { + for (String opt : new String[]{"-t", "--list"}) { + final ProcessBuilder pb = new ProcessBuilder() + .command(JAR_TOOL.toString(), opt) + // stream the JAR file content to the jar command through the process' STDIN + .redirectInput(SIMPLE_JAR.toFile()); + final OutputAnalyzer oa = ProcessTools.executeCommand(pb); + oa.shouldHaveExitValue(0); + // verify the listing contained the JAR entry name + oa.contains(JAR_ENTRY_NAME); + } + } + + /* + * Launches "jar --extract" and "jar -x" by streaming the JAR file content through + * the "jar" tool process' STDIN and expects that the command completes normally. + */ + @Test + public void testExtract() throws Exception { + for (String opt : new String[]{"-x", "--extract"}) { + final Path tmpDestDir = Files.createTempDirectory(SCRATCH_DIR, "8345506"); + final ProcessBuilder pb = new ProcessBuilder() + .command(JAR_TOOL.toString(), opt, "--dir", tmpDestDir.toString()) + // stream the JAR file content to the jar command through the process' STDIN + .redirectInput(SIMPLE_JAR.toFile()); + final OutputAnalyzer oa = ProcessTools.executeCommand(pb); + oa.shouldHaveExitValue(0); + // verify the file content was extracted + assertTrue(Files.exists(tmpDestDir.resolve(JAR_ENTRY_NAME)), + JAR_ENTRY_NAME + " wasn't extracted to " + tmpDestDir); + } + } + + /* + * Launches "jar --update" and "jar -u" by streaming the JAR file content through + * the "jar" tool process' STDIN and expects that the command completes normally. + */ + @Test + public void testUpdate() throws Exception { + for (String opt : new String[]{"-u", "--update"}) { + // the updated JAR will be written out to this file + final Path destUpdatedJar = Files.createTempFile(SCRATCH_DIR, "8345506", ".jar"); + // an arbitrary file that will be added to the JAR file as + // part of the update operation + final Path fileToAdd = Files.createTempFile(SCRATCH_DIR, "8345506", ".txt"); + final String expectedNewEntry = fileToAdd.getFileName().toString(); + final ProcessBuilder pb = new ProcessBuilder() + .command(JAR_TOOL.toString(), opt, expectedNewEntry) + // stream the JAR file content to the jar command through the process' STDIN + .redirectInput(SIMPLE_JAR.toFile()) + // redirect the updated JAR to a file so that its contents can be verified + // later + .redirectOutput(destUpdatedJar.toFile()); + final OutputAnalyzer oa = ProcessTools.executeProcess(pb); + oa.shouldHaveExitValue(0); + System.out.println("updated JAR file at " + destUpdatedJar.toAbsolutePath()); + // verify, by listing the updated JAR file contents, + // that the JAR file has been updated to include the new file + try (final JarFile jar = new JarFile(destUpdatedJar.toFile())) { + jar.stream() + .map(ZipEntry::getName) + .filter((name) -> name.equals(expectedNewEntry)) + .findFirst() + .orElseThrow( + () -> new AssertionError("missing entry " + expectedNewEntry + + " in updated JAR file " + destUpdatedJar) + ); + } + } + } +} diff --git a/test/jdk/tools/jar/mmrjar/Basic.java b/test/jdk/tools/jar/mmrjar/Basic.java index 14c11edd47a..4d1d56f7c7a 100644 --- a/test/jdk/tools/jar/mmrjar/Basic.java +++ b/test/jdk/tools/jar/mmrjar/Basic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * 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,7 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.ArrayList; import java.util.Arrays; import java.util.Optional; import java.util.Set; @@ -80,25 +81,28 @@ public Basic() throws IOException { // compile the classes directory Path source = testsrc.resolve("src").resolve("classes"); Path destination = Paths.get("classes"); - javac(source, destination); + javac(source, destination, 8); // compile the mr9 directory including module-info.java source = testsrc.resolve("src").resolve("mr9"); destination = Paths.get("mr9"); - javac(source, destination); + javac(source, destination, 9); // move module-info.class for later use Files.move(destination.resolve("module-info.class"), Paths.get("module-info.class")); } - private void javac(Path source, Path destination) throws IOException { - String[] args = Stream.concat( - Stream.of("-d", destination.toString()), - Files.walk(source) - .map(Path::toString) - .filter(s -> s.endsWith(".java")) - ).toArray(String[]::new); + private void javac(Path source, Path destination, int release) throws IOException { + ArrayList arguments = new ArrayList(); + arguments.add("-d"); + arguments.add(destination); + arguments.add("--release"); + arguments.add(release); + try (var stream = Files.walk(source)) { + stream.map(Path::toString).filter(s -> s.endsWith(".java")).forEach(arguments::add); + } + String[] args = arguments.stream().map(Object::toString).toArray(String[]::new); JAVAC_TOOL.run(System.out, System.err, args); } @@ -110,8 +114,8 @@ private int jar(String cmd) { @AfterClass public void cleanup() throws IOException { - Files.walk(userdir, 1) - .filter(p -> !p.equals(userdir)) + try (var stream = Files.walk(userdir, 1)) { + stream.filter(p -> !p.equals(userdir)) .forEach(p -> { try { if (Files.isDirectory(p)) { @@ -123,6 +127,7 @@ public void cleanup() throws IOException { throw new UncheckedIOException(x); } }); + } } // updates a valid multi-release jar with a new public class in @@ -229,7 +234,7 @@ public void test5() throws IOException { // compile the mr10 directory Path source = testsrc.resolve("src").resolve("mr10"); Path destination = Paths.get("mr10"); - javac(source, destination); + javac(source, destination, 10); // create a directory for this tests special files Files.createDirectory(Paths.get("test5")); @@ -240,7 +245,7 @@ public void test5() throws IOException { Files.write(modinfo, hi.getBytes()); // and compile it - javac(modinfo, Paths.get("test5")); + javac(modinfo, Paths.get("test5"), 9); int rc = jar("--create --file mr.jar -C classes ."); Assert.assertEquals(rc, 0); @@ -335,7 +340,7 @@ public void test6() throws IOException { // compile the classes directory Path src = testsrc.resolve("src").resolve("classes"); Path dst = Paths.get("test6"); - javac(src, dst); + javac(src, dst, 8); byte[] mdBytes = Files.readAllBytes(Paths.get("module-info.class")); @@ -397,7 +402,7 @@ public void test7() throws IOException { // compile the classes directory Path src = testsrc.resolve("src").resolve("classes"); Path dst = Paths.get("test7"); - javac(src, dst); + javac(src, dst, 8); // move module-info.class to v9 later use Files.copy(Paths.get("module-info.class"), diff --git a/test/jdk/tools/jar/multiRelease/ApiValidatorTest.java b/test/jdk/tools/jar/multiRelease/ApiValidatorTest.java index 9b10540df85..b8c71305146 100644 --- a/test/jdk/tools/jar/multiRelease/ApiValidatorTest.java +++ b/test/jdk/tools/jar/multiRelease/ApiValidatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -82,8 +82,8 @@ public void changeMethodSignature(String sigBase, String sigV10, String base = classTemplate.replace(METHOD_SIG, sigBase); String v10 = classTemplate.replace(METHOD_SIG, sigV10); - compileTemplate(classes.resolve("base"), base); - compileTemplate(classes.resolve("v10"), v10); + compileTemplate(8, classes.resolve("base"), base); + compileTemplate(10, classes.resolve("v10"), v10); String jarfile = root.resolve("test.jar").toString(); OutputAnalyzer result = jar("cf", jarfile, @@ -135,8 +135,8 @@ public void introducingPublicMembers(String publicAPI) throws Throwable { String base = classTemplate.replace(API, ""); String v10 = classTemplate.replace(API, publicAPI); - compileTemplate(classes.resolve("base"), base); - compileTemplate(classes.resolve("v10"), v10); + compileTemplate(8, classes.resolve("base"), base); + compileTemplate(10, classes.resolve("v10"), v10); String failureMessage = "contains a class with different api from earlier version"; @@ -176,8 +176,8 @@ public void introducingPrivateMembers(String privateAPI) throws Throwable { String base = classTemplate.replace(API, ""); String v10 = classTemplate.replace(API, privateAPI); - compileTemplate(classes.resolve("base"), base); - compileTemplate(classes.resolve("v10"), v10); + compileTemplate(8, classes.resolve("base"), base); + compileTemplate(10, classes.resolve("v10"), v10); String jarfile = root.resolve("test.jar").toString(); jar("cf", jarfile, "-C", classes.resolve("base").toString(), ".", @@ -208,12 +208,12 @@ Object[][] privateAPI() { }; } - private void compileTemplate(Path classes, String template) throws Throwable { + private void compileTemplate(int release, Path classes, String template) throws Throwable { Path classSourceFile = Files.createDirectories( classes.getParent().resolve("src").resolve(classes.getFileName())) .resolve("C.java"); Files.write(classSourceFile, template.getBytes()); - javac(classes, classSourceFile); + javac(release, classes, classSourceFile); } /* Modular multi-release checks */ @@ -452,7 +452,7 @@ private void compileModule(Path classes, String moduleSource, sourceFiles[i + 1] = sourceFile; } - javac(classes, sourceFiles); + javac(9, classes, sourceFiles); } @SafeVarargs diff --git a/test/jdk/tools/jar/multiRelease/Basic.java b/test/jdk/tools/jar/multiRelease/Basic.java index ffde4849d1f..e826de71f32 100644 --- a/test/jdk/tools/jar/multiRelease/Basic.java +++ b/test/jdk/tools/jar/multiRelease/Basic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - # @bug 8186087 8196748 8212807 + # @bug 8186087 8196748 8212807 8268611 * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.compiler @@ -126,9 +126,9 @@ public void versionFormat() throws Throwable { Path classes = Paths.get("classes"); // valid - for (String release : List.of("10000", "09", "00010", "10")) { + for (String release : List.of("09", "00010", "10")) { jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".", - "--release", release, "-C", classes.resolve("v10").toString(), ".") + "--release", release, "-C", classes.resolve("v9").toString(), ".") .shouldHaveExitValue(SUCCESS) .shouldBeEmptyIgnoreVMWarnings(); } @@ -207,26 +207,16 @@ public void test03() throws Throwable { compare(jarfile, names); + // 8268611: The following creates an invalid JAR, which gets deleted. // write the v9 version/Version.class entry in base and the v10 // version/Version.class entry in versions/9 section jarTool("uf", jarfile, "-C", classes.resolve("v9").toString(), "version", "--release", "9", "-C", classes.resolve("v10").toString(), ".") - .shouldHaveExitValue(SUCCESS); - - checkMultiRelease(jarfile, true); - - names = Map.of( - "version/Main.class", - new String[]{"base", "version", "Main.class"}, - - "version/Version.class", - new String[]{"v9", "version", "Version.class"}, - - "META-INF/versions/9/version/Version.class", - new String[]{"v10", "version", "Version.class"} - ); - - compare(jarfile, names); + .shouldNotHaveExitValue(SUCCESS) + .shouldContain("META-INF/versions/9/version/Version.class") + .shouldContain(" has class file version 54,") + .shouldContain(" but class file version 53 or less is required") + .shouldContain(" to target release 9 of the Java Platform"); FileUtils.deleteFileIfExistsWithRetry(Paths.get(jarfile)); FileUtils.deleteFileTreeWithRetry(Paths.get(usr, "classes")); @@ -247,7 +237,7 @@ public void test04() throws Throwable { // replace the v9 class Path source = Paths.get(src, "data", "test04", "v9", "version"); - javac(classes.resolve("v9"), source.resolve("Version.java")); + javac(9, classes.resolve("v9"), source.resolve("Version.java")); jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") @@ -269,7 +259,7 @@ public void test05() throws Throwable { // add the new v9 class Path source = Paths.get(src, "data", "test05", "v9", "version"); - javac(classes.resolve("v9"), source.resolve("Extra.java")); + javac(9, classes.resolve("v9"), source.resolve("Extra.java")); jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") @@ -291,7 +281,7 @@ public void test06() throws Throwable { // add the new v9 class Path source = Paths.get(src, "data", "test06", "v9", "version"); - javac(classes.resolve("v9"), source.resolve("Extra.java")); + javac(9, classes.resolve("v9"), source.resolve("Extra.java")); jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") @@ -313,7 +303,7 @@ public void test07() throws Throwable { // add the new v9 class Path source = Paths.get(src, "data", "test01", "base", "version"); - javac(classes.resolve("v9"), source.resolve("Version.java")); + javac(9, classes.resolve("v9"), source.resolve("Version.java")); jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") @@ -382,11 +372,11 @@ public void test10() throws Throwable { // add a base class with a nested class Path source = Paths.get(src, "data", "test10", "base", "version"); - javac(classes.resolve("base"), source.resolve("Nested.java")); + javac(8, classes.resolve("base"), source.resolve("Nested.java")); // add a versioned class with a nested class source = Paths.get(src, "data", "test10", "v9", "version"); - javac(classes.resolve("v9"), source.resolve("Nested.java")); + javac(9, classes.resolve("v9"), source.resolve("Nested.java")); jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "9", "-C", classes.resolve("v9").toString(), ".") @@ -407,14 +397,14 @@ public void test11() throws Throwable { // add a base class with a nested class Path source = Paths.get(src, "data", "test10", "base", "version"); - javac(classes.resolve("base"), source.resolve("Nested.java")); + javac(8, classes.resolve("base"), source.resolve("Nested.java")); // remove the top level class, thus isolating the nested class Files.delete(classes.resolve("base").resolve("version").resolve("Nested.class")); // add a versioned class with a nested class source = Paths.get(src, "data", "test10", "v9", "version"); - javac(classes.resolve("v9"), source.resolve("Nested.java")); + javac(9, classes.resolve("v9"), source.resolve("Nested.java")); List output = jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".", @@ -460,11 +450,11 @@ public void test12() throws Throwable { // add a base class with a nested class Path source = Paths.get(src, "data", "test10", "base", "version"); - javac(classes.resolve("base"), source.resolve("Nested.java")); + javac(8, classes.resolve("base"), source.resolve("Nested.java")); // add a versioned class with a nested class source = Paths.get(src, "data", "test10", "v9", "version"); - javac(classes.resolve("v9"), source.resolve("Nested.java")); + javac(9, classes.resolve("v9"), source.resolve("Nested.java")); // remove the top level class, thus isolating the nested class Files.delete(classes.resolve("v9").resolve("version").resolve("Nested.class")); @@ -489,11 +479,11 @@ public void test13() throws Throwable { // add a base class with a nested and nested-nested class Path source = Paths.get(src, "data", "test13", "base", "version"); - javac(classes.resolve("base"), source.resolve("Nested.java")); + javac(8, classes.resolve("base"), source.resolve("Nested.java")); // add a versioned class with a nested and nested-nested class source = Paths.get(src, "data", "test13", "v10", "version"); - javac(classes.resolve("v10"), source.resolve("Nested.java")); + javac(10, classes.resolve("v10"), source.resolve("Nested.java")); jarTool("cf", jarfile, "-C", classes.resolve("base").toString(), ".", "--release", "10", "-C", classes.resolve("v10").toString(), ".") @@ -535,7 +525,7 @@ public void testCustomManifest() throws Throwable { jar("ufm", jarfile, manifest.toString(), "-C", classes.resolve("base").toString(), ".", - "--release", "9", "-C", classes.resolve("v10").toString(), ".") + "--release", "9", "-C", classes.resolve("v9").toString(), ".") .shouldHaveExitValue(SUCCESS) .shouldContain("WARNING: Duplicate name in Manifest: Multi-release."); diff --git a/test/jdk/tools/jar/multiRelease/Basic1.java b/test/jdk/tools/jar/multiRelease/Basic1.java index 9f86eb029cd..1312d890a5f 100644 --- a/test/jdk/tools/jar/multiRelease/Basic1.java +++ b/test/jdk/tools/jar/multiRelease/Basic1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,22 +52,22 @@ public void setup() throws Throwable { Path base = classes.resolve("base"); Files.createDirectories(base); Path source = Paths.get(src, "data", test, "base", "version"); - javac(base, source.resolve("Main.java"), source.resolve("Version.java")); + javac(8, base, source.resolve("Main.java"), source.resolve("Version.java")); Path v9 = classes.resolve("v9"); Files.createDirectories(v9); source = Paths.get(src, "data", test, "v9", "version"); - javac(v9, source.resolve("Version.java")); + javac(9, v9, source.resolve("Version.java")); Path v10 = classes.resolve("v10"); Files.createDirectories(v10); source = Paths.get(src, "data", test, "v10", "version"); - javac(v10, source.resolve("Version.java")); + javac(10, v10, source.resolve("Version.java")); Path v10_1 = classes.resolve("v10_1").resolve("META-INF").resolve("versions").resolve("v10"); Files.createDirectories(v10_1); source = Paths.get(src, "data", test, "v10", "version"); - javac(v10_1, source.resolve("Version.java")); + javac(10, v10_1, source.resolve("Version.java")); } @Test diff --git a/test/jdk/tools/jar/multiRelease/MRTestBase.java b/test/jdk/tools/jar/multiRelease/MRTestBase.java index 1a4d2f00e51..3bb9285fd4a 100644 --- a/test/jdk/tools/jar/multiRelease/MRTestBase.java +++ b/test/jdk/tools/jar/multiRelease/MRTestBase.java @@ -62,17 +62,17 @@ protected void compile(String test) throws Throwable { Path classes = Paths.get(usr, "classes", "base"); Files.createDirectories(classes); Path source = Paths.get(src, "data", test, "base", "version"); - javac(classes, source.resolve("Main.java"), source.resolve("Version.java")); + javac(8, classes, source.resolve("Main.java"), source.resolve("Version.java")); classes = Paths.get(usr, "classes", "v9"); Files.createDirectories(classes); source = Paths.get(src, "data", test, "v9", "version"); - javac(classes, source.resolve("Version.java")); + javac(9, classes, source.resolve("Version.java")); classes = Paths.get(usr, "classes", "v10"); Files.createDirectories(classes); source = Paths.get(src, "data", test, "v10", "version"); - javac(classes, source.resolve("Version.java")); + javac(10, classes, source.resolve("Version.java")); } protected void checkMultiRelease(String jarFile, @@ -101,23 +101,17 @@ protected void compare(String jarfile, } } - void javac(Path dest, Path... sourceFiles) throws Throwable { - javac(dest, List.of(), sourceFiles); - } - - void javac(Path dest, List extraParameters, Path... sourceFiles) throws Throwable { - + void javac(int release, Path dest, Path... sourceFiles) throws Throwable { List commands = new ArrayList<>(); String opts = System.getProperty("test.compiler.opts"); if (!opts.isEmpty()) { commands.addAll(Arrays.asList(opts.split(" +"))); } + commands.add("--release"); + commands.add(String.valueOf(release)); commands.add("-d"); commands.add(dest.toString()); - Stream.of(sourceFiles) - .map(Object::toString) - .forEach(x -> commands.add(x)); - commands.addAll(extraParameters); + Stream.of(sourceFiles).map(Object::toString).forEach(commands::add); StringWriter sw = new StringWriter(); try (PrintWriter pw = new PrintWriter(sw)) { diff --git a/test/jdk/tools/jar/multiRelease/VersionValidatorTest.java b/test/jdk/tools/jar/multiRelease/VersionValidatorTest.java index 6e285e20c90..f8dacb1d8dc 100644 --- a/test/jdk/tools/jar/multiRelease/VersionValidatorTest.java +++ b/test/jdk/tools/jar/multiRelease/VersionValidatorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -88,7 +88,7 @@ public class Lib { Path classesDir = root.resolve("classes").resolve(majorVersion); - javac(classesDir, List.of("--release", majorVersion), sourceFile); + javac(Integer.parseInt(majorVersion), classesDir, sourceFile); if (enablePreview) { rewriteMinorVersionForEnablePreviewClass(classesDir.resolve("Lib.class")); } diff --git a/test/jdk/tools/jlink/IntegrationTest.java b/test/jdk/tools/jlink/IntegrationTest.java index d79752f6d56..7f3dc223461 100644 --- a/test/jdk/tools/jlink/IntegrationTest.java +++ b/test/jdk/tools/jlink/IntegrationTest.java @@ -154,9 +154,13 @@ private static void test() throws Exception { mods.add("java.management"); Set limits = new HashSet<>(); limits.add("java.management"); + boolean linkFromRuntime = false; JlinkConfiguration config = new Jlink.JlinkConfiguration(output, mods, - JlinkTask.newModuleFinder(modulePaths, limits, mods), false, false, false); + JlinkTask.newLimitedFinder(JlinkTask.newModuleFinder(modulePaths), limits, mods), + linkFromRuntime, + false /* ignore modified runtime */, + false /* generate run-time image */); List lst = new ArrayList<>(); diff --git a/test/jdk/tools/jlink/bindservices/BindServices.java b/test/jdk/tools/jlink/bindservices/BindServices.java index 02f8bfd52d2..89095631040 100644 --- a/test/jdk/tools/jlink/bindservices/BindServices.java +++ b/test/jdk/tools/jlink/bindservices/BindServices.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,6 +21,9 @@ * questions. */ +import static jdk.test.lib.process.ProcessTools.executeProcess; +import static org.testng.Assert.assertTrue; + import java.io.File; import java.io.PrintWriter; import java.io.StringWriter; @@ -33,21 +36,20 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import jdk.test.lib.compiler.CompilerUtils; -import static jdk.test.lib.process.ProcessTools.*; - import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; -import static org.testng.Assert.*; + +import jdk.test.lib.compiler.CompilerUtils; +import jdk.tools.jlink.internal.LinkableRuntimeImage; /** * @test - * @bug 8174826 + * @bug 8174826 8345573 * @library /test/lib - * @modules jdk.compiler jdk.jlink + * @modules jdk.compiler jdk.jlink/jdk.tools.jlink.internal * @build BindServices jdk.test.lib.process.ProcessTools * jdk.test.lib.compiler.CompilerUtils - * @run testng BindServices + * @run testng/othervm BindServices */ public class BindServices { @@ -56,21 +58,23 @@ public class BindServices { private static final Path SRC_DIR = Paths.get(TEST_SRC, "src"); private static final Path MODS_DIR = Paths.get("mods"); + private static final boolean LINKABLE_RUNTIME = LinkableRuntimeImage.isLinkableRuntime(); + private static final boolean JMODS_EXIST = Files.exists(Paths.get(JAVA_HOME, "jmods")); - private static final String MODULE_PATH = - Paths.get(JAVA_HOME, "jmods").toString() + - File.pathSeparator + MODS_DIR.toString(); + private static final String MODULE_PATH = (JMODS_EXIST ? Paths.get(JAVA_HOME, "jmods").toString() + + File.pathSeparator : "") + + MODS_DIR.toString(); // the names of the modules in this test private static String[] modules = new String[] {"m1", "m2", "m3"}; - private static boolean hasJmods() { - if (!Files.exists(Paths.get(JAVA_HOME, "jmods"))) { - System.err.println("Test skipped. NO jmods directory"); - return false; + private static boolean isExplodedJDKImage() { + if (!JMODS_EXIST && !LINKABLE_RUNTIME) { + System.err.println("Test skipped. Not a linkable runtime and no JMODs"); + return true; } - return true; + return false; } /* @@ -78,7 +82,7 @@ private static boolean hasJmods() { */ @BeforeTest public void compileAll() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; for (String mn : modules) { Path msrc = SRC_DIR.resolve(mn); @@ -89,7 +93,7 @@ public void compileAll() throws Throwable { @Test public void noServiceBinding() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; Path dir = Paths.get("noServiceBinding"); @@ -103,7 +107,7 @@ public void noServiceBinding() throws Throwable { @Test public void fullServiceBinding() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; Path dir = Paths.get("fullServiceBinding"); @@ -122,7 +126,7 @@ public void fullServiceBinding() throws Throwable { @Test public void testVerbose() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; Path dir = Paths.get("verbose"); @@ -153,7 +157,7 @@ public void testVerbose() throws Throwable { @Test public void testVerboseAndNoBindServices() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; Path dir = Paths.get("verboseNoBind"); diff --git a/test/jdk/tools/jlink/bindservices/SuggestProviders.java b/test/jdk/tools/jlink/bindservices/SuggestProviders.java index 9685f927f8d..794d22fc570 100644 --- a/test/jdk/tools/jlink/bindservices/SuggestProviders.java +++ b/test/jdk/tools/jlink/bindservices/SuggestProviders.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,6 +21,9 @@ * questions. */ +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + import java.io.File; import java.io.PrintWriter; import java.io.StringWriter; @@ -32,17 +35,18 @@ import java.util.spi.ToolProvider; import java.util.stream.Collectors; import java.util.stream.Stream; -import jdk.test.lib.compiler.CompilerUtils; import org.testng.annotations.BeforeTest; import org.testng.annotations.Test; -import static org.testng.Assert.*; + +import jdk.test.lib.compiler.CompilerUtils; +import jdk.tools.jlink.internal.LinkableRuntimeImage; /** * @test - * @bug 8174826 + * @bug 8174826 8345573 * @library /lib/testlibrary /test/lib - * @modules jdk.charsets jdk.compiler jdk.jlink + * @modules jdk.charsets jdk.compiler jdk.jlink/jdk.tools.jlink.internal * @build SuggestProviders jdk.test.lib.compiler.CompilerUtils * @run testng SuggestProviders */ @@ -54,20 +58,23 @@ public class SuggestProviders { private static final Path SRC_DIR = Paths.get(TEST_SRC, "src"); private static final Path MODS_DIR = Paths.get("mods"); - private static final String MODULE_PATH = - Paths.get(JAVA_HOME, "jmods").toString() + - File.pathSeparator + MODS_DIR.toString(); + private static final boolean LINKABLE_RUNTIME = LinkableRuntimeImage.isLinkableRuntime(); + private static final boolean JMODS_EXIST = Files.exists(Paths.get(JAVA_HOME, "jmods")); + + private static final String MODULE_PATH = (JMODS_EXIST ? Paths.get(JAVA_HOME, "jmods").toString() + + File.pathSeparator : "") + + MODS_DIR.toString(); // the names of the modules in this test private static String[] modules = new String[] {"m1", "m2", "m3"}; - private static boolean hasJmods() { - if (!Files.exists(Paths.get(JAVA_HOME, "jmods"))) { - System.err.println("Test skipped. NO jmods directory"); - return false; + private static boolean isExplodedJDKImage() { + if (!JMODS_EXIST && !LINKABLE_RUNTIME) { + System.err.println("Test skipped. Not a linkable runtime and no JMODs"); + return true; } - return true; + return false; } /* @@ -75,7 +82,7 @@ private static boolean hasJmods() { */ @BeforeTest public void compileAll() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; for (String mn : modules) { Path msrc = SRC_DIR.resolve(mn); @@ -125,7 +132,7 @@ public void compileAll() throws Throwable { @Test public void suggestProviders() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; List output = JLink.run("--module-path", MODULE_PATH, "--suggest-providers").output(); @@ -145,7 +152,7 @@ public void suggestProviders() throws Throwable { */ @Test public void observableModules() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; List output = JLink.run("--module-path", MODULE_PATH, "--add-modules", "m1", @@ -165,7 +172,7 @@ public void observableModules() throws Throwable { */ @Test public void limitModules() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; List output = JLink.run("--module-path", MODULE_PATH, "--limit-modules", "m1", @@ -184,7 +191,7 @@ public void limitModules() throws Throwable { @Test public void providersForServices() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; List output = JLink.run("--module-path", MODULE_PATH, @@ -203,7 +210,7 @@ public void providersForServices() throws Throwable { @Test public void unusedService() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; List output = JLink.run("--module-path", MODULE_PATH, @@ -221,7 +228,7 @@ public void unusedService() throws Throwable { @Test public void nonExistentService() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; List output = JLink.run("--module-path", MODULE_PATH, @@ -236,7 +243,7 @@ public void nonExistentService() throws Throwable { @Test public void noSuggestProviders() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; List output = JLink.run("--module-path", MODULE_PATH, @@ -250,7 +257,7 @@ public void noSuggestProviders() throws Throwable { @Test public void suggestTypeNotRealProvider() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; List output = JLink.run("--module-path", MODULE_PATH, @@ -268,7 +275,7 @@ public void suggestTypeNotRealProvider() throws Throwable { @Test public void addNonObservableModule() throws Throwable { - if (!hasJmods()) return; + if (isExplodedJDKImage()) return; List output = JLink.run("--module-path", MODULE_PATH, diff --git a/test/jdk/tools/jlink/runtimeImage/AbstractLinkableRuntimeTest.java b/test/jdk/tools/jlink/runtimeImage/AbstractLinkableRuntimeTest.java index e7d5340e3b0..1df4455bc7d 100644 --- a/test/jdk/tools/jlink/runtimeImage/AbstractLinkableRuntimeTest.java +++ b/test/jdk/tools/jlink/runtimeImage/AbstractLinkableRuntimeTest.java @@ -192,7 +192,8 @@ protected Path jlinkUsingImage(JlinkSpec spec, OutputAnalyzerHandler handler, Pr // if the exit checker failed, we expected the other outcome // i.e. fail for success and success for fail. boolean successExit = analyzer.getExitValue() == 0; - String msg = String.format("Expected jlink to %s given a jmodless image. Exit code was: %d", + String msg = String.format("Expected jlink to %s given a linkable run-time image. " + + "Exit code was: %d", (successExit ? "fail" : "pass"), analyzer.getExitValue()); throw new AssertionError(msg); } diff --git a/test/langtools/ProblemList.txt b/test/langtools/ProblemList.txt index 6ac84faaf7d..1d8df78266a 100644 --- a/test/langtools/ProblemList.txt +++ b/test/langtools/ProblemList.txt @@ -1,6 +1,6 @@ ########################################################################### # -# Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/doclet/testBreakIterator/TestBreakIterator.java b/test/langtools/jdk/javadoc/doclet/testBreakIterator/TestBreakIterator.java index 31f1d3a66da..ec5e2c214ed 100644 --- a/test/langtools/jdk/javadoc/doclet/testBreakIterator/TestBreakIterator.java +++ b/test/langtools/jdk/javadoc/doclet/testBreakIterator/TestBreakIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/doclet/testBreakIterator/pkg/BreakIteratorTest.java b/test/langtools/jdk/javadoc/doclet/testBreakIterator/pkg/BreakIteratorTest.java index 3ea965377f6..04119bbb43a 100644 --- a/test/langtools/jdk/javadoc/doclet/testBreakIterator/pkg/BreakIteratorTest.java +++ b/test/langtools/jdk/javadoc/doclet/testBreakIterator/pkg/BreakIteratorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/doclet/testClassLinks/TestClassLinks.java b/test/langtools/jdk/javadoc/doclet/testClassLinks/TestClassLinks.java index a2bffa15305..21bb4abb2e6 100644 --- a/test/langtools/jdk/javadoc/doclet/testClassLinks/TestClassLinks.java +++ b/test/langtools/jdk/javadoc/doclet/testClassLinks/TestClassLinks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8163800 8175200 8186332 8182765 + * @bug 8163800 8175200 8186332 8182765 8345908 * @summary The fix for JDK-8072052 shows up other minor incorrect use of styles * @library ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -66,10 +66,10 @@ public void test() { checkOutput("p/C3.html", true, """ - I1, I12, I2, IT1<\ - /a><T>, IT2<\ + I1, I12, I2, IT1<\ + /a><T>, IT2<\ java.lang.String>""", """ C3()"""); @@ -90,7 +90,7 @@ public void test() { """ C3""", """ - I1, I1, I2"""); checkOutput("p/IT1.html", true, diff --git a/test/langtools/jdk/javadoc/doclet/testClassTree/TestClassTree.java b/test/langtools/jdk/javadoc/doclet/testClassTree/TestClassTree.java index 980a8622fa4..d1379d9656a 100644 --- a/test/langtools/jdk/javadoc/doclet/testClassTree/TestClassTree.java +++ b/test/langtools/jdk/javadoc/doclet/testClassTree/TestClassTree.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/doclet/testGenericTypeLink/TestGenericTypeLink.java b/test/langtools/jdk/javadoc/doclet/testGenericTypeLink/TestGenericTypeLink.java index b7f1a95ae1e..5b77a85a460 100644 --- a/test/langtools/jdk/javadoc/doclet/testGenericTypeLink/TestGenericTypeLink.java +++ b/test/langtools/jdk/javadoc/doclet/testGenericTypeLink/TestGenericTypeLink.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java b/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java index 0a92a489727..3ffb8b36ba3 100644 --- a/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java +++ b/test/langtools/jdk/javadoc/doclet/testHiddenTag/TestHiddenTag.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,8 +59,8 @@ public void test1() { """
    Direct Known Subclasses:
    A.VisibleInner\ - , A.VisibleInnerExtendsInvisibleInner
    """); + , A.Vis\ + ibleInnerExtendsInvisibleInner
    """); checkOutput("pkg1/A.html", false, "invisibleField", @@ -70,10 +70,11 @@ public void test1() { """ visibleField""", """ - visibleMethod""", + visibleMethod""", """

    Nested classes/interfaces in\ - herited from class pkg1.A

    + herited from class A A.VisibleInner, A.Visible\ InnerExtendsInvisibleInner @@ -92,7 +93,7 @@ public void test1() { """ visibleField""", """ - visibleMethod"""); + visibleMethod"""); checkOutput("pkg1/A.VisibleInnerExtendsInvisibleInner.html", false, "invisibleField", @@ -127,7 +128,7 @@ public void test1() { """ visibleMethod""", """ - visibleDefaultMethod""", + visibleDefaultMethod""", // Invisible return or parameter types must not be linked """ pkg1.InvisibleParent""", diff --git a/test/langtools/jdk/javadoc/doclet/testHtmlDocument/TestHtmlDocument.java b/test/langtools/jdk/javadoc/doclet/testHtmlDocument/TestHtmlDocument.java index 03adf00ca73..a4466c711b9 100644 --- a/test/langtools/jdk/javadoc/doclet/testHtmlDocument/TestHtmlDocument.java +++ b/test/langtools/jdk/javadoc/doclet/testHtmlDocument/TestHtmlDocument.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/doclet/testHtmlTableStyles/TestHtmlTableStyles.java b/test/langtools/jdk/javadoc/doclet/testHtmlTableStyles/TestHtmlTableStyles.java index c11e6d5f720..f2e6e75ec07 100644 --- a/test/langtools/jdk/javadoc/doclet/testHtmlTableStyles/TestHtmlTableStyles.java +++ b/test/langtools/jdk/javadoc/doclet/testHtmlTableStyles/TestHtmlTableStyles.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java b/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java index 0b8ff056059..349c1608af3 100644 --- a/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java +++ b/test/langtools/jdk/javadoc/doclet/testHtmlTableTags/TestHtmlTableTags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/doclet/testInheritance/TestInheritance.java b/test/langtools/jdk/javadoc/doclet/testInheritance/TestInheritance.java index 5ebb5157ecb..1d29290a51b 100644 --- a/test/langtools/jdk/javadoc/doclet/testInheritance/TestInheritance.java +++ b/test/langtools/jdk/javadoc/doclet/testInheritance/TestInheritance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java index 214f134f3ad..3b6d2fee06d 100644 --- a/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java +++ b/test/langtools/jdk/javadoc/doclet/testInterface/TestInterface.java @@ -76,8 +76,8 @@ public void test() { """
    All Known Implementing Classes:
    -
    Child, Parent
    +
    Child, Parent
    """); checkOutput("pkg/Child.html", true, @@ -205,22 +205,13 @@ public void test2() { // Ensure the correct type parameters are displayed correctly """

    Nested classes/int\ - erfaces inherited from interface pkg2.Spliterator

    + erfaces inherited from interface Spliterator Spliterator.\ OfDouble, Spliter\ - ator.OfInt<Integer>, Spliterator.OfPrimitive<T, T_C\ - ONS, T_SPLITR extends Spliterator.OfPrimitive<T,<\ - a href="Spliterator.OfPrimitive.html#type-param-T_CONS" title="type parameter in Spliterator.OfPri\ - mitive">T_CONS,T_SPLITR>>"""); + ator.OfInt<Integer>, Spliterator.OfPrimitive<T,T_CONS,T_SPLITR>"""); checkOutput("pkg2/Spliterator.html", true, """
    Nested Classes
    diff --git a/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java index be7afd303a5..cc1706bb17d 100644 --- a/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java +++ b/test/langtools/jdk/javadoc/doclet/testJavaFX/TestJavaFX.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -240,7 +240,7 @@ public void test1() { checkOutput("pkg1/D.html", true, """

    Properties inherited from class&\ - nbsp;pkg1.C

    + nbsp;C paused, rate"""); checkOutput("pkg1/D.html", false, "shouldNotAppear"); diff --git a/test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java b/test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java index ab1142f6a23..91eda7db191 100644 --- a/test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java +++ b/test/langtools/jdk/javadoc/doclet/testMemberInheritance/TestMemberInheritance.java @@ -56,7 +56,7 @@ public void test() { """, // Public method should be inherited """ - """, + """, // Public inner class should be inherited. """ """, @@ -65,16 +65,17 @@ public void test() { """, // Protected method should be inherited """ - """, + """, // Protected inner class should be inherited. """ """, // New labels as of 1.5.0 """ - Nested classes/interfaces inherited from class pkg.BaseClass""", + Nested classes/interfaces inherited from class BaseClass""", """ - Nested classes/interfaces inherited from interface pkg.BaseInterface"""); + Nested classes/interfaces inherited from interface BaseInterface"""); checkOutput("pkg/BaseClass.html", true, // Test overriding/implementing methods with generic parameters. @@ -89,7 +90,7 @@ interface in pkg">BaseInterface checkOutput("diamond/Z.html", true, // Test diamond inheritance member summary (6256068) """ - aMethod"""); + aMethod"""); checkOutput("inheritDist/C.html", true, // Test that doc is inherited from closed parent (6270645) @@ -112,7 +113,8 @@ interface in pkg">BaseInterface checkOutput("pkg1/Implementer.html", false, """ -

    Methods inherited from interface pkg1.Interface

    +

    Methods inherited from interface Interface

    between""" ); diff --git a/test/langtools/jdk/javadoc/doclet/testMethodSignature/TestMethodSignature.java b/test/langtools/jdk/javadoc/doclet/testMethodSignature/TestMethodSignature.java index 3a0f56962de..8d81b60e294 100644 --- a/test/langtools/jdk/javadoc/doclet/testMethodSignature/TestMethodSignature.java +++ b/test/langtools/jdk/javadoc/doclet/testMethodSignature/TestMethodSignature.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java index 4d3628544f8..88ccac31580 100644 --- a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java +++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java @@ -621,7 +621,7 @@ void checkModuleTags() { estpkgmdltags">TestClassInModuleTags.""", """ Member Link: testMethod(String).""", + lang.String)">TestClassInModuleTags.testMethod(String).""", """ Package Link: testpkgmdltags.""", """ @@ -892,7 +892,7 @@ void checkModuleModeCommon() { Type Link: TestClassInModuleTags.
    Member Link: testMethod(String).
    + Method(java.lang.String)">TestClassInModuleTags.testMethod(String).
    Package Link: testpkgmdltags.
    """); checkOutput("moduleA/module-summary.html", true, diff --git a/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java b/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java index 531fed92bc2..af98f1fd07a 100644 --- a/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java +++ b/test/langtools/jdk/javadoc/doclet/testNewLanguageFeatures/TestNewLanguageFeatures.java @@ -218,8 +218,8 @@ void checkTypeParameters() {
    All Implemented Interfaces:
    SubInterface&\ - lt;E>, Su\ - perInterface<E>
    + lt;E>, SuperInterface<\ + /a><E>
    """); checkOutput("pkg/SuperInterface.html", true, diff --git a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestMultiInheritance.java b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestMultiInheritance.java index ccd28448866..5ff7e83811e 100644 --- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestMultiInheritance.java +++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestMultiInheritance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,24 +52,24 @@ public void test() { checkOutput("pkg3/I1.html", true, """ - Methods inherited from interface pkg3.I2""", + Methods inherited from interface I2""", """ - Methods inherited from interface pkg3.I3"""); + Methods inherited from interface I3"""); checkOutput("pkg3/I0.html", true, """ - Methods inherited from interface pkg3.I2""", + Methods inherited from interface I2""", """ - Methods inherited from interface pkg3.I3"""); + Methods inherited from interface I3"""); // Method foo() is NOT inherited from I4 because it is overridden by I3. checkOutput("pkg3/I1.html", false, """ - Methods inherited from interface pkg3.I4"""); + Methods inherited from interface I4"""); checkOutput("pkg3/I0.html", false, """ - Methods inherited from interface pkg3.I4"""); + Methods inherited from interface I4"""); } } diff --git a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenDeprecatedMethods.java b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenDeprecatedMethods.java index 23e56b22c5c..af6313abd65 100644 --- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenDeprecatedMethods.java +++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenDeprecatedMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * 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 void test() { checkOrder("pkg1/SubClass.html", "Method Summary", """ - Methods declared in class pkg1.BaseClass""", + Methods declared in class BaseClass""", """ func3"""); diff --git a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverrideMethods.java b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverrideMethods.java index 75853955cd3..8a4aa614cd2 100644 --- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverrideMethods.java +++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverrideMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 8157000 8192850 8182765 8223607 8261976 8281376 8313204 + * @bug 8157000 8192850 8182765 8223607 8261976 8281376 8313204 8345777 * @summary test the behavior of --override-methods option * @library ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -79,25 +79,22 @@ public void testSummary() { checkOrder("pkg5/Classes.C.html", // Check nested classes - "Nested classes/interfaces declared in class pkg5.", - "Classes.P", - "Classes.P.PN.html", + "Nested classes/interfaces declared in class ", + "Classes.P.html#nested-class-summary", "Classes.P.PN.html", - """ - type parameter in Classes.P.PN">K""", - "type parameter in Classes.P.PN", + "K", "V", // Check properties """ - Properties declared in class pkg5.rate""", // Check fields """ - Fields declared in class pkg5.field0", @@ -116,9 +113,16 @@ public void testSummary() { // Check footnotes """ - Methods declared in class pkg5.m0", + """ + Classes.GP.html#m0()" title="m0()">m0""", + + // Check methods from java.lang.Object + """ + Methods declared in class java.lang.Object""", + """ + clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait""", // Check method details for override """ @@ -132,16 +136,20 @@ public void testSummary() { checkOrder("pkg5/Classes.C.html", // Check footnotes 2 - "Methods declared in class pkg5.", """ - Classes.P.html#getRate()">getRate""", - "Classes.P.html#m2()\">m2", - "Classes.P.html#m3()\">m3", - "Classes.P.html#m4(K,V)\">m4", + Methods declared in class rateProperty""", + Classes.P.html#getRate()" title="getRate()">getRate""", """ - Classes.P.html#setRate(double)">setRate""", + Classes.P.html#m2()" title="m2()">m2""", + """ + Classes.P.html#m3()" title="m3()">m3""", + """ + Classes.P.html#m4(K,V)" title="m4(Object, Object)">m4""", + """ + Classes.P.html#rateProperty()" title="rateProperty()">rateProperty""", + """ + Classes.P.html#setRate(double)" title="setRate(double)">setRate""", // Check @link """ @@ -221,18 +229,19 @@ public void testSummary() { Interfaces.C.html#o()">Interfaces.C.o()""", // Check nested classes - "Nested classes/interfaces declared in interface pkg5.", + "Nested classes/interfaces declared in interface ", "Interfaces.A", "Interfaces.A.AA.html", "Interfaces.A.AA", // Check properties """ - Properties declared in interface pkg5.Interfaces.A""", + Properties declared in interface Interfaces.A""", // Check Fields """ - Fields declared in interface pkg5.QUOTE", "Interfaces.A.html#rate\">rate", @@ -244,20 +253,23 @@ public void testSummary() { // Check footnotes """ - Methods declared in interface pkg5.getRate""", + """ + Interfaces.A.html#rateProperty()" title="rateProperty()">rateProperty""", + """ + Interfaces.A.html#setRate(double)" title="setRate(double)">setRate""", """ - Interfaces.A.html#getRate()">getRate""", + Methods declared in interface rateProperty""", - "Interfaces.A.html#setRate(double)", + Interfaces.B.html#m1()" title="m1()">m1""", """ - Methods declared in interface pkg5.m1", - "Interfaces.B.html#m3()\">m3", + Interfaces.B.html#m3()" title="m3()">m3""", """ - Methods declared in interface pkg5.o""" + o""" ); // Test synthetic values and valuesof of an enum. @@ -376,9 +388,10 @@ public void testSummary() { """, """
    -

    Methods declared in class p\ - kg6.Base

    - m1, m3, m9
    +

    Methods declared in class <\ + a href="Base.html#method-summary" title="class in pkg6">Base

    + m1, m3, m9 """); } @@ -399,9 +412,10 @@ public void testSummaryAnnotations() { """

    Methods declared in int\ - erface pkg7.Annotate\ - dBase

    - m1
    """); + erface AnnotatedBase + m1"""); checkOutput("pkg7/AnnotatedSub2.html", true, """ diff --git a/test/langtools/jdk/javadoc/doclet/testPrivateClasses/TestPrivateClasses.java b/test/langtools/jdk/javadoc/doclet/testPrivateClasses/TestPrivateClasses.java index bf715f895a3..d9117864c34 100644 --- a/test/langtools/jdk/javadoc/doclet/testPrivateClasses/TestPrivateClasses.java +++ b/test/langtools/jdk/javadoc/doclet/testPrivateClasses/TestPrivateClasses.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -158,14 +158,14 @@ public void testPrivate() { checkOutput("pkg/PublicChild.html", true, // Field inheritance from non-public superclass. """ - Fields inherited from class pkg.PrivateParent""", + Fields inherited from class PrivateParent""", """ fieldInheritedFromParent""", // Method inheritance from non-public superclass. """ - Methods inherited from class pkg.PrivateParent""", + Methods inherited from class PrivateParent""", """ - methodInheritedFromParent""", + methodInheritedFromParent""", // Should document that a method overrides method from private class. """
    Overrides:
    @@ -187,8 +187,8 @@ public void testPrivate() {
    All Implemented Interfaces:
    PrivateInterf\ - ace, Pu\ - blicInterface
    + ace, PublicInterface\ +
    """, """
    public class PrivateInterface""", + Fields inherited from interface PrivateInterface""", """ fieldInheritedFromInterface""", // Method inheritance from non-public superinterface. """ - Methods inherited from interface pkg.PrivateInterface""", + Methods inherited from interface PrivateInterface""", // Extend documented private classes or interfaces "extends", "All Superinterfaces", @@ -210,9 +210,8 @@ public void testPrivate() { """
    All Known Implementing Classes:
    -
    PrivateParent, PublicChild
    +
    PrivateParent, <\ + a href="PublicChild.html" title="class in pkg">PublicChild
    """); checkOutput("pkg/PrivateInterface.html", true, diff --git a/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java b/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java index f5f6ff213a0..d59aed41798 100644 --- a/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java +++ b/test/langtools/jdk/javadoc/doclet/testUseOption/TestUseOption.java @@ -24,7 +24,7 @@ /* * @test * @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351 8081854 8071982 8162363 8175200 8186332 - * 8182765 8196202 8202626 8261976 8323698 + * 8182765 8196202 8202626 8261976 8323698 8345770 * @summary A simple test to ensure class-use files are correct. * @library /tools/lib ../../lib * @modules jdk.javadoc/jdk.javadoc.internal.tool @@ -107,7 +107,10 @@ public void test1() { ); checkOutput("pkg1/class-use/UsedInterface.html", true, """ - AnAbstract""" + AnAbstract""", + """ + Link to interface method: Use\ + dInterface.doNothing().""" ); checkOutput("pkg1/class-use/UsedInterface.html", true, "../C10.html#withReturningTypeParameters()" diff --git a/test/langtools/jdk/javadoc/doclet/testUseOption/pkg1/AnAbstract.java b/test/langtools/jdk/javadoc/doclet/testUseOption/pkg1/AnAbstract.java index 4d31c6f36bd..ad7d8f3e719 100644 --- a/test/langtools/jdk/javadoc/doclet/testUseOption/pkg1/AnAbstract.java +++ b/test/langtools/jdk/javadoc/doclet/testUseOption/pkg1/AnAbstract.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,4 +22,8 @@ */ package pkg1; + +/** + * Link to interface method: {@link #doNothing}. + */ public abstract class AnAbstract implements UsedInterface {} diff --git a/test/langtools/jdk/javadoc/doclet/testVoidHtmlElements/TestVoidHtmlElements.java b/test/langtools/jdk/javadoc/doclet/testVoidHtmlElements/TestVoidHtmlElements.java index 518ecebd704..739564fd2eb 100644 --- a/test/langtools/jdk/javadoc/doclet/testVoidHtmlElements/TestVoidHtmlElements.java +++ b/test/langtools/jdk/javadoc/doclet/testVoidHtmlElements/TestVoidHtmlElements.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java b/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java index afcbdbe1987..23754f72f22 100644 --- a/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java +++ b/test/langtools/jdk/javadoc/lib/javadoc/tester/JavadocTester.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/SampleApi.java b/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/SampleApi.java index c3ec71e3fa7..29786dab6eb 100644 --- a/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/SampleApi.java +++ b/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/SampleApi.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/DocCommentGenerator.java b/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/DocCommentGenerator.java index 0a97c0b7524..b5a7046a658 100644 --- a/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/DocCommentGenerator.java +++ b/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/DocCommentGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/Documentifier.java b/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/Documentifier.java index 4b270e1754a..ac8d570ed44 100644 --- a/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/Documentifier.java +++ b/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/Documentifier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/ModuleGenerator.java b/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/ModuleGenerator.java index ccc32720f6a..b84e98fc93c 100644 --- a/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/ModuleGenerator.java +++ b/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/ModuleGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/PackageGenerator.java b/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/PackageGenerator.java index 9a59ade357d..4bcab1f0973 100644 --- a/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/PackageGenerator.java +++ b/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/generator/PackageGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/util/SimpleMultiplier.java b/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/util/SimpleMultiplier.java index 711644c0614..541f01b60ec 100644 --- a/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/util/SimpleMultiplier.java +++ b/test/langtools/jdk/javadoc/tool/sampleapi/lib/sampleapi/util/SimpleMultiplier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/javadoc/tool/testExternRedirects/TestExternRedirects.java b/test/langtools/jdk/javadoc/tool/testExternRedirects/TestExternRedirects.java index a2d98f4603e..144ec1f75bd 100644 --- a/test/langtools/jdk/javadoc/tool/testExternRedirects/TestExternRedirects.java +++ b/test/langtools/jdk/javadoc/tool/testExternRedirects/TestExternRedirects.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/jshell/CompletenessTest.java b/test/langtools/jdk/jshell/CompletenessTest.java index 06cbc6bd41f..c9fc5dc08c3 100644 --- a/test/langtools/jdk/jshell/CompletenessTest.java +++ b/test/langtools/jdk/jshell/CompletenessTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/jshell/ExceptionMessageTest.java b/test/langtools/jdk/jshell/ExceptionMessageTest.java index fe8eec57739..39cca56c612 100644 --- a/test/langtools/jdk/jshell/ExceptionMessageTest.java +++ b/test/langtools/jdk/jshell/ExceptionMessageTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/jshell/ExecPtyGetFlagsToSetTest.java b/test/langtools/jdk/jshell/ExecPtyGetFlagsToSetTest.java index efd1cd010cd..ef55d9dab00 100644 --- a/test/langtools/jdk/jshell/ExecPtyGetFlagsToSetTest.java +++ b/test/langtools/jdk/jshell/ExecPtyGetFlagsToSetTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/jshell/ReplToolTesting.java b/test/langtools/jdk/jshell/ReplToolTesting.java index 589b7b5cf39..d08c1008386 100644 --- a/test/langtools/jdk/jshell/ReplToolTesting.java +++ b/test/langtools/jdk/jshell/ReplToolTesting.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/jshell/ShutdownTest.java b/test/langtools/jdk/jshell/ShutdownTest.java index da4e516f94c..d97b83950cc 100644 --- a/test/langtools/jdk/jshell/ShutdownTest.java +++ b/test/langtools/jdk/jshell/ShutdownTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/jshell/ToolProviderTest.java b/test/langtools/jdk/jshell/ToolProviderTest.java index e27ed410d52..ada5f34d8c0 100644 --- a/test/langtools/jdk/jshell/ToolProviderTest.java +++ b/test/langtools/jdk/jshell/ToolProviderTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/jshell/ToolSimpleTest.java b/test/langtools/jdk/jshell/ToolSimpleTest.java index 60d4f369521..81f75a3863e 100644 --- a/test/langtools/jdk/jshell/ToolSimpleTest.java +++ b/test/langtools/jdk/jshell/ToolSimpleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/jdk/jshell/VariablesTest.java b/test/langtools/jdk/jshell/VariablesTest.java index 98a543e77a9..a7aabc0ead6 100644 --- a/test/langtools/jdk/jshell/VariablesTest.java +++ b/test/langtools/jdk/jshell/VariablesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/doclint/CoverageExtras.java b/test/langtools/tools/doclint/CoverageExtras.java index 55ac63d6ab3..9cf65164f6d 100644 --- a/test/langtools/tools/doclint/CoverageExtras.java +++ b/test/langtools/tools/doclint/CoverageExtras.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/4241573/T4241573.java b/test/langtools/tools/javac/4241573/T4241573.java index de832aef706..9f3240a1f3e 100644 --- a/test/langtools/tools/javac/4241573/T4241573.java +++ b/test/langtools/tools/javac/4241573/T4241573.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/6304921/TestLog.java b/test/langtools/tools/javac/6304921/TestLog.java index 3d88aa6fdfd..41695554a88 100644 --- a/test/langtools/tools/javac/6304921/TestLog.java +++ b/test/langtools/tools/javac/6304921/TestLog.java @@ -41,6 +41,7 @@ import com.sun.tools.javac.file.JavacFileManager; import com.sun.tools.javac.parser.Parser; import com.sun.tools.javac.parser.ParserFactory; +import com.sun.tools.javac.resources.CompilerProperties.LintWarnings; import com.sun.tools.javac.tree.EndPosTable; import com.sun.tools.javac.tree.JCTree; import com.sun.tools.javac.tree.TreeScanner; @@ -51,7 +52,6 @@ import com.sun.tools.javac.util.JCDiagnostic.Factory; import com.sun.tools.javac.util.Options; import com.sun.tools.javac.resources.CompilerProperties.Errors; -import com.sun.tools.javac.resources.CompilerProperties.Warnings; public class TestLog { @@ -130,10 +130,10 @@ public void visitIf(JCTree.JCIf tree) { log.error(tree.pos(), Errors.NotStmt); log.error(nil, Errors.NotStmt); - log.warning(Warnings.DivZero); - log.warning(tree.pos, Warnings.DivZero); - log.warning(tree.pos(), Warnings.DivZero); - log.warning(nil, Warnings.DivZero); + log.warning(LintWarnings.DivZero); + log.warning(tree.pos, LintWarnings.DivZero); + log.warning(tree.pos(), LintWarnings.DivZero); + log.warning(nil, LintWarnings.DivZero); } private Log log; diff --git a/test/langtools/tools/javac/6341866/T6341866.java b/test/langtools/tools/javac/6341866/T6341866.java index c04653ed58d..47d17f30ee2 100644 --- a/test/langtools/tools/javac/6341866/T6341866.java +++ b/test/langtools/tools/javac/6341866/T6341866.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/6402516/TestClass.java b/test/langtools/tools/javac/6402516/TestClass.java index 57131cddaf9..3b517db048f 100644 --- a/test/langtools/tools/javac/6402516/TestClass.java +++ b/test/langtools/tools/javac/6402516/TestClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/6402516/TestLocalElements.java b/test/langtools/tools/javac/6402516/TestLocalElements.java index 7b835bfdcc3..9dc8a572969 100644 --- a/test/langtools/tools/javac/6402516/TestLocalElements.java +++ b/test/langtools/tools/javac/6402516/TestLocalElements.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/6402516/TestMethod.java b/test/langtools/tools/javac/6402516/TestMethod.java index 304b0abd9cb..1175cf41ca6 100644 --- a/test/langtools/tools/javac/6402516/TestMethod.java +++ b/test/langtools/tools/javac/6402516/TestMethod.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/7003595/T7003595.java b/test/langtools/tools/javac/7003595/T7003595.java index 3aafbf74b6a..ed676c0e4ec 100644 --- a/test/langtools/tools/javac/7003595/T7003595.java +++ b/test/langtools/tools/javac/7003595/T7003595.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java b/test/langtools/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java index 1fd3fb3fbcc..bdd9c709e40 100644 --- a/test/langtools/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java +++ b/test/langtools/tools/javac/7153958/CPoolRefClassContainingInlinedCts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/8000518/DuplicateConstantPoolEntry.java b/test/langtools/tools/javac/8000518/DuplicateConstantPoolEntry.java index 99ad19203b5..dc63452745e 100644 --- a/test/langtools/tools/javac/8000518/DuplicateConstantPoolEntry.java +++ b/test/langtools/tools/javac/8000518/DuplicateConstantPoolEntry.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java b/test/langtools/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java index 4ba8c7a6491..6c603c590d3 100644 --- a/test/langtools/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java +++ b/test/langtools/tools/javac/8005931/CheckACC_STRICTFlagOnPkgAccessClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/8009170/RedundantByteCodeInArrayTest.java b/test/langtools/tools/javac/8009170/RedundantByteCodeInArrayTest.java index 8b8eb23be4d..7bea6f6834a 100644 --- a/test/langtools/tools/javac/8009170/RedundantByteCodeInArrayTest.java +++ b/test/langtools/tools/javac/8009170/RedundantByteCodeInArrayTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/AnonymousClass/AnonymousClassFlags.java b/test/langtools/tools/javac/AnonymousClass/AnonymousClassFlags.java index e163a4350cd..f60cb33798b 100644 --- a/test/langtools/tools/javac/AnonymousClass/AnonymousClassFlags.java +++ b/test/langtools/tools/javac/AnonymousClass/AnonymousClassFlags.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/ImportModule.java b/test/langtools/tools/javac/ImportModule.java index 1224a9d7470..ac00ea823f1 100644 --- a/test/langtools/tools/javac/ImportModule.java +++ b/test/langtools/tools/javac/ImportModule.java @@ -23,7 +23,7 @@ /** * @test - * @bug 8328481 8332236 8332890 + * @bug 8328481 8332236 8332890 8344647 * @summary Check behavior of module imports. * @library /tools/lib * @modules java.logging @@ -33,7 +33,7 @@ * jdk.compiler/com.sun.tools.javac.util * @build toolbox.ToolBox toolbox.JavacTask * @run main ImportModule -*/ + */ import com.sun.source.tree.Tree; import com.sun.source.util.TaskEvent; @@ -829,6 +829,7 @@ public class Test { } } + @Test public void testPackageImportDisambiguates(Path base) throws Exception { Path current = base.resolve("."); Path src = current.resolve("src"); @@ -919,4 +920,50 @@ public class Test { .run(Task.Expect.SUCCESS) .writeAll(); } + + @Test //JDK-8344647 + public void testJavaBaseOverride(Path base) throws Exception { + Path current = base.resolve("."); + Path src = current.resolve("src"); + Path javaBaseClasses = current.resolve("javaBaseClasses"); + Path javaBase = src.resolve("java.base"); + tb.writeJavaFiles(javaBase, + """ + module java.base { + exports java.lang; + } + """, + """ + package java.lang; + public class Object {} + """); + + Files.createDirectories(javaBaseClasses); + + new JavacTask(tb) + .options("--patch-module", "java.base=" + src.toString()) + .outdir(javaBaseClasses) + .files(tb.findJavaFiles(src)) + .run(Task.Expect.SUCCESS) + .writeAll() + .getOutputLines(Task.OutputKind.DIRECT); + + Path test = current.resolve("test"); + tb.writeJavaFiles(test, + """ + module test { + requires java.se; + } + """); + + Path classes = current.resolve("classes"); + Files.createDirectories(classes); + + new JavacTask(tb) + .options("--patch-module", "java.base=" + javaBaseClasses.toString()) + .outdir(classes) + .files(tb.findJavaFiles(test)) + .run(Task.Expect.SUCCESS) + .writeAll(); + } } diff --git a/test/langtools/tools/javac/LocalFreeVarStaticInstantiate.java b/test/langtools/tools/javac/LocalFreeVarStaticInstantiate.java index 39b419c694a..09d33573da5 100644 --- a/test/langtools/tools/javac/LocalFreeVarStaticInstantiate.java +++ b/test/langtools/tools/javac/LocalFreeVarStaticInstantiate.java @@ -1,6 +1,6 @@ /* * @test /nodynamiccopyright/ - * @bug 8322882 + * @bug 8322882 8345953 * @summary Disallow attempts to access a free variable proxy field from a static method * @compile/fail/ref=LocalFreeVarStaticInstantiate.out -XDrawDiagnostics LocalFreeVarStaticInstantiate.java */ @@ -41,4 +41,61 @@ class Local { }; } }; + + // local class in switch + static Object bar = switch (foo) { + case Runnable r -> { + Object there = ""; + class Local { + { + there.hashCode(); + } + + static { + new Local(); // can't get there from here + } + + static Runnable r = () -> { + new Local(); // can't get there from here + }; + } + yield r; + } + }; + + // local class in instance init + { + Object there = ""; + class Local { + { + there.hashCode(); + } + + static { + new Local(); // can't get there from here + } + + static Runnable r = () -> { + new Local(); // can't get there from here + }; + } + } + + // local class in static init + static { + Object there = ""; + class Local { + { + there.hashCode(); + } + + static { + new Local(); // can't get there from here + } + + static Runnable r = () -> { + new Local(); // can't get there from here + }; + } + } } diff --git a/test/langtools/tools/javac/LocalFreeVarStaticInstantiate.out b/test/langtools/tools/javac/LocalFreeVarStaticInstantiate.out index 50e913083b0..9c26cf4a527 100644 --- a/test/langtools/tools/javac/LocalFreeVarStaticInstantiate.out +++ b/test/langtools/tools/javac/LocalFreeVarStaticInstantiate.out @@ -2,4 +2,10 @@ LocalFreeVarStaticInstantiate.java:18:17: compiler.err.local.cant.be.inst.static LocalFreeVarStaticInstantiate.java:22:17: compiler.err.local.cant.be.inst.static: kindname.class, Local LocalFreeVarStaticInstantiate.java:36:17: compiler.err.local.cant.be.inst.static: kindname.class, Local LocalFreeVarStaticInstantiate.java:40:17: compiler.err.local.cant.be.inst.static: kindname.class, Local -4 errors +LocalFreeVarStaticInstantiate.java:55:21: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticInstantiate.java:59:21: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticInstantiate.java:75:17: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticInstantiate.java:79:17: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticInstantiate.java:93:17: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticInstantiate.java:97:17: compiler.err.local.cant.be.inst.static: kindname.class, Local +10 errors diff --git a/test/langtools/tools/javac/LocalFreeVarStaticSuper.java b/test/langtools/tools/javac/LocalFreeVarStaticSuper.java new file mode 100644 index 00000000000..332eb239e35 --- /dev/null +++ b/test/langtools/tools/javac/LocalFreeVarStaticSuper.java @@ -0,0 +1,161 @@ +/* + * @test /nodynamiccopyright/ + * @bug 8345944 + * @summary JEP 492: extending local class in a different static context should not be allowed + * @compile/fail/ref=LocalFreeVarStaticSuper.out -XDrawDiagnostics LocalFreeVarStaticSuper.java + */ + +class LocalFreeVarStaticSuper { + + // local class in method + static void foo(Object there) { + class Local { + { + there.hashCode(); + } + + static { + class Sub1 extends Local { } + class Sub2 extends Local { + Sub2() { } + } + class Sub3 extends Local { + Sub3() { super(); } + } + } + + static Runnable r = () -> { + class Sub1 extends Local { } + class Sub2 extends Local { + Sub2() { } + } + class Sub3 extends Local { + Sub3() { super(); } + } + }; + } + } + + // local class in lambda + static Runnable foo = () -> { + Object there = ""; + class Local { + { + there.hashCode(); + } + + static { + class Sub1 extends Local { } + class Sub2 extends Local { + Sub2() { } + } + class Sub3 extends Local { + Sub3() { super(); } + } + } + + static Runnable r = () -> { + class Sub1 extends Local { } + class Sub2 extends Local { + Sub2() { } + } + class Sub3 extends Local { + Sub3() { super(); } + } + }; + } + }; + + // local class in switch + static Object bar = switch (foo) { + case Runnable r -> { + Object there = ""; + class Local { + { + there.hashCode(); + } + + static { + class Sub1 extends Local { } + class Sub2 extends Local { + Sub2() { } + } + class Sub3 extends Local { + Sub3() { super(); } + } + } + + static Runnable r = () -> { + class Sub1 extends Local { } + class Sub2 extends Local { + Sub2() { } + } + class Sub3 extends Local { + Sub3() { super(); } + } + }; + } + yield r; + } + }; + + // local class in instance init + { + Object there = ""; + class Local { + { + there.hashCode(); + } + + static { + class Sub1 extends Local { } + class Sub2 extends Local { + Sub2() { } + } + class Sub3 extends Local { + Sub3() { super(); } + } + } + + static Runnable r = () -> { + class Sub1 extends Local { } + class Sub2 extends Local { + Sub2() { } + } + class Sub3 extends Local { + Sub3() { super(); } + } + }; + } + } + + // local class in static init + static { + Object there = ""; + class Local { + { + there.hashCode(); + } + + static { + class Sub1 extends Local { } + class Sub2 extends Local { + Sub2() { } + } + class Sub3 extends Local { + Sub3() { super(); } + } + } + + static Runnable r = () -> { + class Sub1 extends Local { } + class Sub2 extends Local { + Sub2() { } + } + class Sub3 extends Local { + Sub3() { super(); } + } + }; + } + } +} diff --git a/test/langtools/tools/javac/LocalFreeVarStaticSuper.out b/test/langtools/tools/javac/LocalFreeVarStaticSuper.out new file mode 100644 index 00000000000..d85451337bd --- /dev/null +++ b/test/langtools/tools/javac/LocalFreeVarStaticSuper.out @@ -0,0 +1,31 @@ +LocalFreeVarStaticSuper.java:18:17: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:20:28: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:23:30: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:28:17: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:30:28: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:33:30: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:48:17: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:50:28: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:53:30: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:58:17: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:60:28: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:63:30: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:79:21: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:81:32: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:84:34: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:89:21: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:91:32: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:94:34: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:111:17: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:113:28: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:116:30: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:121:17: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:123:28: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:126:30: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:141:17: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:143:28: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:146:30: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:151:17: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:153:28: compiler.err.local.cant.be.inst.static: kindname.class, Local +LocalFreeVarStaticSuper.java:156:30: compiler.err.local.cant.be.inst.static: kindname.class, Local +30 errors diff --git a/test/langtools/tools/javac/MethodParameters/AnnotationTest.java b/test/langtools/tools/javac/MethodParameters/AnnotationTest.java index c373de15e52..c2a74424ed4 100644 --- a/test/langtools/tools/javac/MethodParameters/AnnotationTest.java +++ b/test/langtools/tools/javac/MethodParameters/AnnotationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/MethodParameters/AnonymousClass.java b/test/langtools/tools/javac/MethodParameters/AnonymousClass.java index d0bf322b0c6..711fcaf2a53 100644 --- a/test/langtools/tools/javac/MethodParameters/AnonymousClass.java +++ b/test/langtools/tools/javac/MethodParameters/AnonymousClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/MethodParameters/ClassFileVisitor.java b/test/langtools/tools/javac/MethodParameters/ClassFileVisitor.java index 5a2f3dfd377..b3690e4305e 100644 --- a/test/langtools/tools/javac/MethodParameters/ClassFileVisitor.java +++ b/test/langtools/tools/javac/MethodParameters/ClassFileVisitor.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/MethodParameters/Constructors.java b/test/langtools/tools/javac/MethodParameters/Constructors.java index 27c146ad049..0c393fda56b 100644 --- a/test/langtools/tools/javac/MethodParameters/Constructors.java +++ b/test/langtools/tools/javac/MethodParameters/Constructors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/MethodParameters/EnumTest.java b/test/langtools/tools/javac/MethodParameters/EnumTest.java index f7570644ecd..1a411393556 100644 --- a/test/langtools/tools/javac/MethodParameters/EnumTest.java +++ b/test/langtools/tools/javac/MethodParameters/EnumTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/MethodParameters/InstanceMethods.java b/test/langtools/tools/javac/MethodParameters/InstanceMethods.java index c3d45270c8e..6afb4e2fa0d 100644 --- a/test/langtools/tools/javac/MethodParameters/InstanceMethods.java +++ b/test/langtools/tools/javac/MethodParameters/InstanceMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/MethodParameters/LambdaTest.java b/test/langtools/tools/javac/MethodParameters/LambdaTest.java index cad796a12fd..c1dbe70c8de 100644 --- a/test/langtools/tools/javac/MethodParameters/LambdaTest.java +++ b/test/langtools/tools/javac/MethodParameters/LambdaTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/MethodParameters/LocalClassTest.java b/test/langtools/tools/javac/MethodParameters/LocalClassTest.java index 554ed798316..7456092244a 100644 --- a/test/langtools/tools/javac/MethodParameters/LocalClassTest.java +++ b/test/langtools/tools/javac/MethodParameters/LocalClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/MethodParameters/MemberClassTest.java b/test/langtools/tools/javac/MethodParameters/MemberClassTest.java index b0ea9c9fbee..67e982c6f7e 100644 --- a/test/langtools/tools/javac/MethodParameters/MemberClassTest.java +++ b/test/langtools/tools/javac/MethodParameters/MemberClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/MethodParameters/StaticMethods.java b/test/langtools/tools/javac/MethodParameters/StaticMethods.java index 24cadb6ca36..b8cd80da867 100644 --- a/test/langtools/tools/javac/MethodParameters/StaticMethods.java +++ b/test/langtools/tools/javac/MethodParameters/StaticMethods.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/MethodParameters/UncommonParamNames.java b/test/langtools/tools/javac/MethodParameters/UncommonParamNames.java index f531db7a09a..8853a50f516 100644 --- a/test/langtools/tools/javac/MethodParameters/UncommonParamNames.java +++ b/test/langtools/tools/javac/MethodParameters/UncommonParamNames.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/NoStringToLower.java b/test/langtools/tools/javac/NoStringToLower.java index ed787c759f4..d5e9e0fdc01 100644 --- a/test/langtools/tools/javac/NoStringToLower.java +++ b/test/langtools/tools/javac/NoStringToLower.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/RequiredParameterFlags/ImplicitParameters.java b/test/langtools/tools/javac/RequiredParameterFlags/ImplicitParameters.java index b53238ce4e5..921d8490f2c 100644 --- a/test/langtools/tools/javac/RequiredParameterFlags/ImplicitParameters.java +++ b/test/langtools/tools/javac/RequiredParameterFlags/ImplicitParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/StringConcat/access/Test.java b/test/langtools/tools/javac/StringConcat/access/Test.java index d9d7332e876..d7e9203e93d 100644 --- a/test/langtools/tools/javac/StringConcat/access/Test.java +++ b/test/langtools/tools/javac/StringConcat/access/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/SuperInit/SuperInitGood.java b/test/langtools/tools/javac/SuperInit/SuperInitGood.java index 1d0e928a0d0..11b845f7d32 100644 --- a/test/langtools/tools/javac/SuperInit/SuperInitGood.java +++ b/test/langtools/tools/javac/SuperInit/SuperInitGood.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T6695379/AnnotationsAreNotCopiedToBridgeMethodsTest.java b/test/langtools/tools/javac/T6695379/AnnotationsAreNotCopiedToBridgeMethodsTest.java index b842f1a54ff..b7f0aab11d5 100644 --- a/test/langtools/tools/javac/T6695379/AnnotationsAreNotCopiedToBridgeMethodsTest.java +++ b/test/langtools/tools/javac/T6695379/AnnotationsAreNotCopiedToBridgeMethodsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T6970173/DebugPointerAtBadPositionTest.java b/test/langtools/tools/javac/T6970173/DebugPointerAtBadPositionTest.java index 070d45d2be3..e20d366a384 100644 --- a/test/langtools/tools/javac/T6970173/DebugPointerAtBadPositionTest.java +++ b/test/langtools/tools/javac/T6970173/DebugPointerAtBadPositionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java b/test/langtools/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java index 62bae68ad36..77ea804eeea 100644 --- a/test/langtools/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java +++ b/test/langtools/tools/javac/T7008643/InlinedFinallyConfuseDebuggersTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T7053059/DoubleCastTest.java b/test/langtools/tools/javac/T7053059/DoubleCastTest.java index 4353a119ec7..3567e7c88f7 100644 --- a/test/langtools/tools/javac/T7053059/DoubleCastTest.java +++ b/test/langtools/tools/javac/T7053059/DoubleCastTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T7093325.java b/test/langtools/tools/javac/T7093325.java index 0b527794c1a..2dfb171ea70 100644 --- a/test/langtools/tools/javac/T7093325.java +++ b/test/langtools/tools/javac/T7093325.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T7165659/InnerClassAttrMustNotHaveStrictFPFlagTest.java b/test/langtools/tools/javac/T7165659/InnerClassAttrMustNotHaveStrictFPFlagTest.java index 493dbab113d..a2c117fcdf8 100644 --- a/test/langtools/tools/javac/T7165659/InnerClassAttrMustNotHaveStrictFPFlagTest.java +++ b/test/langtools/tools/javac/T7165659/InnerClassAttrMustNotHaveStrictFPFlagTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8003967/DetectMutableStaticFields.java b/test/langtools/tools/javac/T8003967/DetectMutableStaticFields.java index ee170ec939e..ef3e400481d 100644 --- a/test/langtools/tools/javac/T8003967/DetectMutableStaticFields.java +++ b/test/langtools/tools/javac/T8003967/DetectMutableStaticFields.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8010737/ParameterNamesAreNotCopiedToAnonymousInitTest.java b/test/langtools/tools/javac/T8010737/ParameterNamesAreNotCopiedToAnonymousInitTest.java index a72c768aaef..8194c1f6423 100644 --- a/test/langtools/tools/javac/T8010737/ParameterNamesAreNotCopiedToAnonymousInitTest.java +++ b/test/langtools/tools/javac/T8010737/ParameterNamesAreNotCopiedToAnonymousInitTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8011181/EmptyUTF8ForInnerClassNameTest.java b/test/langtools/tools/javac/T8011181/EmptyUTF8ForInnerClassNameTest.java index 4f32bc090c3..f4a2813b455 100644 --- a/test/langtools/tools/javac/T8011181/EmptyUTF8ForInnerClassNameTest.java +++ b/test/langtools/tools/javac/T8011181/EmptyUTF8ForInnerClassNameTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8019486/WrongLNTForLambdaTest.java b/test/langtools/tools/javac/T8019486/WrongLNTForLambdaTest.java index c916089f4ed..33bb9bb598a 100644 --- a/test/langtools/tools/javac/T8019486/WrongLNTForLambdaTest.java +++ b/test/langtools/tools/javac/T8019486/WrongLNTForLambdaTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java b/test/langtools/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java index 1870cc4cfa1..bbfe10b2524 100644 --- a/test/langtools/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java +++ b/test/langtools/tools/javac/T8022186/DeadCodeGeneratedForEmptyTryTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java b/test/langtools/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java index df6c32dcd48..381318ab621 100644 --- a/test/langtools/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java +++ b/test/langtools/tools/javac/T8024039/NoDeadCodeGenerationOnTrySmtTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8028504/DontGenerateLVTForGNoneOpTest.java b/test/langtools/tools/javac/T8028504/DontGenerateLVTForGNoneOpTest.java index 759b78cb929..6af82b27be8 100644 --- a/test/langtools/tools/javac/T8028504/DontGenerateLVTForGNoneOpTest.java +++ b/test/langtools/tools/javac/T8028504/DontGenerateLVTForGNoneOpTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8180141/MissingLNTEntryForBreakContinueTest.java b/test/langtools/tools/javac/T8180141/MissingLNTEntryForBreakContinueTest.java index ad33759899f..6aaea53192f 100644 --- a/test/langtools/tools/javac/T8180141/MissingLNTEntryForBreakContinueTest.java +++ b/test/langtools/tools/javac/T8180141/MissingLNTEntryForBreakContinueTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8180660/MissingLNTEntryForFinalizerTest.java b/test/langtools/tools/javac/T8180660/MissingLNTEntryForFinalizerTest.java index 1da6fa5e121..ff3f2cf3200 100644 --- a/test/langtools/tools/javac/T8180660/MissingLNTEntryForFinalizerTest.java +++ b/test/langtools/tools/javac/T8180660/MissingLNTEntryForFinalizerTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8187805/BogusRTTAForUnusedVarTest.java b/test/langtools/tools/javac/T8187805/BogusRTTAForUnusedVarTest.java index bf20746c738..486370f0eff 100644 --- a/test/langtools/tools/javac/T8187805/BogusRTTAForUnusedVarTest.java +++ b/test/langtools/tools/javac/T8187805/BogusRTTAForUnusedVarTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8203892/CheckTargetIsNotAddedAsMarkerInterfaceTest.java b/test/langtools/tools/javac/T8203892/CheckTargetIsNotAddedAsMarkerInterfaceTest.java index 44e6564e49f..90c9a70b969 100644 --- a/test/langtools/tools/javac/T8203892/CheckTargetIsNotAddedAsMarkerInterfaceTest.java +++ b/test/langtools/tools/javac/T8203892/CheckTargetIsNotAddedAsMarkerInterfaceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8209173/CodeCompletionExceptTest.java b/test/langtools/tools/javac/T8209173/CodeCompletionExceptTest.java index e506340ab0a..6cb45581db3 100644 --- a/test/langtools/tools/javac/T8209173/CodeCompletionExceptTest.java +++ b/test/langtools/tools/javac/T8209173/CodeCompletionExceptTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8210435/NoLocalsMustBeReservedForDCEedVarsTest.java b/test/langtools/tools/javac/T8210435/NoLocalsMustBeReservedForDCEedVarsTest.java index 225b105664e..a3a2bf98787 100644 --- a/test/langtools/tools/javac/T8210435/NoLocalsMustBeReservedForDCEedVarsTest.java +++ b/test/langtools/tools/javac/T8210435/NoLocalsMustBeReservedForDCEedVarsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/T8222949/TestConstantDynamic.java b/test/langtools/tools/javac/T8222949/TestConstantDynamic.java index 007e7648d40..4578bfbf318 100644 --- a/test/langtools/tools/javac/T8222949/TestConstantDynamic.java +++ b/test/langtools/tools/javac/T8222949/TestConstantDynamic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/TryWithResources/TwrSimpleClose.java b/test/langtools/tools/javac/TryWithResources/TwrSimpleClose.java index 1f2230493e4..af3f4ea19ef 100644 --- a/test/langtools/tools/javac/TryWithResources/TwrSimpleClose.java +++ b/test/langtools/tools/javac/TryWithResources/TwrSimpleClose.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/ApplicableAnnotationsOnRecords.java b/test/langtools/tools/javac/annotations/ApplicableAnnotationsOnRecords.java index 75e8d57fdad..773271f8c91 100644 --- a/test/langtools/tools/javac/annotations/ApplicableAnnotationsOnRecords.java +++ b/test/langtools/tools/javac/annotations/ApplicableAnnotationsOnRecords.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/SyntheticParameters.java b/test/langtools/tools/javac/annotations/SyntheticParameters.java index 692499a0b8a..00be377ab1f 100644 --- a/test/langtools/tools/javac/annotations/SyntheticParameters.java +++ b/test/langtools/tools/javac/annotations/SyntheticParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/parameter/ParameterAnnotations.java b/test/langtools/tools/javac/annotations/parameter/ParameterAnnotations.java index da042001356..ce50a9ad0d3 100644 --- a/test/langtools/tools/javac/annotations/parameter/ParameterAnnotations.java +++ b/test/langtools/tools/javac/annotations/parameter/ParameterAnnotations.java @@ -640,8 +640,9 @@ private void doTest(Path base, String code, String binaryNameToCheck, } Task.Result result = new JavacTask(tb) - .processors(new TestAP()) .options("-classpath", classes.toString(), + "-processorpath", System.getProperty("test.classes"), + "-processor", TestAP.class.getName(), "-XDrawDiagnostics", "-Xlint:classfile") .outdir(classes) diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsPositionsOnRecords.java b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsPositionsOnRecords.java index 190c6372ebc..dfa266ef035 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsPositionsOnRecords.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnotationsPositionsOnRecords.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/VariablesDeclaredWithVarTest.java b/test/langtools/tools/javac/annotations/typeAnnotations/VariablesDeclaredWithVarTest.java index 199e56fbf53..0837dde6754 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/VariablesDeclaredWithVarTest.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/VariablesDeclaredWithVarTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java index 11abffa8c91..93087c2a275 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/ClassfileTestHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java index 7d3f42584ad..33685d66193 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java index dda964c3473..35715502770 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest3.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest3.java index 16e2ed0bb5c..1a8a8cf8414 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest3.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/CombinationsTargetTest3.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/DeadCode.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/DeadCode.java index 3a9fdc9270a..ddb2b81ab56 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/DeadCode.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/DeadCode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/InstanceInitializer.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/InstanceInitializer.java index d6a775c2b6c..3c344b19e3d 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/InstanceInitializer.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/InstanceInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java index cbaebb4916e..d1cdb6fa2cb 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NewTypeArguments.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java index 65d5a639f35..d28611f1dfd 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/NoTargetAnnotations.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Scopes.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Scopes.java index 4025a61be6a..a4a5388562b 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Scopes.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Scopes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/StaticInitializer.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/StaticInitializer.java index b44faa4d6cf..b42413ab0ac 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/StaticInitializer.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/StaticInitializer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java index cc2dcf8277f..7cac702874f 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008762.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008762.java index 4dbff9cd68f..b5fe81fab40 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008762.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008762.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008769.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008769.java index 0aa41def875..3ab0afde122 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008769.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8008769.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8010015.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8010015.java index 045c75fa39f..6c927f51d5c 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8010015.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/T8010015.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java index efb78c02ad3..7e5be2d47ae 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestAnonInnerClasses.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestNewCastArray.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestNewCastArray.java index ea4f69ecaca..803e0c8865b 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestNewCastArray.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TestNewCastArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java index 9a0ed02ae28..2a33e256ae1 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/TypeCasts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java index 3295d0a513b..c05ddc7036b 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/classfile/Wildcards.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java index c4581fc1bf3..2ff841f5a06 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassExtends.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java index 2202766e450..40d00daabb0 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ClassTypeParam.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ConstructorInvocationTypeArgument.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ConstructorInvocationTypeArgument.java index f89ec2efce4..3b5ece66d5d 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ConstructorInvocationTypeArgument.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ConstructorInvocationTypeArgument.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java index 89128a60888..d703e149933 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Constructors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java index e179764a1e8..d493a0f1c1e 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ExceptionParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java index 089f32ae775..0d66907333b 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Fields.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java index b89517c4376..0066863bad5 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/FromSpecification.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Initializers.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Initializers.java index 70af9591900..d8a1242725b 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Initializers.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Initializers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java index 1d78183e68e..29b2bafe3e3 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/Lambda.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodInvocationTypeArgument.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodInvocationTypeArgument.java index 38026251a19..33cba2a41ab 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodInvocationTypeArgument.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodInvocationTypeArgument.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java index edc9ae18a32..084b0ad01b0 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodParameters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java index d379301005f..610b4ca385f 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReceivers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java index b174ea414c4..ffd524c6d7b 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodReturns.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java index 69de815909e..e6603d8d211 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodThrows.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java index 05a8c09c1cf..91577abe80c 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MethodTypeParam.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java index a1883ff4864..c8395992568 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/MultiCatch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java index 37aedf75f62..34eed43751a 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NestedTypes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java index ff90b8bb2da..c19029ec753 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/NewObjects.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java index 1d78cfed508..c819292f968 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/RepeatingTypeAnnotations.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ResourceVariable.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ResourceVariable.java index bb5944d400c..a6a54f60fc0 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ResourceVariable.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/ResourceVariable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java index 612601538b6..8d59bda04c5 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeCasts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java index e82c5f4009a..62dfd422c9b 100644 --- a/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java +++ b/test/langtools/tools/javac/annotations/typeAnnotations/referenceinfos/TypeTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/api/TestGetScopeResult.java b/test/langtools/tools/javac/api/TestGetScopeResult.java index daa3e761b2a..babc7a79170 100644 --- a/test/langtools/tools/javac/api/TestGetScopeResult.java +++ b/test/langtools/tools/javac/api/TestGetScopeResult.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/cast/intersection/DuplicatedCheckcastTest.java b/test/langtools/tools/javac/cast/intersection/DuplicatedCheckcastTest.java index 0bf600044b1..aed5b3c18e0 100644 --- a/test/langtools/tools/javac/cast/intersection/DuplicatedCheckcastTest.java +++ b/test/langtools/tools/javac/cast/intersection/DuplicatedCheckcastTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/InnerClasses/SyntheticClasses.java b/test/langtools/tools/javac/classfiles/InnerClasses/SyntheticClasses.java index db06862d3ae..4585ef4fdef 100644 --- a/test/langtools/tools/javac/classfiles/InnerClasses/SyntheticClasses.java +++ b/test/langtools/tools/javac/classfiles/InnerClasses/SyntheticClasses.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/T8255757/T8255757.java b/test/langtools/tools/javac/classfiles/T8255757/T8255757.java index b165967bf5e..0ce6e87f4e3 100644 --- a/test/langtools/tools/javac/classfiles/T8255757/T8255757.java +++ b/test/langtools/tools/javac/classfiles/T8255757/T8255757.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java b/test/langtools/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java index f67fa87474e..10d66e18dd2 100644 --- a/test/langtools/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/AnnotationDefault/AnnotationDefaultTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java b/test/langtools/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java index 69a40ddbf45..9100073d300 100644 --- a/test/langtools/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/EnclosingMethod/EnclosingMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java index 3d3d4f69d0a..d8fb460160b 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTestBase.java b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTestBase.java index 531d5e617d0..32ec2e07f73 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTestBase.java +++ b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/LineNumberTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/MultipleRecordPatterns.java b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/MultipleRecordPatterns.java index b2b3e1e8a2c..d71cc33cd23 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/MultipleRecordPatterns.java +++ b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/MultipleRecordPatterns.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/RuleSwitchBreaks.java b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/RuleSwitchBreaks.java index a1bb8a6150c..852703b2a5a 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/RuleSwitchBreaks.java +++ b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/RuleSwitchBreaks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/StringSwitchBreaks.java b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/StringSwitchBreaks.java index e445818553e..1fe952c6557 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/StringSwitchBreaks.java +++ b/test/langtools/tools/javac/classfiles/attributes/LineNumberTable/StringSwitchBreaks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java b/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java index 2ce77364bea..df14b54bedb 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTestBase.java b/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTestBase.java index 7bda1500b3e..8af31b2f49e 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTestBase.java +++ b/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java b/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java index 0f4ed838edd..3bb2545ee6c 100644 --- a/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/LocalVariableTable/LocalVariableTypeTableTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Module/ModuleFlagTest.java b/test/langtools/tools/javac/classfiles/attributes/Module/ModuleFlagTest.java index 2dcee4d16e1..82c3d8451f0 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Module/ModuleFlagTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Module/ModuleFlagTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Module/ModuleTest.java b/test/langtools/tools/javac/classfiles/attributes/Module/ModuleTest.java index cf09ce7ca39..29f0bf3e3a1 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Module/ModuleTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Module/ModuleTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Module/ModuleTestBase.java b/test/langtools/tools/javac/classfiles/attributes/Module/ModuleTestBase.java index 490e585e06a..8cbd32a0764 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Module/ModuleTestBase.java +++ b/test/langtools/tools/javac/classfiles/attributes/Module/ModuleTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/ConstructorTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/ConstructorTest.java index 20012318ea7..90ff0fd5e78 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/ConstructorTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/ConstructorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/Driver.java b/test/langtools/tools/javac/classfiles/attributes/Signature/Driver.java index 7b75ffa5f9c..deaa0b3dbe0 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/Driver.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/Driver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/EnumTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/EnumTest.java index b7e6d2ca99a..ce9d213be84 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/EnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/EnumTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/ExceptionTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/ExceptionTest.java index 54706e2822b..997c3b2fbda 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/ExceptionTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/ExceptionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/FieldTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/FieldTest.java index 795a4d30bea..f813cdbec7c 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/FieldTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/FieldTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/InnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/InnerClassTest.java index 740607d56c0..7f7db6984eb 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/InnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/InnerClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java index 6966ed1852c..54d62e7b526 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/MethodParameterTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java index 2131b5a4f02..cb98ac9b898 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/MethodTypeBoundTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java b/test/langtools/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java index cce155bbb71..33f6505aa76 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Signature/ReturnTypeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java index 15696c89bee..0fe213f6798 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/AnonymousClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java index d8cd067408f..ab16f04af23 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/InnerClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java index dc45a92d407..3bb1b92efce 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/LocalClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/MixTest.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/MixTest.java index d2079bb13f9..b934c6d190e 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/MixTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/MixTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/ModuleInfoTest.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/ModuleInfoTest.java index d0b65e41cfe..2d2c6de538f 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/ModuleInfoTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/ModuleInfoTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java index 4e4b2faacd2..7f05686cad0 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/NoSourceFileAttribute.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/SourceFileTestBase.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/SourceFileTestBase.java index 0d81fc2c282..b8d5d7cf981 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/SourceFileTestBase.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/SourceFileTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java b/test/langtools/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java index ee85b2dc650..7d562c3224d 100644 --- a/test/langtools/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/SourceFile/TopLevelClassesOneFileTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassConstructorsTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassConstructorsTest.java index 3072b641b69..e1e38c0d6dd 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassConstructorsTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassConstructorsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java index 0440ec1a430..b3708f8b6c7 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateInnerClassMembersTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java index 720af8507a8..43687f551b3 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AccessToPrivateSiblingsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java index 508bf245c47..04b47ea1bd7 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/AssertFieldTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java index 96c7a41fea9..d57772b77d1 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodForGenericMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java index 5d26990d23d..0c12b997edf 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/BridgeMethodsForLambdaTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/EnumTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/EnumTest.java index d4cfbbe8d19..bae2fa0914e 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/EnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/EnumTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java index 18a3c966546..bb7c1c4dfde 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/PackageInfoTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java index 4db2585355e..847fb5047f0 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/SyntheticTestDriver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java b/test/langtools/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java index 7c07628afbd..e00c51de132 100644 --- a/test/langtools/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/Synthetic/ThisFieldTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForGenericMethodTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForGenericMethodTest.java index 7691bc54ba7..9bf66901626 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForGenericMethodTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForGenericMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerAnnotationTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerAnnotationTest.java index c0ca6d2426d..fb959259684 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerAnnotationTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerAnnotationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerClassTest.java index 8fc1aadb276..ebe96e004f6 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerEnumTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerEnumTest.java index f699124dca9..cc32186f640 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerEnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerEnumTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerInterfaceTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerInterfaceTest.java index 553155fa9f2..55e001834f2 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerInterfaceTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForInnerInterfaceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForTopLevelClassTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForTopLevelClassTest.java index 6a80acd406e..d990854decb 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForTopLevelClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsForTopLevelClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsTestBase.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsTestBase.java index 970628be575..73ac7db6b74 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsTestBase.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeAnnotationsTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForGenericMethodTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForGenericMethodTest.java index 6e0671c2b23..42714664f19 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForGenericMethodTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForGenericMethodTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForLambdaTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForLambdaTest.java index c40ac214bd7..53d97bafe54 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForLambdaTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsForLambdaTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTest.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTest.java index 9443ccc5151..3174f90711e 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTestBase.java b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTestBase.java index b8c90faf52b..88099d6ca72 100644 --- a/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTestBase.java +++ b/test/langtools/tools/javac/classfiles/attributes/annotations/RuntimeParameterAnnotationsTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java index a7d84a4a599..e0346be1cda 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerAnnotationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java index cdf2413eeec..441d70a27d4 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java index 1b78cbeccec..8ae5054ea1b 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerEnumTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java index c40b7161d6d..aed539005d3 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerAnnotationsInInnerInterfaceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java index a6210b8455a..05b48e47013 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesHierarchyTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java index fb6003752f6..f75b08d571b 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInAnonymousClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java index f69b0d1a885..7572ee96157 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerAnnotationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java index bd5d27e7307..be7891d2587 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java index 7bca5b5240f..ea400defaea 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerEnumTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java index 3e6d32044cb..9c1988f5dc1 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInInnerInterfaceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java index a2409c810d1..aeb8398a6ab 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesInLocalClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java index d8b78622185..1c71cbb9881 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesIndexTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java index 6225c89e591..f07476fa84c 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTestBase.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTestBase.java index aa46d8a9b9d..4b11dfdc944 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTestBase.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerClassesTestBase.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java index 43aa1462ca6..ed17e63a0e3 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerAnnotationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java index 3c4775d22a7..f946aac791d 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerEnumTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java index 01beace40ca..d8c73ac5d48 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumInInnerInterfaceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java index 413bee58f00..43aafed64b4 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerEnumsInInnerClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java index ca25c1028f6..0879beef2ab 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerAnnotationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java index c0dac827f81..80cb3672bf8 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java index 5e6051ddd75..632e32a332e 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerEnumTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java index abf8e5987d7..3be3c38cd85 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/InnerInterfacesInInnerInterfaceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java b/test/langtools/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java index e6f29a1d078..3ebd621e4b7 100644 --- a/test/langtools/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java +++ b/test/langtools/tools/javac/classfiles/attributes/innerclasses/NoInnerClassesTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/classwriter/IndyCorrectInvocationName.java b/test/langtools/tools/javac/classwriter/IndyCorrectInvocationName.java index 3a8be1f53ed..a4619782b09 100644 --- a/test/langtools/tools/javac/classwriter/IndyCorrectInvocationName.java +++ b/test/langtools/tools/javac/classwriter/IndyCorrectInvocationName.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/code/CharImmediateValue.java b/test/langtools/tools/javac/code/CharImmediateValue.java index d96fb60a1b7..d72187ed18a 100644 --- a/test/langtools/tools/javac/code/CharImmediateValue.java +++ b/test/langtools/tools/javac/code/CharImmediateValue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/constDebug/ConstDebugTest.java b/test/langtools/tools/javac/constDebug/ConstDebugTest.java index c487ccea269..d13cafd4b3c 100644 --- a/test/langtools/tools/javac/constDebug/ConstDebugTest.java +++ b/test/langtools/tools/javac/constDebug/ConstDebugTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/defaultMethods/TestDefaultBody.java b/test/langtools/tools/javac/defaultMethods/TestDefaultBody.java index edf8427bc93..dafb6ae4f96 100644 --- a/test/langtools/tools/javac/defaultMethods/TestDefaultBody.java +++ b/test/langtools/tools/javac/defaultMethods/TestDefaultBody.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java b/test/langtools/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java index cff1b10a7e5..b0ca895b306 100644 --- a/test/langtools/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java +++ b/test/langtools/tools/javac/defaultMethods/TestNoBridgeOnDefaults.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/defaultMethods/super/TestDirectSuperInterfaceInvoke.java b/test/langtools/tools/javac/defaultMethods/super/TestDirectSuperInterfaceInvoke.java index 9aa52686bc4..bee5f837322 100644 --- a/test/langtools/tools/javac/defaultMethods/super/TestDirectSuperInterfaceInvoke.java +++ b/test/langtools/tools/javac/defaultMethods/super/TestDirectSuperInterfaceInvoke.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/CheckResourceKeys.java b/test/langtools/tools/javac/diags/CheckResourceKeys.java index b5f5b2031de..9f6f37dc23d 100644 --- a/test/langtools/tools/javac/diags/CheckResourceKeys.java +++ b/test/langtools/tools/javac/diags/CheckResourceKeys.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/Example.java b/test/langtools/tools/javac/diags/Example.java index 8940032367d..91d3bace4d8 100644 --- a/test/langtools/tools/javac/diags/Example.java +++ b/test/langtools/tools/javac/diags/Example.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/examples/BadConstantValueType/BadConstantValueType.java b/test/langtools/tools/javac/diags/examples/BadConstantValueType/BadConstantValueType.java index 1a9faf67547..c9eee39be17 100644 --- a/test/langtools/tools/javac/diags/examples/BadConstantValueType/BadConstantValueType.java +++ b/test/langtools/tools/javac/diags/examples/BadConstantValueType/BadConstantValueType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/examples/CantAnnotateScoping.java b/test/langtools/tools/javac/diags/examples/CantAnnotateScoping.java index 8a1d9ad77bb..974a6d6c412 100644 --- a/test/langtools/tools/javac/diags/examples/CantAnnotateScoping.java +++ b/test/langtools/tools/javac/diags/examples/CantAnnotateScoping.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/examples/CantAnnotateScoping1.java b/test/langtools/tools/javac/diags/examples/CantAnnotateScoping1.java index 6762f0d1ea7..db3072a845d 100644 --- a/test/langtools/tools/javac/diags/examples/CantAnnotateScoping1.java +++ b/test/langtools/tools/javac/diags/examples/CantAnnotateScoping1.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/examples/IllegalDigitInBinaryLiteral.java b/test/langtools/tools/javac/diags/examples/IllegalDigitInBinaryLiteral.java index 4956114cac2..a4534a7e739 100644 --- a/test/langtools/tools/javac/diags/examples/IllegalDigitInBinaryLiteral.java +++ b/test/langtools/tools/javac/diags/examples/IllegalDigitInBinaryLiteral.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/examples/IllegalDigitInOctalLiteral.java b/test/langtools/tools/javac/diags/examples/IllegalDigitInOctalLiteral.java index a5b3a747138..910f569e9fc 100644 --- a/test/langtools/tools/javac/diags/examples/IllegalDigitInOctalLiteral.java +++ b/test/langtools/tools/javac/diags/examples/IllegalDigitInOctalLiteral.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/examples/InvalidBinaryNumber.java b/test/langtools/tools/javac/diags/examples/InvalidBinaryNumber.java index 941433be676..5024273cb4e 100644 --- a/test/langtools/tools/javac/diags/examples/InvalidBinaryNumber.java +++ b/test/langtools/tools/javac/diags/examples/InvalidBinaryNumber.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java b/test/langtools/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java index bae237b09d2..cc4f14fbd6f 100644 --- a/test/langtools/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java +++ b/test/langtools/tools/javac/diags/examples/InvalidDefaultInterface/InvalidDefaultInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java b/test/langtools/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java index ba739de15ec..2eb8c6aabc9 100644 --- a/test/langtools/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java +++ b/test/langtools/tools/javac/diags/examples/InvalidStaticInterface/InvalidStaticInterface.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/examples/ModifierNotAllowed/module-info.java b/test/langtools/tools/javac/diags/examples/ModifierNotAllowed/module-info.java index f2e5899a915..8eb25a864d7 100644 --- a/test/langtools/tools/javac/diags/examples/ModifierNotAllowed/module-info.java +++ b/test/langtools/tools/javac/diags/examples/ModifierNotAllowed/module-info.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/examples/PrimitivePatternMatching.java b/test/langtools/tools/javac/diags/examples/PrimitivePatternMatching.java index 39c2ec7fe6d..a034119b6df 100644 --- a/test/langtools/tools/javac/diags/examples/PrimitivePatternMatching.java +++ b/test/langtools/tools/javac/diags/examples/PrimitivePatternMatching.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/examples/ProcUseProcOrImplicit/ProcUseProcOrImplicit.java b/test/langtools/tools/javac/diags/examples/ProcUseProcOrImplicit/ProcUseProcOrImplicit.java index 6d9d9a70ee9..b1b8012c7c7 100644 --- a/test/langtools/tools/javac/diags/examples/ProcUseProcOrImplicit/ProcUseProcOrImplicit.java +++ b/test/langtools/tools/javac/diags/examples/ProcUseProcOrImplicit/ProcUseProcOrImplicit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/examples/TypeReqClassArray.java b/test/langtools/tools/javac/diags/examples/TypeReqClassArray.java index ba7eacf2a82..7fd73b458cf 100644 --- a/test/langtools/tools/javac/diags/examples/TypeReqClassArray.java +++ b/test/langtools/tools/javac/diags/examples/TypeReqClassArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/diags/examples/TypeReqRef.java b/test/langtools/tools/javac/diags/examples/TypeReqRef.java index d9ada8672c4..d43b97cd51a 100644 --- a/test/langtools/tools/javac/diags/examples/TypeReqRef.java +++ b/test/langtools/tools/javac/diags/examples/TypeReqRef.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java b/test/langtools/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java index 57f4fcde3e7..3f222a65a28 100644 --- a/test/langtools/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java +++ b/test/langtools/tools/javac/expression/_super/NonDirectSuper/NonDirectSuper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/file/SymLinkTest.java b/test/langtools/tools/javac/file/SymLinkTest.java index ea5295505e1..291af78da82 100644 --- a/test/langtools/tools/javac/file/SymLinkTest.java +++ b/test/langtools/tools/javac/file/SymLinkTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/flow/LVTHarness.java b/test/langtools/tools/javac/flow/LVTHarness.java index 3686323567b..7afe90c1991 100644 --- a/test/langtools/tools/javac/flow/LVTHarness.java +++ b/test/langtools/tools/javac/flow/LVTHarness.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/generics/bridges/BridgeHarness.java b/test/langtools/tools/javac/generics/bridges/BridgeHarness.java index 25414c8127c..ab2cf73cc0e 100644 --- a/test/langtools/tools/javac/generics/bridges/BridgeHarness.java +++ b/test/langtools/tools/javac/generics/bridges/BridgeHarness.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/generics/parametricException/ParametricException.java b/test/langtools/tools/javac/generics/parametricException/ParametricException.java index aa8bd61480c..5c6eef55c2a 100644 --- a/test/langtools/tools/javac/generics/parametricException/ParametricException.java +++ b/test/langtools/tools/javac/generics/parametricException/ParametricException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/importscope/T8193717.java b/test/langtools/tools/javac/importscope/T8193717.java index 6ca58eb8a89..bfe7c35772c 100644 --- a/test/langtools/tools/javac/importscope/T8193717.java +++ b/test/langtools/tools/javac/importscope/T8193717.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/jvm/ClassRefDupInConstantPoolTest.java b/test/langtools/tools/javac/jvm/ClassRefDupInConstantPoolTest.java index 3ea1f5b72bb..b905dedf327 100644 --- a/test/langtools/tools/javac/jvm/ClassRefDupInConstantPoolTest.java +++ b/test/langtools/tools/javac/jvm/ClassRefDupInConstantPoolTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/lambda/ByteCodeTest.java b/test/langtools/tools/javac/lambda/ByteCodeTest.java index f273305925c..58a88c85cd3 100644 --- a/test/langtools/tools/javac/lambda/ByteCodeTest.java +++ b/test/langtools/tools/javac/lambda/ByteCodeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/lambda/LocalVariableTable.java b/test/langtools/tools/javac/lambda/LocalVariableTable.java index cb243957287..d07a58ff651 100644 --- a/test/langtools/tools/javac/lambda/LocalVariableTable.java +++ b/test/langtools/tools/javac/lambda/LocalVariableTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/lambda/TestBootstrapMethodsCount.java b/test/langtools/tools/javac/lambda/TestBootstrapMethodsCount.java index 46a381c97c2..1dbb915c063 100644 --- a/test/langtools/tools/javac/lambda/TestBootstrapMethodsCount.java +++ b/test/langtools/tools/javac/lambda/TestBootstrapMethodsCount.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/lambda/TestInvokeDynamic.java b/test/langtools/tools/javac/lambda/TestInvokeDynamic.java index 9ad73564e23..b7e980d5726 100644 --- a/test/langtools/tools/javac/lambda/TestInvokeDynamic.java +++ b/test/langtools/tools/javac/lambda/TestInvokeDynamic.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecode.java b/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecode.java index f7741921b70..4c779b2b6c3 100644 --- a/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecode.java +++ b/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecodeTargetRelease14.java b/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecodeTargetRelease14.java index 6970832c45b..ac67054d732 100644 --- a/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecodeTargetRelease14.java +++ b/test/langtools/tools/javac/lambda/bytecode/TestLambdaBytecodeTargetRelease14.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java b/test/langtools/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java index 7b418f6184d..2860e3fcd53 100644 --- a/test/langtools/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java +++ b/test/langtools/tools/javac/lambda/lambdaNaming/TestNonSerializableLambdaNameStability.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/launcher/GetResourceTest.java b/test/langtools/tools/javac/launcher/GetResourceTest.java index 8cb9ce9fe72..acdc1e5c429 100644 --- a/test/langtools/tools/javac/launcher/GetResourceTest.java +++ b/test/langtools/tools/javac/launcher/GetResourceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/launcher/MultiFileSourceLauncherTests.java b/test/langtools/tools/javac/launcher/MultiFileSourceLauncherTests.java index dbf6be5b121..d7510605131 100644 --- a/test/langtools/tools/javac/launcher/MultiFileSourceLauncherTests.java +++ b/test/langtools/tools/javac/launcher/MultiFileSourceLauncherTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/launcher/ProgramDescriptorTests.java b/test/langtools/tools/javac/launcher/ProgramDescriptorTests.java index 93dd7a42072..9d82f85ef79 100644 --- a/test/langtools/tools/javac/launcher/ProgramDescriptorTests.java +++ b/test/langtools/tools/javac/launcher/ProgramDescriptorTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/launcher/Run.java b/test/langtools/tools/javac/launcher/Run.java index f6fd6abb0e3..a7cfb87b0c2 100644 --- a/test/langtools/tools/javac/launcher/Run.java +++ b/test/langtools/tools/javac/launcher/Run.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/launcher/src/p/q/CLTest.java b/test/langtools/tools/javac/launcher/src/p/q/CLTest.java index 4ec90245659..71840d3f29d 100644 --- a/test/langtools/tools/javac/launcher/src/p/q/CLTest.java +++ b/test/langtools/tools/javac/launcher/src/p/q/CLTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/linenumbers/ConditionalLineNumberTest.java b/test/langtools/tools/javac/linenumbers/ConditionalLineNumberTest.java index 5e1cce76a28..4c4aae6ace4 100644 --- a/test/langtools/tools/javac/linenumbers/ConditionalLineNumberTest.java +++ b/test/langtools/tools/javac/linenumbers/ConditionalLineNumberTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/linenumbers/FinallyLineNumberTest.java b/test/langtools/tools/javac/linenumbers/FinallyLineNumberTest.java index d1fbadb6f2f..3823aedae74 100644 --- a/test/langtools/tools/javac/linenumbers/FinallyLineNumberTest.java +++ b/test/langtools/tools/javac/linenumbers/FinallyLineNumberTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/mandatoryWarnings/unchecked/Test.java b/test/langtools/tools/javac/mandatoryWarnings/unchecked/Test.java index 759c4090e1c..8d860535856 100644 --- a/test/langtools/tools/javac/mandatoryWarnings/unchecked/Test.java +++ b/test/langtools/tools/javac/mandatoryWarnings/unchecked/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/meth/TestCP.java b/test/langtools/tools/javac/meth/TestCP.java index b01ac799b55..8762e65db65 100644 --- a/test/langtools/tools/javac/meth/TestCP.java +++ b/test/langtools/tools/javac/meth/TestCP.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/modules/AnnotationsOnModules.java b/test/langtools/tools/javac/modules/AnnotationsOnModules.java index 65019854360..291633b4fb2 100644 --- a/test/langtools/tools/javac/modules/AnnotationsOnModules.java +++ b/test/langtools/tools/javac/modules/AnnotationsOnModules.java @@ -804,7 +804,7 @@ public class C {} .writeAll() .getOutputLines(OutputKind.DIRECT); List expectedErrors = List.of( - "- compiler.err.cant.access: m.module-info, (compiler.misc.bad.class.file.header: module-info.class, (compiler.misc.bad.requires.flag: ACC_TRANSITIVE (0x0020))", + "- compiler.err.cant.access: m.module-info, (compiler.misc.bad.class.file.header: module-info.class, (compiler.misc.bad.requires.flag: ACC_TRANSITIVE (0x0020)))", "1 error" ); diff --git a/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java b/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java index f558ddb20ac..2958384ae94 100644 --- a/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java +++ b/test/langtools/tools/javac/modules/ConvenientAccessErrorsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/modules/EdgeCases.java b/test/langtools/tools/javac/modules/EdgeCases.java index dd68a5142b2..a3825d9e3a6 100644 --- a/test/langtools/tools/javac/modules/EdgeCases.java +++ b/test/langtools/tools/javac/modules/EdgeCases.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/modules/ModuleVersion.java b/test/langtools/tools/javac/modules/ModuleVersion.java index c5368b394a1..6e68529e9b6 100644 --- a/test/langtools/tools/javac/modules/ModuleVersion.java +++ b/test/langtools/tools/javac/modules/ModuleVersion.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/modules/RequiresTransitiveTest.java b/test/langtools/tools/javac/modules/RequiresTransitiveTest.java index 03f34e96113..41d1669824f 100644 --- a/test/langtools/tools/javac/modules/RequiresTransitiveTest.java +++ b/test/langtools/tools/javac/modules/RequiresTransitiveTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/multicatch/7005371/T7005371.java b/test/langtools/tools/javac/multicatch/7005371/T7005371.java index a8f71a1d078..ccf405ef0b3 100644 --- a/test/langtools/tools/javac/multicatch/7005371/T7005371.java +++ b/test/langtools/tools/javac/multicatch/7005371/T7005371.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/multicatch/Pos05.java b/test/langtools/tools/javac/multicatch/Pos05.java index b3e6882752f..eb749ff286f 100644 --- a/test/langtools/tools/javac/multicatch/Pos05.java +++ b/test/langtools/tools/javac/multicatch/Pos05.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/patterns/LocalVariableTable.java b/test/langtools/tools/javac/patterns/LocalVariableTable.java index 1b80743bb26..9483233f81a 100644 --- a/test/langtools/tools/javac/patterns/LocalVariableTable.java +++ b/test/langtools/tools/javac/patterns/LocalVariableTable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/patterns/MatchExceptionTest.java b/test/langtools/tools/javac/patterns/MatchExceptionTest.java index 1f761faaec1..cf51f93e8c8 100644 --- a/test/langtools/tools/javac/patterns/MatchExceptionTest.java +++ b/test/langtools/tools/javac/patterns/MatchExceptionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/patterns/NestedPatternVariablesBytecode.java b/test/langtools/tools/javac/patterns/NestedPatternVariablesBytecode.java index ddec9fd2e56..5bb75c44805 100644 --- a/test/langtools/tools/javac/patterns/NestedPatternVariablesBytecode.java +++ b/test/langtools/tools/javac/patterns/NestedPatternVariablesBytecode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/patterns/NoUnnecessaryCast.java b/test/langtools/tools/javac/patterns/NoUnnecessaryCast.java index 84d4752671e..107b933e506 100644 --- a/test/langtools/tools/javac/patterns/NoUnnecessaryCast.java +++ b/test/langtools/tools/javac/patterns/NoUnnecessaryCast.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/patterns/PrimitiveInstanceOfComboTest.java b/test/langtools/tools/javac/patterns/PrimitiveInstanceOfComboTest.java index 113c1214452..82064bd4baf 100644 --- a/test/langtools/tools/javac/patterns/PrimitiveInstanceOfComboTest.java +++ b/test/langtools/tools/javac/patterns/PrimitiveInstanceOfComboTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/patterns/PrimitiveInstanceOfPatternOpWithRecordPatterns.java b/test/langtools/tools/javac/patterns/PrimitiveInstanceOfPatternOpWithRecordPatterns.java index dce025a0708..dc019f7eb36 100644 --- a/test/langtools/tools/javac/patterns/PrimitiveInstanceOfPatternOpWithRecordPatterns.java +++ b/test/langtools/tools/javac/patterns/PrimitiveInstanceOfPatternOpWithRecordPatterns.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/patterns/PrimitivePatternsSwitch.java b/test/langtools/tools/javac/patterns/PrimitivePatternsSwitch.java index 1d78fe98147..ef95399c8b4 100644 --- a/test/langtools/tools/javac/patterns/PrimitivePatternsSwitch.java +++ b/test/langtools/tools/javac/patterns/PrimitivePatternsSwitch.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/patterns/SourceLevelChecks.java b/test/langtools/tools/javac/patterns/SourceLevelChecks.java index 3b0fece12bc..81a988d2a3c 100644 --- a/test/langtools/tools/javac/patterns/SourceLevelChecks.java +++ b/test/langtools/tools/javac/patterns/SourceLevelChecks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/patterns/Switches.java b/test/langtools/tools/javac/patterns/Switches.java index 7d7cb83e02f..2dd4ce7a697 100644 --- a/test/langtools/tools/javac/patterns/Switches.java +++ b/test/langtools/tools/javac/patterns/Switches.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/patterns/TranslationTest.java b/test/langtools/tools/javac/patterns/TranslationTest.java index f69783f6b85..107e0a5aa49 100644 --- a/test/langtools/tools/javac/patterns/TranslationTest.java +++ b/test/langtools/tools/javac/patterns/TranslationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/platform/ModuleVersionTest.java b/test/langtools/tools/javac/platform/ModuleVersionTest.java index 457674cf45c..a204090caf8 100644 --- a/test/langtools/tools/javac/platform/ModuleVersionTest.java +++ b/test/langtools/tools/javac/platform/ModuleVersionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/plugin/AutostartPlugins.java b/test/langtools/tools/javac/plugin/AutostartPlugins.java index 5eb5b16bad5..1c6b9f895e5 100644 --- a/test/langtools/tools/javac/plugin/AutostartPlugins.java +++ b/test/langtools/tools/javac/plugin/AutostartPlugins.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/plugin/InternalAPI.java b/test/langtools/tools/javac/plugin/InternalAPI.java index 70bb024ede9..bd5f3d25d39 100644 --- a/test/langtools/tools/javac/plugin/InternalAPI.java +++ b/test/langtools/tools/javac/plugin/InternalAPI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/preview/PreviewAutoSuppress.java b/test/langtools/tools/javac/preview/PreviewAutoSuppress.java index 20e562fe2d9..c7cffda1f69 100644 --- a/test/langtools/tools/javac/preview/PreviewAutoSuppress.java +++ b/test/langtools/tools/javac/preview/PreviewAutoSuppress.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/preview/PreviewErrors.java b/test/langtools/tools/javac/preview/PreviewErrors.java index 3ec1e99b2ed..eab5b2af9bf 100644 --- a/test/langtools/tools/javac/preview/PreviewErrors.java +++ b/test/langtools/tools/javac/preview/PreviewErrors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/processing/model/TestSymtabItems.java b/test/langtools/tools/javac/processing/model/TestSymtabItems.java index ba9bb20230b..169adc45c36 100644 --- a/test/langtools/tools/javac/processing/model/TestSymtabItems.java +++ b/test/langtools/tools/javac/processing/model/TestSymtabItems.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/processing/model/element/TestFileObjectOf.java b/test/langtools/tools/javac/processing/model/element/TestFileObjectOf.java index 15d04e39d01..ad7c701fa5e 100644 --- a/test/langtools/tools/javac/processing/model/element/TestFileObjectOf.java +++ b/test/langtools/tools/javac/processing/model/element/TestFileObjectOf.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/processing/options/TestNoteOnImplicitProcessing.java b/test/langtools/tools/javac/processing/options/TestNoteOnImplicitProcessing.java index 9d23707c618..73089a9a3cf 100644 --- a/test/langtools/tools/javac/processing/options/TestNoteOnImplicitProcessing.java +++ b/test/langtools/tools/javac/processing/options/TestNoteOnImplicitProcessing.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/records/RecordsBinaryCompatibilityTests.java b/test/langtools/tools/javac/records/RecordsBinaryCompatibilityTests.java index 10ed2809bd0..cd6a52433c2 100644 --- a/test/langtools/tools/javac/records/RecordsBinaryCompatibilityTests.java +++ b/test/langtools/tools/javac/records/RecordsBinaryCompatibilityTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/records/recordComponent/RecordComponentTypeTest.java b/test/langtools/tools/javac/records/recordComponent/RecordComponentTypeTest.java index f7550cb5339..80cbf1dd872 100644 --- a/test/langtools/tools/javac/records/recordComponent/RecordComponentTypeTest.java +++ b/test/langtools/tools/javac/records/recordComponent/RecordComponentTypeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/recovery/AnnotationRecovery.java b/test/langtools/tools/javac/recovery/AnnotationRecovery.java index 1ef98901ddc..89c436912e9 100644 --- a/test/langtools/tools/javac/recovery/AnnotationRecovery.java +++ b/test/langtools/tools/javac/recovery/AnnotationRecovery.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/recovery/LambdaRecovery.java b/test/langtools/tools/javac/recovery/LambdaRecovery.java index cbf8c540c79..54569feabde 100644 --- a/test/langtools/tools/javac/recovery/LambdaRecovery.java +++ b/test/langtools/tools/javac/recovery/LambdaRecovery.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/recovery/MethodModifiers.java b/test/langtools/tools/javac/recovery/MethodModifiers.java index a8220114700..db1568c1aef 100644 --- a/test/langtools/tools/javac/recovery/MethodModifiers.java +++ b/test/langtools/tools/javac/recovery/MethodModifiers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/resolve/NoObjectToString.java b/test/langtools/tools/javac/resolve/NoObjectToString.java index dd743bd7784..5296ed3c66d 100644 --- a/test/langtools/tools/javac/resolve/NoObjectToString.java +++ b/test/langtools/tools/javac/resolve/NoObjectToString.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/sealed/BinaryCompatibilityTests.java b/test/langtools/tools/javac/sealed/BinaryCompatibilityTests.java index e505f2a291a..89255bf9fa9 100644 --- a/test/langtools/tools/javac/sealed/BinaryCompatibilityTests.java +++ b/test/langtools/tools/javac/sealed/BinaryCompatibilityTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/sealed/CheckSubtypesOfSealedTest.java b/test/langtools/tools/javac/sealed/CheckSubtypesOfSealedTest.java index f0f27470aef..1371b0dd93b 100644 --- a/test/langtools/tools/javac/sealed/CheckSubtypesOfSealedTest.java +++ b/test/langtools/tools/javac/sealed/CheckSubtypesOfSealedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/sealed/SealedDiffConfigurationsTest.java b/test/langtools/tools/javac/sealed/SealedDiffConfigurationsTest.java index f2c40422edd..597d4b16e68 100644 --- a/test/langtools/tools/javac/sealed/SealedDiffConfigurationsTest.java +++ b/test/langtools/tools/javac/sealed/SealedDiffConfigurationsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/sym/ElementStructureTest.java b/test/langtools/tools/javac/sym/ElementStructureTest.java index 7a5db50c06a..f1cc3cd91fe 100644 --- a/test/langtools/tools/javac/sym/ElementStructureTest.java +++ b/test/langtools/tools/javac/sym/ElementStructureTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/tree/TreeKindTest.java b/test/langtools/tools/javac/tree/TreeKindTest.java index 15b4ae37bbe..547d9deb1ad 100644 --- a/test/langtools/tools/javac/tree/TreeKindTest.java +++ b/test/langtools/tools/javac/tree/TreeKindTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/varargs/6199075/T6199075.java b/test/langtools/tools/javac/varargs/6199075/T6199075.java index 3b90295cb5e..250f740f5d7 100644 --- a/test/langtools/tools/javac/varargs/6199075/T6199075.java +++ b/test/langtools/tools/javac/varargs/6199075/T6199075.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javac/varargs/7042566/T7042566.java b/test/langtools/tools/javac/varargs/7042566/T7042566.java index b2b37c9d573..1f0e6b768ba 100644 --- a/test/langtools/tools/javac/varargs/7042566/T7042566.java +++ b/test/langtools/tools/javac/varargs/7042566/T7042566.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javap/T4459541.java b/test/langtools/tools/javap/T4459541.java index 7a05e9fc64c..b5649f264a7 100644 --- a/test/langtools/tools/javap/T4459541.java +++ b/test/langtools/tools/javap/T4459541.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javap/T6716452.java b/test/langtools/tools/javap/T6716452.java index c2f219a4597..74bfd3a96c7 100644 --- a/test/langtools/tools/javap/T6716452.java +++ b/test/langtools/tools/javap/T6716452.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javap/T8032814.java b/test/langtools/tools/javap/T8032814.java index 9472ff235dc..7cc263d2fc0 100644 --- a/test/langtools/tools/javap/T8032814.java +++ b/test/langtools/tools/javap/T8032814.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javap/TestClassNameWarning.java b/test/langtools/tools/javap/TestClassNameWarning.java index bed3c4a2cc3..d55bb29facd 100644 --- a/test/langtools/tools/javap/TestClassNameWarning.java +++ b/test/langtools/tools/javap/TestClassNameWarning.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javap/classfile/T6887895.java b/test/langtools/tools/javap/classfile/T6887895.java index b6c23a2d40e..01d85508064 100644 --- a/test/langtools/tools/javap/classfile/T6887895.java +++ b/test/langtools/tools/javap/classfile/T6887895.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javap/typeAnnotations/JSR175Annotations.java b/test/langtools/tools/javap/typeAnnotations/JSR175Annotations.java index 540d78acba8..69ca8828352 100644 --- a/test/langtools/tools/javap/typeAnnotations/JSR175Annotations.java +++ b/test/langtools/tools/javap/typeAnnotations/JSR175Annotations.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javap/typeAnnotations/NewArray.java b/test/langtools/tools/javap/typeAnnotations/NewArray.java index 05760d6a925..44bdb25e726 100644 --- a/test/langtools/tools/javap/typeAnnotations/NewArray.java +++ b/test/langtools/tools/javap/typeAnnotations/NewArray.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javap/typeAnnotations/Presence.java b/test/langtools/tools/javap/typeAnnotations/Presence.java index 5e1b2a05dca..bca18f7b671 100644 --- a/test/langtools/tools/javap/typeAnnotations/Presence.java +++ b/test/langtools/tools/javap/typeAnnotations/Presence.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javap/typeAnnotations/PresenceInner.java b/test/langtools/tools/javap/typeAnnotations/PresenceInner.java index d0cedc42db6..5cf90766873 100644 --- a/test/langtools/tools/javap/typeAnnotations/PresenceInner.java +++ b/test/langtools/tools/javap/typeAnnotations/PresenceInner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javap/typeAnnotations/TypeCasts.java b/test/langtools/tools/javap/typeAnnotations/TypeCasts.java index 8889d7e6db5..1cd8d5abc98 100644 --- a/test/langtools/tools/javap/typeAnnotations/TypeCasts.java +++ b/test/langtools/tools/javap/typeAnnotations/TypeCasts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javap/typeAnnotations/Visibility.java b/test/langtools/tools/javap/typeAnnotations/Visibility.java index 48bfbed343e..086e9cde8d8 100644 --- a/test/langtools/tools/javap/typeAnnotations/Visibility.java +++ b/test/langtools/tools/javap/typeAnnotations/Visibility.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/javap/typeAnnotations/Wildcards.java b/test/langtools/tools/javap/typeAnnotations/Wildcards.java index a4e9b0609e8..7da81d1d5f7 100644 --- a/test/langtools/tools/javap/typeAnnotations/Wildcards.java +++ b/test/langtools/tools/javap/typeAnnotations/Wildcards.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/jdeps/MultiReleaseJar.java b/test/langtools/tools/jdeps/MultiReleaseJar.java index 8ba642083f1..ffc5ee874ec 100644 --- a/test/langtools/tools/jdeps/MultiReleaseJar.java +++ b/test/langtools/tools/jdeps/MultiReleaseJar.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * 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,7 +25,6 @@ * @test * @bug 8153654 8176333 * @summary Tests for jdeps tool with multi-release jar files - * @modules jdk.jdeps/com.sun.tools.jdeps * @library mrjar mrjar/base mrjar/9 mrjar/10 mrjar/v9 mrjar/v10 * @build test.* p.* q.* foo/* Main * @run testng MultiReleaseJar @@ -38,6 +37,7 @@ import java.io.File; import java.io.InputStream; +import java.io.RandomAccessFile; import java.nio.file.Path; import java.nio.file.Paths; import java.util.stream.Stream; @@ -60,6 +60,15 @@ public void initialize() throws Exception { fileSep = System.getProperty("file.separator"); cmdPath = Paths.get(testJdk, "bin"); + // fixup classfile versions + forceReleaseInClassFile(9, "Main.class"); + forceReleaseInClassFile(9, "base/test/Version.class", "base/p/Foo.class"); + forceReleaseInClassFile(9, "9/test/NonPublic.class", "9/test/Version.class"); + forceReleaseInClassFile(9, "v9/p/Foo.class", "v9/q/Bar.class"); + forceReleaseInClassFile(9, "v9/p/Foo.class", "v9/q/Bar.class"); + forceReleaseInClassFile(10, "10/test/Version.class"); + forceReleaseInClassFile(10, "v10/q/Bar.class", "v10/q/Gee.class"); + // build Version.jar, Version_9.jar and main.jar Result r = run("jar -cf Version.jar -C base test --release 9 -C 9 test --release 10 -C 10 test"); checkResult(r); @@ -74,10 +83,22 @@ public void initialize() throws Exception { checkResult(r); Path foo = Paths.get(System.getProperty("test.classes")).resolve("modules").resolve("foo"); + forceReleaseInClassFile(9, foo.resolve("module-info.class")); r = run("jar -uf Foo.jar --release 9 -C " + foo.toString() + " module-info.class --release 10 -C v10 q"); checkResult(r); } + private void forceReleaseInClassFile(int release, Object... paths) { + for (var path : paths) { + try (var file = new RandomAccessFile(mrjar.resolve(path.toString()).toFile(), "rw")) { + file.seek(4 + 2); // skip magic and minor + file.writeShort(release + 44); // overwrite major + } catch (Exception exception) { + throw new RuntimeException(exception); + } + } + } + @Test public void basic() throws Exception { Result r = run("jdeps -J-Duser.language=en -J-Duser.country=US --multi-release 9 -v missing.jar"); diff --git a/test/langtools/tools/jdeps/listdeps/ListModuleDeps.java b/test/langtools/tools/jdeps/listdeps/ListModuleDeps.java index 63814220c03..b3f81ca1e1e 100644 --- a/test/langtools/tools/jdeps/listdeps/ListModuleDeps.java +++ b/test/langtools/tools/jdeps/listdeps/ListModuleDeps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/jdeps/missingDeps/MissingDepsTest.java b/test/langtools/tools/jdeps/missingDeps/MissingDepsTest.java index edd3f3f5787..4a2e47426f2 100644 --- a/test/langtools/tools/jdeps/missingDeps/MissingDepsTest.java +++ b/test/langtools/tools/jdeps/missingDeps/MissingDepsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * 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 @@ public class MissingDepsTest { private static final Path CLASSES_DIR = Paths.get("classes"); private static final ToolProvider JAR_TOOL = ToolProvider.findFirst("jar").orElseThrow(); - private static final String VERSION = "13"; + private static final String VERSION = String.valueOf(Runtime.version().feature()); private static final Set modules = Set.of("m1", "m2"); @@ -122,7 +122,7 @@ private void checkMissingDeps() { JdepsRunner jdepsRunner = new JdepsRunner(options.toArray(new String[0])); int rc = jdepsRunner.run(DEBUG); assertTrue(rc != 0); - String regex = "\\s+13/p.internal.X\\s+->\\s+q.T\\s+not found"; + String regex = "\\s+" + VERSION + "/p.internal.X\\s+->\\s+q.T\\s+not found"; assertTrue(Arrays.stream(jdepsRunner.output()).anyMatch(l -> l.matches(regex))); } diff --git a/test/langtools/tools/jdeps/multiVersion/MultiVersionError.java b/test/langtools/tools/jdeps/multiVersion/MultiVersionError.java index 62513406b71..bcb69f27aa7 100644 --- a/test/langtools/tools/jdeps/multiVersion/MultiVersionError.java +++ b/test/langtools/tools/jdeps/multiVersion/MultiVersionError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,7 +56,7 @@ public class MultiVersionError { public void compileAll() throws Exception { CompilerUtils.cleanDir(MODS_DIR); modules.forEach(mn -> - assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, mn))); + assertTrue(CompilerUtils.compileModule(SRC_DIR, MODS_DIR, mn, "--release", "9"))); // create a modular multi-release m1.jar Path m1 = MODS_DIR.resolve("m1"); diff --git a/test/langtools/tools/lib/toolbox/AbstractTask.java b/test/langtools/tools/lib/toolbox/AbstractTask.java index 778a5398605..a4d2832460d 100644 --- a/test/langtools/tools/lib/toolbox/AbstractTask.java +++ b/test/langtools/tools/lib/toolbox/AbstractTask.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/lib/toolbox/JavacTask.java b/test/langtools/tools/lib/toolbox/JavacTask.java index ed056099e84..49d14de2d1e 100644 --- a/test/langtools/tools/lib/toolbox/JavacTask.java +++ b/test/langtools/tools/lib/toolbox/JavacTask.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/langtools/tools/lib/toolbox/ToolBox.java b/test/langtools/tools/lib/toolbox/ToolBox.java index 8f1f8d3ce4a..0763da16ee5 100644 --- a/test/langtools/tools/lib/toolbox/ToolBox.java +++ b/test/langtools/tools/lib/toolbox/ToolBox.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/test/lib/jdk/test/lib/containers/docker/DockerRunOptions.java b/test/lib/jdk/test/lib/containers/docker/DockerRunOptions.java index fc3b793c47a..1942ae734d9 100644 --- a/test/lib/jdk/test/lib/containers/docker/DockerRunOptions.java +++ b/test/lib/jdk/test/lib/containers/docker/DockerRunOptions.java @@ -65,22 +65,22 @@ public DockerRunOptions(String imageNameAndTag, String javaCmd, this.addJavaOpts("-XX:+ErrorFileToStderr"); } - public DockerRunOptions addDockerOpts(String... opts) { + public final DockerRunOptions addDockerOpts(String... opts) { Collections.addAll(dockerOpts, opts); return this; } - public DockerRunOptions addJavaOpts(String... opts) { + public final DockerRunOptions addJavaOpts(String... opts) { Collections.addAll(javaOpts, opts); return this; } - public DockerRunOptions addJavaOptsAppended(String... opts) { + public final DockerRunOptions addJavaOptsAppended(String... opts) { Collections.addAll(javaOptsAppended, opts); return this; } - public DockerRunOptions addClassOptions(String... opts) { + public final DockerRunOptions addClassOptions(String... opts) { Collections.addAll(classParams,opts); return this; } diff --git a/test/lib/jdk/test/lib/security/XMLUtils.java b/test/lib/jdk/test/lib/security/XMLUtils.java index 6e6495789d6..efc8f6d5449 100644 --- a/test/lib/jdk/test/lib/security/XMLUtils.java +++ b/test/lib/jdk/test/lib/security/XMLUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -198,6 +198,7 @@ public static class Signer { String dm = DigestMethod.SHA256; String cm = CanonicalizationMethod.EXCLUSIVE; String tr = Transform.ENVELOPED; + Map props = new HashMap<>(); public Signer(PrivateKey privateKey) { this.privateKey = Objects.requireNonNull(privateKey); @@ -247,6 +248,11 @@ public Signer sm(String method) throws Exception { return sm(method, null); } + public Signer prop(String name, Object o) { + props.put(name, o); + return this; + } + // Signs different sources // Signs an XML file in detached mode @@ -254,7 +260,7 @@ public Document sign(URI uri) throws Exception { Document newDocument = DocumentBuilderFactory.newInstance() .newDocumentBuilder().newDocument(); FAC.newXMLSignature(buildSignedInfo(uri.toString()), buildKeyInfo()).sign( - new DOMSignContext(privateKey, newDocument)); + withProps(new DOMSignContext(privateKey, newDocument))); return newDocument; } @@ -264,7 +270,8 @@ public Document sign(URI base, URI ref) throws Exception { .newDocumentBuilder().newDocument(); DOMSignContext ctxt = new DOMSignContext(privateKey, newDocument); ctxt.setBaseURI(base.toString()); - FAC.newXMLSignature(buildSignedInfo(ref.toString()), buildKeyInfo()).sign(ctxt); + FAC.newXMLSignature(buildSignedInfo(ref.toString()), buildKeyInfo()) + .sign(withProps(ctxt)); return newDocument; } @@ -275,7 +282,7 @@ public Document sign(Document document) throws Exception { .transform(new DOMSource(document), result); Document newDocument = (Document) result.getNode(); FAC.newXMLSignature(buildSignedInfo(""), buildKeyInfo()).sign( - new DOMSignContext(privateKey, newDocument.getDocumentElement())); + withProps(new DOMSignContext(privateKey, newDocument.getDocumentElement()))); return newDocument; } @@ -290,7 +297,7 @@ public Document signEnveloping(Document document, String id, String ref) throws id, null, null)), null, null) - .sign(new DOMSignContext(privateKey, newDocument)); + .sign(withProps(new DOMSignContext(privateKey, newDocument))); return newDocument; } @@ -308,7 +315,7 @@ public Document sign(byte[] data) throws Exception { "object", null, null)), null, null) - .sign(new DOMSignContext(privateKey, newDocument)); + .sign(withProps(new DOMSignContext(privateKey, newDocument))); return newDocument; } @@ -325,10 +332,18 @@ public Document sign(String str) throws Exception { "object", null, null)), null, null) - .sign(new DOMSignContext(privateKey, newDocument)); + .sign(withProps(new DOMSignContext(privateKey, newDocument))); return newDocument; } + // Add props to a context + private DOMSignContext withProps(DOMSignContext ctxt) { + for (var e : props.entrySet()) { + ctxt.setProperty(e.getKey(), e.getValue()); + } + return ctxt; + } + // Builds a SignedInfo for a string reference private SignedInfo buildSignedInfo(String ref) throws Exception { return buildSignedInfo(FAC.newReference( @@ -426,6 +441,7 @@ public static class Validator { private Boolean secureValidation = null; private String baseURI = null; private final KeyStore ks; + Map props = new HashMap<>(); public Validator(KeyStore ks) { this.ks = ks; @@ -441,6 +457,11 @@ public Validator baseURI(String base) { return this; } + public Validator prop(String name, Object o) { + props.put(name, o); + return this; + } + public boolean validate(Document document) throws Exception { return validate(document, null); } @@ -471,12 +492,21 @@ public KeySelectorResult select(KeyInfo ki, Purpose p, secureValidation); } return XMLSignatureFactory.getInstance("DOM") - .unmarshalXMLSignature(valContext).validate(valContext); + .unmarshalXMLSignature(valContext) + .validate(withProps(valContext)); } } return false; } + // Add props to a context + private DOMValidateContext withProps(DOMValidateContext ctxt) { + for (var e : props.entrySet()) { + ctxt.setProperty(e.getKey(), e.getValue()); + } + return ctxt; + } + // Find public key from KeyInfo, ks will be used if it's KeyName private static class MyKeySelector extends KeySelector { private final KeyStore ks; diff --git a/test/micro/org/openjdk/bench/vm/compiler/WriteBarrier.java b/test/micro/org/openjdk/bench/vm/compiler/WriteBarrier.java index 686706b46c4..683c597cba9 100644 --- a/test/micro/org/openjdk/bench/vm/compiler/WriteBarrier.java +++ b/test/micro/org/openjdk/bench/vm/compiler/WriteBarrier.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * 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 @@ import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; +import org.openjdk.jmh.annotations.CompilerControl; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; @@ -42,7 +43,7 @@ @Warmup(iterations = 4, time = 2, timeUnit = TimeUnit.SECONDS) @Measurement(iterations = 4, time = 2, timeUnit = TimeUnit.SECONDS) @Fork(value = 3) -public class WriteBarrier { +public abstract class WriteBarrier { // For array references public static final int NUM_REFERENCES_SMALL = 32; @@ -50,15 +51,14 @@ public class WriteBarrier { // For array update tests private Object[] theArraySmall; - private Object[] realReferencesSmall; - private Object[] nullReferencesSmall; private int[] indicesSmall; private Object[] theArrayLarge; - private Object[] realReferencesLarge; - private Object[] nullReferencesLarge; private int[] indicesLarge; + private Object nullRef; + private Object realRef; + // For field update tests public Referencer head = null; public Referencer tail = null; @@ -84,13 +84,9 @@ void clear() { @Setup public void setup() { theArraySmall = new Object[NUM_REFERENCES_SMALL]; - realReferencesSmall = new Object[NUM_REFERENCES_SMALL]; - nullReferencesSmall = new Object[NUM_REFERENCES_SMALL]; indicesSmall = new int[NUM_REFERENCES_SMALL]; theArrayLarge = new Object[NUM_REFERENCES_LARGE]; - realReferencesLarge = new Object[NUM_REFERENCES_LARGE]; - nullReferencesLarge = new Object[NUM_REFERENCES_LARGE]; indicesLarge = new int[NUM_REFERENCES_LARGE]; m_w = (int) System.currentTimeMillis(); @@ -99,14 +95,14 @@ public void setup() { for (int i = 0; i < NUM_REFERENCES_SMALL; i++) { indicesSmall[i] = get_random() % (NUM_REFERENCES_SMALL - 1); - realReferencesSmall[i] = new Object(); } for (int i = 0; i < NUM_REFERENCES_LARGE; i++) { indicesLarge[i] = get_random() % (NUM_REFERENCES_LARGE - 1); - realReferencesLarge[i] = new Object(); } + realRef = new Object(); + // Build a small linked structure this.head = new Referencer(); this.tail = new Referencer(); @@ -124,31 +120,40 @@ private int get_random() { return Math.abs((m_z << 16) + m_w); /* 32-bit result */ } + // This and the other testArrayWriteBarrierFast benchmarks below should not + // be inlined into the JMH-generated harness method. If the methods were + // inlined, we might spill in the main loop (on x64) depending on very + // subtle conditions (such as whether LinuxPerfAsmProfiler is enabled!), + // which could distort the results. @Benchmark + @CompilerControl(CompilerControl.Mode.DONT_INLINE) public void testArrayWriteBarrierFastPathRealSmall() { for (int i = 0; i < NUM_REFERENCES_SMALL; i++) { - theArraySmall[indicesSmall[NUM_REFERENCES_SMALL - i - 1]] = realReferencesSmall[indicesSmall[i]]; + theArraySmall[indicesSmall[NUM_REFERENCES_SMALL - i - 1]] = realRef; } } @Benchmark + @CompilerControl(CompilerControl.Mode.DONT_INLINE) public void testArrayWriteBarrierFastPathNullSmall() { for (int i = 0; i < NUM_REFERENCES_SMALL; i++) { - theArraySmall[indicesSmall[NUM_REFERENCES_SMALL - i - 1]] = nullReferencesSmall[indicesSmall[i]]; + theArraySmall[indicesSmall[NUM_REFERENCES_SMALL - i - 1]] = nullRef; } } @Benchmark + @CompilerControl(CompilerControl.Mode.DONT_INLINE) public void testArrayWriteBarrierFastPathRealLarge() { for (int i = 0; i < NUM_REFERENCES_LARGE; i++) { - theArrayLarge[indicesLarge[NUM_REFERENCES_LARGE - i - 1]] = realReferencesLarge[indicesLarge[i]]; + theArrayLarge[indicesLarge[NUM_REFERENCES_LARGE - i - 1]] = realRef; } } @Benchmark + @CompilerControl(CompilerControl.Mode.DONT_INLINE) public void testArrayWriteBarrierFastPathNullLarge() { for (int i = 0; i < NUM_REFERENCES_LARGE; i++) { - theArrayLarge[indicesLarge[NUM_REFERENCES_LARGE - i - 1]] = nullReferencesLarge[indicesLarge[i]]; + theArrayLarge[indicesLarge[NUM_REFERENCES_LARGE - i - 1]] = nullRef; } } @@ -160,4 +165,15 @@ public void testFieldWriteBarrierFastPath() { this.head.append(this.tail); this.tail.clear(); } + + // This run is useful to compare different GC barrier models without being + // affected by C2 unrolling the main loop differently for each model. + @Fork(value = 3, jvmArgs = {"-XX:LoopUnrollLimit=1"}) + public static class WithoutUnrolling extends WriteBarrier {} + + // This run is useful to study the interaction of GC barriers and loop + // unrolling. Check that the main loop in the testArray benchmarks is + // unrolled (or not) as expected for the studied GC barrier model. + @Fork(value = 3) + public static class WithDefaultUnrolling extends WriteBarrier {} }