Package spoon
Class JLSViolation
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
spoon.SpoonException
spoon.JLSViolation
- All Implemented Interfaces:
Serializable
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
-
Field Summary
Fields inherited from class spoon.SpoonException
LOGGER -
Method Summary
Modifier and TypeMethodDescriptionstatic voidthrowIfSyntaxErrorsAreNotIgnored(FactoryAccessor holder, String reason)Handles a JLSViolation according to the environment settings.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Method Details
-
throwIfSyntaxErrorsAreNotIgnored
Handles a JLSViolation according to the environment settings. IfEnvironment.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.
-