Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 396883

Summary: [compiler] Unwanted method should be static compiler warning
Product: [Eclipse Project] JDT Reporter: RĂ¼diger Herrmann <ruediger.herrmann>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: VERIFIED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: jarthana, manoj.palat, ruediger.herrmann
Version: 3.8   
Target Milestone: 4.3 M2   
Hardware: All   
OS: All   
Whiteboard:

Description RĂ¼diger Herrmann CLA 2012-12-18 18:12:07 EST
Turn on the 'Method can be static' compiler warning and compile the snippet below.
The compiler issues a warning that the 'internalMethod' should be declared static. Admittedly this is a weird construct, but this method cannot be declared static.
Removing the 'ExtendedClass' before the 'super' keyword resolves the problem.

class ExtendableClass {
  String[] method() {
    return null;
  }
}

class ExtendingClass extends ExtendableClass {
  String[] method() {
    return internalMethod();
  }

  private String[] internalMethod() {  // Method can be declared as static
    return ExtendingClass.super.method();
  }
}
Comment 1 Jay Arthanareeswaran CLA 2012-12-19 00:53:31 EST
I don't know what has changed, but this is not reproducible in 4.3 M4 build. However, I can reproduce in 4.2/3.8, 4.2.1 and even in the latest M build.
Comment 2 Jay Arthanareeswaran CLA 2012-12-20 00:32:00 EST
This is already fixed via bug 379834.

*** This bug has been marked as a duplicate of bug 379834 ***
Comment 3 Manoj N Palat CLA 2013-03-12 06:02:24 EDT
Verified for 4.3 M6 I20130310-2000