You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2017/06/29 21:30:53 UTC

svn commit: r1800329 - /uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java

Author: schor
Date: Thu Jun 29 21:30:53 2017
New Revision: 1800329

URL: http://svn.apache.org/viewvc?rev=1800329&view=rev
Log:
no Jira, support better approach to highestDefiningType, allowing it to be final.

Modified:
    uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java

Modified: uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java
URL: http://svn.apache.org/viewvc/uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java?rev=1800329&r1=1800328&r2=1800329&view=diff
==============================================================================
--- uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java (original)
+++ uima/uv3/uimaj-v3/trunk/uimaj-core/src/main/java/org/apache/uima/cas/impl/TypeSystemImpl.java Thu Jun 29 21:30:53 2017
@@ -893,8 +893,16 @@ public class TypeSystemImpl implements T
     FeatureImpl existingFeature = (FeatureImpl) getFeature(domainType, shortFeatName);
     if (existingFeature != null) {
       ((TypeImpl)domainType).checkExistingFeatureCompatible(existingFeature, rangeType);
-      if (subsumes(domainType, existingFeature.getHighestDefiningType())) {
-        existingFeature.setHighestDefiningType(domainType);
+      TypeImpl highestDefiningType = existingFeature.getHighestDefiningType();
+      if (highestDefiningType != domainType && subsumes(domainType, highestDefiningType)) {
+        // never happens in existing test cases  6/2017 schor
+        Misc.internalError();  // logically can never happen
+        // Note: The other case, where a type and subtype are defined, and then 
+        // features are added in any order, in particular, a 
+        //   supertype feature is added after a subtype feature of the same name/range has been added,
+        // causes the subtype's feature to be "deleted" and "inherited" instead.
+        //   code: checkAndAdjustFeatureInSubtypes in TypeImpl
+//        existingFeature.setHighestDefiningType(domainType);
       }
       return existingFeature;
     }
@@ -907,6 +915,9 @@ public class TypeSystemImpl implements T
     if (!TypeSystemUtils.isIdentifier(shortFeatName)) {
       throw new CASAdminException(CASAdminException.BAD_FEATURE_SYNTAX, shortFeatName);
     }   
+    
+    // at end of FeatureImpl constructor, TypeImpl.addFeature is called
+    //   which does checks, calls checkAndAdjustFeatureInSubtypes, etc.
     return new FeatureImpl(
         (TypeImpl) domainType, 
         shortFeatName,