public void foo(@NullAllowed String in){ if (in == null){ return; } class Bar{} int length = in.length(); }