-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IllegalStateException: Invisible parameter type of kotlin.jvm.internal.DefaultConstructorMarker #776
Comments
Spock should configure Byte Buddy to run by I will however look into the issue and hopefully fix it! |
Project that demonstrates this: https://github.com/henrik242/kotlin-bytebuddy-spock |
@leonard84 Would it be easy for you to just change to |
Sorry, little baby at home, I hope to look into this within this week. But yes, I suggest to turn off validation in the first place. Also, latest Byte Buddy fully supports Java 9, might be worth the update! |
@raphw what are the implications of disabling type validation? |
Byte Buddy will no longer run a manual assertion of the type's validity. This can result in an assertion error what Byte Buddy would prevent. As a background: when using Java agents, it is often better to fail during chaning a type rather then destroying it alltogether. For subclassing, destruction of a type that serves a purpose without a change is not possible. Of course, the manual validation can be too strict, which is why it makes sense to disable if failure is not crucial to a system like during test. |
Is disabling the validation just a workaround until you fixed the underlying issue and should then be turned on again, or is it generally preferable to disable it for test code? |
I generally recommend to disable it in production setups. If the instrumentation is set up correctlly, there is no good reason to use validation. But it can help a lot under development and be useful to fail fast under test. |
I found out about the problem now and it is as a matter of fact a breach of the JVM spec by Kotlin. I have reported an issue on the tracker. The breach does not break the runtime as JVMs are sometimes less strict then the spec but there might be JVM implementations that are failing the check. I recommend to disable validation as Byte Buddy validates against the formal spec to allow such border-line cases and rather cause a JVM failure. The way Byte Buddy is used in Spock already assures that no invalid code can be generated, therefore this should not be a problem. |
@raphw Thanks for looking into this! So in order for this to work, spock needs to be updated? There's nothing you can do in bytebuddy? BTW, can you link to the kotlin issue? |
The issue is here: https://youtrack.jetbrains.com/issue/KT-20869 I could in theory disable the check in Byte Buddy's manual validation. Spock can opt out of this manual validation and I want to continue byte code against the specification rather then some quirky state as this can change rapidly. |
How about a configurable whitelist |
@leonard84 Thanks! Do you have any imminent plans of releasing a new Spock version? |
@henrik242 sorry no, either use the SNAPSHOT or use jitpack.io for a stable-version. |
@leonard84 No problem, I just built it myself |
I have a Kotlin class:
... and a Spock test:
... using the following Gradle dependencies:
Running the test gives me:
The test works without the byte-buddy dependency.
(ref. raphw/byte-buddy#350 )
The text was updated successfully, but these errors were encountered: