[jira] [Commented] (THRIFT-4476) Typecasting problem on list items

2018-02-22 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-4476:


Github user ozymaxx commented on the issue:

https://github.com/apache/thrift/pull/1496
  
It appears that there is another compilation problem in Erlang. In the file 
`test/DoubleConstantsTest.thrift`, the double literal `100.1` is compiled 
to `1e+06`. However, Erlang does not accept exponent literals where the number 
before the exponent does not have floating point. This causes an error in some 
tests.


> 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 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 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 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 timeCoefficients = [24, 60, 60, 1000, 1000, 1000]}}
> compiles to
> {{public static final java.util.List timeCoefficients = new 
> java.util.ArrayList();}}
> {{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 timeCoefficients = [24.0, 60.0, 60.0, 1000.0, 1000.0, 
> 1000.0]}}
> compiles to
> {{public static final java.util.List timeCoefficients = new 
> java.util.ArrayList();}}
> {{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 timeCoefficients = [24.1, 60.1, 60.1, 1000.1, 1000.1, 
> 1000.1]}}
> this line compiled to
> {{public static final java.util.List timeCoefficients = new 
> java.util.ArrayList();}}
> {{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)


[GitHub] thrift issue #1496: THRIFT-4476: Typecasting problem on list items (+ low pr...

2018-02-22 Thread ozymaxx
Github user ozymaxx commented on the issue:

https://github.com/apache/thrift/pull/1496
  
It appears that there is another compilation problem in Erlang. In the file 
`test/DoubleConstantsTest.thrift`, the double literal `100.1` is compiled 
to `1e+06`. However, Erlang does not accept exponent literals where the number 
before the exponent does not have floating point. This causes an error in some 
tests.


---


[jira] [Commented] (THRIFT-4498) add phpcs back

2018-02-22 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on THRIFT-4498:


GitHub user RobberPhex opened a pull request:

https://github.com/apache/thrift/pull/1498

THRIFT-4498: add phpcs back

ref 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/RobberPhex/thrift phpcs

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/thrift/pull/1498.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1498


commit 5e60bbbcaba9d4c1ef47fcb99ea8b1ef0bde8fc4
Author: Robert Lu 
Date:   2018-02-22T03:06:07Z

add phpcs back




> add phpcs back
> --
>
> Key: THRIFT-4498
> URL: https://issues.apache.org/jira/browse/THRIFT-4498
> Project: Thrift
>  Issue Type: Improvement
>  Components: PHP - Library
>Reporter: Robert Lu
>Assignee: Robert Lu
>Priority: Minor
>
> Can we use phpcs to check code for PSR-2?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[GitHub] thrift pull request #1498: THRIFT-4498: add phpcs back

2018-02-22 Thread RobberPhex
GitHub user RobberPhex opened a pull request:

https://github.com/apache/thrift/pull/1498

THRIFT-4498: add phpcs back

ref 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/RobberPhex/thrift phpcs

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/thrift/pull/1498.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1498


commit 5e60bbbcaba9d4c1ef47fcb99ea8b1ef0bde8fc4
Author: Robert Lu 
Date:   2018-02-22T03:06:07Z

add phpcs back




---


[jira] [Created] (THRIFT-4498) add phpcs back

2018-02-22 Thread Robert Lu (JIRA)
Robert Lu created THRIFT-4498:
-

 Summary: add phpcs back
 Key: THRIFT-4498
 URL: https://issues.apache.org/jira/browse/THRIFT-4498
 Project: Thrift
  Issue Type: Improvement
  Components: PHP - Library
Reporter: Robert Lu
Assignee: Robert Lu


Can we use phpcs to check code for PSR-2?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)