Esempio n. 1
0
 @Override
 public void visitMethod(
     @NonNull JavaContext context,
     @Nullable UastVisitor visitor,
     @NonNull UCallExpression node,
     @NonNull UMethod method) {
   JavaEvaluator evaluator = context.getEvaluator();
   if (evaluator.isMemberInClass(method, "android.app.AlarmManager")
       && evaluator.getParameterCount(method) == 4) {
     ensureAtLeast(context, node, 1, 5000L);
     ensureAtLeast(context, node, 2, 60000L);
   }
 }
 @Override
 public void visitReference(
     @NonNull JavaContext context,
     @Nullable UastVisitor visitor,
     @NonNull UReferenceExpression reference,
     @NonNull PsiElement resolved) {
   if (resolved instanceof PsiField
       && JavaEvaluator.isMemberInClass((PsiField) resolved, "android.view.MenuItem")) {
     if ("SHOW_AS_ACTION_ALWAYS".equals(((PsiField) resolved).getName())) {
       if (context.getDriver().isSuppressed(context, ISSUE, reference)) {
         return;
       }
       if (mAlwaysFields == null) {
         mAlwaysFields = new ArrayList<Location>();
       }
       mAlwaysFields.add(context.getUastLocation(reference));
     } else {
       mHasIfRoomRefs = true;
     }
   }
 }