[ https://issues.apache.org/jira/browse/THRIFT-4476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16394887#comment-16394887 ]
ASF GitHub Bot commented on THRIFT-4476: ---------------------------------------- Github user ozymaxx commented on the issue: https://github.com/apache/thrift/pull/1496 I merged the changes in the master branch into mine, and ran the builds. There are still some errors: On AppVeyor: ``` 3125"C:\projects\build\MSVC2017\x64\INSTALL.vcxproj" (default target) (1) -> 3126"C:\projects\build\MSVC2017\x64\ALL_BUILD.vcxproj" (default target) (3) -> 3127"C:\projects\build\MSVC2017\x64\test\cpp\TestServer.vcxproj" (default target) (32) -> 3128(ClCompile target) -> 3129 C:\projects\thrift\test\cpp\src\TestServer.cpp(799): error C3861: 'sleep': identifier not found [C:\projects\build\MSVC2017\x64\test\cpp\TestServer.vcxproj] 3130 3131 24 Warning(s) 3132 1 Error(s) ``` On Travis: ``` depbase=`echo gen-c_glib/t_test_second_service.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/bash ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -I../../lib/cpp/src/thrift -I../../lib/c_glib/src/thrift -I../../lib/c_glib/src -Igen-c_glib -g -Wall -Wextra -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -O2 -MT gen-c_glib/t_test_second_service.lo -MD -MP -MF $depbase.Tpo -c -o gen-c_glib/t_test_second_service.lo gen-c_glib/t_test_second_service.c &&\ mv -f $depbase.Tpo $depbase.Plo libtool: compile: gcc -DHAVE_CONFIG_H -I. -I../.. -I../../lib/cpp/src/thrift -I../../lib/c_glib/src/thrift -I../../lib/c_glib/src -Igen-c_glib -g -Wall -Wextra -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -O2 -MT gen-c_glib/t_test_second_service.lo -MD -MP -MF gen-c_glib/.deps/t_test_second_service.Tpo -c gen-c_glib/t_test_second_service.c -fPIC -DPIC -o gen-c_glib/.libs/t_test_second_service.o gen-c_glib/t_test_second_service.c: In function 't_test_second_service_processor_process_secondtest_string': gen-c_glib/t_test_second_service.c:397:3: error: unknown type name 'TTestSecondServiceSecondtestStringArgs'; did you mean 'TTestSecondServiceProcessorClass'? TTestSecondServiceSecondtestStringArgs * args = ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TTestSecondServiceProcessorClass gen-c_glib/t_test_second_service.c:398:19: error: 'T_TEST_TYPE_SECOND_SERVICE_SECONDTEST_STRING_ARGS' undeclared (first use in this function); did you mean 'T_TEST_TYPE_SECOND_SERVICE_PROCESSOR'? g_object_new (T_TEST_TYPE_SECOND_SERVICE_SECONDTEST_STRING_ARGS, NULL); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ T_TEST_TYPE_SECOND_SERVICE_PROCESSOR gen-c_glib/t_test_second_service.c:398:19: note: each undeclared identifier is reported only once for each function it appears in gen-c_glib/t_test_second_service.c:408:5: error: unknown type name 'TTestSecondServiceSecondtestStringResult'; did you mean 'TTestSecondServiceProcessorClass'? TTestSecondServiceSecondtestStringResult * result_struct; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ TTestSecondServiceProcessorClass gen-c_glib/t_test_second_service.c:417:35: error: 'T_TEST_TYPE_SECOND_SERVICE_SECONDTEST_STRING_RESULT' undeclared (first use in this function); did you mean 'T_TEST_TYPE_SECOND_SERVICE_SECONDTEST_STRING_ARGS'? result_struct = g_object_new (T_TEST_TYPE_SECOND_SERVICE_SECONDTEST_STRING_RESULT, NULL); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ T_TEST_TYPE_SECOND_SERVICE_SECONDTEST_STRING_ARGS depbase=`echo gen-c_glib/t_test_thrift_test.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/bash ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -I../../lib/cpp/src/thrift -I../../lib/c_glib/src/thrift -I../../lib/c_glib/src -Igen-c_glib -g -Wall -Wextra -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -O2 -MT gen-c_glib/t_test_thrift_test.lo -MD -MP -MF $depbase.Tpo -c -o gen-c_glib/t_test_thrift_test.lo gen-c_glib/t_test_thrift_test.c &&\ mv -f $depbase.Tpo $depbase.Plo depbase=`echo gen-c_glib/t_test_thrift_test_types.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\ /bin/bash ../../libtool --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -I../../lib/cpp/src/thrift -I../../lib/c_glib/src/thrift -I../../lib/c_glib/src -Igen-c_glib -g -Wall -Wextra -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -O2 -MT gen-c_glib/t_test_thrift_test_types.lo -MD -MP -MF $depbase.Tpo -c -o gen-c_glib/t_test_thrift_test_types.lo gen-c_glib/t_test_thrift_test_types.c &&\ mv -f $depbase.Tpo $depbase.Plo Makefile:654: recipe for target 'gen-c_glib/t_test_second_service.lo' failed ``` ``` npm ERR! missing: hawk@3.1.3, required by node-pre-gyp@0.6.39 npm ERR! missing: mkdirp@0.5.1, required by node-pre-gyp@0.6.39 npm ERR! missing: rimraf@2.6.1, required by node-pre-gyp@0.6.39 npm ERR! missing: tar@2.2.1, required by node-pre-gyp@0.6.39 npm ERR! missing: boom@2.10.1, required by hawk@3.1.3 npm ERR! missing: cryptiles@2.0.5, required by hawk@3.1.3 npm ERR! missing: hoek@2.16.3, required by hawk@3.1.3 npm ERR! missing: sntp@1.0.9, required by hawk@3.1.3 npm ERR! missing: hoek@2.16.3, required by boom@2.10.1 npm ERR! missing: boom@2.10.1, required by cryptiles@2.0.5 npm ERR! missing: hoek@2.16.3, required by sntp@1.0.9 npm ERR! missing: minimist@0.0.8, required by mkdirp@0.5.1 npm ERR! missing: console-control-strings@1.1.0, required by npmlog@4.1.0 npm ERR! missing: readable-stream@2.2.9, required by are-we-there-yet@1.1.4 npm ERR! missing: console-control-strings@1.1.0, required by gauge@2.7.4 npm ERR! missing: string-width@1.0.2, required by gauge@2.7.4 npm ERR! missing: strip-ansi@3.0.1, required by gauge@2.7.4 npm ERR! missing: code-point-at@1.1.0, required by string-width@1.0.2 npm ERR! missing: is-fullwidth-code-point@1.0.0, required by string-width@1.0.2 npm ERR! missing: strip-ansi@3.0.1, required by string-width@1.0.2 npm ERR! missing: number-is-nan@1.0.1, required by is-fullwidth-code-point@1.0.0 npm ERR! missing: ansi-regex@2.1.1, required by strip-ansi@3.0.1 npm ERR! missing: string-width@1.0.2, required by wide-align@1.1.2 npm ERR! missing: combined-stream@1.0.5, required by request@2.81.0 npm ERR! missing: hawk@3.1.3, required by request@2.81.0 npm ERR! missing: mime-types@2.1.15, required by request@2.81.0 npm ERR! missing: safe-buffer@5.0.1, required by request@2.81.0 npm ERR! missing: delayed-stream@1.0.0, required by combined-stream@1.0.5 npm ERR! missing: combined-stream@1.0.5, required by form-data@2.1.4 npm ERR! missing: mime-types@2.1.15, required by form-data@2.1.4 npm ERR! missing: extsprintf@1.0.2, required by jsprim@1.4.0 npm ERR! missing: extsprintf@1.0.2, required by verror@1.3.6 npm ERR! missing: mime-db@1.27.0, required by mime-types@2.1.15 npm ERR! missing: safe-buffer@5.0.1, required by tunnel-agent@0.6.0 npm ERR! missing: glob@7.1.2, required by rimraf@2.6.1 npm ERR! missing: fs.realpath@1.0.0, required by glob@7.1.2 npm ERR! missing: inflight@1.0.6, required by glob@7.1.2 npm ERR! missing: inherits@2.0.3, required by glob@7.1.2 npm ERR! missing: minimatch@3.0.4, required by glob@7.1.2 npm ERR! missing: once@1.4.0, required by glob@7.1.2 npm ERR! missing: path-is-absolute@1.0.1, required by glob@7.1.2 npm ERR! missing: once@1.4.0, required by inflight@1.0.6 npm ERR! missing: wrappy@1.0.2, required by inflight@1.0.6 npm ERR! missing: brace-expansion@1.1.7, required by minimatch@3.0.4 npm ERR! missing: balanced-match@0.4.2, required by brace-expansion@1.1.7 npm ERR! missing: concat-map@0.0.1, required by brace-expansion@1.1.7 npm ERR! missing: block-stream@0.0.9, required by tar@2.2.1 npm ERR! missing: fstream@1.0.11, required by tar@2.2.1 npm ERR! missing: inherits@2.0.3, required by tar@2.2.1 npm ERR! missing: inherits@2.0.3, required by block-stream@0.0.9 npm ERR! missing: graceful-fs@4.1.11, required by fstream@1.0.11 npm ERR! missing: inherits@2.0.3, required by fstream@1.0.11 npm ERR! missing: mkdirp@0.5.1, required by fstream@1.0.11 npm ERR! missing: rimraf@2.6.1, required by fstream@1.0.11 npm ERR! missing: fstream@1.0.11, required by tar-pack@3.4.0 npm ERR! missing: once@1.4.0, required by tar-pack@3.4.0 npm ERR! missing: readable-stream@2.2.9, required by tar-pack@3.4.0 npm ERR! missing: rimraf@2.6.1, required by tar-pack@3.4.0 npm ERR! missing: tar@2.2.1, required by tar-pack@3.4.0 npm ERR! missing: fstream@1.0.11, required by fstream-ignore@1.0.5 npm ERR! missing: inherits@2.0.3, required by fstream-ignore@1.0.5 npm ERR! missing: minimatch@3.0.4, required by fstream-ignore@1.0.5 npm ERR! missing: wrappy@1.0.2, required by once@1.4.0 npm ERR! missing: buffer-shims@1.0.0, required by readable-stream@2.2.9 npm ERR! missing: core-util-is@1.0.2, required by readable-stream@2.2.9 npm ERR! missing: inherits@2.0.3, required by readable-stream@2.2.9 npm ERR! missing: isarray@1.0.0, required by readable-stream@2.2.9 npm ERR! missing: process-nextick-args@1.0.7, required by readable-stream@2.2.9 npm ERR! missing: string_decoder@1.0.1, required by readable-stream@2.2.9 npm ERR! missing: util-deprecate@1.0.2, required by readable-stream@2.2.9 npm ERR! missing: safe-buffer@5.0.1, required by string_decoder@1.0.1 Makefile:811: recipe for target 'check-local' failed make[4]: *** [check-local] Error 1 make[4]: Leaving directory '/thrift/src/lib/js' Makefile:686: recipe for target 'check-am' failed make[3]: *** [check-am] Error 2 make[3]: Leaving directory '/thrift/src/lib/js' Makefile:536: recipe for target 'check-recursive' failed make[2]: *** [check-recursive] Error 1 make[2]: Leaving directory '/thrift/src/lib/js' Makefile:580: recipe for target 'check-recursive' failed make[1]: *** [check-recursive] Error 1 make[1]: Leaving directory '/thrift/src/lib' Makefile:662: recipe for target 'check-recursive' failed make: *** [check-recursive] Error 1 ``` Am I missing something? @jeking3 > 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)