Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8224228 No way to locally suppress lint warnings in parser/tokenizer or preview features
  3. JDK-8350212

Track source end positions of declarations that support @SuppressWarnings

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Won't Fix
    • Icon: P4 P4
    • 25
    • 25
    • tools
    • None
    • generic
    • generic

      This is split off as a sub-task of JDK-8224228, which seeks to add @SuppressWarnings support for lexical features.

      In order for @SuppressWarnings to work for source code bits that are handled by the parser (for example, new lexical features subject to preview warnings), these bits need to be located within the innermost enclosing @SuppressWarnings-supporting declaration, i.e., module, package, class, method, or variable declaration. Since these are lexical bits, not Java members or symbols with "owners", etc., this requires we know the starting and ending positions of such enclosing declarations.

      The parser does not normally store lexical end positions in an EndPositionTable unless this is requested explicitly. So we can't rely on that, and we don't want to make the EndPositionTable mandatory for performance reasons.

      Instead, we can just add a new "int endPos" field to the five corresponding AST node classes: JCModuleDecl, JCPackageDecl, JCClassDecl, JCMethodDecl, and JCVariableDecl. This field can be populated as part of the normal parsing of these node types, which already supports the (optional) tracking of end positions.

            acobbs Archie Cobbs
            acobbs Archie Cobbs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: