From f60d759a6593b30375fb9f39a643ff6615046400 Mon Sep 17 00:00:00 2001 From: Philip Ginsbach Date: Tue, 10 Feb 2026 14:52:57 +0000 Subject: [PATCH] Avoid non-trivially shadowing string.toString() Prepare libraries for a possible deprecation warning on shadowing string.toString(). These instanceof classes were using this.(Type).method() to call supertype methods, but super.method() is clearer and equivalent for instanceof supertypes. --- .../regex/nfa/ExponentialBackTracking.qll | 2 +- shared/regex/codeql/regex/nfa/NfaUtils.qll | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/shared/regex/codeql/regex/nfa/ExponentialBackTracking.qll b/shared/regex/codeql/regex/nfa/ExponentialBackTracking.qll index 23f76497371..116029c56a9 100644 --- a/shared/regex/codeql/regex/nfa/ExponentialBackTracking.qll +++ b/shared/regex/codeql/regex/nfa/ExponentialBackTracking.qll @@ -95,7 +95,7 @@ module Make { ) } - string toString() { result = this.(InfiniteRepetitionQuantifier).toString() } + string toString() { result = super.toString() } } /** diff --git a/shared/regex/codeql/regex/nfa/NfaUtils.qll b/shared/regex/codeql/regex/nfa/NfaUtils.qll index e1be49796e0..468cf7a3e96 100644 --- a/shared/regex/codeql/regex/nfa/NfaUtils.qll +++ b/shared/regex/codeql/regex/nfa/NfaUtils.qll @@ -104,11 +104,11 @@ module Make { private class RegexpCharacterConstant instanceof RegExpConstant { RegexpCharacterConstant() { this.isCharacter() } - string toString() { result = this.(RegExpConstant).toString() } + string toString() { result = super.toString() } - RegExpTerm getRootTerm() { result = this.(RegExpConstant).getRootTerm() } + RegExpTerm getRootTerm() { result = super.getRootTerm() } - string getValue() { result = this.(RegExpConstant).getValue() } + string getValue() { result = super.getValue() } } /** @@ -578,11 +578,11 @@ module Make { ) } - string toString() { result = this.(RegExpTerm).toString() } + string toString() { result = super.toString() } - RegExpTerm getAChild() { result = this.(RegExpTerm).getChild(_) } + RegExpTerm getAChild() { result = super.getChild(_) } - RegExpTerm getChild(int i) { result = this.(RegExpTerm).getChild(i) } + RegExpTerm getChild(int i) { result = super.getChild(i) } } /** @@ -601,11 +601,11 @@ module Make { ) } - string toString() { result = this.(RegExpTerm).toString() } + string toString() { result = super.toString() } - RegExpTerm getAChild() { result = this.(RegExpTerm).getAChild() } + RegExpTerm getAChild() { result = super.getAChild() } - RegExpTerm getChild(int i) { result = this.(RegExpTerm).getChild(i) } + RegExpTerm getChild(int i) { result = super.getChild(i) } } /** @@ -621,11 +621,11 @@ module Make { ) } - string toString() { result = this.(RegExpTerm).toString() } + string toString() { result = super.toString() } - RegExpTerm getAChild() { result = this.(RegExpTerm).getAChild() } + RegExpTerm getAChild() { result = super.getAChild() } - RegExpTerm getChild(int i) { result = this.(RegExpTerm).getChild(i) } + RegExpTerm getChild(int i) { result = super.getChild(i) } } /**