generated bytecode not verifyable for some methods

"Stefan Ocke" <[email protected]> Fri, 7 Feb 2003 01:38:23 +0100
Newsgroups gmane.comp.java.netbeans.modules.mdr.devel
Message-ID <01b701c2ce41$38a8fc30$3ee41e8d@stefan>
Hi,

I have noticed some quite particular problems with derived methods in the
metamodel:

As soon as I define a mehod with no parameters and a primitive return type
(example fom UML-Metamodel: Multiplicity::upperBound():int ), the  generated
bytecode seems  not to pass the JVM Bytecode Verifier.
(example:  if i call  createMultiplicity() on MultiplicityClass, I get a
verify error.)
The  error is always:
VerifyError in _invokeOperation  ...Signature...blah...   :  Stack Size too
large.

I guess, the bug is in:

org.netbeans.mdr.handlers.gen.HandlerGenerator.getDispatcherMethod()

There, maxStack is only calculated only with respect to the parameters of
the features, but return type + wrapping seems not to be considered.
In case of wrapping (that is: codePreReturn() has detected a primitive type
an has - for example - written the opcodes for "new Integer" and "dup" ) the
maxStack should a least be 2, even if  the invoked operation has 0
parameters.

best Regards,
Stefan Ocke.