Bug 24350 - PUTFIELD error msg wrong
Summary: PUTFIELD error msg wrong
Status: RESOLVED DUPLICATE of bug 24351
Alias: None
Product: BCEL - Now in Jira
Classification: Unclassified
Component: Main (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: issues@commons.apache.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-03 10:51 UTC by Enver Haase
Modified: 2006-03-10 05:23 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Enver Haase 2003-11-03 10:51:51 UTC
[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
Comment 1 Torsten Curdt 2006-03-02 03:27:06 UTC
So you are saying the refrence is the second on the stack and we should only check on protected fields?
Comment 2 Torsten Curdt 2006-03-10 13:23:31 UTC

*** This bug has been marked as a duplicate of 24351 ***