)]}'
{
  "commit": "bd273e537cc52e41194a5e0c67c1673467bbe1eb",
  "tree": "ea617bcb30f826b157ba1db5f3e371185a8792a9",
  "parents": [
    "68f94a1d6f2eede5552fd52986a74b6e9ecaa1b6"
  ],
  "author": {
    "name": "Googler",
    "email": "brandjon@google.com",
    "time": "Thu Oct 24 08:58:01 2024 -0700"
  },
  "committer": {
    "name": "Copybara-Service",
    "email": "copybara-worker@google.com",
    "time": "Thu Oct 24 08:59:16 2024 -0700"
  },
  "message": "Refactor RuleVisibility validation and concatenation\n\nThis CL simplifies RuleVisibility concatenation by inlining concatWithElement() into concatWithPackage(). The latter was the only caller of the former in production. The implementation no longer has to handle the case where the RHS is public or private -- something that was not needed in practice, but which was required in abstract for the deleted method\u0027s API to be correct. It also now doesn\u0027t need to parse an untrusted label, so there\u0027s no need to catch or throw EvalException.\n\nconcatWithPackage() is also made non-static, which looks nicer at the call sites.\n\nThe validate() method is renamed to checkForVisibilityMisspelling(), since that\u0027s the only thing it does now. (A previous CL removed its other job of detecting formerly illegal combinations of public/private visibility with other items in a list.)\n\nAdded an equals() and hashCode() while we\u0027re at it, to avoid depending on singleton identity (I\u0027m not sure whether @SerializationConstant lets us assume that). It\u0027s based on just getDeclaredLabels() since that should superset any information returned by getDependencyLabels(). Changed RuleVisibility from an interface to an abstract class too -- I would\u0027ve made it `sealed`, but the singleton PUBLIC and PRIVATE anonymous subclasses prevent that and it\u0027s not worth making them named classes.\n\nMacroInstance.java\n- Implement the TODO. (I went with \"getDefinitionPackage\" over \"getDefiningPackage\" because the latter might be confused with the package that defines the macro *instance*.)\n\nMacroClass.java\n- Condense to if-expr form now that the else branch is more concise.\n\nRuleVisibilityTest.java\n- Add pkg() helper for concatenation() test case.\n- Remove assertEqual() now that we have a RuleVisibility#equals() method.\n- Rename \"B\" -\u003e \"B_PG\" for clarity/contrast with \"A\" and \"C\".\n- Delete test cases for concatWithElement that are no longer applicable (where the RHS is public or private visibility)\n\nWork toward #23855.\n\nPiperOrigin-RevId: 689400241\nChange-Id: I6b7a1c9f87c4b3c9e5cd99d5dc4d906b5d798d28\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "7bc2640e639c203e7cb650bcc61ca4a6bf71d69a",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/packages/MacroClass.java",
      "new_id": "3f54d1fccd46b8cc27030604820a89e7cfd38710",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/packages/MacroClass.java"
    },
    {
      "type": "modify",
      "old_id": "417ec32b1b1ae373374d889cf2ca507bab2cc4d5",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/packages/MacroInstance.java",
      "new_id": "05cc112f5404d412d60afea63f9459de549408b5",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/packages/MacroInstance.java"
    },
    {
      "type": "modify",
      "old_id": "048367e47f32a30d7ef4417fcdcb8ed07a00e107",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/packages/PackageGroupsRuleVisibility.java",
      "new_id": "e3b55a8569b0b226ca4d53c6aff4048fd93350e2",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/packages/PackageGroupsRuleVisibility.java"
    },
    {
      "type": "modify",
      "old_id": "3aa6c4addb494587e880bf308dac0918da0f0327",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/packages/RuleFactory.java",
      "new_id": "a989416ecd529fce6f6c0adab608e57d3ba1b4cb",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/packages/RuleFactory.java"
    },
    {
      "type": "modify",
      "old_id": "0c4ca664fedf96b3242e16fa0577e39e728af68c",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/packages/RuleVisibility.java",
      "new_id": "71b585f66a7e0a02566996868d35410a8146859d",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/packages/RuleVisibility.java"
    },
    {
      "type": "modify",
      "old_id": "5302e2e62e4700cbfb35c81c161726dff9aed7e2",
      "old_mode": 33188,
      "old_path": "src/main/java/com/google/devtools/build/lib/packages/StarlarkNativeModule.java",
      "new_id": "a4ac2b07a48d884a6a810cca946ce3e18fff9f0f",
      "new_mode": 33188,
      "new_path": "src/main/java/com/google/devtools/build/lib/packages/StarlarkNativeModule.java"
    },
    {
      "type": "modify",
      "old_id": "b197f8e3104cc90af3a995799803d7de6069b623",
      "old_mode": 33188,
      "old_path": "src/test/java/com/google/devtools/build/lib/packages/RuleVisibilityTest.java",
      "new_id": "13d69ae819f19d94c7a8136c506fb6a43b04002c",
      "new_mode": 33188,
      "new_path": "src/test/java/com/google/devtools/build/lib/packages/RuleVisibilityTest.java"
    }
  ]
}
