Published March 9, 2023 | Version v1
Software Open

Behavioral up/down casting for statically typed languages (Tool artifact)

  • 1. ROR icon University of Bologna
  • 2. ROR icon University of Oxford
  • 3. ROR icon Universidade Nova de Lisboa

Description

You may find the latest version of the tool at https://github.com/jdmota/java-typestate-checker

Artifact Submission

Title of the submitted paper: Behavioral up/down casting for statically typed languages

What does the artifact comprise?

The Docker image contains:

  • The code for the Car example presented in the paper (in the /tool/example folder). The main classes are:
    • The ClientCode class (presented in the paper) with well-behaved code which is accepted by the tool;
    • The WrongClientCode class which shows evidence that the tool catches errors regarding protocol compliance or completion.
  • The jar file of the tool (in the /tool/dist folder).

This artifact shows how the developed tool verifies code with respect to protocol compliance and completion, in particular, the motivating example presented in the paper.

Software requirements

  • Docker
  • GNU Bash

Getting Started

  • Open Docker Desktop with your GUI: this will launch the daemon.
  • Open a shell.

Shell instructions

  1. Import the image provided into docker:
  • docker load -i behavioral-casting-tool.tar
  1. Run the docker image:
  • docker run -it behavioral-casting-tool:latest
  1. A prompt of the form root@8de54d614a6d:/tool/example# should be opened. Now run:
  • ./run.sh

Expected output

The tool verifies all the Java code in the folder /tool/example, including the main classes ClientCode and WrongClientCode. The ClientCode.java file contains well-behaved code (as presented in the paper), so no error should be reported on it. The WrongClientCode.java file contains ill-behaved code, so errors should be reported on it. In summary, the expected tool output for the given example is the following:

WrongClientCode.java:9: error: [suv] did not complete its protocol (found: State{SUV, COMF_ON})
  public static void example2() { // The tool should report an error here about protocol completion
                     ^
WrongClientCode.java:6: error: Cannot call [switchMode] on State{SUV, OFF}
    f.switchMode(); // The tool should report an error here about protocol compliance
                ^
2 errors

Files

Files (482.2 MB)

Name Size Download all
md5:ea4c100d3f3643eb702e4241572662bc
482.2 MB Download

Additional details

Related works

Is published in
Conference paper: 10.4230/LIPIcs.ECOOP.2024.5 (DOI)