• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2016 The Android Open Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16# This is the test suite runner. It is written in smali rather than
17# Java pending support in dx/dxmerge for invoke-polymorphic (b/33191712).
18
19.source "Main.smali"
20
21.class public LMain;
22.super Ljava/lang/Object;
23
24.method public constructor<init>()V
25.registers 1
26  invoke-direct {v0}, Ljava/lang/Object;-><init>()V
27  return-void
28.end method
29
30.method public static main([Ljava/lang/String;)V
31.registers 1
32  # New tests should be added here.
33  const-string v0, "MethodHandleNotInvoke"
34  invoke-static {v0}, LMain;->test(Ljava/lang/String;)V
35  const-string v0, "MethodHandleToString"
36  invoke-static {v0}, LMain;->test(Ljava/lang/String;)V
37  const-string v0, "NonReference"
38  invoke-static {v0}, LMain;->test(Ljava/lang/String;)V
39  const-string v0, "TooFewArguments"
40  invoke-static {v0}, LMain;->test(Ljava/lang/String;)V
41  const-string v0, "TooManyArguments"
42  invoke-static {v0}, LMain;->test(Ljava/lang/String;)V
43  const-string v0, "BadThis"
44  invoke-static {v0}, LMain;->test(Ljava/lang/String;)V
45  const-string v0, "FakeSignaturePolymorphic"
46  invoke-static {v0}, LMain;->test(Ljava/lang/String;)V
47  const-string v0, "BetterFakeSignaturePolymorphic"
48  invoke-static {v0}, LMain;->test(Ljava/lang/String;)V
49  const-string v0, "Subclass"
50  invoke-static {v0}, LMain;->test(Ljava/lang/String;)V
51  const-string v0, "Unresolved"
52  invoke-static {v0}, LMain;->test(Ljava/lang/String;)V
53  const-string v0, "VarHandleHappyAccessors"
54  invoke-static {v0}, LMain;->test(Ljava/lang/String;)V
55  const-string v0, "VarHandleUnhappyAccessors"
56  invoke-static {v0}, LMain;->test(Ljava/lang/String;)V
57const-string v0, "VarHandleUnknownAccessor"
58  invoke-static {v0}, LMain;->test(Ljava/lang/String;)V
59  return-void
60.end method
61
62.method public static test(Ljava/lang/String;)V
63.registers 6
64 :try_start_1
65  invoke-static {v5}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
66  move-result-object v0
67  invoke-virtual {v0}, Ljava/lang/Class;->newInstance()Ljava/lang/Object;
68 :try_end_1
69  .catch Ljava/lang/VerifyError; {:try_start_1 .. :try_end_1} :catch_verifier
70  return-void
71 :catch_verifier
72  move-exception v3
73  invoke-virtual {v3}, Ljava/lang/Exception;->toString()Ljava/lang/String;
74  move-result-object v3
75  sget-object v2, Ljava/lang/System;->out:Ljava/io/PrintStream;
76  invoke-virtual {v2, v3}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
77  return-void
78.end method
79
80# A test method called "invoke", but on a class other than MethodHandle.
81.method public invoke([Ljava/lang/Object;)Ljava/lang/Object;
82.registers 2
83  const/4 v0, 0
84  aget-object v0, p0, v0
85  return-object v0
86.end method
87
88# A test method called "invokeExact" that is native varargs, but is on a class
89# other than MethodHandle.
90.method public native varargs invokeExact([Ljava/lang/Object;)Ljava/lang/Object;
91.end method