9

First of all sorry for the bad picture. Let's move on...
Deleting this method like:
Who the hell did this nonsense?
I just took a picture of it so I could post it here and rant about it.
Sure felt stupid after deleting it for not thinking about a protected method in the parent class that is part of an API.
So... Yeah....
I was feeling too confident in my skills lately anyway

Comments
  • 4
    @LastDigitOfPi
    Yeah it doesn't call itself. It gets called by quite a few other methods.
    The only thing that this method does is that it changes the method of the subclass to public.
    So that for instances of the subclass this method can be called from classes outside of the package.
  • 0
    I think JVM will check the code inside the method that is about to overwrite and seen that the instruction inside it is going to make sense JVM will execute the related parent method.

    But never tried this :)
  • 0
    Tbh Im not sure, whether this is a good style...
  • 2
    Hey, do you have a moment to talk about our lord and savior Kotlin?
  • 0
    @jespersh technically, you can't call s private method of a class, even if it is the superclass.

    You can change the visibility from "protected" to public though..
  • 0
    Wouldn't this be considered bad parctice?
Add Comment