MyType () { MyType nearestOuter = getOwnerParentOfType(MyType.class); if (nearestOuter != null) { MyType currentOuter = nearestOuter; while (currentOuter.getOuterClass() != null) { // False positive error here currentOuter = currentOuter.getOuterClass(); } } return null; }