| 1 | package com.github.dakusui.osynth.core; | |
| 2 | ||
| 3 | import java.lang.reflect.Method; | |
| 4 | import java.util.Arrays; | |
| 5 | import java.util.Objects; | |
| 6 | ||
| 7 | import static java.util.stream.Collectors.joining; | |
| 8 | ||
| 9 | public interface MethodSignature { | |
| 10 | static MethodSignature create(String name, Class<?>... parameterTypes) { | |
| 11 |
1
1. create : replaced return value with null for com/github/dakusui/osynth/core/MethodSignature::create → KILLED |
return new Impl(name, parameterTypes); |
| 12 | } | |
| 13 | ||
| 14 | static MethodSignature create(Method method) { | |
| 15 |
1
1. create : replaced return value with null for com/github/dakusui/osynth/core/MethodSignature::create → KILLED |
return create(method.getName(), method.getParameterTypes()); |
| 16 | } | |
| 17 | ||
| 18 | static String formatSignature(String methodName, Class<?>[] parameterTypess) { | |
| 19 |
1
1. formatSignature : replaced return value with "" for com/github/dakusui/osynth/core/MethodSignature::formatSignature → KILLED |
return String.format("%s(%s)", methodName, Arrays.stream(parameterTypess).map(Class::getSimpleName).collect(joining(","))); |
| 20 | } | |
| 21 | ||
| 22 | String name(); | |
| 23 | ||
| 24 | Class<?>[] parameterTypes(); | |
| 25 | ||
| 26 | class Impl implements MethodSignature { | |
| 27 | ||
| 28 | private final String name; | |
| 29 | private final Class<?>[] parameterTypes; | |
| 30 | ||
| 31 | public Impl(String name, Class<?>[] parameterTypes) { | |
| 32 | this.name = name; | |
| 33 | this.parameterTypes = parameterTypes; | |
| 34 | } | |
| 35 | ||
| 36 | @Override | |
| 37 | public String name() { | |
| 38 |
1
1. name : replaced return value with "" for com/github/dakusui/osynth/core/MethodSignature$Impl::name → KILLED |
return this.name; |
| 39 | } | |
| 40 | ||
| 41 | @Override | |
| 42 | public Class<?>[] parameterTypes() { | |
| 43 |
1
1. parameterTypes : replaced return value with null for com/github/dakusui/osynth/core/MethodSignature$Impl::parameterTypes → KILLED |
return Arrays.copyOf(this.parameterTypes, this.parameterTypes.length); |
| 44 | } | |
| 45 | ||
| 46 | @Override | |
| 47 | public int hashCode() { | |
| 48 |
1
1. hashCode : replaced int return with 0 for com/github/dakusui/osynth/core/MethodSignature$Impl::hashCode → SURVIVED |
return this.name.hashCode(); |
| 49 | } | |
| 50 | ||
| 51 | @Override | |
| 52 | public boolean equals(Object anotherObject) { | |
| 53 |
1
1. equals : negated conditional → KILLED |
if (!(anotherObject instanceof MethodSignature)) |
| 54 |
1
1. equals : replaced boolean return with true for com/github/dakusui/osynth/core/MethodSignature$Impl::equals → KILLED |
return false; |
| 55 | MethodSignature another = (MethodSignature) anotherObject; | |
| 56 |
3
1. equals : negated conditional → KILLED 2. equals : negated conditional → KILLED 3. equals : replaced boolean return with true for com/github/dakusui/osynth/core/MethodSignature$Impl::equals → KILLED |
return Objects.equals(this.name(), another.name()) && Arrays.equals(this.parameterTypes(), another.parameterTypes()); |
| 57 | } | |
| 58 | ||
| 59 | @Override | |
| 60 | public String toString() { | |
| 61 |
1
1. toString : replaced return value with "" for com/github/dakusui/osynth/core/MethodSignature$Impl::toString → KILLED |
return formatSignature(this.name, this.parameterTypes); |
| 62 | } | |
| 63 | } | |
| 64 | } | |
Mutations | ||
| 11 |
1.1 |
|
| 15 |
1.1 |
|
| 19 |
1.1 |
|
| 38 |
1.1 |
|
| 43 |
1.1 |
|
| 48 |
1.1 |
|
| 53 |
1.1 |
|
| 54 |
1.1 |
|
| 56 |
1.1 2.2 3.3 |
|
| 61 |
1.1 |