3

I am a noob at JVM internals.

Can someone explain what happens at Java interpreter level when IncompatibleClassChangeError is thrown?

I am facing an issue similar to the one described here: https://bugs.openjdk.java.net/browse/JDK-4171827 but having a hard time understanding this comment(quoted from the same page):

This is actually a bug in the interpreter's handling of IncompatibleClassChangeError. The bug is that the logic that checks for invoking a method on a null object, which results in a NullPointerException, is executed before the logic that checks for IncompatibleClassChangeError. In the case of a non-static method becoming static this will cause the interpreter to read a value of the stack which isn't guaranteed to be valid. In this test case it reads a value one above the top of stack which may or may not have a valid value in it. If you modify the test slightly to push a couple nulls and then pop them off before doing the invocation, the test will fail on every vm JavaSoft has shipped. Here's the modified test...

  • 2
    Keep in mind that is bug is ancient, it was fixed in 2002. Current JVMs most likely work quite different. – Michael Borgwardt Jan 20 '16 at 13:07
  • @MichaelBorgwardt It ll still help if I can understand that. I am working with v1.5 - might not be all that different. – xerocool Jan 20 '16 at 13:42
  • It can have many different reasons, explained in detail here and here. – biziclop Jan 20 '16 at 16:53
  • Yes but I still couldnt understand this line: " In the case of a non-static method becoming static this will cause the interpreter to read a value of the stack which isn't guaranteed to be valid." – xerocool Jan 22 '16 at 7:26
1

I may say that the issue isn't fixed but is closed as non-reproducible.

Yes but I still couldnt understand this line: " In the case of a non-static method becoming static this will cause the interpreter to read a value of the stack which isn't guaranteed to be valid."

Most likely the point is that in the case of static method top cell of the stack is ignored when the method is invoked and may contain null (or undefined value). In the case of non-static method the top cell contains this reference.

Can someone explain what happens at Java interpreter level when IncompatibleClassChangeError is thrown?

I'd refer you to the answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.