Why this matters
Creating an object solely to call `getClass()` wastes memory and CPU cycles. Use `ClassName.class` instead.
Ensure that objects are not created solely for calling `getClass()`. Use `ClassName.class` instead.
Creating an object solely to call `getClass()` wastes memory and CPU cycles. Use `ClassName.class` instead.
Side-by-side examples engineers can pattern-match during review.
MyObject myOb = new MyObject(); // Noncompliant
Class c = myOb.getClass();Class c = MyObject.class;MyObject myOb = new MyObject(); // Noncompliant
Class c = myOb.getClass();Class c = MyObject.class;From the same buckets as this rule.
All static JS/CSS/font/image files MUST use content-hashed filenames (e.g., app.9c1a7b.js) and be served with "Cache-Control: public, max-age=31536000, immutable". HTML and other non-fingerprinted documents MUST be served with "Cache-Control: no-cache" (or equivalent) to enable conditional revalidation.