You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/06/23 20:42:35 UTC

[GitHub] [netbeans] mbien commented on a diff in pull request #4278: Inline redundant variable hint added.

mbien commented on code in PR #4278:
URL: https://github.com/apache/netbeans/pull/4278#discussion_r905408279


##########
java/java.hints/src/org/netbeans/modules/java/hints/suggestions/Tiny.java:
##########
@@ -400,4 +402,83 @@ protected void performRewrite(final TransformationContext ctx) {
 
     }
 
+    @Hint(displayName = "#DN_org.netbeans.modules.java.hints.suggestions.Tiny.inlineRedundantVar", description = "#DESC_org.netbeans.modules.java.hints.suggestions.Tiny.inlineRedundantVar", category="suggestions", hintKind=Kind.ACTION, severity=Severity.HINT)

Review Comment:
   nitpick: I believe it would improve readability (esp for future diffs) if this wouldn't be a single line, but this is consistent with the rest of the file so its not really a complaint - just my opinion



##########
java/java.hints/src/org/netbeans/modules/java/hints/suggestions/Tiny.java:
##########
@@ -400,4 +402,83 @@ protected void performRewrite(final TransformationContext ctx) {
 
     }
 
+    @Hint(displayName = "#DN_org.netbeans.modules.java.hints.suggestions.Tiny.inlineRedundantVar", description = "#DESC_org.netbeans.modules.java.hints.suggestions.Tiny.inlineRedundantVar", category="suggestions", hintKind=Kind.ACTION, severity=Severity.HINT)
+    @TriggerPattern(value="$type $var = $init; $statements$ return $var;")

Review Comment:
   the trigger seems to be a bit greedy. The hint is active even before the variable is declared.
   ![inline](https://user-images.githubusercontent.com/114367/175393374-c700689b-fc28-4914-83bd-a45fe1a560fb.png)
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists