Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 14:02 Go to next message
Andrew C is currently offline Andrew CFriend
Messages: 6
Registered: October 2014
Junior Member
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 333 times)

[Updated on: Fri, 03 October 2014 14:13]

Report message to a moderator

Re: How can I avoid the warning in this scenario? [message #1440517 is a reply to message #1436855] Wed, 08 October 2014 13:10 Go to previous messageGo to next message
shankha banerjee is currently offline shankha banerjeeFriend
Messages: 40
Registered: February 2013
Member
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 14:09 Go to previous messageGo to next message
Andrew C is currently offline Andrew CFriend
Messages: 6
Registered: October 2014
Junior Member
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 15:33 Go to previous message
Andrew C is currently offline Andrew CFriend
Messages: 6
Registered: October 2014
Junior Member
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: Wed Apr 24 21:13:26 GMT 2024

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

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

Back to the top