This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

invokespecial on abstract method


Christian Stuellenberg writes:
 > 
 > An invokespecial to an abstract method should throw a
 > java.lang.AbstractMethodError at execution time (as e.g. an JVM-1.3
 > does), but I'm not able to compile this with gcj.

I'm in favour of errors being detected early.  One of the features of
gcj, and it's arguable whether it's good or bad, is that we get errors
for missing methods at link time.  A trad JVM doesn't do this because
it doesn't have a link phase.

 > If I look at the bytecode there is an invokespecial on an abstract
 > method:
 > Method public  size () -> int
 > 0       iconst_1
 > 1       ifeq 9
 > 4       aload_0
 > 5       invokestatic #6 <Method testbug/fun.size (Ltestbug/A;)I>
 > 8       ireturn
 > 9       aload_0
 > 10      invokenonvirtual #11 <Method java/util/AbstractCollection.size ()I>
 > 13      ireturn
 > Method public  get (int) -> java/lang/Object
 > 0       iload_1
 > 1       iconst_0
 > 2       if_icmpne 11
 > 5       aload_0
 > 6       iload_1
 > 7       invokestatic #15 <Method testbug/fun.get (Ltestbug/A;I)Ljava/lang/Object;>
 > 10      areturn
 > 11      aload_0
 > 12      iload_1
 > 13      invokenonvirtual #20 <Method java/util/AbstractList.get (I)Ljava/lang/Object;
 > 16      areturn
 > Method public  <init> () -> void
 > 0       aload_0
 > 1       invokenonvirtual #24 <Method java/util/AbstractList.<init>
 >         ()V>
 > 4       return

Where?

 > But if I even use
 > gij -jar testing-out.jar
 > it gives me (in german):
 > Speicherzugriffsfehler
 > 
 > So, there seems to be something wrong, doesn't it?

Yes.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]