From e3d80f1e1e8b5d503f13b8037172e3dac29e27ad Mon Sep 17 00:00:00 2001 From: Artur Barashev Date: Tue, 24 Sep 2024 18:57:58 +0000 Subject: [PATCH] 8340670: Policy.UNSUPPORTED_EMPTY_COLLECTION.isReadOnly does not return true Reviewed-by: mullan --- .../share/classes/java/security/Policy.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/java.base/share/classes/java/security/Policy.java b/src/java.base/share/classes/java/security/Policy.java index 838366b7e38..37f7cc3d9a6 100644 --- a/src/java.base/share/classes/java/security/Policy.java +++ b/src/java.base/share/classes/java/security/Policy.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 @@ -896,5 +896,15 @@ public abstract class Policy { @Override public Enumeration elements() { return perms.elements(); } + + /** + * If this object is readonly, no new objects can be added to it using {@code add}. + * + * @return {@code true} if this object is marked as readonly, {@code false} otherwise. + */ + @Override + public boolean isReadOnly() { + return perms.isReadOnly(); + } } }