mbien commented on code in PR #4331:
URL: https://github.com/apache/netbeans/pull/4331#discussion_r913397719
##########
ide/versioning.util/src/org/netbeans/modules/turbo/Turbo.java:
##########
@@ -182,7 +182,7 @@ public Object readEntry(Object key, String name) {
private Iterator providers() {
if (customProviders == null) {
Collection plugins = providers.allInstances();
- List all = new ArrayList(plugins.size() +1);
+ List<TurboProvider> all = new ArrayList(plugins.size() + 1);
Review Comment:
`<>` missing on the right
##########
enterprise/web.core.syntax/src/org/netbeans/modules/web/core/syntax/ErrorAnnotationImpl.java:
##########
@@ -151,9 +149,9 @@ public void run() {
/** Transforms ErrosInfo to Annotation
*/
- private Collection getAnnotations(ErrorInfo[] errors, StyledDocument
document) {
+ private Collection<LineSetAnnotation> getAnnotations(ErrorInfo[] errors,
StyledDocument document) {
BaseDocument doc = (BaseDocument) document;
- HashMap map = new HashMap(errors.length);
+ Map map = new HashMap(errors.length);
Review Comment:
-> `Map<Integer, LineSetAnnotation> map = new HashMap<>(errors.length);`
##########
java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/EvaluatorVisitor.java:
##########
@@ -5512,7 +5512,7 @@ public Value getValue(Field field) {
@Override
public Map<Field, Value> getValues(List<? extends Field> list) {
- List[] listByTypes = new List[types.length];
+ List<Field>[] listByTypes = new List[types.length];
Review Comment:
diamond on the right missing
##########
java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/expr/EvaluatorVisitor.java:
##########
@@ -4531,7 +4531,7 @@ private static ReferenceType
getOrLoadClass(VirtualMachine vm, String name,
String message = Bundle.MSG_IncompatibleThreadStateMessage();
InvalidExpressionException ieex = new
InvalidExpressionException(message, itsex);
throw new IllegalStateException(ieex);
- } catch (Exception ex) {
+ } catch (ClassNotLoadedException | InvalidTypeException |
InvocationException ex) {
return null;
Review Comment:
this is risky. I probably would recommend to revert this. Unless we test
this a bit more.
For example the line above throws `IllegalStateException`, which would have
been caught before with `Exception` and null would have been returned, But now
this wouldn't be caught, it would skip to the finally block and then just
propagate the exception further.
I don't know what the original intention was. Maybe it was supposed to
propagate, maybe not. So you either fixed a bug here or added one :) In any
case it would be safer to not hide this in a cleanup commit. Someone familiar
with the debugger should review this part.
##########
platform/o.n.swing.tabcontrol/src/org/netbeans/swing/tabcontrol/DefaultTabDataModel.java:
##########
@@ -365,7 +365,7 @@ public void removeTab(int index) {
*/
@Override
public void removeTabs(int start, int end) {
- java.util.List affected = new ArrayList(list.subList(start, end));
+ List affected = new ArrayList(list.subList(start, end));
Review Comment:
`<TabData>` left and `<> `right
##########
ide/api.debugger/src/org/netbeans/api/debugger/DebuggerManager.java:
##########
@@ -315,7 +315,7 @@ public DebuggerEngine[] startDebugging (DebuggerInfo info) {
}
// init DebuggerEngines
- ArrayList engineProviders = new ArrayList ();
+ List engineProviders = new ArrayList<>();
Review Comment:
`List<Object>` on the left. Since that is unfortunately the common type the
way this list is used.
##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/DebuggingTreeModel.java:
##########
@@ -494,7 +492,7 @@ public void propertyChange (PropertyChangeEvent e) {
} else {
return ;
}
- List nodes = new ArrayList();
+ List nodes = new ArrayList<>();
Review Comment:
`<Object>` on the left
##########
enterprise/j2ee.ddloaders/src/org/netbeans/modules/j2ee/ddloaders/multiview/CmpFieldsNode.java:
##########
@@ -88,11 +88,11 @@ public SectionNode getNodeForElement(Object element) {
return this;
}
} else if (element instanceof CmpField[]) {
- final List list1 = Arrays.asList(cmpFields.getCmpFields());
- final List list2 = new LinkedList<>(Arrays.asList((CmpField[])
element));
+ final List<CmpField> list1 =
Arrays.asList(cmpFields.getCmpFields());
+ final List<CmpField> list2 = new
LinkedList<>(Arrays.<CmpField>asList((CmpField[]) element));
Review Comment:
second line could be simply
`final List<CmpField> list2 = new LinkedList<>(Arrays.asList((CmpField[])
element));`
analog to the first line (no generic type for `asList()`)
##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/models/DebuggingTreeModel.java:
##########
@@ -293,8 +291,8 @@ private boolean containsThread(DVThreadGroup group,
DVThread currentThread) {
}
private Object[] getTopLevelThreadsAndGroups() {
- List result = new LinkedList();
- Set groups = new HashSet();
+ List<JPDADVThread> result = new LinkedList<>();
+ Set groups = new HashSet<>();
Review Comment:
```java
List<Object> result = new LinkedList<>();
Set<JPDADVThreadGroup> groups = new HashSet<>();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists