Re: Constructor Instrumentation : super()

"Nikhil C. Khedkar" <[email protected]>
Newsgroups gmane.comp.jakarta.bcel.devel,gmane.comp.jakarta.bcel.user
Message-ID <[email protected]>
Well no peoblem with detecting the constructor. The
approach you have mentioned is not full proof. In my
constructor I have the following code, few lines down
the line

		if (!(type == MAINUI || type == PROJECTWIZARD))
		{
			throw new RuntimeException("Invalid type");
		}

Even this chap has INVOKESPECIAL and I end up skipping
some of the lines and in fact this line also, if I use
your approach, which I had already tried.

<[email protected]>
--- Erik Corry <[email protected]> wrote:
> On Wed, Feb 18, 2004 at 01:58:04AM -0800, Nikhil C.
> Khedkar wrote:
> > 	Now the above mentioned approach doesn't work and
> I
> > end up putting my method call before super() and
> get
> > VerifyError.
> 
> Since the constructor has a special name (<init>)
> you
> can know that you are dealing with a constructor.
> If so, scan the whole method for a call to the
> superclass constructor (INVOKESPECIAL to a method
> called
> <init>).  If you don't find it (it seems legal
> according to
>
http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#16411
> ) then you can put your instrumenting call at the
> start,
> otherwise you put the call after the INVOKESPECIAL
> call.
> 
> I haven't tried it, so I'd be interested in whether
> it works.
> I'm going to be needing it realy soon for my own
> project.
> 
> -- 
> Erik Corry         I'd be a Libertarian, if they
> weren't all a
> [email protected]     bunch of tax-dodging professional
> whiners.   - B. Breathed.
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [email protected]
> For additional commands, e-mail:
> [email protected]
> 


__________________________________
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.
http://antispam.yahoo.com/tools
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.