Getting “A “NullPointerException” could be thrown; “tb” is nullable here.” from
if (Optional.ofNullable(tb).map(val -> val.getFrom()).map(EReference.class::isInstance).orElse(false)) {
EStructuralFeature feature = (EStructuralFeature)tb.getTo();
Error is reported on tb.getTo()
Since tb is checked with Optional for nullable and if optional is empty we return false, we can’t get to the next line and have a nullable tb
Using:
SonarLint for Eclipse 10.9.1.82333