Home | History | Annotate | Download | only in lint
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.eclipse.org/org/documents/epl-v10.php
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package com.android.ide.eclipse.adt.internal.lint;
     17 
     18 import com.android.annotations.NonNull;
     19 import com.android.tools.lint.checks.*;
     20 import com.android.tools.lint.detector.api.Issue;
     21 
     22 import java.util.ArrayList;
     23 import java.util.List;
     24 
     25 public class EclipseLintIssueRegistry extends BuiltinIssueRegistry {
     26     private static List<Issue> sFilteredIssues;
     27 
     28     public EclipseLintIssueRegistry() {
     29     }
     30 
     31     @NonNull
     32     @Override
     33     public List<Issue> getIssues() {
     34         if (sFilteredIssues == null) {
     35             // Remove issues that do not work properly in Eclipse
     36             List<Issue> sIssues = super.getIssues();
     37             List<Issue> result = new ArrayList<Issue>(sIssues.size());
     38             for (Issue issue : sIssues) {
     39                 if (issue == MissingClassDetector.INSTANTIATABLE) {
     40                     // Apparently violated by
     41                     // android.support.v7.internal.widget.ActionBarView.HomeView
     42                     // See issue 72760
     43                     continue;
     44                 } else if (issue == DuplicateIdDetector.WITHIN_LAYOUT) {
     45                     // Apparently violated by
     46                     // sdk/extras/android/support/v7/appcompat/abc_activity_chooser_view_include.xml
     47                     // See issue 72760
     48                     continue;
     49                 } else if (issue == AppCompatResourceDetector.ISSUE
     50                         || issue == AppCompatCallDetector.ISSUE) {
     51                     // Apparently has some false positives in Eclipse; see issue
     52                     // 72824
     53                     continue;
     54                 } else if (issue.getImplementation().getDetectorClass() == RtlDetector.class) {
     55                     // False positives in Eclipse; see issue 78780
     56                     continue;
     57                 }
     58                 result.add(issue);
     59             }
     60             sFilteredIssues = result;
     61         }
     62 
     63         return sFilteredIssues;
     64     }
     65 }
     66