Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How can I avoid the warning in this scenario?
How can I avoid the warning in this scenario? [message #1436855] Fri, 03 October 2014 10:02 Go to next message
Eclipse UserFriend
public class A {
    // warning occurs on this method:
    // The method foo() from the type A can potentially be declared as static
    protected boolean foo() {
        return false;
    }
}

public final class B extends A {
    @Override
    protected boolean foo() {
        // do non-static, B specific things
        return true;
    }
}

index.php/fa/19378/0/

Is this behavior expected? It seems like a spurious warning to me. I wonder if it warrants filing a bug report.
  • Attachment: static.png
    (Size: 2.04KB, Downloaded 375 times)

[Updated on: Fri, 03 October 2014 10:13] by Moderator

Re: How can I avoid the warning in this scenario? [message #1440517 is a reply to message #1436855] Wed, 08 October 2014 09:10 Go to previous messageGo to next message
Eclipse UserFriend
I understand your question. When we are in A, we see that foo is not calling any other function of A. So let us narrow down it's scope. Make the method static and thus the method can only call static methods.

There is no way one can figure out while processing A that what are subclasses of A. That is why we have the word "potentially" Smile.
Re: How can I avoid the warning in this scenario? [message #1440556 is a reply to message #1440517] Wed, 08 October 2014 10:09 Go to previous messageGo to next message
Eclipse UserFriend
shankha banerjee wrote on Wed, 08 October 2014 09:10
[...]
There is no way one can figure out while processing A that what are subclasses of A. [...].


I disagree with this. Eclipse should trivially be able to find out the class hierarchy; indeed, that's what Ctrl+T does.
Re: How can I avoid the warning in this scenario? [message #1442080 is a reply to message #1440556] Fri, 10 October 2014 11:33 Go to previous message
Eclipse UserFriend
After a week for review here, I submitted bug 446679 on Bugzilla.
Previous Topic:Cannot Install/configure Glassfish Server 4.1 in Eclipse Luna x86
Next Topic:Luna JEE Maven integration doesn't work out of the box
Goto Forum:
  


Current Time: Sat Jul 12 11:39:12 EDT 2025

Powered by FUDForum. Page generated in 0.04061 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top