Make Android bytecode shape tests more readable

This commit is contained in:
Yan Zhulanow
2015-03-16 20:29:03 +03:00
parent 15f8ba811b
commit 01c79c6d00
21 changed files with 84 additions and 172 deletions
@@ -8,8 +8,7 @@ fun Activity.a() {
val y = this.login val y = this.login
} }
// 2 GETSTATIC // 2 GETSTATIC com/myapp/R\$id\.login
// 2 INVOKEVIRTUAL // 2 INVOKEVIRTUAL android/app/Activity\.findViewById
// 2 CHECKCAST // 2 CHECKCAST android/widget/Button
// 0 _\$_findCachedViewById // 0 _\$_findCachedViewById
// 2 findViewById
@@ -8,9 +8,8 @@ fun Fragment.a() {
val y = this.login val y = this.login
} }
// 2 GETSTATIC // 2 GETSTATIC com/myapp/R\$id\.login
// 4 INVOKEVIRTUAL // 2 CHECKCAST android/widget/Button
// 2 CHECKCAST // 2 INVOKEVIRTUAL android/app/Fragment\.getView
// 0 _\$_findCachedViewById // 2 INVOKEVIRTUAL android/view/View\.findViewById
// 2 findViewById // 0 _\$_findCachedViewById
// 2 getView
@@ -6,9 +6,9 @@ import java.io.File
import kotlinx.android.synthetic.* import kotlinx.android.synthetic.*
public class MyActivity : Activity() { public class MyActivity : Activity() {
{clearFindViewByIdCache()} init { clearFindViewByIdCache() }
} }
// 5 INVOKEVIRTUAL // 1 public _\$_findCachedViewById
// 1 CHECKCAST // 1 public _\$_clearFindViewByIdCache
// 2 _\$_clearFindViewByIdCache // 1 INVOKEVIRTUAL com/myapp/MyActivity\._\$_clearFindViewByIdCache
@@ -9,4 +9,4 @@ public fun Activity.a() {
clearFindViewByIdCache() clearFindViewByIdCache()
} }
// 0 clearFindViewByIdCache // 0 clearFindViewByIdCache
@@ -14,8 +14,8 @@ fun MyActivity.b() {
val y = this.login val y = this.login
} }
// 2 GETSTATIC // 1 public _\$_findCachedViewById
// 6 INVOKEVIRTUAL // 1 public _\$_clearFindViewByIdCache
// 3 CHECKCAST // 2 GETSTATIC com/myapp/R\$id\.login
// 3 _\$_findCachedViewById // 2 INVOKEVIRTUAL com/myapp/MyActivity\._\$_findCachedViewById
// 1 findViewById // 2 CHECKCAST android/widget/Button
@@ -1,21 +0,0 @@
package com.myapp
import android.app.Activity
import android.os.Bundle
import java.io.File
import kotlinx.android.synthetic.layout.*
public class MyActivity : Activity() {
}
fun Activity.b() {
val x = login
val y = this.login
}
// 2 GETSTATIC
// 6 INVOKEVIRTUAL
// 3 CHECKCAST
// 1 _\$_findCachedViewById
// 3 findViewById
@@ -1,17 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>
@@ -1,22 +0,0 @@
package com.myapp
import android.app.Fragment
import android.os.Bundle
import java.io.File
import kotlinx.android.synthetic.layout.*
public class MyFragment : Fragment() {
}
fun Fragment.b() {
val x = login
val y = this.login
}
// 2 GETSTATIC
// 9 INVOKEVIRTUAL
// 3 CHECKCAST
// 1 _\$_findCachedViewById
// 3 findViewById
// 3 getView
@@ -1,17 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/item_detail_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame" >
<Button
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Sign in" />
</FrameLayout>
@@ -5,17 +5,16 @@ import android.os.Bundle
import java.io.File import java.io.File
import kotlinx.android.synthetic.layout.* import kotlinx.android.synthetic.layout.*
public class MyActivity : Activity() { public class MyActivity : Activity()
}
fun MyActivity.b() { fun MyActivity.b() {
val x = login val x = login
val y = this.login val y = this.login
} }
// 2 GETSTATIC // 1 public _\$_findCachedViewById
// 6 INVOKEVIRTUAL // 1 public _\$_clearFindViewByIdCache
// 3 CHECKCAST // 1 INVOKEVIRTUAL com/myapp/MyActivity\.findViewById
// 3 _\$_findCachedViewById // 2 GETSTATIC com/myapp/R\$id\.login
// 1 findViewById // 2 INVOKEVIRTUAL com/myapp/MyActivity\._\$_findCachedViewById
// 2 CHECKCAST android/widget/Button
@@ -8,8 +8,7 @@ fun View.a() {
val y = this.login val y = this.login
} }
// 2 GETSTATIC // 2 GETSTATIC com/myapp/R\$id\.login
// 2 INVOKEVIRTUAL // 2 INVOKEVIRTUAL android/view/View\.findViewById
// 2 CHECKCAST // 2 CHECKCAST android/widget/Button
// 0 _\$_findCachedViewById // 0 _\$_findCachedViewById
// 2 findViewById
@@ -8,8 +8,8 @@ class MyActivity: Activity() {
val button2 = MyButton val button2 = MyButton
} }
// 2 GETSTATIC // 1 public _\$_findCachedViewById
// 6 INVOKEVIRTUAL // 1 public _\$_clearFindViewByIdCache
// 3 CHECKCAST // 2 GETSTATIC com/myapp/R\$id\.MyButton
// 3 _\$_findCachedViewById // 2 INVOKEVIRTUAL com/myapp/MyActivity\._\$_findCachedViewById
// 1 findViewById // 2 CHECKCAST android/widget/Button
@@ -8,9 +8,9 @@ class MyFragment: Fragment() {
val button2 = MyButton val button2 = MyButton
} }
// 2 GETSTATIC // 1 public _\$_findCachedViewById
// 7 INVOKEVIRTUAL // 1 public _\$_clearFindViewByIdCache
// 3 CHECKCAST // 1 INVOKEVIRTUAL com/myapp/MyFragment\.getView
// 3 _\$_findCachedViewById // 2 GETSTATIC com/myapp/R\$id\.MyButton
// 1 findViewById // 2 INVOKEVIRTUAL com/myapp/MyFragment\._\$_findCachedViewById
// 1 getView // 2 CHECKCAST android/widget/Button
@@ -8,8 +8,8 @@ class MyActivity: Activity() {
val button2 = MyButton val button2 = MyButton
} }
// 2 GETSTATIC // 1 public _\$_findCachedViewById
// 6 INVOKEVIRTUAL // 1 public _\$_clearFindViewByIdCache
// 3 CHECKCAST // 2 GETSTATIC com/myapp/R\$id\.MyButton
// 3 _\$_findCachedViewById // 2 INVOKEVIRTUAL com/myapp/MyActivity\._\$_findCachedViewById
// 1 findViewById // 2 CHECKCAST android/widget/Button
@@ -8,9 +8,9 @@ class MyFragment: Fragment() {
val button2 = MyButton val button2 = MyButton
} }
// 2 GETSTATIC // 1 public _\$_findCachedViewById
// 7 INVOKEVIRTUAL // 1 public _\$_clearFindViewByIdCache
// 3 CHECKCAST // 1 INVOKEVIRTUAL com/myapp/MyFragment\.getView
// 3 _\$_findCachedViewById // 2 GETSTATIC com/myapp/R\$id\.MyButton
// 1 findViewById // 2 INVOKEVIRTUAL com/myapp/MyFragment\._\$_findCachedViewById
// 1 getView // 2 CHECKCAST android/widget/Button
@@ -9,8 +9,9 @@ class MyActivity: Activity() {
val button1 = this.loginButton val button1 = this.loginButton
} }
// 2 GETSTATIC // 1 public _\$_findCachedViewById
// 6 INVOKEVIRTUAL // 1 public _\$_clearFindViewByIdCache
// 3 CHECKCAST // 1 GETSTATIC com/myapp/R\$id\.login : I
// 3 _\$_findCachedViewById // 1 GETSTATIC com/myapp/R\$id\.loginButton : I
// 1 findViewById // 2 INVOKEVIRTUAL com/myapp/MyActivity\._\$_findCachedViewById
// 2 CHECKCAST android/widget/Button
@@ -13,9 +13,11 @@ class MyFragment: Fragment() {
val button1 = this.loginButton val button1 = this.loginButton
} }
// 2 GETSTATIC // 2 public _\$_findCachedViewById
// 11 INVOKEVIRTUAL // 2 public _\$_clearFindViewByIdCache
// 4 CHECKCAST // 1 INVOKEVIRTUAL com/myapp/MyFragment\.getView
// 4 _\$_findCachedViewById // 1 GETSTATIC com/myapp/R\$id\.login : I
// 2 findViewById // 1 GETSTATIC com/myapp/R\$id\.loginButton : I
// 1 getView // 1 INVOKEVIRTUAL com/myapp/MyActivity\._\$_findCachedViewById
// 1 INVOKEVIRTUAL com/myapp/MyFragment\._\$_findCachedViewById
// 2 CHECKCAST android/widget/Button
@@ -9,8 +9,8 @@ public class MyActivity : Activity() {
{login} {login}
} }
// 1 GETSTATIC // 1 public _\$_findCachedViewById
// 5 INVOKEVIRTUAL // 1 public _\$_clearFindViewByIdCache
// 2 CHECKCAST // 1 GETSTATIC com/myapp/R\$id\.login
// 2 _\$_findCachedViewById // 1 INVOKEVIRTUAL com/myapp/MyActivity\._\$_findCachedViewById
// 1 findViewById // 1 CHECKCAST android/widget/Button
@@ -8,9 +8,9 @@ public class MyFragment : Fragment() {
{login} {login}
} }
// 1 GETSTATIC // 1 public _\$_findCachedViewById
// 6 INVOKEVIRTUAL // 1 public _\$_clearFindViewByIdCache
// 2 CHECKCAST // 1 INVOKEVIRTUAL com/myapp/MyFragment\.getView
// 2 _\$_findCachedViewById // 1 GETSTATIC com/myapp/R\$id\.login
// 1 findViewById // 1 INVOKEVIRTUAL com/myapp/MyFragment\._\$_findCachedViewById
// 1 getView // 1 CHECKCAST android/widget/Button
@@ -8,8 +8,10 @@ public class MyActivity : Activity() {
{ View(this).login } { View(this).login }
} }
// 1 GETSTATIC // 1 public _\$_findCachedViewById
// 5 INVOKEVIRTUAL // 1 INVOKEVIRTUAL com/myapp/MyActivity\.findViewById
// 3 CHECKCAST // 1 public _\$_clearFindViewByIdCache
// 1 _\$_findCachedViewById // 1 GETSTATIC com/myapp/R\$id\.login
// 2 findViewById // 1 INVOKEVIRTUAL android/view/View\.findViewById
// 0 INVOKEVIRTUAL com/myapp/MyActivity\._\$_findCachedViewById
// 1 CHECKCAST android/widget/Button
@@ -66,18 +66,6 @@ public class AndroidBytecodeShapeTestGenerated extends AbstractAndroidBytecodeSh
doTest(fileName); doTest(fileName);
} }
@TestMetadata("extensionFunctionsBaseClass")
public void testExtensionFunctionsBaseClass() throws Exception {
String fileName = JetTestUtils.navigationMetadata("plugins/android-compiler-plugin/testData/codegen/bytecodeShape/extensionFunctionsBaseClass/");
doTest(fileName);
}
@TestMetadata("extensionFunctionsBaseClassFragment")
public void testExtensionFunctionsBaseClassFragment() throws Exception {
String fileName = JetTestUtils.navigationMetadata("plugins/android-compiler-plugin/testData/codegen/bytecodeShape/extensionFunctionsBaseClassFragment/");
doTest(fileName);
}
@TestMetadata("extensionFunctionsFragment") @TestMetadata("extensionFunctionsFragment")
public void testExtensionFunctionsFragment() throws Exception { public void testExtensionFunctionsFragment() throws Exception {
String fileName = JetTestUtils.navigationMetadata("plugins/android-compiler-plugin/testData/codegen/bytecodeShape/extensionFunctionsFragment/"); String fileName = JetTestUtils.navigationMetadata("plugins/android-compiler-plugin/testData/codegen/bytecodeShape/extensionFunctionsFragment/");