Collect all interface names from a class and its parent chain. Walks the class's `interfaces` list and its parent class chain, collecting all interface names (including those inherited from parents). Also walks interface-extends chains transitively.
(
&self,
cls: &ClassInfo,
class_loader: &dyn Fn(&str) -> Option<Arc<ClassInfo>>,
)
| 309 | /// collecting all interface names (including those inherited from |
| 310 | /// parents). Also walks interface-extends chains transitively. |
| 311 | fn collect_all_interfaces( |
| 312 | &self, |
| 313 | cls: &ClassInfo, |
| 314 | class_loader: &dyn Fn(&str) -> Option<Arc<ClassInfo>>, |
| 315 | ) -> Vec<String> { |
| 316 | let mut result = Vec::new(); |
| 317 | let mut seen = HashSet::new(); |
| 318 | |
| 319 | // Direct interfaces. |
| 320 | for iface in &cls.interfaces { |
| 321 | let s = iface.to_string(); |
| 322 | if seen.insert(s.clone()) { |
| 323 | result.push(s.clone()); |
| 324 | // Also collect interfaces that this interface extends. |
| 325 | self.collect_parent_interfaces(&s, class_loader, &mut result, &mut seen); |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | // Interfaces from parent classes. |
| 330 | let mut current = cls.parent_class; |
| 331 | let mut depth = 0u32; |
| 332 | while let Some(parent_name) = current { |
| 333 | if depth >= MAX_INHERITANCE_DEPTH { |
| 334 | break; |
| 335 | } |
| 336 | depth += 1; |
| 337 | if let Some(parent_cls) = class_loader(&parent_name) { |
| 338 | for iface in &parent_cls.interfaces { |
| 339 | let s = iface.to_string(); |
| 340 | if seen.insert(s.clone()) { |
| 341 | result.push(s.clone()); |
| 342 | self.collect_parent_interfaces(&s, class_loader, &mut result, &mut seen); |
| 343 | } |
| 344 | } |
| 345 | current = parent_cls.parent_class; |
| 346 | } else { |
| 347 | break; |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | result |
| 352 | } |
| 353 | |
| 354 | /// Recursively collect interfaces that an interface extends. |
| 355 | fn collect_parent_interfaces( |
no test coverage detected