style: optimize code

This commit is contained in:
2023-09-22 17:12:28 +08:00
parent bfcad65dc8
commit 0d386153a2
15 changed files with 135 additions and 32 deletions

View File

@@ -26,7 +26,7 @@
* This file is created by fankes on 2022/4/3. * This file is created by fankes on 2022/4/3.
* This file is Modified by fankes on 2023/1/21. * This file is Modified by fankes on 2023/1/21.
*/ */
@file:Suppress("OPT_IN_IS_NOT_ENABLED", "EXPERIMENTAL_IS_NOT_ENABLED", "unused") @file:Suppress("unused")
package com.highcapable.yukireflection.annotation package com.highcapable.yukireflection.annotation

View File

@@ -26,7 +26,7 @@
* This file is created by fankes on 2022/4/3. * This file is created by fankes on 2022/4/3.
* This file is Modified by fankes on 2023/1/21. * This file is Modified by fankes on 2023/1/21.
*/ */
@file:Suppress("OPT_IN_IS_NOT_ENABLED", "EXPERIMENTAL_IS_NOT_ENABLED") @file:Suppress("unused")
package com.highcapable.yukireflection.annotation package com.highcapable.yukireflection.annotation

View File

@@ -150,7 +150,7 @@ class CurrentClass @PublishedApi internal constructor(@PublishedApi internal val
inline fun method(initiate: MethodConditions) = inline fun method(initiate: MethodConditions) =
superClassSet.method(initiate).result { if (isShutErrorPrinting) ignored() }.get(instance) superClassSet.method(initiate).result { if (isShutErrorPrinting) ignored() }.get(instance)
override fun toString() = "CurrentClass super [${superClassSet}]" override fun toString() = "CurrentClass super [$superClassSet]"
} }
override fun toString() = "CurrentClass [$classSet]" override fun toString() = "CurrentClass [$classSet]"

View File

