Add `JavaMethod >> #makeLocalStringSource`
authorJan Vrany <jan.vrany@labware.com>
Tue, 30 Jun 2020 01:10:31 +0100
changeset 4002 8b69954e6f8f
parent 3981 489c2b2ef281
child 4003 7eb787acfccb
Add `JavaMethod >> #makeLocalStringSource` ...to make it polymorhic with normal Smalltalk methods. This is (should be) used by source code managers before filing out a class / method to avoid source corruption when overwriting files in package working copy.
JavaClass.st
JavaMethod.st
Make.proto
bc.mak
stx_libjava.st
tools/bc.mak
--- a/JavaClass.st	Sat Dec 14 04:28:52 2019 +0000
+++ b/JavaClass.st	Tue Jun 30 01:10:31 2020 +0100
@@ -1,5 +1,6 @@
 "
  COPYRIGHT (c) 1996-2015 by Claus Gittinger
+ COPYRIGHT (c) 2020 LabWare
 
  New code and modifications done at SWING Research Group [1]:
 
@@ -48,6 +49,7 @@
 copyright
 "
  COPYRIGHT (c) 1996-2015 by Claus Gittinger
+ COPYRIGHT (c) 2020 LabWare
 
  New code and modifications done at SWING Research Group [1]:
 
@@ -842,6 +844,18 @@
     "Created: / 5.11.1998 / 19:16:00 / cg"
 !
 
+makeLocalStringSource
+    "assure that the methods source code is stored locally as a string
+     within the method (as opposed to an external string, which is accessed
+     by reading the source code file).
+     This is required, when a method's package is changed, to assure that its
+     sourceCode is not lost."   
+
+    self setSource: self sourceString
+
+    "Created: / 30-06-2020 / 01:04:52 / Jan Vrany <jan.vrany@labware.com>"
+!
+
 nameWithoutNameSpacePrefix
     ^ self lastName
 
@@ -1926,22 +1940,6 @@
     "Modified: / 07-12-2014 / 02:11:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-primitiveNew
-    "Create a new cleared JAVA instance. Its instVars are cleared to the
-     corresponding typed values; however, constructor is not invoked."
-
-    "/ Reimplemented for speed as a C function. That function is
-    "/ also called from JIT-compiled code, resulting in 40-50% speedup
-    "/ when running Java code
-%{
-    extern OBJ ___new();
-    RETURN ( ___new(self) );
-%}.
-
-!
-
-
-
 initValueFor:instVarName
     |idx field|
 
@@ -2008,6 +2006,20 @@
     "Modified: / 04-11-1998 / 18:04:34 / cg"
     "Created: / 13-11-1998 / 14:17:01 / cg"
     "Modified: / 02-11-2012 / 21:11:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+primitiveNew
+    "Create a new cleared JAVA instance. Its instVars are cleared to the
+     corresponding typed values; however, constructor is not invoked."
+
+    "/ Reimplemented for speed as a C function. That function is
+    "/ also called from JIT-compiled code, resulting in 40-50% speedup
+    "/ when running Java code
+%{
+    extern OBJ ___new();
+    RETURN ( ___new(self) );
+%}.
+
 ! !
 
 !JavaClass methodsFor:'java instance creation-proxying'!
--- a/JavaMethod.st	Sat Dec 14 04:28:52 2019 +0000
+++ b/JavaMethod.st	Tue Jun 30 01:10:31 2020 +0100
@@ -1,5 +1,6 @@
 "
  COPYRIGHT (c) 1996-2015 by Claus Gittinger
+ COPYRIGHT (c) 2020 LabWare
 
  New code and modifications done at SWING Research Group [1]:
 
@@ -39,6 +40,7 @@
 copyright
 "
  COPYRIGHT (c) 1996-2015 by Claus Gittinger
+ COPYRIGHT (c) 2020 LabWare
 
  New code and modifications done at SWING Research Group [1]:
 
@@ -1116,6 +1118,18 @@
     "
 !
 
+makeLocalStringSource
+    "assure that the methods source code is stored locally as a string
+     within the method (as opposed to an external string, which is accessed
+     by reading the source code file).
+     This is required, when a method's package is changed, to assure that its
+     sourceCode is not lost."  
+
+    javaClass makeLocalStringSource
+
+    "Created: / 30-06-2020 / 01:02:43 / Jan Vrany <jan.vrany@labware.com>"
+!
+
 mclass
     ^ self javaClass
 !
--- a/Make.proto	Sat Dec 14 04:28:52 2019 +0000
+++ b/Make.proto	Tue Jun 30 01:10:31 2020 +0100
@@ -76,7 +76,7 @@
 
 all:: preMake classLibRule postMake
 
-pre_objs::  zlib $(LIBFDM)
+pre_objs::  zlib $(LIBFDM) 
 
 
 java_clean:
--- a/bc.mak	Sat Dec 14 04:28:52 2019 +0000
+++ b/bc.mak	Tue Jun 30 01:10:31 2020 +0100
@@ -121,7 +121,6 @@
 
 
 
-
 test: $(TOP)\goodies\builder\reports
 	pushd $(TOP)\goodies\builder\reports & $(MAKE_BAT)
 	$(TOP)\goodies\builder\reports\report-runner.bat -D . -r Builder::TestReport -p $(PACKAGE)
--- a/stx_libjava.st	Sat Dec 14 04:28:52 2019 +0000
+++ b/stx_libjava.st	Tue Jun 30 01:10:31 2020 +0100
@@ -713,7 +713,7 @@
 !stx_libjava class methodsFor:'description - java'!
 
 javaBundle
-
+    
     ^ JavaCodeBundle standardPackageBundleFor: self package
 ! !
 
--- a/tools/bc.mak	Sat Dec 14 04:28:52 2019 +0000
+++ b/tools/bc.mak	Tue Jun 30 01:10:31 2020 +0100
@@ -82,7 +82,6 @@
 
 
 
-
 test: $(TOP)\goodies\builder\reports
 	pushd $(TOP)\goodies\builder\reports & $(MAKE_BAT)
 	$(TOP)\goodies\builder\reports\report-runner.bat -D . -r Builder::TestReport -p $(PACKAGE)