Jörn Kottmann wrote:
> Is that the correct generification?
> Class<? extends AbstractCas> getRequiredCasInterface();
>
> Implementing classes can then specify the concrete return
> type.
>
> For example:
> Class<JCas> JCasAnnotator_ImplBase.getRequiredCasInterface()
> Class<CAS> CasAnnotator_ImplBase.getRequiredCasInterface()
I tried:
  public static void tgrci(AnalysisComponent ac) {
    Class<JCas> x = ac.getRequiredCasInterface();
  }

but it doesn't work, gives error:
// error, cannot convert from Class<capture#4-of ? extends AbstractCas>
to Class<JCas>

This is with the interface AnalysisComponent defining
getRequiredCasInterface as:
 Class<? extends AbstractCas> getRequiredCasInterface();

This works:
  public static void tgrci(AnalysisComponent ac) {
    Class<? extends AbstractCas> x = ac.getRequiredCasInterface();
  }

and this works too:
  public static void tgrci(AnalysisComponent ac) {
    Class<JCas> x = ((JCasAnnotator_ImplBase)ac).getRequiredCasInterface();
  }

So, I think we have the correct generification in the interface
AnalysisComponent, of return <? extends AbstractCAS>.

-Marshall.

> Jörn
>
>
>

Reply via email to