Class ScalaDiagnosticVisitor

java.lang.Object
io.micronaut.scala.processing.test.ScalaDiagnosticVisitor
All Implemented Interfaces:
io.micronaut.core.order.Ordered, io.micronaut.core.util.Toggleable, io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>

public final class ScalaDiagnosticVisitor extends Object implements io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>
Test visitor that reports a diagnostic against a chosen element, so a spec can assert where the compiler attributed it. VisitorContext is the only way a visitor can report anything, and the element it is given is the only thing that can carry a source position, so this is the seam the position plumbing has to be tested through.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The diagnostic severity to report.
    static enum 
    Which element of the visited class to blame.

    Nested classes/interfaces inherited from interface io.micronaut.inject.visitor.TypeElementVisitor

    io.micronaut.inject.visitor.TypeElementVisitor.VisitorKind
  • Field Summary

    Fields inherited from interface io.micronaut.core.order.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    Runs a compilation with this visitor reporting the given diagnostic.
    void
    visitClass(io.micronaut.inject.ast.ClassElement element, io.micronaut.inject.visitor.VisitorContext context)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.core.order.Ordered

    getOrder

    Methods inherited from interface io.micronaut.core.util.Toggleable

    isEnabled

    Methods inherited from interface io.micronaut.inject.visitor.TypeElementVisitor

    finish, getClassType, getElementType, getSupportedAnnotationNames, getSupportedOptions, getVisitorKind, query, start, visitConstructor, visitEnumConstant, visitField, visitMethod
  • Constructor Details

    • ScalaDiagnosticVisitor

      public ScalaDiagnosticVisitor()
  • Method Details

    • reporting

      public static void reporting(ScalaDiagnosticVisitor.Severity severity, ScalaDiagnosticVisitor.Target target, String message, Runnable runnable)
      Runs a compilation with this visitor reporting the given diagnostic.
      Parameters:
      severity - The severity
      target - The element to blame
      message - The message
      runnable - The compilation
    • visitClass

      public void visitClass(io.micronaut.inject.ast.ClassElement element, io.micronaut.inject.visitor.VisitorContext context)
      Specified by:
      visitClass in interface io.micronaut.inject.visitor.TypeElementVisitor<Object,Object>