push ex4 and ex5

This commit is contained in:
tuanvu
2025-12-12 12:58:32 +01:00
parent 98ecd56e6b
commit 749bb02e57
9 changed files with 91 additions and 79 deletions

View File

@@ -4,11 +4,13 @@ Pick a Java project from Github (see the [instructions](../sujet.md) for suggest
## Answer
We clone the project `commons-math`
Nous avons cloné le projet `commons-math`
https://github.com/apache/commons-math
We found a problem that it's not worth to change
On a trouvé un problème quil ne vaut pas la peine de changer :
`./commons-math/commons-math-core/src/main/java/org/apache/commons/math4/core/jdkmath/AccurateMath.java:396: UselessParentheses: Useless parentheses around `0.5 * t`.`
And here is the code that PMD a indiqué:
Et voici le code que PMD a indiqué:
```
if (x >= LOG_MAX_VALUE) {
// Avoid overflow (MATH-905).
@@ -16,9 +18,9 @@ And here is the code that PMD a indiqué:
return (0.5 * t) * t;
```
As we can see the parentheses didn't cause any harm here but it is a true positive
Comme on peut le voir, les parenthèses ne causent aucun problème ici, mais cest un vrai positif.
For a false positive, we found this one:
Pour un faux positif, nous avons trouvé celui-ci:
`./commons-math/commons-math-legacy-core/src/test/java/org/apache/commons/math4/legacy/core/IntegerSequenceTest.java:255: UnusedLocalVariable: Avoid unused local variables such as 'inc'.`
```
@@ -33,4 +35,6 @@ For a false positive, we found this one:
```
Because the purpose of the test is to trigger the bug when create object.
Parce que le but du test est de déclencher le bug lors de la création de lobjet.