META-INF/MANIFEST.MF
file of the JANINO JARs.
CompilerFactoryFactory.getSpecificationVersion()
and
ICompilerFactory.getImplementationVersion()
.
CompileException
was moved from package org.codehaus.janino
to package
org.codehaus.commons.compiler
(and so were its buddies Location
,
LocatedException
and CausedException
).
ParseException
and ScanException
were removed; all methods that previously threw
one or more of CompileException
, ParseException
and ScanException
now
throw only CompileException
. (This is an API simplification honoring the fact that applications
rarely want to differentiate between scan, parse and compilation problems).
org.codehaus.commons.compiler
, while the original API remains unchanged.
A second implementation of the org.codehaus.commons.compiler
interfaces was added, based on the
javax.tools.JavaCompiler
API that exists since JDK 1.6. This implementation is available in the
commons-compiler-jdk.jar
file.
Rather than instantiating e.g. org.codehaus.janino.ExpressionEvaluator
directly, applications can now
alternatively call
org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory().newExpressionEvaluator()
,
which will use the first implementation of IExpressionEvaluator
on the class path (be it
janino.jar
or commons-compiler-jdk.jar
, or yet another implementation).
The JUNIT regression test suite was restructured so that if differentiates between implementation-independent tests, which are automatically executed against every implementation on the class path, and implementation-specific tests.
Also, the following bugs were fixed:
RuntimeException
if cook()
is called more than once.
janino.jar
is now signed with a dummy certificate.
janino.jar
is now published as
http://www.janino.net/lib/janino.jar, so remote systems can always
download the latest version from a fixed URL.
import static java.util.Collections.EMPTY_MAP
),
types (e.g. import static java.util.Map.Entry
)
and methods (e.g. import static java.util.Arrays.asList
)
import static java.util.Collections.*
),
types (e.g. import static java.util.Map.*
)
and methods (e.g. import static java.util.Arrays.*
)
ExpressionEvaluator
and ScriptEvaluator
with the capability
to compile more than one expression/script in one evaluator. This greatly improves the runtime
performance and reduces the JVM resource usage if you need to compile many expressions/scripts at
the same time.
ClassLoader
that was set with
setParentClassLoader()
. In other words: The expression/script/class body/compilation
unit executes in a "sandbox", restricted by a ClassLoader
with minimal peepholes
to the classes you specify. This also resolves issue
JANINO-66 Security: restrict package access
TunnelException
with ClassNotFoundException(Throwable ex)
,
which makes exception handling much clearer. In retrospect,
TunnelExeption
has proven to be a bad concept.
Java.Xxx
PUBLIC for AST manipulation.
*Evaluator
s.
Scanner.close()
and all file-related Scanner
constructors are now deprecated, because (A) they sometimes left
input files open and (B) the logic was confusing - it is now strictly
the caller's responsibility to open and close input files.
*Evaluator
and the SimpleCompiler
classes. Important notice: ScriptEvaluator.evaluate()
had to be renamed to
ScriptEvaluator.getClazz()
due to a method signature clash with
ExpressionEvaluator.evaluate()
.
*Evaluator
and the SimpleComplier
classes.
JaninoTests
for class instance
creation (basically JLS2 section 15.9.1).
Scanner
now warns about misplaced DOC comments -- hence we need
to have a WarningHandler
installed also on the Scanner
.
.class
files could not be
instantiated.
Java
class hierarchy -- basically the
"uplink" of the AST objects is no longer set by a constructor parameter, but by the
constructor of the superordinate AST object. As a consequence, the creation order
of AST objects is no longer top-down, but bottom-up. This makes code that creates an AST
significantly shorter.
UnitCompiler
is now context-free, i.e. it can resolve types, constant
values etc. without compiling the unit. This is necessary for the upcoming
JGrep
utility (see below).
JGrep
utility -- a command line tool that analyses
a set of source files in a highly configurable way.
FormalParameter
PUBLIC.
Enumerator
and EnumeratorSet
classes,
inspired by "Effective Java".
CachingJavaSourceClassLoader
.
Compiler.compile(Resource[])
.
org.codehaus.janino.Compiler
is now based on the new ResourceCreator
class, so they
can not only be stored in files but anywhere (e.g. in a database).
(Requested by Andreas Schmidt 2005-10-19.)
Traverser
for static code analysis.
visit(...)
methods to accept(...)
for
conformance with GoF "Design Patterns".
@deprecated
.
Java
to UnitCompiler
.
This involved some minor incompatible changes:
Java.CompileException
to CompileException
.
Visitor
to Visitor.ComprehensiveVisitor
.
CompilationUnit
, VariableDeclarator
and
FormalParameter
from the visitors, because they are not virtual.
Scanner.Location
a top-level class.
PackageDeclaration
and ImportDeclaration
are now
AST objects.
ResourceFinder.findResource()
no longer returns a
URL
object, but a more abstract ResourceFinder.Resource
object (requested by Michael Orth 2005-03-22).
ByteArrayClassLoader
for thread safety.
optionalParentClassLoader
parameter of all *Evaluator
classes (see JAVADOC of EvaluatorBase(ClassLoader)
).
equals()
code> methods to ByteArrayClassLoader
and EvaluatorBase
.
Scanner
now allows for explicit initialization of line number and column
number (useful if the Java code begins only in the middle of a file.)
Iterator
s
like NestedIterator
, TransformingIterator
, and the
IteratorCollection
(a Collection
that reads its elements from
a delegate Iterator
while it is being iterated for the first time).
net.janino.tools.Disassembler
now has a verbose mode.
IClass
es.
getConstantValue()
.
BufferedReader
s when reading from files.
IClass
now caches the results of its abstract methods.
IClassLoader.loadIClass
no longer throws ClassNotFoundException
s,
but returns null
(save creation of a lot of objects).
SimpleCompiler
, ClassBodyEvaluator
and ScriptEvaluator
now add SOURCE and LINES debugging info, so file name and line number appear in exceptions
thrown by generated code. (Requested by Mike Hebert 2004-09-11.)
optionalFileName
parameter of net.janino.Scanner
's
constructors is null
and system property
net.janino.source_debugging.enable
is "true". The source code file is written
to net.janino.source_debugging.dir
or the system's default temp directory.
(You need to add that directory to your debugger's "source lookup path".)
EvaluatorBase
generated no output.
net.janino.UnparseVisitor
.
net.janino.UnparseVisitor
that unparses a
parsed construct, e.g. a compilation unit (requested by Mark Proctor).
net.janino.Java
public to allow for
generation of "synthetic" constructs (requested by Mark Proctor).
net.janino.Scanner.LocatedException
for all
JANINO-related exceptions.
net.janino.ExpressionEvaluator
now supports null
expression types; this auto-wraps primitive values as necessary. (Requested by
Amir Bar-Or 2004-05-31).
A major milestone... Janino now supports member types, local classes and anonymous classes. Therefore you can legitimally call a fully implemented JavaTM compiler!
A good time to open a bottle of champagne...
net.janino.Compiler
now reports up to 20 compile errors before it gives up.
(Notice that scanning, parsing and I/O exceptions are still fatal and terminate compilation.)
NullPointerException
in the AntCompilerAdapter
.
ExpressionEvaluator
and the
ScriptEvaluator
.
Compiler
and AntCompilerAdapter
now
provide for the "extdirs" and "bootclasspath" features.
AntCompilerAdapter
now honors most of the options that ANT passes to it.
IClassLoader
used to load
classes defined outside the current compilation unit are now stored in
thread-local globals. The IClassLoader
also holds the formerly
global IClass
cache, which caused a memory leak (reported by
Fabrice Carnet 2003-05-20).
IClass.isAssignableFrom(net.janino.IClass)
did not handle primitive types (reported
by Fabrice Carnet 2003-05-20).
ClassLoader
, if that is a
ByteArrayClassLoader
.
This is necessary if the expressions, scripts and classes need to refer to each other.
(Requested by Fabirce Carnet 2003-05-20.)
java.lang.NullPointerException
.
net.janino.ClassLoaderIClassLoader.ReflectionIClass
holds a map
that guarantees that java.lang.Class
es and IClass
es
map one-to-one. This posed a memory leak. (Reported by Fabrice Carnet 2003-05-20.)
ClassBodyEvaluator
.
java.lang.ClassLoader
used to load the just-compiled
class now uses as its parent the current thread's context class loader
(reported by Fabrice Carnet 2003-03-26).
break
and continue
.
Signed JAR files of the latest version: commons-compiler.jar janino.jar commons-compiler-jdk.jar