THRIFT-3025 Change pure Ints into @enums
Client: Haxe
Patch: Jens Geyer

This closes #391
diff --git a/lib/haxe/src/org/apache/thrift/TApplicationException.hx b/lib/haxe/src/org/apache/thrift/TApplicationException.hx
index 4287a85..4fe571d 100644
--- a/lib/haxe/src/org/apache/thrift/TApplicationException.hx
+++ b/lib/haxe/src/org/apache/thrift/TApplicationException.hx
@@ -34,6 +34,8 @@
     private static var MESSAGE_FIELD = { new TField("message", TType.STRING, 1); };
     private static var TYPE_FIELD = { new TField("type", TType.I32, 2); };
 
+    // WARNING: These are subject to be extended in the future, so we can't use enums 
+    // with Haxe 3.1.3 because of https://github.com/HaxeFoundation/haxe/issues/3649
     public static inline var UNKNOWN : Int = 0;
     public static inline var UNKNOWN_METHOD : Int = 1;
     public static inline var INVALID_MESSAGE_TYPE : Int = 2;
diff --git a/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx b/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx
index 7c22030..039a2cf 100644
--- a/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx
+++ b/lib/haxe/src/org/apache/thrift/TFieldRequirementType.hx
@@ -23,9 +23,9 @@
    * Requirement type constants.
    *
    */
-class TFieldRequirementType {
-    public static inline var REQUIRED : Int  = 1;
+@:enum
+abstract TFieldRequirementType(Int)  from Int to Int  {
+    public static inline var REQUIRED : Int = 1;
     public static inline var OPTIONAL : Int = 2;
-    public static inline var DEFAULT : Int = 3;
-
+    public static inline var DEFAULT  : Int = 3;
 }
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx b/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx
index d08a6d0..0781114 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TCompactProtocol.hx
@@ -35,26 +35,7 @@
 
 
 /**
- * All of the on-wire type codes.
- */
-class TCompactTypes {
-    public static inline var STOP          = 0x00;
-    public static inline var BOOLEAN_TRUE  = 0x01;
-    public static inline var BOOLEAN_FALSE = 0x02;
-    public static inline var BYTE          = 0x03;
-    public static inline var I16           = 0x04;
-    public static inline var I32           = 0x05;
-    public static inline var I64           = 0x06;
-    public static inline var DOUBLE        = 0x07;
-    public static inline var BINARY        = 0x08;
-    public static inline var LIST          = 0x09;
-    public static inline var SET           = 0x0A;
-    public static inline var MAP           = 0x0B;
-    public static inline var STRUCT        = 0x0C;
-}
-
-/**
-* Binary protocol implementation for thrift.
+* Compact protocol implementation for thrift.
 */
 class TCompactProtocol implements TProtocol {
 
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TCompactTypes.hx b/lib/haxe/src/org/apache/thrift/protocol/TCompactTypes.hx
new file mode 100644
index 0000000..cdd3d87
--- /dev/null
+++ b/lib/haxe/src/org/apache/thrift/protocol/TCompactTypes.hx
@@ -0,0 +1,41 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.thrift.protocol;
+
+/**
+ * All of the on-wire type codes.
+ */
+@:enum
+abstract TCompactTypes(Int)  from Int to Int  {
+    public static inline var STOP          = 0x00;
+    public static inline var BOOLEAN_TRUE  = 0x01;
+    public static inline var BOOLEAN_FALSE = 0x02;
+    public static inline var BYTE          = 0x03;
+    public static inline var I16           = 0x04;
+    public static inline var I32           = 0x05;
+    public static inline var I64           = 0x06;
+    public static inline var DOUBLE        = 0x07;
+    public static inline var BINARY        = 0x08;
+    public static inline var LIST          = 0x09;
+    public static inline var SET           = 0x0A;
+    public static inline var MAP           = 0x0B;
+    public static inline var STRUCT        = 0x0C;
+}
+
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TMessage.hx b/lib/haxe/src/org/apache/thrift/protocol/TMessage.hx
index 58d71a9..d99264a 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TMessage.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TMessage.hx
@@ -38,4 +38,4 @@
     public function equals(other:TMessage) : Bool {
       return name == other.name && type == other.type && seqid == other.seqid;
     }
-}
\ No newline at end of file
+}
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TMessageType.hx b/lib/haxe/src/org/apache/thrift/protocol/TMessageType.hx
index 7cb38b3..706d329 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TMessageType.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TMessageType.hx
@@ -19,9 +19,10 @@
 
 package org.apache.thrift.protocol;
 
-class TMessageType {
+@:enum
+abstract TMessageType(Int)  from Int to Int  {
     public static inline var CALL      : Int = 1;
-    public static inline var REPLY        : Int = 2;
+    public static inline var REPLY     : Int = 2;
     public static inline var EXCEPTION : Int = 3;
     public static inline var ONEWAY    : Int = 4;
 }
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TProtocolException.hx b/lib/haxe/src/org/apache/thrift/protocol/TProtocolException.hx
index 6e528cb..2e0f9f5 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TProtocolException.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TProtocolException.hx
@@ -23,6 +23,8 @@
 
 class TProtocolException extends TException {
 
+    // WARNING: These are subject to be extended in the future, so we can't use enums 
+    // with Haxe 3.1.3 because of https://github.com/HaxeFoundation/haxe/issues/3649
     public static inline var UNKNOWN : Int = 0;
     public static inline var INVALID_DATA : Int = 1;
     public static inline var NEGATIVE_SIZE : Int = 2;
diff --git a/lib/haxe/src/org/apache/thrift/protocol/TType.hx b/lib/haxe/src/org/apache/thrift/protocol/TType.hx
index 1e093c2..6abbc96 100644
--- a/lib/haxe/src/org/apache/thrift/protocol/TType.hx
+++ b/lib/haxe/src/org/apache/thrift/protocol/TType.hx
@@ -19,8 +19,8 @@
 
 package org.apache.thrift.protocol;
 
-class TType {
-
+@:enum
+abstract TType(Int)  from Int to Int  {
     public static inline var STOP : Int   = 0;
     public static inline var VOID : Int   = 1;
     public static inline var BOOL : Int   = 2;
@@ -34,5 +34,4 @@
     public static inline var MAP : Int    = 13;
     public static inline var SET : Int    = 14;
     public static inline var LIST : Int   = 15;
-
 }
diff --git a/lib/haxe/src/org/apache/thrift/transport/TTransportException.hx b/lib/haxe/src/org/apache/thrift/transport/TTransportException.hx
index f930c52..036b9f5 100644
--- a/lib/haxe/src/org/apache/thrift/transport/TTransportException.hx
+++ b/lib/haxe/src/org/apache/thrift/transport/TTransportException.hx
@@ -23,6 +23,8 @@
 
 class TTransportException extends TException {
 
+    // WARNING: These are subject to be extended in the future, so we can't use enums 
+    // with Haxe 3.1.3 because of https://github.com/HaxeFoundation/haxe/issues/3649
     public static inline var UNKNOWN : Int = 0;
     public static inline var NOT_OPEN : Int = 1;
     public static inline var ALREADY_OPEN : Int = 2;