]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/elaboration/java/LoggingModule.java
Minor SCL enhancements and fixes for logging and test executing
[simantics/platform.git] / bundles / org.simantics.scl.compiler / src / org / simantics / scl / compiler / elaboration / java / LoggingModule.java
index fa5059626a12b1b881a2f6d913b74d4ef3bad3bc..45596c5704e5aad359f197e445781cca148509b7 100644 (file)
@@ -2,6 +2,7 @@ package org.simantics.scl.compiler.elaboration.java;
 
 import org.cojen.classfile.TypeDesc;
 import org.osgi.service.component.annotations.Component;
 
 import org.cojen.classfile.TypeDesc;
 import org.osgi.service.component.annotations.Component;
+import org.simantics.scl.compiler.commands.CommandSession;
 import org.simantics.scl.compiler.common.names.Name;
 import org.simantics.scl.compiler.constants.JavaMethod;
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
 import org.simantics.scl.compiler.common.names.Name;
 import org.simantics.scl.compiler.constants.JavaMethod;
 import org.simantics.scl.compiler.elaboration.contexts.SimplificationContext;
@@ -48,8 +49,13 @@ public class LoggingModule extends ConcreteModule {
                 @Override
                 public Expression apply(SimplificationContext context, Type[] typeParameters, EApply apply) {
                     ConcreteModule module = context.getCompilationContext().module;
                 @Override
                 public Expression apply(SimplificationContext context, Type[] typeParameters, EApply apply) {
                     ConcreteModule module = context.getCompilationContext().module;
+                    String identifier;
+                    if (module != null)
+                        identifier = module.getName().replaceAll("/", ".");
+                    else
+                        identifier = CommandSession.class.getName();
                     apply.set(new ELiteral(javaMethod), new Expression[] {
                     apply.set(new ELiteral(javaMethod), new Expression[] {
-                            new EExternalConstant(LoggerFactory.getLogger(module.getName().replaceAll("/", ".")), Logger),
+                            new EExternalConstant(LoggerFactory.getLogger(identifier), Logger),
                             apply.parameters[0]
                     });
                     return apply;
                             apply.parameters[0]
                     });
                     return apply;