There's a general "rule" in Java that you should not store a ref to a partially-initialized instance in another object, because it allows another thread to potentially access a Java Object that is not yet fully initialized.

The use of JCasRegistry might be doing this. It stores into an externally-observable array (observable on other threads) a ref to the class Foo, before Foo is fully initialized. It does this using the code:

   /**
* Each cover class when loaded sets an index. Used in the JCas typeArray to go from the cover * class or class instance to the corresponding instance of the _Type class
  */
   public final static int typeIndexID = JCasRegistry.register(TOP.class);

I don't think this is an actual issue in our case, because I think this value is only used to obtain a ref to the class for the purpose of getting the class "name" to use in an error message. Other opinions?

-Marshall

Reply via email to