Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include mappings super types metadata #714

Merged
merged 1 commit into from
Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Include mappings super types metadata
  • Loading branch information
radcortez committed Feb 7, 2022
commit f0406a23c5dcd7b8596a5eca42cb17b90a3393d9
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public static List<ConfigMappingMetadata> getConfigMappingsMetadata(Class<?> typ
if (configurationInterface != null) {
mappings.add(configurationInterface);
mappings.addAll(configurationInterface.getNested());
for (ConfigMappingInterface superType : configurationInterface.getSuperTypes()) {
mappings.add(superType);
mappings.addAll(superType.getNested());
}
}
final ConfigMappingClass configMappingClass = ConfigMappingClass.getConfigurationClass(type);
if (configMappingClass != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,32 @@ void collectionGroup() throws Exception {
// If the bytecode has an issue this will throw a VerifyError
assertNotNull(implementationClass.getDeclaredConstructor(ConfigMappingContext.class));
}

interface ServerParent {
String parent();

ServerParentNested parentNested();

interface ServerParentNested {

}
}

interface ServerChild extends ServerParent {
ServerChildNested childNested();

interface ServerChildNested {

}
}

@Test
void parentNested() {
List<ConfigMappingMetadata> mappingsMetadata = ConfigMappingLoader.getConfigMappingsMetadata(ServerChild.class);
List<Class<?>> mappings = mappingsMetadata.stream().map(ConfigMappingMetadata::getInterfaceType).collect(toList());
assertTrue(mappings.contains(ServerChild.class));
assertTrue(mappings.contains(ServerChild.ServerChildNested.class));
assertTrue(mappings.contains(ServerParent.class));
assertTrue(mappings.contains(ServerParent.ServerParentNested.class));
}
}