Package spoon

Class JLSViolation

All Implemented Interfaces:
Serializable

public class JLSViolation extends SpoonException
This exception is thrown when an operation on a CtElement transfers it in an invalid state.

An invalid state is a state that is not conform to the JLS. For example, a CtMethod is in an invalid state if it is abstract and has a body.

See Also:
Serialized Form
  • Method Details

    • throwIfSyntaxErrorsAreNotIgnored

      public static void throwIfSyntaxErrorsAreNotIgnored(FactoryAccessor holder, String reason)
      Handles a JLSViolation according to the environment settings. If Environment.getIgnoreSyntaxErrors() is set to true, the exception is ignored. Otherwise, the exception is thrown.
      Parameters:
      holder - an object with access to factory and environment.
      reason - the reason for the exception.