groovy-eclipse icon indicating copy to clipboard operation
groovy-eclipse copied to clipboard

Invalid warning about redundant specification of type arguments with anonymous inner classes

Open mauromol opened this issue 3 years ago • 0 comments

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

mauromol avatar Apr 22 '22 14:04 mauromol