[
https://issues.apache.org/jira/browse/THRIFT-2589?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jens Geyer resolved THRIFT-2589.
--------------------------------
Resolution: Fixed
Fix Version/s: (was: 1.0)
0.9.2
Committed, thanks!
> C# generator: const of BaseType in IDL generates static instead of const
> properties
> -----------------------------------------------------------------------------------
>
> Key: THRIFT-2589
> URL: https://issues.apache.org/jira/browse/THRIFT-2589
> Project: Thrift
> Issue Type: Bug
> Components: C# - Compiler
> Affects Versions: 0.9.1
> Environment: Windows 7
> Reporter: Thomas Lazar
> Assignee: Jens Geyer
> Fix For: 0.9.2
>
> Attachments: thrift-2589-fix-csharp-basetype-const.patch
>
>
> Compiling a thrift file containing const definitions for basetype variables
> results in static properties {{public static whatsits}} being generated.
> Should generate const properties {{public const whatsits}}.
> Current version generates this from test/ConstantsDemo.thrift
> {code}
> public static class ConstantsDemoConstants
> {
> public static int myInt = 3;
> public static int hex_const = 31;
> public static int GEN_ME = -3523553;
> public static double GEn_DUB = 325.532;
> public static double GEn_DU = 85.2355;
> public static string GEN_STRING = "asldkjasfd";
> public static Dictionary<int, int> GEN_MAP = new Dictionary<int, int>();
> public static List<int> GEN_LIST = new List<int>();
> ...
> {code}
> The code should instead look like this.
> {code}
> public static class ConstantsDemoConstants
> {
> public const int myInt = 3;
> public const int hex_const = 31;
> public const int GEN_ME = -3523553;
> public const double GEn_DUB = 325.532;
> public const double GEn_DU = 85.2355;
> public const string GEN_STRING = "asldkjasfd";
> public static Dictionary<int, int> GEN_MAP = new Dictionary<int, int>();
> public static List<int> GEN_LIST = new List<int>();
> ...
> {code}
> A patch for this change is supplied.
> As i don't really know yet how the testing for these kind of changes is done
> i haven't supplied one. But generating all the .thrift files in test with a
> before and after version of the compiler and comparing the output of both
> looked good to me.
--
This message was sent by Atlassian JIRA
(v6.2#6252)