SLING-10677 add support for using an enum class via the Java Use-API (#13)
diff --git a/pom.xml b/pom.xml
index 766d643..a1bb598 100644
--- a/pom.xml
+++ b/pom.xml
@@ -147,7 +147,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.scripting.sightly.runtime</artifactId>
- <version>1.2.4-1.4.0</version>
+ <version>1.2.6-1.4.0</version>
<scope>provided</scope>
</dependency>
diff --git a/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/JavaUseProvider.java b/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/JavaUseProvider.java
index 28560d6..c1f70cd 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/JavaUseProvider.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/JavaUseProvider.java
@@ -214,6 +214,9 @@
LOG.debug("Won't attempt to instantiate an interface or abstract class {}", cls.getName());
return ProviderOutcome.failure(new IllegalArgumentException(String.format(" %s represents an interface or an abstract " +
"class which cannot be instantiated.", cls.getName())));
+ } else if (cls.isEnum()) {
+ // for enum, just return the class
+ return ProviderOutcome.success(cls);
} else {
/*
* the object was cached by the class loader but it's not adaptable from {@link Resource} or {@link