You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@uima.apache.org by Frank Enders <en...@averbis.de> on 2011/03/23 14:36:38 UTC

JCasGen omitting fully-qualified class name?

Hi together,

in a TypeSystem we have a type "org.company.types.Annotation".
Now we have another type "org.company.types.Sentence" which uses
"org.company.types.Annotation" as its supertypeName.
When we generate the corresponding Java classes using JCasGen the
fully-qualified name seems to be omitted:
Sentence.java extends "Annotation" which gets translated to
"uima.tcas.Annotation" instead of "org.company.types.Annotation".

Is this a bug in JCasGen or is it a desired behaviour?

Thanks and all the best,
Frank

Re: JCasGen omitting fully-qualified class name?

Posted by Marshall Schor <ms...@schor.com>.
ok, this is a case we didn't think of - one where the no-qualifier version works
but is overridden by another import, caused by another feature referencing the
other version of this.

For now, a workaround is to name your org.company.types.Annotation to something
other than ...Annotation.

-Marshall

On 3/23/2011 11:44 AM, Frank Enders wrote:
> Marshall, thanks for your quick response.
>
>> Can you provide more details on how you are seeing that Annotation in
> this case
>> is being translated to uima.tcas.Annotation, in your setup?
> org.apache.uima.jcas.tcas.Annotation gets imported within Sentence.java:
>
> "import org.apache.uima.jcas.tcas.Annotation;"
>
> Sentence has a complex feature with rangeTypeName uima.tcas.Annotation
> which probably leads to that import.
>
> All occurences of "Annotation" in Sentence.java are without the package
> name. Regardless wheter they are declared as
> org.company.types.Annotation or uima.tcas.Annotation within the
> typesystem. So in all cases the imported Annotation
> org.apache.uima.jcas.tcas.Annotation is used  (as shown on hover in
> eclipse).
>
> Best regards, Frank
>
>

Re: JCasGen omitting fully-qualified class name?

Posted by Frank Enders <en...@averbis.de>.
Marshall, thanks for your quick response.

> Can you provide more details on how you are seeing that Annotation in
this case
> is being translated to uima.tcas.Annotation, in your setup?

org.apache.uima.jcas.tcas.Annotation gets imported within Sentence.java:

"import org.apache.uima.jcas.tcas.Annotation;"

Sentence has a complex feature with rangeTypeName uima.tcas.Annotation
which probably leads to that import.

All occurences of "Annotation" in Sentence.java are without the package
name. Regardless wheter they are declared as
org.company.types.Annotation or uima.tcas.Annotation within the
typesystem. So in all cases the imported Annotation
org.apache.uima.jcas.tcas.Annotation is used  (as shown on hover in
eclipse).

Best regards, Frank

Re: JCasGen omitting fully-qualified class name?

Posted by Marshall Schor <ms...@schor.com>.
When I did this, I saw that

1) JCasGen generates the Classes into the same "package": org.company.types

2) This package has the classes:
    Sentence.java
    Sentence_type.java
    Annotation.java
    Annotation_type.java

3) The Sentence type extends "Annotation", which is *not* imported.  This means
that Java looks into the same package to resolve this.  In Eclipse, when I hover
over Annotation in the Sentence type, it shows org.company.types.Annotation.

Can you provide more details on how you are seeing that Annotation in this case
is being translated to uima.tcas.Annotation, in your setup?

-Marshall



On 3/23/2011 9:36 AM, Frank Enders wrote:
> Hi together,
>
> in a TypeSystem we have a type "org.company.types.Annotation".
> Now we have another type "org.company.types.Sentence" which uses
> "org.company.types.Annotation" as its supertypeName.
> When we generate the corresponding Java classes using JCasGen the
> fully-qualified name seems to be omitted:
> Sentence.java extends "Annotation" which gets translated to
> "uima.tcas.Annotation" instead of "org.company.types.Annotation".
>
> Is this a bug in JCasGen or is it a desired behaviour?
>
> Thanks and all the best,
> Frank
>
>