I have an application that I am working on that decided to stop working in a very unexplained manner. After some debugging and error tracing, I found the problem to be in the call to a specific method in my code.
public static void main(String[] args) throws FileNotFoundException {
System.out.println("Print ");
InternalPanel.init();
}
IN INTERNAL PANEL
public static void init() {
System.out.println("Line");
}
Just to clarify, calling any other methods from other classes works. Calling any methods from this specific class does not work.
Also, this class (and methods within) have always worked.
When it stopped working, I was making minor changes to something completely irrelevant in the program (As in, in a separate thread, having no effect on the class in question)
Try looking at the rest of your InternalPanel class. It’s likely that something in its static initialization has an effect on something else. For example:
In the above code, if instantiating SomeOtherThing ends up causing a chain of events that eventually produces an infinite loop or a stack overflow, that would produce the effect you’re seeing. It wouldn’t actually be the call to the
initfunction, but rather the static initialization of the InternalPanel class.(You could easily check if this is a static initialization issue by having your test program invoke some other dummy method on the
InternalPanelclass.)In debug mode, you may just want to try pausing execution at random while the program appears to be frozen, and see what code is being run and what the stack trace looks like.