Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed private List raw use #6667

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ private static boolean isLeafType (String type) {
//---------------------------------------------------------------------------------------

public static class ImplicitLocals {
private List locals = new ArrayList ();
private List<LocalVariable> locals = new ArrayList<>();
private static HashSet<String> localsNames = null;

public static boolean isImplicitLocal(String aLocalName) {
Expand All @@ -343,7 +343,7 @@ void addLocal (LocalVariable local) {
locals.add (local);
}

List getLocals () {
List<LocalVariable> getLocals () {
return locals;
}

Expand All @@ -358,7 +358,7 @@ public int hashCode () {
}

public static class AttributeMap {// extends java.util.HashMap {
private ArrayList attributes = new ArrayList();
private ArrayList<Attribute> attributes = new ArrayList<>();
private ObjectVariable owner = null;
private String ownerName = null;

Expand Down Expand Up @@ -391,7 +391,7 @@ private void setOwnerName(String aOwnerName) {
throw new UnknownOwnerNameException(aOwnerName);
}

public ArrayList getAttributes() { return attributes; }
public ArrayList<Attribute> getAttributes() { return attributes; }
public String getOwnerName() { return ownerName; }

public class Attribute {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
*/
public class QueryBuilderSqlCompletion extends DefaultStyledDocument {

private List dictionary = new ArrayList();
private List<String> dictionary = new ArrayList<>();
private JTextComponent comp;
private int charCount = -1;
private int lastOffset = 0;
Expand Down Expand Up @@ -91,8 +91,8 @@ public void insertString(int offs, String str, AttributeSet a) throws BadLocatio

// Compare prefix of chars typed with sqlReservedWords from QueryBuilderSqlTextArea
public String completeText( String text ) {
for( Iterator i = dictionary.iterator(); i.hasNext(); ) {
String word = (String) i.next();
for( Iterator<String> i = dictionary.iterator(); i.hasNext(); ) {
String word = i.next();
if( word.startsWith( text ) ) {
return word.substring( text.length() );
} else if (word.startsWith(text.toUpperCase()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public final class FoldHierarchyTransactionImpl {
* starting with folds with the highest priority
* going to folds with the lowest priority.
*/
private List unblockedFoldLists = new ArrayList(4);
private List<List<Fold>> unblockedFoldLists = new ArrayList<>(4);

/**
* Maximum priority of the unblocked folds added
Expand Down Expand Up @@ -1191,9 +1191,9 @@ private void unblockBlocked(Fold block) {
Fold blocked = (Fold)it.next();
int priority = getOperation(blocked).getPriority();
while (unblockedFoldLists.size() <= priority) {
unblockedFoldLists.add(new ArrayList(4));
unblockedFoldLists.add(new ArrayList<>(4));
}
((List)unblockedFoldLists.get(priority)).add(blocked);
unblockedFoldLists.get(priority).add(blocked);
if (priority > unblockedFoldMaxPriority) {
unblockedFoldMaxPriority = priority;
}
Expand All @@ -1208,11 +1208,11 @@ private void processUnblocked() {
ApiPackageAccessor api = ApiPackageAccessor.get();
if (unblockedFoldMaxPriority >= 0) { // some folds became unblocked
for (int priority = unblockedFoldMaxPriority; priority >= 0; priority--) {
List foldList = (List)unblockedFoldLists.get(priority);
List<Fold> foldList = unblockedFoldLists.get(priority);
Fold rootFold = execution.getRootFold();
for (int i = foldList.size() - 1; i >= 0; i--) {
// Remove last fold from the list
Fold unblocked = (Fold)foldList.remove(i);
Fold unblocked = foldList.remove(i);

if (!execution.isAddedOrBlocked(unblocked)) { // not yet processed
unblockedFoldMaxPriority = -1;
Expand Down
26 changes: 13 additions & 13 deletions ide/editor.lib/src/org/netbeans/editor/StatusBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public static void setGlobalCell(String cellName, JLabel globalCell) {

private boolean visible;

private List cellList = new ArrayList();
private List<JLabel> cellList = new ArrayList<>();

private Caret caret;

Expand Down Expand Up @@ -409,7 +409,7 @@ public void addCustomCell(int i, JLabel c) {

private void addCellImpl(int i, JLabel c) {
synchronized (cellList) {
ArrayList newCellList = new ArrayList(cellList);
List<JLabel> newCellList = new ArrayList<>(cellList);
int cnt = newCellList.size();
if (i < 0 || i > cnt) {
i = cnt;
Expand Down Expand Up @@ -440,29 +440,29 @@ private void updateCellBorders(int addedIndex) {
}
if (cellCount == 1) {
// only one cell
((JLabel)cellList.get(0)).setBorder(onlyOneBorder);
cellList.get(0).setBorder(onlyOneBorder);
return;
}
if (addedIndex == 0) {
// added as first, updates second
((JLabel)cellList.get(0)).setBorder(leftBorder);
JLabel second = (JLabel)cellList.get(1);
cellList.get(0).setBorder(leftBorder);
JLabel second = cellList.get(1);
second.setBorder(cellCount == 2 ? rightBorder : innerBorder);
} else if (addedIndex == cellCount - 1) {
// added as last, updates previous
((JLabel)cellList.get(cellCount - 1)).setBorder(rightBorder);
JLabel previous = (JLabel)cellList.get(cellCount - 2);
cellList.get(cellCount - 1).setBorder(rightBorder);
JLabel previous = cellList.get(cellCount - 2);
previous.setBorder(cellCount == 2 ? leftBorder : innerBorder);
} else {
// cell added inside
((JLabel)cellList.get(addedIndex)).setBorder(innerBorder);
cellList.get(addedIndex).setBorder(innerBorder);
}
}

public JLabel getCellByName(String name) {
Iterator i = cellList.iterator();
Iterator<JLabel> i = cellList.iterator();
while (i.hasNext()) {
JLabel c = (JLabel)i.next();
JLabel c = i.next();
if (name.equals(c.getName())) {
return c;
}
Expand Down Expand Up @@ -554,9 +554,9 @@ public void setText(String text, int importance) {
private void refreshPanel() {
if (isVisible()) { // refresh only if visible
// Apply coloring to all cells
Iterator it = cellList.iterator();
Iterator<JLabel> it = cellList.iterator();
while (it.hasNext()) {
JLabel c = (JLabel)it.next();
JLabel c = it.next();
JTextComponent jtc = editorUI.getComponent();
if (c instanceof Cell && jtc != null /*#141362 Check editorUI.getComponent() not null*/) {
Coloring col = getColoring(
Expand All @@ -577,7 +577,7 @@ private void refreshPanel() {

it = cellList.iterator();
while (it.hasNext()) {
JLabel c = (JLabel)it.next();
JLabel c = it.next();
boolean main = CELL_MAIN.equals(c.getName());
if (main) {
gc.fill = GridBagConstraints.HORIZONTAL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class XMLSchemaParser extends GeneralParser implements SchemaParser {
private Stack parentUniqueNames = new Stack();
private String lastDefinedType = null;
private boolean lastDefinedExternalType = true;
private List perAttributeExtraData = new LinkedList();
private List<SwitchData> perAttributeExtraData = new LinkedList<>();
private String targetNamespace;
private Map elementsAlreadyDefined = new IdentityHashMap();

Expand Down Expand Up @@ -362,7 +362,7 @@ protected void processElement(SchemaRep.Element el) throws Schema2BeansException
handler.addExtraDataCurLink(new MinOccursRestriction(el.getMinOccurs()));
}
if (perAttributeExtraData.size() > 0) {
for (Iterator it = perAttributeExtraData.iterator(); it.hasNext(); ) {
for (Iterator<SwitchData> it = perAttributeExtraData.iterator(); it.hasNext(); ) {
handler.addExtraDataCurLink(it.next());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class DBScriptWizardDescriptor implements WizardDescriptor.FinishablePanel, ChangeListener {

private DBScriptPanel.WizardPanel p;
private List changeListeners = new ArrayList();
private List<javax.swing.event.ChangeListener> changeListeners = new ArrayList<>();
private WizardDescriptor wizardDescriptor;
private Project project;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
public class EntityWizardDescriptor implements WizardDescriptor.FinishablePanel, ChangeListener {

private EntityWizardPanel p;
private List changeListeners = new ArrayList();
private List<javax.swing.event.ChangeListener> changeListeners = new ArrayList<>();
private WizardDescriptor wizardDescriptor;
private Project project;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
*/
public class CacheWriterTask extends Task {
private File outDir = null;
private List paths = new ArrayList();
private List<Path> paths = new ArrayList<>();
private boolean clean = true;
/** Creates a new instance of CacheWriterTask */
public CacheWriterTask() {
Expand Down Expand Up @@ -68,14 +68,14 @@ public void execute() throws BuildException {
if (outDir == null) {
throw new BuildException ("Output directory for cache file must be specified");
}

try {
CacheWriter writer = new CacheWriter();
writer.setDir(outDir.toString(), clean);

Iterator it = paths.iterator();
Iterator<Path> it = paths.iterator();
while (it.hasNext()) {
Path curr = (Path) it.next();
Path curr = it.next();
String[] dirs = curr.list();
for (int i=0; i < dirs.length; i++) {
System.err.println("WriteDir " + dirs[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void setTarget(String t) {
subTarget = t;
}

private List filesets = new LinkedList(); // List<FileSet>
private List<FileSet> filesets = new LinkedList<>();
public void addFileset(FileSet fs) {
filesets.add(fs);
}
Expand All @@ -56,9 +56,9 @@ public void addParam(Param p) {
public void execute() throws BuildException {
if (subTarget == null) throw new BuildException("No subtarget set.");
if (filesets.isEmpty()) throw new BuildException("No files to process - fileset is empty");
Iterator it = filesets.iterator();
Iterator<FileSet> it = filesets.iterator();
while (it.hasNext()) {
FileSet fs = (FileSet)it.next();
FileSet fs = it.next();
DirectoryScanner ds = fs.getDirectoryScanner(project);
File basedir = ds.getBasedir();
String[] files = ds.getIncludedFiles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ public String getAccessibleDescription() {

private class SearchFieldListener extends KeyAdapter implements DocumentListener, FocusListener {
/** The last search results */
private List results = new ArrayList();
private List<Integer> results = new ArrayList<>();

/** The last selected index from the search results. */
private int currentSelectionIndex;
Expand Down Expand Up @@ -1272,9 +1272,9 @@ private void displaySearchResult() {
currentSelectionIndex = 0;
}

Integer index = (Integer) results.get(currentSelectionIndex);
list.setSelectedIndex(index.intValue());
list.ensureIndexIsVisible(index.intValue());
Integer index = results.get(currentSelectionIndex);
list.setSelectedIndex(index);
list.ensureIndexIsVisible(index);
} else {
list.clearSelection();
}
Expand Down