1# Created with baksmali. 2 3# Java file for reference. 4 5# import java.lang.reflect.InvocationTargetException; 6# import java.lang.reflect.Method; 7# 8# public class Main { 9# public static void main(String[] args) { 10# try { 11# // Make sure that the abstract final class is marked as erroneous. 12# Class.forName("AbstractFinal"); 13# System.out.println("UNREACHABLE!"); 14# } catch (VerifyError expected) { 15# } catch (Throwable t) { 16# t.printStackTrace(System.out); 17# } 18# try { 19# // Verification of TestClass.test() used to crash when processing 20# // the final abstract (erroneous) class. 21# Class<?> tc = Class.forName("TestClass"); 22# Method test = tc.getDeclaredMethod("test"); 23# test.invoke(null); 24# System.out.println("UNREACHABLE!"); 25# } catch (InvocationTargetException ite) { 26# if (ite.getCause() instanceof InstantiationError) { 27# System.out.println( 28# ite.getCause().getClass().getName() + ": " + ite.getCause().getMessage()); 29# } else { 30# ite.printStackTrace(System.out); 31# } 32# } catch (Throwable t) { 33# t.printStackTrace(System.out); 34# } 35# } 36# } 37 38.class public LMain; 39.super Ljava/lang/Object; 40.source "Main.java" 41 42 43# direct methods 44.method public constructor <init>()V 45 .registers 1 46 47 .line 20 48 invoke-direct {p0}, Ljava/lang/Object;-><init>()V 49 50 return-void 51.end method 52 53.method public static main([Ljava/lang/String;)V 54 .registers 4 55 56 .line 24 57 :try_start_0 58 const-string p0, "AbstractFinal" 59 60 invoke-static {p0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class; 61 62 .line 25 63 sget-object p0, Ljava/lang/System;->out:Ljava/io/PrintStream; 64 65 const-string v0, "UNREACHABLE!" 66 67 invoke-virtual {p0, v0}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V 68 :try_end_c 69 .catch Ljava/lang/VerifyError; {:try_start_0 .. :try_end_c} :catch_14 70 .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_c} :catch_d 71 72 goto :goto_15 73 74 .line 27 75 :catch_d 76 move-exception p0 77 78 .line 28 79 sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 80 81 invoke-virtual {p0, v0}, Ljava/lang/Throwable;->printStackTrace(Ljava/io/PrintStream;)V 82 83 goto :goto_16 84 85 .line 26 86 :catch_14 87 move-exception p0 88 89 .line 29 90 :goto_15 91 nop 92 93 .line 33 94 :goto_16 95 :try_start_16 96 const-string p0, "TestClass" 97 98 invoke-static {p0}, Ljava/lang/Class;->forName(Ljava/lang/String;)Ljava/lang/Class; 99 100 move-result-object p0 101 102 .line 34 103 const-string v0, "test" 104 105 const/4 v1, 0x0 106 107 new-array v2, v1, [Ljava/lang/Class; 108 109 invoke-virtual {p0, v0, v2}, Ljava/lang/Class;->getDeclaredMethod(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method; 110 111 move-result-object p0 112 113 .line 35 114 const/4 v0, 0x0 115 116 new-array v1, v1, [Ljava/lang/Object; 117 118 invoke-virtual {p0, v0, v1}, Ljava/lang/reflect/Method;->invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; 119 120 .line 36 121 sget-object p0, Ljava/lang/System;->out:Ljava/io/PrintStream; 122 123 const-string v0, "UNREACHABLE!" 124 125 invoke-virtual {p0, v0}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V 126 :try_end_32 127 .catch Ljava/lang/reflect/InvocationTargetException; {:try_start_16 .. :try_end_32} :catch_3a 128 .catch Ljava/lang/Throwable; {:try_start_16 .. :try_end_32} :catch_33 129 130 goto :goto_76 131 132 .line 44 133 :catch_33 134 move-exception p0 135 136 .line 45 137 sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 138 139 invoke-virtual {p0, v0}, Ljava/lang/Throwable;->printStackTrace(Ljava/io/PrintStream;)V 140 141 goto :goto_77 142 143 .line 37 144 :catch_3a 145 move-exception p0 146 147 .line 38 148 invoke-virtual {p0}, Ljava/lang/reflect/InvocationTargetException;->getCause()Ljava/lang/Throwable; 149 150 move-result-object v0 151 152 instance-of v0, v0, Ljava/lang/InstantiationError; 153 154 if-eqz v0, :cond_71 155 156 .line 39 157 sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 158 159 new-instance v1, Ljava/lang/StringBuilder; 160 161 invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V 162 163 .line 40 164 invoke-virtual {p0}, Ljava/lang/reflect/InvocationTargetException;->getCause()Ljava/lang/Throwable; 165 166 move-result-object v2 167 168 invoke-virtual {v2}, Ljava/lang/Object;->getClass()Ljava/lang/Class; 169 170 move-result-object v2 171 172 invoke-virtual {v2}, Ljava/lang/Class;->getName()Ljava/lang/String; 173 174 move-result-object v2 175 176 invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 177 178 const-string v2, ": " 179 180 invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 181 182 invoke-virtual {p0}, Ljava/lang/reflect/InvocationTargetException;->getCause()Ljava/lang/Throwable; 183 184 move-result-object p0 185 186 invoke-virtual {p0}, Ljava/lang/Throwable;->getMessage()Ljava/lang/String; 187 188 move-result-object p0 189 190 invoke-virtual {v1, p0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 191 192 invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; 193 194 move-result-object p0 195 196 .line 39 197 invoke-virtual {v0, p0}, Ljava/io/PrintStream;->println(Ljava/lang/String;)V 198 199 goto :goto_76 200 201 .line 42 202 :cond_71 203 sget-object v0, Ljava/lang/System;->out:Ljava/io/PrintStream; 204 205 invoke-virtual {p0, v0}, Ljava/lang/reflect/InvocationTargetException;->printStackTrace(Ljava/io/PrintStream;)V 206 207 .line 46 208 :goto_76 209 nop 210 211 .line 47 212 :goto_77 213 return-void 214.end method 215