zero9178 / C-Cpp-Coverage-for-CLion

Get coverage data in CLion using gcov or llvm-cov
MIT License
38 stars 2 forks source link

net.zero9178.cov.data.LLVMCoverageGenerator: lass java.lang.Integer cannot be cast to class java.lang.Boolean #10

Closed alexforster closed 5 years ago

alexforster commented 5 years ago
java.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.Boolean (java.lang.Integer and java.lang.Boolean are in module java.base of loader 'bootstrap')
    at net.zero9178.cov.data.LLVMCoverageGenerator$processJson$root$1.fromJson(LLVMCoverageGenerator.kt:107)
    at com.beust.klaxon.DefaultConverter.fromCollection(DefaultConverter.kt:130)
    at com.beust.klaxon.DefaultConverter.fromJson(DefaultConverter.kt:30)
    at com.beust.klaxon.JsonObjectConverter.retrieveKeyValues(JsonObjectConverter.kt:185)
    at com.beust.klaxon.JsonObjectConverter.initIntoUserClass(JsonObjectConverter.kt:67)
    at com.beust.klaxon.JsonObjectConverter.fromJson(JsonObjectConverter.kt:32)
    at com.beust.klaxon.DefaultConverter.fromJsonObject(DefaultConverter.kt:208)
    at com.beust.klaxon.DefaultConverter.fromJson(DefaultConverter.kt:31)
    at com.beust.klaxon.DefaultConverter.fromCollection(DefaultConverter.kt:130)
    at com.beust.klaxon.DefaultConverter.fromJson(DefaultConverter.kt:30)
    at com.beust.klaxon.JsonObjectConverter.retrieveKeyValues(JsonObjectConverter.kt:185)
    at com.beust.klaxon.JsonObjectConverter.initIntoUserClass(JsonObjectConverter.kt:67)
    at com.beust.klaxon.JsonObjectConverter.fromJson(JsonObjectConverter.kt:32)
    at com.beust.klaxon.DefaultConverter.fromJsonObject(DefaultConverter.kt:208)
    at com.beust.klaxon.DefaultConverter.fromJson(DefaultConverter.kt:31)
    at com.beust.klaxon.DefaultConverter.fromCollection(DefaultConverter.kt:130)
    at com.beust.klaxon.DefaultConverter.fromJson(DefaultConverter.kt:30)
    at com.beust.klaxon.JsonObjectConverter.retrieveKeyValues(JsonObjectConverter.kt:185)
    at com.beust.klaxon.JsonObjectConverter.initIntoUserClass(JsonObjectConverter.kt:67)
    at com.beust.klaxon.JsonObjectConverter.fromJson(JsonObjectConverter.kt:32)
    at com.beust.klaxon.DefaultConverter.fromJsonObject(DefaultConverter.kt:208)
    at com.beust.klaxon.DefaultConverter.fromJson(DefaultConverter.kt:31)
    at com.beust.klaxon.Klaxon.fromJsonObject(Klaxon.kt:296)
    at net.zero9178.cov.data.LLVMCoverageGenerator.processJson(LLVMCoverageGenerator.kt:378)
    at net.zero9178.cov.data.LLVMCoverageGenerator.generateCoverage(LLVMCoverageGenerator.kt:374)
    at net.zero9178.cov.CoverageConfigurationExtension$attachToProcess$1$processTerminated$1.run(CoverageConfigurationExtension.kt:111)
    at com.intellij.openapi.progress.impl.CoreProgressManager$TaskRunnable.run(CoreProgressManager.java:894)
    at com.intellij.openapi.progress.impl.CoreProgressManager$5.run(CoreProgressManager.java:447)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:169)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:591)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:537)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:59)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:156)
    at com.intellij.openapi.application.impl.ApplicationImpl.lambda$null$9(ApplicationImpl.java:552)
    at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:294)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
alexforster commented 5 years ago

This plugin is untested on Mac OS-X. It should work as long as the toolchains are setup correctly. One thing to watch out for is that gcc, g++ and gcov installed by XCode are NOT GCC but actually clang,clang++ and a gcov like implementation by the LLVM project. This version of gcov will NOT WORK as it does not implement the same command line arguments as real gcov. Please install another toolchain or find a llvm-cov version suitable for your version of clang.

Oh wait, let me try the homebrew llvm...

Nope, same exception.

zero9178 commented 5 years ago

Investigating... Dont think this is to blame and Mac OS-X as you have a normal LLVM install and not an Apple LLVM.

zero9178 commented 5 years ago

Turns out there are two properties in the JSON that llvm prior to llvm 8 outputted as either 0 or 1 (aka as ints) and since llvm 8 do as boolean. Will be fixed in the next version which I'll be releasing hopefully today or tomorrow and will then be available after approval two days afterwards

alexforster commented 5 years ago

Great! Thanks for taking a look.

alexforster commented 5 years ago

That fixed it. Thanks again!