Package org.codehaus.janino
package org.codehaus.janino
The core of the Janino Java compiler.
The package comprises a scanner (Scanner
, a parser (Parser
) and a class file library. The parser builds a syntax tree from the "Java.*" classes
that represents the parsed code. The UnitCompiler.compileUnit(boolean, boolean, boolean)
method compiles this syntax tree into a ClassFile
object, which can
write JVM bytecode to an OutputStream
.
This package implements the org.codehaus.commons.compiler
API.
-
ClassDescriptionReturn value for
IClass.IMember.getAccess()
.A simpleCompilerAdapter
for the "ant" tool that silently ignores most of the configuration parameters and attempts to compile all given source files into class files.AJavaSourceClassLoader
that uses a resource storage provided by the application to cache compiled classes and thus saving unnecessary recompilations.The context of the compilation of a function (constructor or method).Representation of an entry in the "exception_table" of a "Code" attribute (see JVMS 4.7.3).A throw-in interface that marksCodeContext.Offset
s as "fix-ups": During the execution ofCodeContext.fixUp()
, all "fix-ups" are invoked and can do last touches to the code attribute.JANINO implementation ofICompiler
.The JANINO implementation ofICompilerFactory
.Helper class that defines useful methods for handling "field descriptors" (JVMS 4.3.2) and "method descriptors" (JVMS 4.3.3).ThisIExpressionEvaluator
is implemented by creating and compiling a temporary compilation unit defining one class with one static method with one RETURN statement.Invokes a delegate iff the handle of the warning matches one or more of a set ofStringPattern
s.A simplified equivalent to "java.lang.reflect".Representation of a Java "annotation".Base for the members of anIClass
.Loads anIClass
by type name.Type bounds can either be a class or interface type, or a type variable.The compilation ofCompiler
,JavaSourceIClassLoader
,SimpleCompiler
and their subclasses can be configured with these options.This wrapper class defines classes that represent the elements of the Java programming language.Convenience class.Base for the various class declaration kinds.Holds the result ofParser.parseAbstractCompilationUnit()
.Base class for the various IMPORT declarations.Represents a single static import declaration likeRepresents a "single-type import declaration" like "import java.util.Map;
".Represents a static-import-on-demand declaration likeRepresents a type-import-on-demand declaration likeimport java.util.*;
.Abstract implementation ofJava.TypeBodyDeclaration
.Abstract implementation ofJava.TypeDeclaration
.Representation of the modifier flags and annotations that are associated with a declaration.Representation of a JLS7 8.8.7.1.Representation of a JLS7 6.5.2 "ambiguous name".Representation of Java elements that can be annotated: Fields, constructors, methods, type declarations.Representation of a Java annotation.Base for package member ("top-level") and member ("nested") annotation type declarations.Representation of a JLS7 15.9.5 "anonymous class declaration".Representation of a JLS7 15.13 (JLS8: 15.10.3) "array access expression".Representation of a "method reference expression", as described in JLS9 15.13, with the form "<var>arrayType</var>::new
".Representation of a JLS7 10.6 "array initializer".The union ofJava.ArrayInitializer
andJava.Rvalue
.Representation of the JLS7 10.7 array type "length" pseudo-member.Representation of a JLS7 10.1 "array type".Representation of the JLS7 14.10 ASSERT statement.Representation of all JLS7 15.26 assignments.Representation of all non-operand-modifying binary operations.Representation of a Java "block" (JLS7 14.2).Representation of a "lambda body" that is a block; see JLS9 15.27.2.Everything that can be compiled to code, e.g.Representation of a "boolean literal" (JLS7 3.10.3) (typeboolean
).Base class forJava.Rvalue
s that compile better as conditional branches.Base class for statements that can be terminated abnormally with abreak
statement.Representation of the JLS7 14.15 BREAK statement.Representation of a JLS7 15.16 "cast expression".Representation of a JLS7 14.20.1 CATCH clause.Representation of a "catch" parameter.Representation of a "character literal" (JLS7 3.10.4) (typechar
).Base for the various class declarations (top-level class, local class, anonymous class, nested class, top-level enum, nested enum).Representation of a "method reference expression", as described in JLS9 15.13, with the form "<var>classType</var>::new
".Representation of a JLS7 15.8.2 "class literal".Representation of an "ordinary compilation unit" as explained in JLS9 7.3 (before Java 9 known as "compilation unit" and described in JLS8 7.3).Representation of a JLS7 15.25 "conditional operation".Representation of a constructor declarator.Abstract bas class forJava.SuperConstructorInvocation
andJava.AlternateConstructorInvocation
.Base class for statements that support the "continue" statement.Representation of the JLS7 14.16 CONTINUE statement.Representation of a JLS7 15.14.2 "postfix increment operation", a JLS7 15.14.3 "postfix decrement operation", a JLS7 15.15.1 "prefix increment operation" or a JLS7 15.15.2 "prefix decrement operation".Representation of a Java element that can be annotated with a DOC comment ("/** ...
Representation of a JLS7 14.13 DO statement.Base of the possible element values in aJava.NormalAnnotation
.An element value in the form of an array initializer, e.g.Representation of a "name = value" element in aJava.NormalAnnotation
.Representation of the "empty statement", i.e.Lazily determines and returns the enclosingJava.Scope
of the givenJava.TypeDeclaration
.Representation of an "enum constant", see JLS7 8.9.1.Base for package member (a.k.a.Representation of a (Java 9+) "exports directive", as explained in JLS9 7.7.2.Representation of a "lambda body" that is an expression; see JLS9 15.27.2.Representation of the JLS7 14.8 "expression statement".Representation of an access to a field of a class or an interface.Representation of a JLS7 15.11 "field access expression", including the "array length" pseudo field access.This class is derived from "Statement", because it provides for the initialization of the field.Representation of a "floating-point literal" (JLS7 3.10.2) (typesfloat
anddouble
).Representation of a JLS7 14.14.2 "enhanced FOR statement".Representation of "lamba parameters" that include a formal parameter list; see JLS9 15.27.1.Representation of a JLS7 14.14.1 "basic FOR statement".Abstract base class forJava.ConstructorDeclarator
andJava.MethodDeclarator
.Representation of a (formal) function parameter.Representation of the (formal) function parameters.Representation of "lamba parameters" that consist of a single identifier; see JLS9 15.27.1Representation of a JLS7 14.9 IF statement.Representation of "lamba parameters" that include an inferred formal parameter list; see JLS9 15.27.1.Representation of an "instance initializer" (JLS7 8.6) or "static initializer" (JLS7 8.7).Represents the declaration of an inner class, i.e.Representation of a JLS7 15.20.2 "type comparison operation".Representation of an "integer literal" (JLS7 3.10.1) (typesint
andlong
).Base for the various interface declaration kinds.Abstract base class forJava.MethodInvocation
andJava.SuperclassMethodInvocation
.Representation of a JLS7 14.7 "labeled statement".Representation of a "lambda body", see JLS9 15.27.2.Representation of a (Java 8+) "lambda expression", see JLS9 15.27.Base for the various "lambda parameters" styles, see JLS9 15.27.1.Abstract base class for the various Java literals; see JLS7 3.10.Representation of a "local class declaration" i.e.Representation of the JLS7 14.3 "local class declaration statement".Representation of a local variable while it is in scope during compilation.Representation of a local variable access -- used during compilation.Representation of a JLS7 14.4 "local variable declaration statement".All local variables have a slot number; local variables that get written into the "local variable table" also have a start and end offset that defines the variable's extent in the bytecode.This interface is implemented by objects which are associated with a location in the source code.Abstract implementation ofJava.Locatable
.Representation of an "lvalue", i.e.Representation of a "marker annotation", i.e.Representation of a member annotation type declaration, a.k.a.Representation of a "member class declaration", i.e.Representation of a "member enum declaration", i.e.Representation of a "member interface declaration", i.e.Represents a class or interface declaration where the immediately enclosing scope is another class or interface declaration.Representation of a method declarator.Representation of a JLS7 15.12 "method invocation expression".Representation of a "method reference expression", as described in JLS9 15.13, with the form "<var>referenceType</var>::identifier
.Base for the various modifiers (access modifiers, annotations).Deprecated.Represents aModularCompilationUnit
as specified in JLS11 7.3.Representation of a "module declaration", as described in JLS9 7.7.Representation of a (Java 9+) "module directive", as explained in JLS9 7.7.Base for the various named class declarations.Represents the declaration of a class or an interface that has a name.Representation of a JLS7 15.9 "anonymous class instance creation expression".Representation of a JLS7 15.10 "array creation expression".Representation of a JLS7 "class instance creation expression".Representation of a JLS7 15.10 "array creation expression".A "normal annotation", i.e.Representation of a "null literal" (JLS7 3.10.7).Representation of a (Java 9+) "opens directive", as explained in JLS9 7.7.2.Representation of a JLS7 6.5.2.1.5 "package name".Representation of a package declaration likepackage com.acme.tools;
.Representation of a package member annotation type declaration, a.k.a.Implementation of a "package member class declaration", a.k.a.Implementation of a "package member enum declaration", a.k.a.Representation of a "package member interface declaration", a.k.a.Represents a class or interface declaration on compilation unit level."Artificial" operation for accessing the parameters of the synthetic constructor of an anonymous class.Representation of a JLS7 15.8.5 "parenthesized expression".Java's primitive types.Representation of a JLS7 4.2 "primitive type", i.e a primitive type "usage", which has a location.Representation of a (Java 9+) "provides directive", as explained in JLS9 7.7.4.Representation of an JLS7 15.8.4 access to the current object or an enclosing instance.Representation of a JLS7 4.3 reference type.Representation of a (Java 9+) "requires directive", as explained in JLS9 7.7.1.Representation of the JLS7 14.17 RETURN statement.Representation of an "rvalue", i.e.Representation of the first part of a JLS7 15.9 "Qualified class instance creation expression": The "a.new MyClass
" part of "a.new MyClass(...)
" expression.Representation of a Java "scope", e.g.This class is not used when code is parsed; it is intended for "programmatic" literals.This class is not used when code is parsed; it is intended for "programmatic" types.Representation of a "single-element annotation", i.e.Everything that can occur in the body of a method or in a block.Representation of a "string literal" (JLS7 3.10.5) (typeString
).Representation of an JLS7 "superclass field access expression", e.g.Representation of a JLS7 15.12.1.1.3 "superclass method invocation".Representation of a JLS7 8.8.7.1.The JLS7 14.10switch
Statement.Representation of a "switch block statement group" as defined in JLS7 14.11.Representation of a JLS7 14.9 SYNCHRONIZED statement.Representation of an JLS7 15.8.3 access to the innermost enclosing instance.Representation of a JLS7 14.18 THROW statement.Representation of a JLS7 14.20 TRY statement.Representation of a JLS9 14.20.2 "local-variable-declarator resource" in a TRY-with-resources statement.Representation of a JLS9 14.20.2 "resource" in a TRY-with-resources statement.Representation of a JLS9 14.20.2 "variable-access resource" in a TRY-with-resources statement.Representation of a Java type.Representation of a JLS7 4.5.1 type argument.Representation of a "ClassBodyDeclaration" or an "InterfaceMemberDeclaration".Base for the various kinds of type declarations, e.g.Representation of a type parameter (which declares a type variable).Representation of a JLS7 15.15.3 "unary plus operator", a JLS7 15.15.4 "unary minus operator", a JLS7 15.15.5 "bitwise complement operator" or a JLS7 15.15.6 "logical complement operator".Representation of a (Java 9+) "uses directive", as explained in JLS9 7.7.3.Used by FieldDeclaration and LocalVariableDeclarationStatement.Representation of the JLS7 14.2 WHILE statement.Representation of a JLS7 4.5.1 "wildcard".AClassLoader
that, unlike usualClassLoader
s, does not load byte code, but reads Java source code and then scans, parses, compiles and loads it into the virtual machine.ThisIClassLoader
finds, scans and parses compilation units.Representation of a "method descriptor" (JVMS 4.3.3).This class defines constants and convenience methods for the handling of modifiers as defined by the JVM.Definitions of JVM bytecode opcodes.A parser for the Java programming language.The kinds of context where a class declaration can occur.The kinds of context where an interface declaration can occur.The kinds of context where a method declaration can occur.Splits up a character stream into tokens and returns them asString
objects.An implementation ofIScriptEvaluator
that utilizes the JANINO Java compiler.To set up aSimpleCompiler
object, proceed as described forISimpleCompiler
.Immutable representation of a Java token.An interface that allows for peeking and consuming a stream ofToken
s.Standard implementation for theTokenStream
.Represents a problem that occurred while unescaping a unicode escape sequence through aUnicodeUnescapeReader
.AFilterReader
that unescapes the "Unicode Escapes" as described in JLS7 3.10.6.This class actually implements the Java compiler.Helper interface for string conversion.Interface for delayed code generation.Short-hand implementation ofIClass.IField
that implements a non-constant, non-static, package-accessible field.Unparses (un-compiles) an AST to aWriter
.The basis for the "visitor" pattern as described in "Gamma, Helm, Johnson, Vlissides: Design Patterns".Visitor.AbstractCompilationUnitVisitor<R,EX extends Throwable> The visitor for the different kinds ofJava.AbstractCompilationUnit
s.Visitor.AnnotationVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.Annotation
s.Visitor.AtomVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.Atom
s.Visitor.BlockStatementVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.BlockStatement
s (statements that may appear with a block).Visitor.ConstructorInvocationVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.ConstructorInvocation
s.Visitor.ElementValueVisitor<R,EX extends Throwable> Visitor.FieldDeclarationOrInitializerVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.BlockStatement
s (statements that may appear with a block).Visitor.FunctionDeclaratorVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.FunctionDeclarator
s.Visitor.ImportVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.AbstractCompilationUnit.ImportDeclaration
s.Visitor.LambdaBodyVisitor<R,EX extends Throwable> The visitor for the different kinds ofJava.LambdaBody
s.Visitor.LambdaParametersVisitor<R,EX extends Throwable> The visitor for the different kinds ofJava.LambdaParameters
styles.Visitor.LvalueVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.Lvalue
s.Visitor.ModifierVisitor<R,EX extends Throwable> The visitor for the different kinds ofJava.Modifier
s.Visitor.ModuleDirectiveVisitor<R,EX extends Throwable> The visitor for the different kinds ofJava.ModuleDirective
s.Visitor.RvalueVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.Rvalue
s.Visitor.TryStatementResourceVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.TryStatement.Resource
s.Visitor.TypeArgumentVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.TypeArgument
s.Visitor.TypeBodyDeclarationVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.TypeBodyDeclaration
s (declarations that may appear in the body of a type declaration).Visitor.TypeDeclarationVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.TypeDeclaration
s.Visitor.TypeVisitor<R,EX extends Throwable> The visitor for all kinds ofJava.Type
s.
Java.Modifier
[]
(incompatible API change in JANINO version 3.0.13)