[NETBEANS-4458] - enable use of generics#2194
Conversation
neilcsmith-net
left a comment
There was a problem hiding this comment.
-1 as of now. This is not a compatible change. Needs proper review / plan, particularly for anything that is public API. @matthiasblaesing made this point already in #1377
platform/openide.nodes/src/org/openide/cookies/InstanceCookie.java
Outdated
Show resolved
Hide resolved
|
Many of the changes aren't API changes (like changing local variables and private or package private field/method types). Those can certainly be made, the other ones would deserve some more thoughts. We have just a single try to get the signatures right! However let me state that it makes no sense to reduce number of warnings without preventing the warnings to ever appear again. E.g. for each module that you want to clean up, turn on "warning as error" mode and then fix (or suppress) all the warnings in the module. Otherwise it is just a useless mangling of the source code. In my 2 Kč opinion. |
matthiasblaesing
left a comment
There was a problem hiding this comment.
I have nothing against fixing warnings, but I'd like to keep that separate from changing API. I marked two locations where I saw API, Jaroslav found another, so please check again, that only internal methods or fields are updated.
Friend modules are a bit of a stretch, while not API, I would not say they are fair game to change just because.
ide/xml.core/src/org/netbeans/modules/xml/api/model/ExtendedGrammarQuery.java
Outdated
Show resolved
Hide resolved
ide/xml.text/src/org/netbeans/modules/xml/text/navigator/base/AbstractXMLNavigatorPanel.java
Outdated
Show resolved
Hide resolved
I'm in agreement with you about this.. But, there are 10s of thousands of warnings.. I'm trying to fix things in a way that only "one thing" gets changed at a time.. That's why I'll do things like just fix the EMPTY_LIST.. I've managed to get our number of warnings down from approx. 26,000 to 19,000.. Once things get more manageable then we can start to turn on "error on warning".. Hopefully this explains my rational better.. |
d8d5715 to
0b61d12
Compare
|
One more thing.. I do try to stay away from API changes because of the previously mentioned comments. FYI.. |
matthiasblaesing
left a comment
There was a problem hiding this comment.
Sorry :-) I left two inline comments.
| } | ||
|
|
||
| synchronized List /*<JavaClass>*/ createClassCollection() { | ||
| synchronized List/*<JavaClass>*/ createClassCollection() { |
There was a problem hiding this comment.
This is package private - I would not consider this API, so could be made generic and then the callsite of this function could be generified.
There was a problem hiding this comment.
This is package private - I would not consider this API, so could be made generic and then the callsite of this function could be generified.
Fixed..
| //~ Instance fields ---------------------------------------------------------------------------------------------------------- | ||
|
|
||
| protected List/*<Runnable>*/ afterBatchCommands = new ArrayList<>(); | ||
| protected List<Runnable> afterBatchCommands = new ArrayList<>(); |
There was a problem hiding this comment.
This is a friend API.
There was a problem hiding this comment.
This is a friend API.
fixed..
A lot of places in the code has generic use commented out.. For example, the following in
LayoutModel.java
public void unsetSameSize(List/*<String>*/ components, int dimension) {
Iterator i = components.iterator();
while (i.hasNext()) {
String cid = (String)i.next();
LayoutComponent lc = getLayoutComponent(cid);
removeComponentFromLinkSizedGroup(lc, dimension);
}
}
All I've done here is enable it to reduce the warnings and test out the code to make sure it works correctly.
0b61d12 to
534be04
Compare
Should be fixed.. |
|
|
||
| private WizardDescriptor wizardDescriptor; | ||
|
|
||
| private final Set/*<ChangeListener>*/ listeners = new HashSet(1); |
There was a problem hiding this comment.
HashSet of size 1 is probably a non-sense. By default it has 75% fill ratio and then it is rehashed.E.g. as soon as first item is added, the set is probably rehashed.
There was a problem hiding this comment.
HashSetof size 1 is probably a non-sense.
Just a follow-up comment in case someone comes across this bug report in the future.. I completely agree with your comment! My goal is simply to try and stay away from any "potential" source changes that could be behavioral. Even ones as small as this. Hope that explains why I do what I do..
|
The current state is integratable, as far as I can say. |
matthiasblaesing
left a comment
There was a problem hiding this comment.
Looks sane - lets get this in :-)
|
Hey @junichi11 , how can I add the "code cleanup" label? I don't seem to have permission.. |
|
@BradWalker Well, only committer... So, if you would like to add a label, please ask someone (e.g. reviewer). I add it when I notice it is missing. |
A lot of places in the code has generic use commented out.. For example, the following in
LayoutModel.java
All I've done here is enable it to reduce the warnings and test out the code to make sure it works correctly.