jOOQ / jOOR

jOOR - Fluent Reflection in Java jOOR is a very simple fluent API that gives access to your Java Class structures in a more intuitive way. The JDK's reflection APIs are hard and verbose to use. Other languages have much simpler constructs to access type meta information at runtime. Let us make Java reflection better.
http://www.jooq.org/products
Apache License 2.0
2.8k stars 377 forks source link

Throw a better exception than a NPE when no compiler can be found #108

Closed lukaseder closed 3 years ago

lukaseder commented 3 years ago

When Reflect.compile() can't find a ToolProvider::getSystemJavaCompiler, a NullPointerException is thrown (see https://github.com/jOOQ/jOOR/issues/107):

Exception in thread "main" org.joor.ReflectException: Error while compiling Name
        at org.joor.Compile.compile(Compile.java:158)
        at org.joor.Reflect.compile(Reflect.java:104)
        at Main.main(Main.java:12)
Caused by: java.lang.NullPointerException
        at org.joor.Compile.compile(Compile.java:66)
        ... 2 more

A better exception could be thrown instead to help users troubleshoot this issue.