We lost this bit when we were switching annotations. Since we
require Java 11, we should no longer be exposed to the JDK issue.
Change-Id: I769686186f1b03a2bd7e00bbc9474d91278c8d91
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
import java.lang.reflect.Type;
import java.util.List;
import java.util.Optional;
import java.lang.reflect.Type;
import java.util.List;
import java.util.Optional;
+import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.binding.spec.naming.BindingMapping;
import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
import org.opendaylight.yangtools.util.ClassLoaderUtils;
import org.opendaylight.mdsal.binding.spec.naming.BindingMapping;
import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
import org.opendaylight.yangtools.util.ClassLoaderUtils;
final List<PathArgument> builder) {
final Optional<? extends Class<? extends DataObject>> caseType = arg.getCaseType();
if (caseType.isPresent()) {
final List<PathArgument> builder) {
final Optional<? extends Class<? extends DataObject>> caseType = arg.getCaseType();
if (caseType.isPresent()) {
- // XXX: we use two caseType.get()s because of https://bugs.openjdk.java.net/browse/JDK-8144185,
- // which makes JaCoCo blow up if we try using @NonNull on the local variable.
- final ChoiceNodeCodecContext<?> choice = choicesByClass.getUnchecked(caseType.get());
+ final @NonNull Class<? extends DataObject> type = caseType.orElseThrow();
+ final ChoiceNodeCodecContext<?> choice = choicesByClass.getUnchecked(type);
choice.addYangPathArgument(arg, builder);
choice.addYangPathArgument(arg, builder);
- final DataContainerCodecContext<?, ?> caze = choice.streamChild(caseType.get());
+ final DataContainerCodecContext<?, ?> caze = choice.streamChild(type);
caze.addYangPathArgument(arg, builder);
return caze.bindingPathArgumentChild(arg, builder);
}
caze.addYangPathArgument(arg, builder);
return caze.bindingPathArgumentChild(arg, builder);
}