Bug 85062

Summary: [compiler] Implicit static method invocation should target the receiver type not the declaring class
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: kent_johnson
Version: 3.1   
Target Milestone: 3.1 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Apply on HEAD none

Description Olivier Thomann CLA 2005-02-11 16:51:12 EST
In this example,

class A { 
    static int foo() { 
        return 10;
    }
    
	static int bar() { 
        return 11;
    }    
}

public class X extends A {
    public static void main(String argv[]) {
        int i = A.foo();
        int j = bar();
        System.out.println(i + " - " + j);
    }
}

The method invocation A.foo() should have the declaring class A, but the method
invocation bar() should have the declaring class X. Not A.
Comment 1 Olivier Thomann CLA 2005-02-11 16:52:27 EST
Created attachment 17877 [details]
Apply on HEAD

This patch fixes the declaring class by using the actualReceiverType if the
receiver is an implicit this.
Comment 2 Olivier Thomann CLA 2005-02-11 16:57:28 EST
I am not sure that the test if (receiver.isImplicitThis()) { is required,
because the actualReceiverType is fine in both cases.
Comment 3 Philipe Mulet CLA 2005-02-19 12:16:02 EST
Consider static receiver type from 1.4 compliance on, also had to tweak lookup
using static imports to properly set the actualReceiverType.

Updated Compliance_1* tests to match new behavior.
We now match 1.4.2 (and no longer 1.4.1).
Fixed
Comment 4 David Audel CLA 2005-03-31 09:17:46 EST
Verified in I20050330-0500