| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
LiquidJava is an additional type checker for Java, based on liquid types and typestates, which provides additional safety guarantees to Java programs through refinements at compile time.
Example:
@Refinement("a > 0")
int a = 3; // okay
a = -8; // type error!This project contains the LiquidJava verifier and its API, as well as some examples for testing.
You can find out more about LiquidJava in the following resources:
The easiest way to use LiquidJava is through its VS Code extension, which uses the LiquidJava verifier directly inside VS Code, with real-time error diagnostics and syntax highlighting for refinements.
For development, you may use the LiquidJava verifier from the command line.
Before setting up LiquidJava, ensure you have the following installed:
Additionally, you'll need the following dependency, which includes the LiquidJava API annotations:
<dependency>
<groupId>io.github.rcosta358</groupId>
<artifactId>liquidjava-api</artifactId>
<version>0.0.3</version>
</dependency>repositories {
mavenCentral()
}
dependencies {
implementation 'io.github.rcosta358:liquidjava-api:0.0.3'
}To run LiquidJava, use the Maven command below, replacing /path/to/your/project with the path to the Java file or directory you want to verify.
mvn exec:java -pl liquidjava-verifier -Dexec.mainClass="liquidjava.api.CommandLineLauncher" -Dexec.args="/path/to/your/project"Warning: Any change to LiquidJava requires rebuilding the jar.
If you're on Linux/macOS, you can use the liquidjava script (from the repository root) to simplify the process.
Test a correct case:
./liquidjava liquidjava-example/src/main/java/testSuite/CorrectSimpleAssignment.javaThis should output: Correct! Passed Verification.
Test an error case:
./liquidjava liquidjava-example/src/main/java/testSuite/ErrorSimpleAssignment.javaThis should output an error message describing the refinement violation.
Run mvn test to run all the tests in LiquidJava.
The starter test file is TestExamples.java, which runs the test suite under the testSuite directory in liquidjava-example.
The test suite considers test cases:
Therefore, the files and folders that do not follow this pattern are ignored.
| Back | FazBrowse Home | New Git URL |