2015-03-13 18:52:59 +00:00
|
|
|
/* Copyright (c) 2008-2015, Avian Contributors
|
2009-09-19 00:01:54 +00:00
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software
|
|
|
|
for any purpose with or without fee is hereby granted, provided
|
|
|
|
that the above copyright notice and this permission notice appear
|
|
|
|
in all copies.
|
|
|
|
|
|
|
|
There is NO WARRANTY for this software. See license.txt for
|
|
|
|
details. */
|
|
|
|
|
|
|
|
package avian;
|
|
|
|
|
2011-03-28 02:29:31 +00:00
|
|
|
public class ClassAddendum extends Addendum {
|
|
|
|
public Object[] interfaceTable;
|
2013-10-31 22:01:33 +00:00
|
|
|
public InnerClassReference[] innerClassTable;
|
fix Class.getDeclaredMethods
getDeclaredMethods was returning methods which were inherited from
interfaces but not (re)declared in the class itself, due to the VM's
internal use of VMClass.methodTable differing from its role in
reflection. For reflection, we must only include the declared
methods, not the inherited but un-redeclared ones.
Previously, we saved the original method table in
ClassAddendum.methodTable before creating a new one which contains
both declared and inherited methods. That wasted space, so this patch
replaces ClassAddendum.methodTable with
ClassAddendum.declaredMethodCount, which specifies how many of the
methods in VMClass.methodTable were declared in that class.
Alternatively, we could ensure that undeclared methods always have
their VMMethod.class_ field set to the declaring class instead of the
inheriting class. I tried this, but it led to subtle crashes in
interface method lookup. The rest of the VM relies not only on
VMClass.methodTable containing all inherited interface methods but
also that those methods point to the inheriting class, not the
declaring class. Changing those assumptions would be a much bigger
(and more dangerous in terms of regression potential) effort than I
care to take on right now. The solution I chose is a bit ugly, but
it's safe.
2014-03-03 16:56:26 +00:00
|
|
|
/**
|
|
|
|
* If this value is negative, all the methods in VMClass.methodTable
|
|
|
|
* were declared in that class. Otherwise, only the first
|
|
|
|
* declaredMethodCount methods in that table were declared in that
|
|
|
|
* class, while the rest were declared in interfaces implemented or
|
|
|
|
* extended by that class.
|
|
|
|
*/
|
|
|
|
public int declaredMethodCount;
|
2014-06-26 02:17:27 +00:00
|
|
|
|
2014-07-12 22:03:11 +00:00
|
|
|
public byte[] enclosingClass;
|
2014-06-26 02:17:27 +00:00
|
|
|
|
2014-07-12 22:03:11 +00:00
|
|
|
public Pair enclosingMethod;
|
2015-08-05 21:55:52 +00:00
|
|
|
|
|
|
|
public VMMethod[] bootstrapMethodTable;
|
2011-03-28 02:29:31 +00:00
|
|
|
}
|