Bugfix: replace mangled class names A$B with A.B after reading them via reflection. Bugfix: remove quotes when building path to tools.jar
A jynx.lib.hibernate package is added. Hibernate Annotations are used as mapping metadata.
java parser added
A javaparser package was added. It is basically used to improve type discovery but can be used for all sorts of situations where parsing Java code is required.
type dicovery heuristics improvement
One of the major problems of Java class JA_Cl generation from Jython classes JY_Cl is to discover all relevant Java classes which have to be imported in the generated class file. In previous Jynx versions all Java classes being found in the Python module Py_M which defines JY_Cl where imported. In the new appraoch JA_Cl will be parsed, type information is extracted and only those Java classes in Py_M are imported which are relevant for JA_Cl.
support for nested annotations
Nested annotations like @A(name = "foo", @Type(value= "integer")) can be represented in Python as A(name = "foo", Type(value = "integer")). When used as a decorator the complete Java annotation is recovered through reflection and the correct Java syntax is generated.
A getAnnotations(obj) function that takes a single parameter and returns all Java annotations is defined in jannotations. This function is missing at Jython core level.
method overloading supported
An optional boolean valued keyword parameter overload is added to the signature decorator defined in jannotations.
more flexible Jython translation
Custom pre- and postprocessors can be added to Jython -> Java translators. Instead of using the default @JavaClass decorator one can define now custom translators for special purposes e.g. from Python to annotated, persistent Entity Beans.
pulling annotations from method to jproperty
It is possible to pull annotations defined at a method and assign them to a jproperty object which represents Java member variables. The method annotations will be stripped then from a method.
supervising translation process
Both the jcompile.JavaCompiler class as well as the jannotations.JavaClass decorator will keep an optional display boolean valued keyword parameter. If set the generated Java code will be printed to stdout. This facilitates
Improvements in dynamic compilation and classloading
Jynx 0.2 had to store dynamically compiled Java code on disk first before it was loaded as a class. This was a workaround caused by a class loader bug. This bug is now removed and compiling/loading happens in memory just like a Python eval().
Changes in jclasspath.py
The urllib.py stdlibrary function pathname2url converts a Windows path C:\lang\... into an URL of the form file:///C|/lang/... substituting the colon ‘:’ with a vertical bar ‘|’. This is unacceptable when adding the converted path to the Java CLASSPATH using classloader.addURL().
Improved annotation support
In Jynx 0.1 an annotation was defined as
annotation("SupportedSourceVersion(value = SourceVersion.RELEASE_6)")
The Java annotation was quoted and Jynx provided a somewhat unreliable heuristics to detect the relevant types like SupportedSourceVersion and SourceVersion in the quoted string. This heuristics is still supported but the recommended way of using annotations is now to use the annotation.extract classmethod
from javax.annotation.processing import SupportedSourceVersion from javax.lang.model import SourceVersion SupportedSourceVersion = annotation.extract(SupportedSourceVersion) @SupportedSourceVersion(value = SourceVersion.RELEASE_6) class CodeAnalyzer(AbstractProcessor): ...
This method is both safer and more direct.
Change JUnit annotations
Since autodetection of Java annotation classes is not necessary anymore using the new annotation extraction mechanism
Setting Java classpath in Jython scripts
A new jclasspath module is added. It is documented here.