Commit ee56610f authored by Skylot's avatar Skylot

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

parent 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% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment