We need to scan up the hierarchy so that if we're overriding a renamed method
(e.g toString(StringBuffer)) we use the properly renamed version (e.g. toStringBuffer(StringBuffer)) when generating our ActionScript. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4870 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -367,6 +367,7 @@ public class ActionScriptSource
|
|||||||
list.add(mem);
|
list.add(mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
METHODS:
|
||||||
for (Method method : jclass.getDeclaredMethods()) {
|
for (Method method : jclass.getDeclaredMethods()) {
|
||||||
int mods = method.getModifiers();
|
int mods = method.getModifiers();
|
||||||
ArrayList<Member> list;
|
ArrayList<Member> list;
|
||||||
@@ -379,15 +380,28 @@ public class ActionScriptSource
|
|||||||
}
|
}
|
||||||
|
|
||||||
String name = method.getName();
|
String name = method.getName();
|
||||||
ActionScript asa = method.getAnnotation(ActionScript.class);
|
|
||||||
if (asa != null) {
|
// we have to scan our parent classes for annotations because we may be overriding this
|
||||||
if (asa.omit()) {
|
// method and we want to "inherit" annotations
|
||||||
continue;
|
Class<?> cclass = jclass;
|
||||||
|
do {
|
||||||
|
try {
|
||||||
|
Method cmethod = cclass.getMethod(name, method.getParameterTypes());
|
||||||
|
ActionScript asa = cmethod.getAnnotation(ActionScript.class);
|
||||||
|
if (asa != null) {
|
||||||
|
if (asa.omit()) {
|
||||||
|
continue METHODS;
|
||||||
|
}
|
||||||
|
if (!StringUtil.isBlank(asa.name())) {
|
||||||
|
name = asa.name();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (NoSuchMethodException nsme) {
|
||||||
|
// thanks Java for insisting on using exceptions for a potentially expected
|
||||||
|
// code path; fall through and try the superclass
|
||||||
}
|
}
|
||||||
if (!StringUtil.isBlank(asa.name())) {
|
cclass = cclass.getSuperclass();
|
||||||
name = asa.name();
|
} while (cclass != null);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// if this is an auto-generated reader or writer method, skip it
|
// if this is an auto-generated reader or writer method, skip it
|
||||||
if (name.startsWith("readField_") || name.startsWith("writeField_")) {
|
if (name.startsWith("readField_") || name.startsWith("writeField_")) {
|
||||||
|
|||||||
Reference in New Issue
Block a user