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

Bug 216930

Summary: [1.5][compiler] Wrong compiler error when using static method with same signature as non static one but with variable arguments
Product: [Eclipse Project] JDT Reporter: Miquel Herrera <miquel>
Component: CoreAssignee: Kent Johnson <kent_johnson>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eric_jodet, Olivier_Thomann
Version: 3.3.1   
Target Milestone: 3.4 M6   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Proposed patch with testcase none

Description Miquel Herrera CLA 2008-01-29 11:31:49 EST
Build ID: M20071023-1652

Steps To Reproduce:
Create a final class with two methods such as:
public final class AndExpression {
public static AndExpression and(WhereExpression... expression)
{
	return new AndExpression(expression);
}
	
public AndExpression and(WhereExpression expression)
{
	this.group.add(expression);
	return this;
}
}

Then import statically in another place like:

import static uk.nominet.core.search.builder.expression.AndExpression.and;

and use it as:

query.setWhereCondition(
    and(query.getWhereCondition())
    .and(query.getOtherWhereCondition()));



More information:
class AndExpression in the example, compiles well into eclipse but you get an error of the type The method and(WhereExpression) is undefined for the type THE_TYPE_WHERE_YOU_USE_AND_METHOD

However that construction is perfectly valid and java compiler does not complain at all.
Comment 1 Kent Johnson CLA 2008-03-13 14:58:47 EDT
Created attachment 92491 [details]
Proposed patch with testcase
Comment 2 Kent Johnson CLA 2008-03-13 14:59:38 EDT
Released into HEAD for 3.4M6
Comment 3 Eric Jodet CLA 2008-03-26 03:16:33 EDT
Verified for 3.4M6 using build I20080324-1300