Project: clover
Issue CLOV-1401: Clover fails to instrument generic type with a constructor reference
This works fine: {code:java} myLambda = ArrayList::new; // javac error since JDK8 b114 myLambda = ArrayList::new; {code} But the following: {code:java} myLambda = ArrayList::new; myLambda = ArrayList::new; {code} fails with a parser error: {noformat} ERROR: Instrumentation errorInstrumentation error : c:\Work\clover-hg\clover-core\src\test\resources\javasyntax1.8\LambdaAndMethodReferences.java:78:28:unexpected token: ArrayList com.atlassian.clover.api.CloverException: c:\Work\clover-hg\clover-core\src\test\resources\javasyntax1.8\LambdaAndMethodReferences.java:78:28:unexpected token: ArrayList com.atlassian.clover.instr.java.Instrumenter.instrument(Instrumenter.java:158) com.atlassian.clover.CloverInstr.execute(CloverInstr.java:73) com.atlassian.clover.CloverInstr.mainImpl(CloverInstr.java:49) com.atlassian.clover.JavaSyntaxCompilationTestBase.instrumentSourceFile(JavaSyntaxCompilationTestBase.java:145) com.atlassian.clover.JavaSyntaxCompilationTestBase.instrumentAndCompileSourceFile(JavaSyntaxCompilationTestBase.java:111) com.atlassian.clover.JavaSyntax18CompilationTest.testLambdaAndMethodReferences(JavaSyntax18CompilationTest.java:84) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:483) junit.framework.TestCase.runTest(TestCase.java:168) junit.framework.TestCase.runBare(TestCase.java:134) junit.framework.TestResult$1.protect(TestResult.java:110) junit.framework.TestResult.runProtected(TestResult.java:128) junit.framework.TestResult.run(TestResult.java:113) junit.framework.TestCase.run(TestCase.java:124) junit.framework.TestSuite.runTest(TestSuite.java:243) junit.framework.TestSuite.run(TestSuite.java:238) org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83) org.junit.runner.JUnitCore.run(JUnitCore.java:157) com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77) com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:483) com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: line 78:28: unexpected token: ArrayList com.atlassian.clover.instr.java.JavaRecognizer.conditionalExpression(JavaRecognizer.java:4407) com.atlassian.clover.instr.java.JavaRecognizer.assignmentExpression(JavaRecognizer.java:4274) com.atlassian.clover.instr.java.JavaRecognizer.assignmentExpression(JavaRecognizer.java:4319) com.atlassian.clover.instr.java.JavaRecognizer.expression(JavaRecognizer.java:3366) com.atlassian.clover.instr.java.JavaRecognizer.statement(JavaRecognizer.java:2909) com.atlassian.clover.instr.java.JavaRecognizer.outerCompoundStmt(JavaRecognizer.java:2696) com.atlassian.clover.instr.java.JavaRecognizer.field(JavaRecognizer.java:2265) com.atlassian.clover.instr.java.JavaRecognizer.classBlock(JavaRecognizer.java:1728) com.atlassian.clover.instr.java.JavaRecognizer.classDefinition(JavaRecognizer.java:736) com.atlassian.clover.instr.java.JavaRecognizer.typeDefinition2(JavaRecognizer.java:666) com.atlassian.clover.instr.java.JavaRecognizer.typeDefinition(JavaRecognizer.java:524) com.atlassian.clover.instr.java.JavaRecognizer.compilationUnit(JavaRecognizer.java:445) com.atlassian.clover.instr.java.Instrumenter.instrument(Instrumenter.java:212) com.atlassian.clover.instr.java.Instrumenter.instrument(Instrumenter.java:121)	... 27 more {noformat}
Story points: 8