Do not subclass YangTextSchemaSource in yang-repo-fs
[yangtools.git] / yang / yang-model-util / src / main / java / org / opendaylight / yangtools / yang / model / repo / util / FilesystemSchemaSourceCache.java
index 1c6b3c51084cfdf2d5fa67101238ebc256393cdc..b6086590a1c98d555de1269b01287451599e197b 100644 (file)
@@ -12,7 +12,6 @@ import static java.util.Objects.requireNonNull;
 import static org.opendaylight.yangtools.util.concurrent.FluentFutures.immediateFailedFluentFuture;
 import static org.opendaylight.yangtools.util.concurrent.FluentFutures.immediateFluentFuture;
 
-import com.google.common.base.MoreObjects.ToStringHelper;
 import com.google.common.util.concurrent.FluentFuture;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.File;
@@ -250,18 +249,7 @@ public final class FilesystemSchemaSourceCache<T extends SchemaSourceRepresentat
 
         @Override
         public YangTextSchemaSource restoreAsType(final SourceIdentifier sourceIdentifier, final File cachedSource) {
-            return new YangTextSchemaSource(sourceIdentifier) {
-
-                @Override
-                protected ToStringHelper addToStringAttributes(final ToStringHelper toStringHelper) {
-                    return toStringHelper;
-                }
-
-                @Override
-                public InputStream openStream() throws IOException {
-                    return Files.newInputStream(cachedSource.toPath());
-                }
-            };
+            return YangTextSchemaSource.forFile(cachedSource, sourceIdentifier);
         }
     }