Skip to main content
Last updated March 28, 2011 13:33, by Amanj Sherwany
Feedicon  

Loci 0.1
A Pluggable Type Checker for Expressing Thread Locality in JavaTM


What is Loci?

Loci is a pluggable type checker, helps the programmer to check the correctness of the thread locality in their programs. It uses a simple statically checkable set of annotations. The current implementation of Loci only supports Java programming language, but we hope to deliver support for other programming languages as well (especially porting to other Java-like programming languages should be straight forward).

Loci is 100% compatible with legacy Java programs, any Java code compiled with standard Java compiler can also be compiled with Loci checker. If you apply Loci on your legacy Java code, it still stays completely backward compatible: your code compiles with any Java compiler, it runs on any JVM, and your coworkers don't have to use the enhanced type system if they don't want to. You can check only part of your program. Type inference tools exist to help you annotate your code.

Loci uses the annotation compiler from JSR308, therefore it has a wide support for annotations. Loci is also built on top of the checker framework, which makes Loci very easy to use and install once Java 8 is out. But that doesn't mean you cannot already use it with your Java 6 or Java 7 installation, Loci is compatible with them too, and you can install it almost effortlessly, please see the installation section below.


Backward Compatibility

We proved that Loci is backward compatible, by applying Loci on an old and huge version of lucene search library (version 2.4.1), and Loci didn't have any incompatibility problem with the library. You can see the results of our annotating process here (BTW, it is a bit old). We also annotated several other benchmarks. And in neither cases we had any incompatibility problem.


Downloading Loci

Loci is distributed in both binary and source code format, as it is an open source tool, and GPLv3.0 licensed. Loci just like Java is platform independent and you can install and run it, under any platform which is supported by Java.

  • The binary version of Loci (version 0.1) is available here.
  • Download the Manual here or view the HTML version here
  • To grab the source code, please click here
  • The Loci API documentation can be found here
  • A presentation about Loci 0.1 can be found here (BTW, it is a bit old)



Installing Loci

In order to use Loci, you should have the enhanced Java compiler, you can download and install it by following the instructions mentioned here. Once you Installed the enhanced javac you can install and use Loci easily, by adding it to your CLASSPATH, like:

  • Unix: $ export CLASSPATH=Path/To/Loci/dist/loci-0.1.jar:$CLASSPATH
  • Windows: C:> set CLASSPATH=Path\To\Loci\dist\loci-0.1.jar;classpath2...

You can also use this plugin, with Ant and Maven, as well as with different IDEs, for more details about Maven installation refer to here, and for Ant and named IDEs please visit this page


A Simple Example

Whenever you want to use Loci, you have to import loci.quals.* package. In the following listing, we show you a simple Java program and apply Loci on it.

import loci.quals.*; //import loci qualifiers
@Local public class HelloWorld{ //a thread local class
    @Shared Object b; //a shared field
    public static void main(String... args){
         System.out.println("Example");
    }
}


To compile the above program using the Loci checker plugin:

$ javac -processor loci.LociChecker HelloWorld.java

The above program, should not report any problem. But, the below program should do:
import loci.quals.*;

@Local public class BadHelloWorld{
    @Shared Object b = new @Local Object();
    public static void main(String... args){
        System.out.println("Example");
    }
}


$ javac -processor loci.LociChecker BadHelloWorld.java

The above program will report some message similar to:

BadHelloWorld.java:3: incompatible types.
      @Shared Object b = new @Local Object();
                         ^
  found : @Local Object
  required: @Shared Object
1 error



Getting more Help

Loci has got a Forum, which is publicly accessible through, this forum. Feel free to post your questions, suggestions, bug fixes, new features and even annotated libraries.


Credits

Loci 0.1 is a master project by Amanj Sherwany, the project is a subproject of UPMARC research group at the Information Technology Department at Uppsala University. The project was designed and supervised by Tobias Wrigstad an assistant professor at the same department.

FAQ

Please refer to FAQ.

Licensing

Please refer to this page

Internal Links


Other Useful Links

 
 
Close
loading
Please Confirm
Close