aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorchibash <chiba@javassist.org>2019-09-23 22:12:42 +0900
committerchibash <chiba@javassist.org>2019-09-23 22:12:42 +0900
commit855ca0050a41abde84f116a0b9b6e9bb13a5ccb1 (patch)
tree3fa95934b71446c7974f402288b5382e3c7986d2 /src
parentc78e17c67f172a6e07253314d78800ce3979f09a (diff)
downloadjavassist-855ca0050a41abde84f116a0b9b6e9bb13a5ccb1.tar.gz
javassist-855ca0050a41abde84f116a0b9b6e9bb13a5ccb1.zip
adds CtClass#isKotlin() for PR #276
Diffstat (limited to 'src')
-rw-r--r--src/main/javassist/CtBehavior.java5
-rw-r--r--src/main/javassist/CtClass.java8
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>.
*/