Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 6404194
Votes 0
Synopsis javac parser generates incorrect end position for annotations with parentheses.
Category java:compiler
Reported Against
Release Fixed 7(b03)
State 10-Fix Delivered, bug
Priority: 3-Medium
Related Bugs 6402077
Submit Date 26-MAR-2006
Description
The javac parser stores the end position for annotations, which cannot be heuristically determined because parentheses can be optional in an annotation expression.  However, it always stores the end position of the annotation's identifier, rather than the closing parenthesis when parentheses are present:

   @SuppressWarning("foo")
------------------^         current endPos stored in endPositions
-------------------------^  correct endPos

The problem is that com.sun.tools.javac.parser.Parser.annotation() stores the identifier's end position before parsing any fields, then stores that value regardless of whether there were any parentheses.  The suggested fix checks whether the next token is a left-parenthesis, and if so uses the last token's end position, otherwise the stored value.  Although there isn't a test case, this fix was verified with Jackpot.
Posted Date : 2006-03-26 00:21:22.0
Work Around
None possible, since parentheses are optional for empty annotations.
Evaluation
Should be fixed using the supplied patch.
Posted Date : 2006-04-21 00:58:31.0
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang