Skip to content

Commit 3e469cc

Browse files
authored
perf: resolve reference declaration only once (#6361)
1 parent 5e3fef1 commit 3e469cc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/spoon/support/reflect/reference/CtExecutableReferenceImpl.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,15 @@ public boolean isConstructor() {
9191
@SuppressWarnings("unchecked")
9292
public CtExecutable<T> getDeclaration() {
9393
final CtTypeReference<?> typeRef = getDeclaringType();
94-
if (typeRef == null || typeRef.getDeclaration() == null) {
94+
if (typeRef == null) {
9595
return null;
9696
}
97-
return getCtExecutable(typeRef.getDeclaration());
97+
CtType<?> declaration = typeRef.getDeclaration();
98+
if (declaration == null) {
99+
return null;
100+
}
101+
102+
return getCtExecutable(declaration);
98103
}
99104

100105
@Override

0 commit comments

Comments
 (0)