Use representation class for casting 25/99425/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 24 Jan 2022 16:30:54 +0000 (17:30 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 24 Jan 2022 16:30:54 +0000 (17:30 +0100)
We have an unchecked cast supressed here. Use Class.cast() to get
rid of it.

Change-Id: Ie39f9d21095a438a72dc88945e54d1846becf01d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-repo-spi/src/main/java/org/opendaylight/yangtools/yang/model/repo/spi/AbstractSchemaSourceCache.java

index 77f703914d67e6ba10864b18d97f388d66db5f12..1390f8b05f7f355bd0471a2ea9d88d1a7889eb26 100644 (file)
@@ -63,9 +63,7 @@ public abstract class AbstractSchemaSourceCache<T extends SchemaSourceRepresenta
     @Override
     public void schemaSourceEncountered(final SchemaSourceRepresentation source) {
         if (representation.isAssignableFrom(source.getType())) {
-            @SuppressWarnings("unchecked")
-            final T src = (T)source;
-            offer(src);
+            offer(representation.cast(source));
         }
     }