summaryrefslogtreecommitdiff
path: root/libjava/link.cc
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-15 18:29:44 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2006-03-15 18:29:44 +0000
commit1a78785526bdf2a52982c302a4ff0b6527a1efa7 (patch)
tree2ecb4b543663d3d4a29ca6755698fc74160ea415 /libjava/link.cc
parent966a57c4c22c90af0dc7399fba8599a4aa45a249 (diff)
downloadgcc-1a78785526bdf2a52982c302a4ff0b6527a1efa7.tar.gz
gcc/java
PR java/26390: * class.c (get_interface_method_index): Don't put <clinit> into interface table. libjava PR java/26390: * link.cc (get_interfaces): Skip <clinit>. (append_partial_itable): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112093 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/link.cc')
-rw-r--r--libjava/link.cc26
1 files changed, 17 insertions, 9 deletions
diff --git a/libjava/link.cc b/libjava/link.cc
index df148a38e64..827d3185059 100644
--- a/libjava/link.cc
+++ b/libjava/link.cc
@@ -699,9 +699,18 @@ _Jv_Linker::get_interfaces (jclass klass, _Jv_ifaces *ifaces)
result += get_interfaces (klass->interfaces[i], ifaces);
}
}
-
+
if (klass->isInterface())
- result += klass->method_count + 1;
+ {
+ // We want to add 1 plus the number of interface methods here.
+ // But, we take special care to skip <clinit>.
+ ++result;
+ for (int i = 0; i < klass->method_count; ++i)
+ {
+ if (klass->methods[i].name->first() != '<')
+ ++result;
+ }
+ }
else if (klass->superclass)
result += get_interfaces (klass->superclass, ifaces);
return result;
@@ -817,7 +826,7 @@ _Jv_ThrowAbstractMethodError ()
// Returns the offset at which the next partial ITable should be appended.
jshort
_Jv_Linker::append_partial_itable (jclass klass, jclass iface,
- void **itable, jshort pos)
+ void **itable, jshort pos)
{
using namespace java::lang::reflect;
@@ -826,6 +835,10 @@ _Jv_Linker::append_partial_itable (jclass klass, jclass iface,
for (int j=0; j < iface->method_count; j++)
{
+ // Skip '<clinit>' here.
+ if (iface->methods[j].name->first() == '<')
+ continue;
+
meth = NULL;
for (jclass cl = klass; cl; cl = cl->getSuperclass())
{
@@ -836,12 +849,7 @@ _Jv_Linker::append_partial_itable (jclass klass, jclass iface,
break;
}
- if (meth && (meth->name->first() == '<'))
- {
- // leave a placeholder in the itable for hidden init methods.
- itable[pos] = NULL;
- }
- else if (meth)
+ if (meth)
{
if ((meth->accflags & Modifier::STATIC) != 0)
throw new java::lang::IncompatibleClassChangeError