Merge pull request #110 from benkard/bugfix/quarkus-flowscoped-no-passivation

MYFACES-7347 Rely on BeanManager to determine whether @FlowScoped is passivating.
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/FacesScopeBeanHolder.java b/impl/src/main/java/org/apache/myfaces/cdi/FacesScopeBeanHolder.java
index bf3f624..f450533 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/FacesScopeBeanHolder.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/FacesScopeBeanHolder.java
@@ -53,7 +53,7 @@
     public ContextualStorage getContextualStorage(BeanManager beanManager, FacesContext facesContext)
     {
         return (ContextualStorage) facesContext.getAttributes().computeIfAbsent(FACES_SCOPE_MAP,
-                k -> new ContextualStorage(beanManager, false, false));
+                k -> new ContextualStorage(beanManager, false));
     }
     
     public ContextualStorage getContextualStorageNoCreate(BeanManager beanManager, FacesContext facesContext)
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/util/ContextualStorage.java b/impl/src/main/java/org/apache/myfaces/cdi/util/ContextualStorage.java
index 7f9503f..a8190d2 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/util/ContextualStorage.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/util/ContextualStorage.java
@@ -48,18 +48,14 @@
 
     private final boolean concurrent;
 
-    private final boolean passivationCapable;
-
     /**
      * @param beanManager is needed for serialisation
      * @param concurrent whether the ContextualStorage might get accessed concurrently by different threads
-     * @param passivationCapable whether the storage is for passivation capable Scopes
      */
-    public ContextualStorage(BeanManager beanManager, boolean concurrent, boolean passivationCapable)
+    public ContextualStorage(BeanManager beanManager, boolean concurrent)
     {
         this.beanManager = beanManager;
         this.concurrent = concurrent;
-        this.passivationCapable = passivationCapable;
         if (concurrent)
         {
             contextualInstances = new ConcurrentHashMap<>();
@@ -146,7 +142,7 @@
      */
     public <T> Object getBeanKey(Contextual<T> bean)
     {
-        if (passivationCapable)
+        if (bean instanceof PassivationCapable)
         {
             // if the
             return ((PassivationCapable) bean).getId();
@@ -161,8 +157,9 @@
      */
     public Contextual<?> getBean(Object beanKey)
     {
-        if (passivationCapable)
+        if (beanKey instanceof String)
         {
+            // If the beanKey is a String, it was generated by PassivationCapable#getId().
             return beanManager.getPassivationCapableBean((String) beanKey);
         }
 
diff --git a/impl/src/main/java/org/apache/myfaces/cdi/view/ViewTransientScopeBeanHolder.java b/impl/src/main/java/org/apache/myfaces/cdi/view/ViewTransientScopeBeanHolder.java
index 39aa580..2506722 100644
--- a/impl/src/main/java/org/apache/myfaces/cdi/view/ViewTransientScopeBeanHolder.java
+++ b/impl/src/main/java/org/apache/myfaces/cdi/view/ViewTransientScopeBeanHolder.java
@@ -48,7 +48,7 @@
                 facesContext.getViewRoot().getTransientStateHelper().getTransient(VIEW_TRANSIENT_SCOPE_MAP);
         if (contextualStorage == null)
         {
-            contextualStorage = new ContextualStorage(beanManager, false, false);
+            contextualStorage = new ContextualStorage(beanManager, false);
             facesContext.getViewRoot().getTransientStateHelper()
                     .putTransient(VIEW_TRANSIENT_SCOPE_MAP, contextualStorage);
         }
diff --git a/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopeBeanHolder.java b/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopeBeanHolder.java
index be4b29c..22e9fbb 100644
--- a/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopeBeanHolder.java
+++ b/impl/src/main/java/org/apache/myfaces/flow/cdi/FlowScopeBeanHolder.java
@@ -104,7 +104,7 @@
      */
     public ContextualStorage getContextualStorage(BeanManager beanManager, String flowClientWindowId)
     {
-        return storageMap.computeIfAbsent(flowClientWindowId, k -> new ContextualStorage(beanManager, true, true));
+        return storageMap.computeIfAbsent(flowClientWindowId, k -> new ContextualStorage(beanManager, true));
     }
     
     public ContextualStorage getContextualStorageNoCreate(BeanManager beanManager, String flowClientWindowId)