GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [java] LawOfDemeter: False positive with indexed array access · Issue #2181 · pmd/pmd

[java] LawOfDemeter: False positive with indexed array access #2181

New issue
Copy link
New issue
Copy link
Closed
#2645
Closed
[java] LawOfDemeter: False positive with indexed array access#2181
#2645
Copy link
Labels
a:false-positivePMD flags a piece of code that is not problematic
Milestone
6.26.0

Description

@linusjf
linusjf
opened on Dec 22, 2019
Issue body actions

#2160 (comment)
Affects PMD Version:
6.20.0

Rule:
LawOfDemeter

Description:
Index of array is treated as a method chain call by this rule. Data structures must be exempt from this rule especially indexed array access.

Code Sample demonstrating the issue:

public final class Util {  
  
  public static boolean check(String passwd,
                              String hashed) {
    try {
      final String[] parts = hashed.split("\\$");

      if (parts.length != 5 || !parts[1].equals("s0")) {
        throw new IllegalArgumentException(
            "Invalid hashed value");
      }
    }
  }

  
}

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]

Activity

  1. adangel
    changed the title [-][Java] False positive: LawOfDemeter marks indexed array access as method call. [/-] [+][java] False positive: LawOfDemeter marks indexed array access as method call[/+] on Jun 7, 2020
  2. adangel
    added
    a:false-positivePMD flags a piece of code that is not problematic
    on Jun 7, 2020
  3. adangel
    changed the title [-][java] False positive: LawOfDemeter marks indexed array access as method call[/-] [+][java] LawOfDemeter: False positive with indexed array access[/+] on Jul 16, 2020
  4. adangel
    added a commit that references this issue on Jul 16, 2020

    [java] LawOfDemeter: False positive with indexed array access

    This issue will close once commit 80103ab is merged into the 'main' branch.
    80103ab
  5. adangel
    added this to the 6.26.0 milestone on Jul 16, 2020
  6. oowekyala
    closed this as completedin 80103abon Jul 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type

    Projects

    No projects

      Milestone

      • 6.26.0

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.