BradWalker commented on a change in pull request #1872: [NETBEANS-3695] - not 
proper to use a static variable through a refer…
URL: https://github.com/apache/netbeans/pull/1872#discussion_r367025507
 
 

 ##########
 File path: 
ide/team.commons/src/org/netbeans/modules/bugtracking/commons/LinkButton.java
 ##########
 @@ -119,10 +119,10 @@ public LinkButton() {
     }
     
     public void setColors(Color linkColor, Color linkInFocusColor, Color 
mouseOverLinkColor, Color visitedLinkColor) {
-        this.linkInFocusColor = linkInFocusColor;
-        this.linkColor = linkColor;
-        this.mouseOverLinkColor = mouseOverLinkColor;
-        this.visitedLinkColor = visitedLinkColor;
+        linkInFocusColor = linkInFocusColor;
+        linkColor = linkColor;
+        mouseOverLinkColor = mouseOverLinkColor;
+        visitedLinkColor   = visitedLinkColor;
 
 Review comment:
   In it's original form, here is the warning emitted..
   ```
      [repeat] 
/home/bwalker/src/netbeans/ide/team.commons/src/org/netbeans/modules/bugtracking/commons/LinkButton.java:122:
 warning: [static] static variable should be qualified by type name, 
LinkButton, instead of by an expression
      [repeat]         this.linkInFocusColor = linkInFocusColor;
      [repeat]             ^
      [repeat] 
/home/bwalker/src/netbeans/ide/team.commons/src/org/netbeans/modules/bugtracking/commons/LinkButton.java:123:
 warning: [static] static variable should be qualified by type name, 
LinkButton, instead of by an expression
      [repeat]         this.linkColor = linkColor;
      [repeat]             ^
      [repeat] 
/home/bwalker/src/netbeans/ide/team.commons/src/org/netbeans/modules/bugtracking/commons/LinkButton.java:124:
 warning: [static] static variable should be qualified by type name, 
LinkButton, instead of by an expression
      [repeat]         this.mouseOverLinkColor = mouseOverLinkColor;
      [repeat]             ^
      [repeat] 
/home/bwalker/src/netbeans/ide/team.commons/src/org/netbeans/modules/bugtracking/commons/LinkButton.java:125:
 warning: [static] static variable should be qualified by type name, 
LinkButton, instead of by an expression
      [repeat]         this.visitedLinkColor   = visitedLinkColor;
      [repeat]             ^
   ```
   Which seems correct as these variables are declared static in the class. So 
by accessing them via the self reference is not correct and the compiler is 
warning us. Nor is providing a fully qualified class name the correct way to 
fix this. These variables are declared as static in the class so they have 
"global" reference.
   
   What would you like for me to change it to?
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

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

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

Reply via email to