java.lang.Object
org.aspectj.org.eclipse.jdt.internal.core.dom.util.DOMASTUtil

public class DOMASTUtil extends Object
  • Constructor Details

    • DOMASTUtil

      public DOMASTUtil()
  • Method Details

    • isFeatureSupportedinAST

      public static boolean isFeatureSupportedinAST(AST ast, int featureName)
      Validates if the given apiLevel and previewEnabled supports the provided nodeType. This API checks for node types supported from JLS 14 onwards and will return true> for nodes added before JLS14.
      Parameters:
      ast - the AST to be evaluated
      featureName - the feature name constant indicating the feature to be evaluated
      Returns:
      true if the given AST supports the provided nodeType else false
      Since:
      3.22
      See Also:
      ASTNode.getNodeType()
    • isFeatureSupportedinAST

      public static boolean isFeatureSupportedinAST(int apiLevel, boolean previewEnabled, int featureName)
      Validates if the given apiLevel and previewEnabled supports the provided nodeType. This API checks for node types supported from JLS 14 onwards and will return true> for nodes added before JLS14.
      Parameters:
      apiLevel - the level to be checked
      previewEnabled - the preview feature to be considered
      featureName - the feature name constant indicating the feature to be evaluated
      Returns:
      true if the given AST supports the provided nodeType else false
      Since:
      3.22
      See Also:
      ASTNode.getNodeType()
    • isFeatureSupportedinAST

      public static boolean isFeatureSupportedinAST(int apiLevel, int featureName)
      Validates if the given apiLevel and previewEnabled supports the provided nodeType. This API checks for node types supported from JLS 14 onwards and will return true> for nodes added before JLS14.
      Parameters:
      apiLevel - the level to be checked
      featureName - the feature name constant indicating the feature to be evaluated
      Returns:
      true if the given AST supports the provided nodeType else false
      Since:
      3.27
      See Also:
      ASTNode.getNodeType()
    • isPreviewEnabled

      public static boolean isPreviewEnabled(int apiLevel, boolean previewEnabled)
    • isSwitchExpressionSupported

      public static boolean isSwitchExpressionSupported(AST ast)
    • isYieldStatementSupported

      public static boolean isYieldStatementSupported(AST ast)
    • isTextBlockSupported

      public static boolean isTextBlockSupported(AST ast)
    • isRecordDeclarationSupported

      public static boolean isRecordDeclarationSupported(AST ast)
    • isRecordDeclarationSupported

      public static boolean isRecordDeclarationSupported(int apiLevel)
    • isPatternInstanceofExpressionSupported

      public static boolean isPatternInstanceofExpressionSupported(AST ast)
    • isPatternSupported

      public static boolean isPatternSupported(AST ast)
    • isPatternSupported

      public static boolean isPatternSupported(int apiLevel, boolean previewEnabled)
    • isJavaDocCodeSnippetSupported

      public static boolean isJavaDocCodeSnippetSupported(int apiLevel)
    • checkASTLevel

      public static void checkASTLevel(int level)
    • getCompliance

      public static String getCompliance(int astLevel)
      Calculates the JavaCore Option value string corresponding to the input ast level. AST Level 4 is used for Java versions 1.4 to 1.7 and is converted to compliance level 7 if input ast level is out of boundary, latest compliance will be returned
      Parameters:
      astLevel -
      Returns:
      JavaCore Option value string corresponding to the ast level