@UiThread(id = "id") void uiThreadWithId() { uiThreadWithIdDidExecute = true; }
@Override public void validate(Element element, ElementValidation valid) { super.validate(element, valid); coreValidatorHelper.usesEnqueueIfHasId(element, valid); UiThread annotation = element.getAnnotation(UiThread.class); long delay = annotation.delay(); UiThread.Propagation propagation = annotation.propagation(); if (delay != 0 && propagation == UiThread.Propagation.REUSE) { valid.addWarning("propagation=REUSE is ignored when using a delay"); } }
public void usesEnqueueIfHasId(Element element, ElementValidation valid) { UiThread annotation = element.getAnnotation(UiThread.class); if (!"".equals(annotation.id()) && annotation.propagation() == UiThread.Propagation.REUSE) { valid.addError("An id only can be used with Propagation.ENQUEUE"); } }
@Override public void process(Element element, EComponentHolder holder) throws Exception { ExecutableElement executableElement = (ExecutableElement) element; JMethod delegatingMethod = codeModelHelper.overrideAnnotatedMethod(executableElement, holder); JBlock previousBody = codeModelHelper.removeBody(delegatingMethod); JDefinedClass anonymousRunnableClass = codeModelHelper.createDelegatingAnonymousRunnableClass(previousBody); UiThread annotation = element.getAnnotation(UiThread.class); long delay = annotation.delay(); UiThread.Propagation propagation = annotation.propagation(); if (delay == 0 && propagation == UiThread.Propagation.REUSE) { // Put in the check for the UI thread. addUIThreadCheck(delegatingMethod, previousBody, holder); } delegatingMethod.body().add(getJClass(UiThreadExecutor.class).staticInvoke(METHOD_RUN_TASK) // .arg(annotation.id()) // .arg(_new(anonymousRunnableClass)) // .arg(lit(delay))); }
@Override public void process(Element element, EComponentHolder holder) throws Exception { ExecutableElement executableElement = (ExecutableElement) element; JMethod delegatingMethod = codeModelHelper.overrideAnnotatedMethod(executableElement, holder); JBlock previousBody = codeModelHelper.removeBody(delegatingMethod); JDefinedClass anonymousRunnableClass = codeModelHelper.createDelegatingAnonymousRunnableClass(previousBody); UiThread annotation = element.getAnnotation(UiThread.class); long delay = annotation.delay(); UiThread.Propagation propagation = annotation.propagation(); if (delay == 0 && propagation == UiThread.Propagation.REUSE) { // Put in the check for the UI thread. addUIThreadCheck(delegatingMethod, previousBody, holder); } delegatingMethod.body().add(getJClass(UiThreadExecutor.class).staticInvoke(METHOD_RUN_TASK) // .arg(annotation.id()) // .arg(_new(anonymousRunnableClass)) // .arg(lit(delay))); }
@UiThread void uiThread() { didExecute = true; }
@Override public void validate(Element element, ElementValidation valid) { super.validate(element, valid); coreValidatorHelper.usesEnqueueIfHasId(element, valid); UiThread annotation = element.getAnnotation(UiThread.class); long delay = annotation.delay(); UiThread.Propagation propagation = annotation.propagation(); if (delay != 0 && propagation == UiThread.Propagation.REUSE) { valid.addWarning("propagation=REUSE is ignored when using a delay"); } }
public void usesEnqueueIfHasId(Element element, ElementValidation valid) { UiThread annotation = element.getAnnotation(UiThread.class); if (!"".equals(annotation.id()) && annotation.propagation() == UiThread.Propagation.REUSE) { valid.addError("An id only can be used with Propagation.ENQUEUE"); } }
@UiThread void genericUiMethod(List<Map<String, List<Set<Void>>>> param) { }
@UiThread void uiThreadedUsingArrayParamtersMethod(MySerializableBean[][] array) { }
@UiThread void uiThread() { }
@UiThread void objectUiMethod(Object param) { }
@UiThread(delay = 1000) void emptyUiDelayedMethod() { }
@UiThread <S extends List<T>> void uiMethod(S method) { }
@UiThread void uiThread() { }
@UiThread void someUIThreadTask() { }
@UiThread void uiThreadedUsingArrayParamtersMethod(MySerializableBean[] array) { }
@UiThread void emptyUiMethod() { }
@UiThread(propagation = Propagation.REUSE) void emptUiMethodReuse() { }
@UiThread void uiThread() { }