private boolean runExtraTokenChecks() { if (task.skipExtraTokenChecks) { return false; } for (Issue issue : task.getCheckedIssues()) { if (issue.getImplementation().getScope().contains(Scope.JAVA_FILE)) { Class<? extends Detector> detectorClass = issue.getImplementation() .getDetectorClass(); if (Detector.JavaPsiScanner.class.isAssignableFrom(detectorClass)) { return true; } } } return false; }
@Override protected void tearDown() throws Exception { super.tearDown(); List<Issue> issues; try { // Some detectors extend LintDetectorTest but don't actually // provide issues and assert instead; gracefully ignore those // here issues = getIssues(); } catch (Throwable t) { issues = Collections.emptyList(); } for (Issue issue : issues) { EnumSet<Scope> scope = issue.getImplementation().getScope(); if (scope.contains(Scope.JAVA_FILE) || scope.contains(Scope.ALL_JAVA_FILES) || scope.contains(Scope.RESOURCE_FILE) || scope.contains(Scope.ALL_RESOURCE_FILES)) { if (LintDriver.getCrashCount() > 0) { fail("There was a crash during lint execution; consult log for details"); } break; } } }
EnumSet<Scope> issueScope = issue.getImplementation().getScope(); if (s == null) { detectorToScope.put(detectorClass, issueScope);
context.requestRepeat(this, ISSUE.getImplementation().getScope());
context.requestRepeat(this, ISSUE.getImplementation().getScope());
Implementation implementation = issue.getImplementation(); Class<? extends Detector> detectorClass = implementation.getDetectorClass(); EnumSet<Scope> issueScope = implementation.getScope(); if (!detectorClasses.contains(detectorClass)) {
EnumSet<Scope> scope = issue.getImplementation().getScope(); if (scope.contains(Scope.JAVA_FILE) || scope.contains(Scope.JAVA_LIBRARIES) || scope.contains(Scope.ALL_JAVA_FILES)) {
private boolean checkSuppressLint(@NonNull PsiAnnotation node, @NonNull String id) { IssueRegistry registry = mContext.getDriver().getRegistry(); Issue issue = registry.getIssue(id); // Special-case the ApiDetector issue, since it does both source file analysis // only on field references, and class file analysis on the rest, so we allow // annotations outside of methods only on fields if (issue != null && !issue.getImplementation().getScope().contains(Scope.JAVA_FILE) || issue == ApiDetector.UNSUPPORTED) { // This issue doesn't have AST access: annotations are not // available for local variables or parameters PsiElement scope = getAnnotationScope(node); mContext.report(INSIDE_METHOD, scope, mContext.getLocation(node), String.format( "The `@SuppressLint` annotation cannot be used on a local " + "variable with the lint check '%1$s': move out to the " + "surrounding method", id)); return false; } return true; } }
if (issue != null && !issue.getImplementation().getScope().contains(Scope.JAVA_FILE) || issue == ApiDetector.UNSUPPORTED) {