DO NOT REPLY [Bug 24350] New: - PUTFIELD error msg wrong

[email protected]
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <[email protected]>
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24350>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24350

PUTFIELD error msg wrong

           Summary: PUTFIELD error msg wrong
           Product: BCEL
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Main
        AssignedTo: [email protected]
        ReportedBy: [email protected]


[reported by Luca Martini] <[email protected]>

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.