Remove dependency on glassfish-servlet-api

This commit is contained in:
Marian Koncek 2019-09-16 11:05:31 +02:00
parent 8186fa5548
commit f074da854d
2 changed files with 102 additions and 1 deletions

View File

@ -0,0 +1,98 @@
From b14ee1ef509d9717eaa29e672282901847f2f735 Mon Sep 17 00:00:00 2001
From: Marian Koncek <mkoncek@redhat.com>
Date: Mon, 16 Sep 2019 10:48:10 +0200
Subject: [PATCH] Remove dependency on glassfish-servlet-api
---
.../eclipse/sisu/inject/Implementations.java | 56 +------------------
1 file changed, 1 insertion(+), 55 deletions(-)
diff --git a/sisu-inject/org.eclipse.sisu.inject/src/org/eclipse/sisu/inject/Implementations.java b/sisu-inject/org.eclipse.sisu.inject/src/org/eclipse/sisu/inject/Implementations.java
index 523c9b2..89db5da 100644
--- a/sisu-inject/org.eclipse.sisu.inject/src/org/eclipse/sisu/inject/Implementations.java
+++ b/sisu-inject/org.eclipse.sisu.inject/src/org/eclipse/sisu/inject/Implementations.java
@@ -38,17 +38,6 @@ final class Implementations
static
{
- boolean hasGuiceServlet;
- try
- {
- hasGuiceServlet = BindingTargetVisitor.class.isInstance( ServletFinder.THIS );
- }
- catch ( final LinkageError e )
- {
- hasGuiceServlet = false;
- }
- HAS_GUICE_SERVLET = hasGuiceServlet;
-
boolean hasJsr250Priority;
try
{
@@ -65,8 +54,6 @@ final class Implementations
// Constants
// ----------------------------------------------------------------------
- private static final boolean HAS_GUICE_SERVLET;
-
private static final boolean HAS_JSR250_PRIORITY;
// ----------------------------------------------------------------------
@@ -106,7 +93,7 @@ final class Implementations
// peek behind servlet/filter extension bindings when checking priority, so we can order them by rank
final Class<?> implementation =
- binding.acceptTargetVisitor( HAS_GUICE_SERVLET && isPriority ? ServletFinder.THIS : ClassFinder.THIS );
+ binding.acceptTargetVisitor( ClassFinder.THIS );
T annotation = null;
if ( null != implementation )
@@ -215,45 +202,4 @@ final class Implementations
return binding.getPrivateElements().getInjector().getBinding( binding.getKey() ).acceptTargetVisitor( this );
}
}
-
- /**
- * {@link ClassFinder} that can also peek behind servlet/filter bindings.
- */
- static final class ServletFinder
- extends ClassFinder
- implements com.google.inject.servlet.ServletModuleTargetVisitor<Object, Class<?>>
- {
- // ----------------------------------------------------------------------
- // Constants
- // ----------------------------------------------------------------------
-
- @SuppressWarnings( "hiding" )
- static final BindingTargetVisitor<Object, Class<?>> THIS = new ServletFinder();
-
- // ----------------------------------------------------------------------
- // Public methods
- // ----------------------------------------------------------------------
-
- public Class<?> visit( final com.google.inject.servlet.InstanceFilterBinding binding )
- {
- return binding.getFilterInstance().getClass();
- }
-
- public Class<?> visit( final com.google.inject.servlet.InstanceServletBinding binding )
- {
- return binding.getServletInstance().getClass();
- }
-
- public Class<?> visit( final com.google.inject.servlet.LinkedFilterBinding binding )
- {
- // this assumes only one level of indirection: api-->impl
- return binding.getLinkedKey().getTypeLiteral().getRawType();
- }
-
- public Class<?> visit( final com.google.inject.servlet.LinkedServletBinding binding )
- {
- // this assumes only one level of indirection: api-->impl
- return binding.getLinkedKey().getTypeLiteral().getRawType();
- }
- }
}
--
2.21.0

View File

@ -18,6 +18,7 @@ Source102: sisu-plexus.pom
Patch0: sisu-OSGi-import-guava.patch
Patch2: sisu-ignored-tests.patch
Patch3: sisu-osgi-api.patch
Patch4: 0001-Remove-dependency-on-glassfish-servlet-api.patch
BuildRequires: maven-local
BuildRequires: mvn(com.google.inject.extensions:guice-servlet)
@ -25,7 +26,6 @@ BuildRequires: mvn(com.google.inject:guice::no_aop:)
BuildRequires: mvn(javax.annotation:javax.annotation-api)
BuildRequires: %{?module_prefix}mvn(javax.enterprise:cdi-api)
BuildRequires: mvn(javax.inject:javax.inject)
BuildRequires: mvn(javax.servlet:servlet-api)
BuildRequires: mvn(junit:junit)
BuildRequires: %{?module_prefix}mvn(org.codehaus.plexus:plexus-classworlds)
BuildRequires: %{?module_prefix}mvn(org.codehaus.plexus:plexus-component-annotations)
@ -55,6 +55,9 @@ cp %{SOURCE102} sisu-plexus/pom.xml
%patch0
%patch2
%patch3
%patch4 -p1
%pom_remove_dep :servlet-api sisu-inject
%pom_xpath_set -r /pom:project/pom:version %{version}