Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


What is Janino?

Janino is a super-small, super-fast Java™ compiler. Not only can it compile a set of source files to a set of class files like JAVAC, but also can it compile a Java™ expression, block, class body or source file in memory, load the bytecode and execute it directly in the same JVM.

JANINO is integrated with Apache Commons JCI ("Java Compiler Interface") and JBoss Rules / Drools.

JANINO can also be used for static code analysis or code manipulation.

JANINO can be configured to use (available since JDK 1.6), i.e. JAVAC, which removes the Java 5-related limitations.



The major design goal was to keep the compiler small and simple, while providing an (almost) Java 1.4 / 5 compatible compiler.

The following elements of the Java programming language are implemented:

  • package declaration, import declaration
  • class declaration, interface declaration
  • Inheritance (extends and implements)
  • Static member type declaration
  • Inner (non-static member, local, anonymous) class declaration
  • Class initializer, instance initializer
  • Field declaration, method declaration
  • Local variable declaration
  • Class variable initializer, instance variable initializer
  • Block statement ({...})
  • if ... else statement
  • Basic for statement
  • Enhanced for statement (except for Iterable, which doesn't make much sense without generics)
  • while statement
  • do ... while statement
  • try ... catch ... finally statement
  • throw statement
  • return statement
  • break statement
  • continue statement
  • switch statement
  • synchronized statement
  • All primitive types (boolean, char, byte, short, int, long, float, double)
  • Assignment operator =
  • Compound assignment operators +=, -=, *=, /=, &=, |=, ^=, %=, <<=, >>=, >>>=
  • Conditional operators ?...:, &&, ||
  • Boolean logical operators &, ^, |
  • Integer bitwise operators &, ^, |
  • Numeric operators *, /, %, +, -, <<, >>, >>>
  • String concatenation operator +
  • Operators ++ and --
  • Type comparison operator instanceof
  • Unary operators +, -, ~, !
  • Parenthesized expression

Properties (cont'd.)

  • Field access (like System.out)
  • Superclass member access (super.meth(), super.field)
  • this (reference to current instance)
  • Alternate constructor invocation (this(a, b, c);)
  • Superclass constructor invocation (super(a, b, c);)
  • Method invocation (System.out.println("Hello"))
  • Class instance creation (new Foo())
  • Primitive array creation (new int[10][5][])
  • Class or interface array creation (new Foo[10][5][])
  • Array access (args[0])
  • Local variable access
  • Integer, floating-point, boolean, character, string literal
  • null literal
  • Unary numeric conversion, binary numeric conversion, widening numeric conversion, narrowing numeric conversion, widening reference conversion, narrowing reference conversion
  • Cast
  • Assignment conversion
  • String conversion (for string concatenation)
  • Constant expression
  • Block scope, method scope, class scope, global scope
  • throws clause
  • Array initializer (String[] a = { "x", "y", "z" })
  • Primitive class literals (int.class)
  • Non-primitive class literals (String.class)
  • References between uncompiled compilation units
  • Line number tables ("-g:lines")
  • Source file information ("-g:source")
  • Local variable information information ("-g:vars")
  • Handling of @deprecated doc comment tag
  • Accessibility checking (PUBLIC, PROTECTED, PRIVATE)
  • Checking of "definite assignment" (JLS7 16)
  • Methods that compile to more than 32 KB
  • assert (partial: assertions are always enabled, as if '-ea' were given)
  • Static imports (single and on-demand; fields, types and methods)
  • Autoboxing and unboxing
  • StringBuilder class used (if available) for string concatenation
  • Covariant return types
  • Annotations (partial: Not yet stored into the CLASS file)
  • @Override
  • Variable arity methods (a.k.a. "varargs")
  • Type arguments (List<String>) are parsed, but otherwise ignored



The following elements of the Java programming language are not implemented:

  • Declaration of parametrized types (type arguments, however, are (partially) implemented, see above)
  • Typesafe enums
  • Annotation declarations (annotation uses, however, are (partially) implemented, see above)