PROPOSAL: Method and Field Literals (original) (raw)
Neal Gafter neal at gafter.com
Thu Mar 12 08:23:27 PDT 2009
- Previous message: PROPOSAL: Method and Field Literals
- Next message: PROPOSAL: Method and Field Literals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Mar 12, 2009 at 8:16 AM, David Goodenough <david.goodenough at linkchoose.co.uk> wrote:
You are right that getting Field or Method literals into Annotations would be difficult, because the Annotation rules require compile time constants as arguements (that is not what it says in the language spec but it is what it means). Because Field and Method objects are not stored in the class file directly (they are reconstructed at run time when they are used from a binary form) it would be extreemly difficult to regard these as compile time constants, and it would require not only a language syntax change, compiler changes and run time changes, but also a change to the class file format.
I think adding support for field and method literals to the language can be done as a separate step from supporting them in annotations. Doing the first step as a new expression form lays the groundwork for extending annotations as a separate step, possibly in JDK8, but to me the first step looks small enough for project coin.
- Previous message: PROPOSAL: Method and Field Literals
- Next message: PROPOSAL: Method and Field Literals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]