question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add class qualifier to static member access should only apply to other classes

See original GitHub issue

Please make it configurable to add the class qualifier to only to the classes other than the one where this static member is defined.

For example,

class Hello { 
   static final String STR="Hello";
   void sayIt() {
     println(STR); // should not qualify it as Hello.STR
   }

   class Other {
      String do() {
         String s = Hello.STR; // should qualify
         return s.replace("l", "y");
       }
   }
}
class World extends Hello {
  void sayIt() {
     println(Hello.STR + " World!"); // should qualify
   }
}

Because I didn’t find it useful to have ThisClassDefinition.log.info("Why so verbose");

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
dubreuiacommented, May 24, 2018

Hello @rw00, thank you for you interest in the plugin.

You can submit a PR anytime for this feature. Best way to do that would be to extend the class com.siyeh.ig.style.UnqualifiedFieldAccessInspection that is used in the plugin at com.dubreuia.processors.java.ProcessorFactory#getUnqualifiedFieldAccessProcessor.

Check out https://github.com/dubreuia/intellij-plugin-save-actions#contributing to setup your environment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

protected static member for inherited class - Stack Overflow
My problem is how to have one static model per subclass, while still ensuring it is defined in the parent class (so if...
Read more >
static members - cppreference.com
Static members of a class are not associated with the objects of the class: they are independent variables with static or thread (since...
Read more >
Static Classes and Static Class Members - C# guide
Static classes cannot be instantiated in C#. You access the members of a static class by using the class name itself.
Read more >
13.14 — Static member functions - Learn C++
If the static member variables are public, we can access them directly using the class name and the scope resolution operator.
Read more >
Controlling Access to Members of a Class - Oracle Help Center
Access level modifiers determine whether other classes can use a ... The private modifier specifies that the member can only be accessed in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found