Git Product home page Git Product logo

bixie's Introduction

Bixie Inconsistent Code Detection for Java

Status of Master

Build Status Coverage Status

Status of Devel

Build Status Coverage Status

Check our the Online Demo.

Bixie is a static analysis tool that detects inconsistencies in Java bytecode. An inconsistency occurs when code must throw an exception or is unreachable because because of assumptions made by other statements.

Examples
 if (operator == null) {
 	throw new SemanticException("Operator " + operator.getName());
 }

In this example from Hive, operator.getName() is inconsistent with the conditional operator == null.

In this example from Cassandra:

public Boolean generate() {
	return identityDistribution.next() % 1 == 0;
}

There is an inconsistency in the bytecode because the expression identityDistribution.next() % 1 == 0 appears as a conditional choice in the bytecode, and one case is unreachable because identityDistribution.next() % 1 returns a constant value.

Build instructions

Bixie uses gradle to build:

git clone https://github.com/SRI-CSL/bixie.git
cd bixie
./gradlew shadowJar

Usage example

To check if everything is working, run Bixie on itself:

cd build/libs/
java -jar bixie.jar -j ../classes/main/

Bixie runner

For your convenience, there is a Python script (runner/runner.py) that will automatically determine what classpaths to use and where class files are generated, and then invoke Bixie. It works for projects built with ant, maven, or gradle. For example:

cd <path-to-project>
mvn clean
python <path-to-bixie>/runner/runner.py -- mvn compile

This command will execute the maven build process for the project and scrape its output for instances where javac was called, then feed that information to Bixie. Be sure to clean before building, as the tool can only detect files that were actually compiled while it is observing.

Soundness remarks

Bixie is not sound. Many Java features, such as concurrency and reflection, are not handled by Bixie and may result in false alarms. Bixie also sometimes detects inconsistencies in the bytecode that have no corresponding inconsistency in the source code. For example, conditional choices with conjunctions in the condition sometimes raise false alarms.

bixie's People

Contributors

martinschaef avatar tim-mccarthy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.