Skip to content

Commit 8f82b41

Browse files
committed
Rename FutureWarning -> ParanoidWarning
Signed-off-by: Ben Sherman <bentshermann@gmail.com>
1 parent 578476e commit 8f82b41

File tree

5 files changed

+20
-20
lines changed

5 files changed

+20
-20
lines changed

modules/compiler/src/main/java/config/control/VariableScopeVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public void visitVariableExpression(VariableExpression node) {
241241
Variable variable = vsc.findVariableDeclaration(name, node);
242242
if( variable == null ) {
243243
if( "it".equals(name) ) {
244-
vsc.addFutureWarning("Implicit closure parameter `it` will not be supported in a future version", node);
244+
vsc.addParanoidWarning("Implicit closure parameter `it` will not be supported in a future version", node);
245245
}
246246
else {
247247
variable = new DynamicVariable(name, false);

modules/compiler/src/main/java/script/control/FutureWarning.java renamed to modules/compiler/src/main/java/script/control/ParanoidWarning.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
*
2525
* @author Ben Sherman <bentshermann@gmail.com>
2626
*/
27-
public class FutureWarning extends WarningMessage implements RelatedInformationAware {
27+
public class ParanoidWarning extends WarningMessage implements RelatedInformationAware {
2828

2929
private String otherMessage;
3030

3131
private ASTNode otherNode;
3232

33-
public FutureWarning(int importance, String message, CSTNode context, SourceUnit owner) {
33+
public ParanoidWarning(int importance, String message, CSTNode context, SourceUnit owner) {
3434
super(importance, message, context, owner);
3535
}
3636

modules/compiler/src/main/java/script/control/VariableScopeChecker.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public Variable findDslMember(ClassNode cn, String name, ASTNode node) {
191191
if( !name.equals(memberName) )
192192
continue;
193193
if( findAnnotation(mn, Deprecated.class).isPresent() )
194-
addFutureWarning("`" + name + "` is deprecated and will be removed in a future version", node);
194+
addParanoidWarning("`" + name + "` is deprecated and will be removed in a future version", node);
195195
return wrapMethodAsVariable(mn, memberName);
196196
}
197197

@@ -215,24 +215,24 @@ private Variable wrapMethodAsVariable(MethodNode mn, String name) {
215215
return pn;
216216
}
217217

218-
public void addFutureWarning(String message, String tokenText, ASTNode node, String otherMessage, ASTNode otherNode) {
218+
public void addParanoidWarning(String message, String tokenText, ASTNode node, String otherMessage, ASTNode otherNode) {
219219
var token = new Token(0, tokenText, node.getLineNumber(), node.getColumnNumber()); // ASTNode to CSTNode
220-
var warning = new FutureWarning(WarningMessage.POSSIBLE_ERRORS, message, token, sourceUnit);
220+
var warning = new ParanoidWarning(WarningMessage.POSSIBLE_ERRORS, message, token, sourceUnit);
221221
if( otherNode != null )
222222
warning.setRelatedInformation(otherMessage, otherNode);
223223
sourceUnit.getErrorCollector().addWarning(warning);
224224
}
225225

226-
public void addFutureWarning(String message, ASTNode node, String otherMessage, ASTNode otherNode) {
227-
addFutureWarning(message, "", node, otherMessage, otherNode);
226+
public void addParanoidWarning(String message, ASTNode node, String otherMessage, ASTNode otherNode) {
227+
addParanoidWarning(message, "", node, otherMessage, otherNode);
228228
}
229229

230-
public void addFutureWarning(String message, String tokenText, ASTNode node) {
231-
addFutureWarning(message, tokenText, node, null, null);
230+
public void addParanoidWarning(String message, String tokenText, ASTNode node) {
231+
addParanoidWarning(message, tokenText, node, null, null);
232232
}
233233

234-
public void addFutureWarning(String message, ASTNode node) {
235-
addFutureWarning(message, "", node, null, null);
234+
public void addParanoidWarning(String message, ASTNode node) {
235+
addParanoidWarning(message, "", node, null, null);
236236
}
237237

238238
public void addError(String message, ASTNode node) {

modules/compiler/src/main/java/script/control/VariableScopeVisitor.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ public void visitFeatureFlag(FeatureFlagNode node) {
158158
if( result.isPresent() ) {
159159
var ffn = result.get();
160160
if( findAnnotation(ffn, Deprecated.class).isPresent() )
161-
vsc.addFutureWarning("`" + node.name + "` is deprecated and will be removed in a future version", node.name, node);
161+
vsc.addParanoidWarning("`" + node.name + "` is deprecated and will be removed in a future version", node.name, node);
162162
node.target = ffn;
163163
}
164164
else {
@@ -238,7 +238,7 @@ public void visitProcess(ProcessNode node) {
238238
vsc.popScope();
239239

240240
if( !(node.when instanceof EmptyExpression) )
241-
vsc.addFutureWarning("Process `when` section will not be supported in a future version", node.when);
241+
vsc.addParanoidWarning("Process `when` section will not be supported in a future version", node.when);
242242
visit(node.when);
243243

244244
visit(node.exec);
@@ -527,7 +527,7 @@ private void checkExternalWriteInAsyncClosure(VariableExpression target, Variabl
527527
var name = variable.getName();
528528
// TODO: should apply only to operator closures
529529
if( scope.isReferencedLocalVariable(name) && scope.getDeclaredVariable(name) == null )
530-
vsc.addFutureWarning("Mutating an external variable in an operator closure may lead to a race condition", target, "External variable declared here", (ASTNode) variable);
530+
vsc.addParanoidWarning("Mutating an external variable in an operator closure may lead to a race condition", target, "External variable declared here", (ASTNode) variable);
531531
}
532532

533533
// expressions
@@ -648,13 +648,13 @@ public void visitVariableExpression(VariableExpression node) {
648648
Variable variable = vsc.findVariableDeclaration(name, node);
649649
if( variable == null ) {
650650
if( "it".equals(name) ) {
651-
vsc.addFutureWarning("Implicit closure parameter `it` will not be supported in a future version", node);
651+
vsc.addParanoidWarning("Implicit closure parameter `it` will not be supported in a future version", node);
652652
}
653653
else if( "args".equals(name) ) {
654-
vsc.addFutureWarning("The use of `args` outside the entry workflow will not be supported in a future version", node);
654+
vsc.addParanoidWarning("The use of `args` outside the entry workflow will not be supported in a future version", node);
655655
}
656656
else if( "params".equals(name) ) {
657-
vsc.addFutureWarning("The use of `params` outside the entry workflow will not be supported in a future version", node);
657+
vsc.addParanoidWarning("The use of `params` outside the entry workflow will not be supported in a future version", node);
658658
}
659659
else {
660660
variable = new DynamicVariable(name, false);

modules/language-server/src/main/java/nextflow/lsp/services/LanguageService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
import nextflow.lsp.util.LanguageServerUtils;
4141
import nextflow.lsp.util.Logger;
4242
import nextflow.lsp.util.Positions;
43-
import nextflow.script.control.FutureWarning;
43+
import nextflow.script.control.ParanoidWarning;
4444
import nextflow.script.control.RelatedInformationAware;
4545
import nextflow.script.formatter.FormattingOptions;
4646
import org.codehaus.groovy.runtime.DefaultGroovyMethods;
@@ -395,7 +395,7 @@ protected void publishDiagnostics(Set<URI> changedUris) {
395395
}
396396

397397
for( var warning : astCache.getWarnings(uri) ) {
398-
if( !configuration.paranoidWarnings() && warning instanceof FutureWarning )
398+
if( !configuration.paranoidWarnings() && warning instanceof ParanoidWarning )
399399
continue;
400400

401401
var message = warning.getMessage();

0 commit comments

Comments
 (0)