This is valid in Java 8 :scream: ``` public class ...
# random
k
This is valid in Java 8 😱
Copy code
public class Foo implements Comparable<Foo> {
    @Override
    public int compareTo(Foo this, @NotNull final Foo o) {
        return 0;
    }
}
😯 1
e
kirillrakhman: It was added to Java 8 syntax to enable type annotations on (implicit) receivers by allowing to declare them as explicit parameters with name “this"
k
But what's the use case? Obviously not
@NotNull
since
this
can never be null
e
Anything. Look at checkers framework. @Readonly, for example. But not limited to it
k
Interesting. It looks like partial methods might be implemented with this syntax according to http://mail.openjdk.java.net/pipermail/valhalla-spec-experts/2015-December/000028.html
although this is from 2015. not sure about the current state