title: java reflection :Avoid warning unchecked call to getConstructor(Class<?>...) as a member of the raw type Class
body: <p>I have read this post</p>
  
  <p><a href="https://stackoverflow.com/questions/2238818/java-unchecked-call-to-getconstructorjava-lang-class">java: unchecked call to getConstructor(java.lang.Class&lt;?&gt;...)</a></p>
  
  <pre><code>for (Map.Entry&lt;String, Class&gt; entry : connectionRepository.entrySet()) {
              if (/*someconditionhere*/) {
                  try {
                      cwsConnection = (CWSConnection)entry.getValue().getConstructor().newInstance();
                      break;
                  } catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
                      logger.error("Could not Create instance of CWSConnection for site version:\"{}\" Error:\"{}\"", entry.getKey(), e.getMessage(), e);
                  } 
              }
          }
  </code></pre>
  
  <p>While compiling this piece of code I am getting a warning </p>
  
  <blockquote>
    <p>warning: [unchecked] unchecked call to getConstructor(Class...) as a member of the raw type Class</p>
  </blockquote>
  
  <p>I just wanted to get the default constructor of CWSConnection, therefore, I should not pass any parameters to getConstructor(Class...) method.
  Is there any better approach to get the default constructor(The one without arguments)</p>
  
  <p>(I know <code>@SupressWarning</code> annotation will suppress this warning.)</p>