Skip to content

--rac: "cannot find symbol" on chars/modelString in Path.jml postcondition #28

Description

@ANogin

[Caveat: Aided by Claude Code; I confirmed the specific findings, but not the underlying logic]

Reproducer

import java.nio.file.Path;
public class Foo { public void bar(Path p) {} }
$ openjml --rac Foo.java
[...]/specs/java/nio/file/Path.jml:97: error: cannot find symbol
    //@   ensures \result.chars == modelString;
                         ^
  symbol:   variable chars
  location: class String
[..]/specs/java/nio/file/Path.jml:97: error: cannot find symbol
    //@   ensures \result.chars == modelString;
                                   ^
  symbol:   variable modelString
  location: interface Path
2 errors

Observation

Both chars and modelString are declared //-RAC@ on Object.jml:

// This \string represents the value that will be produced by toString()
//-RAC@ model public instance \string modelString; in objectState;
// This \string represents the value acucmulated by CharSequence and its derived classes,
// and also by Appendable and its derived classes -- it would be nice if this could be the same
// as modelString but it is possible for derived classes to have these be different values
//-RAC@ model public instance \string chars; in objectState;

Object.jml's own toString() wraps its postcondition in /*-RAC@*/:
/*-RAC@ public normal_behavior
@ ensures \result.chars == modelString;

Path.jml's also clause uses plain //@ ensures instead:
//@ also public normal_behavior
//@ ensures \result.chars == modelString;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions