summaryrefslogtreecommitdiff
path: root/test/162-method-resolution/src
AgeCommit message (Collapse)Author
2021-03-24Add a test for wrong constructor resolution.Vladimir Marko
The constructor resolution in ART currently allows calling the superclass contructor directly. This is against the JLS but we do not try to fix it in this CL, just add a test that exposes the behavior. Test: New test in 162-method-resolution Test: testrunner.py --host -t 162-method-resolution Test: testrunner.py --jvm -t 162-method-resolution Bug: 183485797 Change-Id: I199584a09645b252e63ade903c0c43fef3e91819
2021-03-24Update test 162-method-resolution to pass on RI.Vladimir Marko
Update the test7 for newer versions of JLS and RI. Add a workaround for divergence in test10. Test: testrunner.py --host -t 162-method-resolution Test: testrunner.py --jvm -t 162-method-resolution Bug: 63624936 Bug: 64274113 Change-Id: I848745c64fcc22c49c2dd7ebbdaaf50922d8486b
2020-11-05Rename ART run-tests `expected.txt` files as `expected-stdout.txt`.Roland Levillain
This is in preparation for the addition of `expected-stderr.txt` files in all ART run-test directories, which will record the expected standard error for each of these tests, and which will be verified along with `expected-stdout.txt`. Test: Run ART run-tests on host and device using `testrunner.py`. Test: atest --test-mapping art:all Bug: 171865375 Bug: 147812905 Change-Id: I37e3c4b8409475790e2fc63514cdf57156d47ff4
2017-08-02Fix verifier checks on interface methods.Alex Light
We were disallowing interfaces in the IsInheritedMethod even though the function can be called with them. This could cause some failing DCHECKS if the verifier cannot find methods in some situations. We also fixed a small issue in the verifier where we allowed non-public java.lang.Object methods to be considered valid for interface dispatch. Test: ./test.py --host -j50 Test: Compile an app with bad bytecodes (See bug) Bug: 64158483 Bug: 64274113 Change-Id: Ia79f25be0001efc4069a411a0b34476bd0871803
2017-07-20ART: Change method lookup to be more consistent to JLS and the RI.Vladimir Marko
The method lookup for different invoke types was previously widely different and didn't work well with the dex cache method array where we have only a single slot for each MethodId. The new behavior is to perform the same lookup for all cases, distinguishing only between interface and non-interface referencing class, and to further align the behavior with the JLS and the RI. Where the JLS conflicts with the RI, we follow the JLS semantics. The new lookup for class methods first searches the methods declared in the superclass chain (ignoring "copied" methods) and only then looks in the "copied" methods. If the search in the superclass chain finds a method that has not been inherited (i.e. either a private method or a package-access method where one of the classes in the chain does not belong to the same package, see JLS 8.4.8), we still search the "copied" methods as there may actually be a method inherited from an interface. This follows the JLS semantics where inherited methods are included in the search (JLS 15.12.2.1) but conflicts with the RI where the private or package-access method takes precedence over methods inherited from interfaces. Note that this search can find an accessible method that is not inherited by the qualifying type, either for a package access method when the referrer is in the same package but the qualifying type is in another package, or for a private method where the referrer is in the same class but the qualifying type is actually a subclass. For the moment we allow such calls and we shall consider whether to throw an IncompatibleClassChangeError in this situation in future to comply with JLS 15.12.4.3. The new lookup for interface methods searches the interface class, then all the superinterfaces and then the java.lang.Object class, see implicitly declared methods in interfaces, JLS 9.2. The search for the maximally-specific non-abstract superinterface method is not yet implemented, but the difference should be difficult to observe as the usual subsequent call to FindVirtualMethodForInterface() should yield the same result for any matching method. The new test 162-method-idx-clash exposes several cases where we previously completely messed up due to the effects of the DexCache, or where we were out of line with the RI. It also tests a case where the JLS and the RI disagree and we follow the JLS. Test: art/test/run-test --host --jvm 162-method-resolution Test: m test-art-host-gtest Test: testrunner.py --host Test: testrunner.py --host --interp-ac Test: Nexus 6P boots. Test: testrunner.py --target Bug: 62855082 Bug: 30627598 Change-Id: If450c8cff2751369011d649c25d28a482a2c61a3