]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
OpenJ9 compatibility for SCL compiler's naming of ontology modules 67/2367/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sat, 27 Oct 2018 14:42:14 +0000 (17:42 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Sat, 27 Oct 2018 14:42:14 +0000 (17:42 +0300)
The problem was these errors coming from ClassLoader.defineClassImpl
when the generated class name contained two '/' characters in a row:

java.lang.ClassFormatError: JVMCFRE068 class name is invalid;
class=scl/http_58_//Projects/Development_37_20Project/Model/SCLMain,
offset=0

More escaping was added to fix this.

gitlab #159

Change-Id: I01f8b17b1230cbf06051848b23c805e8d2d61c96

bundles/org.simantics.scl.compiler/src/org/simantics/scl/compiler/internal/codegen/utils/JavaNamingPolicy.java

index bd07654743acb86028727928b5d70c704d15b756..7e9780d4a78f12eddbc61aca29ba269f111ab33c 100644 (file)
@@ -34,11 +34,11 @@ public class JavaNamingPolicy {
                 b.append('_').append((int)c).append('_');
         }
         //System.out.println("m2c " + moduleName + " -> " + b.toString());
-        return b.toString().replace("..", "._.");
+        return b.toString().replace("..", "._.").replace("//", "/_/");
     }
     
     public static String classNameToModuleName(String className) {
-       className = className.replace("._.", "..");
+        className = className.replace("/_/", "//").replace("._.", "..");
         StringBuilder b = new StringBuilder(className.length());
         int length = className.length();
         for(int i=0;i<length;++i) {