Will java external class compilation effects internal class

I need to give a patch for websphere. where I have a main java class that has three inner classes. I have few code changes for the main class, but no changes in any inner classes. Now my question is, should I include all inner classes along with the main class file as part of a fix or main class?

+4
source share
2 answers

This is not an authoritative answer, but every time I made such a correction, I copied all the classes (external and internal classes), i.e.

Outer.class Outer$1.class // These indexes might change ... Outer$2.class // ... between compilation runs Outer$Inner.class // This name should never change 

When I did not, late-loading side effects usually occurred. In my opinion, this most often happens due to anonymous inner classes that do not always regenerate the same β€œanonymous class index” (as in $1 , $2 , etc.), depending on their order in the .java file .

So, of course, since this type of patch is a pretty hooligan technique, I always copied all the classes.

+3
source

The inner class is similar to a regular class with an implicit reference to the outer class, so I would say that it is safe to give only the outer class if you really haven't changed the inner ones.

+1
source

Source: https://habr.com/ru/post/1440050/


All Articles