mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8344943: Mark not subclassable classes final in java.base exported classes
Reviewed-by: weijun, liach, djelinski
This commit is contained in:
parent
76f792b552
commit
8e8f800071
22 changed files with 44 additions and 47 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -44,7 +44,7 @@ package java.io;
|
|||
*
|
||||
* @since 1.1
|
||||
*/
|
||||
public class OptionalDataException extends ObjectStreamException {
|
||||
public final class OptionalDataException extends ObjectStreamException {
|
||||
|
||||
@java.io.Serial
|
||||
private static final long serialVersionUID = -8011121865681257820L;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -113,7 +113,7 @@ import jdk.internal.reflect.Reflection;
|
|||
*
|
||||
* @since 1.2
|
||||
*/
|
||||
public class Package extends NamedPackage implements java.lang.reflect.AnnotatedElement {
|
||||
public final class Package extends NamedPackage implements java.lang.reflect.AnnotatedElement {
|
||||
/**
|
||||
* Return the name of this package.
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2019, Azul Systems, Inc. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
|
@ -120,7 +120,7 @@ import jdk.internal.reflect.Reflection;
|
|||
* @since 1.0
|
||||
*/
|
||||
|
||||
public class Runtime {
|
||||
public final class Runtime {
|
||||
private static final Runtime currentRuntime = new Runtime();
|
||||
|
||||
private static Version version;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -41,12 +41,12 @@ import static jdk.internal.constant.ConstantUtils.validateMemberName;
|
|||
* A <a href="package-summary.html#nominal">nominal descriptor</a> for an
|
||||
* {@code invokedynamic} call site.
|
||||
*
|
||||
* <p>Concrete subtypes of {@linkplain DynamicCallSiteDesc} should be immutable
|
||||
* and their behavior should not rely on object identity.
|
||||
* <p>A {@code DynamicCallSiteDesc} is immutable and its behavior does not
|
||||
* rely on object identity.
|
||||
*
|
||||
* @since 12
|
||||
*/
|
||||
public class DynamicCallSiteDesc {
|
||||
public final class DynamicCallSiteDesc {
|
||||
|
||||
private final DirectMethodHandleDesc bootstrapMethod;
|
||||
private final ConstantDesc[] bootstrapArgs;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -69,7 +69,7 @@ import static jdk.internal.constant.ConstantUtils.*;
|
|||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
public class MethodHandleProxies {
|
||||
public final class MethodHandleProxies {
|
||||
|
||||
private MethodHandleProxies() { } // do not instantiate
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -84,7 +84,7 @@ import static java.lang.invoke.MethodType.methodType;
|
|||
* @author John Rose, JSR 292 EG
|
||||
* @since 1.7
|
||||
*/
|
||||
public class MethodHandles {
|
||||
public final class MethodHandles {
|
||||
|
||||
private MethodHandles() { } // do not instantiate
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -91,7 +91,7 @@ import jdk.internal.module.ModuleInfo;
|
|||
* @since 9
|
||||
*/
|
||||
|
||||
public class ModuleDescriptor
|
||||
public final class ModuleDescriptor
|
||||
implements Comparable<ModuleDescriptor>
|
||||
{
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -52,7 +52,7 @@ import java.util.StringJoiner;
|
|||
* @author Kenneth Russell
|
||||
* @since 1.1
|
||||
*/
|
||||
public class Modifier {
|
||||
public final class Modifier {
|
||||
/**
|
||||
* Do not call.
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -48,7 +48,7 @@ import static java.util.Objects.requireNonNull;
|
|||
*
|
||||
* @since 16
|
||||
*/
|
||||
public class ObjectMethods {
|
||||
public final class ObjectMethods {
|
||||
|
||||
private ObjectMethods() { }
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -74,7 +74,7 @@ import sun.invoke.util.Wrapper;
|
|||
*
|
||||
* @since 21
|
||||
*/
|
||||
public class SwitchBootstraps {
|
||||
public final class SwitchBootstraps {
|
||||
|
||||
private SwitchBootstraps() {}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -36,7 +36,7 @@ import java.util.Objects;
|
|||
* @see java.net.NetworkInterface
|
||||
* @since 1.6
|
||||
*/
|
||||
public class InterfaceAddress {
|
||||
public final class InterfaceAddress {
|
||||
private InetAddress address = null;
|
||||
private Inet4Address broadcast = null;
|
||||
private short maskLength = 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -81,7 +81,7 @@ import java.util.Objects;
|
|||
* @since 1.2
|
||||
*/
|
||||
|
||||
public class URLDecoder {
|
||||
public final class URLDecoder {
|
||||
|
||||
/**
|
||||
* Do not call.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -84,7 +84,7 @@ import jdk.internal.util.ImmutableBitSetPredicate;
|
|||
* @author Herb Jellinek
|
||||
* @since 1.0
|
||||
*/
|
||||
public class URLEncoder {
|
||||
public final class URLEncoder {
|
||||
private static final IntPredicate DONT_NEED_ENCODING;
|
||||
|
||||
static {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -81,7 +81,7 @@ import java.util.Map;
|
|||
* @since 1.4
|
||||
*/
|
||||
|
||||
public class CoderResult {
|
||||
public final class CoderResult {
|
||||
|
||||
private static final int CR_UNDERFLOW = 0;
|
||||
private static final int CR_OVERFLOW = 1;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -40,7 +40,7 @@ package java.nio.charset;
|
|||
* @since 1.4
|
||||
*/
|
||||
|
||||
public class CodingErrorAction {
|
||||
public final class CodingErrorAction {
|
||||
|
||||
private String name;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -232,7 +232,7 @@ import java.util.Objects;
|
|||
*
|
||||
* @since 9
|
||||
*/
|
||||
public class DrbgParameters {
|
||||
public final class DrbgParameters {
|
||||
|
||||
private DrbgParameters() {
|
||||
// This class should not be instantiated
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -81,7 +81,7 @@ import jdk.internal.vm.annotation.IntrinsicCandidate;
|
|||
* @since 1.8
|
||||
*/
|
||||
|
||||
public class Base64 {
|
||||
public final class Base64 {
|
||||
|
||||
private Base64() {}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ import jdk.internal.access.SharedSecrets;
|
|||
* @since 1.2
|
||||
*/
|
||||
|
||||
public class Collections {
|
||||
public final class Collections {
|
||||
// Suppresses default constructor, ensuring non-instantiability.
|
||||
private Collections() {
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -33,7 +33,7 @@ package java.util;
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public class FormattableFlags {
|
||||
public final class FormattableFlags {
|
||||
|
||||
// Explicit instantiation of this class is prohibited.
|
||||
private FormattableFlags() {}
|
||||
|
|
|
@ -68,7 +68,7 @@ import jdk.internal.ref.CleanerFactory;
|
|||
* @since 1.5
|
||||
* @author Doug Lea
|
||||
*/
|
||||
public class Executors {
|
||||
public final class Executors {
|
||||
|
||||
/**
|
||||
* Creates a thread pool that reuses a fixed number of threads
|
||||
|
|
|
@ -139,7 +139,7 @@ import jdk.internal.misc.Unsafe;
|
|||
*
|
||||
* @since 1.5
|
||||
*/
|
||||
public class LockSupport {
|
||||
public final class LockSupport {
|
||||
private LockSupport() {} // Cannot be instantiated.
|
||||
|
||||
private static void setBlocker(Thread t, Object arg) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue