JDK-6969184 : poor error recovery after symbol not found
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-07-14
  • Updated: 2011-03-08
  • Resolved: 2011-03-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7 b130Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
The context is an annotation processor in which TypeElement is not imported.   I get an initial error, which is good, then a followup error, which would be better if it were not generated.   

/w/jjg/work/DiagsExamples/6966604-filer/7/langtools/test/tools/javac/processing/filer/TestLastRound.java:60: cannot find symbol
    public boolean process(Set<? extends TypeElement> annotations,
                                         ^
  symbol:   class TypeElement
  location: class TestLastRound
/w/jjg/work/DiagsExamples/6966604-filer/7/langtools/test/tools/javac/processing/filer/TestLastRound.java:60: type parameter ? extends TypeElement is not within its bound
    public boolean process(Set<? extends TypeElement> annotations,
                               ^
2 errors

Comments
SUGGESTED FIX A webrev of this fix is available at the following URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/03cf47d4de15
03-02-2011

EVALUATION Confirmed on b124. I would have expected that "? extends TypeElement" should evaluate to errType if TypeElement is undefined, and that a bounds check involving errType should not give an error. Test case -- take copy of test/tools/javac/processing/filer/TestLastRound.java, delete import for javax.lang.model.element.*, and change "extends JavacTestingAbstractProcessor" to "AbstractProcessor". (modified copy attached.) $ /opt/jdk/1.7.0/bin/javac play/TestLastRound.java play/TestLastRound.java:41: cannot find symbol public boolean process(Set<? extends TypeElement> annotations, ^ symbol: class TypeElement location: class TestLastRound play/TestLastRound.java:41: type parameter ? extends TypeElement is not within its bound public boolean process(Set<? extends TypeElement> annotations, ^
14-01-2011