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

Removed a lot of compiler warnings: Part 2. Multicommit #5497

Closed
wants to merge 1 commit into from
Closed
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 @@ -104,7 +104,7 @@ public class JBDeploymentManager implements DeploymentManager {
* running state by Boolean.TRUE, stopped state Boolean.FALSE.
* WeakHashMap should guarantee erasing of an unregistered server instance bcs instance properties are also removed along with instance.
*/
private static final Map<InstanceProperties, Boolean> propertiesToIsRunning = Collections.synchronizedMap(new WeakHashMap());
private static final Map<InstanceProperties, Boolean> propertiesToIsRunning = Collections.synchronizedMap(new WeakHashMap<>());

/** Creates a new instance of JBDeploymentManager */
public JBDeploymentManager(DeploymentFactory df, String realUri,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class WildflyDeploymentManager implements DeploymentManager2 {
* instance.
*/
private static final Map<InstanceProperties, Boolean> PROPERTIES_TO_IS_RUNNING
= Collections.synchronizedMap(new WeakHashMap());
= Collections.synchronizedMap(new WeakHashMap<>());

private final DeploymentFactory df;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ private static class TomcatFormat extends org.openide.util.MapFormat {
private static final long serialVersionUID = 992972967554321415L;

public TomcatFormat(File startupScript, File homeDir) {
super(new HashMap());
super(new HashMap<>());
Map<String, String> map = getMap();
String scriptPath = startupScript.getAbsolutePath();
map.put(TAG_EXEC_CMD, scriptPath);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ public class LogManager {
private ServerLog serverLog;
private LogViewer sharedContextLogViewer;
private LogViewer juliLogViewer;
private Map<TomcatModule, TomcatModuleConfig> tomcatModuleConfigs = Collections.synchronizedMap(new WeakHashMap());
private Map<String, LogViewer> contextLogViewers = Collections.synchronizedMap(new HashMap());
private Map<TomcatModule, TomcatModuleConfig> tomcatModuleConfigs = Collections.synchronizedMap(new WeakHashMap<>());
private Map<String, LogViewer> contextLogViewers = Collections.synchronizedMap(new HashMap<>());
private TomcatManager manager;

private final Object serverLogLock = new Object();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* @author Stepan Herold
*/
public class LogSupport {
private Map<Link, Link> links = Collections.synchronizedMap(new HashMap());
private Map<Link, Link> links = Collections.synchronizedMap(new HashMap<>());
private Annotation errAnnot;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public void run(WorkingCopy workingCopy) throws Exception {
maker.Modifiers(EnumSet.of(Modifier.PUBLIC,
Modifier.ABSTRACT)),
classTree.getSimpleName(),
Arrays.asList(maker.TypeParameter(genericsTypeName,
Arrays.asList(maker.TypeParameter(genericsTypeName,
Collections.EMPTY_LIST)),
null,
Collections.EMPTY_LIST,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public static class UnixBrowserFormat extends org.openide.util.MapFormat {
* @param url to specify URL
*/
public UnixBrowserFormat (String url) {
super(new java.util.HashMap ());
super(new java.util.HashMap<>());
java.util.Map map = getMap ();
map.put (TAG_URL, url);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public static class BrowserFormat extends org.openide.util.MapFormat {
* @param library library path
*/
public BrowserFormat (String url) {
super(new HashMap());
super(new HashMap<>());
java.util.Map map = getMap ();

map.put (TAG_URL, url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected void setUp() throws Exception {
cp1 = ClassPathSupport.createClassPath(src1);
bcp1 = ClassPathSupport.createClassPath(bin1);
FooCPP.roots2cps = Collections.unmodifiableMap(
new HashMap() {
new HashMap<>() {
{
put(src1, Collections.singletonMap(FOO_SOURCES, cp1));
put(bin1, Collections.singletonMap(FOO_BINARY, bcp1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public class WSDLInlineSchemaValidator extends XsdBasedValidator {

@SuppressWarnings("unchecked")
public static final ValidationResult EMPTY_RESULT =
new ValidationResult( Collections.EMPTY_SET,
new ValidationResult( Collections.EMPTY_SET,
Collections.EMPTY_SET);

public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public String getName() {

public synchronized Schema[] getSchemas() throws SQLException {
if (schemas == null) {
schemas = new TreeMap();
schemas = new TreeMap<>();

// (if name == null)
// assuming the current catalog when the catalog name is null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public class DBMetaDataProvider {
// instead of List in order to be consistent with dbschema.

// Maps java.sql.Connection-s to DB metadata providers.
private static final Map<Connection, DBMetaDataProvider> CONN_TO_PROVIDER = new WeakHashMap();
private static final Map<Connection, DBMetaDataProvider> CONN_TO_PROVIDER = new WeakHashMap<>();

// must be a weak reference -- we don't want to prevent the connection from being GCd
// it is OK to be a weak reference -- the connection is hold strongly by the DB Explorer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ public final class NbSourceProvider {

private static final Logger LOG = Logger.getLogger(NbSourceProvider.class.getName());

private final Map<String, String> fqnToURI = Collections.synchronizedMap(new CacheMap());
private final Map<String, Source> uriToSource = Collections.synchronizedMap(new CacheMap());
private final Map<String, String> fqnToURI = Collections.synchronizedMap(new CacheMap<>());
private final Map<String, Source> uriToSource = Collections.synchronizedMap(new CacheMap<>());
private final DebugAdapterContext context;
private ClassPath sources = ClassPath.EMPTY;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ public void run(WorkingCopy workingCopy) throws Exception {
Collections.EMPTY_LIST,
extendsTree,
implementsList,
Collections.EMPTY_LIST);
Collections.EMPTY_LIST);
innerClass = make.addClassMember(innerClass, mt);
innerClass = make.addClassMember(innerClass, vt);
innerClass = make.addClassMember(innerClass, make.Block(Collections.EMPTY_LIST, false));
innerClass = make.addClassMember(innerClass, make.Block(Collections.EMPTY_LIST, false));
ClassTree modifiedClazz = make.addClassMember(clazz, innerClass);
workingCopy.rewrite(clazz, modifiedClazz);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1871,7 +1871,7 @@ public String getDisplayName() {

this.ic.addPair(l);

Collection c = lookup.lookup(new Lookup.Template(String.class)).allInstances();
Collection c = lookup.lookup(new Lookup.Template<>(String.class)).allInstances();
assertTrue("It is empty: " + c, c.isEmpty());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void resultChanged(LookupEvent ev) {
LocalFileSystem lfs = new LocalFileSystem();
InstanceDataObject i = InstanceDataObject.create (folder, null, lfs, null);
assertNull(i.getCookie(SaveCookie.class));
Lookup.Result<SaveCookie> scr = i.getLookup().lookup(new Lookup.Template(SaveCookie.class));
Lookup.Result<SaveCookie> scr = i.getLookup().lookup(new Lookup.Template(SaveCookie.class));
scr.addLookupListener(ml);
Collection<? extends SaveCookie> saveCookies = scr.allInstances();
assertFalse(saveCookies.contains(lfs));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static boolean isAquaLookAndFeel() {

private static Map<Integer, Color> DARKER_CACHE;
public static Color getDarker(Color c) {
if (DARKER_CACHE == null) DARKER_CACHE = new HashMap();
if (DARKER_CACHE == null) DARKER_CACHE = new HashMap<>();

int rgb = c.getRGB();
Color d = DARKER_CACHE.get(rgb);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public void propertyChange(PropertyChangeEvent evt) {
private Map<Integer, Integer> columnPreferredWidths;

boolean setColumnOffset(int column, int offset) {
if (columnOffsets == null) columnOffsets = new HashMap();
if (columnOffsets == null) columnOffsets = new HashMap<>();
Integer previousOffset = columnOffsets.put(column, offset);
int _previousOffset = previousOffset == null ? 0 : previousOffset.intValue();
boolean change = _previousOffset != offset;
Expand All @@ -124,7 +124,7 @@ void clearColumnsPrefferedWidth() {
}

boolean setColumnPreferredWidth(int column, int width) {
if (columnPreferredWidths == null) columnPreferredWidths = new HashMap();
if (columnPreferredWidths == null) columnPreferredWidths = new HashMap<>();
Integer previousWidth = columnPreferredWidths.put(column, width);
int _previousWidth = previousWidth == null ? 0 : previousWidth.intValue();
boolean change = _previousWidth != width;
Expand Down Expand Up @@ -157,7 +157,7 @@ void setDefaultColumnWidth(int width) {
}

void setDefaultColumnWidth(int column, int width) {
if (defaultColumnWidths == null) defaultColumnWidths = new HashMap();
if (defaultColumnWidths == null) defaultColumnWidths = new HashMap<>();
defaultColumnWidths.put(column, width);
if (isColumnVisible(column)) {
TableColumn c = getModelColumn(column);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void setDefaultSortOrder(SortOrder sortOrder) {
}

void setDefaultSortOrder(int column, SortOrder sortOrder) {
if (defaultSortOrders == null) defaultSortOrders = new HashMap();
if (defaultSortOrders == null) defaultSortOrders = new HashMap<>();
defaultSortOrders.put(column, sortOrder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ protected void fireTreeStructureChanged(Object source, Object[] path,


private List filteredChildren(Object parent) {
if (cache == null) cache = new HashMap();
if (cache == null) cache = new HashMap<>();

TreeNode tParent = (TreeNode)parent;
TreePathKey parentKey = new TreePathKey(getPathToRoot(tParent));
Expand Down Expand Up @@ -1067,7 +1067,7 @@ protected void fireTreeStructureChanged(Object source, Object[] path,


private int[] viewToModel(Object parent) {
if (viewToModel == null) viewToModel = new HashMap();
if (viewToModel == null) viewToModel = new HashMap<>();

TreePathKey parentKey = new TreePathKey(getPathToRoot((TreeNode)parent));
int[] indexes = viewToModel.get(parentKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public final class LogReader {

public LogReader(FileObject f) {
logFile = f;
recordList = new TreeMap();
recordList = new TreeMap<>();
}


Expand Down