Skip to content

Commit df05abb

Browse files
change string format by existing function
1 parent 03db099 commit df05abb

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

liquidjava-verifier/src/main/java/liquidjava/processor/refinement_checker/general_checkers/MethodsFunctionsChecker.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void getConstructorRefinements(CtConstructor<?> c) throws LJError {
4848
f.setRefReturn(new Predicate());
4949
CtTypeReference<?> declaring = c.getDeclaringType() != null ? c.getDeclaringType().getReference() : null;
5050
if (declaring != null) {
51-
f.setSignature(String.format("%s.%s", declaring.getQualifiedName(), c.getSignature()));
51+
f.setSignature(Utils.qualifyName(declaring.getQualifiedName(), c.getSignature()));
5252
} else {
5353
f.setSignature(c.getSignature());
5454
}
@@ -85,7 +85,7 @@ public void getConstructorInvocationRefinements(CtConstructorCall<?> ctConstruct
8585
// ################### VISIT METHOD ##############################
8686
public <R> void getMethodRefinements(CtMethod<R> method) throws LJError {
8787
String className = parentQualifiedName(method);
88-
String signature = (className != null) ? String.format("%s.%s", className, method.getSignature())
88+
String signature = (className != null) ? Utils.qualifyName(className, method.getSignature())
8989
: method.getSignature();
9090
RefinedFunction f = buildAndRegisterFunction(method, method.getSimpleName(), className, signature);
9191

@@ -99,8 +99,8 @@ public <R> void getMethodRefinements(CtMethod<R> method) throws LJError {
9999
public <R> void getMethodRefinements(CtMethod<R> method, String prefix) throws LJError {
100100
String constructorName = "<init>";
101101
boolean isConstructor = Utils.getSimpleName(prefix).equals(method.getSimpleName());
102-
String functionName = isConstructor ? constructorName : String.format("%s.%s", prefix, method.getSimpleName());
103-
String signature = String.format("%s.%s", prefix, method.getSignature());
102+
String functionName = isConstructor ? constructorName : Utils.qualifyName(prefix, method.getSimpleName());
103+
String signature = Utils.qualifyName(prefix, method.getSignature());
104104

105105
RefinedFunction f = buildAndRegisterFunction(method, functionName, prefix, signature);
106106

@@ -111,9 +111,8 @@ public <R> void getMethodRefinements(CtMethod<R> method, String prefix) throws L
111111
}
112112

113113
/**
114-
* Creates a {@link RefinedFunction} with the shared boilerplate (sanitized name, type, empty return refinement,
115-
* placement, optional owning class and signature), registers it in the context, and processes its parameter/return
116-
* refinements.
114+
* Creates a {@link RefinedFunction} with the sanitized name, type, empty return refinement, placement, optional
115+
* owning class and signature, and registers it in the context, and processes its parameter/return
117116
*/
118117
private RefinedFunction buildAndRegisterFunction(CtMethod<?> method, String name, String className,
119118
String signature) throws LJError {
@@ -262,8 +261,8 @@ private void searchMethodInLibrary(CtExecutableReference<?> ctr, CtInvocation<?>
262261
List<CtTypeReference<?>> paramTypes = ctr.getParameters();
263262

264263
// Try each candidate key in order; a null key (when ctype is unknown) is skipped.
265-
String qualifiedSignature = (ctype != null) ? String.format("%s.%s", ctype, ctr.getSignature()) : null;
266-
String completeName = (ctype != null) ? String.format("%s.%s", ctype, name) : null;
264+
String qualifiedSignature = (ctype != null) ? Utils.qualifyName(ctype, ctr.getSignature()) : null;
265+
String completeName = (ctype != null) ? Utils.qualifyName(ctype, name) : null;
267266

268267
if (tryRefinements(invocation, qualifiedSignature, ctype, paramTypes)
269268
|| tryRefinements(invocation, ctr.getSignature(), ctype, paramTypes)

0 commit comments

Comments
 (0)