== 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

[source,java,diff-id=1,diff-type=noncompliant]
----
MyObject myOb = new MyObject();  // Noncompliant
Class c = myOb.getClass();
----


=== Compliant solution

[source,java,diff-id=1,diff-type=compliant]
----
Class c = MyObject.class;
----



ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

Remove this object instantiation and use "xxx.class" instead.


'''
== Comments And Links
(visible only on this page)

=== on 10 Oct 2014, 11:40:44 Freddy Mallet wrote:
Sounds good to me !

endif::env-github,rspecator-view[]
