+ // The type of 'data' should really be T for compile-time checking. Several call sites do not pass an
+ // Augmentable DataObject type which would result in a ClassCastException at runtime. This is clearly
+ // broken - those call sites need to be analyzed to determine the correct behavior in order for this method
+ // signature to be changed but for now catch ClassCastException.
+ T guessData;
+ try {
+ guessData = (T) data;
+ } catch (ClassCastException e) {
+ LOG.warn("Cannot cast to Augmentable", e);
+ return Optional.empty();
+ }