GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - eisop/jspecify-reference-checker: The reference implementation for the JSpecify nullness specification (and later, its other specifications as well)

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

590 Commits
590 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
conformance-test-framework
conformance-test-framework
 
 
docs
docs
 
 
gradle/wrapper
gradle/wrapper
 
 
src
src
 
 
tests
tests
 
 
usage-demo
usage-demo
 
 
.gitignore
.gitignore
 
 
AUTHORS
AUTHORS
 
 
JdkSample.java
JdkSample.java
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
SimpleSample.java
SimpleSample.java
 
 
build.gradle
build.gradle
 
 
demo
demo
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
initialize-project
initialize-project
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

The JSpecify Reference Checker

This project is under development to become the reference implementation for the JSpecify nullness specification (and later, its other specifications as well). The current goal we're working toward is conformance with version 0.3 of that spec, but it's not there yet.

A "reference" checker

Though it does check your references (to see if they're null), that's not the intended meaning!

This tool's purpose is to report nullness-related findings correctly according to the JSpecify standard for nullness annotation semantics.

But that's its only job. Notably, it is:

  • not expected to have good performance characteristics
  • not expected to have good usability characteristics

... and there is no intention to make it competitive in these ways. Of course real tools by our partner organizations will be better.

Relationship to Checker Framework and EISOP

The EISOP project maintains a fork of the Checker Framework, and JSpecify conformance is one of its goals.

This tool is built on top of the EISOP Checker Framework. However, please view this relationship as implementation detail only. Building a reference checker from scratch would simply have been too difficult, so we needed to base it on some existing tool. The choice of which tool was made purely for expediency and is subject to change.

Usage

Building and running this tool depends on code from several other repositories, but these instructions will take care of that automatically.

These instructions might require workarounds or fail outright. Please file an issue if you have any trouble!

Prework

Set JAVA_HOME to a JDK 17 or later installation.

Make sure you have Apache Maven installed and in your PATH, or the demo script will fail:

mvn

Choose a name for a brand new directory that doesn't already exist. It may be convenient to set $root_dir to that absolute path:

root_dir=/absolute/pathname/for/fresh/new/directory

... because then you can paste the commands below exactly as they are.

Building

Now get the code for this project, JSpecify's annotated JDK, and JSpecify itself, which the tests use.

Warning: If you clone this project under a different name, watch out, as the later steps assume it to be named exactly jspecify-reference-checker. The build expects the annotated JDK in the sibling directory jdk; pass -PjspecifyJdkHome=/path/to/jdk to use a clone elsewhere.

mkdir $root_dir
cd $root_dir
git clone https://github.com/jspecify/jspecify-reference-checker
git clone --depth 1 https://github.com/jspecify/jdk
git clone https://github.com/jspecify/jspecify
cd jspecify-reference-checker

Now build it:

./gradlew assemble

Demonstration

Run the checker on the sample file:

cd $root_dir/jspecify-reference-checker
./demo SimpleSample.java

(If you haven't built the reference checker yet, this will build it the first time you run it.)

After that, you should see:

SimpleSample.java:7: error: [nullness] incompatible types in return.
    return mightBeNull;
           ^
  type of expression: Object?
  method return type: Object
1 error

Note that the demo script is not complicated, and illustrates how you can enable checking for your own code as well.

Testing

To perform a minimal test, run:

cd $root_dir/jspecify-reference-checker
./gradlew test

To run the (incomplete) conformance test suite, check out the main branch of jspecify and run conformanceTests:

git -C $root_dir/jspecify checkout main
cd $root_dir/jspecify-reference-checker
./gradlew conformanceTests --include-build ../jspecify

To run the (legacy) "samples" test suite, check out the samples-google-prototype-eisop branch of jspecify and run jspecifySamplesTest:

git -C $root_dir/jspecify checkout samples-google-prototype-eisop
cd $root_dir/jspecify-reference-checker
./gradlew jspecifySamplesTest --include-build ../jspecify

About

The reference implementation for the JSpecify nullness specification (and later, its other specifications as well)

jspecify.org

Resources

Readme
Apache-2.0 license

Contributing

Contributing
Activity
Custom properties

Stars

0 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.