This fixes type inference failure by using a temporary variable.
Change-Id: I298cb7778d590842911dca9e2bd4936b887a221e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
*/
default <E extends DataTreeEffectiveStatement<?>> @NonNull Optional<E> findDataTreeNode(
final @NonNull QName qname) {
- return Optional.ofNullable(get(Namespace.class, requireNonNull(qname)));
+ @SuppressWarnings("unchecked")
+ final E result = (E) get(Namespace.class, requireNonNull(qname));
+ return Optional.ofNullable(result);
}
}
*/
default <E extends SchemaTreeEffectiveStatement<?>> @NonNull Optional<E> findSchemaTreeNode(
final @NonNull QName qname) {
- return Optional.ofNullable(get(Namespace.class, requireNonNull(qname)));
+ @SuppressWarnings("unchecked")
+ final E result = (E) get(Namespace.class, requireNonNull(qname));
+ return Optional.ofNullable(result);
}
}
}
QName nextPath = iterator.next();
- Mutable<?, ?, EffectiveStatement<?, ?>> current = root.getFromNamespace(ChildSchemaNodeNamespace.class,
+ @SuppressWarnings("unchecked")
+ Mutable<?, ?, EffectiveStatement<?, ?>> current = (Mutable)root.getFromNamespace(ChildSchemaNodeNamespace.class,
nextPath);
if (current == null) {
return Optional.ofNullable(tryToFindUnknownStatement(nextPath.getLocalName(),
}
while (current != null && iterator.hasNext()) {
nextPath = iterator.next();
- final Mutable<?, ?, EffectiveStatement<?, ?>> nextNodeCtx = current.getFromNamespace(
- ChildSchemaNodeNamespace.class,nextPath);
+ @SuppressWarnings("unchecked")
+ final Mutable<?, ?, EffectiveStatement<?, ?>> nextNodeCtx = (Mutable)current.getFromNamespace(
+ ChildSchemaNodeNamespace.class, nextPath);
if (nextNodeCtx == null) {
return Optional.ofNullable(tryToFindUnknownStatement(nextPath.getLocalName(), current));
}
throw new UnsupportedOperationException("Direct access to namespace is not supported");
}
- @SuppressWarnings("unchecked")
@Override
public Mutable<?, ?, EffectiveStatement<?, ?>> getFrom(final NamespaceStorageNode storage,
final SchemaNodeIdentifier key) {
return null;
}
QName nextPath = iterator.next();
- Mutable<?, ?, EffectiveStatement<?, ?>> current = lookupStartStorage.getFromLocalStorage(
+ @SuppressWarnings("unchecked")
+ Mutable<?, ?, EffectiveStatement<?, ?>> current = (Mutable)lookupStartStorage.getFromLocalStorage(
ChildSchemaNodeNamespace.class,nextPath);
if (current == null && lookupStartStorage instanceof StmtContext<?, ?, ?>) {
return ChildSchemaNodeNamespace.tryToFindUnknownStatement(nextPath.getLocalName(),
}
while (current != null && iterator.hasNext()) {
nextPath = iterator.next();
- final Mutable<?, ?, EffectiveStatement<?, ?>> nextNodeCtx = current.getFromNamespace(
+ @SuppressWarnings("unchecked")
+ final Mutable<?, ?, EffectiveStatement<?, ?>> nextNodeCtx = (Mutable)current.getFromNamespace(
ChildSchemaNodeNamespace.class,nextPath);
if (nextNodeCtx == null) {
return ChildSchemaNodeNamespace.tryToFindUnknownStatement(nextPath.getLocalName(), current);