[
https://issues.apache.org/jira/browse/UIMA-2147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13605332#comment-13605332
]
Richard Eckart de Castilho commented on UIMA-2147:
--------------------------------------------------
Java annotations can only make use of static final values, in particular static
values that do not require any non-inlined logic. E.g. it can use a static
final String, even a concatenation of Strings, but not the string returned by a
.getClass().getName() method. Unfortunately, the following does not compile
with the message "The value for annotation attribute TypeCapability.inputs must
be a constant expression":
{code}
@TypeCapability(
inputs = {Token.class.getName()})
{code}
What would be needed as constants of the feature name strings generated into
places like this:
{code}
jcas.getRequiredFeatureDE(casType, FEATURE_NAME,
"de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Stem", featOkTst)
{code}
> Generate static fields for type names and feature names in JCas wrappers
> ------------------------------------------------------------------------
>
> Key: UIMA-2147
> URL: https://issues.apache.org/jira/browse/UIMA-2147
> Project: UIMA
> Issue Type: Improvement
> Components: Core Java Framework
> Affects Versions: 2.3.1
> Reporter: Richard Eckart de Castilho
>
> It would be convient if the JCas wrapper generator would create static final
> String fields for feature names and for the type name, e.g.
> public static final String TYPE_NAME = "my.jcastypes.Type";
> public static final String FEAT_BEGIN = "begin";
> This would allow cleaner programming with JCas wrappers in cases where the
> names are required. In particular it would allow to detect certain errors at
> compile-time and facilitate refactoring.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira