FHIR Chat · Interesting IDE warning on getResourceType() but compiles... · hapi

Stream: hapi

Topic: Interesting IDE warning on getResourceType() but compiles...


view this post on Zulip Gary Teichrow (Jun 16 2017 at 16:01):

I see an interesting warning in my IDE (NetBeans) on any class implementing IResourceProvider. The project builds fine, but the warning seems acurrate. Curious if anyone else has seen this? Dstu2 -> Dstu3 issue?

IResourceProvider does seem to want getResourceType to return Resources that extend IBaseResource. But, _I think_, DSTU3 entities now extend DomainResource -> Resource -> BaseResource -> Base so therefore no IBaseResource.

    Class<? extends IBaseResource> getResourceType();

Here is the error indicated by the IDE:

getResourceType() in PatientResourceProvider cannot implement getResourceType() in IResourceProvider
return type Class<Patient> is not compatible with Class<? extends IBaseResource>

And the prototypical resource provider code for a Patient Resource:

import org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender;
import org.hl7.fhir.dstu3.model.Identifier.IdentifierUse;
import org.hl7.fhir.dstu3.model.Patient;

public class PatientResourceProvider implements IResourceProvider {

    @Override
    public Class<Patient> getResourceType() {
        return Patient.class;
    }

view this post on Zulip Gary Teichrow (Jun 22 2017 at 01:29):

Maven corruption. Cleared out local repo in .m2 and seemed to clear it up. Interesting that NB was looking at older stuff and showing the warnings but the build worked just fine. Oh well :)


Last updated: Apr 12 2022 at 19:14 UTC