Skip to content

Commit

Permalink
Removed a lot of compiler warnings (#5487)
Browse files Browse the repository at this point in the history
Inserted diamond in constructions like this:
ArrayList<Strings> = new ArrayList();
No any interfaces was changed
  • Loading branch information
tbw777 authored Feb 14, 2023
1 parent 5297579 commit 55430b4
Show file tree
Hide file tree
Showing 272 changed files with 523 additions and 523 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public class NbMoveRefactoringPlugin extends AbstractRefactoringPlugin {
private EditableManifest targetManifest;

private Map packagePostfix = new HashMap();
ArrayList<FileObject> filesToMove = new ArrayList();
ArrayList<FileObject> filesToMove = new ArrayList<>();
HashMap<FileObject,ElementHandle> classes;

/**
Expand Down Expand Up @@ -647,7 +647,7 @@ private String concat(String s1, String s2, String s3) {
}

private void initClasses() {
classes = new HashMap();
classes = new HashMap<>();
for (int i=0;i<filesToMove.size();i++) {
final int j = i;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ protected void sendInitCommands() throws Exception {

private class Tabs {

private HashMap<String, TabDescriptor> map = new HashMap();
private HashMap<String, TabDescriptor> map = new HashMap<>();
private Object monitor = new Object();
private boolean inited = false;

Expand All @@ -365,7 +365,7 @@ public boolean update(NSObject r) throws Exception {
}
boolean wasEmpty = map.isEmpty();
boolean connectionUrlFound = false;
HashMap<String, TabDescriptor> currentMap = new HashMap();
HashMap<String, TabDescriptor> currentMap = new HashMap<>();
for (String s : listing.allKeys()) {
NSDictionary o = (NSDictionary) listing.objectForKey(s);
NSObject identifier = o.objectForKey("WIRPageIdentifierKey"); // NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void testListing() throws ParserConfigurationException, SAXException, IOE

class Tabs {

private HashMap<String, TabDescriptor> map = new HashMap();
private HashMap<String, TabDescriptor> map = new HashMap<>();

public void update(InputStream is) throws Exception {
NSDictionary root = (NSDictionary) XMLPropertyListParser.parse(is);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static String buildPath(List<URL> path) {
* @return A tokenization of the specified path into the list of URLs.
*/
public static List<URL> tokenizePath(String path) {
List<URL> l = new ArrayList();
List<URL> l = new ArrayList<>();
StringTokenizer tok = new StringTokenizer(path, ":;", true); // NOI18N
char dosHack = '\0';
char lastDelim = '\0';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ private void initLibrariesForWLS() {
library.setContent(J2eeLibraryTypeProvider.VOLUME_TYPE_CLASSPATH, list);
File j2eeDoc = InstalledFileLocator.getDefault().locate(J2EE_API_DOC, null, false);
if (j2eeDoc != null) {
list = new ArrayList();
list = new ArrayList<>();
addFileToList(list, j2eeDoc);
library.setContent(J2eeLibraryTypeProvider.VOLUME_TYPE_JAVADOC, list);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public Object getElementAt(int index) {

private synchronized List getData() {
if (data == null) {
data = new ArrayList();
data = new ArrayList<>();
LibraryImplementation[] libImpl = platform.getLibraries();
for (int i = 0; i < libImpl.length; i++) {
data.addAll(libImpl[i].getContent(type));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public String getSystemID(String publicId) {

private synchronized Map<String, String> getLocalSchemaDefs() {
if (localSchemaDefs == null) {
localSchemaDefs = new HashMap();
localSchemaDefs = new HashMap<>();
localSchemaDefs.putAll(getSchemaLocations(true));
}
return localSchemaDefs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,7 @@ public static void save(WSDLComponent c) {
}

public static synchronized void save(WSDLModel model) {
Set<FileObject> traversedModels = new HashSet();
Set<FileObject> traversedModels = new HashSet<>();
save(model, traversedModels);
}

Expand Down Expand Up @@ -788,7 +788,7 @@ static void moveCurrentConfig(Binding b, ConfigVersion currentCfgVersion, Config

// STS
boolean sts = ProprietarySecurityPolicyModelHelper.isSTSEnabled(b);
List<ServiceProviderElement> sProviderElems = new ArrayList();
List<ServiceProviderElement> sProviderElems = new ArrayList<>();
String issuer = null;
String contract = null;
String lifetime = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void testSecurityProfilesLayout() throws Exception {

for (ConfigVersion cfgV : ConfigVersion.values()) {
String cfgStr = ConfigVersion.CONFIG_1_0.equals(cfgV) ? "10-" : "13-";
ArrayList<String> profiles = new ArrayList();
ArrayList<String> profiles = new ArrayList<>();
PolicyModelHelper.setConfigVersion(b, cfgV, null);
for (SecurityProfile sP : secProfiles) {
if (sP.isProfileSupported(null, b, false)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public String getSystemID(String publicId) {

private synchronized Map<String, String> getLocalSchemaDefs() {
if (localSchemaDefs == null) {
localSchemaDefs = new HashMap();
localSchemaDefs = new HashMap<>();
localSchemaDefs.putAll(Addressing10QName.ADDRESS.getSchemaLocations(true));
localSchemaDefs.putAll(Addressing10WsdlQName.USINGADDRESSING.getSchemaLocations(true));
localSchemaDefs.putAll(Addressing13WsdlQName.ADDRESSING.getSchemaLocations(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public class VulnerabilityWorker implements ErrorProvider{
private static final String GOV_DETAIL_URL = "https://nvd.nist.gov/vuln/detail/";

// @GuardedBy(self)
private static final HashMap<Project, CacheItem> cache = new HashMap();
private static final HashMap<Project, CacheItem> cache = new HashMap<>();

// @GuardedBy(class)
private static VulnerabilityWorker instance;
Expand Down Expand Up @@ -160,7 +160,7 @@ public List<ApplicationDependencyVulnerabilitySummary> getVulnerabilities() {

public Map<String, Dependency> getDependencyMap() {
if (dependencyMap == null) {
dependencyMap = new HashMap();
dependencyMap = new HashMap<>();
buildDependecyMap(dependencyResult.getRoot(), dependencyMap);
}
return dependencyMap;
Expand All @@ -179,7 +179,7 @@ public Set<FileObject> getProblematicFiles() {
if (getAudit().getIsSuccess()) {
return Collections.EMPTY_SET;
}
Set<FileObject> result = new HashSet();
Set<FileObject> result = new HashSet<>();
for (ApplicationDependencyVulnerabilitySummary v: getVulnerabilities()){
List<Vulnerability> vulnerabilities = v.getVulnerabilities();
if (!vulnerabilities.isEmpty()) {
Expand Down Expand Up @@ -276,7 +276,7 @@ public List<Diagnostic> getDiagnosticsForFile(FileObject file) {
return null;
}

List<Diagnostic> result = new ArrayList();
List<Diagnostic> result = new ArrayList<>();
for (ApplicationDependencyVulnerabilitySummary v: getVulnerabilities()){
List<Vulnerability> vulnerabilities = v.getVulnerabilities();
if (!vulnerabilities.isEmpty()) {
Expand Down Expand Up @@ -401,7 +401,7 @@ public String findVulnerability(Project project, AuditOptions auditOptions) thro

private String doFindVulnerability(Project project, String compartmentId, String knowledgeBaseId, String projectDisplayName, AuditOptions auditOptions,
ProgressHandle progressHandle, AtomicBoolean remoteCall) throws AuditException {
List<ApplicationDependency> result = new ArrayList();
List<ApplicationDependency> result = new ArrayList<>();

CacheItem cacheItem = null;
VulnerabilityReport savedAudit = null;
Expand Down Expand Up @@ -504,7 +504,7 @@ private String doFindVulnerability(Project project, String compartmentId, String
cache.put(project, cacheItem);
}

Set<FileObject> problematicFiles = new HashSet();
Set<FileObject> problematicFiles = new HashSet<>();
problematicFiles.addAll(cacheItem.getProblematicFiles());

String message;
Expand Down Expand Up @@ -545,7 +545,7 @@ private int convert(Dependency dependency, Map<String, Integer> gavIndex, List<A
builder.gav(gav);
builder.nodeId(Integer.toString(n));

List<String> childrenNodeIds = new ArrayList(dependency.getChildren().size());
List<String> childrenNodeIds = new ArrayList<>(dependency.getChildren().size());
for (Dependency childDependency : dependency.getChildren()) {
int cid = convert(childDependency, gavIndex, result);
childrenNodeIds.add(Integer.toString(cid));
Expand Down Expand Up @@ -640,7 +640,7 @@ private CacheItem fetchVulnerabilityItems(Project project, ApplicationDependency

@Override
public List<? extends Diagnostic> computeErrors(Context context) {
List<Diagnostic> result = new ArrayList();
List<Diagnostic> result = new ArrayList<>();
Collection<CacheItem> items;

synchronized (cache) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public File[] getClasspathEntries(Set<ServerLibraryDependency> libraries) {
}

private List<File> getClasspath(LibraryImplementation[] libraries) {
List<File> classpath = new ArrayList();
List<File> classpath = new ArrayList<>();
for (int i = 0; i < libraries.length; i++) {
List classpathList = libraries[i].getContent(J2eeLibraryTypeProvider.VOLUME_TYPE_CLASSPATH);
for (Iterator iter = classpathList.iterator(); iter.hasNext();) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public boolean supportsModuleType(J2eeModule.Type type) {
private Map<String, String[]> deployConfigDescriptorMap;

private final void initDeploymentConfigurationFileList(FileObject fo) {
deployConfigDescriptorMap = new HashMap();
deployConfigDescriptorMap = new HashMap<>();
FileObject deplFNames = fo.getFileObject(LAYER_DEPLOYMENT_FILE_NAMES);
if (deplFNames != null) {
FileObject mTypes [] = deplFNames.getChildren();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public ServerFileDistributor(ServerInstance instance, DeploymentTarget dtarget){
private static Map<J2eeModule.Type, List<String>> j2eeTypeMap = null;
static synchronized List getDescriptorPath(J2eeModule module) {
if (j2eeTypeMap == null) {
j2eeTypeMap = new HashMap();
j2eeTypeMap = new HashMap<>();
j2eeTypeMap.put(J2eeModule.Type.EJB,
Arrays.asList(new String[]{J2eeModule.EJBJAR_XML, J2eeModule.EJBSERVICES_XML}));
j2eeTypeMap.put(J2eeModule.Type.WAR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ private Map<String, String> cleanInitialProperties(Map<String, String> initialPr
return Collections.<String, String>emptyMap();
}

Map<String,String> properties = new HashMap(initialProperties);
Map<String,String> properties = new HashMap<>(initialProperties);
properties.remove(InstanceProperties.URL_ATTR);
properties.remove(InstanceProperties.USERNAME_ATTR);
properties.remove(InstanceProperties.PASSWORD_ATTR);
Expand Down Expand Up @@ -593,9 +593,9 @@ private void initConfigNamesByType() {
if (configNamesByType != null) {
return;
}
configNamesByType = new HashMap();
configNamesByType = new HashMap<>();
for (int i = 0 ; i < ALL_TYPES.length; i++) {
Set<String> configNames = new HashSet();
Set<String> configNames = new HashSet<>();
for (Iterator j=servers.values().iterator(); j.hasNext();) {
Server s = (Server) j.next();
String[] paths = s.getDeploymentPlanFiles(ALL_TYPES[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

public class ServerProgress implements ProgressObject {
private Object server;
private List<ProgressListener> listeners = new CopyOnWriteArrayList();
private List<ProgressListener> listeners = new CopyOnWriteArrayList<>();
private DeploymentStatus status;

/** Creates a new instance of StartServerProgress */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static String buildPath(List<URL> path) {
* @return A tokenization of the specified path into the list of URLs.
*/
public static List<URL> tokenizePath(String path) {
List<URL> l = new ArrayList();
List<URL> l = new ArrayList<>();
StringTokenizer tok = new StringTokenizer(path, ":;", true); // NOI18N
char dosHack = '\0';
char lastDelim = '\0';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public enum PayaraContainer implements Comparator<PayaraContainer> {
* conversion.
*/
private static final Map<String, PayaraContainer> stringValuesMap
= new HashMap(2 * values().length);
= new HashMap<>(2 * values().length);

// Initialize backward String conversion Map.
static {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public static String buildPath(List<URL> path) {
* @return A tokenization of the specified path into the list of URLs.
*/
public static List<URL> tokenizePath(String path) {
List<URL> l = new ArrayList();
List<URL> l = new ArrayList<>();
StringTokenizer tok = new StringTokenizer(path, ":;", true); // NOI18N
char dosHack = '\0';
char lastDelim = '\0';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public static boolean pingTomcat(int port, int timeout, String serverHeader, Str
if (text == null || !text.startsWith("HTTP/")) { // NOI18N
return false; // not an http response
}
Map<String, List<String>> headerFileds = new HashMap();
Map<String, List<String>> headerFileds = new HashMap<>();
while ((text = in.readLine()) != null && text.length() > 0) {
int colon = text.indexOf(":");
if (colon <= 0) {
Expand All @@ -88,7 +88,7 @@ public static boolean pingTomcat(int port, int timeout, String serverHeader, Str
String value = text.substring(colon + 1).trim();
List<String> list = headerFileds.get(name);
if (list == null) {
list = new ArrayList();
list = new ArrayList<>();
headerFileds.put(name, list);
}
list.add(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected BaseKit getEditorKit(String mimeType) {
public final void initParserJARs() throws MalformedURLException {
String path = System.getProperty("jsp.parser.jars");
String[] paths = PropertyUtils.tokenizePath(path);
List<URL> list = new ArrayList();
List<URL> list = new ArrayList<>();
for (int i = 0; i< paths.length; i++) {
String token = paths[i];
File f = new File(token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public static void gc() {
System.gc();
}

private static final Map<FileObject,Integer> loadCount = new WeakHashMap();
private static final Map<FileObject,Integer> loadCount = new WeakHashMap<>();

/**
* Check how many times {@link ProjectFactory#loadProject} has been called
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public ResourcesMappingModelTest(String name) {
@Test
public void testParseResourceFromString() throws Exception {
String resString = "stylesheet@test.css:;script@file.js:jsLib";
List<ResourcesMappingModel.Resource> resources = new ArrayList(ResourcesMappingModel.parseResourcesFromString(resString));
List<ResourcesMappingModel.Resource> resources = new ArrayList<>(ResourcesMappingModel.parseResourcesFromString(resString));
assertEquals(2, resources.size());

ResourcesMappingModel.Resource res1 = resources.get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public HelpCtx getHelpCtx() {
return new HelpCtx("org.netbeans.modules.web.jsf.wizards.ManagedBeanPanelVisual");
}

private final Set<ChangeListener> listeners = new HashSet(1);
private final Set<ChangeListener> listeners = new HashSet<>(1);

public final void addChangeListener(ChangeListener l) {
synchronized (listeners) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class TemplatePanelVisual extends javax.swing.JPanel implements HelpCtx.P
private static final long serialVersionUID = 1L;
private static final String RESOURCES_FOLDER="org/netbeans/modules/web/jsf/facelets/resources/templates/"; //NOI18N

private final Map<Integer, JRadioButton> templateButtonMapping = new HashMap();
private final Map<Integer, JRadioButton> templateButtonMapping = new HashMap<>();

/** Creates new form TemplatePanelVisual */
public TemplatePanelVisual() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void testInputStream() throws Exception {
File outFile = new File(getWorkDir(), "faces-modification.xml");
FileWriter fWriter = new FileWriter(outFile);
modifications.addDifference(fileObject, difference);
List<Difference> differences = new LinkedList();
List<Difference> differences = new LinkedList<>();
differences.add(difference);
modifications.commit(fileObject, differences, fWriter);
fWriter.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public static void initParserJARs() throws MalformedURLException {
public static List<URL> getJARs(String propertyName) throws MalformedURLException {
String path = System.getProperty(propertyName);
String[] paths = PropertyUtils.tokenizePath(path);
List<URL> list = new ArrayList();
List<URL> list = new ArrayList<>();
for (int i = 0; i< paths.length; i++) {
String token = paths[i];
File f = new File(token);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public static void gc() {
System.gc();
}

private static final Map<FileObject,Integer> loadCount = new WeakHashMap();
private static final Map<FileObject,Integer> loadCount = new WeakHashMap<>();

/**
* Check how many times {@link ProjectFactory#loadProject} has been called
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ public void run(WorkingCopy workingCopy) throws Exception {
List<GenerationOptions> methodOptions =
getAbstractFacadeMethodOptions(entityNames,
genericsTypeName, "entity"); //NOI18N
List<Tree> members = new ArrayList();
List<Tree> members = new ArrayList<>();
String entityClassVar = "entityClass"; //NOI18N
Tree classObjectTree = genUtils.createType("java.lang.Class<" +
genericsTypeName + ">", classElement); //NOI18N
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ public void testCollectExtraModulesTextsFromFeatures() throws IOException {
assertNotNull(texts);
assertFalse(texts.isEmpty());

List<String> expected = new ArrayList();
List<String> expected = new ArrayList<>();
expected.add("Required");
assertEquals(expected, texts);

texts = configurationPanel.collectExtraModulesTextsFromFeatures(features, false);
assertNotNull(texts);
assertFalse(texts.isEmpty());

expected = new ArrayList();
expected = new ArrayList<>();
expected.add("Recommended");
assertEquals(expected, texts);

Expand Down
Loading

0 comments on commit 55430b4

Please sign in to comment.