Scope implementation and transition capping to package-qualified types

When an interface simple name is ambiguous, resolve FQN implementation
lookups within the requested package only, and stop capping polymorphic
candidates to machine transitions by constant name across enum types.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-14 05:45:23 +02:00
parent 828f1260cd
commit 82f4e5c087
4 changed files with 45 additions and 8 deletions

View File

@@ -263,6 +263,16 @@ class MachineEnumCanonicalizerTest {
assertThat(enriched.getPolymorphicEvents()).isNullOrEmpty();
}
@Test
void shouldNotCapForeignPackageEnumConstantToMachineTransition() {
List<String> capped = MachineEnumCanonicalizer.capToConfiguredTransitionEvents(
List.of("b.OrderEvent.PAY"),
List.of("a.OrderEvent.PAY"),
"a.OrderEvent");
assertThat(capped).isEmpty();
}
@Test
void shouldValidateRawNameConsistencyForCanonicalHelpers() {
assertThat(MachineEnumCanonicalizer.isRawNameConsistentWithFullIdentifier(

View File

@@ -271,8 +271,8 @@ class CodebaseContextTest {
assertThat(context.getImplementations("Service"))
.as("ambiguous simple interface name must not widen to arbitrary impls")
.isEmpty();
assertThat(context.getImplementations("a.Service")).contains("a.AServiceImpl");
assertThat(context.getImplementations("b.Service")).contains("b.BServiceImpl");
assertThat(context.getImplementations("a.Service")).containsExactly("a.AServiceImpl");
assertThat(context.getImplementations("b.Service")).containsExactly("b.BServiceImpl");
}
@Test