groovy-eclipse
groovy-eclipse copied to clipboard
Invalid warning about redundant specification of type arguments with anonymous inner classes
Ensure the following option is set to warning or above: Right click on project => Properties | Java Compiler | Errors/Warnings | Enable project specific settings | Redundant type arguments (1.7 or higher), under Generic types.
Consider this:
package testdiamond
class TestDiamond {
ArrayList<String> list = new ArrayList<String>() {
}
}
Greclipse compiler shows a warning on new ArrayList<String> saying:
Redundant specification of type arguments <String>
However, if you change that line to:
ArrayList<String> list = new ArrayList<>() {
this of course produces an error, because:
Cannot use diamond <> with anonymous inner classes