diff options
author | David Brazdil <dbrazdil@google.com> | 2019-01-30 16:17:50 +0000 |
---|---|---|
committer | David Brazdil <dbrazdil@google.com> | 2019-02-01 14:59:57 +0000 |
commit | 2da3cbb4af20a64108e474c0bbbe0cc5d3af2aa2 (patch) | |
tree | 8cbdf50aab2183c701f1dc7c9ac17d1129fb5238 /test/HiddenApi/AbstractPackageClass.java | |
parent | 0518af4e87d484b10e785aff9b030b688926cd7f (diff) |
hiddenapi: Fix class hierarchy traversal
`hiddenapi` builds and traverses the class hierarchy, visiting all
class members that methods/fields in stubs may resolve to.
The algorithm wouldn't work when:
* an interface declares a method which is in stubs, and
* a class implements the interface by inheriting the method from its
superclass; neither the class nor its superclass are in stubs.
The problem was that once a matching method was found, only subclasses
would be traversed. In this case, the method would be found in the
interface, the class which implements it would be traversed but its
superclass would not.
This patch simplifies the algorithm and partially reverts a performance
optimization which caused the problem. As a result, there is a build
time regression from 5s to 8s.
The patch also adds gtests which test this behaviour. There were no
tests until now because stubs are not present in master-art manifest.
Get around this issue by using the actual core JARs as stubs but test
the behaviour on other classes.
Bug: 122551864
Test: m test-art-host-gtest-hiddenapi_test
Change-Id: I63751c5ef517c8e9d3a157dfbec8de01bd99c2d4
Diffstat (limited to 'test/HiddenApi/AbstractPackageClass.java')
-rw-r--r-- | test/HiddenApi/AbstractPackageClass.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/HiddenApi/AbstractPackageClass.java b/test/HiddenApi/AbstractPackageClass.java new file mode 100644 index 0000000000..8f955caa52 --- /dev/null +++ b/test/HiddenApi/AbstractPackageClass.java @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +abstract class AbstractPackageClass { + public void publicMethod2() {} +} |