= JCop = [[Image(http://www.hpi.uni-potsdam.de/hirschfeld/projects/jcop/media/jcop.jpg)]] JCop is a context-oriented programming (COP) extension to the Java programming language. It combines COP features - introduced by its predecessor ContextJ - with new constructs for declarative and event-based layer composition and a first-class event-based context representation. '''Modularization'''. Behavioral variations are modularized by layers that can either be defined within classes (layer-in-class) or in dedicated top-level modules (class-in-layer). Layers contain partial method definitions that extend or replace a plain method while their layers are active. '''Dynamic Composition'''. JCop provides control-flow specific layer composition as known from other COP languages. In addition, it offers declarative composition statements that are specified within context modules and thus combines COP with concepts of aspect-oriented programming. * [https://www.hpi.uni-potsdam.de/hirschfeld/svn/cop/JCopProject/src/JCop/versions/ Download latest JCop Compiler] * [wiki:JCopInstallationManual JCop Manual] [WikiStart Back to JCop] = JCop Manual = This manual describes the usage of the JCop language compiler that is able to compile programs of the JCop and Java programming language. The compiler implements the language as defined in the JCop language specification ver- sion 1.0. The language definition has continuously been revised to precisely specify the language including various corner cases and combinations of features. The compiler is an extension to the JastAddJ Java compiler that is implemented based on the [http://jastadd.org/JastAdd JastAdd compiler framework]. == Installation == An archive containing the latest version of JCop and all necessary files is available [https://www.hpi.uni-potsdam.de/hirschfeld/svn/cop/JCopProject/src/JCop/versions/ here]. In addition, a JVM 1.5 or higher must be installed on the system. === Required Files === The following files are required to run the compiler at the command line. Besides the platform independent JAR archives the JCop distribution contains command scripts for Windows and Unix systems. * ''jcop.jar'', Executable archive that contains the JCop compiler. * ''aspectjtools.jar'', aspectjrt.jar, [http://www.eclipse.org/aspectj/ AspectJ] libraries that are required by jcop.jar. * ''aspectjweaver.jar'', [http://www.eclipse.org/aspectj/ AspectJ]library that is required for VM instrumentation at runtime. * ''agg_V165_classes.jar'', [http://user.cs.tu-berlin.de/~gragra/agg/ AGG] library required to generate an AGG graph instead of bytecode. * ''jcopc'' and ''jcop'' scripts for compilation and launching of JCop applications === Environment Variables === The compiler requires a JCOP_HOME environment variable pointing to the directory in which the above archives and scripts are located. For convenience, the folder should also be added to the path variable to ease the access to the command scripts. == Command Line Tools == === Compile === ==== Synopsis ==== {{{jcopc [Options] [file]}}} ==== Description ==== The jcopc command compiles JCop and Java source, producing .class files compliant with any Java VM (1.1 or later). The argument after the options specifies the source file to compile. Source files are specified by their full qualified name (package name + type name), separated by a dot (".") (rather than a folder delimiter as for javac). ==== Options ==== {{{-classpath }}} Specify where to find user class files and annotation processors. {{{-sourcepath }}} Specify where to find input source files. Only required if the sources aren’t located in the working directory. Example: {{{ jcopc -sourcepath src myPckg.MyMainClass }}} {{{-d }}} Specify where to place generated class files. Example: {{{ jcopc -d bin -sourcepath src myPckg.MyMainClass }}} {{{-sourcedump }}} Dumps Java source files of the compiled classes into the specified folder. Example: {{{ jcopc -sourcedump dump myPckg.MyMainClass }}} {{{-agg }}} Generates a file containing an AGG graph representation of the program’s AST. Example: {{{ jcopc -agg output/agg myPckg.MyMainClass }}} {{{-ctl}}} Output JCop specific messages about what the compiler is doing. Example: {{{ jcopc -ctl myPckg.MyMainClass ... > copying PartialMethod.java > to src\jcop\lang > ..done ... > compiling:...src\de\uni_potsdam\hpi\swa\Widget.jcop ..done > compiling:jcop\lang\Composition.java ..done ... > ..done > compile and weave auxilliary aspect bin\jcop\lang\JCopAspect.aj > ..done > compiled in 3723 millis }}} {{{-rtl}}} Loggs layer activation and composition information at runtime. Example: {{{ jcopc -rtl myPckg.MyMainClass ... > INFO: accessing base method of getBMI > INFO: accessing method getBMI of layer Visualization ... }}} {{{-verbose}}} Output messages about what the compiler is doing {{{-help}}} Print a synopsis of standard options {{{-aspectinfo}}} Output messages about aspect weaving {{{-version}}} Print version information. {{{-xml-outline-path }}} Generate an outline in XML format (useful for development environments) {{{-class-in-layer-outline}}} Generate an outline in XML format (useful for development environments) ==== File Names ==== jcopc accepts source files with either the .java extension or the .jcop extension.