code: protected <T extends MavenProjectDescriptor> T resolveProject(MavenProject project, Class<T> expectedType, ScannerContext scannerContext) {
          Store store = scannerContext.getStore();
          String id = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
          MavenProjectDescriptor projectDescriptor = store.find(MavenProjectDescriptor.class, id);
          if (projectDescriptor == null) {
              projectDescriptor = store.create(expectedType, id);
              projectDescriptor.setName(project.getName());
              projectDescriptor.setGroupId(project.getGroupId());
              projectDescriptor.setArtifactId(project.getArtifactId());
              projectDescriptor.setVersion(project.getVersion());
              projectDescriptor.setPackaging(project.getPackaging());
              projectDescriptor.setFullQualifiedName(id);
          } else if (!expectedType.isAssignableFrom(projectDescriptor.getClass())) {
              projectDescriptor = store.addDescriptorType(projectDescriptor, expectedType);
          }
          return expectedType.cast(projectDescriptor);
      }
docs: Resolves a maven project.
  
  @param project
  The project
  @param expectedType
  The expected descriptor type.
  @param scannerContext
  The scanner context.
  @param <T>
  The expected descriptor type.
  @return The maven project descriptor.