Possible bug in StackFrameInfo#getByteCodeIndex?

David Lloyd david.lloyd at redhat.com
Fri Dec 8 04:19:41 UTC 2017

I was doing some research related to AccessController, and I noted
this code [1] in StackFrameInfo#getByteCodeIndex():

public int getByteCodeIndex() {
    // bci not available for native methods
    if (isNativeMethod())
        return -1;

    return bci;

Now bci is of type short, and given the spec of the method, should the
return not be:

    return bci & 0xffff;

instead?  Else it would return wrong values for methods with more than
32767 bytecodes in them.

[1] http://hg.openjdk.java.net/jdk/jdk/file/e3b6cb90d7ce/src/java.base/share/classes/java/lang/StackFrameInfo.java#l96


More information about the core-libs-dev mailing list