Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
c088e423
Commit
c088e423
authored
May 30, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(internal) _miraiContentToString: Ignore transient properties
parent
a5f9504b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
2 deletions
+26
-2
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/contentToString.kt
...kotlin/net/mamoe/mirai/qqandroid/utils/contentToString.kt
+10
-1
mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/setVisible.kt
...Main/kotlin/net/mamoe/mirai/qqandroid/utils/setVisible.kt
+16
-1
No files found.
mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/utils/contentToString.kt
View file @
c088e423
...
...
@@ -11,6 +11,7 @@
package
net.mamoe.mirai.qqandroid.utils
import
kotlinx.serialization.Transient
import
net.mamoe.mirai.utils.DefaultLogger
import
net.mamoe.mirai.utils.debug
import
kotlin.reflect.KClass
...
...
@@ -210,5 +211,13 @@ private fun Any.allMembersFromSuperClassesMatching(classFilter: (KClass<out Any>
.
map
{
it
.
members
}
.
flatMap
{
it
.
asSequence
()
}
.
filterIsInstance
<
KProperty1
<
*
,
*
>>()
.
filterNot
{
it
.
hasAnnotation
<
Transient
>()
}
.
filterNot
{
it
.
isTransient
()
}
.
mapNotNull
{
it
as
KProperty1
<
Any
,
*
>
}
}
\ No newline at end of file
}
@Suppress
(
"EXTENSION_SHADOWED_BY_MEMBER"
)
internal
expect
inline
fun
<
reified
T
:
Annotation
>
KProperty
<*>.
hasAnnotation
():
Boolean
@Suppress
(
"EXTENSION_SHADOWED_BY_MEMBER"
)
internal
expect
fun
KProperty
<*>.
isTransient
():
Boolean
\ No newline at end of file
mirai-core-qqandroid/src/jvmMain/kotlin/net/mamoe/mirai/qqandroid/utils/setVisible.kt
View file @
c088e423
package
net.mamoe.mirai.qqandroid.utils
import
java.lang.reflect.Modifier
import
kotlin.reflect.KProperty
import
kotlin.reflect.KProperty1
import
kotlin.reflect.full.findAnnotation
import
kotlin.reflect.jvm.javaField
internal
actual
fun
KProperty1
<*,
*>.
getValueAgainstPermission
(
receiver
:
Any
):
Any
?
{
return
this
.
javaField
?.
apply
{
isAccessible
=
true
}
?.
get
(
receiver
)
}
\ No newline at end of file
}
// on JVM, it will be resolved to member function
@Suppress
(
"EXTENSION_SHADOWED_BY_MEMBER"
)
actual
internal
inline
fun
<
reified
T
:
Annotation
>
KProperty
<*>.
hasAnnotation
():
Boolean
=
findAnnotation
<
T
>()
!=
null
// on JVM, it will be resolved to member function
@Suppress
(
"EXTENSION_SHADOWED_BY_MEMBER"
)
actual
internal
fun
KProperty
<*>.
isTransient
():
Boolean
=
javaField
?.
modifiers
?.
and
(
Modifier
.
TRANSIENT
)
!=
0
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment