package test.cf.returnvalue; class Foo { public void run() { //legeal call: on object whose type is the return type of a method in the encloseing type Bar b=getABar(); b.test(); Bar.bar.test(); } public Bar getABar() { return new Bar(); } public static void main(String[] args) { System.out.println("***** A correct implementation should report no violation"); Foo aFoo = new Foo(); aFoo.run(); } } class Bar { public static final Bar bar = new Bar(); void test() { return; } }