提交 ee56610f 编写于 作者: S Skylot

core: allow method name be same as class name (issue #15)

上级 fb9ff774
......@@ -339,12 +339,7 @@ public class MethodNode extends LineAttrNode implements ILoadable {
}
public String getName() {
String name = mthInfo.getName();
if (name.equals(parentClass.getShortName())) {
return name + "_";
} else {
return name;
}
return mthInfo.getName();
}
public ClassNode getParentClass() {
......
package jadx.tests.internal.names;
import jadx.api.InternalJadxTest;
import jadx.core.dex.nodes.ClassNode;
import org.junit.Test;
import static jadx.tests.utils.JadxMatchers.containsOne;
import static org.junit.Assert.assertThat;
public class TestSameMethodsNames extends InternalJadxTest {
public static class TestCls<V> {
public static void test() {
new Bug().Bug();
}
public static class Bug {
public Bug() {
System.out.println("constructor");
}
void Bug() {
System.out.println("Bug");
}
}
}
@Test
public void test() {
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
System.out.println(code);
assertThat(code, containsOne("new Bug().Bug();"));
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册