[
https://issues.apache.org/jira/browse/IGNITE-10301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ryabov Dmitrii reassigned IGNITE-10301:
---------------------------------------
Assignee: Ryabov Dmitrii
> GridToStringBuilder is broken for classes with inheritance
> ----------------------------------------------------------
>
> Key: IGNITE-10301
> URL: https://issues.apache.org/jira/browse/IGNITE-10301
> Project: Ignite
> Issue Type: Bug
> Affects Versions: 2.7
> Reporter: Alexey Goncharuk
> Assignee: Ryabov Dmitrii
> Priority: Blocker
> Fix For: 2.7
>
>
> Given the following class hierarchy
> {code}
> /** */
> private static class Parent {
> /** */
> private int a;
> /** {@inheritDoc} */
> @Override public String toString() {
> return S.toString(Parent.class, this);
> }
> }
> /** */
> private static class Child extends Parent {
> /** */
> private int b;
> /** {@inheritDoc} */
> @Override public String toString() {
> return S.toString(Child.class, this, super.toString());
> }
> }
> private static class Wrapper {
> /** */
> @GridToStringInclude
> Parent p = new Child();
> /** {@inheritDoc} */
> @Override public String toString() {
> return S.toString(Wrapper.class, this);
> }
> }
> {code}
> the next test fails:
> {code}
> /**
> */
> public void testHierarchy() {
> Wrapper w = new Wrapper();
> Parent p = w.p;
> String wS = w.toString();
> String pS = p.toString();
> // Expect wS to be "Wrapper [p=" + pS + ']'.
> assertEquals("Wrapper [p=" + pS + ']', wS);
> }
> {code}
> {code}
> Expected :Wrapper [p=Child [b=0, super=Parent [a=0]]]
> Actual :Wrapper [p=Parent [a=0]Child [b=0, super=]]
> {code}
> This is a regression from IGNITE-602. We need to fix this in 2.7 or revert
> IGNITE-602.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)