Java Diagnostic to Output filterSupportedSourceVersionWarnings( List> diagnostics)

Here you can find the source of filterSupportedSourceVersionWarnings( List> diagnostics)

Description

Filter out warnings about SupportedSourceVersion .

License

Open Source License

Declaration

public static List<Diagnostic<? extends JavaFileObject>> filterSupportedSourceVersionWarnings(
        List<Diagnostic<? extends JavaFileObject>> diagnostics) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

import javax.tools.Diagnostic;

import javax.tools.JavaFileObject;

public class Main {
    /**/*  w  ww.j  a va 2 s  .co  m*/
     * Filter out warnings about {@link SupportedSourceVersion}.
     * {@code metainf-services-1.1.jar} produces {@code warning: No SupportedSourceVersion annotation found on org.kohsuke.metainf_services.AnnotationProcessorImpl, returning RELEASE_6.} which is irrelevant to us.
     * (Development versions have already fixed this; when released and used here, delete this method.)
     */
    public static List<Diagnostic<? extends JavaFileObject>> filterSupportedSourceVersionWarnings(
            List<Diagnostic<? extends JavaFileObject>> diagnostics) {
        List<Diagnostic<? extends JavaFileObject>> r = new ArrayList<Diagnostic<? extends JavaFileObject>>();
        for (Diagnostic<? extends JavaFileObject> d : diagnostics) {
            if (!d.getMessage(Locale.ENGLISH).contains("SupportedSourceVersion")) {
                r.add(d);
            }
        }
        return r;
    }
}

Related

  1. diagnosticToString(final Diagnostic diagnostic, boolean usingAnomsgtxt)
  2. errorsToString( DiagnosticCollector diagnosticCollector)
  3. log(ProcessingEnvironment processingEnvironment, Diagnostic.Kind kind, CharSequence message)
  4. note(final ProcessingEnvironment processingEnv, final String message, final Object... args)
  5. raiseCompilerError(String error)