This is the mail archive of the java-patches@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]

[ecj] Patch: FYI: don't decompile accessors


I'm checking this in on the gcj-eclipse branch.

gcjh tried to decompile a static field accessor method, yielding
invalid C++ code.

This is a bug in the main line as well.  We haven't hit it since gcj
is pretty bad about making accessor methods.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* gjavah.c (decompile_method): Don't decompile a static field
	accessor method.

Index: gjavah.c
===================================================================
--- gjavah.c	(revision 114451)
+++ gjavah.c	(working copy)
@@ -1130,7 +1130,10 @@
   if ((method_access & ACC_SYNCHRONIZED))
     return;
 
-  if (code_len == 5
+  /* The first case is 'return field'; but we only want to do this for
+     non-static methods.  */
+  if (! (method_access & ACC_STATIC)
+      && code_len == 5
       && codes[0] == OPCODE_aload_0
       && codes[1] == OPCODE_getfield
       && (codes[4] == OPCODE_areturn


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