- @SuppressWarnings("rawtypes")
- Entry binding = codecRegistry.fromNormalizedNode(normalized.getKey(), normalized.getValue());
- return Optional.<Entry<org.opendaylight.yangtools.yang.binding.InstanceIdentifier<? extends DataObject>, DataObject>>fromNullable(binding);
+ /*
+ * This cast is required, due to generics behaviour in openjdk / oracle javac
+ *
+ * InstanceIdentifier has definition InstanceIdentifier<T extends DataObject>,
+ * this means '?' is always <? extends DataObject>. Eclipse compiler
+ * is able to determine this relationship and treats
+ * Entry<InstanceIdentifier<?>,DataObject> and Entry<InstanceIdentifier<? extends DataObject,DataObject>
+ * as assignable. However openjdk / oracle javac treats this two types
+ * as incompatible and issues a compile error.
+ *
+ * It is safe to loose generic information and cast it to other generic signature.
+ *
+ */
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ final Entry<InstanceIdentifier<? extends DataObject>, DataObject> binding = (Entry) codecRegistry.fromNormalizedNode(normalized.getKey(), normalized.getValue());
+ return Optional.fromNullable(binding);