Fix in SmalltalkChunkFileSourceWriter>>#fileOutMethods:on: to support both old and new Java class naming. jv
authorJan Vrany <jan.vrany@fit.cvut.cz>
Mon, 14 Oct 2013 08:00:12 +0100
branchjv
changeset 18102 7e0c971b2849
parent 18101 8fec4f5f194c
child 18103 389203ee58fc
Fix in SmalltalkChunkFileSourceWriter>>#fileOutMethods:on: to support both old and new Java class naming.
SmalltalkChunkFileSourceWriter.st
--- a/SmalltalkChunkFileSourceWriter.st	Fri Oct 04 12:12:02 2013 +0100
+++ b/SmalltalkChunkFileSourceWriter.st	Mon Oct 14 08:00:12 2013 +0100
@@ -534,14 +534,26 @@
 
 fileOutMethods: methods on: stream
 
-    methods do:
-        [:method| |cat source privacy|
+    methods do:[:method| 
+        |cat source privacy|
 
         stream nextPutChunkSeparator.
         "JV@2012-09-05: Support for filing out Java extension methods"
         method mclass theNonMetaclass isJavaClass ifTrue:[
+            | class classBinaryName comps |
+
+            class := method mclass theNonMetaclass .
+            "Sigh, make it compatible with old and new naming of Java classes
+
+            old -> aJavaClass name == #'java/lang/Object'
+            new -> aJavaClass name == JAVA::java::lang::Object
+                   aJavaClass binaryName == #'java/lang/Object'
+            "
+            classBinaryName := (class respondsTo: #binaryName) 
+                                    ifTrue:[ class binaryName ]
+                                    ifFalse:[ class name ].      
             stream nextPutAll:'(Java classForName:'''.
-            stream nextPutAll:(method mclass theNonMetaclass name copyReplaceAll:$/ with: $.).
+            stream nextPutAll:(classBinaryName copyReplaceAll:$/ with: $.).
             stream nextPutAll:''')'.
             method mclass isMetaclass ifTrue:[
                 stream nextPutAll: ' class'.
@@ -568,6 +580,7 @@
         stream cr]
 
     "Created: / 30-12-2009 / 18:43:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 09-10-2013 / 08:57:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 fileOutPackageDefinition:pkg on:aStream 
@@ -627,6 +640,11 @@
     ^ '$Header: /cvs/stx/stx/libbasic/SmalltalkChunkFileSourceWriter.st,v 1.23 2013-06-23 22:22:44 cg Exp $'
 !
 
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+!
+
 version_SVN
     ^ '$ Id: SmalltalkChunkFileSourceWriter.st 10643 2011-06-08 21:53:07Z vranyj1  $'
 ! !