Do not install Groovy's do-it classes into class registry... development
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 29 Aug 2013 01:09:28 +0100
branchdevelopment
changeset 2676 a9d6293ac6d5
parent 2675 287841eb1564
child 2677 17b4e18678ae
Do not install Groovy's do-it classes into class registry... ...they are used only once and never again.
GroovyEvaluator.st
JavaClassRegistry.st
--- a/GroovyEvaluator.st	Wed Aug 28 09:24:47 2013 +0100
+++ b/GroovyEvaluator.st	Thu Aug 29 01:09:28 2013 +0100
@@ -165,7 +165,7 @@
         result := shell 
                     perform: #'evaluate(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object;'
                     with: (Java as_String: src string)
-                    with: (Java as_String: 'doIt')
+                    with: (Java as_String: '$do$It$')
     ] on: JAVA org codehaus groovy control CompilationFailedException do:[:ex|
         self syntaxError: ex.    
     ].
@@ -173,6 +173,7 @@
     ^ result class javaUnwrap: result.
 
     "Created: / 24-08-2013 / 13:48:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 29-08-2013 / 00:37:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !GroovyEvaluator methodsFor:'error reporting'!
--- a/JavaClassRegistry.st	Wed Aug 28 09:24:47 2013 +0100
+++ b/JavaClassRegistry.st	Thu Aug 29 01:09:28 2013 +0100
@@ -304,6 +304,13 @@
 registerClass: newClass
     | classes oldClass |
 
+    ((newClass name == #'$do$It$') 
+        and:[newClass superclass name == #'groovy/lang/Script']) ifTrue:[
+        "/ Mhhh...Groovy do-it. No need to register this!!
+        ^ self
+    ].
+
+
     self assert: (newClass name includes: $.) not.
     loaders keysAndValuesDo:[:loader :classesPerLoader|
 
@@ -331,13 +338,8 @@
                     Smalltalk changed: #classDefinition with: reloadedClass.
                     ^self.             
                 ].
-            ] ifFalse:[
-                ((newClass name == #Script1) 
-                    and:[newClass superclass name == #'groovy/lang/Script']) ifFalse:[
-                        "/self breakPoint: #jv.
-                    ]
-            ]
-        ]                        
+            ].
+        ].
     ].
 
     classes := loaders at: newClass classLoader ifAbsent: nil.
@@ -349,7 +351,7 @@
 
     "Created: / 23-10-2011 / 11:53:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 02-11-2011 / 18:40:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
-    "Modified: / 06-08-2013 / 10:46:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 29-08-2013 / 01:03:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 registerClassInSmalltalk: javaclass notify: doNotify