diff options
author | Tor Norbye <tnorbye@google.com> | 2012-02-28 12:02:46 -0800 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-02-28 12:02:46 -0800 |
commit | fd9fe37e806b8f14b2944d29f307cd050ecb419c (patch) | |
tree | c359698378b29eb16cda128043e6bc013bc4a710 /eclipse | |
parent | 8c89972f765412b93834b18f43e93a77269bd2e7 (diff) | |
download | sdk-fd9fe37e806b8f14b2944d29f307cd050ecb419c.zip sdk-fd9fe37e806b8f14b2944d29f307cd050ecb419c.tar.gz sdk-fd9fe37e806b8f14b2944d29f307cd050ecb419c.tar.bz2 |
Fix configuration information for library projects
This changeset fixes one more bug related to lint configurations and
library projects (see issue 26029).
Some lint checks, such as the MergeRootFrameLayoutDetector, computes
the warnings at the end of processing all files. At that point, the
context points to the master project, so any errors which were
actually found in a library project will instead be using the master
project's configuration. That means that any suppress rules applies to
the lint.xml in the library project will be ignored.
This changeset fixes this by moving the logic which looks up the
severity for a warning out of the lint clients and into the
context. Now it checks the current projects being scanned and looks up
the corresponding project for each file (based on the file prefix),
and retrieves the configuration that way.
This changeset also makes one more fix: It now consults *both* the
library project *and* the master project to see if a rule should be
ignored. This means that if you turn off a given check in your master
project, you will no longer see those warnings from library projects
either, which seems desirable.
Change-Id: Icb5cdf7696b4908b0553f86896793515cb06f29c
Diffstat (limited to 'eclipse')
2 files changed, 4 insertions, 8 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java index 9db17d8..9424bf0 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/EclipseLintClient.java @@ -203,12 +203,8 @@ public class EclipseLintClient extends LintClient implements IDomParser { } @Override - public void report(Context context, Issue issue, Location location, String message, - Object data) { - assert context.isEnabled(issue); - assert context.getConfiguration().getSeverity(issue) != Severity.IGNORE; - Severity s = context.getConfiguration().getSeverity(issue); - + public void report(Context context, Issue issue, Severity s, Location location, + String message, Object data) { int severity = getMarkerSeverity(s); IMarker marker = null; if (location != null) { diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/lint/ProjectLintConfigurationTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/lint/ProjectLintConfigurationTest.java index 96014de..202d768 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/lint/ProjectLintConfigurationTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/lint/ProjectLintConfigurationTest.java @@ -208,8 +208,8 @@ public class ProjectLintConfigurationTest extends AdtProjectTest { private static class TestClient extends LintClient { @Override - public void report(Context context, Issue issue, Location location, String message, - Object data) { + public void report(Context context, Issue issue, Severity severity, Location location, + String message, Object data) { } @Override |