How do I correctly access static member classes?
<p>I have two classes, and want to include a static instance of one class inside the other and access the static fields from the second class via the first.  </p>

<p>This is so I can have non-identical instances with the same name.  </p>

<pre><code>Class A 
{
    public static package1.Foo foo;
}

Class B 
{
    public static package2.Foo foo;
}


//package1
Foo 
{
    public final static int bar = 1;
}

// package2
Foo
{
    public final static int bar = 2;
}

// usage
assertEquals(A.foo.bar, 1);
assertEquals(B.foo.bar, 2);
</code></pre>

<p>This works, but I get a warning "The static field Foo.bar shoudl be accessed in a static way".
Can someone explain why this is and offer a "correct" implementation.</p>

<p>I realize I could access the static instances directly, but if you have a long package hierarchy, that gets ugly:</p>

<pre><code>assertEquals(net.FooCorp.divisions.A.package.Foo.bar, 1);
assertEquals(net.FooCorp.divisions.B.package.Foo.bar, 2);
</code></pre>
