extensions.st
changeset 3112 1f8c991bc1d2
parent 3055 10b7a8f2e23c
child 3113 3cdcaf15c918
--- a/extensions.st	Wed May 21 21:08:57 2014 +0100
+++ b/extensions.st	Tue May 27 12:49:36 2014 +0100
@@ -303,16 +303,22 @@
 
     | nm |
     nm := self asJavaComponentClassName.
-    (nm startsWith: $L) ifTrue: [
-	nm := nm copyFrom: 2 to: nm size - 1
-    ].
-    (nm includes: $/) ifTrue: [
-	nm := nm asString copyReplaceAll: $/ with: $.
+    (nm first == $L) ifTrue: [
+        nm := nm copyFrom: 2 to: nm size - 1.
+        (nm includes: $/) ifTrue: [
+            "/ No need to do another copt here!!
+            nm replaceAll: $/ with: $.            
+        ].
+    ] ifFalse:[
+        (nm includes: $/) ifTrue: [
+            nm := nm copyReplaceAll: $/ with: $.
+        ].
     ].
     ^ nm.
 
     "Created: / 21-10-2011 / 12:31:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
     "Created: / 30-10-2011 / 17:41:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 27-05-2014 / 12:29:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !CharacterArray methodsFor:'java conversions'!
@@ -320,13 +326,13 @@
 asJavaComponentClassName
     | componentClassName |
 
-    componentClassName := self utf8Encoded.
-    (componentClassName matches: '*\[*') ifTrue: [
-	componentClassName := componentClassName
-		    copyFrom: (componentClassName lastIndexOf: $[) + 1
-		    to: componentClassName size.
+    componentClassName := self "utf8Encoded".
+    (componentClassName first == $[) ifTrue: [
+        componentClassName := componentClassName copyFrom: (componentClassName lastIndexOf: $[) + 1
     ].
     ^ componentClassName.
+
+    "Modified: / 27-05-2014 / 12:25:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !CharacterArray methodsFor:'java conversions'!
@@ -361,16 +367,22 @@
     "removes square brackets and adds slashes"
     | internalName |
     internalName := self asJavaComponentClassName.
-    (internalName startsWith: $L) ifTrue: [
-	internalName := internalName copyFrom: 2 to: internalName size - 1
-    ].
-    (internalName includes: $.) ifTrue: [
-	internalName := internalName asString copyReplaceAll: $. with: $/
+    (internalName first == $L) ifTrue: [
+        internalName := internalName copyFrom: 2 to: internalName size - 1.
+        "/ No need to do another copy here
+        (internalName includes: $.) ifTrue: [
+            internalName replaceAll: $. with: $/
+        ].
+    ] ifFalse:[
+        (internalName includes: $.) ifTrue: [
+            internalName := internalName copyReplaceAll: $. with: $/
+        ].
     ].
     ^ internalName.
 
     "Created: / 21-10-2011 / 12:31:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
     "Created: / 30-10-2011 / 17:40:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 27-05-2014 / 12:30:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !CharacterArray methodsFor:'java queries'!