/*
 * Copyright 2020 the original author or authors.
 *
 * Licensed 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.
 */

package org.gradle.execution.plan;

import org.gradle.internal.MutableBoolean;
import org.gradle.internal.reflect.TypeValidationContext;

import javax.annotation.Nullable;

public class DefaultNodeValidator implements NodeValidator {
    @Override
    public boolean hasValidationProblems(Node node) {
        if (node instanceof LocalTaskNode) {
            MutableBoolean foundProblem = new MutableBoolean();
            TypeValidationContext context = new TypeValidationContext() {
                @Override
                public void visitTypeProblem(Severity severity, Class<?> type, String message) {
                    if (severity != Severity.CACHEABILITY_WARNING) {
                        foundProblem.set(true);
                    }
                }

                @Override
                public void visitPropertyProblem(Severity severity, @Nullable String parentProperty, @Nullable String property, String message) {
                    if (severity != Severity.CACHEABILITY_WARNING) {
                        foundProblem.set(true);
                    }
                }
            };
            ((LocalTaskNode) node).getTaskProperties().validateType(context);
            return foundProblem.get();
        } else {
            return false;
        }
    }
}

@@ -1242,126 +1242,47 @@
     
-if (severity != Severity.CACHEABILITY_WARNING) %7B%0A                        found
+recordNonCacheability
 Problem
-.set(true);%0A                    %7D
+(severity);
 %0A   
@@ -1461,32 +1461,315 @@
 ring message) %7B%0A
+                    recordNonCacheabilityProblem(severity);%0A                %7D%0A%0A                private void recordNonCacheabilityProblem(Severity severity) %7B%0A                    // We don't know whether the task is cacheable or not, so we ignore cacheability problems for scheduling%0A
                 

Add comment why we ignore cacheability problems