JDK-8038788 : javac behaves incorrectly for annotations after method type parameters in some cases
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2014-03-31
  • Updated: 2014-08-15
  • Resolved: 2014-04-18
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.
8u20Fixed 9 b11Fixed
Consider these examples with the specified incorrect behavior of javac:
public class Foo {
    <T> @DA Foo() { }      //should be rejected, is accepted
    <T> @TA Foo(int i) { } //should be rejected, is accepted
    public <T> @DA int foo1() { return 0;}
    public <T> @DA void foo2() { } //should be accepted, is rejected
    public <T> @TA int foo3() { return 0;}
    public <T> @TA void foo4() { } //correctly rejected, but with suboptimal error message
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
@interface DA { }
@interface TA { }

This is with:
$ javac -fullversion
javac full version "1.8.0-b132"

for more details.