--- old/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java 2018-10-01 10:01:11.978026000 +0700 +++ new/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicPopupMenuUI.java 2018-10-01 10:01:11.502026000 +0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2018, 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 @@ -327,7 +327,7 @@ if (subitem != null) { lst.add(subitem); } - MenuElement newPath[] = new MenuElement[0]; + MenuElement[] newPath = new MenuElement[0]; newPath = lst.toArray(newPath); MenuSelectionManager.defaultManager().setSelectedPath(newPath); e.consume(); @@ -344,12 +344,12 @@ } MenuSelectionManager manager = e.getMenuSelectionManager(); - MenuElement path[] = e.getPath(); - MenuElement items[] = popupMenu.getSubElements(); + MenuElement[] path = e.getPath(); + MenuElement[] items = popupMenu.getSubElements(); int currentIndex = -1; int matches = 0; int firstMatch = -1; - int indexes[] = null; + int[] indexes = null; for (int j = 0; j < items.length; j++) { if (! (items[j] instanceof JMenuItem)) { @@ -397,7 +397,7 @@ newItem = items[indexes[(currentIndex + 1) % matches]]; - MenuElement newPath[] = new MenuElement[path.length+1]; + MenuElement[] newPath = new MenuElement[path.length+1]; System.arraycopy(path, 0, newPath, 0, path.length); newPath[path.length] = newItem; manager.setSelectedPath(newPath); @@ -470,12 +470,12 @@ } MenuSelectionManager msm = MenuSelectionManager.defaultManager(); - MenuElement path[] = msm.getSelectedPath(); + MenuElement[] path = msm.getSelectedPath(); MenuElement lastElement; if(path.length > 0) { lastElement = path[path.length-1]; if(lastElement instanceof JMenu) { - MenuElement newPath[] = new MenuElement[path.length+1]; + MenuElement[] newPath = new MenuElement[path.length+1]; System.arraycopy(path,0,newPath,0,path.length); newPath[path.length] = ((JMenu)lastElement).getPopupMenu(); msm.setSelectedPath(newPath); @@ -494,7 +494,7 @@ } private void selectParentChild(boolean direction) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); - MenuElement path[] = msm.getSelectedPath(); + MenuElement[] path = msm.getSelectedPath(); int len = path.length; if (direction == PARENT) { @@ -510,7 +510,7 @@ !((JMenu)path[popupIndex-1]).isTopLevelMenu()) { // we have a submenu, just close it - MenuElement newPath[] = new MenuElement[popupIndex]; + MenuElement[] newPath = new MenuElement[popupIndex]; System.arraycopy(path, 0, newPath, 0, popupIndex); msm.setSelectedPath(newPath); return; @@ -548,7 +548,7 @@ path[0].getSubElements(), currentMenu, direction); if (nextMenu != null && nextMenu != currentMenu) { - MenuElement newSelection[]; + MenuElement[] newSelection; if (len == 2) { // menu is selected but its popup not shown newSelection = new MenuElement[2]; @@ -568,7 +568,7 @@ private void selectItem(boolean direction) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); - MenuElement path[] = msm.getSelectedPath(); + MenuElement[] path = msm.getSelectedPath(); if (path.length == 0) { return; } @@ -638,7 +638,7 @@ } else { // just select the next item, no path expansion needed - MenuElement subs[] = path[len-2].getSubElements(); + MenuElement[] subs = path[len-2].getSubElements(); MenuElement nextChild = findEnabledChild(subs, path[len-1], direction); if (nextChild == null) { @@ -668,7 +668,7 @@ } private void shortenSelectedPath() { - MenuElement path[] = MenuSelectionManager.defaultManager().getSelectedPath(); + MenuElement[] path = MenuSelectionManager.defaultManager().getSelectedPath(); if (path.length <= 2) { MenuSelectionManager.defaultManager().clearSelectedPath(); return; @@ -695,13 +695,13 @@ // clear selection for the topLevelMenu value = path.length; } - MenuElement newPath[] = new MenuElement[path.length - value]; + MenuElement[] newPath = new MenuElement[path.length - value]; System.arraycopy(path, 0, newPath, 0, path.length - value); MenuSelectionManager.defaultManager().setSelectedPath(newPath); } } - private static MenuElement nextEnabledChild(MenuElement e[], + private static MenuElement nextEnabledChild(MenuElement[] e, int fromIndex, int toIndex) { for (int i=fromIndex; i<=toIndex; i++) { if (e[i] != null) { @@ -716,7 +716,7 @@ return null; } - private static MenuElement previousEnabledChild(MenuElement e[], + private static MenuElement previousEnabledChild(MenuElement[] e, int fromIndex, int toIndex) { for (int i=fromIndex; i>=toIndex; i--) { if (e[i] != null) { @@ -731,7 +731,7 @@ return null; } - static MenuElement findEnabledChild(MenuElement e[], int fromIndex, + static MenuElement findEnabledChild(MenuElement[] e, int fromIndex, boolean forward) { MenuElement result; if (forward) { @@ -745,7 +745,7 @@ return result; } - static MenuElement findEnabledChild(MenuElement e[], + static MenuElement findEnabledChild(MenuElement[] e, MenuElement elem, boolean forward) { for (int i=0; i