diff --git a/jOOQ/src/main/java/org/jooq/tools/reflect/Compile.java b/jOOQ/src/main/java/org/jooq/tools/reflect/Compile.java index a0da75b402..28354c0f67 100644 --- a/jOOQ/src/main/java/org/jooq/tools/reflect/Compile.java +++ b/jOOQ/src/main/java/org/jooq/tools/reflect/Compile.java @@ -17,6 +17,7 @@ package org.jooq.tools.reflect; import java.io.ByteArrayOutputStream; import java.io.OutputStream; +import java.io.StringWriter; import java.lang.invoke.MethodHandles; import java.lang.invoke.MethodHandles.Lookup; import java.net.URI; @@ -55,8 +56,13 @@ class Compile { List files = new ArrayList(); files.add(new CharSequenceJavaFileObject(className, content)); + StringWriter out = new StringWriter(); compiler.getTask(null, fileManager, null, null, null, files).call(); + + if (fileManager.o == null) + throw new ReflectException("Compilation error: " + out); + Class result = null; // This works if we have private-access to the interfaces in the class hierarchy @@ -106,6 +112,9 @@ class Compile { return result; } + catch (ReflectException e) { + throw e; + } catch (Exception e) { throw new ReflectException("Error while compiling " + className, e); }