Uploaded image for project: 'Clover'
  1. Clover
  2. CLOV-1401

Clover fails to instrument generic type with a constructor reference

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • 3.2.2
    • 3.2.0
    • Instrumentation
    • None

    Description

      This works fine:

      myLambda = ArrayList::new;   // javac error since JDK8 b114
      myLambda = ArrayList::<String>new;
      

      But the following:

      myLambda = ArrayList<String>::new;
      myLambda = ArrayList<String>::<String>new;
      

      fails with a parser error:

      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
      	at com.atlassian.clover.instr.java.Instrumenter.instrument(Instrumenter.java:158)
      	at com.atlassian.clover.CloverInstr.execute(CloverInstr.java:73)
      	at com.atlassian.clover.CloverInstr.mainImpl(CloverInstr.java:49)
      	at com.atlassian.clover.JavaSyntaxCompilationTestBase.instrumentSourceFile(JavaSyntaxCompilationTestBase.java:145)
      	at com.atlassian.clover.JavaSyntaxCompilationTestBase.instrumentAndCompileSourceFile(JavaSyntaxCompilationTestBase.java:111)
      	at com.atlassian.clover.JavaSyntax18CompilationTest.testLambdaAndMethodReferences(JavaSyntax18CompilationTest.java:84)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:483)
      	at junit.framework.TestCase.runTest(TestCase.java:168)
      	at junit.framework.TestCase.runBare(TestCase.java:134)
      	at junit.framework.TestResult$1.protect(TestResult.java:110)
      	at junit.framework.TestResult.runProtected(TestResult.java:128)
      	at junit.framework.TestResult.run(TestResult.java:113)
      	at junit.framework.TestCase.run(TestCase.java:124)
      	at junit.framework.TestSuite.runTest(TestSuite.java:243)
      	at junit.framework.TestSuite.run(TestSuite.java:238)
      	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:157)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:483)
      	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
      Caused by: line 78:28: unexpected token: ArrayList
      	at com.atlassian.clover.instr.java.JavaRecognizer.conditionalExpression(JavaRecognizer.java:4407)
      	at com.atlassian.clover.instr.java.JavaRecognizer.assignmentExpression(JavaRecognizer.java:4274)
      	at com.atlassian.clover.instr.java.JavaRecognizer.assignmentExpression(JavaRecognizer.java:4319)
      	at com.atlassian.clover.instr.java.JavaRecognizer.expression(JavaRecognizer.java:3366)
      	at com.atlassian.clover.instr.java.JavaRecognizer.statement(JavaRecognizer.java:2909)
      	at com.atlassian.clover.instr.java.JavaRecognizer.outerCompoundStmt(JavaRecognizer.java:2696)
      	at com.atlassian.clover.instr.java.JavaRecognizer.field(JavaRecognizer.java:2265)
      	at com.atlassian.clover.instr.java.JavaRecognizer.classBlock(JavaRecognizer.java:1728)
      	at com.atlassian.clover.instr.java.JavaRecognizer.classDefinition(JavaRecognizer.java:736)
      	at com.atlassian.clover.instr.java.JavaRecognizer.typeDefinition2(JavaRecognizer.java:666)
      	at com.atlassian.clover.instr.java.JavaRecognizer.typeDefinition(JavaRecognizer.java:524)
      	at com.atlassian.clover.instr.java.JavaRecognizer.compilationUnit(JavaRecognizer.java:445)
      	at com.atlassian.clover.instr.java.Instrumenter.instrument(Instrumenter.java:212)
      	at com.atlassian.clover.instr.java.Instrumenter.instrument(Instrumenter.java:121)
      	... 27 more
      

      Attachments

        Issue Links

          Activity

            People

              mparfianowicz Marek Parfianowicz
              mparfianowicz Marek Parfianowicz
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: