package org.realityforge.arez.processor;

import javax.annotation.Nonnull;
import javax.annotation.processing.Messager;
import javax.lang.model.element.Element;
import javax.tools.Diagnostic;

class ArezProcessorException
  extends Exception
{
  private final Element _element;

  ArezProcessorException( @Nonnull final String message, @Nonnull final Element element )
  {
    super( message );
    _element = element;
  }

  void print( @Nonnull final Messager messager )
  {
    if ( null != _element )
    {
      messager.printMessage( Diagnostic.Kind.ERROR, getMessage(), _element );
    }
    else
    {
      messager.printMessage( Diagnostic.Kind.ERROR, getMessage() );
    }
  }
}

@@ -237,16 +237,27 @@
 ption%0A%7B%0A
+  @Nonnull%0A
   privat
@@ -413,24 +413,48 @@
 lement =
+ Objects.requireNonNull(
  element
 ;%0A  %7D%0A%0A 
@@ -445,16 +445,18 @@
  element
+ )
 ;%0A  %7D%0A%0A 

Enforce nullability annotation