You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by sebb <se...@gmail.com> on 2008/01/17 22:22:09 UTC

Fixes to nio source for 1.5

There are quite a few missing @Override markers in the nio source
files, e.g. for toString(), clone(), etc.

Would it be OK if I fix those that are clearly intended to be overrides?

Likewise, now that generics are being used, there are some casts that
can be removed. Shall I do those as well?

S///

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Fixes to nio source for 1.5

Posted by sebb <se...@gmail.com>.
Of course, but it's not always immediately obvious which type of
variable is intended to be used, and in large amounts of code it's
possible to overlook some misuses.

Why allow the the confusion at all?

On 18/01/2008, Stojce Dimski <sd...@yahoo.it> wrote:
> We can use our eyes ;-), All modern IDE's have syntax highlighting and
> on my eclipse per default local and object variables have different
> colors...
>
> > OK, but something needs to be done to prevent variable hiding. IDEs
>
>
>
>      ___________________________________
> L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Fixes to nio source for 1.5

Posted by Stojce Dimski <sd...@yahoo.it>.
We can use our eyes ;-), All modern IDE's have syntax highlighting and
on my eclipse per default local and object variables have different
colors...

> OK, but something needs to be done to prevent variable hiding. IDEs



      ___________________________________ 
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail: http://it.docs.yahoo.com/nowyoucan.html

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Fixes to nio source for 1.5

Posted by sebb <se...@gmail.com>.
On 18/01/2008, Ortwin Glück <od...@odi.ch> wrote:
>
>
> sebb wrote:
> > One could use l_ for local and p_ for parameters.
>
> Please, no! Those were the times when there was no IDEs. Today it's the
> IDEs job to help you browse your source code. These prefixes are dead ugly.
>

OK, but something needs to be done to prevent variable hiding. IDEs
may be able to report the name clashes, but they can't always know if
the wrong one is being used.

> Odi
>
> --
> [web]  http://www.odi.ch/
> [blog] http://www.odi.ch/weblog/
> [pgp]  key 0x81CF3416
>        finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5 81CF 3416
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Fixes to nio source for 1.5

Posted by Ortwin Glück <od...@odi.ch>.

sebb wrote:
> One could use l_ for local and p_ for parameters.

Please, no! Those were the times when there was no IDEs. Today it's the 
IDEs job to help you browse your source code. These prefixes are dead ugly.

Odi

-- 
[web]  http://www.odi.ch/
[blog] http://www.odi.ch/weblog/
[pgp]  key 0x81CF3416
        finger print F2B1 B21F F056 D53E 5D79 A5AF 02BE 70F5 81CF 3416

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Fixes to nio source for 1.5

Posted by sebb <se...@gmail.com>.
On 18/01/2008, Oleg Kalnichevski <ol...@apache.org> wrote:
> On Fri, Jan 18, 2008 at 01:07:56AM +0000, sebb wrote:
> > On 17/01/2008, Oleg Kalnichevski <ol...@apache.org> wrote:
> > >
> > > On Thu, 2008-01-17 at 21:22 +0000, sebb wrote:
> > > > There are quite a few missing @Override markers in the nio source
> > > > files, e.g. for toString(), clone(), etc.
> > > >
> > > > Would it be OK if I fix those that are clearly intended to be overrides?
> > > >
> > > > Likewise, now that generics are being used, there are some casts that
> > > > can be removed. Shall I do those as well?
> > > >
> > > > S///
> > > >
> > >
> > > Sure. Go for it.
> > >
> >
> > OK, done.
> >
> > There are also quite a few warnings about variable hiding, e.g. where
> > a parameter has the same name as a field in the class or super-class.
> > This can lead to subtle bugs.
> >
> > Is there a policy on this?
> > Or maybe a naming convention for parameters and local variables?
> >
>
> I have a (bad) habit of always qualifying instance variables with
> "this.xxx". It helps me distinguish them from parameters, but I
> understand not everyone may like such notation.
>

That's fine, but that will only detect a missing instance variable,
not a parameter or local variable that is being used instead of an
instance variable.

When I was writing C, we used to use prefixes such as l_, p_, m_, and
g_ for local, parameter, module and global variables.

m and g are not really relevant to Java.

One could use l_ for local and p_ for parameters.

> Oleg
>
>
> > > Oleg
> > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> > > > For additional commands, e-mail: dev-help@hc.apache.org
> > > >
> > > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> > > For additional commands, e-mail: dev-help@hc.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> > For additional commands, e-mail: dev-help@hc.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Fixes to nio source for 1.5

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, Jan 18, 2008 at 01:07:56AM +0000, sebb wrote:
> On 17/01/2008, Oleg Kalnichevski <ol...@apache.org> wrote:
> >
> > On Thu, 2008-01-17 at 21:22 +0000, sebb wrote:
> > > There are quite a few missing @Override markers in the nio source
> > > files, e.g. for toString(), clone(), etc.
> > >
> > > Would it be OK if I fix those that are clearly intended to be overrides?
> > >
> > > Likewise, now that generics are being used, there are some casts that
> > > can be removed. Shall I do those as well?
> > >
> > > S///
> > >
> >
> > Sure. Go for it.
> >
> 
> OK, done.
> 
> There are also quite a few warnings about variable hiding, e.g. where
> a parameter has the same name as a field in the class or super-class.
> This can lead to subtle bugs.
> 
> Is there a policy on this?
> Or maybe a naming convention for parameters and local variables?
>

I have a (bad) habit of always qualifying instance variables with
"this.xxx". It helps me distinguish them from parameters, but I
understand not everyone may like such notation.

Oleg


> > Oleg
> >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> > > For additional commands, e-mail: dev-help@hc.apache.org
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> > For additional commands, e-mail: dev-help@hc.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Fixes to nio source for 1.5

Posted by sebb <se...@gmail.com>.
On 17/01/2008, Oleg Kalnichevski <ol...@apache.org> wrote:
>
> On Thu, 2008-01-17 at 21:22 +0000, sebb wrote:
> > There are quite a few missing @Override markers in the nio source
> > files, e.g. for toString(), clone(), etc.
> >
> > Would it be OK if I fix those that are clearly intended to be overrides?
> >
> > Likewise, now that generics are being used, there are some casts that
> > can be removed. Shall I do those as well?
> >
> > S///
> >
>
> Sure. Go for it.
>

OK, done.

There are also quite a few warnings about variable hiding, e.g. where
a parameter has the same name as a field in the class or super-class.
This can lead to subtle bugs.

Is there a policy on this?
Or maybe a naming convention for parameters and local variables?

> Oleg
>
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> > For additional commands, e-mail: dev-help@hc.apache.org
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Re: Fixes to nio source for 1.5

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Thu, 2008-01-17 at 21:22 +0000, sebb wrote:
> There are quite a few missing @Override markers in the nio source
> files, e.g. for toString(), clone(), etc.
> 
> Would it be OK if I fix those that are clearly intended to be overrides?
> 
> Likewise, now that generics are being used, there are some casts that
> can be removed. Shall I do those as well?
> 
> S///
> 

Sure. Go for it.

Oleg

> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
> For additional commands, e-mail: dev-help@hc.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org