|
9 | 9 | import java.io.PrintWriter; |
10 | 10 | import java.lang.reflect.Method; |
11 | 11 | import java.util.ArrayList; |
| 12 | +import java.util.Collection; |
12 | 13 | import java.util.Collections; |
13 | 14 | import java.util.HashMap; |
14 | 15 | import java.util.HashSet; |
|
41 | 42 | import com.sun.codemodel.JDefinedClass; |
42 | 43 | import com.sun.codemodel.JEnumConstant; |
43 | 44 | import com.sun.codemodel.JExpr; |
44 | | -import com.sun.codemodel.JExpression; |
45 | 45 | import com.sun.codemodel.JFieldVar; |
46 | 46 | import com.sun.codemodel.JInvocation; |
47 | 47 | import com.sun.codemodel.JMethod; |
@@ -836,6 +836,23 @@ private void parseMethodOrFunction(Element root, ParsingContext context) { |
836 | 836 | name = nativeName; |
837 | 837 | } |
838 | 838 | name = NameUtils.neutralizeKeyword(name); |
| 839 | + |
| 840 | + JClass klass = enclosing; |
| 841 | + outer: |
| 842 | + while ( (klass != null) && (klass instanceof JDefinedClass) ) { |
| 843 | + JDefinedClass definedClass = (JDefinedClass) klass; |
| 844 | + |
| 845 | + Collection<JMethod> methods = definedClass.methods(); |
| 846 | + for (JMethod method : methods) { |
| 847 | + if (method.name().equals(name)) { |
| 848 | + name = enclosing.name().toLowerCase() + "_" + name; |
| 849 | + break outer; |
| 850 | + } |
| 851 | + } |
| 852 | + |
| 853 | + klass = klass._extends(); |
| 854 | + } |
| 855 | + |
839 | 856 | JMethod wrapper = enclosing.method(JMod.PUBLIC | staticModifier, returnType.getJType(), name); |
840 | 857 |
|
841 | 858 | JInvocation nativeCall; |
|
0 commit comments