-
CSR
-
Resolution: Approved
-
P4
-
None
-
source, binary, behavioral
-
low
-
-
Java API, System or security property, File or wire format
-
SE
Summary
Deprecate for removal java.awt.Window.getWarningString() and javax.swing.JInternalFrame.getWarningString() because disabling of the SecurityManager has made them obsolete. Supporting permissions and Serializable fields are removed immediately
Problem
java.awt.Window.getWarningString() was introduced to (1) provide the warning text to be displayed prominently alongside untrusted windows, alongside a warning icon, and (2) if non-null indicate the need to display warnings on a window.
Untrusted windows are those created by untrusted code, however after permanent disabling of the SecurityManager by JEP 486 [See https://bugs.openjdk.org/browse/JDK-8338411] no SecurityManager can be installed meaning the warning string and warning icons can never be displayed.
Historically the text of the String would be set as the value of the System Property "awt.appletWarning", but applets are also obsolete, and reference to this System Property was already removed by JEP 486 so the text of the String can not be set.
java.awt.Window stores the value in a field "private String warningString" which is part of the serialized form of java.awt.Window. That field is obsolete as a consequence of warning strings being obsolete.
A java.awt.AWTPermission : "showWindowWithoutWarningBanner" could be used to indicate to a SecurityManager that the window should be trusted. This Permission is also obsolete since all SM related checks are no-ops. Public documentation of it was already removed by JEP 486
javax.swing.JInternalFrame.getWarningString() has never been used to display warning strings, and existed only for symmetry with java.awt.Window.getWarningString() so it is no longer serving any purpose - it should be deprecated alongside java.awt.Window.getWarningString()
Solution
The methods java.awt.Window.getWarningString() and javax.swing.JInternalFrame.getWarningString() will be deprecated for removal. And will always return null.
The serializable field warningString on java.awt.Window is obsolete and removed from the specification
The use of the System property "awt.appletWarning" was already removed from the specification by JEP 486
The AWTPermission : "showWindowWithoutWarningBanner" is obsolete and checks based on it are removed. Public documentation was already removed by JEP 486
Specification
java.awt.Window : /** * Gets the warning string that is displayed with this window. ** Warning strings are no longer applicable, - * so this method always returns {@code null}. + * so this method always returns {@code null} and may be + * removed in a future release. * @return null + * @deprecated since JDK 24 */ + @Deprecated(since="24", forRemoval=true) public final String getWarningString() { - return warningString; + return null; } - /** - * This represents the warning message that is - * to be displayed in a non secure window. ie : - * a window that has a security manager installed that denies - * {@code AWTPermission("showWindowWithoutWarningBanner")}. - * This message can be displayed anywhere in the window. - * - * @serial - * @see #getWarningString - */ - String warningString; Remove all code that follows this protocol :- - * If there is a security manager, then it is invoked to check - * {@code AWTPermission("showWindowWithoutWarningBanner")} - * to determine whether or not the window must be displayed with - * a warning banner. javax.swing.JInternalFrame /** * Gets the warning string that is displayed with this internal frame. - * Since an internal frame is always secure (since it's fully - * contained within a window that might need a warning string) - * this method always returns
null
. + * This method always returnsnull
. + * Warning strings are no longer applicable, even to top-level + * windows, so this method may be removed in a future release * @returnnull
* @see java.awt.Window#getWarningString + * @deprecated since JDK 24 */ + @Deprecated(since="24", forRemoval=true) @BeanProperty(bound = false) public final String getWarningString() { return null; }
- csr of
-
JDK-8342903 Deprecate for removal java.awt.Window.getWarningString()
-
- Resolved
-