Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

403: Skeleton should reflect the exact overloaded called method #432

Merged
merged 9 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/main/java/org/jpeek/skeleton/OpsOf.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,22 @@ public void visitFieldInsn(final int opcode, final String owner,
).up().up();
}

// @todo #403:30min Method call description has to contain
// information about the method's arguments.
// That is important to differentiate overloaded methods to calculate LCOM4.
// We need to add a tag 'name' to reflect the method name
// and a tag 'args' to reflect the method's arguments.
// skeleton.xsd should be changed to support the method's arguments.
// Also, don't forget to delete @Disabled lines in
// SkeletonTest#skeletonShouldReflectExactOverloadedCalledMethod.
// Example:
// <op code="call">
// <name>OverloadMethods.methodOne</name>
// <args>
// <arg type="Ljava/lang/String">?</arg>
// <arg type="Ljava/lang/String">?</arg>
// </args>
// </op>
@Override
public void visitMethodInsn(final int opcode,
final String owner, final String mtd,
Expand Down
20 changes: 20 additions & 0 deletions src/test/java/org/jpeek/skeleton/SkeletonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.jcabi.matchers.XhtmlMatchers;
import org.jpeek.Base;
import org.jpeek.FakeBase;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.llorllale.cactoos.matchers.Assertion;

Expand Down Expand Up @@ -61,6 +62,25 @@ public void createsXml() {
).affirm();
}

@Test
@Disabled
public void skeletonShouldReflectExactOverloadedCalledMethod() {
new Assertion<>(
"Must find arguments of overloaded method",
XhtmlMatchers.xhtml(
new Skeleton(
new FakeBase("OverloadMethods")
).xml().toString()
),
XhtmlMatchers.hasXPaths(
// @checkstyle LineLength (3 lines)
"//method[@name='methodOne' and @desc='(Ljava/lang/String;)D']/ops/op[@code='call']/name[.='OverloadMethods.methodOne']",
"//method[@name='methodOne' and @desc='(Ljava/lang/String;)D']/ops/op[@code='call']/args[count(arg)=2]",
"//method[@name='methodOne' and @desc='(Ljava/lang/String;)D']/ops/op[@code='call']/args/arg[@type='Ljava/lang/String' and .='?']"
)
).affirm();
}

@Test
public void findsMethodsAndArgs() {
new Assertion<>(
Expand Down