Fixed IllegalInstantiationCheck, so it won't recognize a constructor reference (Java8) as instantiation.
Also added a test for it.
This commit is contained in:
parent
a75e6d670f
commit
839cd1b10e
|
|
@ -190,6 +190,9 @@ public class IllegalInstantiationCheck
|
|||
*/
|
||||
private void processLiteralNew(DetailAST aAST)
|
||||
{
|
||||
if (aAST.getParent().getType() == TokenTypes.METHOD_REF) {
|
||||
return;
|
||||
}
|
||||
mInstantiations.add(aAST);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,4 +48,15 @@ public class IllegalInstantiationCheckTest
|
|||
};
|
||||
verify(checkConfig, getPath("InputSemantic.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJava8() throws Exception
|
||||
{
|
||||
final DefaultConfiguration checkConfig =
|
||||
createCheckConfig(IllegalInstantiationCheck.class);
|
||||
final String[] expected = {};
|
||||
verify(checkConfig,
|
||||
getPath("grammars/java8/InputMethodReferencesTest2.java"),
|
||||
expected);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue