Is it necessary to compile the inner class if changes made in an other inner class?
I have a Class Aouter, This Aouter cl开发者_如何学Cass has 2 inner classes namely Binner,Cinner. My doubt is if Binner class had been changed so Cinner class also should be compiled and moved to server?
plz ask me if you have any doubt in my question.
Thank in advance.
If Cinner
does not depend on Binner
in any way, it doesn't need to be recompiled. Otherwise I think it is better to recompile (although it may not be always necessary, it is still better to be on the safe side). But since in general inner classes are compiled together with their containing class, either all or none of them are recompiled in practice.
I doubt you can compile them separately, but one inner class should not be affected by changes to another inner class. Since they generate different .class files why not use a tool like rsync for deploying your binaries (i.e. moving to server). That way only changes needs to be transferred..
If an inner class uses an outer class, to can make a difference. This is because the compiler need to generate access methods when an inner class access a private member of an outer class. This also means than if you change a field/method/constructor from non-private to private the inner class will change from a field access to a method call in the byte code.
精彩评论