Class AnnotationValidator

java.lang.Object
org.rumbledb.compiler.utils.AnnotationValidator

public final class AnnotationValidator extends Object
Static validation and resolution of annotations on function declarations, variable declarations, and inline function expressions.
  • Method Details

    • validateAnnotationName

      public static void validateAnnotationName(Name annotationName, ExceptionMetadata metadata)
      Validates an annotation name against reserved namespaces according to W3C XQuery 3.1 §4.17/§4.18 [err:XQST0045].
      Parameters:
      annotationName - the annotation name to validate
      metadata - the source location metadata
    • checkAssignable

      public static boolean checkAssignable(List<Annotation> annotations, boolean defaultAssignable, ExceptionMetadata exceptionMetadata)
      Checks assignable annotations for exclusivity and returns whether the declaration is assignable.
      Parameters:
      annotations - the list of annotations
      defaultAssignable - default assignable state if not specified
      exceptionMetadata - the source location metadata
      Returns:
      true if assignable, false otherwise
    • validateFunctionAnnotations

      public static void validateFunctionAnnotations(List<Annotation> annotations)
      Validates annotations on a function declaration according to W3C XQuery 3.1 §4.18 [err:XQST0106]. A function declaration cannot contain more than one visibility annotation (%public, %private).
      Parameters:
      annotations - the list of annotations
    • validateVariableAnnotations

      public static void validateVariableAnnotations(List<Annotation> annotations)
      Validates annotations on a variable declaration according to W3C XQuery 3.1 §4.17 [err:XQST0116]. A variable declaration cannot contain more than one visibility annotation (%public, %private).
      Parameters:
      annotations - the list of annotations
    • validateInlineFunctionAnnotations

      public static void validateInlineFunctionAnnotations(List<Annotation> annotations)
      Validates annotations on an inline function expression according to W3C XQuery 3.1 §3.1.7 [err:XQST0125].
      Parameters:
      annotations - the list of annotations