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
it.
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(
CASRuntimeException.JCAS_UNSUPPORTED_OP_NOT_TCAS);
casEx.addArgument("getSofa()");
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.
-Adam
|