Understanding java compilation and inheritance -


i'm reading jmh samples , i'm @ section inheritance. here remark made:

because we know type hierarchy during compilation, possible during same compilation session. is, mixing in subclass extending benchmark class after jmh compilation have no effect.

i haven't thought of aspect of compilation , doesn't seem quite clear me. use class::getsuperclass though. example:

@benchmark public abstract class mybenchmark{     public void mb(){         dosome();     }      public abstract dosome(); } 

i thought when compiling class jhm uses annotation processor benchmark generation. , if try compile subclass say

public class myconcretebenchmark extends mybenchmark {     @override     public void dosome(){         //do     } } 

it has no effect because annotation processor has nothing process.

jhm comes before compiling (analyze , generate). preprocessor or precompiler. therefore jmh can not see inheritance tree , not possible see inherited annotations.

lombock example works in same way. here image demonstrating how works (just replace in mind lombok jmh):

enter image description here

readmore: project lombok: creating custom transformations


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -