Nevo Hed created THRIFT-2587:
--------------------------------

             Summary: Compiled Java code doubles-up the namespace of default 
value
                 Key: THRIFT-2587
                 URL: https://issues.apache.org/jira/browse/THRIFT-2587
             Project: Thrift
          Issue Type: Bug
          Components: Java - Compiler
    Affects Versions: 0.9.1, 0.9.2
            Reporter: Nevo Hed
             Fix For: 0.9.2


This seems to happen when a struct with a field that has a default value,
and said value is an enum defined in an included thrift file

{code:title=common.thrift|borderStyle=solid}
namespace java com.example.common

enum SomeEnum {
  SOMEENUM_X,
}
{code}


{code:title=myapi.thrift|borderStyle=solid}
include "common.thrift"

namespace java com.example.someapi

struct MyStruct {
  1: optional common.SomeEnum val=common.SOMEENUM_X
}
{code}

Compile:
.../thrift --gen cpp myapi.thrift

As you can see the namespace to the enum is wrong, as it contains "common" 
twice.

{code}
$ grep SOMEENUM_ gen-java/com/example/someapi/MyStruct.java
    this.val = com.example.common.common.SOMEENUM_X;
    this.val = com.example.common.common.SOMEENUM_X;
{code}

Reproduced with latest upstream




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to