You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Thomas Lazar (JIRA)" <ji...@apache.org> on 2014/10/16 09:14:34 UTC

[jira] [Commented] (THRIFT-2589) C# generator: const of BaseType in IDL generates static instead of const properties

    [ https://issues.apache.org/jira/browse/THRIFT-2589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14173467#comment-14173467 ] 

Thomas Lazar commented on THRIFT-2589:
--------------------------------------

The issue says "Fix Version/s: 0.9.2" but the fix is nowhere to be found in the 0.9.2 branch. Is that by design? 

> 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.3.4#6332)