X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.compiler%2Fsrc%2Forg%2Fsimantics%2Fscl%2Fcompiler%2Fruntime%2FRuntimeModule.java;h=aeb21ffa63b333a5aae9cd1b018c75aad4549e29;hb=e8269f6cba002c702c25d80db5399b5b50b97ab9;hp=c5904b3c44fdb8f35427aa548e4c7165e877c932;hpb=969bd23cab98a79ca9101af33334000879fb60c5;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/runtime/RuntimeModule.java b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/runtime/RuntimeModule.java index c5904b3c4..aeb21ffa6 100644 --- a/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/runtime/RuntimeModule.java +++ b/bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/runtime/RuntimeModule.java @@ -1,9 +1,8 @@ package org.simantics.scl.compiler.runtime; -import java.io.IOException; -import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.Collection; +import java.util.List; import java.util.Map; import org.simantics.scl.compiler.constants.Constant; @@ -15,17 +14,8 @@ import org.simantics.scl.compiler.internal.codegen.types.JavaTypeTranslator; import org.simantics.scl.compiler.internal.codegen.utils.JavaNamingPolicy; import org.simantics.scl.compiler.internal.codegen.utils.TransientClassBuilder; import org.simantics.scl.compiler.module.Module; -import org.simantics.scl.compiler.top.SCLCompilerConfiguration; import org.simantics.scl.compiler.top.ValueNotFound; -import com.strobel.assembler.metadata.Buffer; -import com.strobel.assembler.metadata.ClasspathTypeLoader; -import com.strobel.assembler.metadata.CompositeTypeLoader; -import com.strobel.assembler.metadata.ITypeLoader; -import com.strobel.decompiler.Decompiler; -import com.strobel.decompiler.DecompilerSettings; -import com.strobel.decompiler.PlainTextOutput; - import gnu.trove.map.hash.THashMap; public class RuntimeModule { @@ -117,32 +107,7 @@ public class RuntimeModule { bytes = localClasses.get(internalName); if(bytes == null) throw new ClassNotFoundException(name); - } - if(SCLCompilerConfiguration.SHOW_LOADED_CLASSES_DISASSEMBLED) { - DecompilerSettings settings = DecompilerSettings.javaDefaults(); - ITypeLoader typeLoader = new ITypeLoader() { - @Override - public boolean tryLoadType(String internalName, Buffer buffer) { - byte[] bytes = getBytes(internalName); - if(bytes != null) { - buffer.reset(bytes.length); - buffer.putByteArray(bytes, 0, bytes.length); - buffer.position(0); - return true; - } - else - return false; - } - }; - settings.setTypeLoader(new CompositeTypeLoader(typeLoader, new ClasspathTypeLoader())); - OutputStreamWriter writer = new OutputStreamWriter(System.out); - PlainTextOutput output = new PlainTextOutput(writer); - Decompiler.decompile(name, output, settings); - try { - writer.flush(); - } catch (IOException e) { - } - } + } return defineClass(name, bytes, 0, bytes.length); } @@ -241,10 +206,17 @@ public class RuntimeModule { @Override public void collectRules(Collection rules) { } + @Override + public List getFieldAccessors(String name) { + // TODO Not clear if this is needed. + return null; + } }; public RuntimeModule(Module module, RuntimeModuleMap parentModuleMap, ClassLoader parentClassLoader) { + if(parentClassLoader == null) + throw new NullPointerException(); this.module = module; this.parentModuleMap = parentModuleMap; this.classLoader = new ModuleClassLoader(parentClassLoader);