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
Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option #1168
Comments
I was able to deep dive into this. I have created a simple script that verifies the JVM target of a few mockk artifacts (others need to be checked as well). It checks if artifacts are compiled with the correct byte code: mockk-core-jvm-1.13.7.jar - is compiled to bytecode 52 (Java 8) ✅ Steps to Reproduce
import sys
import subprocess
import os
import tempfile
import shutil
def get_bytecode_version(class_file):
result = subprocess.run(["javap", "-verbose", class_file], capture_output=True, text=True)
for line in result.stdout.splitlines():
if "major version" in line:
return line.split(":")[-1].strip()
def main(file_path):
# Java 8 == bytecode version 52.0 (defined in the local.javalibrary.gradle.kts)
desired_java_version = "8"
desired_bytecode_version = "52"
if os.path.exists(file_path):
print(f"Verify if all classes in {file_path} are compiled to bytecode {desired_bytecode_version} (Java {desired_java_version})")
else:
print("File not found:", file_path)
# Create a temporary directory
temp_dir = "./temp"
try:
# Unzip the jar file to the temporary directory
subprocess.run(["unzip", "-qq", file_path, "-d", temp_dir], check=True)
# Walk the directory to find all .class files
for root, _, files in os.walk(temp_dir):
for file in files:
print("file", file)
if file.endswith(".class"):
file_path = os.path.join(root, file)
version = get_bytecode_version(file_path)
if version != desired_bytecode_version:
print(f"❌ ERROR {file_path} has incorrect bytecode version {version}")
sys.exit(1)
else:
print(f"✅ SUCCESS {file_path} has correct bytecode version {version}")
print(f"✅✅✅ All classed in {file_path} have correct bytecode")
print()
finally:
# Clean up the temporary directory
aaa = True
shutil.rmtree(temp_dir)
if __name__ == "__main__":
main("mockk-1.13.7.jar")
main("mockk-1.13.8.jar")
main("mockk-core-1.13.7.jar")
main("mockk-core-1.13.8.jar")
main("mockk-core-jvm-1.13.7.jar")
main("mockk-core-jvm-1.13.8.jar") It looks like this PR may have caused the issue #1056 Here is the failing PR upgrading mockk v1.13.7 -> v1.13.8 BTW |
Fixed via #1161 |
Any updates on when we will get a new release for this? |
Any updates on this release? |
Same issue occurs for me. Whats current status of issue ? cc : @odrotbohm |
hey guys! issue was solved in 1.13.7, but is back in 1.13.8 |
Also getting it in 1.13.8 |
KoTest: 5.6.2 -> 5.8.0 mockk: 1.13.5 -> 1.13.7 Robolectric: 4.10.3 -> 4.11.1 Note that due to [1], the most recent version of mockk cannot be used. [1]: mockk/mockk#1168 Signed-off-by: Oliver Heger <oliver.heger@oliver-heger.de>
KoTest: 5.6.2 -> 5.8.0 mockk: 1.13.5 -> 1.13.7 Robolectric: 4.10.3 -> 4.11.1 Note that due to [1], the most recent version of mockk cannot be used. [1]: mockk/mockk#1168 Signed-off-by: Oliver Heger <oliver.heger@oliver-heger.de>
Android studio downgrade works: I use it in Android Studio Kotlin, indeed, downgrade to 1.13.7 |
Please remove sections wisely
Below information is actually needed to make all the process of fixing faster.
Choose main points. Don't blindly follow this as a set of rules.
Don't waste much time. Usually, the main thing is to have a good reproducible minimal code.
Prerequisites
Please answer the following questions for yourself before submitting an issue.
Expected Behavior
Kotest should run with mockk 1.13.8
Current Behavior
What is the current behavior?
Failure Information (for bugs)
Compile and Runtime error
Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Kotest
Failure Logs
Cannot inline bytecode built with JVM target 11 into bytecode that is being built with JVM target 1.8. Please specify proper '-jvm-target' option
Please include any relevant log snippets or files here.
Stack trace
Minimal reproducible code (the gist of this issue)
We are using maven to build the project.
// -----------------------[ YOUR CODE ENDS HERE ] -----------------------
The text was updated successfully, but these errors were encountered: