Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: s/equals/hashCode

...

Code Block
bgColor#ccccff
final class LicenseType {
  // ...
} 

Noncompliant Code Example

...

This noncompliant code example consists of a Widget class and a LayoutManager class containing a set of widgets.

...

An attacker can extend the Widget class as a Navigator widget and override the equalsthe hashCode() method.

Code Block
public class Navigator extends Widget {
    public Navigator(int noOfComponents) {
        super(noOfComponents);
    }
    @Override
    public int hashCode() {
        int res = 31;
        res = res * 17;
        return res;
    }
}

...