[reported by Luca Martini] <luca.martini@iet.unipi.it> It seems that I found a minor inaccuracy in an error message. in org.apache.bcel.verifier.structurals.InstConstraintVisitor.java you wrote: public void visitPUTFIELD(PUTFIELD o){ [snip] if (! ( objreftype.equals(curr) || objreftype.subclassOf(curr) ) ){ constraintViolated(o, "The referenced field has the ACC_PROTECTED modifier, and it's a member of the current class or a superclass of the current class. However, the referenced object type '"+stack().peek()+"' is not the current class or a subclass of the current class."); } } } but I think the referenced object type is not at the top of the stack but, next to it. However, even if this check is done only on protected field (as stated in vmspec) the Standard Verifier checks it even for public fields (and it seems reasonable). You can try the stupid enclosed example (in Jasmin syntax): in this case I substituted the putfield object reference of type with a reference of type B. JustIce signals no error while the native verifier reports: Exception in thread "main" java.lang.VerifyError: (class: A, method: m signature: (ILB;)V) Incompatible type for getting or setting field
So you are saying the refrence is the second on the stack and we should only check on protected fields?
*** This bug has been marked as a duplicate of 24351 ***