Interface SymbolProcessor

  • All Implemented Interfaces:

    
    public interface SymbolProcessor
    
                        

    SymbolProcessor is the interface used by plugins to integrate into Kotlin Symbol Processing. SymbolProcessor supports multiple rounds of execution, a processor may return a list of deferred symbols at the end of every round, which will be passed to processors again in the next round, together with the newly generated symbols. On exceptions, KSP will try to distinguish between exceptions from KSP and exceptions from processors. Exceptions from processors will immediately terminate processing and be logged as an error in KSPLogger. Exceptions from KSP should be reported to KSP developers for further investigation. At the end of the round where exceptions or errors happened, all processors will invoke onError() function to do their own error handling.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract List<KSAnnotated> process(Resolver resolver) Called by Kotlin Symbol Processing to run the processing task.
      Unit finish() Called by Kotlin Symbol Processing to finalize the processing of a compilation.
      Unit onError() Called by Kotlin Symbol Processing to handle errors after a round of processing.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • process

         abstract List<KSAnnotated> process(Resolver resolver)

        Called by Kotlin Symbol Processing to run the processing task.

        Parameters:
        resolver - provides SymbolProcessor with access to compiler details such as Symbols.
        Returns:

        A list of deferred symbols that the processor can't process. Only symbols that can't be processed at this round should be returned. Symbols in compiled code (libraries) are always valid and are ignored if returned in the deferral list.

      • finish

         Unit finish()

        Called by Kotlin Symbol Processing to finalize the processing of a compilation.

      • onError

         Unit onError()

        Called by Kotlin Symbol Processing to handle errors after a round of processing.