I have two classes, and I want to include a static instance of one class inside the other and access the static fields from the second class through the first.
This means that I can have non-identical instances with the same name.
Class A { public static package1.Foo foo; } Class B { public static package2.Foo foo; }
This works, but I get the warning "Static field Foo.bar shoudl can be obtained in a static way." Can someone explain why this is so and offers the "right" implementation.
I understand that I can access static instances directly, but if you have a long hierarchy of packages, this becomes ugly:
assertEquals(net.FooCorp.divisions.A.package.Foo.bar, 1); assertEquals(net.FooCorp.divisions.B.package.Foo.bar, 2);
source share