Skip to content
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

jvm: Difficulties with "hello world" #1040

Closed
langston-barrett opened this issue Sep 13, 2022 · 4 comments
Closed

jvm: Difficulties with "hello world" #1040

langston-barrett opened this issue Sep 13, 2022 · 4 comments
Labels

Comments

@langston-barrett
Copy link
Contributor

langston-barrett commented Sep 13, 2022

crucible-jvm can't verify the following main method that simply calls System.out.println. This may be the intended behavior. Regardless, this error message is sub-optimal - it doesn't make it clear what's gone wrong, how to fix it, or if this is a user error or a problem with crucible-jvm.

class Main {
    public static void main(String args[]) {
        System.out.println("Hello, world!");
    }
}
javac -g Main.java && cabal run exe:crucible-jvm -- Main.class
resolveField: Field FieldId {fieldIdClass = ClassName "java/lang/Object", fieldIdName = "value", fieldIdType = char[]} not found
CallStack (from HasCallStack):
  error, called at src/Lang/Crucible/JVM/Translation/Monad.hs:61:15 in crucible-jvm-0.2-inplace:Lang.Crucible.JVM.Translation.Monad
  jvmFail, called at src/Lang/Crucible/JVM/Translation/Class.hs:843:23 in crucible-jvm-0.2-inplace:Lang.Crucible.JVM.Translation.Class

Update:

javac --version
javac 17.0.3
@RyanGlScott
Copy link
Contributor

Which version of the JVM are you using?

@langston-barrett
Copy link
Contributor Author

@RyanGlScott Good question :-) javac --version says javac 17.0.3.

@RyanGlScott
Copy link
Contributor

That would explain it, then. Really, this is an issue with crucible-jvm's special treatment of the String class, which is tracked in #641. This special treatment makes a lot of assumptions about the class fields of String that work for JDK 8 and earlier, but not later versions of the JDK. To make this work for later versions of the JDK, we'd need to revisit how String is defined and change the special-casing in crucible-jvm accordingly.

@langston-barrett
Copy link
Contributor Author

Gotcha, I'll close this in favor of #641 then. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants