From f7d2ff895ec5b30eab9780e5d621ea2baa4018f6 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Tue, 31 Dec 2019 09:40:49 -0800 Subject: [PATCH] Fix Error Prone errors Soong wasn't including android_app or android_test sources in the javac-check target used for the Error Prone build, which allowed some Error Prone errors to get in. Fix them so Error Prone can be re-enabled for these targets. Fixes: cts/hostsidetests/net/app/src/com/android/cts/net/hostside/RequiredPropertiesRule.java:61: error: [CollectionIncompatibleType] Argument '~requiredProperty.getValue()' should not be passed to this method; its type int is not compatible with its collection's type argument Property cts/tests/location/location_fine/src/android/location/cts/fine/CriteriaTest.java:199: error: [JUnit4TestNotRun] This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility. cts/tests/location/location_fine/src/android/location/cts/fine/LocationManagerFineTest.java:948: error: [TryFailThrowable] Catching Throwable/Error masks failures from fail() or assert*() in the try block cts/tests/location/location_fine/src/android/location/cts/fine/LocationTest.java:402: error: [JUnit4TestNotRun] This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility. cts/tests/tests/assist/src/android/assist/cts/AssistTestBase.java:613: error: [CheckReturnValue] Ignored return value of method that is annotated with @CheckReturnValue cts/tests/tests/assist/src/android/assist/cts/AssistTestBase.java:616: error: [CheckReturnValue] Ignored return value of method that is annotated with @CheckReturnValue cts/tests/tests/media/src/android/media/cts/AudioRecordTest.java:1661: error: [JUnit4TestNotRun] This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility. cts/tests/tests/media/src/android/media/cts/AudioRecordTest.java:1681: error: [JUnit4TestNotRun] This looks like a test method but is not run; please add @Test and @Ignore, or, if this is a helper method, reduce its visibility. Bug: 146455923 Test: m RUN_ERROR_PRONE=true javac-check Change-Id: I48b1ccb61c807d0b41a165298ef5981258d6656e --- .../android/cts/net/hostside/RequiredPropertiesRule.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/cts/hostside/app/src/com/android/cts/net/hostside/RequiredPropertiesRule.java b/tests/cts/hostside/app/src/com/android/cts/net/hostside/RequiredPropertiesRule.java index 1e333200db..98c97c5687 100644 --- a/tests/cts/hostside/app/src/com/android/cts/net/hostside/RequiredPropertiesRule.java +++ b/tests/cts/hostside/app/src/com/android/cts/net/hostside/RequiredPropertiesRule.java @@ -58,8 +58,12 @@ public class RequiredPropertiesRule extends BeforeAfterRule { continue; } for (Property requiredProperty : requiredProperties.value()) { - if (!allRequiredProperties.contains(~requiredProperty.getValue())) { - allRequiredProperties.add(requiredProperty); + for (Property p : Property.values()) { + if (p.getValue() == ~requiredProperty.getValue()) { + if (!allRequiredProperties.contains(p)) { + allRequiredProperties.add(requiredProperty); + } + } } } }