A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/2125 below:

False positive when variable is updated in conditional loop · Issue #2125 · pmd/pmd · GitHub

Affects PMD Version:
6.18.0, 6.19.0

Rule:
ImmutableField

Description:
If field is updated in conditional loop, this rule still identifies the field as a possible final or immutable candidate.

Code Sample demonstrating the issue:

package pmdtests;

import java.util.Random;
import java.math.BigInteger;

public class TestFinal {
  private BigInteger e;

  public TestFinal() {
    Random random = new Random();
    e = BigInteger.probablePrime(Integer.MAX_VALUE / 2, random);

    while (random.nextBoolean()) 
      e = e.add(BigInteger.ONE);
  }

}

Running PMD through: *[CLI | Ant **

This is sample code. Don't expect it to do anything useful.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4