New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[java] False positive in ConsecutiveLiteralAppends #1325

rdicroce opened this Issue Aug 30, 2018 · 0 comments


None yet
3 participants

rdicroce commented Aug 30, 2018

Affects PMD Version:


ConsecutiveLiteralAppends complains about the below snippet (marker at the first line) even though it shouldn't. Presumably, it is not taking into account the fact that the lambda is calling the builder.

Code Sample demonstrating the issue:

			StringBuilder builder = new StringBuilder("[");
			nodes.forEach((k, v) -> builder
					.append(" = ")
					.append(", "));
			int length = builder.length();
			if (length > 1) {
				builder.delete(length - 2, length);
			return builder.toString();

Running PMD through: Eclipse

@adangel adangel self-assigned this Sep 7, 2018

@adangel adangel added this to the 6.8.0 milestone Sep 7, 2018

adangel added a commit to adangel/pmd that referenced this issue Sep 7, 2018

@adangel adangel added the has:pr label Sep 7, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment