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

[PATCH]: `finit$' to replace `$finit$'.


Sorry for the cross post, but I thought I would rather kill two birds
with one stone.

I'm checking in this run-time patch that supports a tweaks we just
brought to gcj. Gcj will now use the identifier `finit$' in place of
`$finit$' because of one identified problem with gdb and some other
potential problems (Sun's specs are stating that `$' can be used in
mechanically generated name, but I never saw the JDK generating
something with a leading `$'.)

The gcj patch (http://gcc.gnu.org/ml/gcc-patches/2000-08/msg00664.html)
which should be used in conjunction with the attached run-time patch
now generates `finit$' instead of `$finit$' but still recognize
`$finit$' as equivalent to `finit$' for backward compatibility reasons
-- you don't need to rebuild your world and you can mix
bytecode/native code using either `finit$' or `$finit$'.

If you find any problems, please send email to the list or file a PR.
I'd like to thank the people (Tom Tromey, Daniel Berlin and Anthony
Gree) who originally worked on this problem and helped me prepare this
patch.

./A

2000-08-15  Alexandre Petit-Bianco  <apbianco@cygnus.com>

        * java/lang/natClass.cc (finit_name): Initialized with `finit$'.
        (finit_leg_name): New global.
        (java::lang::Class::getDeclaredMethods): Test for `finit$' or
        `$finit$'. This is a backward compatibility hack.
        (java::lang::Class::_getMethods): Likewise.

Index: libjava/java/lang/natClass.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/natClass.cc,v
retrieving revision 1.27
diff -u -p -r1.27 natClass.cc
--- natClass.cc	2000/06/18 22:14:06	1.27
+++ natClass.cc	2000/08/17 20:12:37
@@ -70,7 +70,10 @@ extern java::lang::Class ConstructorClas
 static _Jv_Utf8Const *void_signature = _Jv_makeUtf8Const ("()V", 3);
 static _Jv_Utf8Const *clinit_name = _Jv_makeUtf8Const ("<clinit>", 8);
 static _Jv_Utf8Const *init_name = _Jv_makeUtf8Const ("<init>", 6);
-static _Jv_Utf8Const *finit_name = _Jv_makeUtf8Const ("$finit$", 7);
+static _Jv_Utf8Const *finit_name = _Jv_makeUtf8Const ("finit$", 6);
+// The legacy `$finit$' method name, which still needs to be
+// recognized as equivalent to the now prefered `finit$' name.
+static _Jv_Utf8Const *finit_leg_name = _Jv_makeUtf8Const ("$finit$", 7);
 
 
 
@@ -331,7 +334,9 @@ java::lang::Class::getDeclaredMethods (v
       if (method->name == NULL
 	  || _Jv_equalUtf8Consts (method->name, clinit_name)
 	  || _Jv_equalUtf8Consts (method->name, init_name)
-	  || _Jv_equalUtf8Consts (method->name, finit_name))
+	  || _Jv_equalUtf8Consts (method->name, finit_name)
+	  // Backward compatibility hack: match the legacy `$finit$' name
+	  || _Jv_equalUtf8Consts (method->name, finit_leg_name))
 	continue;
       numMethods++;
     }
@@ -345,7 +350,9 @@ java::lang::Class::getDeclaredMethods (v
       if (method->name == NULL
 	  || _Jv_equalUtf8Consts (method->name, clinit_name)
 	  || _Jv_equalUtf8Consts (method->name, init_name)
-	  || _Jv_equalUtf8Consts (method->name, finit_name))
+	  || _Jv_equalUtf8Consts (method->name, finit_name)
+	  // Backward compatibility hack: match the legacy `$finit$' name
+	  || _Jv_equalUtf8Consts (method->name, finit_leg_name))
 	continue;
       java::lang::reflect::Method* rmethod
 	= new java::lang::reflect::Method ();
@@ -508,7 +515,9 @@ java::lang::Class::_getMethods (JArray<j
       if (method->name == NULL
 	  || _Jv_equalUtf8Consts (method->name, clinit_name)
 	  || _Jv_equalUtf8Consts (method->name, init_name)
-	  || _Jv_equalUtf8Consts (method->name, finit_name))
+	  || _Jv_equalUtf8Consts (method->name, finit_name)
+	  // Backward compatibility hack: match the legacy `$finit$' name
+	  || _Jv_equalUtf8Consts (method->name, finit_leg_name))
 	continue;
       // Only want public methods.
       if (! java::lang::reflect::Modifier::isPublic (method->accflags))

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