Call findViewById if invoked on anything but our Activity class
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
package com.myapp
|
||||
|
||||
import android.app.Activity
|
||||
import kotlinx.android.synthetic.layout.*
|
||||
|
||||
fun Activity.a() {
|
||||
val x = login
|
||||
val y = this.login
|
||||
}
|
||||
|
||||
// 2 GETSTATIC
|
||||
// 2 INVOKEVIRTUAL
|
||||
// 2 CHECKCAST
|
||||
// 0 _\$_findCachedViewById
|
||||
// 2 findViewById
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<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>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
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 MyActivity.b() {
|
||||
val x = login
|
||||
val y = this.login
|
||||
}
|
||||
|
||||
// 2 GETSTATIC
|
||||
// 5 INVOKEVIRTUAL
|
||||
// 3 CHECKCAST
|
||||
// 3 _\$_findCachedViewById
|
||||
// 1 findViewById
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<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>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
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
|
||||
// 5 INVOKEVIRTUAL
|
||||
// 3 CHECKCAST
|
||||
// 1 _\$_findCachedViewById
|
||||
// 3 findViewById
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
<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>
|
||||
+6
-3
@@ -5,8 +5,11 @@ import kotlinx.android.synthetic.layout.*
|
||||
|
||||
class MyActivity: Activity() {
|
||||
val button = this.MyButton
|
||||
val button2 = MyButton
|
||||
}
|
||||
|
||||
// 1 GETSTATIC
|
||||
// 4 INVOKEVIRTUAL
|
||||
// 2 CHECKCAST
|
||||
// 2 GETSTATIC
|
||||
// 5 INVOKEVIRTUAL
|
||||
// 3 CHECKCAST
|
||||
// 3 _\$_findCachedViewById
|
||||
// 1 findViewById
|
||||
+6
-3
@@ -5,8 +5,11 @@ import kotlinx.android.synthetic.layout.*
|
||||
|
||||
class MyActivity: Activity() {
|
||||
val button = this.MyButton
|
||||
val button2 = MyButton
|
||||
}
|
||||
|
||||
// 1 GETSTATIC
|
||||
// 4 INVOKEVIRTUAL
|
||||
// 2 CHECKCAST
|
||||
// 2 GETSTATIC
|
||||
// 5 INVOKEVIRTUAL
|
||||
// 3 CHECKCAST
|
||||
// 3 _\$_findCachedViewById
|
||||
// 1 findViewById
|
||||
@@ -12,3 +12,5 @@ class MyActivity: Activity() {
|
||||
// 2 GETSTATIC
|
||||
// 5 INVOKEVIRTUAL
|
||||
// 3 CHECKCAST
|
||||
// 3 _\$_findCachedViewById
|
||||
// 1 findViewById
|
||||
@@ -12,3 +12,5 @@ public class MyActivity : Activity() {
|
||||
// 1 GETSTATIC
|
||||
// 4 INVOKEVIRTUAL
|
||||
// 2 CHECKCAST
|
||||
// 2 _\$_findCachedViewById
|
||||
// 1 findViewById
|
||||
Reference in New Issue
Block a user