(&self)
| 294 | if matches!(ty, Type::Pointer(_)) { |
| 295 | has_pointer = true; |
| 296 | 5u16 |
| 297 | } else if matches!(ty, Type::I64 | Type::U64 | Type::F64) { |
| 298 | 2 |
| 299 | } else { |
| 300 | 1 |
| 301 | } |
| 302 | }) |
| 303 | .sum::<u16>(); |
| 304 | // JVMS 4.3.3 limits a method descriptor to 255 parameter units; |
| 305 | // instance methods also consume one unit for the receiver. |
| 306 | has_pointer && slots + u16::from(!self.is_static) <= 255 |
| 307 | } |
| 308 | |
| 309 | /// Replaces all occurrences of `Type::Class(old_name)` with `Type::Class(new_name)` |
| 310 | /// in the signature's parameters and return type. |
| 311 | /// Returns a tuple (params_changed, return_changed) indicating whether any replacements were made. |
| 312 | pub fn replace_class_in_signature( |
| 313 | &mut self, |
| 314 | old_class_name: &str, |
| 315 | new_class_name: &str, |
| 316 | ) -> (bool, bool) { |
| 317 | let mut params_changed = false; |
| 318 | let mut return_changed = false; |
| 319 | |
| 320 | // Replace in parameters |
| 321 | for (_param_name, param_type) in self.params.iter_mut() { |
no test coverage detected