Skip to content

Commit da1628c

Browse files
committed
updated usage in README
1 parent 5bc983b commit da1628c

1 file changed

Lines changed: 1 addition & 14 deletions

File tree

README.md

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,7 @@ E.g.:
1515
sourceCode.append(" public String hello() { return \"hello\"; }");
1616
sourceCode.append("}");
1717

18-
Class<?> helloClass = InMemoryJavaCompiler.compile("org.mdkt.HelloClass", sourceCode.toString());
19-
20-
Alternatively, if you want to load several (dependent) classes:
21-
22-
String cls1 = "public class A{ public B b() { return new B(); }}";
23-
String cls2 = "public class B{ public String toString() { return \"B!\"; }}";
24-
25-
InMemoryJavaCompiler compiler = new InMemoryJavaCompiler();
26-
compiler.addSource("A", cls1);
27-
compiler.addSource("B", cls2);
28-
Map<String,Class<?>> compiled = compiler.compileAll();
29-
30-
Class<?> aClass = compiled.get("A");
31-
18+
Class<?> helloClass = InMemoryJavaCompiler.newInstance().compile("org.mdkt.HelloClass", sourceCode.toString());
3219

3320
Artifact is pushed to Sonatype OSS Releases Repository
3421

0 commit comments

Comments
 (0)