No, I’m not talking about closures. Normal static methods and static
initialisers.
Honestly, I remember using it years ago. Not recently though.
It’s a small but handy thing to have when you are defining stuff like loggers
manually.
Imagine code like this: // AFAIK it should work now.
```
class LongClassName {
private static Logger log = Logger.getLogger(this.name) // instead of
duplicating class name here. Logger.getLogger(LongClassName.class.getName())
}
```
It simplifies manual class renaming, and eliminates chances of error.
I was sure it should work, but seems not in IDEA. So, I’m guessing, is it IDEA
bug, or intended behaviour.
Cheers,
Pavel
> On 6 Nov 2017, at 18:45, <[email protected]>
> <[email protected]> wrote:
>
> For sure , "this" and "super" are supported within a closure defined in a
> static context. Are you saying they also work directly in a static method?
> Given "class A { static main(args} { this } }", this should be of type
> "Class<A>" if it is indeed supported. It follows that it would work, since
> you can call directly methods on Class<A> from that scope, like
> getCanonicalName().