Skip to content

Commit 0c2b91e

Browse files
committed
some generics warnings fixed
1 parent 6605f0e commit 0c2b91e

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

visualvm/applicationviews/src/org/graalvm/visualvm/application/views/overview/OverviewViewSupport.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,29 +230,29 @@ private void updateSavedData() {
230230
snapshotsMap.clear();
231231
StringBuilder data = new StringBuilder();
232232

233-
List<SnapshotCategory> snapshotCategories = RegisteredSnapshotCategories.sharedInstance().getVisibleCategories();
234-
for (SnapshotCategory category : snapshotCategories) {
235-
Set<Snapshot> snapshots = dataSource.getRepository().getDataSources(category.getType());
233+
List<SnapshotCategory<? extends Snapshot>> snapshotCategories = RegisteredSnapshotCategories.sharedInstance().getVisibleCategories();
234+
for (SnapshotCategory<? extends Snapshot> category : snapshotCategories) {
235+
Set<? extends Snapshot> snapshots = dataSource.getRepository().getDataSources(category.getType());
236236
if (snapshots.isEmpty()) {
237237
data.append("<b>" + category.getName() + ":</b> " + snapshots.size() + "<br>"); // NOI18N
238238
} else {
239239
String categoryName = category.getName();
240240
data.append("<b>" + categoryName + ":</b> <a href='" + (LINK_TOGGLE_CATEGORY + categoryName) + "'>" + snapshots.size() + "</a><br>"); // NOI18N
241241

242242
if (isExpanded(categoryName)) {
243-
List<DataSourceDescriptor> descriptors = new ArrayList<>();
244-
Map<DataSourceDescriptor, Snapshot> dataSources = new HashMap<>();
243+
List<DataSourceDescriptor<? extends Snapshot>> descriptors = new ArrayList<>();
244+
Map<DataSourceDescriptor<? extends Snapshot>, Snapshot> dataSources = new HashMap<>();
245245

246246
for (Snapshot s : snapshots) {
247-
DataSourceDescriptor dsd = DataSourceDescriptorFactory.getDescriptor(s);
247+
DataSourceDescriptor<? extends Snapshot> dsd = DataSourceDescriptorFactory.getDescriptor(s);
248248
descriptors.add(dsd);
249249
dataSources.put(dsd, s);
250250
}
251251
Collections.sort(descriptors, Positionable.STRONG_COMPARATOR);
252252

253253
int size = snapshotsMap.size();
254254
for (int i = 0; i < descriptors.size(); i++) {
255-
DataSourceDescriptor dsd = descriptors.get(i);
255+
DataSourceDescriptor<? extends Snapshot> dsd = descriptors.get(i);
256256
Snapshot s = dataSources.get(dsd);
257257
snapshotsMap.put(i + size, s);
258258
data.append("&nbsp;&nbsp;&nbsp;<a href='" + LINK_OPEN_SNAPSHOT + (i + size) + "'>" + dsd.getName() + "</a><br>"); // NOI18N

visualvm/core/src/org/graalvm/visualvm/core/datasource/descriptor/DataSourceDescriptorFactory.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.graalvm.visualvm.core.model.ModelFactory;
3030
import org.graalvm.visualvm.core.model.ModelProvider;
3131
import org.graalvm.visualvm.core.properties.PropertiesSupport;
32+
import org.graalvm.visualvm.core.snapshot.Snapshot;
3233

3334
/**
3435
* ModelFactory for DataSourceDescriptors.
@@ -65,7 +66,7 @@ public static synchronized DataSourceDescriptorFactory getDefault() {
6566
* @param ds DataSource for which to get the descriptor.
6667
* @return DataSourceDescriptor for given DataSource.
6768
*/
68-
public static DataSourceDescriptor getDescriptor(DataSource ds) {
69+
public static <X extends DataSource> DataSourceDescriptor<X> getDescriptor(X ds) {
6970
return getDefault().getModel(ds);
7071
}
7172

visualvm/core/src/org/graalvm/visualvm/core/snapshot/RegisteredSnapshotCategories.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public final class RegisteredSnapshotCategories {
4343
private static RegisteredSnapshotCategories sharedInstance;
4444

4545
private final Set<SnapshotCategoriesListener> listeners = Collections.synchronizedSet(new HashSet<>());
46-
private final Set<SnapshotCategory> categories = Collections.synchronizedSet(new HashSet<>());
46+
private final Set<SnapshotCategory<?>> categories = Collections.synchronizedSet(new HashSet<>());
4747

4848

4949
/**
@@ -101,9 +101,9 @@ public void unregisterCategory(SnapshotCategory category) {
101101
*
102102
* @return list of registered SnapshotCategory instances to be shown in UI.
103103
*/
104-
public List<SnapshotCategory> getVisibleCategories() {
105-
List<SnapshotCategory> allCategories = new ArrayList<>(categories);
106-
List<SnapshotCategory> visibleCategories = new ArrayList<>();
104+
public List<SnapshotCategory<? extends Snapshot>> getVisibleCategories() {
105+
List<SnapshotCategory<?>> allCategories = new ArrayList<>(categories);
106+
List<SnapshotCategory<?>> visibleCategories = new ArrayList<>();
107107
for (SnapshotCategory category : allCategories)
108108
if (category.getPreferredPosition() != SnapshotCategory.POSITION_NONE)
109109
visibleCategories.add(category);

visualvm/core/src/org/graalvm/visualvm/core/ui/DataSourceCaption.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ final class DataSourceCaption<X extends DataSource> extends JPanel implements Pr
6666
private static final String APPLICATION_PID_SUFFIX = ")"; // NOI18N
6767

6868
private final DataSource dataSourceMaster;
69-
private final DataSourceDescriptor<X> dataSourceMasterDescriptor;
69+
private final DataSourceDescriptor<? extends DataSource> dataSourceMasterDescriptor;
7070

7171
private final boolean tracksChanges;
7272
private boolean isAvailable;

visualvm/coredump/src/org/graalvm/visualvm/coredump/impl/OverviewViewSupport.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,29 +115,29 @@ private String getSavedData(DataSource dataSource) {
115115
snapshotsMap.clear();
116116
StringBuilder data = new StringBuilder();
117117

118-
List<SnapshotCategory> snapshotCategories = RegisteredSnapshotCategories.sharedInstance().getVisibleCategories();
119-
for (SnapshotCategory category : snapshotCategories) {
120-
Set<Snapshot> snapshots = dataSource.getRepository().getDataSources(category.getType());
118+
List<SnapshotCategory<? extends Snapshot>> snapshotCategories = RegisteredSnapshotCategories.sharedInstance().getVisibleCategories();
119+
for (SnapshotCategory<? extends Snapshot> category : snapshotCategories) {
120+
Set<? extends Snapshot> snapshots = dataSource.getRepository().getDataSources(category.getType());
121121
if (snapshots.isEmpty()) {
122122
data.append("<b>" + category.getName() + ":</b> " + snapshots.size() + "<br>"); // NOI18N
123123
} else {
124124
String categoryName = category.getName();
125125
data.append("<b>" + categoryName + ":</b> <a href='" + (LINK_TOGGLE_CATEGORY + categoryName) + "'>" + snapshots.size() + "</a><br>"); // NOI18N
126126

127127
if (isExpanded(categoryName)) {
128-
List<DataSourceDescriptor> descriptors = new ArrayList<>();
129-
Map<DataSourceDescriptor, Snapshot> dataSources = new HashMap<>();
128+
List<DataSourceDescriptor<? extends Snapshot>> descriptors = new ArrayList<>();
129+
Map<DataSourceDescriptor<? extends Snapshot>, Snapshot> dataSources = new HashMap<>();
130130

131131
for (Snapshot s : snapshots) {
132-
DataSourceDescriptor dsd = DataSourceDescriptorFactory.getDescriptor(s);
132+
DataSourceDescriptor<? extends Snapshot> dsd = DataSourceDescriptorFactory.getDescriptor(s);
133133
descriptors.add(dsd);
134134
dataSources.put(dsd, s);
135135
}
136136
Collections.sort(descriptors, Positionable.STRONG_COMPARATOR);
137137

138138
int size = snapshotsMap.size();
139139
for (int i = 0; i < descriptors.size(); i++) {
140-
DataSourceDescriptor dsd = descriptors.get(i);
140+
DataSourceDescriptor<? extends Snapshot> dsd = descriptors.get(i);
141141
Snapshot s = dataSources.get(dsd);
142142
snapshotsMap.put(i + size, s);
143143
data.append("&nbsp;&nbsp;&nbsp;<a href='" + LINK_OPEN_SNAPSHOT + (i + size) + "'>" + dsd.getName() + "</a><br>"); // NOI18N

0 commit comments

Comments
 (0)