Use representation class for casting 48/99448/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 24 Jan 2022 16:30:54 +0000 (17:30 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 25 Jan 2022 21:34:31 +0000 (22:34 +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>
(cherry picked from commit 0ad5644d6e4e5a9ef6a18d462c97064d41cbcd42)

yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/repo/util/AbstractSchemaSourceCache.java

index 92567fd498b30e6e35bc2e16b84c39b86d200dd9..f7bc8f73c9471e77f8c7a05e55e922d1196771eb 100644 (file)
@@ -68,9 +68,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));
         }
     }