A simpler model for repeating annotations

Alex Buckley alex.buckley at oracle.com
Wed Jan 2 17:46:31 PST 2013


Having spent today writing out the expected behavior of core reflection 
methods, I'm sympathetic to the idea that 
get[Declared]Annotations(Class) should be more clearly distinguished. 
I've avoided the term "repeating" in API names since repetition is not 
really the point - the point is multiple applications of the same 
annotation type, but "multiple" has its own downsides since there may 
only be one annotation for the new methods to return. I'd favor 
something more like getAll[Declared]Annotations(Class). Comments welcome.

Alex

On 1/2/2013 7:32 AM, Paul Benedict wrote:
> BTW, I read something by Remi a few days back that was quite
> interesting. It was from another thread. He said that correct method
> overloading is not supposed to change behavior. Given that bit of
> wisdom, that's why I recommend a renaming here. Behavior is changing,
> thus a new name should be given.
>
> On Wed, Jan 2, 2013 at 9:22 AM, Paul Benedict <pbenedict at apache.org> wrote:
>> I like the new proposal better. Yet, there's one thing that bothers
>> me, which is the naming of get[Declared]Annotations(Foo.class). It's
>> way too easy to look at the API and miss the difference in behavior
>> here. I propose giving it this name:
>> get[Declared]RepeatingAnnotations(Foo.class) -- and do the same for
>> language model's new typed method.
>>
>> Paul



More information about the enhanced-metadata-spec-discuss mailing list