ClassFileWriter, abstract methods and code attribute

20 views
Skip to first unread message

Vasco Vasconcelos

unread,
May 17, 2012, 10:36:12 AM5/17/12
to mozilla-rhino
Hi,

I'm having difficulties in generating bytecode for abstract methods.
Naively, I was expecting a piece of code such as

classFileWriter.startMethod("foo", "()V",
ClassFileWriter.ACC_ABSTRACT);
classFileWriter.stopMethod((short) 0);

to do the job. But this generates a code attribute together with the
method, which is not supposed to be present in the bytecode for
abstract methods.
When the interpreter loads the bytecode, I get "Exception in thread
"main" java.lang.ClassFormatError: Code attribute in native or
abstract methods in class file AbstractMethod".

I am using, Rhino 1.7R3 and java version "1.6.0_31".

Ideas?
Reply all
Reply to author
Forward
0 new messages