8211300: Convert C-style array declarations in JDK client code

Reviewed-by: prr, serb
This commit is contained in:
Tagir F. Valeev 2018-10-04 12:40:55 -07:00
parent c33f1a61de
commit fc807d0914
339 changed files with 1645 additions and 1645 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -87,7 +87,7 @@ public interface ImageOutputStream extends ImageInputStream, DataOutput {
* {@code null}.
* @exception IOException if an I/O error occurs.
*/
void write(byte b[]) throws IOException;
void write(byte[] b) throws IOException;
/**
* Writes a sequence of bytes to the stream at the current
@ -114,7 +114,7 @@ public interface ImageOutputStream extends ImageInputStream, DataOutput {
* {@code null}.
* @exception IOException if an I/O error occurs.
*/
void write(byte b[], int off, int len) throws IOException;
void write(byte[] b, int off, int len) throws IOException;
/**
* Writes a {@code boolean} value to the stream. If

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -47,11 +47,11 @@ public abstract class ImageOutputStreamImpl
public abstract void write(int b) throws IOException;
public void write(byte b[]) throws IOException {
public void write(byte[] b) throws IOException {
write(b, 0, b.length);
}
public abstract void write(byte b[], int off, int len) throws IOException;
public abstract void write(byte[] b, int off, int len) throws IOException;
public void writeBoolean(boolean v) throws IOException {
write(v ? 1 : 0);

View file

@ -853,7 +853,7 @@ public class MidiSystem {
allTypes.add(types[j]);
}
}
int resultTypes[] = new int[allTypes.size()];
int[] resultTypes = new int[allTypes.size()];
int index = 0;
Iterator<Integer> iterator = allTypes.iterator();
while (iterator.hasNext()) {
@ -908,7 +908,7 @@ public class MidiSystem {
allTypes.add(types[j]);
}
}
int resultTypes[] = new int[allTypes.size()];
int[] resultTypes = new int[allTypes.size()];
int index = 0;
Iterator<Integer> iterator = allTypes.iterator();
while (iterator.hasNext()) {

View file

@ -676,7 +676,7 @@ public class AudioSystem {
List<FormatConversionProvider> codecs = getFormatConversionProviders();
Vector<AudioFormat.Encoding> encodings = new Vector<>();
AudioFormat.Encoding encs[] = null;
AudioFormat.Encoding[] encs = null;
// gather from all the codecs
for(int i=0; i<codecs.size(); i++ ) {
@ -1084,7 +1084,7 @@ public class AudioSystem {
returnTypesSet.add(fileTypes[j]);
}
}
AudioFileFormat.Type returnTypes[] =
AudioFileFormat.Type[] returnTypes =
returnTypesSet.toArray(new AudioFileFormat.Type[0]);
return returnTypes;
}
@ -1133,7 +1133,7 @@ public class AudioSystem {
returnTypesSet.add(fileTypes[j]);
}
}
AudioFileFormat.Type returnTypes[] =
AudioFileFormat.Type[] returnTypes =
returnTypesSet.toArray(new AudioFileFormat.Type[0]);
return returnTypes;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, 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
@ -2605,7 +2605,7 @@ public abstract class AbstractButton extends JComponent implements ItemSelectabl
}
Rectangle2D.Float shape =
new Rectangle2D.Float(r.x, r.y, r.width, r.height);
Position.Bias bias[] = new Position.Bias[1];
Position.Bias[] bias = new Position.Bias[1];
return view.viewToModel(p.x, p.y, shape, bias);
} else {
return -1;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -58,7 +58,7 @@ class ArrayTable implements Cloneable {
* AbstractAction use to avoid having the same code in each class.
*/
static void writeArrayTable(ObjectOutputStream s, ArrayTable table) throws IOException {
Object keys[];
Object[] keys;
if (table == null || (keys = table.getKeys(null)) == null) {
s.writeInt(0);

View file

@ -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
@ -770,7 +770,7 @@ public class DebugGraphics extends Graphics {
/**
* Overrides <code>Graphics.drawPolyline</code>.
*/
public void drawPolyline(int xPoints[], int yPoints[], int nPoints) {
public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) {
DebugGraphicsInfo info = info();
if (debugLog()) {
@ -805,7 +805,7 @@ public class DebugGraphics extends Graphics {
/**
* Overrides <code>Graphics.drawPolygon</code>.
*/
public void drawPolygon(int xPoints[], int yPoints[], int nPoints) {
public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints) {
DebugGraphicsInfo info = info();
if (debugLog()) {
@ -840,7 +840,7 @@ public class DebugGraphics extends Graphics {
/**
* Overrides <code>Graphics.fillPolygon</code>.
*/
public void fillPolygon(int xPoints[], int yPoints[], int nPoints) {
public void fillPolygon(int[] xPoints, int[] yPoints, int nPoints) {
DebugGraphicsInfo info = info();
if (debugLog()) {
@ -945,7 +945,7 @@ public class DebugGraphics extends Graphics {
/**
* Overrides <code>Graphics.drawBytes</code>.
*/
public void drawBytes(byte data[], int offset, int length, int x, int y) {
public void drawBytes(byte[] data, int offset, int length, int x, int y) {
DebugGraphicsInfo info = info();
Font font = graphics.getFont();
@ -981,7 +981,7 @@ public class DebugGraphics extends Graphics {
/**
* Overrides <code>Graphics.drawChars</code>.
*/
public void drawChars(char data[], int offset, int length, int x, int y) {
public void drawChars(char[] data, int offset, int length, int x, int y) {
DebugGraphicsInfo info = info();
Font font = graphics.getFont();

View file

@ -55,7 +55,7 @@ public class DefaultComboBoxModel<E> extends AbstractListModel<E> implements Mut
*
* @param items an array of Object objects
*/
public DefaultComboBoxModel(final E items[]) {
public DefaultComboBoxModel(final E[] items) {
objects = new Vector<E>(items.length);
int i,c;

View file

@ -98,7 +98,7 @@ public class DefaultListModel<E> extends AbstractListModel<E>
* @param anArray the array into which the components get copied
* @see Vector#copyInto(Object[])
*/
public void copyInto(Object anArray[]) {
public void copyInto(Object[] anArray) {
delegate.copyInto(anArray);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, 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
@ -1305,7 +1305,7 @@ implements ItemSelectable,ListDataListener,ActionListener, Accessible {
if ( selectedObject == null )
return new Object[0];
else {
Object result[] = new Object[1];
Object[] result = new Object[1];
result[0] = selectedObject;
return result;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, 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
@ -3461,7 +3461,7 @@ public abstract class JComponent extends Container implements Serializable,
// This class is used by the KeyboardState class to provide a single
// instance that can be stored in the AppContext.
static final class IntVector {
int array[] = null;
int[] array = null;
int count = 0;
int capacity = 0;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, 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
@ -133,7 +133,7 @@ public class JDesktopPane extends JLayeredPane implements Accessible
setFocusTraversalPolicy(new LayoutFocusTraversalPolicy() {
public Component getDefaultComponent(Container c) {
JInternalFrame jifArray[] = getAllFrames();
JInternalFrame[] jifArray = getAllFrames();
Component comp = null;
for (JInternalFrame jif : jifArray) {
comp = jif.getFocusTraversalPolicy().getDefaultComponent(jif);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, 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
@ -1149,7 +1149,7 @@ public class JLabel extends JComponent implements SwingConstants, Accessible
}
Rectangle2D.Float shape =
new Rectangle2D.Float(r.x, r.y, r.width, r.height);
Position.Bias bias[] = new Position.Bias[1];
Position.Bias[] bias = new Position.Bias[1];
return view.viewToModel(p.x, p.y, shape, bias);
} else {
return -1;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, 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
@ -1202,7 +1202,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
if(popupMenu == null)
return new MenuElement[0];
else {
MenuElement result[] = new MenuElement[1];
MenuElement[] result = new MenuElement[1];
result[0] = popupMenu;
return result;
}
@ -1285,7 +1285,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
* button was pressed for
*/
public void doClick(int pressTime) {
MenuElement me[] = buildMenuElementArray(this);
MenuElement[] me = buildMenuElementArray(this);
MenuSelectionManager.defaultManager().setSelectedPath(me);
}
@ -1319,7 +1319,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
break;
}
}
MenuElement me[] = new MenuElement[elements.size()];
MenuElement[] me = new MenuElement[elements.size()];
elements.copyInto(me);
return me;
}
@ -1471,7 +1471,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
* @return 1 if a menu is currently selected, else 0
*/
public int getAccessibleSelectionCount() {
MenuElement me[] =
MenuElement[] me =
MenuSelectionManager.defaultManager().getSelectedPath();
if (me != null) {
for (int i = 0; i < me.length; i++) {
@ -1496,7 +1496,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
if (i < 0 || i >= getItemCount()) {
return null;
}
MenuElement me[] =
MenuElement[] me =
MenuSelectionManager.defaultManager().getSelectedPath();
if (me != null) {
for (int j = 0; j < me.length; j++) {
@ -1524,7 +1524,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
*/
public boolean isAccessibleChildSelected(int i) {
// if i is a sub-menu and is pop-ed up, return true, else false
MenuElement me[] =
MenuElement[] me =
MenuSelectionManager.defaultManager().getSelectedPath();
if (me != null) {
JMenuItem mi = JMenu.this.getItem(i);
@ -1556,7 +1556,7 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
JMenuItem mi = getItem(i);
if (mi != null) {
if (mi instanceof JMenu) {
MenuElement me[] = buildMenuElementArray((JMenu) mi);
MenuElement[] me = buildMenuElementArray((JMenu) mi);
MenuSelectionManager.defaultManager().setSelectedPath(me);
} else {
MenuSelectionManager.defaultManager().setSelectedPath(null);
@ -1578,9 +1578,9 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
JMenuItem mi = getItem(i);
if (mi != null && mi instanceof JMenu) {
if (mi.isSelected()) {
MenuElement old[] =
MenuElement[] old =
MenuSelectionManager.defaultManager().getSelectedPath();
MenuElement me[] = new MenuElement[old.length-2];
MenuElement[] me = new MenuElement[old.length-2];
for (int j = 0; j < old.length -2; j++) {
me[j] = old[j];
}
@ -1596,12 +1596,12 @@ public class JMenu extends JMenuItem implements Accessible,MenuElement
public void clearAccessibleSelection() {
// if this menu is selected, reset selection to only go
// to this menu; else do nothing
MenuElement old[] =
MenuElement[] old =
MenuSelectionManager.defaultManager().getSelectedPath();
if (old != null) {
for (int j = 0; j < old.length; j++) {
if (old[j] == JMenu.this) { // menu is in the selection!
MenuElement me[] = new MenuElement[j+1];
MenuElement[] me = new MenuElement[j+1];
System.arraycopy(old, 0, me, 0, j);
me[j] = JMenu.this.getPopupMenu();
MenuSelectionManager.defaultManager().setSelectedPath(me);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, 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
@ -391,7 +391,7 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement
*
* @see #getSubElements
*/
public void processMouseEvent(MouseEvent event,MenuElement path[],MenuSelectionManager manager) {
public void processMouseEvent(MouseEvent event,MenuElement[] path,MenuSelectionManager manager) {
}
/**
@ -399,7 +399,7 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement
*
* @see #getSubElements
*/
public void processKeyEvent(KeyEvent e,MenuElement path[],MenuSelectionManager manager) {
public void processKeyEvent(KeyEvent e,MenuElement[] path,MenuSelectionManager manager) {
}
/**
@ -420,7 +420,7 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement
*/
@BeanProperty(bound = false)
public MenuElement[] getSubElements() {
MenuElement result[];
MenuElement[] result;
Vector<MenuElement> tmp = new Vector<MenuElement>();
int c = getComponentCount();
int i;
@ -610,7 +610,7 @@ public class JMenuBar extends JComponent implements Accessible,MenuElement
getSelectionModel().setSelectedIndex(i);
JMenu menu = getMenu(i);
if (menu != null) {
MenuElement me[] = new MenuElement[3];
MenuElement[] me = new MenuElement[3];
me[0] = JMenuBar.this;
me[1] = menu;
me[2] = menu.getPopupMenu();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, 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
@ -413,7 +413,7 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement
* @param manager the <code>MenuSelectionManager</code>
*/
@SuppressWarnings("deprecation")
public void processMouseEvent(MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
public void processMouseEvent(MouseEvent e,MenuElement[] path,MenuSelectionManager manager) {
processMenuDragMouseEvent(
new MenuDragMouseEvent(e.getComponent(), e.getID(),
e.getWhen(),
@ -437,7 +437,7 @@ public class JMenuItem extends AbstractButton implements Accessible,MenuElement
* @param manager the <code>MenuSelectionManager</code>
*/
@SuppressWarnings("deprecation")
public void processKeyEvent(KeyEvent e,MenuElement path[],MenuSelectionManager manager) {
public void processKeyEvent(KeyEvent e,MenuElement[] path,MenuSelectionManager manager) {
if (DEBUG) {
System.out.println("in JMenuItem.processKeyEvent/3 for " + getText() +
" " + KeyStroke.getKeyStrokeForEvent(e));

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, 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
@ -471,7 +471,7 @@ public class JPasswordField extends JTextField {
} else {
// Treat the text displayed in the JPasswordField
// as one word and sentence.
char password[] = getPassword();
char[] password = getPassword();
if (password == null ||
index < 0 || index >= password.length) {
return null;
@ -582,7 +582,7 @@ public class JPasswordField extends JTextField {
} else {
// Treat the text displayed in the JPasswordField
// as one word, sentence, line and attribute run
char password[] = getPassword();
char[] password = getPassword();
if (password == null ||
index < 0 || index >= password.length) {
return null;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, 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
@ -774,7 +774,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
// This is a popup menu with MenuElement children,
// set selection path before popping up!
if (isPopupMenu()) {
MenuElement me[] = new MenuElement[1];
MenuElement[] me = new MenuElement[1];
me[0] = this;
MenuSelectionManager.defaultManager().setSelectedPath(me);
}
@ -1371,7 +1371,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
* <code>MenuElement</code> interface, but it not implemented.
* @see MenuElement#processMouseEvent(MouseEvent, MenuElement[], MenuSelectionManager)
*/
public void processMouseEvent(MouseEvent event,MenuElement path[],MenuSelectionManager manager) {}
public void processMouseEvent(MouseEvent event,MenuElement[] path,MenuSelectionManager manager) {}
/**
* Processes a key event forwarded from the
@ -1386,7 +1386,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
* @param manager the <code>MenuSelectionManager</code>
*/
@SuppressWarnings("deprecation")
public void processKeyEvent(KeyEvent e, MenuElement path[],
public void processKeyEvent(KeyEvent e, MenuElement[] path,
MenuSelectionManager manager) {
MenuKeyEvent mke = new MenuKeyEvent(e.getComponent(), e.getID(),
e.getWhen(), e.getModifiers(),
@ -1504,7 +1504,7 @@ public class JPopupMenu extends JComponent implements Accessible,MenuElement {
*/
@BeanProperty(bound = false)
public MenuElement[] getSubElements() {
MenuElement result[];
MenuElement[] result;
Vector<MenuElement> tmp = new Vector<MenuElement>();
int c = getComponentCount();
int i;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, 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
@ -1000,7 +1000,7 @@ public class JTabbedPane extends JComponent
// container's children array indices, so make sure we
// remove the correct child!
if (component != null) {
Component components[] = getComponents();
Component[] components = getComponents();
for (int i = components.length; --i >= 0; ) {
if (components[i] == component) {
super.remove(i);
@ -1034,7 +1034,7 @@ public class JTabbedPane extends JComponent
} else {
// Container#remove(comp) invokes Container#remove(int)
// so make sure JTabbedPane#remove(int) isn't called here
Component children[] = getComponents();
Component[] children = getComponents();
for (int i=0; i < children.length; i++) {
if (component == children[i]) {
super.remove(i);
@ -1548,7 +1548,7 @@ public class JTabbedPane extends JComponent
// why not if (page.component.getParent() == this) remove(component)
synchronized(getTreeLock()) {
int count = getComponentCount();
Component children[] = getComponents();
Component[] children = getComponents();
for (int i = 0; i < count; i++) {
if (children[i] == page.component) {
super.remove(i);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, 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
@ -7217,8 +7217,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
int rowsSel = JTable.this.getSelectedRowCount();
int colsSel = JTable.this.getSelectedColumnCount();
int rowIndicies[] = getSelectedRows();
int colIndicies[] = getSelectedColumns();
int[] rowIndicies = getSelectedRows();
int[] colIndicies = getSelectedColumns();
int ttlCols = JTable.this.getColumnCount();
int ttlRows = JTable.this.getRowCount();
int r;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, 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
@ -1809,7 +1809,7 @@ public class JViewport extends JComponent implements Accessible
if(lastParent != null && parent instanceof JComponent &&
!((JComponent)parent).isOptimizedDrawingEnabled()) {
Component comps[] = parent.getComponents();
Component[] comps = parent.getComponents();
int index = 0;
for(int i = comps.length - 1 ;i >= 0; i--) {

View file

@ -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
@ -53,7 +53,7 @@ public interface MenuElement {
* @param path the path of the receiving element in the menu hierarchy
* @param manager the {@code MenuSelectionManager} for the menu hierarchy
*/
public void processMouseEvent(MouseEvent event, MenuElement path[], MenuSelectionManager manager);
public void processMouseEvent(MouseEvent event, MenuElement[] path, MenuSelectionManager manager);
/**
@ -63,7 +63,7 @@ public interface MenuElement {
* @param path the path of the receiving element in the menu hierarchy
* @param manager the {@code MenuSelectionManager} for the menu hierarchy
*/
public void processKeyEvent(KeyEvent event, MenuElement path[], MenuSelectionManager manager);
public void processKeyEvent(KeyEvent event, MenuElement[] path, MenuSelectionManager manager);
/**
* Call by the {@code MenuSelectionManager} when the {@code MenuElement} is

View file

@ -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
@ -139,7 +139,7 @@ public class MenuSelectionManager {
* @return an array of MenuElement objects representing the selected path
*/
public MenuElement[] getSelectedPath() {
MenuElement res[] = new MenuElement[selection.size()];
MenuElement[] res = new MenuElement[selection.size()];
int i,c;
for(i=0,c=selection.size();i<c;i++)
res[i] = selection.elementAt(i);
@ -223,8 +223,8 @@ public class MenuSelectionManager {
Rectangle r2;
int cWidth,cHeight;
MenuElement menuElement;
MenuElement subElements[];
MenuElement path[];
MenuElement[] subElements;
MenuElement[] path;
int selectionSize;
p = event.getPoint();
@ -292,7 +292,7 @@ public class MenuSelectionManager {
path[k] = tmp.elementAt(k);
}
path[i+1] = subElements[j];
MenuElement currentSelection[] = getSelectedPath();
MenuElement[] currentSelection = getSelectedPath();
// Enter/exit detection -- needs tuning...
if (currentSelection[currentSelection.length-1] !=
@ -347,11 +347,11 @@ public class MenuSelectionManager {
}
}
private void printMenuElementArray(MenuElement path[]) {
private void printMenuElementArray(MenuElement[] path) {
printMenuElementArray(path, false);
}
private void printMenuElementArray(MenuElement path[], boolean dumpStack) {
private void printMenuElementArray(MenuElement[] path, boolean dumpStack) {
System.out.println("Path is(");
int i, j;
for(i=0,j=path.length; i<j ;i++){
@ -396,7 +396,7 @@ public class MenuSelectionManager {
Rectangle r2;
int cWidth,cHeight;
MenuElement menuElement;
MenuElement subElements[];
MenuElement[] subElements;
int selectionSize;
SwingUtilities.convertPointToScreen(p,source);
@ -504,7 +504,7 @@ public class MenuSelectionManager {
}
private boolean isComponentPartOfCurrentMenu(MenuElement root,Component c) {
MenuElement children[];
MenuElement[] children;
int i,d;
if (root == null)

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -367,7 +367,7 @@ public class PopupFactory {
if(contents != null && contents.isFocusable()) {
if(contents instanceof JPopupMenu) {
JPopupMenu jpm = (JPopupMenu) contents;
Component popComps[] = jpm.getComponents();
Component[] popComps = jpm.getComponents();
for (Component popComp : popComps) {
if (!(popComp instanceof MenuElement) &&
!(popComp instanceof JSeparator)) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, 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
@ -124,7 +124,7 @@ public class ProgressMonitorInputStream extends FilterInputStream
* Overrides <code>FilterInputStream.read</code>
* to update the progress monitor after the read.
*/
public int read(byte b[]) throws IOException {
public int read(byte[] b) throws IOException {
int nr = in.read(b);
if (nr > 0) monitor.setProgress(nread += nr);
if (monitor.isCanceled()) {
@ -141,7 +141,7 @@ public class ProgressMonitorInputStream extends FilterInputStream
* Overrides <code>FilterInputStream.read</code>
* to update the progress monitor after the read.
*/
public int read(byte b[],
public int read(byte[] b,
int off,
int len) throws IOException {
int nr = in.read(b, off, len);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 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
@ -122,7 +122,7 @@ package javax.swing;
public class SizeSequence {
private static int[] emptyArray = new int[0];
private int a[];
private int[] a;
/**
* Creates a new <code>SizeSequence</code> object
@ -360,7 +360,7 @@ public class SizeSequence {
* (<code>0 &lt;= start &lt; (getSizes().length)) AND (length &gt;= 0)</code>
*/
public void insertEntries(int start, int length, int value) {
int sizes[] = getSizes();
int[] sizes = getSizes();
int end = start + length;
int n = a.length + length;
a = new int[n];
@ -390,7 +390,7 @@ public class SizeSequence {
* @param length the number of entries to be removed
*/
public void removeEntries(int start, int length) {
int sizes[] = getSizes();
int[] sizes = getSizes();
int end = start + length;
int n = a.length - length;
a = new int[n];

View file

@ -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
@ -310,7 +310,7 @@ public class SwingUtilities implements SwingConstants
return null;
}
if (parent instanceof Container) {
Component components[] = ((Container)parent).getComponents();
Component[] components = ((Container)parent).getComponents();
for (Component comp : components) {
if (comp != null && comp.isVisible()) {
Point loc = comp.getLocation();
@ -606,7 +606,7 @@ public class SwingUtilities implements SwingConstants
Rectangle t = new Rectangle();
Rectangle a=null,b=null,c=null,d=null;
Rectangle result[];
Rectangle[] result;
int rectCount = 0;
/* rectA contains rectB */

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2016, 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
@ -230,7 +230,7 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
// Point(20000, 20000))
private GraphicsConfiguration getDrawingGC(Point toFind) {
GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice devices[] = env.getScreenDevices();
GraphicsDevice[] devices = env.getScreenDevices();
for (GraphicsDevice device : devices) {
GraphicsConfiguration config = device.getDefaultConfiguration();
Rectangle rect = config.getBounds();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -1067,7 +1067,7 @@ public class TransferHandler implements Serializable {
} catch (IntrospectionException ex) {
return null;
}
PropertyDescriptor props[] = bi.getPropertyDescriptors();
PropertyDescriptor[] props = bi.getPropertyDescriptors();
for (int i=0; i < props.length; i++) {
if (propertyName.equals(props[i].getName())) {
Method reader = props[i].getReadMethod();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -49,7 +49,7 @@ import java.awt.Component;
*/
@SuppressWarnings("serial")
public class MenuDragMouseEvent extends MouseEvent {
private MenuElement path[];
private MenuElement[] path;
private MenuSelectionManager manager;
/**
@ -78,7 +78,7 @@ public class MenuDragMouseEvent extends MouseEvent {
*/
public MenuDragMouseEvent(Component source, int id, long when,
int modifiers, int x, int y, int clickCount,
boolean popupTrigger, MenuElement p[],
boolean popupTrigger, MenuElement[] p,
MenuSelectionManager m) {
super(source, id, when, modifiers, x, y, clickCount, popupTrigger);
path = p;
@ -117,7 +117,7 @@ public class MenuDragMouseEvent extends MouseEvent {
public MenuDragMouseEvent(Component source, int id, long when,
int modifiers, int x, int y, int xAbs,
int yAbs, int clickCount,
boolean popupTrigger, MenuElement p[],
boolean popupTrigger, MenuElement[] p,
MenuSelectionManager m) {
super(source, id, when, modifiers, x, y, xAbs, yAbs, clickCount,
popupTrigger, MouseEvent.NOBUTTON);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -49,7 +49,7 @@ import java.awt.Component;
*/
@SuppressWarnings("serial")
public class MenuKeyEvent extends KeyEvent {
private MenuElement path[];
private MenuElement[] path;
private MenuSelectionManager manager;
/**
@ -71,7 +71,7 @@ public class MenuKeyEvent extends KeyEvent {
*/
public MenuKeyEvent(Component source, int id, long when, int modifiers,
int keyCode, char keyChar,
MenuElement p[], MenuSelectionManager m) {
MenuElement[] p, MenuSelectionManager m) {
super(source, id, when, modifiers, keyCode, keyChar);
path = p;
manager = m;

View file

@ -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
@ -61,7 +61,7 @@ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI {
* @param path an array of {@code MenuElement}
* @param manager an instance of {@code MenuSelectionManager}
*/
public void processMouseEvent(JMenuItem item,MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
public void processMouseEvent(JMenuItem item,MouseEvent e,MenuElement[] path,MenuSelectionManager manager) {
Point p = e.getPoint();
if(p.x >= 0 && p.x < item.getWidth() &&
p.y >= 0 && p.y < item.getHeight()) {
@ -71,7 +71,7 @@ public class BasicCheckBoxMenuItemUI extends BasicMenuItemUI {
} else
manager.setSelectedPath(path);
} else if(item.getModel().isArmed()) {
MenuElement newPath[] = new MenuElement[path.length-1];
MenuElement[] newPath = new MenuElement[path.length-1];
int i,c;
for(i=0,c=path.length-1;i<c;i++)
newPath[i] = path[i];

View file

@ -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
@ -269,8 +269,8 @@ public class BasicMenuBarUI extends MenuBarUI {
// TAKE_FOCUS
JMenuBar menuBar = (JMenuBar)e.getSource();
MenuSelectionManager defaultManager = MenuSelectionManager.defaultManager();
MenuElement me[];
MenuElement subElements[];
MenuElement[] me;
MenuElement[] subElements;
JMenu menu = menuBar.getMenu(0);
if (menu!=null) {
me = new MenuElement[3];

View file

@ -868,8 +868,8 @@ public class BasicMenuItemUI extends MenuItemUI
*/
public MenuElement[] getPath() {
MenuSelectionManager m = MenuSelectionManager.defaultManager();
MenuElement oldPath[] = m.getSelectedPath();
MenuElement newPath[];
MenuElement[] oldPath = m.getSelectedPath();
MenuElement[] newPath;
int i = oldPath.length;
if (i == 0)
return new MenuElement[0];
@ -905,7 +905,7 @@ public class BasicMenuItemUI extends MenuItemUI
return newPath;
}
void printMenuElementArray(MenuElement path[], boolean dumpStack) {
void printMenuElementArray(MenuElement[] path, boolean dumpStack) {
System.out.println("Path is(");
int i, j;
for(i=0,j=path.length; i<j ;i++){
@ -1089,9 +1089,9 @@ public class BasicMenuItemUI extends MenuItemUI
MenuSelectionManager.defaultManager().processMouseEvent(e);
} else {
MenuElement path[] = manager.getSelectedPath();
MenuElement[] path = manager.getSelectedPath();
if (path.length > 1 && path[path.length-1] == menuItem) {
MenuElement newPath[] = new MenuElement[path.length-1];
MenuElement[] newPath = new MenuElement[path.length-1];
int i,c;
for(i=0,c=path.length-1;i<c;i++)
newPath[i] = path[i];
@ -1111,12 +1111,12 @@ public class BasicMenuItemUI extends MenuItemUI
//
public void menuDragMouseEntered(MenuDragMouseEvent e) {
MenuSelectionManager manager = e.getMenuSelectionManager();
MenuElement path[] = e.getPath();
MenuElement[] path = e.getPath();
manager.setSelectedPath(path);
}
public void menuDragMouseDragged(MenuDragMouseEvent e) {
MenuSelectionManager manager = e.getMenuSelectionManager();
MenuElement path[] = e.getPath();
MenuElement[] path = e.getPath();
manager.setSelectedPath(path);
}
public void menuDragMouseExited(MenuDragMouseEvent e) {}
@ -1125,7 +1125,7 @@ public class BasicMenuItemUI extends MenuItemUI
return;
}
MenuSelectionManager manager = e.getMenuSelectionManager();
MenuElement path[] = e.getPath();
MenuElement[] path = e.getPath();
Point p = e.getPoint();
if (p.x >= 0 && p.x < menuItem.getWidth() &&
p.y >= 0 && p.y < menuItem.getHeight()) {

View file

@ -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
@ -253,7 +253,7 @@ public class BasicMenuUI extends BasicMenuItemUI
}
private static void appendPath(MenuElement[] path, MenuElement elem) {
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] = elem;
MenuSelectionManager.defaultManager().setSelectedPath(newPath);
@ -293,8 +293,8 @@ public class BasicMenuUI extends BasicMenuItemUI
if(force) {
Container cnt = menu.getParent();
if(cnt != null && cnt instanceof JMenuBar) {
MenuElement me[];
MenuElement subElements[];
MenuElement[] me;
MenuElement[] subElements;
subElements = menu.getPopupMenu().getSubElements();
if(subElements.length > 0) {
@ -312,7 +312,7 @@ public class BasicMenuUI extends BasicMenuItemUI
defaultManager.setSelectedPath(me);
}
} else {
MenuElement path[] = defaultManager.getSelectedPath();
MenuElement[] path = defaultManager.getSelectedPath();
if(path.length > 0 && path[path.length-1] == menu) {
appendPath(path, menu.getPopupMenu());
}
@ -503,7 +503,7 @@ public class BasicMenuUI extends BasicMenuItemUI
} else {
Container cnt = menu.getParent();
if(cnt != null && cnt instanceof JMenuBar) {
MenuElement me[] = new MenuElement[2];
MenuElement[] me = new MenuElement[2];
me[0]=(MenuElement)cnt;
me[1]=menu;
manager.setSelectedPath(me);
@ -511,7 +511,7 @@ public class BasicMenuUI extends BasicMenuItemUI
}
}
MenuElement selectedPath[] = manager.getSelectedPath();
MenuElement[] selectedPath = manager.getSelectedPath();
if (selectedPath.length > 0 &&
selectedPath[selectedPath.length-1] != menu.getPopupMenu()) {
@ -559,7 +559,7 @@ public class BasicMenuUI extends BasicMenuItemUI
MenuSelectionManager manager =
MenuSelectionManager.defaultManager();
MenuElement selectedPath[] = manager.getSelectedPath();
MenuElement[] selectedPath = manager.getSelectedPath();
if (!menu.isTopLevelMenu()) {
if(!(selectedPath.length > 0 &&
selectedPath[selectedPath.length-1] ==
@ -574,7 +574,7 @@ public class BasicMenuUI extends BasicMenuItemUI
} else {
if(selectedPath.length > 0 &&
selectedPath[0] == menu.getParent()) {
MenuElement newPath[] = new MenuElement[3];
MenuElement[] newPath = new MenuElement[3];
// A top level menu's parent is by definition
// a JMenuBar
newPath[0] = (MenuElement)menu.getParent();
@ -615,13 +615,13 @@ public class BasicMenuUI extends BasicMenuItemUI
return;
MenuSelectionManager manager = e.getMenuSelectionManager();
MenuElement path[] = e.getPath();
MenuElement[] path = e.getPath();
Point p = e.getPoint();
if(p.x >= 0 && p.x < menuItem.getWidth() &&
p.y >= 0 && p.y < menuItem.getHeight()) {
JMenu menu = (JMenu)menuItem;
MenuElement selectedPath[] = manager.getSelectedPath();
MenuElement[] selectedPath = manager.getSelectedPath();
if(!(selectedPath.length > 0 &&
selectedPath[selectedPath.length-1] ==
menu.getPopupMenu())) {
@ -665,19 +665,19 @@ public class BasicMenuUI extends BasicMenuItemUI
}
char key = Character.toLowerCase((char)menuItem.getMnemonic());
MenuElement path[] = e.getPath();
MenuElement[] path = e.getPath();
if (key == Character.toLowerCase(e.getKeyChar())) {
JPopupMenu popupMenu = ((JMenu)menuItem).getPopupMenu();
ArrayList<MenuElement> newList = new ArrayList<>(Arrays.asList(path));
newList.add(popupMenu);
MenuElement subs[] = popupMenu.getSubElements();
MenuElement[] subs = popupMenu.getSubElements();
MenuElement sub =
BasicPopupMenuUI.findEnabledChild(subs, -1, true);
if(sub != null) {
newList.add(sub);
}
MenuSelectionManager manager = e.getMenuSelectionManager();
MenuElement newPath[] = new MenuElement[0];;
MenuElement[] newPath = new MenuElement[0];;
newPath = newList.toArray(newPath);
manager.setSelectedPath(newPath);
e.consume();

View file

@ -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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
}
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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
}
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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
}
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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
!((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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
} 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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
}
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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
// 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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
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 @@ public class BasicPopupMenuUI extends PopupMenuUI {
return result;
}
static MenuElement findEnabledChild(MenuElement e[],
static MenuElement findEnabledChild(MenuElement[] e,
MenuElement elem, boolean forward) {
for (int i=0; i<e.length; i++) {
if (e[i] == elem) {

View file

@ -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
@ -61,7 +61,7 @@ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI
* @param path an array of {@code MenuElement}
* @param manager an instance of {@code MenuSelectionManager}
*/
public void processMouseEvent(JMenuItem item,MouseEvent e,MenuElement path[],MenuSelectionManager manager) {
public void processMouseEvent(JMenuItem item,MouseEvent e,MenuElement[] path,MenuSelectionManager manager) {
Point p = e.getPoint();
if(p.x >= 0 && p.x < item.getWidth() &&
p.y >= 0 && p.y < item.getHeight()) {
@ -72,7 +72,7 @@ public class BasicRadioButtonMenuItemUI extends BasicMenuItemUI
} else
manager.setSelectedPath(path);
} else if(item.getModel().isArmed()) {
MenuElement newPath[] = new MenuElement[path.length-1];
MenuElement[] newPath = new MenuElement[path.length-1];
int i,c;
for(i=0,c=path.length-1;i<c;i++)
newPath[i] = path[i];

View file

@ -132,13 +132,13 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants {
// Transient variables (recalculated each time TabbedPane is layed out)
/** Tab runs */
protected int tabRuns[] = new int[10];
protected int[] tabRuns = new int[10];
/** Run count */
protected int runCount = 0;
/** Selected run */
protected int selectedRun = -1;
/** Tab rects */
protected Rectangle rects[] = new Rectangle[0];
protected Rectangle[] rects = new Rectangle[0];
/** Maximum tab height */
protected int maxTabHeight;
/** Maximum tab width */
@ -986,8 +986,8 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants {
* subtracting xCropLen[i] from (tab.y + tab.height) and adding yCropLen[i]
* to (tab.x).
*/
private static int xCropLen[] = {1,1,0,0,1,1,2,2};
private static int yCropLen[] = {0,3,3,6,6,9,9,12};
private static int[] xCropLen = {1,1,0,0,1,1,2,2};
private static int[] yCropLen = {0,3,3,6,6,9,9,12};
private static final int CROP_SEGMENT = 12;
private static Polygon createCroppedTabShape(int tabPlacement, Rectangle tabRect, int cropline) {
@ -1017,8 +1017,8 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants {
rcnt++;
}
int npts = 2 + (rcnt*8);
int xp[] = new int[npts];
int yp[] = new int[npts];
int[] xp = new int[npts];
int[] yp = new int[npts];
int pcnt = 0;
xp[pcnt] = ostart;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -360,7 +360,7 @@ public class DefaultMetalTheme extends MetalTheme {
USER_TEXT_FONT, CONTROL_TEXT_FONT,
CONTROL_TEXT_FONT, SUB_TEXT_FONT
};
FontUIResource fonts[];
FontUIResource[] fonts;
// menu and window are mapped to controlFont
public FontDelegate() {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -224,7 +224,7 @@ class BumpBuffer {
Transparency.BITMASK);
}
else {
int cmap[] = { backColor.getRGB(), topColor.getRGB(),
int[] cmap = { backColor.getRGB(), topColor.getRGB(),
shadowColor.getRGB() };
IndexColorModel icm = new IndexColorModel(8, 3, cmap, 0, false,
(backColor == MetalBumps.ALPHA) ? 0 : -1,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -2226,7 +2226,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel
*/
private static void updateWindowUI(Window window) {
SwingUtilities.updateComponentTreeUI(window);
Window ownedWins[] = window.getOwnedWindows();
Window[] ownedWins = window.getOwnedWindows();
for (Window w : ownedWins) {
updateWindowUI(w);
}
@ -2236,7 +2236,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel
* Updates the UIs of all the known Frames.
*/
private static void updateAllUIs() {
Frame appFrames[] = Frame.getFrames();
Frame[] appFrames = Frame.getFrames();
for (Frame frame : appFrames) {
updateWindowUI(frame);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -303,7 +303,7 @@ public final class NimbusStyle extends SynthStyle {
//there are no custom states or custom state ordering
String statesString = (String)defaults.get(prefix + ".States");
if (statesString != null) {
String s[] = statesString.split(",");
String[] s = statesString.split(",");
for (int i=0; i<s.length; i++) {
s[i] = s[i].trim();
if (!State.isStandardStateName(s[i])) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 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
@ -863,7 +863,7 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
*/
private static void updateWindowUI(Window window) {
updateStyles(window);
Window ownedWins[] = window.getOwnedWindows();
Window[] ownedWins = window.getOwnedWindows();
for (Window w : ownedWins) {
updateWindowUI(w);
}
@ -873,7 +873,7 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
* Updates the UIs of all the known Frames.
*/
private static void updateAllUIs() {
Frame appFrames[] = Frame.getFrames();
Frame[] appFrames = Frame.getFrames();
for (Frame frame : appFrames) {
updateWindowUI(frame);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -1245,14 +1245,14 @@ class SynthParser extends DefaultHandler {
}
}
public void characters(char ch[], int start, int length)
public void characters(char[] ch, int start, int length)
throws SAXException {
if (isForwarding()) {
getHandler().characters(ch, start, length);
}
}
public void ignorableWhitespace (char ch[], int start, int length)
public void ignorableWhitespace (char[] ch, int start, int length)
throws SAXException {
if (isForwarding()) {
getHandler().ignorableWhitespace(ch, start, length);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, 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
@ -1057,7 +1057,7 @@ public abstract class AbstractDocument implements Document, Serializable {
// Calculate the bidi levels for the affected range of paragraphs. The
// levels array will contain a bidi level for each character in the
// affected text.
byte levels[] = calculateBidiLevels( firstPStart, lastPEnd );
byte[] levels = calculateBidiLevels( firstPStart, lastPEnd );
Vector<Element> newElements = new Vector<Element>();
@ -1185,7 +1185,7 @@ public abstract class AbstractDocument implements Document, Serializable {
*/
private byte[] calculateBidiLevels( int firstPStart, int lastPEnd ) {
byte levels[] = new byte[ lastPEnd - firstPStart ];
byte[] levels = new byte[ lastPEnd - firstPStart ];
int levelsEnd = 0;
Boolean defaultDirection = null;
Object d = getProperty(TextAttribute.RUN_DIRECTION);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, 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
@ -1002,7 +1002,7 @@ public class ParagraphView extends FlowView implements TabExpander {
@Override
protected SizeRequirements calculateMajorAxisRequirements(int axis,
SizeRequirements r) {
int oldJustficationData[] = justificationData;
int[] oldJustficationData = justificationData;
justificationData = null;
SizeRequirements ret = super.calculateMajorAxisRequirements(axis, r);
if (isJustifyEnabled()) {
@ -1014,7 +1014,7 @@ public class ParagraphView extends FlowView implements TabExpander {
@Override
protected void layoutMajorAxis(int targetSpan, int axis,
int[] offsets, int[] spans) {
int oldJustficationData[] = justificationData;
int[] oldJustficationData = justificationData;
justificationData = null;
super.layoutMajorAxis(targetSpan, axis, offsets, spans);
if (! isJustifyEnabled()) {
@ -1045,7 +1045,7 @@ public class ParagraphView extends FlowView implements TabExpander {
int rowStartOffset = getStartOffset();
int rowEndOffset = getEndOffset();
int spaceMap[] = new int[rowEndOffset - rowStartOffset];
int[] spaceMap = new int[rowEndOffset - rowStartOffset];
Arrays.fill(spaceMap, 0);
for (int i = getViewCount() - 1; i >= 0 ; i--) {
View view = getView(i);
@ -1179,7 +1179,7 @@ public class ParagraphView extends FlowView implements TabExpander {
//this should be the last index in justificationData
static final int END_JUSTIFIABLE = 3;
int justificationData[] = null;
int[] justificationData = null;
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -1975,7 +1975,7 @@ class AccessibleHTML implements Accessible {
vec.addElement(Integer.valueOf(i));
}
}
int retval[] = new int[vec.size()];
int[] retval = new int[vec.size()];
for (int i = 0; i < retval.length; i++) {
retval[i] = vec.elementAt(i).intValue();
}
@ -2000,7 +2000,7 @@ class AccessibleHTML implements Accessible {
vec.addElement(Integer.valueOf(i));
}
}
int retval[] = new int[vec.size()];
int[] retval = new int[vec.size()];
for (int i = 0; i < retval.length; i++) {
retval[i] = vec.elementAt(i).intValue();
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -3373,9 +3373,9 @@ public class CSS implements Serializable {
int n = iter.getCount();
int adjustmentWeightsCount = LayoutIterator.WorstAdjustmentWeight + 1;
//max gain we can get adjusting elements with adjustmentWeight <= i
long gain[] = new long[adjustmentWeightsCount];
long[] gain = new long[adjustmentWeightsCount];
//max loss we can get adjusting elements with adjustmentWeight <= i
long loss[] = new long[adjustmentWeightsCount];
long[] loss = new long[adjustmentWeightsCount];
for (int i = 0; i < adjustmentWeightsCount; i++) {
gain[i] = loss[i] = 0;
@ -3414,7 +3414,7 @@ public class CSS implements Serializable {
// determine the adjustment to be made
int allocated = targetSpan - totalSpacing;
long desiredAdjustment = allocated - preferred;
long adjustmentsArray[] = (desiredAdjustment > 0) ? gain : loss;
long[] adjustmentsArray = (desiredAdjustment > 0) ? gain : loss;
desiredAdjustment = Math.abs(desiredAdjustment);
int adjustmentLevel = 0;
for (;adjustmentLevel <= LayoutIterator.WorstAdjustmentWeight;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
@ -70,7 +70,7 @@ class CSSBorder extends AbstractBorder {
};
/** Parsers for the border properties. */
static final CssValue PARSERS[] = {
static final CssValue[] PARSERS = {
new ColorValue(), new BorderStyle(), new BorderWidthValue(null, 0),
};

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -184,7 +184,7 @@ class FrameSetView extends javax.swing.text.BoxView {
protected SizeRequirements[] getChildRequests(int targetSpan, int axis) {
int span[] = new int[children.length];
int[] span = new int[children.length];
spread(targetSpan, span);
int n = getViewCount();
@ -215,7 +215,7 @@ class FrameSetView extends javax.swing.text.BoxView {
* computes this based on the information that extracted
* from the value of the ROW/COL attribute.
*/
private void spread(int targetSpan, int span[]) {
private void spread(int targetSpan, int[] span) {
if (targetSpan == 0) {
return;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -553,7 +553,7 @@ public class HTML {
*/
public static final Tag COMMENT = new Tag("comment");
static final Tag allTags[] = {
static final Tag[] allTags = {
A, ADDRESS, APPLET, AREA, B, BASE, BASEFONT, BIG,
BLOCKQUOTE, BODY, BR, CAPTION, CENTER, CITE, CODE,
DD, DFN, DIR, DIV, DL, DT, EM, FONT, FORM, FRAME,
@ -1060,7 +1060,7 @@ public class HTML {
public static final Attribute COMMENT = new Attribute("comment");
static final Attribute MEDIA = new Attribute("media");
static final Attribute allAttributes[] = {
static final Attribute[] allAttributes = {
FACE,
COMMENT,
SIZE,

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -76,7 +76,7 @@ class MuxingAttributeSet implements AttributeSet, Serializable {
protected synchronized void insertAttributeSetAt(AttributeSet as,
int index) {
int numAttrs = attrs.length;
AttributeSet newAttrs[] = new AttributeSet[numAttrs + 1];
AttributeSet[] newAttrs = new AttributeSet[numAttrs + 1];
if (index < numAttrs) {
if (index > 0) {
System.arraycopy(attrs, 0, newAttrs, 0, index);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -133,7 +133,7 @@ public class ObjectView extends ComponentView {
System.err.println("introspector failed, ex: "+ex);
return; // quit for now
}
PropertyDescriptor props[] = bi.getPropertyDescriptors();
PropertyDescriptor[] props = bi.getPropertyDescriptors();
for (int i=0; i < props.length; i++) {
// System.err.println("checking on props[i]: "+props[i].getName());
Object v = attr.getAttribute(props[i].getName());

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, 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
@ -1514,9 +1514,9 @@ public class StyleSheet extends StyleContext {
int numElements = elements.size();
// Build three arrays, one for tags, one for class's, and one for
// id's
String tags[] = new String[numElements];
String ids[] = new String[numElements];
String classes[] = new String[numElements];
String[] tags = new String[numElements];
String[] ids = new String[numElements];
String[] classes = new String[numElements];
for (int counter = 0; counter < numElements; counter++) {
Element e = elements.elementAt(counter);
AttributeSet attr = e.getAttributes();
@ -2447,7 +2447,7 @@ public class StyleSheet extends StyleContext {
}
/* list of roman numerals */
static final char romanChars[][] = {
static final char[][] romanChars = {
{'i', 'v'},
{'x', 'l' },
{'c', 'd' },
@ -3410,8 +3410,8 @@ public class StyleSheet extends StyleContext {
* The HTML/CSS size model has seven slots
* that one can assign sizes to.
*/
static final int sizeMapDefault[] = { 8, 10, 12, 14, 18, 24, 36 };
static final int[] sizeMapDefault = { 8, 10, 12, 14, 18, 24, 36 };
private int sizeMap[] = sizeMapDefault;
private int[] sizeMap = sizeMapDefault;
private boolean w3cLengthUnits = false;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -1054,7 +1054,7 @@ import javax.swing.text.*;
/**
* Set the layout arrays to use for holding layout results
*/
public void setLayoutArrays(int offsets[], int spans[], int targetSpan) {
public void setLayoutArrays(int[] offsets, int[] spans, int targetSpan) {
this.offsets = offsets;
this.spans = spans;
updatePercentagesAndAdjustmentWeights(targetSpan);

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -156,8 +156,8 @@ public final class ContentModel implements Serializable {
}
}
private boolean valSet[];
private boolean val[];
private boolean[] valSet;
private boolean[] val;
// A cache used by first(). This cache was found to speed parsing
// by about 10% (based on measurements of the 4-12 code base after
// buffering was fixed).
@ -264,7 +264,7 @@ public final class ContentModel implements Serializable {
case ',':
case '|':
case '&':
char data[] = {' ', (char)type, ' '};
char[] data = {' ', (char)type, ' '};
String str = "";
for (ContentModel m = (ContentModel)content ; m != null ; m = m.next) {
str = str + m;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -237,7 +237,7 @@ class DTD implements DTDConstants {
* @return the <code>Entity</code> requested or a new <code>Entity</code>
* if not found
*/
public Entity defineEntity(String name, int type, char data[]) {
public Entity defineEntity(String name, int type, char[] data) {
Entity ent = entityHash.get(name);
if (ent == null) {
ent = new Entity(name, type, data);
@ -304,7 +304,7 @@ class DTD implements DTDConstants {
* @return the new character <code>Entity</code>
*/
public Entity defEntity(String name, int type, int ch) {
char data[] = {(char)ch};
char[] data = {(char)ch};
return defineEntity(name, type, data);
}
@ -317,7 +317,7 @@ class DTD implements DTDConstants {
*/
protected Entity defEntity(String name, int type, String str) {
int len = str.length();
char data[] = new char[len];
char[] data = new char[len];
str.getChars(0, len, data, 0);
return defineEntity(name, type, data);
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -177,7 +177,7 @@ public class DocumentParser extends javax.swing.text.html.parser.Parser {
}
protected void handleComment(char text[]) {
protected void handleComment(char[] text) {
if (debugFlag) {
debug("comment: ->" + new String(text) + "<-"
+ " pos: " + getCurrentPos());
@ -257,7 +257,7 @@ public class DocumentParser extends javax.swing.text.html.parser.Parser {
/**
* Handle Text.
*/
protected void handleText(char data[]) {
protected void handleText(char[] data) {
if (data != null) {
if (inscript != 0) {
callback.handleComment(data, getBlockStartPosition());

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -55,7 +55,7 @@ class Entity implements DTDConstants {
/**
* The char array of data.
*/
public char data[];
public char[] data;
/**
* Creates an entity.
@ -63,7 +63,7 @@ class Entity implements DTDConstants {
* @param type the type of the entity
* @param data the char array of data
*/
public Entity(String name, int type, char data[]) {
public Entity(String name, int type, char[] data) {
this.name = name;
this.type = type;
this.data = data;
@ -105,7 +105,7 @@ class Entity implements DTDConstants {
* Returns the <code>data</code>.
* @return the <code>data</code>
*/
public char getData()[] {
public char[] getData() {
return data;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -78,12 +78,12 @@ import java.net.URL;
public
class Parser implements DTDConstants {
private char text[] = new char[1024];
private char[] text = new char[1024];
private int textpos = 0;
private TagElement last;
private boolean space;
private char str[] = new char[128];
private char[] str = new char[128];
private int strpos = 0;
/**
@ -273,7 +273,7 @@ class Parser implements DTDConstants {
*
* @param text the section text
*/
protected void handleText(char text[]) {
protected void handleText(char[] text) {
}
/**
@ -281,7 +281,7 @@ class Parser implements DTDConstants {
*
* @param text the title text
*/
protected void handleTitle(char text[]) {
protected void handleTitle(char[] text) {
// default behavior is to call handleText. Subclasses
// can override if necessary.
handleText(text);
@ -292,7 +292,7 @@ class Parser implements DTDConstants {
*
* @param text the comment being handled
*/
protected void handleComment(char text[]) {
protected void handleComment(char[] text) {
}
/**
@ -386,7 +386,7 @@ class Parser implements DTDConstants {
if (!ignoreSpace) {
// enlarge buffer if needed
if (textpos + 1 > text.length) {
char newtext[] = new char[text.length + 200];
char[] newtext = new char[text.length + 200];
System.arraycopy(text, 0, newtext, 0, text.length);
text = newtext;
}
@ -399,7 +399,7 @@ class Parser implements DTDConstants {
}
space = false;
}
char newtext[] = new char[textpos];
char[] newtext = new char[textpos];
System.arraycopy(text, 0, newtext, 0, textpos);
// Handles cases of bad html where the title tag
// was getting lost when we did error recovery.
@ -837,7 +837,7 @@ class Parser implements DTDConstants {
*/
void addString(int c) {
if (strpos == str.length) {
char newstr[] = new char[str.length + 128];
char[] newstr = new char[str.length + 128];
System.arraycopy(str, 0, newstr, 0, str.length);
str = newstr;
}
@ -848,21 +848,21 @@ class Parser implements DTDConstants {
* Get the string that's been accumulated.
*/
String getString(int pos) {
char newStr[] = new char[strpos - pos];
char[] newStr = new char[strpos - pos];
System.arraycopy(str, pos, newStr, 0, strpos - pos);
strpos = pos;
return new String(newStr);
}
char[] getChars(int pos) {
char newStr[] = new char[strpos - pos];
char[] newStr = new char[strpos - pos];
System.arraycopy(str, pos, newStr, 0, strpos - pos);
strpos = pos;
return newStr;
}
char[] getChars(int pos, int endPos) {
char newStr[] = new char[endPos - pos];
char[] newStr = new char[endPos - pos];
System.arraycopy(str, pos, newStr, 0, endPos - pos);
// REMIND: it's not clear whether this version should set strpos or not
// strpos = pos;
@ -1034,18 +1034,18 @@ class Parser implements DTDConstants {
ch = readCh();
break;
}
char data[] = mapNumericReference(n);
char[] data = mapNumericReference(n);
return data;
}
addString('#');
if (!parseIdentifier(false)) {
error("ident.expected");
strpos = pos;
char data[] = {'&', '#'};
char[] data = {'&', '#'};
return data;
}
} else if (!parseIdentifier(false)) {
char data[] = {'&'};
char[] data = {'&'};
return data;
}
@ -1095,7 +1095,7 @@ class Parser implements DTDConstants {
/* given that there is not a match restore the entity reference */
String str = "&" + nm + (semicolon ? ";" : "");
char b[] = new char[str.length()];
char[] b = new char[str.length()];
str.getChars(0, b.length, b, 0);
return b;
}
@ -1251,9 +1251,9 @@ class Parser implements DTDConstants {
break;
case '&':
char data[] = parseEntityReference();
char[] data = parseEntityReference();
if (textpos + data.length > text.length) {
char newtext[] = new char[Math.max(textpos + data.length + 128, text.length * 2)];
char[] newtext = new char[Math.max(textpos + data.length + 128, text.length * 2)];
System.arraycopy(text, 0, newtext, 0, text.length);
text = newtext;
}
@ -1285,7 +1285,7 @@ class Parser implements DTDConstants {
// output character
if (textpos == text.length) {
char newtext[] = new char[text.length + 128];
char[] newtext = new char[text.length + 128];
System.arraycopy(text, 0, newtext, 0, text.length);
text = newtext;
}
@ -1395,7 +1395,7 @@ class Parser implements DTDConstants {
break;
}
char data[] = parseEntityReference();
char[] data = parseEntityReference();
for (int i = 0 ; i < data.length ; i++) {
c = data[i];
addString((lower && (c >= 'A') && (c <= 'Z')) ? 'a' + c - 'A' : c);
@ -1506,7 +1506,7 @@ class Parser implements DTDConstants {
}
}
} else {
char str[] = {(char)ch};
char[] str = {(char)ch};
error("invalid.tagchar", new String(str), elem.getName());
ch = readCh();
continue;
@ -1526,7 +1526,7 @@ class Parser implements DTDConstants {
error("attvalerr");
return;
} else {
char str[] = {(char)ch};
char[] str = {(char)ch};
error("invalid.tagchar", new String(str), elem.getName());
if (!strict) {
ch = readCh();
@ -1674,7 +1674,7 @@ class Parser implements DTDConstants {
// before parsing and sending the
// comment
if (textpos != 0) {
char newtext[] = new char[textpos];
char[] newtext = new char[textpos];
System.arraycopy(text, 0, newtext, 0, textpos);
handleText(newtext);
lastBlockStartPos = currentBlockStartPos;
@ -2224,9 +2224,9 @@ class Parser implements DTDConstants {
space = false;
}
}
char data[] = parseEntityReference();
char[] data = parseEntityReference();
if (textpos + data.length + 1 > text.length) {
char newtext[] = new char[Math.max(textpos + data.length + 128, text.length * 2)];
char[] newtext = new char[Math.max(textpos + data.length + 128, text.length * 2)];
System.arraycopy(text, 0, newtext, 0, text.length);
text = newtext;
}
@ -2306,7 +2306,7 @@ class Parser implements DTDConstants {
// enlarge buffer if needed
if (textpos + 2 > text.length) {
char newtext[] = new char[text.length + 128];
char[] newtext = new char[text.length + 128];
System.arraycopy(text, 0, newtext, 0, text.length);
text = newtext;
}
@ -2412,7 +2412,7 @@ class Parser implements DTDConstants {
* this reason the initial size is 1 and when the body is encountered the
* size is adjusted to 256.
*/
private char buf[] = new char[1];
private char[] buf = new char[1];
private int pos;
private int len;
/*

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2010, 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
@ -49,17 +49,17 @@ import java.lang.*;
abstract class AbstractFilter extends OutputStream
{
/** A table mapping bytes to characters */
protected char translationTable[];
protected char[] translationTable;
/** A table indicating which byte values should be interpreted as
* characters and which should be treated as formatting codes */
protected boolean specialsTable[];
protected boolean[] specialsTable;
/** A translation table which does ISO Latin-1 (trivial) */
static final char latin1TranslationTable[];
static final char[] latin1TranslationTable;
/** A specials table which indicates that no characters are special */
static final boolean noSpecialsTable[];
static final boolean[] noSpecialsTable;
/** A specials table which indicates that all characters are special */
static final boolean allSpecialsTable[];
static final boolean[] allSpecialsTable;
static {
int i;
@ -93,7 +93,7 @@ abstract class AbstractFilter extends OutputStream
public void readFromStream(InputStream in)
throws IOException
{
byte buf[];
byte[] buf;
int count;
buf = new byte[16384];
@ -110,7 +110,7 @@ abstract class AbstractFilter extends OutputStream
public void readFromReader(Reader in)
throws IOException
{
char buf[];
char[] buf;
int count;
buf = new char[2048];

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2008, 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
@ -33,7 +33,7 @@ import java.io.IOException;
class RTFAttributes
{
static RTFAttribute attributes[];
static RTFAttribute[] attributes;
static {
Vector<RTFAttribute> a = new Vector<RTFAttribute>();

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, 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
@ -496,7 +496,7 @@ protected void checkControlWord(MutableAttributeSet currentAttributes,
protected void checkControlWords(MutableAttributeSet currentAttributes,
AttributeSet newAttributes,
RTFAttribute words[],
RTFAttribute[] words,
int domain)
throws IOException
{
@ -596,7 +596,7 @@ void updateParagraphAttributes(MutableAttributeSet current,
RTFAttributes.attributes, RTFAttribute.D_PARAGRAPH);
if (oldTabs != newTabs && newTabs != null) {
TabStop tabs[] = (TabStop[])newTabs;
TabStop[] tabs = (TabStop[])newTabs;
int index;
for(index = 0; index < tabs.length; index ++) {
TabStop tab = tabs[index];

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, 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
@ -90,7 +90,7 @@ abstract class RTFParser extends AbstractFilter
public abstract void endgroup();
// table of non-text characters in rtf
static final boolean rtfSpecialsTable[];
static final boolean[] rtfSpecialsTable;
static {
rtfSpecialsTable = noSpecialsTable.clone();
rtfSpecialsTable['\n'] = true;
@ -191,7 +191,7 @@ abstract class RTFParser extends AbstractFilter
break;
}
if (!Character.isLetter(ch)) {
char newstring[] = new char[1];
char[] newstring = new char[1];
newstring[0] = ch;
if (!handleKeyword(new String(newstring))) {
warning("Unknown keyword: " + newstring + " (" + (byte)ch + ")");

View file

@ -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
@ -1421,7 +1421,7 @@ abstract class AttributeTrackingDestination implements Destination
Integer stateItem;
/*** Tab stops ***/
TabStop tabs[];
TabStop[] tabs;
tabs = (TabStop[])parserState.get("_tabs_immutable");
if (tabs == null) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, 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
@ -382,7 +382,7 @@ public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeS
}
if(validCount > 0) {
TreePath newSelection[] = new TreePath[oldCount +
TreePath[] newSelection = new TreePath[oldCount +
validCount];
/* And build the new selection. */
@ -901,7 +901,7 @@ public class DefaultTreeSelectionModel implements Cloneable, Serializable, TreeS
}
else {
TreePath[] newSel = new TreePath[counter - min];
int selectionIndex[] = rowMapper.getRowsForPaths(selection);
int[] selectionIndex = rowMapper.getRowsForPaths(selection);
// find the actual selection pathes corresponded to the
// rows of the new selection
for (int i = 0; i < selectionIndex.length; i++) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -347,7 +347,7 @@ public class FixedHeightLayoutCache extends AbstractLayoutCache {
*/
public void treeNodesChanged(TreeModelEvent e) {
if(e != null) {
int changedIndexs[];
int[] changedIndexs;
FHTreeStateNode changedParent = getNodeForPath
(SwingUtilities2.getTreePath(e, getModel()), false, false);
int maxCounter;
@ -391,7 +391,7 @@ public class FixedHeightLayoutCache extends AbstractLayoutCache {
*/
public void treeNodesInserted(TreeModelEvent e) {
if(e != null) {
int changedIndexs[];
int[] changedIndexs;
FHTreeStateNode changedParent = getNodeForPath
(SwingUtilities2.getTreePath(e, getModel()), false, false);
int maxCounter;
@ -430,7 +430,7 @@ public class FixedHeightLayoutCache extends AbstractLayoutCache {
*/
public void treeNodesRemoved(TreeModelEvent e) {
if(e != null) {
int changedIndexs[];
int[] changedIndexs;
int maxCounter;
TreePath parentPath = SwingUtilities2.getTreePath(e, getModel());
FHTreeStateNode changedParentNode = getNodeForPath

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -409,7 +409,7 @@ public class VariableHeightLayoutCache extends AbstractLayoutCache {
*/
public void treeNodesChanged(TreeModelEvent e) {
if(e != null) {
int changedIndexs[] = e.getChildIndices();
int[] changedIndexs = e.getChildIndices();
TreeStateNode changedNode = getNodeForPath(
SwingUtilities2.getTreePath(e, getModel()), false, false);
@ -456,7 +456,7 @@ public class VariableHeightLayoutCache extends AbstractLayoutCache {
*/
public void treeNodesInserted(TreeModelEvent e) {
if(e != null) {
int changedIndexs[] = e.getChildIndices();
int[] changedIndexs = e.getChildIndices();
TreeStateNode changedParentNode = getNodeForPath(
SwingUtilities2.getTreePath(e, getModel()), false, false);
/* Only need to update the children if the node has been
@ -522,7 +522,7 @@ public class VariableHeightLayoutCache extends AbstractLayoutCache {
*/
public void treeNodesRemoved(TreeModelEvent e) {
if(e != null) {
int changedIndexs[];
int[] changedIndexs;
TreeStateNode changedParentNode;
changedIndexs = e.getChildIndices();