Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Machine > Re: argument of...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 3 Topic 713 of 803
Post > Topic >>

Re: argument of invokevirtual

by Thomas Hawtin <usenet@[EMAIL PROTECTED] > Aug 22, 2006 at 05:09 PM

Toby Kim wrote:
> While I'm writing codes on call graph construction of Java programs,
> I've got a question.
> I'm wondering how the class name in the argument of invokevirtual is
> determined.
> Is it the name of a class containing the method definition?
> 
> The code snippet (1) is compiled into the bytecode (2).
> Neither printStackTrace() nor equals() are not defined in the
> AWTException.
> But the class name of the first invokevirtual is AWTException,
> whereas the class name of the second invokevirtual is Object. Why is
> that?

The parameter and return types must always match. Working out which 
overloaded method to use is done at compile time. In 1.5+, the compiler 
synthesises bridge methods for covariant return types.

Which class the method is declared on is not important. Indeed binary 
compatibility requires that a method may be moved to a super class.

For methods declared in interfaces, it is preferable to use a class type 
if possible because dispatch on a class type is often faster than on an 
interface type.

Tom Hawtin
-- 
Unemployed English Java programmer
http://jroller.com/page/tackline/




 3 Posts in Topic:
argument of invokevirtual
"Toby Kim" <  2006-08-22 06:57:24 
Re: argument of invokevirtual
Thomas Hawtin <usenet@  2006-08-22 17:09:06 
Re: argument of invokevirtual
"Chris Uppal" &  2006-08-22 16:25:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 7:13:43 CDT 2008.