UnmanagedNodeBackedModelMapTest.groovy

Clone Tools
  • last updated a few minutes ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Moved ObjectInstantiationException to public API

This avoids leaking an internal exception type through the

ObjectFactory.newInstance API.

    • -1
    • +1
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 26 more files in changeset.
Revert "Promote o.g.model/{internal/core/rule/describe=>}/ModelRuleDescriptor"

This reverts commit de9e06338062d7ff2933717e1c30fbf0fb6c50d2 following a

review in which we determined that letting the indirect cycle persist is

a lesser evil that promoting ModelRuleDescriptor to public status.

Note again that the original commit, nor this reversion of it has any

impact on Classycle errors, as it appears to be incapable of detecting

this kind of (very common) cycle.

    • -0
    • +1
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 85 more files in changeset.
Coalesce o.g.m.{collection.internal=>internal.core}

This change removes a "feedback dependency" at the package level, which

is an indirect form of a package cycle.

In this case, collection.internal.ModelMapModelProjection depended on

internal.manage.instance.ManagedInstance while at the same time types in

internal.manage.extract depended on

collection.internal.ChildNodeInitializerStrategy* types.

So while there was no direct cycle between any two packages, there was

a an indirect cycle or between different subpackages of

collection.internal and collection.manage.

Indirect cycles are just as indicative of a design problem as their

direct counterparts, but unfortunately it appears that Classycle is not

capable of detecting them. Fortunately, other tools are. This screenshot

taken from Structure101 Studio visualizes the indirect cycle described

above: https://imgur.com/00FyduF.

It appears that the presence of these types in collection.internal was

probably an oversight to begin with. This package did start out with

proper collection types such as DefaultManagedSet and

DefaultCollectionBuilder, but these were removed quite some time ago in

commit 699abb21985e8126742007cb2e0daeae34316756. As such, this commit

resolves the indirect cycle simply by moving the offending types from

collection.internal into internal.core, where they look to be a better

fit anyway.

    • -2
    • +0
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 13 more files in changeset.
Promote o.g.model/{internal/core/rule/describe=>}/ModelRuleDescriptor

Much like the previous commit, this change resolves an indirect package

cycle. Unlike the previous commit, however, it does so by promoting a

previously intenal type (ModelRuleDescriptor) to public API status.

There are several exception types resident in org.gradle.model that

depend on ModelRuleDescriptor and expose that dependency through their

constructors. This alone provides a rationale for promoting

ModelRuleDescriptor to public status, and resolving the cycle is now an

additional motivation.

Note that while the package structure within on the internal side was

org.gradle.model.internal.core.rule.describe, ModelRuleDescriptor has

been promoted here directly to org.gradle.model, i.e. the

core.rule.describe subpackaging has not been mirrored into the public

package structure. The reason for doing this is to avoid introducing a

dependency from a higher level package (org.gradle.model) to a

subpackage. In general, package dependencies should always flow upward

from subpackages to parent packages in a given hierarchy, and not the

other way around. There are many counterexamples of this throughout the

codebase today, but that is no reason to perpetuate the practice.

    • -1
    • +0
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 83 more files in changeset.
Change "constructable" to "constructible" in code

    • -5
    • +5
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 13 more files in changeset.
NodeBackedModelMap.create() to respect chained filtering

Previously NodeBackedModelMap’s create() methods didn’t take filtering

into account, and allowed creating any type that the underlying factory

was able to construct. Now that is fixed. Further update is coming to

make the resulting error message nicer.

+review REVIEW-5738

    • -2
    • +10
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 4 more files in changeset.
Make NodeBasedModelMap respect chained filtering

NodeBackedModelMap now respects chained filtering. That is:

modelMap.withType(Serializable).withType(Thing)

will return only elements that implement both Serializable and Thing.

All the rule-assigning methods (all(), beforeEach(), afterEach() and

withType()) are also aware of chained filtering.

+review REVIEW-5738

    • -112
    • +0
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 3 more files in changeset.
Extract shared code from NodeBackedModelMapTests

+review REVIEW-5738

    • -713
    • +6
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 2 more files in changeset.
Clarify purpose of method

