KOPI
PrevChapter 2. The KOPI Kopi Java CompilerNext

KJC, another Java compiler

KJC is not the first freely available Java compiler but it provides some new features not previously available. These features are:

Since KJC is a GNU a project, it is easy to improve by sending us patches or suggestions. Since it is maintained by a small team of engineers, the development cycle of new releases is far shorter than the JavaC one.

Comparison with other compilers

There are mainly two other compilers for Java freely available: Javac and jikes. Javac is error-proof and has a role of reference, and jikes is extremly fast. This table shows the differences between these two compilers and KJC:

Table 2-1. Comparison with other compilers

FeatureJavacJikes

KJC

License model Community Source Code Jikes Public license GNU Public License
LanguageJavaC++Java
Supported platformAll platforms with a Java VMAlmost allAll platforms with a Java VM
SpeedSlowVery fast-
ExtendabilityPoorPoorGood
Generated codeGood with -ONo optimizations-
AuditingNoPoor with -warningStill at an early level

KJC advantages

Free software

KJC is distributed under the term of a GNU public license and thus can be integrated freely in any other GNU project. The source code is part of the standard distribution and will help you understand the behavior of the program. It will also allow you to extend it.

Extensible

This Java compiler written in Java is easily extensible. We have developed a lot of tools over KJC like XKJC and VKJC. These tools generates classfiles without any knowledge of the underlying Java bytecode convention (Stack size, verifier convention, ...).

Auditing features

An auditing tool helps you follow the Java code convention and avoid common errors that can be easily detected by a compiler. We have started to extend KJC with warnings to enforce the respect of this convention. This part of KJC is still in an early development stage, but will be our main focus for the next release (1.4).

Beautifier

KJC can read a .Java file and rewrite it following the Java Code Conventions. This can be useful when you get some source files from someone else and want to convert them into something readable. It is also useful for tools extending KJC to generate 100% pure Java code.

Optimizer

The code generation is based on at.dms.classfile and at.dms.optimizer. This last package is focused on bytecode optimization and will be improved in the next release. It already supports multi-pass optimizations, dead code removal and peephole optimization.


PrevHomeNext
The KOPI Kopi Java CompilerUpUsage