In a class derived from Project
the instruction this.getSCMs().add(gitSCM)
causes the compilation error:
    incompatible types: GitSCM cannot be converted to CAP#1
    where CAP#1 is a fresh type-variable:
    CAP#1 extends SCM frpù capture of ? extends SCM

The object gitSCM is being initialized as follows:
    public void addGitRepo(String url, String branch)
    {
        List<UserRemoteConfig> repoList = new ArrayList<UserRemoteConfig>();
        repoList.add(new UserRemoteConfig(url, null, null, null));
        BranchSpec spec = new BranchSpec(branch);
        ArrayList<BranchSpec> specList = new ArrayList<BranchSpec>();
        specList.add(spec);
        ArrayList<GitSCMExtension> scmExtensions = new
ArrayList<GitSCMExtension>();
        scmExtensions.add(new CleanCheckout());
        GitSCM gitSCM = new GitSCM(repoList, specList, false, null, null,
"", scmExtensions);
        getSCMs().add(gitSCM);
    }

GitSCM extends GitSCMBackwardsCompatibility, which extends SCM.
getSCMs returns a collection of SCM.
Even if I cast GitSCM to SCM I get the same error.

Why am I getting this error?

Thanks for your attention,
Ivo

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CAPc4eF9jLig%2B%3DT%2BpTuzVmv_At4XoGTAn6K_FsrUP%3DQ3dBewGfQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
  • [no subject] Ivo Bellin Salarin
    • Re: Jesse Glick
      • Re: Ivo Bellin Salarin

Reply via email to