| Summary: | [compiler] Unwanted method should be static compiler warning | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | RĂ¼diger Herrmann <ruediger.herrmann> |
| Component: | Core | Assignee: | 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: | |||
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. This is already fixed via bug 379834. *** This bug has been marked as a duplicate of bug 379834 *** Verified for 4.3 M6 I20130310-2000 |
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(); } }