Should a “static final Logger” be declared in UPPER-CASE?

In Java, static final variables are constants and the convention is that they should be in upper-case. However, I have seen that most people declare loggers in lower-case which comes up as a violation in PMD. e.g: private static final Logger logger = Logger.getLogger(MyClass.class); Just search googleor SO for “static final logger” and you will … Read more

ReSharper warns: “Static field in generic type”

public class EnumRouteConstraint<T> : IRouteConstraint where T : struct { private static readonly Lazy<HashSet<string>> _enumNames; // <– static EnumRouteConstraint() { if (!typeof(T).IsEnum) { throw new ArgumentException( Resources.Error.EnumRouteConstraint.FormatWith(typeof(T).FullName)); } string[] names = Enum.GetNames(typeof(T)); _enumNames = new Lazy<HashSet<string>>(() => new HashSet<string> ( names.Select(name => name), StringComparer.InvariantCultureIgnoreCase )); } public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary … Read more