Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Apr 1, 2020
2 parents 84b729c + 32563fc commit b62ae0f
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
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

1 comment on commit b62ae0f

@0pdd
Copy link
Collaborator

@0pdd 0pdd commented on b62ae0f Apr 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 403-214b0d9e discovered in src/main/java/org/jpeek/skeleton/OpsOf.java and submitted as #437. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.