[hibernate-dev] Code style and whitespaces

Hardy Ferentschik hardy at hibernate.org
Wed Jul 3 06:28:24 EDT 2013


+1 for  'catch ( IllegalArgumentException e )' - using white spaces

On 3 Jan 2013, at 11:07 AM, Sanne Grinovero <sanne at hibernate.org> wrote:

> Looking at the following patch:
> 
> 
> }
> -    catch (IllegalArgumentException e) {
> +    catch ( IllegalArgumentException e ) {
> 
> would you consider it an improvement in terms of consistency with the
> Hibernate style?
> 
> It has always been my interpretation that we use whitespaces inside
> blocks, like:
> 
> 
> if ( condition)
> //rather than
> if (condition)
> 
> but we don't for constructor invocations:
> 
> new Wrapper(type, param);
> //rather than
> new Wrapper( type, param );
> 
> and we also do not (usually) for catch.
> 
> I know that might sound like inconsistent, but the point is
> readability: I've got used to it and I could swear that the *different
> treating* helps with eyeball code scanning.. but I realize that could
> be a very personal opinion.
> 
> So since we're encoding this rule now in checkstyle, which one shall
> it be for the catch statements?
> 
> My guts vote goes to
> 
> }
> catch (IllegalArgumentException e) {
> ...
> 
> but I'd prefer to follow the convention from ORM, if you guys have a
> clear rule :-)
> 
> Cheers,
> Sanne
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev



More information about the hibernate-dev mailing list