And then there were none: -Xlint:all enabled int the build of JDK 9 jdk repo

joe darcy joe.darcy at oracle.com
Wed Jan 21 23:24:33 UTC 2015


Hi Joe,

On 1/21/2015 1:46 PM, huizhe wang wrote:
> Hi Joe,
>
> Lance reminded me to see this email thread. Looks like jaxp made it to 
> top 3, a plenty of warnings cleanup work indeed :-)

Plenty of warnings, but each one is generally very easy to fix :-)

Some comments / guidance on the different warning categories:

[cast]: These are redundant casts. Since they are in method bodies and 
checked by javac they are safe and easy to remove, an essentially 
zero-risk change.

[fallthrough]: Indicates a switch has a fall-through condition. If such 
a code path is not intentional, it can be a serious bug. All such cases 
should be examined for correctness.

[static]: Accessing a static member through an instance variable. 
Misleading code that should be corrected.

[dep-ann]: When @Deprecated annotations aren't properly paired with 
@deprecated javadoc tags; should be fixed.

[serial]: A serializable class without a serialVersionUID defined, often 
a problem for the serialization contract we maintain the in JDK. The fix 
is usually just to add a serialVersionUID set to the serialver of the 
already-shipped version of the class. Extra care must be taken of the 
class has actually evolved over different releases.

[deprecation]: Use of deprecated code. If a rigorous examination is not 
possible, the warning should at least able to be successfully suppressed 
now in JDK 9.

[rawtypes] & [unchecked] Symptomatic of incomplete generification of 
APIs. Generics shipped in 2004 with JDK 5; Java code today should be 
generics aware!

I'd be happy to advise and code review warnings fixes in jaxp, jaxws, 
and corba.

Thanks,

-Joe

>
> Thanks,
> Joe
>
> On 1/21/2015 11:03 AM, joe darcy wrote:
>> A follow-up below...
>>
>> On 1/16/2015 10:45 AM, Jonathan Gibbons wrote:
>>> On 01/15/2015 07:36 PM, joe darcy wrote:
>>>> Hello,
>>>>
>>>> After a small language change to make the effort tractable [1], and 
>>>> another round of code cleanup [2], the deprecation warnings have 
>>>> been eliminated from the build of the jdk repository of JDK 9 [3].
>>>>
>>>> That means that coming after the previous waves of warnings 
>>>> cleanup, *all* the lint warnings are now enabled in the build of 
>>>> the jdk repo!
>>>>
>>>> The effort of clearing all these lint warnings has taken place over 
>>>> many months building on the contribution of many people. I'd like 
>>>> to especially recognize Stuart Marks and Alan Bateman for early 
>>>> work cleaning up the libraries, Jan Lahoda for implementing the 
>>>> supporting language change, Jason Uh for help running build jobs, 
>>>> and Phil Race for many reviews of changes to client code.
>>>>
>>>> Thanks,
>>>>
>>>> -Joe
>>>>
>>>> [1] JEP 211: Elide Deprecation Warnings on Import Statements, 
>>>> http://openjdk.java.net/jeps/211
>>>>
>>>> [2] JDK-8066616 Suppress deprecation warnings in jdk libraries, 
>>>> https://bugs.openjdk.java.net/browse/JDK-8066616
>>>>
>>>> [3] http://hg.openjdk.java.net/jdk9/dev/rev/f1dc16345985
>>>>
>>>
>>>
>>> Joe,
>>>
>>> This is indeed good news, and shows that if you keep chipping away 
>>> at the backlog, you can get to a satisfactory conclusion.
>>>
>>> Now that we have achieved this goal, we need to be able to stay 
>>> there. I presume that along with -Xlint:all, we also have -Werror, 
>>> to make fatail errors from any future lapses.
>>>
>>> Also, what is the "score sheet" across the other repos in the forest?
>>>
>>
>> After getting some tips over on build-dev, here are the warning stats 
>> for the modules hosted in the other repos:
>>
>> # corba repo: 6664 total warnings
>>
>> java.corba: 5982 total warnings
>> [rawtypes]: 3260
>> [unchecked]: 1446
>> [serial]: 544
>> [cast]: 386
>> [deprecation]: 309
>> [static]: 22
>> [fallthrough]: 12
>> [dep-ann]: 2
>>
>> java.sql: 1 total warning
>> [serial]: 1
>>
>> jdk.rmic: 681 total warnings
>> [unchecked]: 126
>> [rawtypes]: 494
>> [cast]: 18
>> [deprecation]: 40
>> [fallthrough]: 2
>>
>> # jaxp repo: 5230 total warnings
>>
>> java.xml: 5230 total warnings
>> [rawtypes]: 2238
>> [unchecked] 2285
>> [cast]: 160
>> [dep-ann]: 109
>> [deprecation]: 91
>> [fallthrough]: 46
>> [serial]: 280
>> [static]: 21
>>
>> # jaxws repo: 6021 total warnings
>>
>> java.activation: 169 total warnings
>> [rawtypes]: 100
>> [unchecked]: 60
>> [cast]: 2
>> [dep-ann]: 2
>> [serial]: 5
>>
>> java.annotations.common: no warnings
>>
>> java.xml.bind: 1868 total warnings
>> [rawtypes]: 1163
>> [unchecked]: 504
>> [cast]: 3
>> [dep-ann]: 43
>> [deprecation]: 117
>> [fallthrough]: 12
>> [serial]: 25
>> [static]: 1
>>
>> java.xml.ws: 1645 total warnings
>> [rawtypes]: 824
>> [unchecked]: 372
>> [cast]: 15
>> [dep-ann]: 142
>> [deprecation]: 193
>> [fallthrough]: 4
>> [serial]: 89
>> [static]: 6
>>
>> jdk.xml.bind: 1475 total warnings
>> [rawtypes]: 766
>> [unchecked]: 570
>> [cast]: 23
>> [dep-ann]: 39
>> [deprecation]: 42
>> [fallthrough]: 4
>> [serial]: 31
>>
>> jdk.xml.ws: 864 total warnings
>> [rawtypes]: 286
>> [unchecked]: 228
>> [cast]: 12
>> [dep-ann]: 7
>> [deprecation]: 319
>> [serial]: 12
>>
>> Fixing warnings is fun and rewarding; luckily there are still plenty 
>> of warnings for others to enjoy resolving ;-)
>>
>> As in the jdk repo, the preponderance of the warnings are 
>> rawtypes/unchecked. I'd recommend prioritizing fixing the warnings 
>> categories other than rawtypes and unchecked.
>>
>> Cheers,
>>
>> -Joe
>



More information about the jdk9-dev mailing list