1# Copyright (C) 2016 The Android Open Source Project
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15# We cannot implement Main in Java, as this would require to run
16# dexmerger (to merge the Dex file produced from Smali code and the
17# Dex file produced from Java code), which loops indefinitely when
18# processing class B28685551, as this class inherits from itself.  As
19# a workaround, implement Main using Smali (we could also have used
20# multidex, but this requires a custom build script).
21
22.class public LMain;
23.super Ljava/lang/Object;
24
25.method public static main([Ljava/lang/String;)V
26    .registers 3
27    .param p0, "args"
28
29    invoke-static {}, LMain;->test()V
30    sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream;
31    const-string v1, "Done!"
32    invoke-virtual {v0, v1}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
33    return-void
34.end method
35
36.method static test()V
37    .registers 4
38
39    :try_start
40    const-string v2, "B28685551"
41    invoke-static {v2}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class;
42    :try_end
43    .catch Ljava/lang/ClassCircularityError; {:try_start .. :try_end} :catch
44
45    move-result-object v0
46
47    :goto_7
48    return-void
49
50    :catch
51    move-exception v1
52    .local v1, "e":Ljava/lang/ClassCircularityError;
53    sget-object v2, Ljava/lang/System;->out:Ljava/io/PrintStream;
54    const-string v3, "Caught ClassCircularityError"
55    invoke-virtual {v2, v3}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V
56    goto :goto_7
57.end method
58