maven - Could java reflection add method into class file that are not in java source file? -
i'm digging source code of deeplearning java recently. there such class neuralnetconfiguration in there tons of fields requires getters , setters. neuralnetconfiguration.java source code not provide any, however.
when open project in intellij, ctrl click on usage of class, methods like, neuralnetconfiguration.getninput() or neuralnetconfiguration.getkernelsize(), ide direct me compiled class file in getters defined each of field in class.
just wonder how done since i'm new bee java. posts found java reflect suggest reflect can not add method method class unless wrote own classloader. check deep learning java project , don't think have done that.
what bothers me time time is, intellij starts report errors getfields methods not resolved since not in source file @ all, after building project using intellij instead of using mvn command line.
the magic happens @data annotation on class. annotation project lombok. there annotation processor somewhere hooks compiling process , generates these methods.
Comments
Post a Comment