Menu

java.lang.IllegalStateException: CONSTANT_info: invalid tag value [18]

Developers
2018-04-18
2019-04-09
  • Kiran Kumar

    Kiran Kumar - 2018-04-18

    while integrating EMMA with Gradle i am facing this issue.
    java.lang.IllegalStateException: CONSTANT_info: invalid
    tag value [18]

    Do we have any solution for this issue please let me know.

    here is the script :

    apply plugin: "emma"
    configurations{
    emma
    }

    dependencies{
    emma "emma:emma:2.0.5312"
    emma "emma:emma_ant:2.0.5312"
    }

    def emmaConvention = new EmmaPluginConvention(project)
    project.convention.plugins.emma = emmaConvention

    class EmmaPluginConvention{
    def verbosityLevel = "info"
    def reportPath;
    def coverageFileName;
    def tmpDir;
    def instrDir;
    def metaDataFilePath;

    def emma(Closure close){
        close.delegate = this;
        close.run()
    }
    
    EmmaPluginConvention(Project project){
        reportPath          = "${project.reportsDir.absolutePath}/emma"
        coverageFileName    = "coverage"
        tmpDir              = "${project.buildDir}/tmp/emma"
        instrDir            = "${tmpDir}/instr"
        metaDataFilePath    = "${tmpDir}/metadata.emma"
    }
    

    }

    test{
    //setup JVM Arguments for emma coverage
    jvmArgs "-Demma.coverage.out.file=${emmaConvention.metaDataFilePath}", "-Demma.coverage.out.merge=true"

    //add 
    doFirst{
        ant.taskdef( resource:"emma_ant.properties", classpath: configurations.emma.asPath)
        ant.path(id:"run.classpath"){
            pathelement(location:sourceSets.main.output.classesDir.absolutePath ) 
        }
        ant.emma(verbosity:"${emmaConvention.verbosityLevel}"){
            instr(merge:"true", destdir:"${emmaConvention.instrDir}", instrpathref:"run.classpath", metadatafile:"${emmaConvention.metaDataFilePath}"){
                instrpath{
                    fileset(dir:sourceSets.main.classesDir.absolutePath, includes:"*.class")
                }
            }
        }
        setClasspath(files("${emmaConvention.instrDir}") + configurations.emma +  getClasspath())
    }
    
    doLast{
        ant.path(id:"src.path"){
            sourceSets.main.java.srcDirs.each{
                pathelement(location:it.absolutePath ) 
            }
        }
        ant.emma(enabled:"true"){
    
            report(sourcepathref:"src.path"){
                fileset(dir:"${emmaConvention.tmpDir}"){
                    include(name:"*.emma")
                }
                txt(outfile:"${emmaConvention.reportPath}/coverage.txt")
                html(outfile:"${emmaConvention.reportPath}/coverage.html")
                xml(outfile:"${emmaConvention.reportPath}/coverage.xml")
            }
        }
    }
    

    }

     
  • vicush

    vicush - 2019-04-09

    You must be using some lambda expressions or stream api of Java 8.
    What helped me out of this mess is compiling my code with Java 7 to find those places and then you can either exclude them from instrumentation or re-write them without Java 8 :(

    Check this out
    https://stackoverflow.com/questions/30313255/reflections-java-8-invalid-constant-type

     

Log in to post a comment.