Skip to content

Releases: miho/JCompiler

v0.5.0

22 Sep 15:51
Compare
Choose a tag to compare
fixed vmf test

Dependencies via URL classloader improved

07 Jun 15:59
Compare
Choose a tag to compare

Dependencies specified via URL classloader are recognized by compiler. This is done by adding urls of the classloader to the classpath of the compile task.

API documentation improved, debug output removed

11 Mar 09:30
Compare
Choose a tag to compare
v0.3

preparing next release (removed debug output)

Classloading fixed.

10 Mar 21:46
Compare
Choose a tag to compare
v0.2

Merge branch 'master' of github.com:miho/InMemoryJavaCompiler

Initial Release with new API

10 Mar 19:11
8a59b17
Compare
Choose a tag to compare

The new API separates the steps between compilation and classloading:

CompilationResult result = JCompiler.newInstance().compile("public class MyClass {}").checkErrors();
Class<?> myClass = result.loadClasses().get("MyClass");    

Additionally, it is not necessary anymore to specify the class name manually:

JCompiler.newInstance().addSource("MyClass", "public class MyClass {}").compileAll();

is now reduced to

JCompiler.newInstance().addSource("public class MyClass {}").compileAll();

The name is inferred from the code.

Classes are grouped by compilation unit:

CompilationResult result = //...
List<CompiledUnit> compiledUnits = result.getCompiledUnits();

for(CompiledUnit cu : compiledUnits) {
  List<CompiledClass> classes = cu.getClasses();
  for(CompiledClass cc : classes) {
     // do something with cc
  }
}

Internal classes and non public classes are also loaded and included in the result.

Furthermore, this version is compatible with the old InMemoryJavaCompiler API. The old API is driven by the new JCompiler class. It is tested against the existing test cases for the old API.

The new API is partly inspired by PRs from @ruediste and @benor1470.