istinnstudio commented on issue #6146:
URL: https://github.com/apache/netbeans/issues/6146#issuecomment-1619065622
ok. it is more than this, in this test class with lots of cases we can
trigger the issue, 1, for parameters with the same name or same name and a
negative operator in front, 2. with parameters that have a casting, 3.
parameters with functions like 1/2 or num/2, maybe more that this, a screenshot
attached.
```
public class Addition {
public static int addThreeNumbers(int num1, int num2, double num3) {
return (int) (num1 + num2 + num3);
}
public static void main(String[] args) {
int num1 = 2;
float num2 = 5;
int num3 = 8;
int sum = addThreeNumbers(num1, (int) num2, num3);
int sum2 = addThreeNumbers(num1, (int) -2.7, 4);
int sum3 = addThreeNumbers(num1, -3, -4d);
System.out.println("Sum: " + sum);
}
public static void m0(String[] args) {
int num1 = 2;
int num10 = 2;
float num2 = 5;
int num3 = 8;
int num30 = 8;
int sum = addThreeNumbers(num10, (int) num2, num30); // different name
int sum0 = addThreeNumbers(num10, (int) num2, num3);
int sum2 = addThreeNumbers(num1, 2, 4);
int sum3 = addThreeNumbers(num1, -3, -4f); // a valid float number but
...
System.out.println("Sum: " + sum);
}
public static int addThreeNumbers2(int num1, float num2, double num3,
double num4) {
return (int) (num1 + num2 + num3);
}
public static void m2(String[] args) {
int num1 = 2;
int num2 = 5;
int num3 = 8;
double num4 = 8.0;
int sum = addThreeNumbers2(num1, num2, -num3, -1 / 2); // function
int sum0 = addThreeNumbers2(num1, num2, num3, -0.5); // foating point
int sum2 = addThreeNumbers2(num1, 2, 4, 0.5d);
int sum3 = addThreeNumbers2(num1, -3, 4d, num4); // sane name
System.out.println("Sum: " + sum);
}
}
```

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists