This is a good catch; I think properly the loop needs a better castt:

for (FeatureStructure attrFS : (Iterable<? extends FeatureStructure>) 
aElement.getAttributes()) {
...
}

I don't think it is a runtime error but a bug on the DKPro side, the FSArray 
contract is FSArray<T extends FeatureStructure> implements Iterable<T>

Thanks!
Hai-Son


On 8/1/19, 3:09 AM, "Richard Eckart de Castilho" <[email protected]> wrote:

    Caution: This email came from outside Kaiser Permanente. Do not open 
attachments or click on links if you do not recognize the sender.

    ______________________________________________________________________
    dist artifact signature check: ok
    README spot check: ok
    RELEASE_NOTES spot check: ok
    API report spot check: ok
    Built from sources: ok

    Building DKPro Core against the RC, I get a compiler error:

    With v3.0.2, JCasGen generated this code:

    ```
    public FSArray getAttributes() { return 
(FSArray)(_getFeatureValueNc(wrapGetIntCatchException(_FH_attributes)));}
    ```

    and DKPro Core could/had to then cast the unspecific FSArray to 
Iterable<FeatureStructure>:

    ```
      for (FeatureStructure attrFS : (Iterable<FeatureStructure>) 
aElement.getAttributes()) {
        ...
      }
    ```

    But with v3.0.3, JCasGen was changed to return specific types where 
possible instead of an unspecified generic:

    ```
      public FSArray<XmlAttribute> getAttributes() {
        return 
(FSArray<XmlAttribute>)(_getFeatureValueNc(wrapGetIntCatchException(_FH_attributes)));
      }
    ```

    This now causes the previously working type cast in DKPro Core to become a 
compiler error:

    ```
      [ERROR] 
/Users/bluefire/git/dkpro-core/dkpro-core-api-xml-asl/src/main/java/org/dkpro/core/api/xml/https://urldefense.proofpoint.com/v2/url?u=http-3A__Cas2SaxEvents.java&d=DwIFAg&c=V-WiB07a9ZG9AUogGPqIYBXfVnjryhYX1W_SjITv1Oo&r=A33kge5NheqiOmZbXpb29M79KHMRFZoJygn2vT_Z8Ns&m=v39d2r5gsIsm2C22ZcwQ1ACmaU14gdexcFo1Heh4Txc&s=Zj9BDgFRlvWKW8q8CUqK_s2j4vOrcRL2b2ytf297qgk&e=
 :[67,95] incompatible types: 
org.apache.uima.jcas.cas.FSArray<org.dkpro.core.api.xml.type.XmlAttribute> 
cannot be converted to java.lang.Iterable<org.apache.uima.cas.FeatureStructure>
    ```

    I'd tend to say that the change to JCasGen is not a source-compatible 
change and would warrant changing the version number to 3.1.0.

    WDYT?

    Cheers,

    -- Richard



NOTICE TO RECIPIENT:  If you are not the intended recipient of this e-mail, you 
are prohibited from sharing, copying, or otherwise using or disclosing its 
contents.  If you have received this e-mail in error, please notify the sender 
immediately by reply e-mail and permanently delete this e-mail and any 
attachments without reading, forwarding or saving them.  Thank you.

Reply via email to