False positive: SingularField and lambda-expression
A source code analyzer
Brought to you by:
adangel,
juansotuyo
package com.foo; import java.util.Optional; public enum Supplier { bar("Bar"), private final String supplierName; private Supplier(String supplierName) { this.supplierName = supplierName; } public static String getSupplierNameIfPresent(String supplier) { return Optional.ofNullable(supplier).map(foo -> valueOf(supplier).supplierName).orElse(""); } }
violates SingularField:
"Perhaps 'supplierName' could be replaced by a local variable."
Last edit: PJ Walstroem 2015-01-13
Will be fixed with the next version.