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

Static member names should be resolvable based on the current class #39

Closed
acfoltzer opened this issue Jul 20, 2015 · 1 comment
Closed
Labels
obsolete Issues that involve/depend on deprecated code, such that they are not worth pursuing type: enhancement Issues describing an improvement to an existing feature or capability

Comments

@acfoltzer
Copy link
Contributor

Perhaps easiest to show by example. Right now, examples/java/staticfield.saw looks like this:

let setx_spec : JavaSetup () = do {
    newx <- java_var "newx" java_int;
    java_var "sfield.StaticField.x" java_int;
    java_ensure_eq "sfield.StaticField.x" {{ newx : [32] }};
    java_verify_tactic abc;
};

let getx_spec : JavaSetup () = do {
    x <- java_var "sfield.StaticField.x" java_int;
    java_return {{ x : [32] }};
    java_verify_tactic abc;
};

let main : TopLevel () = do {
    c <- java_load_class "sfield.StaticField";
    ms_setx <- java_verify c "setx" [] setx_spec;
    ms_getx <- java_verify c "getx" [] getx_spec;
    print "Done.";
};

Since we're running the JavaSetup blocks in the context of a class, we should be able to do so unqualified: "sfield.StaticField.x" becomes "StaticField.x" or even "x". The first alternative more accurately reflects how static references tend to appear in the text of Java programs, but one can refer to static members totally unqualified from within the same class, so we should allow that too.

Acceptance test: the following should work identically to the above script (intentionally mixing all three reference styles):

let setx_spec : JavaSetup () = do {
    newx <- java_var "newx" java_int;
    java_var "StaticField.x" java_int;
    java_ensure_eq "x" {{ newx : [32] }};
    java_verify_tactic abc;
};

let getx_spec : JavaSetup () = do {
    x <- java_var "sfield.StaticField.x" java_int;
    java_return {{ x : [32] }};
    java_verify_tactic abc;
};

let main : TopLevel () = do {
    c <- java_load_class "sfield.StaticField";
    ms_setx <- java_verify c "setx" [] setx_spec;
    ms_getx <- java_verify c "getx" [] getx_spec;
    print "Done.";
};
@acfoltzer acfoltzer added the type: enhancement Issues describing an improvement to an existing feature or capability label Jul 20, 2015
@atomb atomb added the obsolete Issues that involve/depend on deprecated code, such that they are not worth pursuing label Apr 2, 2019
@atomb atomb added this to the 1.0 milestone Jun 4, 2019
@atomb atomb modified the milestones: 0.5, 0.6 Mar 31, 2020
@atomb atomb modified the milestones: 0.6, 0.7 Aug 6, 2020
@atomb atomb modified the milestones: 0.7, Remove jvm-verifier Oct 16, 2020
@brianhuffman
Copy link
Contributor

The old java_verify, java_var and related commands are set to be removed soon after having been deprecated (#1005). As of #981 we can specify static fields for jvm_verify using jvm_static_field_is, and it already allows for unqualified field names when referring to static fields in the class whose method is being verified.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
obsolete Issues that involve/depend on deprecated code, such that they are not worth pursuing type: enhancement Issues describing an improvement to an existing feature or capability
Projects
None yet
Development

No branches or pull requests

3 participants