1 package org.simantics.scl.compiler.source;
4 import java.io.FileInputStream;
5 import java.io.IOException;
6 import java.io.InputStream;
8 import org.simantics.scl.compiler.internal.codegen.types.JavaReferenceValidator;
9 import org.simantics.scl.compiler.internal.codegen.types.RuntimeJavaReferenceValidator;
10 import org.simantics.scl.compiler.module.ImportDeclaration;
11 import org.simantics.scl.compiler.module.repository.UpdateListener;
13 public class FileModuleSource extends EncodedTextualModuleSource {
15 private final ClassLoader classLoader;
16 private final File path;
17 private final ImportDeclaration[] builtinImports;
19 public FileModuleSource(String moduleName, ClassLoader classLoader,
20 File path, ImportDeclaration[] builtinImports) {
22 this.classLoader = classLoader;
24 this.builtinImports = builtinImports;
28 protected InputStream getSourceStream(UpdateListener listener)
30 return new FileInputStream(path);
34 protected JavaReferenceValidator<?, ?, ?, ?> getJavaReferenceValidator() {
35 return new RuntimeJavaReferenceValidator(classLoader);
39 public ImportDeclaration[] getBuiltinImports(UpdateListener listener) {
40 return builtinImports;