| 1 |
# /* |
| 2 |
# * Copyright (C) 2015 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 |
# |
| 17 |
# class Main implements Iface { |
| 18 |
# public static void main(String[] args) { |
| 19 |
# Main m = new Main(); |
| 20 |
# sayHiMain(m); |
| 21 |
# sayHiIface(m); |
| 22 |
# } |
| 23 |
# public static void sayHiMain(Main m) { |
| 24 |
# System.out.println("Saying hi from class"); |
| 25 |
# m.sayHi(); |
| 26 |
# } |
| 27 |
# public static void sayHiIface(Iface m) { |
| 28 |
# System.out.println("Saying hi from interface"); |
| 29 |
# m.sayHi(); |
| 30 |
# } |
| 31 |
# } |
| 32 |
.class public LMain; |
| 33 |
.super Ljava/lang/Object; |
| 34 |
.implements LIface; |
| 35 |
|
| 36 |
.method public constructor <init>()V |
| 37 |
.registers 1 |
| 38 |
invoke-direct {p0}, Ljava/lang/Object;-><init>()V |
| 39 |
return-void |
| 40 |
.end method |
| 41 |
|
| 42 |
.method public static main([Ljava/lang/String;)V |
| 43 |
.locals 2 |
| 44 |
new-instance v0, LMain; |
| 45 |
invoke-direct {v0}, LMain;-><init>()V |
| 46 |
|
| 47 |
invoke-static {v0}, LMain;->sayHiMain(LMain;)V |
| 48 |
invoke-static {v0}, LMain;->sayHiIface(LIface;)V |
| 49 |
|
| 50 |
return-void |
| 51 |
.end method |
| 52 |
|
| 53 |
.method public static sayHiMain(LMain;)V |
| 54 |
.locals 2 |
| 55 |
sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; |
| 56 |
const-string v1, "Saying hi from class" |
| 57 |
invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V |
| 58 |
|
| 59 |
invoke-virtual {p0}, LMain;->sayHi()V |
| 60 |
return-void |
| 61 |
.end method |
| 62 |
|
| 63 |
.method public static sayHiIface(LIface;)V |
| 64 |
.locals 2 |
| 65 |
sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; |
| 66 |
const-string v1, "Saying hi from interface" |
| 67 |
invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/Object;)V |
| 68 |
|
| 69 |
invoke-interface {p0}, LIface;->sayHi()V |
| 70 |
return-void |
| 71 |
.end method |