From 5ce8b07fb417d11b4a8a739a2728ab56693b7ab4 Mon Sep 17 00:00:00 2001 From: Renaud Pawlak Date: Fri, 30 Oct 2020 14:15:26 +0100 Subject: [PATCH] add util method --- .../java/org/jsweet/transpiler/JSweetContext.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/transpiler/src/main/java/org/jsweet/transpiler/JSweetContext.java b/transpiler/src/main/java/org/jsweet/transpiler/JSweetContext.java index b79c105b..214cc0c0 100644 --- a/transpiler/src/main/java/org/jsweet/transpiler/JSweetContext.java +++ b/transpiler/src/main/java/org/jsweet/transpiler/JSweetContext.java @@ -1260,12 +1260,22 @@ public class JSweetContext extends Context { } /** - * Tells if the given type is a Java interface. + * Tells if the given type is an interface. */ public boolean isInterface(TypeSymbol typeSymbol) { return (typeSymbol.type.isInterface() || hasAnnotationType(typeSymbol, JSweetConfig.ANNOTATION_INTERFACE)); } + /** + * Tells if the given type is an interface. + */ + public boolean isInterface(Element element) { + if (element instanceof TypeSymbol) { + return isInterface((TypeSymbol)element); + } + return false; + } + /** * Tells if the given symbol is annotated with one of the given annotation * types.