title: Raw use of parameterized class Java (implementing interface with generic param type)
body: <p>I'm getting the warning &quot;Raw use of parameterized class 'MapperService' and &quot;Unchecked call to 'mapSourceToBehandlerKrav(T)' as a member of raw type .. from IntelliJ. I'm not really grasping the concepts of generics in general, trying to figure it out. But some explanation and solution to these warnings might be helpful</p>
  <p>Interface:</p>
  <pre><code>public interface MapperService&lt;T&gt; {
      Behandlerkrav mapSourceToBehandlerkrav(T sourceInput) throws DataSourceException, MapperException;
  }
  </code></pre>
  <p>Implementing class:</p>
  <pre><code>public class XMLToDomainMapper implements MapperService {
  
      public Behandlerkrav mapSourceToBehandlerkrav(Object input) throws DataSourceException, MapperException {
  
          if (!(input instanceof File)) {
              throw new DataSourceException(
                  &quot;Input er av ugyldig type: &quot; + input.getClass() + &quot; | tillat type = &quot; + &quot;File&quot;);
          }
  
          // More stuff
      }
  
  </code></pre>
  <p>Calling of implemting class (where the warnings occur):</p>
  <pre><code>public class InnrapporteringServiceImpl implements InnrapporteringService {
      MapperService kildesystemInputMapper; &lt;-- IntelliJ WARNING HERE
  
      public InnrapporteringServiceImpl(XMLToDomainMapper mapper) {
          this.kildesystemInputMapper = mapper;
      }
  
      @ServiceActivator(inputChannel = &quot;sftChannel&quot;)
      public void init(Message&lt;File&gt; message) {
          // call mapper service
          // call persistence service
          // call reporting service
          var timestamp = message.getHeaders().getTimestamp();
  
          Behandlerkrav behandlerkrav = kildesystemInputMapper.mapSourceToBehandlerkrav(message.getPayload()); &lt;-- IntelliJ WARNING here
      }
  }
  </code></pre>