Skip to content

Commit 96e022e

Browse files
authored
Merge pull request #1155 from Liyw979/improve/toString
Cache toString for SootClassMemberSignature
2 parents 5f1b50b + ab4952a commit 96e022e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

sootup.core/src/main/java/sootup/core/signatures/SootClassMemberSignature.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
*/
2424

2525
import com.google.common.base.Objects;
26+
import com.google.common.base.Suppliers;
27+
import java.util.function.Supplier;
2628
import javax.annotation.Nonnull;
2729
import sootup.core.model.SootClassMember;
2830
import sootup.core.types.ClassType;
@@ -90,10 +92,13 @@ public int hashCode() {
9092
return hashCode;
9193
}
9294

95+
private final Supplier<String> _cachedToString =
96+
Suppliers.memoize(() -> "<" + getDeclClassType() + ": " + getSubSignature() + '>');
97+
9398
@Override
9499
@Nonnull
95100
public String toString() {
96-
return "<" + declClassSignature + ": " + getSubSignature() + '>';
101+
return _cachedToString.get();
97102
}
98103

99104
@Override

0 commit comments

Comments
 (0)