GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — [java] UseDiamondOperator: False positive with Guice TypeLiteral · Issue #6239 · pmd/pmd Closed Labels a:false-positivePMD flags a piece of code that is not problematic Milestone DescriptionAffects PMD Version: 7.18.0 Rule: UseDiamondOperator Description: Guice's TypeLiteral exists to capture type information. It forces you to create a subclass and thereby captures the generic type information for use at runtime. Removal of the type information by using the diamond operator changes the behaviour of the code, so PMD should not generate a warning and a suggestion to remove the type information and use the diamond operator. Code Sample demonstrating the issue: import com.google.inject.TypeLiteral; protected Map<Key<?>, Object> computeBindings() { return Map.of( Key.get(new TypeLiteral<Optional<Long>>() {}, BusinessId.class), Optional.of(businessIdProvider.get())); } Expected outcome: PMD should allow the TypeLiteral to have the type information without generating a warning. Running PMD through: Other: PMD plugin in IntelliJ Activity
MetadataMetadataAssigneesLabelsa:false-positivePMD flags a piece of code that is not problematic TypeProjectsMilestoneRelationshipsDevelopmentIssue 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. |