From c3f42d96834e7e42ffb8394516cc04295ea3f015 Mon Sep 17 00:00:00 2001 From: sbt-garus-dg Date: Wed, 25 Mar 2020 13:49:01 +0300 Subject: [PATCH 1/9] 403 Skeleton should reflect the exact overloaded called method --- src/main/java/org/jpeek/skeleton/OpsOf.java | 14 ++++++++++++++ src/main/resources/org/jpeek/xsd/skeleton.xsd | 14 ++++++++++++++ src/test/java/org/jpeek/skeleton/SkeletonTest.java | 5 ++++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/jpeek/skeleton/OpsOf.java b/src/main/java/org/jpeek/skeleton/OpsOf.java index 815ece1e..a009c34d 100644 --- a/src/main/java/org/jpeek/skeleton/OpsOf.java +++ b/src/main/java/org/jpeek/skeleton/OpsOf.java @@ -84,6 +84,20 @@ 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. +// Also, don't forget to uncomment lines in org.jpeek.skeleton.SkeletonTest#createsXml. +// Example: +// +// OverloadMethods.methodOne +// +// ? +// ? +// +// @Override public void visitMethodInsn(final int opcode, final String owner, final String mtd, diff --git a/src/main/resources/org/jpeek/xsd/skeleton.xsd b/src/main/resources/org/jpeek/xsd/skeleton.xsd index d9ff5685..58a3c0e2 100644 --- a/src/main/resources/org/jpeek/xsd/skeleton.xsd +++ b/src/main/resources/org/jpeek/xsd/skeleton.xsd @@ -110,6 +110,20 @@ SOFTWARE. + diff --git a/src/test/java/org/jpeek/skeleton/SkeletonTest.java b/src/test/java/org/jpeek/skeleton/SkeletonTest.java index 3274b527..687658fb 100644 --- a/src/test/java/org/jpeek/skeleton/SkeletonTest.java +++ b/src/test/java/org/jpeek/skeleton/SkeletonTest.java @@ -47,11 +47,14 @@ public void createsXml() { ).xml().toString() ), XhtmlMatchers.hasXPaths( - // @checkstyle LineLength (10 lines) + // @checkstyle LineLength (15 lines) "/skeleton/app/package[count(class)=2]", "//class[@id='Bar']/methods[count(method)=5]", "//class[@id='OverloadMethods']/methods[count(method)=5]", "//method[@name='' and @ctor='true']", +// "//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 .='?']", "//class[@id='Bar']//method[@name='getKey']/ops[count(op)=3]", "//class[@id='Bar']//method[@name='getKey']/ops/op[@code='put_static' and .='Bar.singleton']", "//class[@id='Bar']//method[@name='getKey']/ops/op[@code='call' and .='java.lang.String.length']", From cc222821a9263a0ea0fc0233b5edeba21dcbd610 Mon Sep 17 00:00:00 2001 From: sbt-garus-dg Date: Wed, 25 Mar 2020 14:13:52 +0300 Subject: [PATCH 2/9] fix code style --- src/main/java/org/jpeek/skeleton/OpsOf.java | 26 ++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/jpeek/skeleton/OpsOf.java b/src/main/java/org/jpeek/skeleton/OpsOf.java index a009c34d..493fce30 100644 --- a/src/main/java/org/jpeek/skeleton/OpsOf.java +++ b/src/main/java/org/jpeek/skeleton/OpsOf.java @@ -85,19 +85,19 @@ public void visitFieldInsn(final int opcode, final String owner, } // @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. -// Also, don't forget to uncomment lines in org.jpeek.skeleton.SkeletonTest#createsXml. -// Example: -// -// OverloadMethods.methodOne -// -// ? -// ? -// -// +// 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. +// Also, don't forget to uncomment lines in org.jpeek.skeleton.SkeletonTest#createsXml. +// Example: +// +// OverloadMethods.methodOne +// +// ? +// ? +// +// @Override public void visitMethodInsn(final int opcode, final String owner, final String mtd, From 7dc2c1ba0ea463a08c30924485addd5ece9af9d4 Mon Sep 17 00:00:00 2001 From: sbt-garus-dg Date: Wed, 25 Mar 2020 14:53:00 +0300 Subject: [PATCH 3/9] fix code style --- src/main/java/org/jpeek/skeleton/OpsOf.java | 28 ++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/main/java/org/jpeek/skeleton/OpsOf.java b/src/main/java/org/jpeek/skeleton/OpsOf.java index 493fce30..4db924e0 100644 --- a/src/main/java/org/jpeek/skeleton/OpsOf.java +++ b/src/main/java/org/jpeek/skeleton/OpsOf.java @@ -84,20 +84,20 @@ 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. -// Also, don't forget to uncomment lines in org.jpeek.skeleton.SkeletonTest#createsXml. -// Example: -// -// OverloadMethods.methodOne -// -// ? -// ? -// -// + // @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. + // Also, don't forget to uncomment lines in org.jpeek.skeleton.SkeletonTest#createsXml. + // Example: + // + // OverloadMethods.methodOne + // + // ? + // ? + // + // @Override public void visitMethodInsn(final int opcode, final String owner, final String mtd, From b7512651b226911655561d95e742184744123d92 Mon Sep 17 00:00:00 2001 From: sbt-garus-dg Date: Wed, 25 Mar 2020 15:14:35 +0300 Subject: [PATCH 4/9] fix code style --- src/main/java/org/jpeek/skeleton/OpsOf.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/jpeek/skeleton/OpsOf.java b/src/main/java/org/jpeek/skeleton/OpsOf.java index 4db924e0..804eada6 100644 --- a/src/main/java/org/jpeek/skeleton/OpsOf.java +++ b/src/main/java/org/jpeek/skeleton/OpsOf.java @@ -92,12 +92,12 @@ public void visitFieldInsn(final int opcode, final String owner, // Also, don't forget to uncomment lines in org.jpeek.skeleton.SkeletonTest#createsXml. // Example: // - // OverloadMethods.methodOne - // - // ? - // ? - // - // + // OverloadMethods.methodOne + // + // ? + // ? + // + // @Override public void visitMethodInsn(final int opcode, final String owner, final String mtd, From 8704157c2ff2128b9922dfc032cd55fb07714bf0 Mon Sep 17 00:00:00 2001 From: sbt-garus-dg Date: Wed, 25 Mar 2020 15:22:45 +0300 Subject: [PATCH 5/9] fix code style skeleton.xsd --- src/main/resources/org/jpeek/xsd/skeleton.xsd | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/resources/org/jpeek/xsd/skeleton.xsd b/src/main/resources/org/jpeek/xsd/skeleton.xsd index 58a3c0e2..355694b9 100644 --- a/src/main/resources/org/jpeek/xsd/skeleton.xsd +++ b/src/main/resources/org/jpeek/xsd/skeleton.xsd @@ -112,17 +112,17 @@ SOFTWARE. From ff93dbcfa768782a9cb99f6f94c3f797c451bca8 Mon Sep 17 00:00:00 2001 From: sbt-garus-dg Date: Wed, 25 Mar 2020 15:43:15 +0300 Subject: [PATCH 6/9] disable test --- src/main/java/org/jpeek/skeleton/OpsOf.java | 2 +- src/test/java/org/jpeek/skeleton/SkeletonTest.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jpeek/skeleton/OpsOf.java b/src/main/java/org/jpeek/skeleton/OpsOf.java index 804eada6..b0d979eb 100644 --- a/src/main/java/org/jpeek/skeleton/OpsOf.java +++ b/src/main/java/org/jpeek/skeleton/OpsOf.java @@ -89,7 +89,7 @@ public void visitFieldInsn(final int opcode, final String owner, // 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. - // Also, don't forget to uncomment lines in org.jpeek.skeleton.SkeletonTest#createsXml. + // Also, don't forget to delete @Disabled lines in org.jpeek.skeleton.SkeletonTest#createsXml. // Example: // // OverloadMethods.methodOne diff --git a/src/test/java/org/jpeek/skeleton/SkeletonTest.java b/src/test/java/org/jpeek/skeleton/SkeletonTest.java index 687658fb..6dffa689 100644 --- a/src/test/java/org/jpeek/skeleton/SkeletonTest.java +++ b/src/test/java/org/jpeek/skeleton/SkeletonTest.java @@ -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; @@ -38,6 +39,7 @@ public final class SkeletonTest { @Test + @Disabled public void createsXml() { new Assertion<>( "Must overload bar's methods", @@ -52,9 +54,9 @@ public void createsXml() { "//class[@id='Bar']/methods[count(method)=5]", "//class[@id='OverloadMethods']/methods[count(method)=5]", "//method[@name='' and @ctor='true']", -// "//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 .='?']", + "//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 .='?']", "//class[@id='Bar']//method[@name='getKey']/ops[count(op)=3]", "//class[@id='Bar']//method[@name='getKey']/ops/op[@code='put_static' and .='Bar.singleton']", "//class[@id='Bar']//method[@name='getKey']/ops/op[@code='call' and .='java.lang.String.length']", From 7fff2414fdf0055d6f89b497f5001740dc934ee9 Mon Sep 17 00:00:00 2001 From: sbt-garus-dg Date: Tue, 31 Mar 2020 22:58:25 +0300 Subject: [PATCH 7/9] fix comments --- src/main/java/org/jpeek/skeleton/OpsOf.java | 3 ++- .../java/org/jpeek/skeleton/SkeletonTest.java | 25 +++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/jpeek/skeleton/OpsOf.java b/src/main/java/org/jpeek/skeleton/OpsOf.java index b0d979eb..99bd49c1 100644 --- a/src/main/java/org/jpeek/skeleton/OpsOf.java +++ b/src/main/java/org/jpeek/skeleton/OpsOf.java @@ -89,7 +89,8 @@ public void visitFieldInsn(final int opcode, final String owner, // 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. - // Also, don't forget to delete @Disabled lines in org.jpeek.skeleton.SkeletonTest#createsXml. + // Also, don't forget to delete @Disabled lines in + // SkeletonTest#skeletonShouldReflectExactOverloadedCalledMethod. // Example: // // OverloadMethods.methodOne diff --git a/src/test/java/org/jpeek/skeleton/SkeletonTest.java b/src/test/java/org/jpeek/skeleton/SkeletonTest.java index 6dffa689..bed2a6a4 100644 --- a/src/test/java/org/jpeek/skeleton/SkeletonTest.java +++ b/src/test/java/org/jpeek/skeleton/SkeletonTest.java @@ -39,7 +39,6 @@ public final class SkeletonTest { @Test - @Disabled public void createsXml() { new Assertion<>( "Must overload bar's methods", @@ -49,14 +48,11 @@ public void createsXml() { ).xml().toString() ), XhtmlMatchers.hasXPaths( - // @checkstyle LineLength (15 lines) + // @checkstyle LineLength (10 lines) "/skeleton/app/package[count(class)=2]", "//class[@id='Bar']/methods[count(method)=5]", "//class[@id='OverloadMethods']/methods[count(method)=5]", "//method[@name='' and @ctor='true']", - "//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 .='?']", "//class[@id='Bar']//method[@name='getKey']/ops[count(op)=3]", "//class[@id='Bar']//method[@name='getKey']/ops/op[@code='put_static' and .='Bar.singleton']", "//class[@id='Bar']//method[@name='getKey']/ops/op[@code='call' and .='java.lang.String.length']", @@ -66,6 +62,25 @@ public void createsXml() { ).affirm(); } + @Test + @Disabled + public void skeletonShouldReflectExactOverloadedCalledMethod() { + new Assertion<>( + "Must overload bar's methods", + XhtmlMatchers.xhtml( + new Skeleton( + new FakeBase("OverloadMethods", "Bar") + ).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<>( From 35b1eb4b9e126923062d918d8d13cc5f73054455 Mon Sep 17 00:00:00 2001 From: sbt-garus-dg Date: Wed, 1 Apr 2020 12:51:05 +0300 Subject: [PATCH 8/9] fix comments --- src/test/java/org/jpeek/skeleton/SkeletonTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/jpeek/skeleton/SkeletonTest.java b/src/test/java/org/jpeek/skeleton/SkeletonTest.java index bed2a6a4..065c1f04 100644 --- a/src/test/java/org/jpeek/skeleton/SkeletonTest.java +++ b/src/test/java/org/jpeek/skeleton/SkeletonTest.java @@ -66,10 +66,10 @@ public void createsXml() { @Disabled public void skeletonShouldReflectExactOverloadedCalledMethod() { new Assertion<>( - "Must overload bar's methods", + "Must find arguments of overloaded method", XhtmlMatchers.xhtml( new Skeleton( - new FakeBase("OverloadMethods", "Bar") + new FakeBase("OverloadMethods") ).xml().toString() ), XhtmlMatchers.hasXPaths( From 32563fc7864f9372c6f933d4e3c1d0a730b20680 Mon Sep 17 00:00:00 2001 From: sbt-garus-dg Date: Wed, 1 Apr 2020 12:58:37 +0300 Subject: [PATCH 9/9] fix comments --- src/main/java/org/jpeek/skeleton/OpsOf.java | 1 + src/main/resources/org/jpeek/xsd/skeleton.xsd | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/main/java/org/jpeek/skeleton/OpsOf.java b/src/main/java/org/jpeek/skeleton/OpsOf.java index 99bd49c1..d45aaf3a 100644 --- a/src/main/java/org/jpeek/skeleton/OpsOf.java +++ b/src/main/java/org/jpeek/skeleton/OpsOf.java @@ -89,6 +89,7 @@ public void visitFieldInsn(final int opcode, final String owner, // 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: diff --git a/src/main/resources/org/jpeek/xsd/skeleton.xsd b/src/main/resources/org/jpeek/xsd/skeleton.xsd index 355694b9..d9ff5685 100644 --- a/src/main/resources/org/jpeek/xsd/skeleton.xsd +++ b/src/main/resources/org/jpeek/xsd/skeleton.xsd @@ -110,20 +110,6 @@ SOFTWARE. -