-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use box-impl function as factory for kotlin jvm inline class
- Loading branch information
Showing
2 changed files
with
12 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
src/main/java/com/fasterxml/jackson/databind/ext/KotlinSupport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
package com.fasterxml.jackson.databind.ext; | ||
|
||
import java.lang.reflect.Constructor; | ||
import java.lang.reflect.Method; | ||
import java.lang.reflect.Modifier; | ||
|
||
public class KotlinSupport { | ||
public static boolean isJvmInlineClassSyntheticConstructor(Constructor<?> ctor) { | ||
Class<?>[] params = ctor.getParameterTypes(); | ||
Class<?> lastParam = params[params.length - 1]; | ||
return ctor.isSynthetic() && lastParam.getName().equals("kotlin.jvm.internal.DefaultConstructorMarker"); | ||
} | ||
|
||
public static boolean isJvmInlineClassSyntheticBoxingFunction(Method method) { | ||
return Modifier.isStatic(method.getModifiers()) | ||
&& method.isSynthetic() | ||
&& method.getName().equals("box-impl"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters