Skip to content

Commit

Permalink
Merge pull request apache#2075 from BradWalker/cleanup_EMPTY_LIST
Browse files Browse the repository at this point in the history
[NETBEANS-4050] - cleanup uses of EMPTY_LIST, EMPTY_SET, EMPTY_MAP
  • Loading branch information
matthiasblaesing authored Jun 11, 2020
2 parents 97a3bda + f5f3c9f commit 36cfe28
Show file tree
Hide file tree
Showing 39 changed files with 68 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class ExamineManifest {
private String locBundle;
private boolean publicPackages;
private boolean populateDependencies = false;
private List dependencyTokens = Collections.EMPTY_LIST;
private List dependencyTokens = Collections.emptyList();


public void checkFile() throws MojoExecutionException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private WizardDescriptor.Panel[] getPanels() {

@Override
public Set instantiate() throws IOException {
Set result = Collections.EMPTY_SET;
Set result = Collections.emptySet();
PayaraDDWizardPanel wizardPanel = (PayaraDDWizardPanel) panels[0];

File configDir = wizardPanel.getSelectedLocation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ public void run() {

//compute the type off awt
ClasspathInfo cpInfo = ClasspathInfo.create(jspSup.getFileObject());
JavaSource source = JavaSource.create(cpInfo, Collections.EMPTY_LIST);
JavaSource source = JavaSource.create(cpInfo, Collections.<FileObject>emptyList());

AtomicBoolean cancel = new AtomicBoolean();
Compute<TypeElement> compute = new Compute<TypeElement>(cancel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public Collection<? extends SchedulerTask> create(Snapshot snapshot) {
if (mimeType.equals("text/html")) { //NOI18N
return Collections.singletonList(new HtmlSourceTask());
} else {
return Collections.EMPTY_LIST;
return Collections.<SchedulerTask>emptyList();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public static JavaSource createJavaSource(WebModule webModule) {
ClassPath bootCP = cpp.findClassPath(webModule.getDocumentBase(), ClassPath.BOOT);
ClassPath compileCP = cpp.findClassPath(webModule.getDocumentBase(), ClassPath.COMPILE);
ClassPath sourceCP = cpp.findClassPath(webModule.getDocumentBase(), ClassPath.SOURCE);
return JavaSource.create(ClasspathInfo.create(bootCP, compileCP, sourceCP), Collections.EMPTY_LIST);
return JavaSource.create(ClasspathInfo.create(bootCP, compileCP, sourceCP), Collections.<FileObject>emptyList());
}

private static boolean containsAnnotatedJsfResource(CompilationController parameter) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public List<String> keys() {
if (!isViewEmpty){
return Collections.singletonList(KEY_EJBS);
}else{
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ public static Servlet getActionServlet(FileObject dd) {
}

ClasspathInfo cpi = ClasspathInfo.create(dd);
JavaSource js = JavaSource.create(cpi, Collections.EMPTY_LIST);
JavaSource js = JavaSource.create(cpi, Collections.<FileObject>emptyList());
final int[] index = new int[]{-1};
js.runUserActionTask( new Task <CompilationController>(){
public void run(CompilationController cc) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected void addNotify() {
protected void removeNotify() {
super.removeNotify();

setKeys(Collections.EMPTY_SET);
setKeys(Collections.emptySet());
}

private void updateKeys() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public boolean complete(List<CompletionProposal> proposals, CompletionContext re
boolean camelCaseMatch = CamelCaseUtil.compareCamelCase(className, request.getPrefix());
if (camelCaseMatch) {
LOG.log(Level.FINEST, "Prefix matches Class's CamelCase signature. Adding."); // NOI18N
proposals.add(new CompletionItem.ConstructorItem(className, Collections.EMPTY_LIST, anchor, true));
proposals.add(new CompletionItem.ConstructorItem(className, Collections.emptyList(), anchor, true));
}

return camelCaseMatch;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ void sortOrderChanged() {
private Map<Integer, Integer> getColumnSorting() {
String sortingString = getColumnSorting(repositoryId);
if(sortingString == null || sortingString.equals("")) {
return Collections.EMPTY_MAP;
return Collections.emptyMap();
}
Map<Integer, Integer> map = new HashMap<>();
String[] sortingArray = sortingString.split(CONFIG_DELIMITER);
Expand Down Expand Up @@ -697,7 +697,7 @@ private Map<String, Integer> getPersistedColumnValues() {
String columns = getColumns(repositoryId);
String[] visibleColumns = columns.split(CONFIG_DELIMITER); // NOI18N
if(visibleColumns.length <= 1) {
return Collections.EMPTY_MAP;
return Collections.emptyMap();
}
Map<String, Integer> ret = new HashMap<String, Integer>();
for (int i = 0; i < visibleColumns.length; i=i+2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public DockerContainerDetail(String name, DockerContainer.Status status, boolean
this.status = status;
this.stdin = stdin;
this.tty = tty;
this.portMappings = Collections.EMPTY_LIST;
this.portMappings = Collections.emptyList();
}

public DockerContainerDetail(String name, DockerContainer.Status status, boolean stdin, boolean tty, List<PortMapping> portMappings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public CompletionJList(int maxVisibleRowCount, MouseListener mouseListener, JTex
setFont(editorComponent.getFont());
setLayoutOrientation(JList.VERTICAL);
setFixedCellHeight(fixedItemHeight = Math.max(CompletionLayout.COMPLETION_ITEM_HEIGHT, getFontMetrics(getFont()).getHeight()));
setModel(new Model(Collections.EMPTY_LIST));
setModel(new Model(Collections.emptyList()));
setFocusable(false);

renderComponent = new RenderComponent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private Collection<? extends VCSHookFactory> getFactories() {
hooksResult = Lookup.getDefault().lookupResult(VCSHookFactory.class);
}
if(hooksResult == null) {
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
Collection<VCSHookFactory> c = (Collection<VCSHookFactory>) Lookup.getDefault().lookupAll(VCSHookFactory.class);
return hooksResult.allInstances();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class MatchedStyles {
}
Collections.reverse(matchedRules);
} else {
matchedRules = Collections.EMPTY_LIST;
matchedRules = Collections.emptyList();
}
/* TODO: After it's needed, follow the most recent spec.
if (styles.containsKey("pseudoElements")) { // NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class PropertyInfo {
name = (String)propertyInfo.get("name"); // NOI18N
JSONArray longHandsArray = (JSONArray)propertyInfo.get("longhands"); // NOI18N
if (longHandsArray == null) {
longhands = Collections.EMPTY_LIST;
longhands = Collections.emptyList();
} else {
longhands = (List<String>)longHandsArray;
}
Expand All @@ -57,7 +57,7 @@ public class PropertyInfo {
*/
PropertyInfo(String name) {
this.name = name;
this.longhands = Collections.EMPTY_LIST;
this.longhands = Collections.emptyList();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class Rule {
media.add(new Media((JSONObject)o));
}
} else {
media = Collections.EMPTY_LIST;
media = Collections.emptyList();
}
if (rule.containsKey("selectorList")) { // NOI18N
JSONObject selectorList = (JSONObject)rule.get("selectorList"); // NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class StyleSheetBody {
this.styleSheetHeader = header;
this.styleSheetId = header.getStyleSheetId();
this.text = text;
this.rules = Collections.EMPTY_LIST;
this.rules = Collections.emptyList();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public JPopupMenu getPopupMenu() {
} catch (IOException e) {
DialogDisplayer.getDefault().notify(
new NotifyDescriptor.Message(e.getLocalizedMessage()));
allTargets = Collections.EMPTY_SET;
allTargets = Collections.emptySet();
}
String defaultTarget = null;
SortedSet<String> describedTargets = new TreeSet(Collator.getInstance());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,13 +741,13 @@ private List getOracleRecycleBinTables() {
" Setting recycle bin tables to an empty list.",
exc); // NOI18N

result = Collections.EMPTY_LIST;
result = Collections.emptyList();
} catch (AbstractMethodError ame) {
LOGGER.log(Level.WARNING, "Some older versions of the Oracle " +
" driver do not support getDatabaseMajorVersion(). " +
" Setting recycle bin tables to an empty list.",
ame); // NOI18N
result = Collections.EMPTY_LIST;
result = Collections.emptyList();
}
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ private boolean ungrabWindowAWT(ThreadReference tr, ObjectReference grabbedWindo
logger.info("Unable to release X grab, method ungrabInput not found in target VM "+VirtualMachineWrapper.description(vm));
return false;
}
XBaseWindowClass.invokeMethod(tr, ungrabInput, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
XBaseWindowClass.invokeMethod(tr, ungrabInput, Collections.<Value>emptyList(), ObjectReference.INVOKE_SINGLE_THREADED);
} catch (VMDisconnectedExceptionWrapper vmdex) {
return true; // Disconnected, all is good.
} catch (Exception ex) {
Expand Down Expand Up @@ -338,7 +338,7 @@ private boolean ungrabWindowFX(ThreadReference tr) {
logger.info("Unable to release FX X grab, no impl_getWindows() method in "+WindowClass);
return true; // We do not know whether there was any grab
}
ObjectReference windowsIterator = (ObjectReference) WindowClass.invokeMethod(tr, getWindowsMethod, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
ObjectReference windowsIterator = (ObjectReference) WindowClass.invokeMethod(tr, getWindowsMethod, Collections.<Value>emptyList(), ObjectReference.INVOKE_SINGLE_THREADED);
if (windowsIterator == null) {
return true; // We do not know whether there was any grab
}
Expand All @@ -359,12 +359,12 @@ private boolean ungrabWindowFX(ThreadReference tr) {
}

private boolean hasNext(Method hasNext, ThreadReference tr, ObjectReference iterator) throws Exception {
Value v = iterator.invokeMethod(tr, hasNext, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
Value v = iterator.invokeMethod(tr, hasNext, Collections.<Value>emptyList(), ObjectReference.INVOKE_SINGLE_THREADED);
return (v instanceof BooleanValue) && ((BooleanValue) v).booleanValue();
}

private ObjectReference next(Method next, ThreadReference tr, ObjectReference iterator) throws Exception {
return (ObjectReference) iterator.invokeMethod(tr, next, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
return (ObjectReference) iterator.invokeMethod(tr, next, Collections.<Value>emptyList(), ObjectReference.INVOKE_SINGLE_THREADED);
}

private void ungrabWindowFX(ClassType WindowClass, ObjectReference w, ThreadReference tr) throws Exception {
Expand Down Expand Up @@ -400,7 +400,7 @@ private void ungrabWindowFX(ClassType WindowClass, ObjectReference w, ThreadRefe
}
InterfaceType TKStageClass = (InterfaceType) w.virtualMachine().classesByName("com.sun.javafx.tk.TKStage").get(0);
Method ungrabFocusMethod = TKStageClass.methodsByName("ungrabFocus", "()V").get(0);
impl_peer.invokeMethod(tr, ungrabFocusMethod, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
impl_peer.invokeMethod(tr, ungrabFocusMethod, Collections.<Value>emptyList(), ObjectReference.INVOKE_SINGLE_THREADED);
if (logger.isLoggable(Level.FINE)) {
logger.fine("FX Window "+w+" was successfully ungrabbed.");
}
Expand Down Expand Up @@ -547,7 +547,7 @@ private Boolean checkXServerExc(ThreadReference tr, TOOLKIT tkt) throws ClassNot
//writeLock.lock();
ClassType ToolkitClass = (ClassType) toolkitClassesByName.get(0);
Method getDefaultToolkit = ClassTypeWrapper.concreteMethodByName(ToolkitClass, "getDefaultToolkit", "()Ljava/awt/Toolkit;");
ObjectReference toolkit = (ObjectReference) ToolkitClass.invokeMethod(tr, getDefaultToolkit, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
ObjectReference toolkit = (ObjectReference) ToolkitClass.invokeMethod(tr, getDefaultToolkit, Collections.<Value>emptyList(), ObjectReference.INVOKE_SINGLE_THREADED);

ClassType XToolkitClass;
switch (tkt) {
Expand Down Expand Up @@ -583,7 +583,7 @@ private Boolean checkXServerExc(ThreadReference tr, TOOLKIT tkt) throws ClassNot
if (getSunAwtDisableGrab == null) {
logger.fine("XToolkit.getSunAwtDisableGrab() method not found in target VM "+VirtualMachineWrapper.description(virtualMachine));
} else {
BooleanValue sunAwtDisableGrab = (BooleanValue) XToolkitClass.invokeMethod(tr, getSunAwtDisableGrab, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
BooleanValue sunAwtDisableGrab = (BooleanValue) XToolkitClass.invokeMethod(tr, getSunAwtDisableGrab, Collections.<Value>emptyList(), ObjectReference.INVOKE_SINGLE_THREADED);
if (logger.isLoggable(Level.FINE)) {
logger.fine("sunAwtDisableGrab = "+sunAwtDisableGrab.value());
}
Expand All @@ -601,7 +601,7 @@ private Boolean checkXServerExc(ThreadReference tr, TOOLKIT tkt) throws ClassNot
logger.fine("XToolkit.getDefaultRootWindow() method does not exist in the target VM "+VirtualMachineWrapper.description(virtualMachine));
return false;
}
LongValue defaultRootWindowValue = (LongValue) XToolkitClass.invokeMethod(tr, getDefaultRootWindow, Collections.EMPTY_LIST, ObjectReference.INVOKE_SINGLE_THREADED);
LongValue defaultRootWindowValue = (LongValue) XToolkitClass.invokeMethod(tr, getDefaultRootWindow, Collections.<Value>emptyList(), ObjectReference.INVOKE_SINGLE_THREADED);

// XAtom xa = new XAtom(grabCheckStr, true);
List<ReferenceType> xatomClassesByName = VirtualMachineWrapper.classesByName(virtualMachine, "sun.awt.X11.XAtom");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1719,15 +1719,15 @@ public Mirror visitEnhancedForLoop(EnhancedForLoopTree arg0, EvaluationContext e
}
Method iteratorMethod = null;
try {
iteratorMethod = getConcreteMethod(objType, "iterator", Collections.EMPTY_LIST);
iteratorMethod = getConcreteMethod(objType, "iterator", Collections.<TypeMirror>emptyList());
} catch (UnsuitableArgumentsException ex) {
}
iterator = (ObjectReference)invokeMethod(arg0, iteratorMethod, Boolean.FALSE, (ClassType)objRef.type(),
objRef, Collections.EMPTY_LIST, evaluationContext, false);
objRef, Collections.<Value>emptyList(), evaluationContext, false);
try {
ReferenceType iteratorType = iterator.referenceType();
nextMethod = getConcreteMethod(iteratorType, "next", Collections.EMPTY_LIST);
hasNextMethod = getConcreteMethod(iteratorType, "hasNext", Collections.EMPTY_LIST);
nextMethod = getConcreteMethod(iteratorType, "next", Collections.<TypeMirror>emptyList());
hasNextMethod = getConcreteMethod(iteratorType, "hasNext", Collections.<TypeMirror>emptyList());
} catch (UnsuitableArgumentsException ex) {
}
} else {
Expand All @@ -1752,12 +1752,12 @@ public Mirror visitEnhancedForLoop(EnhancedForLoopTree arg0, EvaluationContext e
index++;
} else {
value = invokeMethod(arg0, hasNextMethod, Boolean.FALSE, (ClassType)iterator.type(),
iterator, Collections.EMPTY_LIST, evaluationContext, false);
iterator, Collections.<Value>emptyList(), evaluationContext, false);
if (!((BooleanValue)value).value()) {
break;
}
value = invokeMethod(arg0, nextMethod, Boolean.FALSE, (ClassType)iterator.type(),
iterator, Collections.EMPTY_LIST, evaluationContext, false);
iterator, Collections.<Value>emptyList(), evaluationContext, false);
}
scriptVar.setValue(value); // [TODO] check if value is assignable to variable
try {
Expand Down Expand Up @@ -5496,7 +5496,7 @@ public List<Method> methodsByName(String string, String string1) {

@Override
public List<ReferenceType> nestedTypes() {
return Collections.EMPTY_LIST;
return Collections.<ReferenceType>emptyList();
}

@Override
Expand Down Expand Up @@ -5600,7 +5600,7 @@ public String defaultStratum() {

@Override
public List<ObjectReference> instances(long l) {
return Collections.EMPTY_LIST;
return Collections.<ObjectReference>emptyList();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,12 +586,12 @@ private static ObjectReference createObjectOfType(ClassType type, VirtualMachine
ObjectReference objectConstructor = (ObjectReference)
ObjectReferenceWrapper.invokeMethod(objectClass, thread,
getDeclaredConstructorMethod,
Collections.EMPTY_LIST,
Collections.<Value>emptyList(),
ClassType.INVOKE_SINGLE_THREADED);
ObjectReference rf = (ObjectReference)
ClassTypeWrapper.invokeMethod(reflectionFactoryType, thread,
getReflectionFactoryMethod,
Collections.EMPTY_LIST,
Collections.<Value>emptyList(),
ClassType.INVOKE_SINGLE_THREADED);
ObjectReference constructor = (ObjectReference)
ObjectReferenceWrapper.invokeMethod(rf, thread,
Expand All @@ -610,11 +610,11 @@ private static ObjectReference createObjectOfType(ClassType type, VirtualMachine
ObjectReference newInstance = (ObjectReference)
ObjectReferenceWrapper.invokeMethod(constructor, thread,
newInstanceMethod,
Collections.EMPTY_LIST,
Collections.<Value>emptyList(),
ClassType.INVOKE_SINGLE_THREADED);
return newInstance;
} else {
return ClassTypeWrapper.newInstance(type, thread, c, Collections.EMPTY_LIST, ClassType.INVOKE_SINGLE_THREADED);
return ClassTypeWrapper.newInstance(type, thread, c, Collections.<Value>emptyList(), ClassType.INVOKE_SINGLE_THREADED);
}
}

Expand Down
Loading

0 comments on commit 36cfe28

Please sign in to comment.