Bug 348911

Summary: [compiler] Method resolution doesn't follow the JLS
Product: [Eclipse Project] JDT Reporter: Rémi Forax <forax>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: VERIFIED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, jarthana, Olivier_Thomann
Version: 3.7   
Target Milestone: 3.8 M4   
Hardware: All   
OS: All   
Whiteboard:

Description Rémi Forax CLA 2011-06-09 10:47:34 EDT
Build Identifier: I20110127-2034

The following code compiles but should not:
public class Foo {
  public static void main(String[] args) {
    method("str");
    method("str", 1);
    method("str", 1, "data");
  }

  public static void method(String str, int num, Object... data) {
    // do nothing
  }

  public static void method(String str, Object... data) {
    // do nothing
  }
}

see http://mail.openjdk.java.net/pipermail/compiler-dev/2011-June/003320.html
for a discussion on the javac compiler list.

Note that javac 6 exhibits the same bug but it was fixed in javac 7. 

Reproducible: Always

Steps to Reproduce:
1. type the Foo.class in Eclipse editor
   it should report two errors.
Comment 1 Olivier Thomann CLA 2011-06-09 10:54:05 EDT
Reproduced using latest.
Srikanth, please investigate. Tagging as 3.7.1. Will reassess based on the fix.
Comment 2 Ayushman Jain CLA 2011-06-09 12:22:14 EDT
Tagging as 1.7 since this is a change brought about by javac 7, and all javac 7 fixes have been fixed in BETA_JAVA7.
Comment 3 Srikanth Sankaran CLA 2011-06-10 01:35:29 EDT
See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7042566 and
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7044388.

Apparently, this fix is causing some non trivial amount of code to
not compile anymore, since this seems to have bubbled up very quickly
from more than one source.
Comment 4 Srikanth Sankaran CLA 2011-06-10 02:29:44 EDT
Targetting 3.8, since this is not a regression in 3.7, eclipse and
javac behavior has always matched up until 7b143.
Comment 5 Srikanth Sankaran CLA 2011-11-21 03:58:46 EST
The code in comment#0 compiles on 3.8 stream as of 21 Nov 2011. I'll check
on the regressions referred to in comment#3 and close this defect as appropriate.
Comment 6 Srikanth Sankaran CLA 2011-11-21 04:12:05 EST
The regressions mentioned in comment#3 are javac specific. Eclipse 3.8 stream
top of branch behavior as of today matches JDK7b147. Closing as WORKSFORME.

(This issue most likely got fixed along with either of bug 346038 or 
bug 346039).
Comment 7 Jay Arthanareeswaran CLA 2011-12-06 06:33:04 EST
Verified for 3.8M4 with build I20111204-2000.