1

I am working on IBM FileNet P8 Platform 5.2.1 Content Engine unit test application in jython 2.7.

# Verify a directory
def testDirectory(self):
    directoryConfigurationList = [] 
    url = self.serverUrl + "?tenantId=" + self.tenantName  
    connection = Factory.Connection.getConnection(url)
    domain = Factory.Domain.fetchInstance(connection, self.tenantName, None)
    if (domain is not None):
        dc_set = domain._DirectoryConfigurations.iterator()
        while dc_set.hasNext():
            dc = dc_set.next()
            print dc._DisplayName

I am getting the error:

TypeError: Supertypes that share a modified attribute have an MRO conflict[attribute=remove, supertypes=[, 'com.filenet.api.collection.DependentObjectList'>], type=CmIndexPartitionConstraintList]

on line dc_set = domain._DirectoryConfigurations.iterator() and I don't quite now why. Any help on this would be appreciated. The following links to the IBM 5.2.1 knowledge center maybe helpful:

abarisone
  • 3,707
  • 11
  • 35
  • 54
Neo84
  • 197
  • 2
  • 18
  • From what I understand, it seem like Jython is trying to implement its version of lists while this is already a list type defined in DependentObjectList which DirectoryConfigurations is inherited from. I think... – Neo84 Jun 11 '16 at 00:49

1 Answers1

0

The problem is not in your fileNet code, it looks like Jython doesn't expect to ever see a Map that is also Iterable. I presume it has logic that installs iter on each and then gets a conflict. Unfortunately, there's nothing incorrect about a type that implements both Map and Iterable. Jython should defer to Iterable for iter, but it looks like it will need and enhancement in order to do so.

If you check the DependentObjectList Interface specification, you would see in the super type interfaces that its super type interfaces are java.util.Collection, EngineCollection, java.lang.Iterable, java.util.List, java.io.Serializable.

I believe that this was fixed potentially since Jython 2.7b1.

Update:
I have been doing some digging on a code that we developed before in Java, we used the following logic to convert the engine collection to a list-based collection

public static <T> List<T> convertToList(EngineCollection engineCollection) {
    Iterator<T> engineCollectionIterator = engineCollection.iterator();
    List<T> collection = new ArrayList<T>();
    CollectionUtils.addAll(collection , engineCollectionIterator);
    return collection ;
}
WiredCoder
  • 916
  • 1
  • 11
  • 39
  • What blows my mind is that I also see this for List/Collection. "TypeError: Supertypes that share a modified attribute have an MRO conflict[attribute=__contains__, supertypes=[, ], type=...]" We're on 2.7.2b2 though, so I don't think it has been fixed. – Hakanai Feb 03 '20 at 03:46