[ https://issues.apache.org/jira/browse/THRIFT-4476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16383598#comment-16383598 ]
ASF GitHub Bot commented on THRIFT-4476: ---------------------------------------- Github user ozymaxx commented on the issue: https://github.com/apache/thrift/pull/1496 Two errors at the initial steps of my builds: * The one in Travis (happening in multiple builds): ``` Resolving master.dl.sourceforge.net (master.dl.sourceforge.net)... 216.105.38.12 Connecting to master.dl.sourceforge.net (master.dl.sourceforge.net)|216.105.38.12|:80... failed: Connection refused. The command '/bin/sh -c apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EBCF975E5BA24D5E && wget http://master.dl.sourceforge.net/project/d-apt/files/d-apt.list -O /etc/apt/sources.list.d/d-apt.list && wget -qO - https://dlang.org/d-keyring.gpg | apt-key add -' returned a non-zero code: 4 The command "if [[ `uname` == "Linux" ]]; then build/docker/refresh.sh; fi" failed and exited with 4 during . ``` * The one in AppVeyor (at the initial steps): ``` Downloading winflexbison3 from 'https://sourceforge.net/projects/winflexbison/files/old_versions/win_flex_bison-2.5.10.zip' WARNING: C:\projects\thrift\buildcache\winflexbison3\2.5.10.20170725\win_flex_bison-2.5.10.zip is of content type text/html Progress: 100% - Completed download of C:\projects\thrift\buildcache\winflexbison3\2.5.10.20170725\win_flex_bison-2.5.10.zip (652 B). Download of win_flex_bison-2.5.10.zip (652 B) completed. Error - hashes do not match. Actual value was '7A07D3F7CCA5C0B38CA811984EF8DA536DA32932D68C1A6CCE33EC2462B930BF'. ERROR: Checksum for 'C:\projects\thrift\buildcache\winflexbison3\2.5.10.20170725\win_flex_bison-2.5.10.zip' did not meet '565967D6F6D021B617144698DEDD055DF9B91825CB61A7E1F29BFD22219F550C' for checksum type 'sha256'. Consider passing the actual checksums through with --checksum --checksum64 once you validate the checksums are appropriate. A less secure option is to pass --ignore-checksums if necessary. The install of winflexbison3 was NOT successful. Error while running 'C:\ProgramData\chocolatey\lib\winflexbison3\tools\chocolateyInstall.ps1'. See log for details. Chocolatey installed 0/1 packages. 1 packages failed. See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log). Failures - winflexbison3 (exited -1) - Error while running 'C:\ProgramData\chocolatey\lib\winflexbison3\tools\chocolateyInstall.ps1'. See log for details. Command exited with code -1 ``` I think these errors are build configration-related. These also showed up in the builders running on my forked repo. > Typecasting problem on list items > --------------------------------- > > Key: THRIFT-4476 > URL: https://issues.apache.org/jira/browse/THRIFT-4476 > Project: Thrift > Issue Type: Bug > Components: Java - Compiler > Affects Versions: 0.11.0 > Reporter: Ozan Can Altiok > Priority: Major > > I was trying to add the following into a thrift interface file. > {{const list<double> timeCoefficients = [24, 60, 60, 1000, 1000, 1000]}} > With the definition given above the {{.thrift}} file compiled properly. > However, I noticed that in Python, the items in {{timeCoefficients}} are > considered to be integer although the list has been defined to include items > of {{double}} type. Then I modified the definition as given below to make > sure all the items are of type {{double}}. > {{const list<double> timeCoefficients = [24.0, 60.0, 60.0, 1000.0, 1000.0, > 1000.0]}} > After the change, I ran into the following error during compilation. > {{[ERROR] .../TimeCoefficients.java:[402,48] error: no suitable method found > for add(int)}} > {{[ERROR] method Collection.add(Double) is not applicable}} > {{[ERROR] (argument mismatch; int cannot be converted to Double)}} > {{[ERROR] method List.add(Double) is not applicable}} > {{[ERROR] (argument mismatch; int cannot be converted to Double)}} > Next, I changed the line as follows and the compilation became successful. > {{const list<double> timeCoefficients = [24.1, 60.1, 60.1, 1000.1, 1000.1, > 1000.1]}} > When I reviewed the generated Java source files, I discovered that > {{const list<double> timeCoefficients = [24, 60, 60, 1000, 1000, 1000]}} > compiles to > {{public static final java.util.List<java.lang.Double> timeCoefficients = new > java.util.ArrayList<java.lang.Double>();}} > {{static {}} > {{ timeCoefficients.add((double)24);}} > {{ timeCoefficients.add((double)60);}} > {{ timeCoefficients.add((double)60);}} > {{ timeCoefficients.add((double)1000);}} > {{ timeCoefficients.add((double)1000);}} > {{ timeCoefficients.add((double)1000);}} > {{}}} > whilst > {{const list<double> timeCoefficients = [24.0, 60.0, 60.0, 1000.0, 1000.0, > 1000.0]}} > compiles to > {{public static final java.util.List<java.lang.Double> timeCoefficients = new > java.util.ArrayList<java.lang.Double>();}} > {{static {}} > {{ timeCoefficients.add(24);}} > {{ timeCoefficients.add(60);}} > {{ timeCoefficients.add(60);}} > {{ timeCoefficients.add(1000);}} > {{ timeCoefficients.add(1000);}} > {{ timeCoefficients.add(1000);}} > {{}}} > which leads to an error. > When I modified this line as follows > {{const list<double> timeCoefficients = [24.1, 60.1, 60.1, 1000.1, 1000.1, > 1000.1]}} > this line compiled to > {{public static final java.util.List<java.lang.Double> timeCoefficients = new > java.util.ArrayList<java.lang.Double>();}} > {{static {}} > {{ timeCoefficients.add(24.1);}} > {{ timeCoefficients.add(60.1);}} > {{ timeCoefficients.add(60.1);}} > {{ timeCoefficients.add(1000.1);}} > {{ timeCoefficients.add(1000.1);}} > {{ timeCoefficients.add(1000.1);}} > {{}}} > My guess is that, even if I put {{.0}} at the end of each numeric constant, > on the Java side, Thrift compiler considers them to be {{double}} and does no > typecasts. However, the {{.0}} s are getting lost somewhere and the items > become integers in the generated Java code. Thus, when it comes to populating > the array, Java cannot succeed. {{Double}} s cannot be unboxed to integer and > Java thinks {{int}} and {{Double}} are not related. -- This message was sent by Atlassian JIRA (v7.6.3#76005)