uima-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Lally" <ala...@alum.rpi.edu>
Subject Compiler warnings worth looking into in uimaj-core
Date Wed, 22 Nov 2006 16:06:00 GMT
When cleaning out warnings I did find a couple of things worth
exploring further:

1) LinearTypeOrderBuilderImpl: a couple of parameters hide fields.
This could be just a case where the parameter should be renamed, but I
wasn't entirely sure if some other cleanup was warranted, so I left

2) JCas: Many unnecessary typecasts to TCAS that no longer make sense
due to the refactoring that made TCAS unnecessary.  For example:

  public Sofa getSofa() {
    if (casImpl instanceof TCAS)
      return (Sofa) ((TCAS) casImpl).getSofa();
    CASRuntimeException casEx = new CASRuntimeException(
    throw casEx;

There's no need for these typecasts now since CASImpl implements TCAS
and implements getSofa() and the other methods previously defined only
on TCAS.

So this method could just be reduced to:
  public Sofa getSofa() {
      return (Sofa) casImpl.getSofa();

However, this is in many cases a difference in behavior.  If called on
a base CAS, getSofa() will return null rather than throwing a
CASRuntimeException as was previously the case.  Still, it's best to
be consistent between CAS and JCas as to what happens when methods
like getSofa() are called on a base CAS.


View raw message