You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2020/09/01 11:01:59 UTC

[isis] branch master updated: ISIS-2332: fix spec-loading: when bean sort not previously discovered, fallback to classify bean on-the-fly

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new c904ec3  ISIS-2332: fix spec-loading: when bean sort not previously discovered, fallback to classify bean on-the-fly
c904ec3 is described below

commit c904ec3d8a856ab7a15af629ce593f42184b852c
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Sep 1 13:01:39 2020 +0200

    ISIS-2332: fix spec-loading: when bean sort not previously discovered,
    fallback to classify bean on-the-fly
---
 .../apache/isis/core/config/beans/IsisBeanTypeRegistry.java    |  4 ++--
 .../core/metamodel/specloader/SpecificationLoaderDefault.java  | 10 ++++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/core/config/src/main/java/org/apache/isis/core/config/beans/IsisBeanTypeRegistry.java b/core/config/src/main/java/org/apache/isis/core/config/beans/IsisBeanTypeRegistry.java
index 2d1ba6b..5199f12 100644
--- a/core/config/src/main/java/org/apache/isis/core/config/beans/IsisBeanTypeRegistry.java
+++ b/core/config/src/main/java/org/apache/isis/core/config/beans/IsisBeanTypeRegistry.java
@@ -104,9 +104,9 @@ public final class IsisBeanTypeRegistry implements IsisComponentScanInterceptor,
         return defensiveCopy;
     }
 
-    public BeanSort lookupBeanSortByIntrospectableType(Class<?> type) {
+    public Optional<BeanSort> lookupBeanSortByIntrospectableType(Class<?> type) {
         synchronized (introspectableTypes) {
-            return introspectableTypes.getOrDefault(type, BeanSort.UNKNOWN);
+            return Optional.ofNullable(introspectableTypes.get(type));
         }
     }
     
diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/SpecificationLoaderDefault.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/SpecificationLoaderDefault.java
index 479ada0..d4b5e5c 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/SpecificationLoaderDefault.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/SpecificationLoaderDefault.java
@@ -414,8 +414,14 @@ public class SpecificationLoaderDefault implements SpecificationLoader {
             final @Nullable Class<?> type,
             final IntrospectionState upTo) {
 
+        val typeRegistry = getIsisBeanTypeRegistry();
+        
         return loadSpecification(
-                type, __->getIsisBeanTypeRegistry().lookupBeanSortByIntrospectableType(type), upTo);
+                type, 
+                __->typeRegistry
+                .lookupBeanSortByIntrospectableType(type)
+                .orElseGet(()->typeRegistry.quickClassify(type).getBeanSort()), 
+                upTo);
     }
 
     @Override
@@ -503,7 +509,7 @@ public class SpecificationLoaderDefault implements SpecificationLoader {
         if(isMetamodelFullyIntrospected() 
                 && isisConfiguration.getCore().getMetaModel().getIntrospector().isLockAfterFullIntrospection()) {
 
-            val typeRegistry = isisBeanTypeRegistryHolder.getIsisBeanTypeRegistry();
+            val typeRegistry = getIsisBeanTypeRegistry();
             val category = typeRegistry.quickClassify(cls);
             val sort = category.getBeanSort();