@@ -39,10 +39,36 @@ import com.highcapable.yukireflection.finder.members.ConstructorFinder
import com.highcapable.yukireflection.finder.members.FieldFinder import com.highcapable.yukireflection.finder.members.FieldFinder
import com.highcapable.yukireflection.finder.members.MethodFinder import com.highcapable.yukireflection.finder.members.MethodFinder
import com.highcapable.yukireflection.finder.tools.ReflectionTool import com.highcapable.yukireflection.finder.tools.ReflectionTool
import com.highcapable.yukireflection.finder.type.factory.* import com.highcapable.yukireflection.finder.type.factory.ClassConditions
import com.highcapable.yukireflection.type.java.* import com.highcapable.yukireflection.finder.type.factory.ConstructorConditions
import com.highcapable.yukireflection.finder.type.factory.FieldConditions
import com.highcapable.yukireflection.finder.type.factory.MethodConditions
import com.highcapable.yukireflection.finder.type.factory.ModifierConditions
import com.highcapable.yukireflection.type.java.AnyClass
import com.highcapable.yukireflection.type.java.BooleanClass
import com.highcapable.yukireflection.type.java.BooleanType
import com.highcapable.yukireflection.type.java.ByteClass
import com.highcapable.yukireflection.type.java.ByteType
import com.highcapable.yukireflection.type.java.CharClass
import com.highcapable.yukireflection.type.java.CharType
import com.highcapable.yukireflection.type.java.DoubleClass
import com.highcapable.yukireflection.type.java.DoubleType
import com.highcapable.yukireflection.type.java.FloatClass
import com.highcapable.yukireflection.type.java.FloatType
import com.highcapable.yukireflection.type.java.IntClass
import com.highcapable.yukireflection.type.java.IntType
import com.highcapable.yukireflection.type.java.LongClass
import com.highcapable.yukireflection.type.java.LongType
import com.highcapable.yukireflection.type.java.ShortClass
import com.highcapable.yukireflection.type.java.ShortType
import com.highcapable.yukireflection.type.java.UnitClass
import com.highcapable.yukireflection.type.java.UnitType
import dalvik.system.BaseDexClassLoader import dalvik.system.BaseDexClassLoader
import java.lang.reflect.* import java.lang.reflect.Constructor
import java.lang.reflect.Field
import java.lang.reflect.Member
import java.lang.reflect.Method
import java.lang.reflect.ParameterizedType
/** /**
* 写出当前 [ClassLoader] 下所有 [Class] 名称数组 * 写出当前 [ClassLoader] 下所有 [Class] 名称数组

View File

@@ -34,7 +34,11 @@ import com.highcapable.yukireflection.bean.VariousClass
import com.highcapable.yukireflection.finder.classes.rules.base.BaseRules import com.highcapable.yukireflection.finder.classes.rules.base.BaseRules
import com.highcapable.yukireflection.finder.classes.rules.result.MemberRulesResult import com.highcapable.yukireflection.finder.classes.rules.result.MemberRulesResult
import com.highcapable.yukireflection.finder.members.data.MethodRulesData import com.highcapable.yukireflection.finder.members.data.MethodRulesData
import com.highcapable.yukireflection.finder.type.factory.* import com.highcapable.yukireflection.finder.type.factory.CountConditions
import com.highcapable.yukireflection.finder.type.factory.ModifierConditions
import com.highcapable.yukireflection.finder.type.factory.NameConditions
import com.highcapable.yukireflection.finder.type.factory.ObjectConditions
import com.highcapable.yukireflection.finder.type.factory.ObjectsConditions
import com.highcapable.yukireflection.type.defined.UndefinedType import com.highcapable.yukireflection.type.defined.UndefinedType
import com.highcapable.yukireflection.type.defined.VagueType import com.highcapable.yukireflection.type.defined.VagueType
import java.lang.reflect.Method import java.lang.reflect.Method

View File

@@ -37,7 +37,12 @@ import com.highcapable.yukireflection.finder.base.BaseFinder
import com.highcapable.yukireflection.finder.base.MemberBaseFinder import com.highcapable.yukireflection.finder.base.MemberBaseFinder
import com.highcapable.yukireflection.finder.members.data.MethodRulesData import com.highcapable.yukireflection.finder.members.data.MethodRulesData
import com.highcapable.yukireflection.finder.tools.ReflectionTool import com.highcapable.yukireflection.finder.tools.ReflectionTool
import com.highcapable.yukireflection.finder.type.factory.* import com.highcapable.yukireflection.finder.type.factory.CountConditions
import com.highcapable.yukireflection.finder.type.factory.MethodConditions
import com.highcapable.yukireflection.finder.type.factory.ModifierConditions
import com.highcapable.yukireflection.finder.type.factory.NameConditions
import com.highcapable.yukireflection.finder.type.factory.ObjectConditions
import com.highcapable.yukireflection.finder.type.factory.ObjectsConditions
import com.highcapable.yukireflection.log.yLoggerW import com.highcapable.yukireflection.log.yLoggerW
import com.highcapable.yukireflection.type.defined.UndefinedType import com.highcapable.yukireflection.type.defined.UndefinedType
import com.highcapable.yukireflection.type.defined.VagueType import com.highcapable.yukireflection.type.defined.VagueType

View File

@@ -32,7 +32,12 @@ package com.highcapable.yukireflection.finder.tools
import android.util.ArrayMap import android.util.ArrayMap
import com.highcapable.yukireflection.YukiReflection import com.highcapable.yukireflection.YukiReflection
import com.highcapable.yukireflection.factory.* import com.highcapable.yukireflection.factory.classOf
import com.highcapable.yukireflection.factory.current
import com.highcapable.yukireflection.factory.field
import com.highcapable.yukireflection.factory.hasClass
import com.highcapable.yukireflection.factory.hasExtends
import com.highcapable.yukireflection.factory.toClass
import com.highcapable.yukireflection.finder.base.data.BaseRulesData import com.highcapable.yukireflection.finder.base.data.BaseRulesData
import com.highcapable.yukireflection.finder.classes.data.ClassRulesData import com.highcapable.yukireflection.finder.classes.data.ClassRulesData
import com.highcapable.yukireflection.finder.members.data.ConstructorRulesData import com.highcapable.yukireflection.finder.members.data.ConstructorRulesData
@@ -46,13 +51,19 @@ import com.highcapable.yukireflection.type.java.DalvikBaseDexClassLoader
import com.highcapable.yukireflection.type.java.NoClassDefFoundErrorClass import com.highcapable.yukireflection.type.java.NoClassDefFoundErrorClass
import com.highcapable.yukireflection.type.java.NoSuchFieldErrorClass import com.highcapable.yukireflection.type.java.NoSuchFieldErrorClass
import com.highcapable.yukireflection.type.java.NoSuchMethodErrorClass import com.highcapable.yukireflection.type.java.NoSuchMethodErrorClass
import com.highcapable.yukireflection.utils.* import com.highcapable.yukireflection.utils.conditions
import com.highcapable.yukireflection.utils.findLastIndex
import com.highcapable.yukireflection.utils.lastIndex
import com.highcapable.yukireflection.utils.let
import com.highcapable.yukireflection.utils.runOrFalse
import com.highcapable.yukireflection.utils.takeIf
import com.highcapable.yukireflection.utils.value
import dalvik.system.BaseDexClassLoader import dalvik.system.BaseDexClassLoader
import java.lang.reflect.Constructor import java.lang.reflect.Constructor
import java.lang.reflect.Field import java.lang.reflect.Field
import java.lang.reflect.Member import java.lang.reflect.Member
import java.lang.reflect.Method import java.lang.reflect.Method
import java.util.* import java.util.Enumeration
import kotlin.math.abs import kotlin.math.abs
/** /**

View File

@@ -30,7 +30,7 @@
package com.highcapable.yukireflection.type.android package com.highcapable.yukireflection.type.android
import android.app.* import android.app.* // ktlint-disable no-wildcard-imports
import android.appwidget.AppWidgetHost import android.appwidget.AppWidgetHost
import android.appwidget.AppWidgetManager import android.appwidget.AppWidgetManager
import android.appwidget.AppWidgetProvider import android.appwidget.AppWidgetProvider

View File

@@ -30,10 +30,33 @@
package com.highcapable.yukireflection.type.android package com.highcapable.yukireflection.type.android
import android.graphics.* import android.graphics.Bitmap
import android.graphics.drawable.* import android.graphics.BitmapFactory
import android.graphics.Canvas
import android.graphics.ColorMatrix
import android.graphics.ColorMatrixColorFilter
import android.graphics.Matrix
import android.graphics.NinePatch
import android.graphics.Outline
import android.graphics.Paint
import android.graphics.Point
import android.graphics.PointF
import android.graphics.Rect
import android.graphics.RectF
import android.graphics.Typeface
import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import android.graphics.drawable.Icon
import android.os.Build import android.os.Build
import android.text.* import android.text.Editable
import android.text.GetChars
import android.text.Spannable
import android.text.SpannableStringBuilder
import android.text.TextPaint
import android.text.TextUtils
import android.text.TextWatcher
import android.util.Size import android.util.Size
import android.util.SizeF import android.util.SizeF
import com.highcapable.yukireflection.factory.classOf import com.highcapable.yukireflection.factory.classOf

View File

@@ -30,17 +30,51 @@
package com.highcapable.yukireflection.type.android package com.highcapable.yukireflection.type.android
import android.animation.* import android.animation.Animator
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.animation.PropertyValuesHolder
import android.animation.ValueAnimator
import android.appwidget.AppWidgetHostView import android.appwidget.AppWidgetHostView
import android.util.AttributeSet import android.util.AttributeSet
import android.view.* import android.view.GestureDetector
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.Surface
import android.view.SurfaceView
import android.view.TextureView
import android.view.View
import android.view.ViewGroup
import android.view.ViewParent
import android.view.ViewPropertyAnimator
import android.view.ViewStructure
import android.view.ViewStub
import android.view.animation.AlphaAnimation import android.view.animation.AlphaAnimation
import android.view.animation.Animation import android.view.animation.Animation
import android.view.animation.TranslateAnimation import android.view.animation.TranslateAnimation
import android.webkit.WebView import android.webkit.WebView
import android.webkit.WebViewClient import android.webkit.WebViewClient
import android.widget.* import android.widget.ArrayAdapter
import android.widget.AutoCompleteTextView
import android.widget.BaseAdapter
import android.widget.Button
import android.widget.CheckBox
import android.widget.CompoundButton
import android.widget.EditText
import android.widget.FrameLayout
import android.widget.ImageButton
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.ListAdapter
import android.widget.ListView
import android.widget.ProgressBar
import android.widget.RelativeLayout
import android.widget.RemoteViews
import android.widget.RemoteViews.RemoteView import android.widget.RemoteViews.RemoteView
import android.widget.TextClock
import android.widget.TextView
import android.widget.VideoView
import android.widget.ViewAnimator
import com.highcapable.yukireflection.factory.classOf import com.highcapable.yukireflection.factory.classOf
/** /**

View File

@@ -40,7 +40,7 @@ import dalvik.system.InMemoryDexClassLoader
import dalvik.system.PathClassLoader import dalvik.system.PathClassLoader
import org.json.JSONArray import org.json.JSONArray
import org.json.JSONObject import org.json.JSONObject
import java.io.* import java.io.* // ktlint-disable no-wildcard-imports
import java.lang.ref.Reference import java.lang.ref.Reference
import java.lang.ref.WeakReference import java.lang.ref.WeakReference
import java.lang.reflect.Constructor import java.lang.reflect.Constructor