All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sonar.l10n.java.rules.java.S2133.html Maven / Gradle / Ivy

There is a newer version: 8.6.0.37351
Show newest version

Why is this an issue?

Creating an object for the sole purpose of calling getClass on it is a waste of memory and cycles. Instead, simply use the class’s .class property.

Noncompliant code example

MyObject myOb = new MyObject();  // Noncompliant
Class c = myOb.getClass();

Compliant solution

Class c = MyObject.class;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy