Merge branch 'master' into experimental-scripting-resolver
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..0fa18e5
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,22 @@
+<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+Apache Software Foundation Code of Conduct
+====
+
+Being an Apache project, Apache Sling adheres to the Apache Software Foundation's [Code of Conduct](https://www.apache.org/foundation/policies/conduct.html).
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..ac82a1a
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,24 @@
+<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+Contributing
+====
+
+Thanks for choosing to contribute!
+
+You will find all the necessary details about how you can do this at https://sling.apache.org/contributing.html.
diff --git a/pom.xml b/pom.xml
index aa9a022..f5ed0b7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,7 +37,7 @@
         The versioning scheme defined here corresponds to SLING-7406 (<module_version>-<htl_specification_version>). Take care when
         releasing to only increase the first part, unless the module provides support for a newer version of the HTL specification.
     -->
-    <version>1.0.55-1.4.0-exp-SNAPSHOT</version>
+    <version>1.0.57-1.4.0-exp-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
     <name>Apache Sling Scripting HTL Engine</name>
@@ -172,13 +172,13 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.scripting.sightly.compiler</artifactId>
-            <version>1.0.23-1.4.0-SNAPSHOT</version>
+            <version>1.0.22-1.4.0</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.scripting.sightly.compiler.java</artifactId>
-            <version>1.0.25-1.4.0-SNAPSHOT</version>
+            <version>1.0.26-1.4.0</version>
             <scope>provided</scope>
         </dependency>
 
@@ -280,9 +280,9 @@
         </dependency>
 
         <dependency>
-            <groupId>com.google.code.findbugs</groupId>
-            <artifactId>jsr305</artifactId>
-            <version>3.0.0</version>
+            <groupId>org.jetbrains</groupId>
+            <artifactId>annotations</artifactId>
+            <version>16.0.2</version>
             <scope>provided</scope>
         </dependency>
 
diff --git a/src/main/java/org/apache/sling/scripting/sightly/impl/engine/ResourceBackedPojoChangeMonitor.java b/src/main/java/org/apache/sling/scripting/sightly/impl/engine/ResourceBackedPojoChangeMonitor.java
index d784df2..1070089 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/impl/engine/ResourceBackedPojoChangeMonitor.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/impl/engine/ResourceBackedPojoChangeMonitor.java
@@ -21,12 +21,11 @@
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
-import javax.annotation.Nonnull;
-
 import org.apache.sling.api.resource.observation.ExternalResourceChangeListener;
 import org.apache.sling.api.resource.observation.ResourceChange;
 import org.apache.sling.api.resource.observation.ResourceChangeListener;
 import org.apache.sling.scripting.sightly.SightlyException;
+import org.jetbrains.annotations.NotNull;
 import org.osgi.service.component.annotations.Component;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -73,7 +72,7 @@
     }
 
     @Override
-    public void onChange(@Nonnull List<ResourceChange> changes) {
+    public void onChange(@NotNull List<ResourceChange> changes) {
         for (ResourceChange change : changes) {
             String path = change.getPath();
             ResourceChange.ChangeType changeType = change.getType();
diff --git a/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/URIManipulationFilterExtension.java b/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/URIManipulationFilterExtension.java
index ed5b591..e5a6b03 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/URIManipulationFilterExtension.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/URIManipulationFilterExtension.java
@@ -32,8 +32,6 @@
 import java.util.List;
 import java.util.Map;
 
-import javax.annotation.Nonnull;
-
 import org.apache.commons.lang3.StringUtils;
 import org.apache.sling.api.request.RequestPathInfo;
 import org.apache.sling.api.resource.Resource;
@@ -42,6 +40,7 @@
 import org.apache.sling.scripting.sightly.extension.RuntimeExtension;
 import org.apache.sling.scripting.sightly.render.RenderContext;
 import org.apache.sling.scripting.sightly.render.RuntimeObjectModel;
+import org.jetbrains.annotations.NotNull;
 import org.osgi.service.component.annotations.Component;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -461,7 +460,7 @@
         }
 
         @Override
-        @Nonnull
+        @NotNull
         public String getResourcePath() {
             return resourcePath;
         }
@@ -502,7 +501,7 @@
         }
 
         @Override
-        @Nonnull
+        @NotNull
         public String[] getSelectors() {
             return selectors.toArray(new String[]{});
         }
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 8f5aa76..308ccec 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
@@ -18,6 +18,7 @@
  ******************************************************************************/
 package org.apache.sling.scripting.sightly.impl.engine.extension.use;
 
+import java.lang.reflect.Modifier;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -129,6 +130,9 @@
                 }
                 if (result != null) {
                     return ProviderOutcome.success(result);
+                } else if(cls.isInterface() || Modifier.isAbstract(cls.getModifiers())){
+                    LOG.debug("Wont attempt to instantiate an interface or abstract class {}",cls.getName());
+                    return ProviderOutcome.failure();
                 } else {
                     /*
                      * the object was cached by the class loader but it's not adaptable from {@link Resource} or {@link
diff --git a/src/test/java/org/apache/sling/scripting/sightly/impl/engine/runtime/SlingRuntimeObjectModelTest.java b/src/test/java/org/apache/sling/scripting/sightly/impl/engine/runtime/SlingRuntimeObjectModelTest.java
index e396c2a..8a97adb 100644
--- a/src/test/java/org/apache/sling/scripting/sightly/impl/engine/runtime/SlingRuntimeObjectModelTest.java
+++ b/src/test/java/org/apache/sling/scripting/sightly/impl/engine/runtime/SlingRuntimeObjectModelTest.java
@@ -19,12 +19,11 @@
 package org.apache.sling.scripting.sightly.impl.engine.runtime;
 
 import java.util.HashMap;
-import javax.annotation.CheckForNull;
-import javax.annotation.Nonnull;
-
 import org.apache.sling.api.adapter.Adaptable;
 import org.apache.sling.api.resource.ValueMap;
 import org.apache.sling.api.wrappers.ValueMapDecorator;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 import org.junit.Test;
 
 import static org.junit.Assert.*;
@@ -68,9 +67,9 @@
             }});
         }
 
-        @CheckForNull
+        @Nullable
         @Override
-        public <AdapterType> AdapterType adaptTo(@Nonnull Class<AdapterType> aClass) {
+        public <AdapterType> AdapterType adaptTo(@NotNull Class<AdapterType> aClass) {
             if (aClass == ValueMap.class) {
                 return (AdapterType) getValueMap();
             }