TypeDescriptor<?> restrictionT = getInitialRestriction.restrictionT(); getInitialRestrictionErrors.checkArgument( restrictionT.equals(newTracker.restrictionT()), "Uses restriction type %s, but @%s method %s uses restriction type %s", formatType(restrictionT), DoFn.NewTracker.class.getSimpleName(), format(newTracker.targetMethod()), formatType(newTracker.restrictionT()));
@VisibleForTesting static DoFnSignature.NewTrackerMethod analyzeNewTrackerMethod( ErrorReporter errors, TypeDescriptor<? extends DoFn> fnT, Method m) { // Method is of the form: // @NewTracker // TrackerT newTracker(RestrictionT restriction); Type[] params = m.getGenericParameterTypes(); errors.checkArgument(params.length == 1, "Must have a single argument"); TypeDescriptor<?> restrictionT = fnT.resolveType(params[0]); TypeDescriptor<?> trackerT = fnT.resolveType(m.getGenericReturnType()); TypeDescriptor<?> expectedTrackerT = restrictionTrackerTypeOf(restrictionT); errors.checkArgument( trackerT.isSubtypeOf(expectedTrackerT), "Returns %s, but must return a subtype of %s", formatType(trackerT), formatType(expectedTrackerT)); return DoFnSignature.NewTrackerMethod.create(m, restrictionT, trackerT); }
SomeRestriction.class, signature.getInitialRestriction().restrictionT().getRawType()); assertEquals(SomeRestriction.class, signature.splitRestriction().restrictionT().getRawType()); assertEquals(RestrictionTracker.class, signature.newTracker().trackerT().getRawType()); assertEquals(SomeRestriction.class, signature.newTracker().restrictionT().getRawType()); assertEquals(SomeRestrictionCoder.class, signature.getRestrictionCoder().coderT().getRawType());
SomeRestriction.class, signature.getInitialRestriction().restrictionT().getRawType()); assertEquals(SomeRestriction.class, signature.splitRestriction().restrictionT().getRawType()); assertEquals(SomeRestrictionTracker.class, signature.newTracker().trackerT().getRawType()); assertEquals(SomeRestriction.class, signature.newTracker().restrictionT().getRawType()); assertEquals(SomeRestrictionCoder.class, signature.getRestrictionCoder().coderT().getRawType());