美文网首页
Lambda解析

Lambda解析

作者: SMSM | 来源:发表于2017-12-16 11:36 被阅读17次

    <init>与<clinit>的区别

    smali文件简要结构

    ————————————
    注解、属性、方法
    实例化过程 (class初始化、class实例化)
    获取变量、赋值、调用方法传递参数过程
    ———————————属性
    
    .class final synthetic Lcom/meituan/sankuai/erpboss/component/PickerDataManager$$Lambda$2;
    .super Ljava/lang/Object;
    
    # annotations
    .annotation system Ldalvik/annotation/Signature;
    
    # interfaces
    .implements Lrx/functions/Action1;
    
    # static fields
    .field public static final CITY:I = 0x2
    
    # instance fields
    .field private
    
    .field public mNameActivityUtil:Lcom/pitaya/findviewbyiddemo/NameActivityUtil;
        .annotation build Lcom/pitaya/findviewbyid_annotation/FindViewById;
            value = "com.pitaya.findviewbyiddemo.R.layout.activity_main"
        .end annotation
    .end field
    
    
    # direct methods
    .method static constructor <clinit>()V   用于类class初始化 静态变量,静态代码块中代码在这个时候执行
    
    .method private constructor <init>(Ljava/lang/String;ILandroid/content/Context;)V  用于实例化类先 调用父类构造函数 ——》自身中的属性字段被初始化 ——》自己在构造方法中的代码。
    ———————————
        mAllProvinces = getProvinceDatas(mAdministrativeRegionBean);
    
        invoke-direct {p0, v0}, Lcom/meituan/sankuai/erpboss/component/PickerDataManager;->getProvinceDatas(Lcom/meituan/sankuai/erpboss/location/bean/AdministrativeRegionBean;)Ljava/util/List;
    
        move-result-object v0
    
        iput-object v0, p0, Lcom/meituan/sankuai/erpboss/component/PickerDataManager;->mAllProvinces:Ljava/util/List;
    ———————————
    
       .class文件
    
    //
    // Source code recreated from a .class file by IntelliJ IDEA
    // (powered by Fernflower decompiler)
    //
    
    package com.meituan.sankuai.erpboss.component;
    
    import android.content.Context;
    import com.meituan.sankuai.erpboss.component.PickerDataManager;
    import com.meituan.sankuai.erpboss.network.ApiResponse;
    import rx.functions.Action1;
    
    // $FF: synthetic class
    final class PickerDataManager$$Lambda$5 implements Action1 {
        private final PickerDataManager arg$1;
        private final Context arg$2;
    
        private PickerDataManager$$Lambda$5(PickerDataManager var1, Context var2) {
            this.arg$1 = var1;
            this.arg$2 = var2;
        }
    
        private static Action1 get$Lambda(PickerDataManager var0, Context var1) {
            return new PickerDataManager$$Lambda$5(var0, var1);
        }
    
        public void call(Object var1) {
            PickerDataManager.access$lambda$2(this.arg$1, this.arg$2, (ApiResponse)var1);
        }
    
        public static Action1 lambdaFactory$(PickerDataManager var0, Context var1) {
            return new PickerDataManager$$Lambda$5(var0, var1);
        }
    }
    
        .smali文件
    
    .class final synthetic Lcom/meituan/sankuai/erpboss/component/PickerDataManager$$Lambda$3;
    .super Ljava/lang/Object;
    
    # interfaces
    .implements Lrx/functions/Action1;
    
    
    # instance fields
    .field private final arg$1:Lcom/meituan/sankuai/erpboss/component/PickerDataManager;
    
    .field private final arg$2:Landroid/content/Context;
    
    
    # direct methods
    .method private constructor <init>(Lcom/meituan/sankuai/erpboss/component/PickerDataManager;Landroid/content/Context;)V
        .locals 0
    
        invoke-direct {p0}, Ljava/lang/Object;-><init>()V
    
        iput-object p1, p0, Lcom/meituan/sankuai/erpboss/component/PickerDataManager$$Lambda$3;->arg$1:Lcom/meituan/sankuai/erpboss/component/PickerDataManager;
    
        iput-object p2, p0, Lcom/meituan/sankuai/erpboss/component/PickerDataManager$$Lambda$3;->arg$2:Landroid/content/Context;
    
        return-void
    .end method
    
    .method private static get$Lambda(Lcom/meituan/sankuai/erpboss/component/PickerDataManager;Landroid/content/Context;)Lrx/functions/Action1;
        .locals 1
    
        new-instance v0, Lcom/meituan/sankuai/erpboss/component/PickerDataManager$$Lambda$3;
    
        invoke-direct {v0, p0, p1}, Lcom/meituan/sankuai/erpboss/component/PickerDataManager$$Lambda$3;-><init>(Lcom/meituan/sankuai/erpboss/component/PickerDataManager;Landroid/content/Context;)V
    
        return-object v0
    .end method
    
    .method public static lambdaFactory$(Lcom/meituan/sankuai/erpboss/component/PickerDataManager;Landroid/content/Context;)Lrx/functions/Action1;
        .locals 1
    
        new-instance v0, Lcom/meituan/sankuai/erpboss/component/PickerDataManager$$Lambda$3;
    
        invoke-direct {v0, p0, p1}, Lcom/meituan/sankuai/erpboss/component/PickerDataManager$$Lambda$3;-><init>(Lcom/meituan/sankuai/erpboss/component/PickerDataManager;Landroid/content/Context;)V
    
        return-object v0
    .end method
    
    
    # virtual methods
    .method public call(Ljava/lang/Object;)V
        .locals 2
    
        iget-object v0, p0, Lcom/meituan/sankuai/erpboss/component/PickerDataManager$$Lambda$3;->arg$1:Lcom/meituan/sankuai/erpboss/component/PickerDataManager;
    
        iget-object v1, p0, Lcom/meituan/sankuai/erpboss/component/PickerDataManager$$Lambda$3;->arg$2:Landroid/content/Context;
    
        check-cast p1, Lcom/meituan/sankuai/erpboss/network/ApiResponse;
    
        invoke-static {v0, v1, p1}, Lcom/meituan/sankuai/erpboss/component/PickerDataManager;->access$lambda$2(Lcom/meituan/sankuai/erpboss/component/PickerDataManager;Landroid/content/Context;Lcom/meituan/sankuai/erpboss/network/ApiResponse;)V
    
        return-void
    .end method
    

    存在多个构造函数时,每个构造函数都存在一份相同的公共执行流程。

    屏幕快照 2017-12-15 下午11.35.10.png 屏幕快照 2017-12-15 下午11.35.38.png 屏幕快照 2017-12-15 下午11.36.30.png 屏幕快照 2017-12-15 下午11.36.40.png 屏幕快照 2017-12-15 下午11.40.16.png 屏幕快照 2017-12-15 下午11.54.34.png 屏幕快照 2017-12-15 下午11.55.01.png 屏幕快照 2017-12-16 上午12.11.19.png 屏幕快照 2017-12-16 上午12.23.08.png 屏幕快照 2017-12-16 上午12.23.26.png 屏幕快照 2017-12-16 上午12.23.42.png 屏幕快照 2017-12-16 上午12.24.08.png

    相关文章

      网友评论

          本文标题:Lambda解析

          本文链接:https://www.haomeiwen.com/subject/xvmjwxtx.html