org.sonar.l10n.java.rules.squid.S2133.html Maven / Gradle / Ivy
The newest version!
Creating an object for the sole purpose of calling getClass
on it is a waste of memory and cycles. Instead, simply use the class' .class
property.
Noncompliant Code Example
MyObject myOb = new MyObject(); // Noncompliant
Class c = myOb.getClass();
Compliant Solution
Class c = MyObject.class;
© 2015 - 2025 Weber Informatics LLC | Privacy Policy