Answer the question
In order to leave comments, you need to log in
Is it ok to use Object in non-generic method signature?
There is some method in which the parameter is declared as Object ( createMeth(Object object, Another arg...) and, accordingly, the method works with several different classes, executing some logic, where a certain parameter is taken from this object with a check for its presence.
Unfortunately, I didn’t quite understand what’s going on in the code and I can’t describe its functionality in detail, but basically, if it’s not some kind of container, is it normal (in certain cases) to use the Object class ? and use it instead of Object? It seems to me that the person (fullstack) who wrote this code used constructs more typical for js than for java
Answer the question
In order to leave comments, you need to log in
Not normal. First, it's stupid to use a statically typed language and not take advantage of it. Secondly, "taking a parameter from an object with a check for presence" apparently means using reflection, which is slow and unsafe.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question