A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/5190 below:

[java] NPE in type inference · Issue #5190 · pmd/pmd · GitHub

Affects PMD Version:
7.5.0 (this didn't happen with version 7.4.0 and under)

Rule:
No rules as its failing to parse the code

Description:

 [INFO] --- pmd:3.25.0:pmd (pmd) @ uk-multi-policy-group-service ---
17:53:18   [INFO] PMD version: 7.5.0
17:53:27   [ERROR] PMD processing errors:
17:53:27   [ERROR] /home/teamcity/work/402506fd6a30bd90/uk-multi-policy-group-service/src/test/java/com/marshmallow/uk_multi_policy_group/persistence/policy_group_numbers/PolicyGroupNumberGeneratorStoreTest.java: ContextedRuntimeException: java.lang.NullPointerException: Cannot invoke "net.sourceforge.pmd.lang.java.types.JTypeMirror.equals(Object)" because "asSuperOfS" is null
17:53:27   Exception Context:
17:53:27     [1:Resolving type of=!debug only! [MethodCall:174:16]Optional.ofNullable(
17:53:27               Iterables.getOnlyElement(queryForKey(key), null)
17:53:27           )]
17:53:27     [2:Location=!debug only! /home/teamcity/work/402506fd6a30bd90/uk-multi-policy-group-service/src/test/java/com/marshmallow/uk_multi_policy_group/persistence/policy_group_numbers/PolicyGroupNumberGeneratorStoreTest.java:174:16]
17:53:27   ---------------------------------

Code Sample demonstrating the issue:

    private Optional<Map<String, AttributeValue>> loadForKey(final String key) {
        return Optional.ofNullable(
            Iterables.getOnlyElement(queryForKey(key), null)
        );
    }

Expected outcome:
PMD reports a violation at line ..., but that's wrong. That's a false positive.

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
Maven (v3.5.0)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4