dkpro / dkpro-tc

UIMA-based text classification framework built on top of DKPro Core and DKPro Lab.
https://dkpro.github.io/dkpro-tc/
Other
34 stars 19 forks source link

SaveModel: Serialization of features does not support inner classes #467

Closed Horsmann closed 6 years ago

Horsmann commented 6 years ago

When storing classes during model serialization, the $1 class file with inner classes is not considered if its there. Features using inner classes thus break.

Horsmann commented 6 years ago

@reckart Is there a way to ask a class object for the number of its anonymous classes? At the moment I would try to brute force and simply test if a java class with a $[0-9]+ exists or not in the range of 1 to 100 or so. I get the inner classes by calling getDeclaredClasses() but I haven't figured out how to find the number of anonymous classes?

reckart commented 6 years ago

You could use a Spring PathMatchingResourcePatternResolver to do a search based on the classname + a wildcard.

reckart commented 6 years ago

Well... isn't the number just the position of the class in the array returned by getDeclaredClasses()?

Horsmann commented 6 years ago

getDeclaredClasses() returns the inner classes that are explicitly defined. Anonymous (inner) classes a la

Collections.sort(somelist, new Comparator() {...})

are not covered. I will give PathMatchingResourcePatternResolver a try, thx.