com.softicar.platform.common.code.java.compiler.RuntimeCompilerDiagnostic Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of platform-common Show documentation
Show all versions of platform-common Show documentation
The SoftiCAR Platform is a lightweight, Java-based library to create interactive business web applications.
package com.softicar.platform.common.code.java.compiler;
import javax.tools.Diagnostic;
import javax.tools.JavaFileObject;
public class RuntimeCompilerDiagnostic {
private final Diagnostic diagnostic;
public RuntimeCompilerDiagnostic(Diagnostic diagnostic) {
this.diagnostic = diagnostic;
}
@Override
public String toString() {
if (diagnostic != null) {
JavaFileObject source = diagnostic.getSource();
return String.format("Error in %s:%s: %s", source != null? source.getName() : "unknown", diagnostic.getLineNumber(), diagnostic.getMessage(null));
} else {
return String.format("Error: cannot show diagnostic message because diagnostic object is null");
}
}
}