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 2022/05/17 13:27:38 UTC

[isis] branch master updated (85b0092d03 -> 31e1af9f35)

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

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


    from 85b0092d03 Bump Wicket 9.9.1->9.10.0
     new 8cd01cf1a2 ISIS-3051: fixes demo mixin
     new 31e1af9f35 ISIS-3051: removes error prone optimization step

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../specloader/specimpl/FacetedMethodsBuilder.java | 62 +++-------------------
 .../depargs/DependentArgsActionDemo_useHide.java   |  9 +---
 2 files changed, 9 insertions(+), 62 deletions(-)


[isis] 01/02: ISIS-3051: fixes demo mixin

Posted by ah...@apache.org.
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

commit 8cd01cf1a26b1574f8db40e8365b1940b1f103d9
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue May 17 14:14:04 2022 +0200

    ISIS-3051: fixes demo mixin
---
 .../progmodel/depargs/DependentArgsActionDemo_useHide.java       | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useHide.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useHide.java
index 2b4593add6..5468ba35c3 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useHide.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useHide.java
@@ -67,18 +67,13 @@ public class DependentArgsActionDemo_useHide {
 
     // -- PARAM 0 (boolean hideMessageField)
 
-    @MemberSupport public boolean default0Act() {
+    @MemberSupport public boolean default0Act(final Parameters params) {
         return holder.isDialogCheckboxDefault();
     }
 
     // -- PARAM 1 (String message)
 
-    @MemberSupport public boolean hide1Act(final boolean hideMessageField) {
-        return hideMessageField;
-    }
-
-
-    public boolean hide1Act(final Parameters params) {
+    @MemberSupport public boolean hide1Act(final Parameters params) {
         return params.hideMessageField();
     }
 


[isis] 02/02: ISIS-3051: removes error prone optimization step

Posted by ah...@apache.org.
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

commit 31e1af9f356eaa1ab368cc6db18d4472b35861f2
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue May 17 15:27:32 2022 +0200

    ISIS-3051: removes error prone optimization step
---
 .../specloader/specimpl/FacetedMethodsBuilder.java | 62 +++-------------------
 1 file changed, 7 insertions(+), 55 deletions(-)

diff --git a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/FacetedMethodsBuilder.java b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/FacetedMethodsBuilder.java
index 1fcd3f6ecb..299eb383af 100644
--- a/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/FacetedMethodsBuilder.java
+++ b/core/metamodel/src/main/java/org/apache/isis/core/metamodel/specloader/specimpl/FacetedMethodsBuilder.java
@@ -32,9 +32,7 @@ import java.util.stream.Stream;
 import org.springframework.lang.Nullable;
 
 import org.apache.isis.applib.annotation.Action;
-import org.apache.isis.applib.annotation.DomainObject;
 import org.apache.isis.applib.annotation.Introspection.IntrospectionPolicy;
-import org.apache.isis.applib.annotation.Nature;
 import org.apache.isis.applib.exceptions.unrecoverable.MetaModelException;
 import org.apache.isis.commons.collections.Can;
 import org.apache.isis.commons.internal.base._NullSafe;
@@ -118,8 +116,6 @@ implements HasMetaModelContext {
 
     private final ClassSubstitutorRegistry classSubstitutorRegistry;
 
-    private final boolean isMemberAnnotationsRequired;
-
     // -- CONSTRUCTOR
 
     public FacetedMethodsBuilder(
@@ -136,9 +132,6 @@ implements HasMetaModelContext {
         this.inspectedTypeSpec = inspectedTypeSpec;
         this.introspectedClass = inspectedTypeSpec.getCorrespondingClass();
 
-        this.isMemberAnnotationsRequired =
-                introspectionPolicy().getMemberAnnotationPolicy().isMemberAnnotationsRequired();
-
         val classCache = _ClassCache.getInstance();
         val methodsRemaining = introspectionPolicy().getEncapsulationPolicy().isEncapsulatedMembersSupported()
                 ? classCache.streamPublicOrDeclaredMethods(introspectedClass)
@@ -425,59 +418,17 @@ implements HasMetaModelContext {
         val hasActionAnnotation = _Annotations
                 .isPresent(actionMethod, Action.class);
 
-        // just an optimization, not strictly required:
-        // return false if both are true
-        // 1. actionMethod has no @Action annotation
-        // 2. actionMethod does not identify as a mixin's main method
-        if(isMemberAnnotationsRequired) {
-
-            // even though when @Action is mandatory for action methods,
-            // mixins now can contribute methods,
-            // that do not need to be annotated (see ISIS-1998)
-
-            if(!hasActionAnnotation) {
-                // omitting the @Action annotation at given method is only allowed, when the
-                // type is a mixin, and the mixin's main method identifies as the given actionMethod
-                val type = actionMethod.getDeclaringClass();
-
-                //XXX for given type we do this for every method, could cache the result!
-                val mixedInMethodName = _Annotations.synthesize(type, DomainObject.class)
-                .filter(domainObject->Nature.MIXIN.equals(domainObject.nature()))
-                .map(DomainObject::mixinMethod)
-                .orElse(null);
-
-                if(mixedInMethodName!=null) {
-                    // we have a mixin type
-                    if(!Objects.equals(actionMethod.getName(), mixedInMethodName)) {
-                        // the actionMethod does not identify as the mixin's main method
-                        return false;
-                    }
-                }
-            }
-
-            // else fall through
-
-        }
-
-        val specLoader = getSpecificationLoader();
-
+        // ensure we can load returned element type; otherwise ignore method
         val anyLoadedAsNull = TypeExtractor.streamMethodReturn(actionMethod)
-        .map(typeToLoad->specLoader.loadSpecification(typeToLoad, IntrospectionState.TYPE_INTROSPECTED))
+        .map(typeToLoad->getSpecificationLoader().loadSpecification(typeToLoad, IntrospectionState.TYPE_INTROSPECTED))
         .anyMatch(Objects::isNull);
-
         if (anyLoadedAsNull) {
             return false;
         }
 
-        // ensure we can load specs for all the params
-//don't!! has side effect of pulling in all param types
-//even those that should be ignored by the metamodel
-//        if (!loadParamSpecs(actionMethod)) {
-//            return false;
-//        }
-
         if(isMixinMain(actionMethod)) {
-            // we are introspecting a mixin type, so accept this method for further processing
+            // we are introspecting a mixin type and its main method,
+            // so accept this method for further processing
             log.debug("  identified mixin-main action {}", actionMethod);
             return true;
         }
@@ -494,12 +445,13 @@ implements HasMetaModelContext {
             return false;
         }
 
-        if(isMemberAnnotationsRequired) {
+        if(introspectionPolicy().getMemberAnnotationPolicy().isMemberAnnotationsRequired()) {
             // we have no @Action, so dismiss
+            log.debug("  dismissing non-action method {}", actionMethod);
             return false;
         }
 
-        // we have a valid action candidate, so fall through
+        // we have a valid action candidate, so accept
         log.debug("  identified action {}", actionMethod);
         return true;
     }