This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[patch, 4.3 branch] Fix naming of bridge targets in gjavah
- From: Matthias Klose <doko at ubuntu dot com>
- To: GCJ-patches <java-patches at gcc dot gnu dot org>
- Date: Sun, 14 Sep 2008 20:19:19 +0200
- Subject: [patch, 4.3 branch] Fix naming of bridge targets in gjavah
For the classpath checkin see
http://developer.classpath.org/pipermail/classpath-patches/2008-September/006249.html
Checked in on the classpath-0.98 merge branch (this contains the fixes for the
header files as well):
http://gcc.gnu.org/ml/java-patches/2008-q3/msg00080.html
Approved by Andrew Haley on irc.
Matthias
classpath/ChangeLog.gcj
2008-09-14 Matthias Klose <doko@ubuntu.com>
Merge from classpath:
2008-09-02 Andrew John Hughes <gnu_andrew at member.fsf.org>
* tools/gnu/classpath/tools/javah/ClassWrapper.java:
(makeVtable()): Populate methodNameMap.
(printMethods(CniPrintStream)): Always use pre-populated
methodNameMap for bridge targets.
* tools/classes/gnu/classpath/tools/javah/ClassWrapper.class: Update.
Index: classpath/tools/gnu/classpath/tools/javah/ClassWrapper.java
===================================================================
--- classpath/tools/gnu/classpath/tools/javah/ClassWrapper.java (revision 140358)
+++ classpath/tools/gnu/classpath/tools/javah/ClassWrapper.java (working copy)
@@ -217,7 +217,18 @@
MethodNode m = (MethodNode) i.next();
String desc = MethodHelper.getBridgeTarget(m);
if (desc != null)
- bridgeTargets.add(m.name + desc);
+ {
+ String sum = m.name + desc;
+ boolean newTarget = bridgeTargets.add(sum);
+ if (newTarget)
+ {
+ // Bridge target that is new in this class.
+ String cname = this.name;
+ int index = cname.lastIndexOf('/');
+ cname = cname.substring(index + 1);
+ methodNameMap.put(sum, cname + "$" + m.name);
+ }
+ }
}
}
@@ -247,18 +258,7 @@
String nameToUse;
String sum = m.name + m.desc;
if (bridgeTargets.contains(sum))
- {
- if (methodNameMap.containsKey(sum))
- nameToUse = (String) methodNameMap.get(sum);
- else
- {
- // Bridge target that is new in this class.
- String cname = this.name;
- int index = cname.lastIndexOf('/');
- cname = cname.substring(index + 1);
- nameToUse = cname + "$" + m.name;
- }
- }
+ nameToUse = (String) methodNameMap.get(sum);
else
nameToUse = Keywords.getCxxName(m.name);
methodNameMap.put(sum, nameToUse);