Hi!
I'm currently writing a diploma thesis implementing a type checker.
There are the steps I noted down for reproducing my Eclipse setup (on
Linux, assuming Eclipse and JDK6 or JDK7 are already installed):
How to set up Checkers and JSR308-langtools from scratch using Eclipse
1. Unpack the jsr308-langtools and the checker ZIP files in the same
directory. (There should be two folders, with the same names as the
ZIP files.)
2. In jsr308-langtools/make, run “ant build-javac build-javap”. This
creates JARs in jsr308-langtools/dist/lib, containing the JSR308
javac compiler and disassembler. The compiler has support for
“commented-out” style type qualifiers like /*@NonNull*/, which
makes it work better with current IDEs.
3. In the same directory, you may also wish to run “ant build”, which
among other things, creates a src.zip which has all the compiler
source code in it.
4. Ensure that Ant works in the Checkers directory. (This is a bit
more tricky on MacOS, at one point the Ant file must be changed
to run java with a -Xbootclasspath/p: argument pointing to the
javac.jar in jsr308-langtools.) Be aware that you may need to
modify build.preferences in case you have nonstandard paths.
5. Create an Eclipse project in the Checkers directory.
6. For easier linking, I created a symlink from checkers/langtools-
dist
to jsr308-langtools/dist.
7. Link to the javac.jar, doclets.jar and javadoc.jar from the
Checkers
project. (They are created into dist/lib in langtools. You may
need to run another special Ant target to create the Javadoc-
related
Jars.)
8. In the Eclipse project properties, go to “Build Path->Order and
Export” and make sure the “JRE system library” entry is
overshadowed
by the javac.jar, so the JSR308 compiler is seen instead of the
one installed in your JDK.
9. When setting up JUnit Run Configurations, give the following VM
argument:
-Xbootclasspath/p:${workspace_loc:checkers}/langtools-dist/lib/
javac.jar
Note 1: If developing on MacOS X, you'll possibly need to override the
-Xbootclasspath.
Note 2: For reference, here's my Eclipse .classpath file:
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="tests/src"/>
<classpathentry kind="lib" path="checkers.jar"
sourcepath="src"/>
<classpathentry kind="lib" path="lib/asmx.jar"/>
<classpathentry kind="lib" path="lib/javaparser.jar"/>
<classpathentry kind="lib" path="tests/junit.jar"/>
<classpathentry kind="lib" path="langtools-dist/lib/
doclets.jar" sourcepath="langtools-dist/lib/src.zip"/>
<classpathentry kind="lib" path="langtools-dist/lib/
javadoc.jar"/>
<classpathentry kind="lib" path="langtools-dist/lib/javac.jar"/
>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
I hope this helps. Let me know if it worked for you.
Best regards,
Günther