JDK-8037543 : Better method for associating type annotations and tree nodes
  • Type: Sub-task
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8,9
  • Priority: P5
  • Status: Closed
  • Resolution: Won't Fix
  • Submitted: 2014-03-17
  • Updated: 2020-09-17
  • Resolved: 2020-09-17
Description
Presently, type annotations and tree nodes are associated using the source position of the tree node.  For example, in the following type-annotated cast:

{code}
(@A List<@B Integer @C []>) foo
{code}

All three annotations must be given the source position of the *cast*, as opposed to the actual annotations.  This is misleading, and leads to errors when trying to edit code.

We should come up with a better way to update the bytecode offsets of type annotations.