[JSR308] Custom annotations?

James Gosling James.Gosling at Sun.COM
Mon Feb 11 12:21:40 EST 2008


On Feb 11, 2008, at 8:47 AM, Tom Ball wrote:

> 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.
>>>
>>> Tom
>>
>> 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
>> http://www.jquantlib.org/index.php/DeveloperCorner
>>
>> 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.

It's not quite that dire: they can at least issue warnings, as  
@Override and @Deprecated do.

>
>
> Tom
>
> Tom
>
> _______________________________________________
> JSR308 mailing list
> JSR308 at lists.csail.mit.edu
> https://lists.csail.mit.edu/mailman/listinfo/jsr308




More information about the JSR308 mailing list