directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Seelmann <>
Subject Re: [Studio] Cleanup...
Date Tue, 28 Jul 2015 16:35:36 GMT
On 07/28/2015 10:28 AM, Emmanuel L├ęcharny wrote:
> Hi guys,
> yesterday, I went through the code looking for places where 'instanceof'
> was used. I found two typical improvements that could be applied :
> o useless check on x != null  like in : if ( ( x != null ) && ( x
> instanceof X ) )
> o useless check of x == null like in : if ( ( x == null ) || !( x
> instanceof X ) )
> instanceof is guaranteed to return false if x is null.
> That's just a itch I wanted to scracth yesterday.

Thanks for that.

> At this point, I think that adding checkstyle in Studio would most
> certainly be a nit of a pain (I suspect that we will get thousands of
> failures ;-) but this might be good to have. Stefan did a great job with
> the API, and I thinkw e should benefit from what he did in the other
> projects, including Studio.

Yes, the plan is to add the checkstyle checks also to other projects.
But I choosed the easiest first :).

Beside checkstyle we should also add PMD check, you already started to
cleanup some issues.

Both, checkstyle check and PMD check run very fast during normal build
so it doesn't slow down the build much.

Findbugs is another beast as it does a 2nd compile and increases build
time considerably, I'd not add it to the normal build, either only run
it on Jenkins, or just rely on Sonar (my preference).

> The real problem with Studio is that a lot of its code is quite old
> (keep in mind it started around 2005 !!!) and there is a lot of
> discrepancies between older code and ore recent one.

Well, ApacheDS is even older, so no excuse. But you are right, lot of
the code was never updated to Java5 features. Part of bad code is due to
Eclipse APIs. Even worse is lack of unit tests.

Kind Regards,

View raw message