+review REVIEW-5738

    • -9
    • +9
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 4 more files in changeset.
Simplify the use of ModelRegistryHelperExtension

+review REVIEW-5738

    • -3
    • +3
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 9 more files in changeset.
Require that rule methods in a `RuleSource` must not be private, and that all methods that are not rule methods must be private.

    • -1
    • +1
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 5 more files in changeset.
Introduce convenience methods on ModelRegistry

+review REVIEW-5685

    • -1
    • +1
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 24 more files in changeset.
Revert "Fix tests on Java 1.9"

This reverts commit 71ab259efc81a5c1f41ab2d1b2a69321e4b7a271.

    • -14
    • +0
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 6 more files in changeset.
Fix tests on Java 1.9

Previously, because of http://jira.codehaus.org/browse/GROOVY-7010, we

had to move some test interfaces out to separate top-level classes.

These top-level types then got shared between tests, and led to

classloader issues where we were generating classes based on these

types.

The original problem is not solved, but we use getDeclaredClasses()

less often, and it allows these tests to work with nested interfaces.

So some of these types (the ones that were making the tests fail on

Java 1.9) were moved back to their parent tests.

+review REVIEW-5689

    • -0
    • +14
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 6 more files in changeset.
Removed `ModelMapProjection` subclass that was only used by tests.

    • -2
    • +2
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 2 more files in changeset.
Use a custom node initializer strategy for empty subtypes of `ModelMap`

This change allows us to define subtypes of `ModelMap` and create instances

using a standard `@Model` rule. Previously it was necessary to register each

instance using some `ModelRegistry` magic via the `ModelMapRegistrations`

helper.

This change has simplified the registration of the top-level:

- `ComponentSpecContainer`

- `BinaryContainer`

- `TestSuiteContainer`

Further work will be done to use this for `FunctionalSourceSet`,

which will allow us to remove a bunch of alternative code used for model

registration.

    • -1
    • +1
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 12 more files in changeset.
Make error message assertion more explicit

Issue: gradle/langos#15 +review REVIEW-5670

    • -1
    • +1
    ./UnmanagedNodeBackedModelMapTest.groovy
Rename ModelRegistry.create() to register() +review REVIEW-5678

    • -14
    • +14
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 67 more files in changeset.
Assert report of avail. types in ModelMap on not constructible type

Add tests that assert available constructible types are reported when

attempting to create an element of a ModelMap for a given

non-constructible type.

This commit change test code only.

    • -0
    • +11
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 4 more files in changeset.
Delay defining node projections, take 2

+review REVIEW-5635

    • -8
    • +7
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 19 more files in changeset.
Propagate the ManagedInstance interface to the Groovy model map decorator.

+review REVIEW-5635

    • -0
    • +13
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 4 more files in changeset.
Propagate the ManagedInstance interface to the Groovy model map decorator.

+review REVIEW-5635

    • -0
    • +13
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 4 more files in changeset.
Revert "Postpone defining node projections until needed"

This reverts commit 6cc63413b1af2a95a613d825318339d46f6ad278.

    • -7
    • +8
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 18 more files in changeset.
Better name for `ChildNodeInitializerStrategyAccessors.constant()`

+review REVIEW-5629

    • -1
    • +1
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 6 more files in changeset.
Postpone defining node projections until needed

+review REVIEW-5635

    • -8
    • +7
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 18 more files in changeset.
Postpone defining node projections until needed

+review REVIEW-5635

    • -8
    • +7
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 18 more files in changeset.
Register node initializers via rules

+review REVIEW-5629

    • -1
    • +5
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 51 more files in changeset.
Model actions don't get access automatically to node view

+review REVIEW-5629

    • -4
    • +11
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 29 more files in changeset.
Immediately transition nodes to `ProjectionsDefined` state

+review REVIEW-5620

    • -4
    • +4
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 25 more files in changeset.
Tweaks to model rule binding failure error message format.

+review REVIEW-5556

    • -8
    • +8
    ./UnmanagedNodeBackedModelMapTest.groovy
  1. … 30 more files in changeset.