JDK-6795580 : parser confused by square brackets in qualified generic cast
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: unknown
  • Submitted: 2009-01-20
  • Updated: 2012-01-13
  • Resolved: 2012-01-13
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 b46Fixed
Related Reports
Relates :  
Description
The following program does not compile:

class A<X> {
    class B<Y> {}

    A<? extends Integer>.B<String> b;
    Object o = (A<Integer>.B<String>[][])b;
}

OUTPUT:
maurizio@maurizio-laptop:~/Desktop$ testws/dist/bin/javac Test3.java 
Test3.java:5: ')' expected
	Object o = (A<Integer>.B<String>[])b;
	                                ^
Test3.java:5: ';' expected
	Object o = (A<Integer>.B<String>[])b;
	                                 ^
Test3.java:5: illegal start of type
	Object o = (A<Integer>.B<String>[])b;
	                                  ^
3 errors

Comments
SUGGESTED FIX A webrev of this fix is available at the following URL: http://hg.openjdk.java.net/jdk7/tl/langtools/rev/83c59a9d4b94
20-01-2009

EVALUATION A bug in javac parser introduced by the fix of 6665356. In particular, the parser should consume square brackets only at the end of a given qualified generic type that appears in a cast expression.
20-01-2009