OSDN Git Service

Fix ClassScanner and re-enable CodeInspectionTest tests
authorAntony Sargent <asargent@google.com>
Thu, 31 Aug 2017 20:34:06 +0000 (13:34 -0700)
committerAntony Sargent <asargent@google.com>
Thu, 31 Aug 2017 21:00:15 +0000 (14:00 -0700)
commitec452e58a5642de2d7a41bfcece43df1fec51d16
tree2daa0094cce71ee6f52cc50a21f5efcecc0bfe57
parent09213198249bea341a590b5ea962f665d6dfc5f5
Fix ClassScanner and re-enable CodeInspectionTest tests

This fixes the code in ClassScanner for finding all classes in a given
package to not depend on directory entries in the .jar files generated
by the build system. This dependency caused our tests in
CodeInspepectionTest.java to fail when this CL:

https://android-review.googlesource.com/#/c/platform/build/+/456418/

stopped adding directory entries in the .jar files generated by the
build process. Instead of depending on directories being present in the
list of resources provided by the classloader, this CL switches to using
Guava's ClassPath class to enumerate all loadable classes and filter
them to the ones in the package of interest.

Change-Id: I583919096450b61d4816256be280e2f5f1ce2316
Fixes: 64840107
Test: make RunSettingsRoboTests
tests/robotests/src/com/android/settings/core/codeinspection/ClassScanner.java
tests/robotests/src/com/android/settings/core/codeinspection/CodeInspectionTest.java