Community
Participate
Working Groups
This bug is supported to serve as a placeholder for fixing simple warnings in the platform code. These changes are very welcome as they help us to maintain a clean code basis but we want to avoid a flush of new bug reports for every warning. I suggest that such changes are NOT added to the copyright header to avoid to pollute it with such minor changes.
I don't know if it is considered a simple warning, but it was about an unchecked casting that could possibly lead to a ClassCastException. In fact, it is possible to have elements that are not Strings, like in the example found here: http://stackoverflow.com/questions/17174026/javas-properties-differences-between-propertynames-and-stringpropertynames Because the specified execution environment (Java 1.5) doesn't have implemented stringPropertyNames(), it wasn't possible to use it. Here is the review: https://git.eclipse.org/r/#/c/22285/ I apologize if I should have opened a new issue. In this case, I can update my patch. Thanks in advance.
(In reply to Jeanderson Candido from comment #1) > Because the specified execution environment (Java 1.5) doesn't have > implemented stringPropertyNames(), it wasn't possible to use it. Does is help if I upgrade JFace to 1.6?
(In reply to Lars Vogel from comment #2) > (In reply to Jeanderson Candido from comment #1) > > Because the specified execution environment (Java 1.5) doesn't have > > implemented stringPropertyNames(), it wasn't possible to use it. > > Does is help if I upgrade JFace to 1.6? If there's no problem, I think it would be better, because it wouldn't be necessary to allocate an ArrayList as an "mediator" to have a static array of Strings. Also, we wouldn't have to care about checking object's type since stringPropertyName is tied to a set of Strings.
(In reply to Jeanderson Candido from comment #3) > (In reply to Lars Vogel from comment #2) > > (In reply to Jeanderson Candido from comment #1) > > > Because the specified execution environment (Java 1.5) doesn't have > > > implemented stringPropertyNames(), it wasn't possible to use it. > > > > Does is help if I upgrade JFace to 1.6? > > If there's no problem, I think it would be better, because it wouldn't be > necessary to allocate an ArrayList as an "mediator" to have a static array > of Strings. Also, we wouldn't have to care about checking object's type > since stringPropertyName is tied to a set of Strings. org.eclipse.jface has now been upgraded to Java 1.6 in master. Please update your Gerrit review
Lars, changing to Java 1.6 caused some warnings in the code (e.g. implemented methods should use @Override). Is it okay if I update my review and create another one to fix these new warnings (e.g. add @Override on implemented methods)?
(In reply to Lars Vogel from comment #4) > (In reply to Jeanderson Candido from comment #3) > > (In reply to Lars Vogel from comment #2) > > > (In reply to Jeanderson Candido from comment #1) > > > > Because the specified execution environment (Java 1.5) doesn't have > > > > implemented stringPropertyNames(), it wasn't possible to use it. > > > > > > Does is help if I upgrade JFace to 1.6? > > > > If there's no problem, I think it would be better, because it wouldn't be > > necessary to allocate an ArrayList as an "mediator" to have a static array > > of Strings. Also, we wouldn't have to care about checking object's type > > since stringPropertyName is tied to a set of Strings. > > org.eclipse.jface has now been upgraded to Java 1.6 in master. Please update > your Gerrit review I updated the review. I believe changing to Java 1.6 will not affect other projects.
Removed warnings from AbstractAction: https://git.eclipse.org/r/#/c/22333/
Removed Warnings from ProgressMonitorPart: https://git.eclipse.org/r/22335
(In reply to Jeanderson Candido from comment #7) > Removed warnings from AbstractAction: https://git.eclipse.org/r/#/c/22333/ Thanks. Applied with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=2be6ebb15c991c7a168d0c6c3930acdfb5785fe3
PreferenceStore fixed with https://git.eclipse.org/r/#/c/22285/
Class org.eclipse.jface.action.Separator has something a little weird: Method #1 ---------------- public void fill(Menu menu, int index) { if (index >= 0) { new MenuItem(menu, SWT.SEPARATOR, index); } else { new MenuItem(menu, SWT.SEPARATOR); } } ---------------- Method #2 ---------------- public void fill(ToolBar toolbar, int index) { if (index >= 0) { new ToolItem(toolbar, SWT.SEPARATOR, index); } else { new ToolItem(toolbar, SWT.SEPARATOR); } } ---------------- What's the meaning of creating an object and not keep its reference or returning it? Is it really supposed to work like this? Regards
That's completely legal code and nothing to worry about
(In reply to Jeanderson Candido from comment #11) > Class org.eclipse.jface.action.Separator has something a little weird: > > Method #1 > ---------------- > public void fill(Menu menu, int index) { > if (index >= 0) { > new MenuItem(menu, SWT.SEPARATOR, index); > } else { > new MenuItem(menu, SWT.SEPARATOR); > } > } > ---------------- > > Method #2 > ---------------- > public void fill(ToolBar toolbar, int index) { > if (index >= 0) { > new ToolItem(toolbar, SWT.SEPARATOR, index); > } else { > new ToolItem(toolbar, SWT.SEPARATOR); > } > } > ---------------- > > What's the meaning of creating an object and not keep its reference or > returning it? Is it really supposed to work like this? > > Regards The menu item is inserted in the menu so the code is OK.
Reduced warnings in AboutPluginsPage: https://git.eclipse.org/r/#/c/22558/
Resolved all warnings in AboutBundleData https://git.eclipse.org/r/22571
*** Bug 413611 has been marked as a duplicate of this bug. ***
Patch https://git.eclipse.org/r/#/c/22285/ has been updated. Now it only contains code changes.
(In reply to Jeanderson Candido from comment #17) > Patch https://git.eclipse.org/r/#/c/22285/ has been updated. > Now it only contains code changes. Thanks applied with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=c88f1112a3569cf9232a90fac548c58af269a5a2
(In reply to Matthias Mailänder from comment #15) > Resolved all warnings in AboutBundleData https://git.eclipse.org/r/22571 Thanks, applied with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=26159c418417325015fc97d686a6fac7082c1eca
ViewContentProvider fixed with https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=8ec4f74dc0c3acc478f6dd974659cb924cb2a17d
From Sebastian http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=74f5a45cf82d7e23d1718437b6ccd8333f66f57f PW
I got a fix for this in https://git.eclipse.org/r/#/c/23580/
From Sebastian http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=37976644f590a49e4efe2d3e9540bbc90481f573 PW
From Sebastian http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=b0162eeb18bba6d75671bd08270255163cae7ac6
*** This bug has been marked as a duplicate of bug 418661 ***