pmd / pmd/pmd

[java] New rule for simplifiable system property access

Open
#2,132 7 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Rule name: TBD

Add a rule to convert calls to System.getProperty("line.separator") to use System.lineSeparator() since that is the reason the method was added See JDK-6900043.

Originally posted by @Sthornton12 in https://github.com/pmd/pmd/issues/1993#issuecomment-558408123

See also File.separator/ File.separatorChar vs System.getProperty("file.separator"), although those don't have an @since

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 reviewing existing Java rules that simplify system property access and their tests. Confirm whether the scope is limited to System.getProperty("line.separator") or also includes the File.separator variants, and establish the rule name. Done means the selected access patterns are converted to their standard alternatives with tests covering the behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.