• 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.source "Subclass.smali"
17
18.class public LSubclass;
19.super Ljava/lang/Object;
20
21.method public constructor <init>()V
22.registers 3
23  invoke-direct {p0}, Ljava/lang/Object;-><init>()V
24  goto :happy
25  # Get a MethodHandleImpl instance (subclass of MethodHandle).
26  invoke-static {}, LSubclass;->getMethodHandleSubclassInstance()Ljava/lang/invoke/MethodHandleImpl;
27  move-result-object v0
28  const-string v1, "1"
29  const-string v2, "2"
30  # Calling MethodHandle.invoke() on MethodHandleImpl instance (subclass of MethodHandle) => Okay
31  invoke-polymorphic {v0, v1, v2}, Ljava/lang/invoke/MethodHandle;->invoke([Ljava/lang/Object;)Ljava/lang/Object;, (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
32  # Calling MethodHandleImpl.invoke() rather than MethodHandle.invoke() [ declaring class is okay ] => Okay
33  invoke-polymorphic {v0, v1, v2}, Ljava/lang/invoke/MethodHandleImpl;->invoke([Ljava/lang/Object;)Ljava/lang/Object;, (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
34:happy
35  sget-object v1, Ljava/lang/System;->out:Ljava/io/PrintStream;
36  const-string v2, "Passed Subclass test"
37  invoke-virtual {v1, v2}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
38  return-void
39.end method
40
41.method public static getMethodHandleSubclassInstance()Ljava/lang/invoke/MethodHandleImpl;
42.registers 1
43  const/4 v0, 0
44  return-object v0
45.end method
46