diff --git a/core/src/main/java/de/mirkosertic/bytecoder/core/ir/ResolvedClass.java b/core/src/main/java/de/mirkosertic/bytecoder/core/ir/ResolvedClass.java index e9a204a90d..6e9f757939 100644 --- a/core/src/main/java/de/mirkosertic/bytecoder/core/ir/ResolvedClass.java +++ b/core/src/main/java/de/mirkosertic/bytecoder/core/ir/ResolvedClass.java @@ -117,14 +117,6 @@ public ResolvedMethod resolveMethod(final String methodName, final Type methodTy } return m; } - - private String printStackTrace(AnalysisStack analysisStack) { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - PrintStream stringStream = new PrintStream(bos); - analysisStack.dumpAnalysisStack(stringStream); - return "\n" + bos; - } - private ResolvedMethod resolveMethodInternal(final String methodName, final Type methodType, final AnalysisStack analysisStack, final boolean onlyImplementations) { for (final ResolvedMethod m : resolvedMethods) { final MethodNode methodNode = m.methodNode; diff --git a/maven/src/main/java/de/mirkosertic/bytecoder/maven/BytecoderMavenMojo.java b/maven/src/main/java/de/mirkosertic/bytecoder/maven/BytecoderMavenMojo.java index b091839c4b..c573bb3b66 100644 --- a/maven/src/main/java/de/mirkosertic/bytecoder/maven/BytecoderMavenMojo.java +++ b/maven/src/main/java/de/mirkosertic/bytecoder/maven/BytecoderMavenMojo.java @@ -21,6 +21,7 @@ import de.mirkosertic.bytecoder.core.backend.wasm.WasmBackend; import de.mirkosertic.bytecoder.core.backend.wasm.WasmCompileResult; import de.mirkosertic.bytecoder.core.backend.wasm.WasmIntrinsics; +import de.mirkosertic.bytecoder.core.ir.AnalysisException; import de.mirkosertic.bytecoder.core.ir.AnalysisStack; import de.mirkosertic.bytecoder.core.loader.BytecoderLoader; import de.mirkosertic.bytecoder.core.optimizer.Optimizations; @@ -38,8 +39,10 @@ import org.apache.maven.project.MavenProject; import org.objectweb.asm.Type; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; +import java.io.PrintStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; @@ -120,7 +123,7 @@ public void execute() throws MojoExecutionException { if ("js".equals(backend)) { final CompileUnit compileUnit = new CompileUnit(loader, new Slf4JLogger(), new JSIntrinsics()); - final Type invokedType = Type.getObjectType(mainClass.replace('.','/')); + final Type invokedType = Type.getObjectType(mainClass.replace('.', '/')); compileUnit.resolveMainMethod(invokedType, "main", Type.getMethodType(Type.VOID_TYPE, Type.getType("[Ljava/lang/String;"))); @@ -147,7 +150,7 @@ public void execute() throws MojoExecutionException { } else { final CompileUnit compileUnit = new CompileUnit(loader, new Slf4JLogger(), new WasmIntrinsics()); - final Type invokedType = Type.getObjectType(mainClass.replace('.','/')); + final Type invokedType = Type.getObjectType(mainClass.replace('.', '/')); compileUnit.resolveMainMethod(invokedType, "main", Type.getMethodType(Type.VOID_TYPE, Type.getType("[Ljava/lang/String;"))); @@ -172,11 +175,20 @@ public void execute() throws MojoExecutionException { } } } + } catch (final AnalysisException e) { + throw new MojoExecutionException("Error running Bytecoder : " + printStackTrace(e.getAnalysisStack()), e); } catch (final Exception e) { - throw new MojoExecutionException("Error running bytecoder", e); + throw new MojoExecutionException("Error running Bytecoder", e); } } + private String printStackTrace(final AnalysisStack analysisStack) { + final ByteArrayOutputStream bos = new ByteArrayOutputStream(); + final PrintStream stringStream = new PrintStream(bos); + analysisStack.dumpAnalysisStack(stringStream); + return "\n" + bos; + } + protected boolean isSupportedScope(final String scope) { switch (scope) { case Artifact.SCOPE_COMPILE: diff --git a/pom.xml b/pom.xml index bf64aeb675..c940c28817 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ UTF-8 - 1.8.22 + 1.8.21 1.11.1