pmd / pmd/pmd

[scala] CPD terminates with an exception when a small value is set for --minimum-tokens

Open
#2,153 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

a:bug
Dominant language
Java
Stars
5.5k
Forks
1.6k
Avg merge
1d 19h
Merged PRs (30d)
54

Description

Affects PMD Version:
6.18.0, 6.20.0

Rule:

Description:
When targeting a scala file, if a small value is set for --minimum-tokens, CPD will exit with an exception.

Code Sample demonstrating the issue:

object Foo {
    void foo() {
        String[] array = null;
        array = {"abc", "def", "ghi"};
    }
}

I prepared another same file.

Running PMD through: [CLI]

pmd-bin-6.18.0/bin/run.sh cpd --minimum-tokens 20 --language scala --files scala/

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the provided run.sh cpd command, --minimum-tokens 20, --language scala, and the scala/ files. Inspect the CPD Scala processing path after reproducing the exception. Done means the same input completes without an exception when a small minimum-token value is used.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.