From 14fb48d33e21e5cfd4ed3d637f80d40a2c91e8d8 Mon Sep 17 00:00:00 2001 From: SendaoYan Date: Fri, 23 Aug 2024 06:26:24 +0000 Subject: [PATCH 01/11] 8338630: Test java/nio/channels/DatagramChannel/SendReceiveMaxSize.java timeout Reviewed-by: dfuchs, jpai, djelinski --- test/lib/jdk/test/lib/NetworkConfiguration.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/lib/jdk/test/lib/NetworkConfiguration.java b/test/lib/jdk/test/lib/NetworkConfiguration.java index 8ea10ede6a4..3532bb1a3ee 100644 --- a/test/lib/jdk/test/lib/NetworkConfiguration.java +++ b/test/lib/jdk/test/lib/NetworkConfiguration.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 @@ -127,8 +127,8 @@ public static boolean isSameInterface(NetworkInterface ni1, NetworkInterface ni2 public static boolean isTestable(NetworkInterface nif) { if (Platform.isOSX()) { - if (nif.getName().contains("awdl")) { - return false; // exclude awdl + if (nif.getName().contains("awdl") || nif.getName().contains("docker")) { + return false; // exclude awdl or docker } // filter out interfaces that only have link-local IPv6 addresses // on macOS interfaces like 'en6' fall in this category and @@ -145,6 +145,13 @@ public static boolean isTestable(NetworkInterface nif) { return false; } } + + if (Platform.isLinux()) { + String dName = nif.getDisplayName(); + if (dName != null && dName.contains("docker")) { + return false; + } + } return true; } From e186b97af1614334b710e3578bef71f2418993e7 Mon Sep 17 00:00:00 2001 From: Pavel Rappo Date: Fri, 23 Aug 2024 08:05:16 +0000 Subject: [PATCH 02/11] 8338834: Remove unused import declarations in java.compiler Reviewed-by: darcy --- .../share/classes/javax/annotation/processing/Filer.java | 4 +--- .../share/classes/javax/lang/model/SourceVersion.java | 4 ---- .../share/classes/javax/lang/model/element/Element.java | 4 +--- .../share/classes/javax/lang/model/element/TypeElement.java | 4 +--- .../classes/javax/lang/model/element/VariableElement.java | 4 +--- .../share/classes/javax/lang/model/type/TypeVariable.java | 4 +--- .../share/classes/javax/lang/model/type/TypeVisitor.java | 3 +-- .../model/util/AbstractAnnotationValueVisitorPreview.java | 1 - .../javax/lang/model/util/AbstractElementVisitorPreview.java | 3 --- .../classes/javax/lang/model/util/AbstractTypeVisitor9.java | 1 - .../javax/lang/model/util/AbstractTypeVisitorPreview.java | 1 - .../classes/javax/lang/model/util/ElementKindVisitor6.java | 3 +-- .../classes/javax/lang/model/util/ElementKindVisitor9.java | 1 - .../javax/lang/model/util/ElementKindVisitorPreview.java | 1 - .../share/classes/javax/lang/model/util/ElementScanner14.java | 1 - .../share/classes/javax/lang/model/util/ElementScanner6.java | 3 +-- .../share/classes/javax/lang/model/util/ElementScanner7.java | 1 - .../share/classes/javax/lang/model/util/ElementScanner9.java | 1 - .../classes/javax/lang/model/util/ElementScannerPreview.java | 4 ---- .../lang/model/util/SimpleAnnotationValueVisitorPreview.java | 1 - .../classes/javax/lang/model/util/SimpleElementVisitor6.java | 3 +-- .../classes/javax/lang/model/util/SimpleElementVisitor7.java | 1 - .../javax/lang/model/util/SimpleElementVisitorPreview.java | 3 --- .../classes/javax/lang/model/util/SimpleTypeVisitor6.java | 3 +-- .../classes/javax/lang/model/util/SimpleTypeVisitor7.java | 1 - .../classes/javax/lang/model/util/SimpleTypeVisitor9.java | 1 - .../javax/lang/model/util/SimpleTypeVisitorPreview.java | 1 - .../classes/javax/lang/model/util/TypeKindVisitorPreview.java | 1 - .../share/classes/javax/lang/model/util/Types.java | 3 --- 29 files changed, 10 insertions(+), 56 deletions(-) diff --git a/src/java.compiler/share/classes/javax/annotation/processing/Filer.java b/src/java.compiler/share/classes/javax/annotation/processing/Filer.java index 61af2aae0c7..ba9b7ed60ec 100644 --- a/src/java.compiler/share/classes/javax/annotation/processing/Filer.java +++ b/src/java.compiler/share/classes/javax/annotation/processing/Filer.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 @@ -25,10 +25,8 @@ package javax.annotation.processing; -import javax.tools.JavaFileManager; import javax.tools.*; import javax.lang.model.element.Element; -import javax.lang.model.element.TypeElement; import javax.lang.model.util.Elements; import java.io.IOException; diff --git a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java index fd3cb1cb0f8..4e32f0cdcd8 100644 --- a/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java +++ b/src/java.compiler/share/classes/javax/lang/model/SourceVersion.java @@ -25,10 +25,6 @@ package javax.lang.model; -import java.util.Collections; -import java.util.Set; -import java.util.HashSet; - /** * Source versions of the Java programming language. * diff --git a/src/java.compiler/share/classes/javax/lang/model/element/Element.java b/src/java.compiler/share/classes/javax/lang/model/element/Element.java index 59866114325..129dad29020 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/Element.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/Element.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 @@ -27,8 +27,6 @@ import java.lang.annotation.Annotation; -import java.lang.annotation.AnnotationTypeMismatchException; -import java.lang.annotation.IncompleteAnnotationException; import java.util.List; import java.util.Set; diff --git a/src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java b/src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java index a8c3b91f8b5..3f34b179992 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/TypeElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/TypeElement.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 @@ -25,8 +25,6 @@ package javax.lang.model.element; -import jdk.internal.javac.PreviewFeature; - import java.util.List; import javax.lang.model.type.*; import javax.lang.model.util.*; diff --git a/src/java.compiler/share/classes/javax/lang/model/element/VariableElement.java b/src/java.compiler/share/classes/javax/lang/model/element/VariableElement.java index 07e8c25b8f7..4d2b2582901 100644 --- a/src/java.compiler/share/classes/javax/lang/model/element/VariableElement.java +++ b/src/java.compiler/share/classes/javax/lang/model/element/VariableElement.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 @@ -25,8 +25,6 @@ package javax.lang.model.element; -import jdk.internal.javac.PreviewFeature; - import javax.lang.model.util.Elements; import javax.lang.model.type.TypeMirror; import javax.lang.model.type.TypeKind; diff --git a/src/java.compiler/share/classes/javax/lang/model/type/TypeVariable.java b/src/java.compiler/share/classes/javax/lang/model/type/TypeVariable.java index e5ab0458f69..abea88fb6f2 100644 --- a/src/java.compiler/share/classes/javax/lang/model/type/TypeVariable.java +++ b/src/java.compiler/share/classes/javax/lang/model/type/TypeVariable.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 @@ -28,8 +28,6 @@ import javax.lang.model.element.Element; import javax.lang.model.element.TypeParameterElement; -import javax.lang.model.util.Types; - /** * Represents a type variable. diff --git a/src/java.compiler/share/classes/javax/lang/model/type/TypeVisitor.java b/src/java.compiler/share/classes/javax/lang/model/type/TypeVisitor.java index 31d75fe7929..f3f76803e8f 100644 --- a/src/java.compiler/share/classes/javax/lang/model/type/TypeVisitor.java +++ b/src/java.compiler/share/classes/javax/lang/model/type/TypeVisitor.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 @@ -25,7 +25,6 @@ package javax.lang.model.type; -import javax.lang.model.element.*; import javax.lang.model.util.*; /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitorPreview.java index fed666eb32f..724ebe59379 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitorPreview.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractAnnotationValueVisitorPreview.java @@ -28,7 +28,6 @@ import jdk.internal.javac.PreviewFeature; import static javax.lang.model.SourceVersion.*; -import javax.lang.model.SourceVersion; import javax.annotation.processing.SupportedSourceVersion; import javax.annotation.processing.ProcessingEnvironment; diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitorPreview.java index 66a62b7fcb6..7297e7c0c7b 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitorPreview.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractElementVisitorPreview.java @@ -29,9 +29,6 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.annotation.processing.ProcessingEnvironment; -import javax.lang.model.SourceVersion; -import javax.lang.model.element.ElementVisitor; -import javax.lang.model.element.RecordComponentElement; import static javax.lang.model.SourceVersion.*; /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java index b5b9cfb23b0..f802c3bf1b9 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor9.java @@ -26,7 +26,6 @@ package javax.lang.model.util; import javax.annotation.processing.SupportedSourceVersion; -import javax.lang.model.type.*; import javax.lang.model.SourceVersion; import static javax.lang.model.SourceVersion.*; diff --git a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitorPreview.java index c066f1c2f6f..823bad0748a 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitorPreview.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitorPreview.java @@ -29,7 +29,6 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.annotation.processing.ProcessingEnvironment; -import javax.lang.model.SourceVersion; import static javax.lang.model.SourceVersion.*; /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java index 41ad8ffe218..764f4e32737 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor6.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 @@ -28,7 +28,6 @@ import javax.lang.model.element.*; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; -import javax.lang.model.element.ElementVisitor; import static javax.lang.model.element.ElementKind.*; import static javax.lang.model.SourceVersion.*; diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java index 4197f539408..89dcb1f51f3 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitor9.java @@ -28,7 +28,6 @@ import javax.lang.model.element.*; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; -import javax.lang.model.element.ElementVisitor; import static javax.lang.model.SourceVersion.*; /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitorPreview.java index 7c3a1166e31..71d5f15fc85 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitorPreview.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementKindVisitorPreview.java @@ -30,7 +30,6 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.annotation.processing.ProcessingEnvironment; import javax.lang.model.element.*; -import javax.lang.model.SourceVersion; import static javax.lang.model.SourceVersion.*; /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java index 03a69516b51..2f6fb0e03a0 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner14.java @@ -30,7 +30,6 @@ import javax.lang.model.element.*; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; -import javax.lang.model.element.ElementVisitor; import static javax.lang.model.SourceVersion.*; /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java index c5bde23b47e..bff95313508 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.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 @@ -27,7 +27,6 @@ import javax.lang.model.element.*; import javax.annotation.processing.SupportedSourceVersion; -import javax.lang.model.element.ElementVisitor; import javax.lang.model.SourceVersion; import static javax.lang.model.SourceVersion.*; diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java index 51c78c60067..be7fa9908b6 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner7.java @@ -28,7 +28,6 @@ import javax.lang.model.element.*; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; -import javax.lang.model.element.ElementVisitor; import static javax.lang.model.SourceVersion.*; diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java index a9a66d6c185..d572181b32c 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java @@ -28,7 +28,6 @@ import javax.lang.model.element.*; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; -import javax.lang.model.element.ElementVisitor; import static javax.lang.model.SourceVersion.*; diff --git a/src/java.compiler/share/classes/javax/lang/model/util/ElementScannerPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/ElementScannerPreview.java index 6e21554132a..85c30afcf2b 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/ElementScannerPreview.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/ElementScannerPreview.java @@ -27,13 +27,9 @@ import jdk.internal.javac.PreviewFeature; -import java.util.List; -import java.util.ArrayList; import javax.annotation.processing.SupportedSourceVersion; import javax.annotation.processing.ProcessingEnvironment; import javax.lang.model.element.*; -import javax.lang.model.SourceVersion; -import javax.lang.model.element.ElementVisitor; import static javax.lang.model.SourceVersion.*; /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitorPreview.java index 48182072416..c0444c91060 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitorPreview.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleAnnotationValueVisitorPreview.java @@ -29,7 +29,6 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.annotation.processing.ProcessingEnvironment; -import javax.lang.model.SourceVersion; import static javax.lang.model.SourceVersion.*; /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java index 2e8e27eeff0..c28b13d4992 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor6.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 @@ -28,7 +28,6 @@ import javax.lang.model.element.*; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; -import javax.lang.model.element.ElementVisitor; import static javax.lang.model.SourceVersion.*; diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor7.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor7.java index fcd26dda60d..3c71f97b675 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor7.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitor7.java @@ -28,7 +28,6 @@ import javax.lang.model.element.*; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; -import javax.lang.model.element.ElementVisitor; import static javax.lang.model.SourceVersion.*; /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitorPreview.java index 6acc8f2da48..79da686ee08 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitorPreview.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleElementVisitorPreview.java @@ -29,9 +29,6 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.annotation.processing.ProcessingEnvironment; -import javax.lang.model.SourceVersion; -import javax.lang.model.element.ElementVisitor; -import javax.lang.model.element.RecordComponentElement; import static javax.lang.model.SourceVersion.*; /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java index ce6321d9fd3..9386c027316 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor6.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor6.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 @@ -29,7 +29,6 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; import static javax.lang.model.SourceVersion.*; -import javax.lang.model.type.TypeVisitor; /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java index f47314aeeb2..c550a76e4b6 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor7.java @@ -29,7 +29,6 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; import static javax.lang.model.SourceVersion.*; -import javax.lang.model.type.TypeVisitor; /** * A simple visitor of types with default behavior appropriate for the diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java index 8f97b34d547..32174be9949 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitor9.java @@ -27,7 +27,6 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; -import javax.lang.model.type.IntersectionType; import static javax.lang.model.SourceVersion.*; /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitorPreview.java index a058f42937a..1efbe710837 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitorPreview.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/SimpleTypeVisitorPreview.java @@ -29,7 +29,6 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.annotation.processing.ProcessingEnvironment; -import javax.lang.model.SourceVersion; import static javax.lang.model.SourceVersion.*; /** diff --git a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitorPreview.java b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitorPreview.java index 703ef744edc..70e0498f565 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitorPreview.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/TypeKindVisitorPreview.java @@ -29,7 +29,6 @@ import javax.annotation.processing.SupportedSourceVersion; import javax.annotation.processing.ProcessingEnvironment; -import javax.lang.model.SourceVersion; import javax.lang.model.type.*; import static javax.lang.model.SourceVersion.*; diff --git a/src/java.compiler/share/classes/javax/lang/model/util/Types.java b/src/java.compiler/share/classes/javax/lang/model/util/Types.java index f6296050ca9..0cea2734e21 100644 --- a/src/java.compiler/share/classes/javax/lang/model/util/Types.java +++ b/src/java.compiler/share/classes/javax/lang/model/util/Types.java @@ -25,9 +25,6 @@ package javax.lang.model.util; -import java.lang.annotation.Annotation; -import java.lang.annotation.AnnotationTypeMismatchException; -import java.lang.annotation.IncompleteAnnotationException; import java.util.List; import javax.lang.model.element.*; import javax.lang.model.type.*; From 88977a9631cb8bd15b7ced5ee57b3bd775497db1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= Date: Fri, 23 Aug 2024 09:26:00 +0000 Subject: [PATCH 03/11] 8338745: Intrinsify Continuation.pin() and Continuation.unpin() Reviewed-by: kvn --- src/java.base/share/classes/jdk/internal/vm/Continuation.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/java.base/share/classes/jdk/internal/vm/Continuation.java b/src/java.base/share/classes/jdk/internal/vm/Continuation.java index 5c1d41c36d9..99d0c62aaec 100644 --- a/src/java.base/share/classes/jdk/internal/vm/Continuation.java +++ b/src/java.base/share/classes/jdk/internal/vm/Continuation.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 @@ -427,6 +427,7 @@ public boolean isPreempted() { * Pins the current continuation (enters a critical section). * This increments an internal semaphore that, when greater than 0, pins the continuation. */ + @IntrinsicCandidate public static native void pin(); /** @@ -434,6 +435,7 @@ public boolean isPreempted() { * This decrements an internal semaphore that, when equal 0, unpins the current continuation * if pinned with {@link #pin()}. */ + @IntrinsicCandidate public static native void unpin(); /** From 52db2a7f2544578f05ca33dcbb9391b692d557ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= Date: Fri, 23 Aug 2024 09:29:23 +0000 Subject: [PATCH 04/11] 8338417: Explicitly pin a virtual thread before acquiring the JFR string pool monitor Reviewed-by: alanb, egahlin, dholmes --- src/java.base/share/classes/module-info.java | 3 +- .../classes/jdk/jfr/internal/StringPool.java | 88 +++++++++----- .../jdk/jfr/internal/event/EventWriter.java | 8 +- .../TestStringPoolVirtualThreadPinning.java | 110 ++++++++++++++++++ 4 files changed, 176 insertions(+), 33 deletions(-) create mode 100644 test/jdk/jdk/jfr/threading/TestStringPoolVirtualThreadPinning.java diff --git a/src/java.base/share/classes/module-info.java b/src/java.base/share/classes/module-info.java index 52c1029dd3d..74a7451582c 100644 --- a/src/java.base/share/classes/module-info.java +++ b/src/java.base/share/classes/module-info.java @@ -256,7 +256,8 @@ jdk.internal.jvmstat, jdk.management, jdk.management.agent, - jdk.internal.vm.ci; + jdk.internal.vm.ci, + jdk.jfr; exports jdk.internal.vm.annotation to java.instrument, jdk.internal.vm.ci, diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/StringPool.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/StringPool.java index 6513895069e..d16bd9ab2a9 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/StringPool.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/StringPool.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 @@ -26,6 +26,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; +import jdk.internal.vm.Continuation; public final class StringPool { public static final int MIN_LIMIT = 16; @@ -71,33 +72,49 @@ private static long externalSid(long internalSid) { return internalSid >> 16; } - /* synchronized because of writing the string to the JVM. */ - private static synchronized long storeString(String s) { - Long lsid = cache.get(s); - long internalSid; - if (lsid != null) { - internalSid = lsid.longValue(); - if (isCurrentGeneration(internalSid)) { - // Someone already updated the cache. - return externalSid(internalSid); + /* Explicitly pin a virtual thread before acquiring the string pool monitor + * because migrating the EventWriter onto another carrier thread is impossible. + */ + private static long storeString(String s, boolean pinVirtualThread) { + if (pinVirtualThread) { + assert(Thread.currentThread().isVirtual()); + Continuation.pin(); + } + try { + /* synchronized because of writing the string to the JVM. */ + synchronized (StringPool.class) { + Long lsid = cache.get(s); + long internalSid; + if (lsid != null) { + internalSid = lsid.longValue(); + if (isCurrentGeneration(internalSid)) { + // Someone already updated the cache. + return externalSid(internalSid); + } + internalSid = updateInternalSid(internalSid); + } else { + // Not yet added or the cache was cleared. + internalSid = nextInternalSid(); + currentSizeUTF16 += s.length(); + } + long extSid = externalSid(internalSid); + // Write the string to the JVM before publishing to the cache. + JVM.addStringConstant(extSid, s); + cache.put(s, internalSid); + return extSid; + } + } finally { + if (pinVirtualThread) { + assert(Thread.currentThread().isVirtual()); + Continuation.unpin(); } - internalSid = updateInternalSid(internalSid); - } else { - // Not yet added or the cache was cleared. - internalSid = nextInternalSid(); - currentSizeUTF16 += s.length(); } - long extSid = externalSid(internalSid); - // Write the string to the JVM before publishing to the cache. - JVM.addStringConstant(extSid, s); - cache.put(s, internalSid); - return extSid; } /* a string fetched from the string pool must be of the current generation */ - private static long ensureCurrentGeneration(String s, Long lsid) { + private static long ensureCurrentGeneration(String s, Long lsid, boolean pinVirtualThread) { long internalSid = lsid.longValue(); - return isCurrentGeneration(internalSid) ? externalSid(internalSid) : storeString(s); + return isCurrentGeneration(internalSid) ? externalSid(internalSid) : storeString(s, pinVirtualThread); } /* @@ -109,10 +126,10 @@ private static long ensureCurrentGeneration(String s, Long lsid) { * effectively invalidating the fetched string id. The event restart mechanism * of the EventWriter ensures that committed strings are in the correct generation. */ - public static long addString(String s) { + public static long addString(String s, boolean pinVirtualThread) { Long lsid = cache.get(s); if (lsid != null) { - return ensureCurrentGeneration(s, lsid); + return ensureCurrentGeneration(s, lsid, pinVirtualThread); } if (!preCache(s)) { /* we should not pool this string */ @@ -120,9 +137,9 @@ public static long addString(String s) { } if (cache.size() > MAX_SIZE || currentSizeUTF16 > MAX_SIZE_UTF16) { /* pool was full */ - reset(); + reset(pinVirtualThread); } - return storeString(s); + return storeString(s, pinVirtualThread); } private static boolean preCache(String s) { @@ -143,8 +160,21 @@ private static boolean preCache(String s) { return false; } - private static synchronized void reset() { - cache.clear(); - currentSizeUTF16 = 0; + private static void reset(boolean pinVirtualThread) { + if (pinVirtualThread) { + assert(Thread.currentThread().isVirtual()); + Continuation.pin(); + } + try { + synchronized (StringPool.class) { + cache.clear(); + currentSizeUTF16 = 0; + } + } finally { + if (pinVirtualThread) { + assert(Thread.currentThread().isVirtual()); + Continuation.unpin(); + } + } } } diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/event/EventWriter.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/event/EventWriter.java index 833fb087e24..970365ef73d 100644 --- a/src/jdk.jfr/share/classes/jdk/jfr/internal/event/EventWriter.java +++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/event/EventWriter.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 @@ -65,6 +65,7 @@ public final class EventWriter { private long currentPosition; private long maxPosition; private boolean valid; + private boolean pinVirtualThread; boolean excluded; private PlatformEventType eventType; @@ -144,7 +145,7 @@ public void putString(String s) { return; } if (length > StringPool.MIN_LIMIT && length < StringPool.MAX_LIMIT) { - long l = StringPool.addString(s); + long l = StringPool.addString(s, pinVirtualThread); if (l > 0) { putByte(StringParser.Encoding.CONSTANT_POOL.byteValue()); putLong(l); @@ -296,11 +297,12 @@ public boolean endEvent() { return false; } - private EventWriter(long startPos, long maxPos, long threadID, boolean valid, boolean excluded) { + private EventWriter(long startPos, long maxPos, long threadID, boolean valid, boolean pinVirtualThread, boolean excluded) { startPosition = currentPosition = startPos; maxPosition = maxPos; this.threadID = threadID; this.valid = valid; + this.pinVirtualThread = pinVirtualThread; this.excluded = excluded; } diff --git a/test/jdk/jdk/jfr/threading/TestStringPoolVirtualThreadPinning.java b/test/jdk/jdk/jfr/threading/TestStringPoolVirtualThreadPinning.java new file mode 100644 index 00000000000..0dc1ef85661 --- /dev/null +++ b/test/jdk/jdk/jfr/threading/TestStringPoolVirtualThreadPinning.java @@ -0,0 +1,110 @@ +/* + * 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. + */ +package jdk.jfr.threading; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ThreadFactory; + +import jdk.jfr.Event; +import jdk.jfr.Name; +import jdk.jfr.Recording; +import jdk.jfr.consumer.RecordedEvent; +import jdk.jfr.consumer.RecordedThread; +import jdk.jfr.consumer.RecordingFile; +import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; + +/** + * @test + * @bug 8338417 + * @summary Tests pinning of virtual threads when the JFR string pool monitor is contended. + * @key jfr + * @requires vm.hasJFR & vm.continuations + * @library /test/lib /test/jdk + * @run main/othervm jdk.jfr.threading.TestStringPoolVirtualThreadPinning + */ +public class TestStringPoolVirtualThreadPinning { + + private static final int VIRTUAL_THREAD_COUNT = 100_000; + private static final int STARTER_THREADS = 10; + + @Name("test.Tester") + private static class TestEvent extends Event { + private String eventString = Thread.currentThread().getName(); + } + + /* + * During event commit, the thread is in a critical section because it has loaded a carrier thread local event writer object. + * For virtual threads, a contended monitor, such as a synchronized block, is a point where a thread could become unmounted. + * A monitor guards the JFR string pool, but because of the event writer, remounting a virtual thread onto another carrier is impossible. + * + * The test provokes JFR string pool monitor contention to exercise explicit pin constructs to ensure the pinning of virtual threads. + */ + public static void main(String... args) throws Exception { + try (Recording r = new Recording()) { + r.start(); + + ThreadFactory factory = Thread.ofVirtual().factory(); + CompletableFuture[] c = new CompletableFuture[STARTER_THREADS]; + for (int j = 0; j < STARTER_THREADS; j++) { + c[j] = CompletableFuture.runAsync(() -> { + for (int i = 0; i < VIRTUAL_THREAD_COUNT / STARTER_THREADS; i++) { + try { + Thread vt = factory.newThread(TestStringPoolVirtualThreadPinning::emitEvent); + // For an event field string to be placed in the JFR string pool, it must exceed 16 characters. + // We use the virtual thread name as the event field string so we can verify the result as a 1-1 mapping. + vt.setName("VirtualTestThread-" + i); + vt.start(); + vt.join(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + }); + } + for (int j = 0; j < STARTER_THREADS; j++) { + c[j].get(); + } + + r.stop(); + Path p = Utils.createTempFile("test", ".jfr"); + r.dump(p); + List events = RecordingFile.readAllEvents(p); + Asserts.assertEquals(events.size(), VIRTUAL_THREAD_COUNT, "Expected " + VIRTUAL_THREAD_COUNT + " events"); + for (RecordedEvent e : events) { + RecordedThread t = e.getThread(); + Asserts.assertNotNull(t); + Asserts.assertTrue(t.isVirtual()); + Asserts.assertEquals(e.getString("eventString"), t.getJavaName()); + } + } + } + + private static void emitEvent() { + TestEvent t = new TestEvent(); + t.commit(); + } +} From b57260cc2e189630e7d66969a28e93bf0cc1dee2 Mon Sep 17 00:00:00 2001 From: Qizheng Xing Date: Fri, 23 Aug 2024 09:30:47 +0000 Subject: [PATCH 05/11] 8333334: C2: Make result of `Node::dominates` more precise to enhance scalar replacement Reviewed-by: chagedorn, kvn, thartmann --- .../ScalarReplacementWithGCBarrierTests.java | 118 ++++++++++++++++++ .../bench/java/util/concurrent/Maps.java | 17 +++ 2 files changed, 135 insertions(+) create mode 100644 test/hotspot/jtreg/compiler/c2/irTests/scalarReplacement/ScalarReplacementWithGCBarrierTests.java diff --git a/test/hotspot/jtreg/compiler/c2/irTests/scalarReplacement/ScalarReplacementWithGCBarrierTests.java b/test/hotspot/jtreg/compiler/c2/irTests/scalarReplacement/ScalarReplacementWithGCBarrierTests.java new file mode 100644 index 00000000000..fbf5cdd61cc --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/irTests/scalarReplacement/ScalarReplacementWithGCBarrierTests.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2024 Alibaba Group Holding Limited. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package compiler.c2.irTests.scalarReplacement; + +import compiler.lib.ir_framework.*; + +/* + * @test + * @bug 8333334 + * @summary Tests that dead barrier control flows do not affect the scalar replacement. + * @library /test/lib / + * @requires vm.compiler2.enabled + * @requires vm.gc.G1 + * @run driver compiler.c2.irTests.scalarReplacement.ScalarReplacementWithGCBarrierTests + */ +public class ScalarReplacementWithGCBarrierTests { + static class List { + public Node head; + + public void push(int value) { + Node n = new Node(); + n.value = value; + n.next = head; + head = n; + } + + @ForceInline + public Iter iter() { + Iter iter = new Iter(); + iter.list = this; + iter.n = head; + iter.sum = 0; + return iter; + } + } + + static class Node { + public int value; + public Node next; + } + + static class Iter { + public List list; + public Node n; + public Integer sum; + + @ForceInline + public boolean next() { + int lastSum = sum; + while (sum - lastSum < 1000) { + while (n != null && n.value < 30) n = n.next; + if (n == null) return false; + sum += n.value; + n = n.next; + } + return true; + } + } + + private static final int SIZE = 1000; + + public static void main(String[] args) { + // Must use G1 GC to ensure there is a pre-barrier + // before the first field write. + TestFramework.runWithFlags("-XX:+UseG1GC"); + } + + @Run(test = "testScalarReplacementWithGCBarrier") + private void runner() { + List list = new List(); + for (int i = 0; i < SIZE; i++) { + list.push(i); + } + testScalarReplacementWithGCBarrier(list); + } + + // Allocation of `Iter iter` should be eliminated by scalar replacement, and + // the allocation of `Integer sum` can not be eliminated, so there should be + // 1 allocation after allocations and locks elimination. + // + // Before the patch of JDK-8333334, both allocations of `Iter` and `Integer` + // could not be eliminated. + @Test + @IR(phase = { CompilePhase.AFTER_PARSING }, counts = { IRNode.ALLOC, "1" }) + @IR(phase = { CompilePhase.INCREMENTAL_BOXING_INLINE }, counts = { IRNode.ALLOC, "2" }) + @IR(phase = { CompilePhase.ITER_GVN_AFTER_ELIMINATION }, counts = { IRNode.ALLOC, "1" }) + private int testScalarReplacementWithGCBarrier(List list) { + Iter iter = list.iter(); + while (true) { + while (iter.next()) {} + if (list.head == null) break; + list.head = list.head.next; + iter.n = list.head; + } + return iter.sum; + } +} diff --git a/test/micro/org/openjdk/bench/java/util/concurrent/Maps.java b/test/micro/org/openjdk/bench/java/util/concurrent/Maps.java index bd68e582e6a..62883efb8bb 100644 --- a/test/micro/org/openjdk/bench/java/util/concurrent/Maps.java +++ b/test/micro/org/openjdk/bench/java/util/concurrent/Maps.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, Alibaba Group Holding Limited. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -35,6 +36,7 @@ import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; +import java.util.Enumeration; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; @@ -127,6 +129,21 @@ public ConcurrentHashMap testConcurrentHashMapPutAll() { return map; } + @Benchmark + public int testConcurrentHashMapIterators() { + ConcurrentHashMap map = (ConcurrentHashMap) staticMap; + int sum = 0; + Enumeration it = map.elements(); + while (it.hasMoreElements()) { + sum += (int) it.nextElement(); + } + it = map.keys(); + while (it.hasMoreElements()) { + sum += (int) it.nextElement(); + } + return sum; + } + private static class SimpleRandom { private final static long multiplier = 0x5DEECE66DL; private final static long addend = 0xBL; From 502165fb79666e0f013721b1503c7d9c386ffc8e Mon Sep 17 00:00:00 2001 From: Tejesh R Date: Fri, 23 Aug 2024 10:51:12 +0000 Subject: [PATCH 06/11] 8329756: [macos] "javax/swing/JTable/KeyBoardNavigation.java" fail because most combinations of navigational keys with the Ctrl key do not work Reviewed-by: abhiscxk, dnguyen --- .../com/apple/laf/AquaKeyBindings.java | 4 +++- .../swing/JTable/KeyBoardNavigation.java | 21 +++++++------------ 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java b/src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java index d64ac90e9ac..60bb3da9f87 100644 --- a/src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java +++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaKeyBindings.java @@ -388,7 +388,9 @@ LateBoundInputMap getTableInputMap() { "alt shift TAB", "focusHeader", "F8", "focusHeader", "ctrl shift UP", "selectFirstRowExtendSelection", - "ctrl shift DOWN", "selectLastRowExtendSelection" + "ctrl shift DOWN", "selectLastRowExtendSelection", + "ctrl shift RIGHT", "selectLastColumnExtendSelection", + "ctrl shift LEFT", "selectFirstColumnExtendSelection" })); } diff --git a/test/jdk/javax/swing/JTable/KeyBoardNavigation.java b/test/jdk/javax/swing/JTable/KeyBoardNavigation.java index 595547421ad..728361a3e90 100644 --- a/test/jdk/javax/swing/JTable/KeyBoardNavigation.java +++ b/test/jdk/javax/swing/JTable/KeyBoardNavigation.java @@ -39,7 +39,7 @@ /* * @test * @key headful - * @bug 4112270 8264102 + * @bug 4112270 8264102 8329756 * @library /java/awt/regtesthelpers * @build PassFailJFrame * @summary Test Keyboard Navigation in JTable. @@ -178,7 +178,7 @@ public static void main(String[] args) throws Exception { 1. Refer the below keyboard navigation specs (referenced from bug report 4112270). 2. Check all combinations of navigational keys mentioned below - and verifying each key combinations against the spec defined. + and verify each key combination against the spec defined. If it does, press "pass", otherwise press "fail". """; @@ -270,24 +270,19 @@ public static String getOSSpecificInstructions() { up/down Left/Right Arrow - Deselect current selection; move focus one cell left/right - FN+Up Arrow/FN+Down Arrow - Deselect current selection; + fn+Up/Down Arrow - Deselect current selection; scroll up/down one JViewport view; first visible cell in current column gets focus - Control-FN+Up Arrow/FN+Down Arrow - Deselect current selection; - move focus and view to - first/last cell in current row - F2 - Allows editing in a cell containing information without + fn - Allows editing in a cell containing information without overwriting the information Esc - Resets the cell content back to the state it was in before editing started - Ctrl+A, Ctrl+/ - Select All - Ctrl+\\ - Deselect all + Cmd+A - Select All Shift-Up/Down Arrow - Extend selection up/down one row Shift-Left/Right Arrow - Extend selection left/right one column - FN-Shift Up/Down Arrow - Extend selection to top/bottom of column - Shift-PageUp/PageDown - Extend selection up/down one view and scroll - table - """; + Ctrl-Shift Up/Down Arrow - Extend selection to top/bottom of row + Ctrl-Shift Left/Right Arrow - Extend selection to first/last of column + """; String osName = System.getProperty("os.name").toLowerCase(); if (osName.startsWith("mac")) { return MAC_SPECIFIC; From c3a413818a7e14161cdc72da2edd944ff4b3739d Mon Sep 17 00:00:00 2001 From: Chen Liang Date: Fri, 23 Aug 2024 15:16:44 +0000 Subject: [PATCH 07/11] 8338700: AttributeMapper type parameter should be bounded by Attribute Reviewed-by: asotona --- .../share/classes/java/lang/classfile/AttributeMapper.java | 4 ++-- .../share/classes/java/lang/classfile/package-info.java | 2 +- .../classes/jdk/internal/classfile/impl/AttributeHolder.java | 2 +- .../classes/jdk/internal/classfile/impl/BoundAttribute.java | 2 +- .../share/classes/jdk/internal/classfile/impl/Util.java | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/java.base/share/classes/java/lang/classfile/AttributeMapper.java b/src/java.base/share/classes/java/lang/classfile/AttributeMapper.java index 0e7d625290e..0b46055423a 100644 --- a/src/java.base/share/classes/java/lang/classfile/AttributeMapper.java +++ b/src/java.base/share/classes/java/lang/classfile/AttributeMapper.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 @@ -40,7 +40,7 @@ * @since 22 */ @PreviewFeature(feature = PreviewFeature.Feature.CLASSFILE_API) -public interface AttributeMapper { +public interface AttributeMapper> { /** * Attribute stability indicator diff --git a/src/java.base/share/classes/java/lang/classfile/package-info.java b/src/java.base/share/classes/java/lang/classfile/package-info.java index 921cf9e1a34..6e9ecfe4819 100644 --- a/src/java.base/share/classes/java/lang/classfile/package-info.java +++ b/src/java.base/share/classes/java/lang/classfile/package-info.java @@ -147,7 +147,7 @@ * ClassReader, int)} method for mapping from the classfile format * to an attribute instance, and the * {@link java.lang.classfile.AttributeMapper#writeAttribute(java.lang.classfile.BufWriter, - * java.lang.Object)} method for mapping back to the classfile format. It also + * java.lang.classfile.Attribute)} method for mapping back to the classfile format. It also * contains metadata including the attribute name, the set of classfile entities * where the attribute is applicable, and whether multiple attributes of the * same kind are allowed on a single entity. diff --git a/src/java.base/share/classes/jdk/internal/classfile/impl/AttributeHolder.java b/src/java.base/share/classes/jdk/internal/classfile/impl/AttributeHolder.java index 31e1a7f2533..fb9ecc98902 100644 --- a/src/java.base/share/classes/jdk/internal/classfile/impl/AttributeHolder.java +++ b/src/java.base/share/classes/jdk/internal/classfile/impl/AttributeHolder.java @@ -54,7 +54,7 @@ public void writeTo(BufWriterImpl buf) { } @SuppressWarnings("unchecked") - A get(AttributeMapper am) { + > A get(AttributeMapper am) { for (Attribute a : attributes) if (a.attributeMapper() == am) return (A)a; diff --git a/src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java b/src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java index d5ed0c14bce..36ef2fa55eb 100644 --- a/src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java +++ b/src/java.base/share/classes/jdk/internal/classfile/impl/BoundAttribute.java @@ -148,7 +148,7 @@ public static List> readAttributes(AttributedElement enclosing, Cla mapper = customAttributes.apply(name); } if (mapper != null) { - filled.add((Attribute) Objects.requireNonNull(mapper.readAttribute(enclosing, reader, p))); + filled.add(Objects.requireNonNull(mapper.readAttribute(enclosing, reader, p))); } else { AttributeMapper fakeMapper = new AttributeMapper<>() { @Override diff --git a/src/java.base/share/classes/jdk/internal/classfile/impl/Util.java b/src/java.base/share/classes/jdk/internal/classfile/impl/Util.java index 1ff80d76676..a064c40be30 100644 --- a/src/java.base/share/classes/jdk/internal/classfile/impl/Util.java +++ b/src/java.base/share/classes/jdk/internal/classfile/impl/Util.java @@ -224,7 +224,7 @@ public static MethodTypeDesc methodTypeSymbol(NameAndTypeEntry nat) { } @SuppressWarnings("unchecked") - private static void writeAttribute(BufWriterImpl writer, Attribute attr) { + private static > void writeAttribute(BufWriterImpl writer, Attribute attr) { if (attr instanceof CustomAttribute ca) { var mapper = (AttributeMapper) ca.attributeMapper(); mapper.writeAttribute(writer, (T) ca); From c70c7864a353123ba0a1d7714b0fdaa566d9aeb8 Mon Sep 17 00:00:00 2001 From: Brian Burkhalter Date: Fri, 23 Aug 2024 16:32:14 +0000 Subject: [PATCH 08/11] 8324048: (fc) Make FileKey fields final Reviewed-by: djelinski, alanb, jpai --- .../unix/classes/sun/nio/ch/FileKey.java | 23 ++++++++------- src/java.base/unix/native/libnio/ch/FileKey.c | 24 ++++++---------- .../windows/classes/sun/nio/ch/FileKey.java | 24 +++++++++------- .../windows/native/libnio/ch/FileKey.c | 28 ++++++------------- 4 files changed, 43 insertions(+), 56 deletions(-) diff --git a/src/java.base/unix/classes/sun/nio/ch/FileKey.java b/src/java.base/unix/classes/sun/nio/ch/FileKey.java index e60e63f073d..119abe4a3b5 100644 --- a/src/java.base/unix/classes/sun/nio/ch/FileKey.java +++ b/src/java.base/unix/classes/sun/nio/ch/FileKey.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 @@ -33,15 +33,18 @@ */ public class FileKey { - private long st_dev; // ID of device - private long st_ino; // Inode number + private final long st_dev; // ID of device + private final long st_ino; // Inode number - private FileKey() { } + private FileKey(long st_dev, long st_ino) { + this.st_dev = st_dev; + this.st_ino = st_ino; + } public static FileKey create(FileDescriptor fd) throws IOException { - FileKey fk = new FileKey(); - fk.init(fd); - return fk; + long finfo[] = new long[2]; + init(fd, finfo); + return new FileKey(finfo[0], finfo[1]); } @Override @@ -59,10 +62,10 @@ public boolean equals(Object obj) { && (this.st_ino == other.st_ino); } - private native void init(FileDescriptor fd) throws IOException; - private static native void initIDs(); + private static native void init(FileDescriptor fd, long[] finfo) + throws IOException; static { - initIDs(); + IOUtil.load(); } } diff --git a/src/java.base/unix/native/libnio/ch/FileKey.c b/src/java.base/unix/native/libnio/ch/FileKey.c index c3817003b5b..59a866bcaff 100644 --- a/src/java.base/unix/native/libnio/ch/FileKey.c +++ b/src/java.base/unix/native/libnio/ch/FileKey.c @@ -30,29 +30,21 @@ #include "nio_util.h" #include "sun_nio_ch_FileKey.h" -static jfieldID key_st_dev; /* id for FileKey.st_dev */ -static jfieldID key_st_ino; /* id for FileKey.st_ino */ - - -JNIEXPORT void JNICALL -Java_sun_nio_ch_FileKey_initIDs(JNIEnv *env, jclass clazz) -{ - CHECK_NULL(key_st_dev = (*env)->GetFieldID(env, clazz, "st_dev", "J")); - CHECK_NULL(key_st_ino = (*env)->GetFieldID(env, clazz, "st_ino", "J")); -} - - JNIEXPORT void JNICALL -Java_sun_nio_ch_FileKey_init(JNIEnv *env, jobject this, jobject fdo) +Java_sun_nio_ch_FileKey_init(JNIEnv* env, jclass clazz, jobject fdo, + jlongArray finfo) { struct stat fbuf; int res; + jlong deviceAndInode[2]; - RESTARTABLE(fstat(fdval(env, fdo), &fbuf), res); + int fd = fdval(env, fdo); + RESTARTABLE(fstat(fd, &fbuf), res); if (res < 0) { JNU_ThrowIOExceptionWithLastError(env, "fstat failed"); } else { - (*env)->SetLongField(env, this, key_st_dev, (jlong)fbuf.st_dev); - (*env)->SetLongField(env, this, key_st_ino, (jlong)fbuf.st_ino); + deviceAndInode[0] = (jlong)fbuf.st_dev; + deviceAndInode[1] = (jlong)fbuf.st_ino; + (*env)->SetLongArrayRegion(env, finfo, 0, 2, deviceAndInode); } } diff --git a/src/java.base/windows/classes/sun/nio/ch/FileKey.java b/src/java.base/windows/classes/sun/nio/ch/FileKey.java index 8669517f0c5..a900c382e68 100644 --- a/src/java.base/windows/classes/sun/nio/ch/FileKey.java +++ b/src/java.base/windows/classes/sun/nio/ch/FileKey.java @@ -33,16 +33,21 @@ */ public class FileKey { - private int dwVolumeSerialNumber; - private int nFileIndexHigh; - private int nFileIndexLow; + private final int dwVolumeSerialNumber; + private final int nFileIndexHigh; + private final int nFileIndexLow; - private FileKey() { } + private FileKey(int dwVolumeSerialNumber, int nFileIndexHigh, + int nFileIndexLow) { + this.dwVolumeSerialNumber = dwVolumeSerialNumber; + this.nFileIndexHigh = nFileIndexHigh; + this.nFileIndexLow = nFileIndexLow; + } public static FileKey create(FileDescriptor fd) throws IOException { - FileKey fk = new FileKey(); - fk.init(fd); - return fk; + int finfo[] = new int[3]; + init(fd, finfo); + return new FileKey(finfo[0], finfo[1], finfo[2]); } @Override @@ -60,11 +65,10 @@ public boolean equals(Object obj) { && this.nFileIndexLow == other.nFileIndexLow; } - private native void init(FileDescriptor fd) throws IOException; - private static native void initIDs(); + private static native void init(FileDescriptor fd, int[] finfo) + throws IOException; static { IOUtil.load(); - initIDs(); } } diff --git a/src/java.base/windows/native/libnio/ch/FileKey.c b/src/java.base/windows/native/libnio/ch/FileKey.c index 9cd3459aef8..e552ed6b7ae 100644 --- a/src/java.base/windows/native/libnio/ch/FileKey.c +++ b/src/java.base/windows/native/libnio/ch/FileKey.c @@ -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 @@ -30,32 +30,20 @@ #include "nio_util.h" #include "sun_nio_ch_FileKey.h" -static jfieldID key_volumeSN; /* id for FileKey.dwVolumeSerialNumber */ -static jfieldID key_indexHigh; /* id for FileKey.nFileIndexHigh */ -static jfieldID key_indexLow; /* id for FileKey.nFileIndexLow */ - - -JNIEXPORT void JNICALL -Java_sun_nio_ch_FileKey_initIDs(JNIEnv *env, jclass clazz) -{ - CHECK_NULL(key_volumeSN = (*env)->GetFieldID(env, clazz, "dwVolumeSerialNumber", "I")); - CHECK_NULL(key_indexHigh = (*env)->GetFieldID(env, clazz, "nFileIndexHigh", "I")); - CHECK_NULL(key_indexLow = (*env)->GetFieldID(env, clazz, "nFileIndexLow", "I")); -} - - JNIEXPORT void JNICALL -Java_sun_nio_ch_FileKey_init(JNIEnv *env, jobject this, jobject fdo) +Java_sun_nio_ch_FileKey_init(JNIEnv *env, jclass clazz, jobject fdo, jintArray finfo) { - HANDLE fileHandle = (HANDLE)(handleval(env, fdo)); + HANDLE fileHandle = (HANDLE)handleval(env, fdo); BOOL result; BY_HANDLE_FILE_INFORMATION fileInfo; + jint info[3]; result = GetFileInformationByHandle(fileHandle, &fileInfo); if (result) { - (*env)->SetIntField(env, this, key_volumeSN, fileInfo.dwVolumeSerialNumber); - (*env)->SetIntField(env, this, key_indexHigh, fileInfo.nFileIndexHigh); - (*env)->SetIntField(env, this, key_indexLow, fileInfo.nFileIndexLow); + info[0] = (jint)fileInfo.dwVolumeSerialNumber; + info[1] = (jint)fileInfo.nFileIndexHigh; + info[2] = (jint)fileInfo.nFileIndexLow; + (*env)->SetIntArrayRegion(env, finfo, 0, 3, info); } else { JNU_ThrowIOExceptionWithLastError(env, "GetFileInformationByHandle failed"); } From f10f627c04a89cfcaa99017973339fa0060fa1ae Mon Sep 17 00:00:00 2001 From: Joe Darcy Date: Fri, 23 Aug 2024 20:01:16 +0000 Subject: [PATCH 09/11] 8337715: Update --release 23 symbol information for JDK 23 build 37 Reviewed-by: iris, liach --- .../share/data/symbols/java.base-N.sym.txt | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/src/jdk.compiler/share/data/symbols/java.base-N.sym.txt b/src/jdk.compiler/share/data/symbols/java.base-N.sym.txt index fd1bd11f6b9..f14c1fb1a4c 100644 --- a/src/jdk.compiler/share/data/symbols/java.base-N.sym.txt +++ b/src/jdk.compiler/share/data/symbols/java.base-N.sym.txt @@ -462,18 +462,6 @@ class name java/net/Socket method name descriptor (Ljava/lang/String;IZ)V thrownTypes java/io/IOException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="1.1") method name descriptor (Ljava/net/InetAddress;IZ)V thrownTypes java/io/IOException flags 1 deprecated true runtimeAnnotations @Ljava/lang/Deprecated;(forRemoval=Ztrue,since="1.1") -class name java/nio/HeapByteBuffer -method name hashCode descriptor ()I flags 1 - -class name java/nio/HeapByteBufferR -method name hashCode descriptor ()I flags 1 - -class name java/nio/HeapCharBuffer -method name hashCode descriptor ()I flags 1 - -class name java/nio/HeapCharBufferR -method name hashCode descriptor ()I flags 1 - class name java/security/Provider header extends java/util/Properties nestMembers java/security/Provider$Service flags 421 innerclass innerClass java/util/Map$Entry outerClass java/util/Map innerClassName Entry flags 609 From 780c5f827dff52a2f58f63b03448c2494e498eec Mon Sep 17 00:00:00 2001 From: "Daniel D. Daugherty" Date: Fri, 23 Aug 2024 22:04:43 +0000 Subject: [PATCH 10/11] 8338925: ProblemList runtime/interpreter/LastJsrTest.java on linux-all Reviewed-by: matsaave --- test/hotspot/jtreg/ProblemList.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 2414f3d090a..a991817f951 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -119,6 +119,7 @@ runtime/ErrorHandling/TestDwarf.java#checkDecoder 8305489 linux-all runtime/ErrorHandling/MachCodeFramesInErrorFile.java 8313315 linux-ppc64le runtime/Thread/TestAlwaysPreTouchStacks.java 8335167 macosx-aarch64 runtime/cds/appcds/customLoader/HelloCustom_JFR.java 8241075 linux-all,windows-x64 +runtime/interpreter/LastJsrTest.java 8338924 linux-all applications/jcstress/copy.java 8229852 linux-all From b1102e4c1611cca0e261c60522bc4a23c34a6bd8 Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Sat, 24 Aug 2024 00:05:30 +0000 Subject: [PATCH 11/11] 8338785: The java.awt.datatransfer.SystemFlavorMap#FLAVOR_MAP_KEY field is not used Reviewed-by: honkar, dnguyen, prr --- .../share/classes/java/awt/datatransfer/SystemFlavorMap.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/java.datatransfer/share/classes/java/awt/datatransfer/SystemFlavorMap.java b/src/java.datatransfer/share/classes/java/awt/datatransfer/SystemFlavorMap.java index d481465138b..6b2dc14c05f 100644 --- a/src/java.datatransfer/share/classes/java/awt/datatransfer/SystemFlavorMap.java +++ b/src/java.datatransfer/share/classes/java/awt/datatransfer/SystemFlavorMap.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, 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 @@ -61,8 +61,6 @@ public final class SystemFlavorMap implements FlavorMap, FlavorTable { */ private static String JavaMIME = "JAVA_DATAFLAVOR:"; - private static final Object FLAVOR_MAP_KEY = new Object(); - /** * The list of valid, decoded text flavor representation classes, in order * from best to worst.