8015470: (ann) IncompleteAnnotationException does not need to call toString

Otávio Gonçalves de Santana otaviojava at java.net
Tue May 28 17:06:14 UTC 2013


Hello everyone my name is Otávio Santana and I do part of some Java user
groups in Brazil, including SouJava.

I know it is not an error, but an optimization.

I have studying about OpenJDK and I hope help you.

How I am a beginner in OpenJDK, I only can help with simple things like
refactoring and clean-up, but I hope help always more and with complex code
in the future.



On Tue, May 28, 2013 at 10:08 AM, Remi Forax <forax at univ-mlv.fr> wrote:

> On 05/28/2013 02:48 PM, David Holmes wrote:
>
>> Sorry it didn't register that getName() already returns a String - hence
>> the toString() is redundant - but minimally so.
>>
>> David
>>
>
> The second call to toString() also performs an implicit nullcheck
> (elementName can not be null).
> So if we have to fix something, it's only to remove the call to toString()
> after the call to getName().
>
> cheers,
> Rémi
>
>
>
>> On 28/05/2013 9:15 PM, David Holmes wrote:
>>
>>> Please see my reply under your original subject line.
>>>
>>> This is not a bug.
>>>
>>> David
>>>
>>> On 28/05/2013 7:37 PM, Otávio Gonçalves de Santana wrote:
>>>
>>>> diff --git
>>>> a/src/share/classes/java/lang/**annotation/**
>>>> IncompleteAnnotationException.**java
>>>>
>>>> b/src/share/classes/java/lang/**annotation/**
>>>> IncompleteAnnotationException.**java
>>>>
>>>> ---
>>>> a/src/share/classes/java/lang/**annotation/**
>>>> IncompleteAnnotationException.**java
>>>>
>>>> +++
>>>> b/src/share/classes/java/lang/**annotation/**
>>>> IncompleteAnnotationException.**java
>>>>
>>>> @@ -55,9 +55,9 @@
>>>>       public IncompleteAnnotationException(
>>>>               Class<? extends Annotation> annotationType,
>>>>               String elementName) {
>>>> -        super(annotationType.getName()**.toString() +
>>>> +        super(annotationType.getName() +
>>>>                 " missing element " +
>>>> -              elementName.toString());
>>>> +              elementName);
>>>>
>>>>           this.annotationType = annotationType;
>>>>           this.elementName = elementName;
>>>>
>>>>
>>>>
>


-- 
Atenciosamente.

Otávio Gonçalves de Santana

blog:     http://otaviosantana.blogspot.com.br/
twitter: http://twitter.com/otaviojava
site:     http://www.otaviojava.com.br
(11)     98255-3513



More information about the core-libs-dev mailing list