'''JavaCop started life as the HonoursProject of ChrisAndreae'''

'''Contributors to JavaCop (in alphabetical order)'''

* ChrisAndreae
* ShaneMarkstrum
* ToddMillstein
* JamesNoble

'''Other Known JavaCop Users'''

* Jan Vitek [http://www.cs.purdue.edu/homes/jv/]

'''What ''is'' JavaCop?!'''

The JavaCOP system is a system for defining and enforcing constraints on the structure of a Java program. A wide variety of constraints are possible, ranging from stylistic constraints on the syntax of the program, to a complex user-defined typing discipline such as Confined Types. The JavaCOP system includes a declarative rule language for expressing constraints, a Java framework implemented within the Sun javac compiler for enforcing constraints on program code during compilation, and a compiler for the rule language that produces constraint checking code using the framework.

---

See HowToUseJavaCop

---

'''Tasks that are being Worked On'''

* Rewrite compiler to be in Java (ChrisAndreae)

* Exploring runtime encodings of properties or JavaCopRuntimeInvariants which rules claim to establish (ShaneMarkstrum)
** [http://aspectj.org AspectJ] instrumentation
** source transformation with [http://jackpot.netbeans.org Jackpot]?
** Counter-example generation ([http://alloy.mit.edu Alloy]/[http://www.mit.edu/people/emina/kodkod.html Kodkod])

'''There are Tasks Yet To Do for JavaCop:'''

* Add 'function's which allow for better code reuse when accessing complicated AST structures (such as extracting Attribute information)

* Make the compiler more robust by implementing type checking and extending the parser for error detection and reporting.
** We are developing a 'debug' primitive to aid in the development of rules
** Currently exploring the benefits of some '''@Nonnull''' or '''Exception''' checking in order to generate warnings when compiling JavaCop rules

* Create a JavaCop specific AST for writing rules
** This would allow the JavaCop rules to be backend agnostic
** Glue would be necessary, though, to connect the backend AST with this AST

* Conditionals in the rule language are inconvenient. Neither 'where' (if . then .) nor require (if . then . else fail) are much good for selection from alternatives. Rather than just adding 'if-else' alone, I'd rather provide a more structured selection, along the lines of
case
a:{b}
c:{d}
e:{f}
otherwise:{g};
which captures the previous where (only one argument), where* (otherwise{fail}), and additionally selection, although I'm sure the syntax could be improved from what I've put there.

TimWright: doesn't java have a switch/case statement that you could steal the syntax of?


'''Tasks Maybe To Do'''


* Modularity
** Import
** Package

* Make joinpoints more interesting - might we want to join on a ''set'' of types? (Note that some of this functionality might be provided with a better JavaCop AST) For example:
rule(Tree t)[t=ClassDef,MethodDef,VarDef]{..}

* In order to make javacop useful for metrics or corpus analysis, the language really needs some kind of counting primitives in the result clauses.

* Cache results of quantifiers and predicate calls

* A system for performing localized flow-sensitive analyses on demand as needed by rules, and making their results available to the rules. Like the main component, this would be implemented in a Java back-end, and described by a rule-language front-end.