On 28.05.16 19:38, Alain Stalder wrote:
Hmn, not sure yet, but looks like the map from the Spring Framework I am using is treating both keys (Class) and values (ClassInfo) as weak references, not sure yet if this could easily be changed...

No, at least no indication of that so far, seems only to determine ClassInfo once per class.

Yes, that is the issue, map entries can be garbage collected even if the class is still loaded (e.g. Integer)...

e.g.

def scriptText = """
class Script1 extends Script {
   static class Inner {
       int x = 1;
   }

   Object run() {
       print "."
       return new Inner().x + new Parallel().y
       return x+y
   }
}

class Parallel {
    int y = 2;
}
"""

def shell = new GroovyShell()
//for (int i=0; i<1000; i++) {
//   long t0 = System.nanoTime()
   for (int j=0; j<1000; j++) {
      shell.run(scriptText, "script", [])
   }
//   long t1 = System.nanoTime()
//   printf("%3d: %3.1fs%n", i, ((double)(t1-t0))/1000000000)
//}

=>

Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: java.lang.Integer.plus() is applicable for argument types: (java.lang.Integer) values: [2] Possible solutions: sum(int, int), wait(), equals(java.lang.Object), wait(long), wait(long, int), equals(java.lang.Object)

Reply via email to