Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-9405

Junit 5 IncompatibleClassChangeError

    XMLWordPrintableJSON

    Details

      Description

      Junit5 fails to process closures as annotation member values in package-info.groovy. This worked in Groovy 2.5 / Junit4

      Caused by: java.lang.IncompatibleClassChangeError: io.micronaut.inject.configurations.requirescondition.package-info and io.micronaut.inject.configurations.requirescondition.package-info$_closure1 disagree on InnerClasses attribute
        at java.lang.Class.getDeclaringClass0(Native Method)
        at java.lang.Class.getDeclaringClass(Class.java:1235) at java.lang.Class.getEnclosingClass(Class.java:1277)
        at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.isInnerClass(JUnitPlatformTestClassProcessor.java:104)
        at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor.access$200(JUnitPlatformTestClassProcessor.java:54)
        at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.execute(JUnitPlatformTestClassProcessor.java:90)
        at org.gradle.api.internal.tasks.testing.junitplatform.JUnitPlatformTestClassProcessor$CollectAllTestClassesExecutor.execute(JUnitPlatformTestClassProcessor.java:79)
        at org.gradle.api.internal.tasks.testing.junit.AbstractJUnitTestClassProcessor.processTestClass(AbstractJUnitTestClassProcessor.java:62)
        at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:51)
      

      The package info is related to Micronaut.

      @Configuration
      @Requires(condition = { ConditionContext context -> true })
      package io.micronaut.inject.configurations.requirescondition2
      
      import io.micronaut.context.annotation.Configuration
      import io.micronaut.context.annotation.Requires
      import io.micronaut.context.condition.ConditionContext
      

       

      I'll try to create a sample application here shortly.

      I was able to work around the issue by adding:
       

      test {
          exclude '***/*$_closure*'
      }
      

      to my build.gradle.

        Attachments

          Activity

            People

            • Assignee:
              paulk Paul King
              Reporter:
              Schlogen James Kleeh
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 10m
                10m