- return UnionTypeCodec.loader(valueType, (UnionTypeDefinition) subtype.getBaseType()).call();
- } catch (final Exception e) {
- throw new IllegalStateException("Could not construct Union Type Codec");
+ Object identityref = identityrefCodec.deserialize(input);
+ return typeClass.getConstructor(Class.class).newInstance(identityref);
+ } catch (UncheckedExecutionException | ExecutionError e) {
+ // ignore this exception caused by deserialize()
+ } catch (NoSuchMethodException e) {
+ // caused by getContructor(). this case shouldn't happen.
+ throw new IllegalStateException("Could not construct instance", e);
+ } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
+ // ignore this exception caused by newInstance()