diff options
author | chibash <chiba@javassist.org> | 2019-09-23 22:12:42 +0900 |
---|---|---|
committer | chibash <chiba@javassist.org> | 2019-09-23 22:12:42 +0900 |
commit | 855ca0050a41abde84f116a0b9b6e9bb13a5ccb1 (patch) | |
tree | 3fa95934b71446c7974f402288b5382e3c7986d2 | |
parent | c78e17c67f172a6e07253314d78800ce3979f09a (diff) | |
download | javassist-855ca0050a41abde84f116a0b9b6e9bb13a5ccb1.tar.gz javassist-855ca0050a41abde84f116a0b9b6e9bb13a5ccb1.zip |
adds CtClass#isKotlin() for PR #276
-rw-r--r-- | src/main/javassist/CtBehavior.java | 5 | ||||
-rw-r--r-- | src/main/javassist/CtClass.java | 8 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/main/javassist/CtBehavior.java b/src/main/javassist/CtBehavior.java index fd3dac96..da7cff04 100644 --- a/src/main/javassist/CtBehavior.java +++ b/src/main/javassist/CtBehavior.java @@ -858,6 +858,11 @@ public abstract class CtBehavior extends CtMember { * generate the original bytecode. * The other <code>insertAfter</code> methods calls this method * with <code>false</code> for this parameter. + * A tip is to pass <code>this.getDeclaringClass().isKotlin()</code> + * to this parameter. + * + * @see CtClass#isKotlin() + * @see #getDeclaringClass() * @since 3.26 */ public void insertAfter(String src, boolean asFinally, boolean redundant) diff --git a/src/main/javassist/CtClass.java b/src/main/javassist/CtClass.java index 09cf4b3e..a215246b 100644 --- a/src/main/javassist/CtClass.java +++ b/src/main/javassist/CtClass.java @@ -333,6 +333,14 @@ public abstract class CtClass { } /** + * Returns <code>true</code> if this object represents a Kotlin class. + * @since 3.26 + */ + public boolean isKotlin() { + return hasAnnotation("kotlin.Metadata"); + } + + /** * If this object represents an array, this method returns the component * type of the array. Otherwise, it returns <code>null</code>. */ |