contrib/jwrapper: enable serialization of model
authorAlexis Laferrière <alexis.laf@xymus.net>
Mon, 3 Aug 2015 14:06:52 +0000 (10:06 -0400)
committerAlexis Laferrière <alexis.laf@xymus.net>
Wed, 5 Aug 2015 01:41:51 +0000 (21:41 -0400)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

contrib/jwrapper/.gitignore
contrib/jwrapper/Makefile
contrib/jwrapper/src/code_generator.nit
contrib/jwrapper/src/model.nit

index f37f3ea..ad11ad5 100644 (file)
@@ -2,5 +2,6 @@ gen/*
 src/javap_lexer.nit
 src/javap_parser.nit
 src/javap_test_parser.nit
+src/serial.nit
 tests/*.nit
 tmp/*
index d8d05e0..34faa7a 100644 (file)
@@ -9,9 +9,12 @@ src/javap_test_parser.nit: ../nitcc/src/nitcc grammar/javap.sablecc
        mv javap_*.nit src/
        mv javap* gen/
 
-bin/jwrapper: src/javap_test_parser.nit $(shell ../../bin/nitls -M src/jwrapper.nit) ../../bin/nitc
+src/serial.nit: $(shell ../../bin/nitls -M src/jwrapper.nit)
+       ../../bin/nitserial -o src/serial.nit -d project src/jwrapper.nit
+
+bin/jwrapper: src/javap_test_parser.nit src/serial.nit $(shell ../../bin/nitls -M src/jwrapper.nit) ../../bin/nitc
        mkdir -p bin
-       ../../bin/nitc src/jwrapper.nit -o bin/jwrapper
+       ../../bin/nitc src/jwrapper.nit -o bin/jwrapper -m src/serial.nit
 
 clean:
        rm -f bin/javap_test_parser bin/jwrapper
index 0e5fe3b..c942ae9 100644 (file)
@@ -444,7 +444,7 @@ end
 
 redef class JavaClass
        # Property names used in this class
-       private var used_names = new HashSet[String]
+       private var used_names = new HashSet[String] is serialize
 
        # Get an available property name for the Java property with `name` and parameters
        #
index e47b76f..95b54c5 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Contains the java and nit type representation used to convert java to nit code
-module model
+# Model of the parsed Java classes and their corresponding Nit types
+module model is serialize
 
 import more_collections
 import opts
 import poset
+import binary::serialization
 
 import jtype_converter
 
@@ -262,10 +263,10 @@ class JavaModel
        end
 
        # Unknown types, not already wrapped and not in this pass
-       var unknown_types = new HashMap[JavaType, NitType]
+       var unknown_types = new HashMap[JavaType, NitType] is noserialize
 
        # Wrapped types, or classes analyzed in this pass
-       var known_types = new HashMap[JavaType, NitType]
+       var known_types = new HashMap[JavaType, NitType] is noserialize
 
        # Get the `NitType` corresponding to the `JavaType`
        #
@@ -331,7 +332,7 @@ class JavaModel
        end
 
        # Specialization hierarchy of `classes`
-       var class_hierarchy = new POSet[JavaClass]
+       var class_hierarchy = new POSet[JavaClass] is noserialize
 
        # Fill `class_hierarchy`
        fun build_class_hierarchy
@@ -528,7 +529,7 @@ redef class Sys
        var opt_arrays = new OptionInt("Depth of the primitive array for each wrapped class (default: 1)", 1, "-a")
 end
 
-redef class Text
+redef abstract class Text
        # Get a copy of `self` where the first letter is capitalized
        fun simple_capitalized: String
        do