Skip to content

Commit 16a81e8

Browse files
authored
Fix some nullable types in JOptionPane. (#135)
Mostly, this means fixing the syntax for nullable arras for `options` and `selectionValues`. It also includes adding `@Nullable` to `Icon icon` in one overload of `showInternalOptionDialog`.
1 parent d053f21 commit 16a81e8

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/java.desktop/share/classes/javax/swing/JOptionPane.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ public class JOptionPane extends JComponent implements Accessible
407407
/** Message to display. */
408408
protected transient @Nullable Object message;
409409
/** Options to display to the user. */
410-
protected transient @Nullable Object[] options;
410+
protected transient Object @Nullable [] options;
411411
/** Value that should be initially selected in <code>options</code>. */
412412
protected transient @Nullable Object initialValue;
413413
/** Message type. */
@@ -424,7 +424,7 @@ public class JOptionPane extends JComponent implements Accessible
424424
protected transient @Nullable Object value;
425425
/** Array of values the user can choose from. Look and feel will
426426
* provide the UI component to choose this from. */
427-
protected transient @Nullable Object[] selectionValues;
427+
protected transient Object @Nullable [] selectionValues;
428428
/** Value the user has input. */
429429
protected transient @Nullable Object inputValue;
430430
/** Initial value to select in <code>selectionValues</code>. */
@@ -578,7 +578,7 @@ public static String showInputDialog(@Nullable Component parentComponent,
578578
@SuppressWarnings("deprecation")
579579
public static Object showInputDialog(@Nullable Component parentComponent,
580580
@Nullable Object message, @Nullable String title, int messageType, @Nullable Icon icon,
581-
@Nullable Object[] selectionValues, @Nullable Object initialSelectionValue)
581+
Object @Nullable [] selectionValues, @Nullable Object initialSelectionValue)
582582
throws HeadlessException {
583583
JOptionPane pane = new JOptionPane(message, messageType,
584584
OK_CANCEL_OPTION, icon,
@@ -868,7 +868,7 @@ public static int showConfirmDialog(@Nullable Component parentComponent,
868868
@SuppressWarnings("deprecation")
869869
public static int showOptionDialog(@Nullable Component parentComponent,
870870
@Nullable Object message, @Nullable String title, int optionType, int messageType,
871-
@Nullable Icon icon, @Nullable Object[] options, @Nullable Object initialValue)
871+
@Nullable Icon icon, Object @Nullable [] options, @Nullable Object initialValue)
872872
throws HeadlessException {
873873
JOptionPane pane = new JOptionPane(message, messageType,
874874
optionType, icon,
@@ -1302,8 +1302,8 @@ private static boolean checkFrameForComponent(@Nullable Component parentComponen
13021302
public static int showInternalOptionDialog(@Nullable Component parentComponent,
13031303
@Nullable Object message,
13041304
@Nullable String title, int optionType,
1305-
int messageType, Icon icon,
1306-
@Nullable Object[] options, @Nullable Object initialValue) {
1305+
int messageType, @Nullable Icon icon,
1306+
Object @Nullable [] options, @Nullable Object initialValue) {
13071307
JOptionPane pane = new JOptionPane(message, messageType,
13081308
optionType, icon, options, initialValue);
13091309
pane.putClientProperty(PopupFactory_FORCE_HEAVYWEIGHT_POPUP,
@@ -1440,7 +1440,7 @@ public static String showInternalInputDialog(@Nullable Component parentComponent
14401440
*/
14411441
public static Object showInternalInputDialog(@Nullable Component parentComponent,
14421442
@Nullable Object message, @Nullable String title, int messageType, @Nullable Icon icon,
1443-
@Nullable Object[] selectionValues, @Nullable Object initialSelectionValue) {
1443+
Object @Nullable [] selectionValues, @Nullable Object initialSelectionValue) {
14441444
JOptionPane pane = new JOptionPane(message, messageType,
14451445
OK_CANCEL_OPTION, icon, null, null);
14461446
pane.putClientProperty(PopupFactory_FORCE_HEAVYWEIGHT_POPUP,
@@ -1805,7 +1805,7 @@ public JOptionPane(@Nullable Object message, int messageType, int optionType,
18051805
* @param options the choices the user can select
18061806
*/
18071807
public JOptionPane(@Nullable Object message, int messageType, int optionType,
1808-
@Nullable Icon icon, @Nullable Object[] options) {
1808+
@Nullable Icon icon, Object @Nullable [] options) {
18091809
this(message, messageType, optionType, icon, options, null);
18101810
}
18111811

@@ -1833,7 +1833,7 @@ public JOptionPane(@Nullable Object message, int messageType, int optionType,
18331833
* only meaningful if <code>options</code> is used
18341834
*/
18351835
public JOptionPane(@Nullable Object message, int messageType, int optionType,
1836-
@Nullable Icon icon, @Nullable Object[] options, @Nullable Object initialValue) {
1836+
@Nullable Icon icon, Object @Nullable [] options, @Nullable Object initialValue) {
18371837

18381838
this.message = message;
18391839
this.options = options == null ? null : Arrays.copyOf(options, options.length);
@@ -1993,7 +1993,7 @@ public void setValue(@Nullable Object newValue) {
19931993
*/
19941994
@BeanProperty(description
19951995
= "The option pane's options objects.")
1996-
public void setOptions(@Nullable Object[] newOptions) {
1996+
public void setOptions(Object @Nullable [] newOptions) {
19971997
Object[] oldOptions = options;
19981998

19991999
options = newOptions == null
@@ -2008,7 +2008,7 @@ public void setOptions(@Nullable Object[] newOptions) {
20082008
*
20092009
* @see #setOptions
20102010
*/
2011-
public @Nullable Object[] getOptions() {
2011+
public Object @Nullable [] getOptions() {
20122012
return options == null ? null : Arrays.copyOf(options, options.length);
20132013
}
20142014

@@ -2155,7 +2155,7 @@ public int getOptionType() {
21552155
*/
21562156
@BeanProperty(description
21572157
= "The option pane's selection values.")
2158-
public void setSelectionValues(@Nullable Object[] newValues) {
2158+
public void setSelectionValues(Object @Nullable [] newValues) {
21592159
Object[] oldValues = selectionValues;
21602160

21612161
selectionValues = newValues == null
@@ -2172,7 +2172,7 @@ public void setSelectionValues(@Nullable Object[] newValues) {
21722172
* @return the array of <code>Objects</code> the user can select
21732173
* @see #setSelectionValues
21742174
*/
2175-
public @Nullable Object[] getSelectionValues() {
2175+
public Object @Nullable [] getSelectionValues() {
21762176
return selectionValues == null
21772177
? null
21782178
: Arrays.copyOf(selectionValues, selectionValues.length);

0 commit comments

Comments
 (0)