diff --git a/src/vm/jvm/runtime/org/raku/nqp/runtime/ByteClassLoader.java b/src/vm/jvm/runtime/org/raku/nqp/runtime/ByteClassLoader.java index e83cd20dd..dc3a7e03b 100644 --- a/src/vm/jvm/runtime/org/raku/nqp/runtime/ByteClassLoader.java +++ b/src/vm/jvm/runtime/org/raku/nqp/runtime/ByteClassLoader.java @@ -33,8 +33,9 @@ public Class getMade(String name) { } public Class setMade(String name, Class klass) { - if (name != null) - made.put(name, new SoftReference(klass)); + if (name == null) + name = klass.getName(); + made.put(name, new SoftReference(klass)); return klass; } @@ -42,14 +43,14 @@ public Class getRead(ClassLoader child, String name) { if (name != null && made.containsKey(name)) return made.get(name).get(); if (child != null && read.containsKey(child)) - if (made.containsKey(name = read.get(name))) + if (made.containsKey(name = read.get(child))) return made.get(name).get(); return null; } public Class setRead(ClassLoader child, String name, Class klass) { if (name == null) - name = klass.getCanonicalName(); + name = klass.getName(); if (child != null) read.put(child, name); made.put(name, new SoftReference(klass)); @@ -58,6 +59,6 @@ public Class setRead(ClassLoader child, String name, Class klass) { public Class defineClass(String name, byte[] bytes) throws ClassFormatError { Class made = getMade(name); - return made == null ? setMade(name, defineClass(name, bytes, 0, bytes.length)) : null; + return made == null ? setMade(name, defineClass(name, bytes, 0, bytes.length)) : made; } }