GH-106 - Avoid intercepting Object and proxy-related methods for module interaction tracing.

We now skip Object methods and ones declared on Spring's Advised or TargetClassAware types when intercepting invocations to trigger a module entry.
This commit is contained in:
Oliver Drotbohm
2023-01-05 17:18:40 +01:00
parent 91c746c63c
commit 262efb5828
7 changed files with 136 additions and 6 deletions

View File

@@ -245,6 +245,23 @@ public class ApplicationModule {
.toList();
}
/**
* Returns the {@link ArchitecturallyEvidentType} for the given type.
*
* @param type must not be {@literal null}.
* @return will never be {@literal null}.
* @throws IllegalArgumentException if the given type is not a module type.
*/
public ArchitecturallyEvidentType getArchitecturallyEvidentType(Class<?> type) {
Assert.notNull(type, "Type must not be null!");
return getType(type.getName())
.map(it -> ArchitecturallyEvidentType.of(it, getSpringBeansInternal()))
.orElseThrow(() -> new IllegalArgumentException("Couldn't find type %s in module %s!".formatted(
FormatableType.of(type).getAbbreviatedFullName(this), getName())));
}
public boolean contains(JavaClass type) {
return basePackage.contains(type);
}