use of org.mapstruct.ap.testutil.compilation.annotation.CompilationResult in project mapstruct by mapstruct.
the class CompilationOutcomeDescriptor method forResult.
public static CompilationOutcomeDescriptor forResult(String sourceDir, CompilerResult compilerResult) {
CompilationResult compilationResult = compilerResult.isSuccess() ? CompilationResult.SUCCEEDED : CompilationResult.FAILED;
List<DiagnosticDescriptor> diagnosticDescriptors = new ArrayList<>();
for (CompilerMessage message : compilerResult.getCompilerMessages()) {
if (message.getKind() != CompilerMessage.Kind.NOTE) {
diagnosticDescriptors.add(DiagnosticDescriptor.forCompilerMessage(sourceDir, message));
}
// the eclipse compiler does not support NOTE (it is never actually set).
}
return new CompilationOutcomeDescriptor(compilationResult, diagnosticDescriptors, Collections.emptyList());
}
use of org.mapstruct.ap.testutil.compilation.annotation.CompilationResult in project mapstruct by mapstruct.
the class CompilationOutcomeDescriptor method forResult.
public static CompilationOutcomeDescriptor forResult(String sourceDir, boolean compilationSuccessful, List<Diagnostic<? extends JavaFileObject>> diagnostics) {
CompilationResult compilationResult = compilationSuccessful ? CompilationResult.SUCCEEDED : CompilationResult.FAILED;
List<String> notes = new ArrayList<>();
List<DiagnosticDescriptor> diagnosticDescriptors = new ArrayList<>();
for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics) {
// ignore notes created by the compiler
if (diagnostic.getKind() != Kind.NOTE) {
diagnosticDescriptors.add(DiagnosticDescriptor.forDiagnostic(sourceDir, diagnostic));
} else {
notes.add(diagnostic.getMessage(null));
}
}
return new CompilationOutcomeDescriptor(compilationResult, diagnosticDescriptors, notes);
}
Aggregations