package test.of.returnvalue; class Bar { public static void staticCall() { int a = 0; return; } public void test() { } public static Bar createABar() { return new Bar(); } } class Foo { Foo f ; public Foo(Foo f) { this.f=f; } public Foo() { super(); } void test() { return; } Foo getF() { return f; } Bar getABar() { return Bar.createABar(); } public void run(String s) { getF(); s.length(); getABar().test(); //illegal f.getABar().test(); } public static void main(String[] args) { System.out.println("***** A correct implementation should report the following violations:\n"+ "********* Foo.java:43\n"); Foo aFoo = new Foo(); aFoo.f=new Foo(); aFoo.f.f=new Foo(); aFoo.run("Hello world"); } }