For Coin 8: this keyword for static methods

Rémi Forax forax at univ-mlv.fr
Sat Feb 26 13:35:20 PST 2011


On 02/22/2011 06:47 PM, Vimil Saju wrote:
> Hi,
>
>   It would be nice to have a 'this'
>   keyword for static methods. For static methods 'this' refers
>   to the class in which the static method is defined.
>
>   In our code-base we have a lot of places where we
>   initialize a logger for a class as follows
>
>   public class MyApp {
>      static Logger logger = Logger.getLogger(MyApp.class);
>      ...
>      ...
>
> If we could refer to MyApp using the keyword 'this' then when copying this code to other classes there wouldn't be a need to remember to change the class passed to the getLogger method.
>
> Thanks
> Vimil

see my blog :)
http://weblogs.java.net/blog/forax/archive/2010/10/26/how-get-current-class-java

Rémi





More information about the coin-dev mailing list