| Summary: | [1.8][compiler][spec] Can an annotation type be a functional interface? | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | srikanth_sankaran, stephan.herrmann |
| Version: | 4.4 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | stalebug | ||
We will watch this space for changes and react when called for. Adjusted target accordingly. Considered a bug in javac: https://bugs.openjdk.java.net/browse/JDK-8030663 This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. https://bugs.openjdk.java.net/browse/JDK-8030663 acknowledges that javac violates JLS, but neither wants to move. => No need for action for ecj either. |
Srikanth, I think this needs to be taken to the 335 EG. Can an annotation type (JLS7 9.6) be a functional interface (jsr335-0.7.0 9.8)? The current spec just says "A functional interface is an interface that [...]", and since JLS7 9 defines the term "interface" as applicable to normal interfaces as well as annotation types, this snippet should compile without errors: //javac 1.8.0-ea-b115 error: Unexpected @FunctionalInterface annotation @FunctionalInterface @interface I { } public class Test { // javac error: incompatible types: I is not a functional interface I i= () -> I.class; // OK, abstract method: Class<? extends Annotation> annotationType() java.lang.annotation.Annotation a= () -> I.class; } But since it hardly makes sense to use a marker annotation as a functional interface, I actually agree with javac. The jsr335 spec should be fixed.