[JSR308] Custom annotations?
Tom.Ball at Sun.COM
Mon Feb 11 11:47:42 EST 2008
Richard Gomes wrote:
> On Sunday 10 February 2008 22:52:32 Tom Ball wrote:
>> Richard Gomes wrote:
>>> Hi Mike,
>>> Thank you for your directions.
>>> It should be very convenient to detect that ...
>>> @Rate double rate = 1.0;
>>> @Volatility double vol = rate;
>>> .... cannot compile because the variables are semantically different,
>>> nevertheless both are represented internally as floating point numbers.
>> It had better compile, as annotations aren't supposed to change
>> compilation behavior. Your error detector could certainly flag it as an
>> error, however.
> Hi Tom,
> JSR-308 is very interesting for our project because we are able to reach very
> strong type checking whilst producing small, fast, clear, organized and well
> documented code. More info at
> In the future we will have to implement the annotation processor and cause
> compilation errors wherever necessary.
All of your work looks good, but you can't modify the behavior of
Java-compatible compilers. JSR-308 gives error checkers additional
support, but compliant Java compilers cannot change their behavior based
on different annotation values. Now, there may be OpenJDK
implementations which may do that in the future, but they can't be
considered compatible with Java until the specification of Java changes
to allow annotations to change compiler behavior.
More information about the JSR308