pengwei1024 / LogUtils

More convenient and easy to use android Log manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

有些对象层级太多,根本打不完 打一定层数就该停止

tinybright opened this issue · comments

at com.apkfuns.logutils.utils.ObjectUtil.objectToString(ObjectUtil.java:32)
at com.apkfuns.logutils.utils.ObjectUtil.getClassFields(ObjectUtil.java:90)
at com.apkfuns.logutils.utils.ObjectUtil.objectToString(ObjectUtil.java:41)
at com.apkfuns.logutils.utils.ObjectUtil.getClassFields(ObjectUtil.java:90)
at com.apkfuns.logutils.utils.ObjectUtil.objectToString(ObjectUtil.java:41)
at com.apkfuns.logutils.utils.ObjectUtil.objectToString(ObjectUtil.java:22)
at com.apkfuns.logutils.parser.CollectionParse.parseString(CollectionParse.java:29)
at com.apkfuns.logutils.parser.CollectionParse.parseString(CollectionParse.java:12)
at com.apkfuns.logutils.utils.ObjectUtil.objectToString(ObjectUtil.java:32)
at com.apkfuns.logutils.utils.ObjectUtil.getClassFiel
04-22 13:30:02.592 24424-24442/com.protontek.vcare E/vcare/JobFragV1$7.onServicesDiscovered(JobFragV1.java:737): ds(ObjectUtil.java:90)
at com.apkfuns.logutils.utils.ObjectUtil.objectToString(ObjectUtil.java:41)
at com.apkfuns.logutils.utils.ObjectUtil.getClassFields(ObjectUtil.java:90)
at com.apkfuns.logutils.utils.ObjectUtil.objectToString(ObjectUtil.java:41)
at com.apkfuns.logutils.utils.ObjectUtil.objectToString(ObjectUtil.java:22)
at com.apkfuns.logutils.parser.CollectionParse.parseString(CollectionParse.java:29)
at com.apkfuns.logutils.parser.CollectionParse.parseString(CollectionParse.java:12)
at com.apkfuns.logutils.utils.ObjectUtil.objectToString(ObjectUtil.java:32)
at com.apkfuns.logutils.utils.ObjectUtil.getClassFields(ObjectUtil.java:90)
at com.apkfuns.logutils.utils.ObjectUtil.objectToString(ObjectUtil.java:41)
at com.apkfuns.logutils.utils.ObjectUtil.objectToString(ObjectUtil.java:22)
at com.apkfuns.logutils.parser.CollectionParse.parseString(CollectionParse.java:29)
at com.apkfuns.logutils.parser.CollectionParse.parseString(CollectionParse.java:12)
at com.apkfuns.logutils.utils.ObjectUtil.objectToString(ObjectUtil.java:32)
at com.apkfuns.logutils.utils.ObjectUtil.objectToString(ObjectUtil.java:22)
at com.apkfuns.logutils.Logger.logObject(Logger.java:97)
at com.apkfuns.logutils.Logger.e(Logger.java:161)
at com.apkfuns.logutils.LogUtils.e(LogUtils.java:108)
at com.protontek.vcare.ui.module.job.JobFragV1$7.onServicesDiscovered(JobFragV1.java:735)
at android.bluetooth.BluetoothGatt$1.onSearchComplete(BluetoothGatt.java:304)
at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:217)
at android.os.Binder.execTransact(Binder.java:453)

你是说继承层级吗?

image

我不确定。 但是这种是无限循环的

1.3.1版本貌似修复了这个问题 @tinybright 你可以试试

如果用属性储存内部类的List就会这样

public class FakeBounty {
    public List<A> mA = new ArrayList<>()

    public class  A {
        public A() {
            LogUtils.e("A");
        }
    }

    public FakeBounty() {
        for (int i = 0 ;i<20 ;i++){
            mA.add(new A());
        }
    }
}

LogUtils.e(new FakeBounty());

1.4.0版本已经解决这个问题,不是层级多的原因,而是内部类会持有外部类的一个对象,反射获取属性导致死循环了。 @tinybright 感谢@DrSlark提供解决方案