Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 218320 Details for
Bug 383780
[compiler] Eclipse 4.2 creates ambiguous varargs method error in 1.6 compliance mode (does not mimic JDK bug)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch for migration FAQ
Fixed-bug-383780-compiler-Eclipse-42-creates-ambiguo-doc.patch (text/plain), 2.43 KB, created by
Ayushman Jain
on 2012-07-05 04:17:16 EDT
(
hide
)
Description:
patch for migration FAQ
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2012-07-05 04:17:16 EDT
Size:
2.43 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.jdt.doc.isv/porting/3.8/faq.html b/bundles/org.eclipse.jdt.doc.isv/porting/3.8/faq.html >index 5355d88..8881492 100644 >--- a/bundles/org.eclipse.jdt.doc.isv/porting/3.8/faq.html >+++ b/bundles/org.eclipse.jdt.doc.isv/porting/3.8/faq.html >@@ -13,10 +13,52 @@ > <h1>Eclipse 3.8 Plug-in Migration FAQ</h1> > > <ol> >- <li>None</li> >-<!-- >- <li><a href="#anchor1">Why ... ?</a></li> >---> >+ <li><a href="#illegalAmbiguousVarargs">Why does my varargs code which was legal in 3.7 and earlier no longer compile with 3.8 (Juno)?</a></li> >+</ol> >+<h2><a name="illegalAmbiguousVarargs">Why does my varargs code which was legal in 3.7 and earlier no longer compile with 3.8 (Juno)?</a></h2> >+<p> >+JDK 6 and below had a bug because of which the following code was considered legal:</p> >+<pre> >+public class VarargPrimitiveTest { >+ public static void test(int... a) { >+ System.out.println(Arrays.toString(a)); >+ } >+ >+ public static <T> void test(Object... a) { >+ System.out.println(Arrays.toString(a)); >+ } >+ >+ public static void main(String[] args) { >+ test(1); >+ } >+} >+</pre> >+<p>However, this bug was fixed in JDK 7 and the above code now reports an ambiguous invocation error at the call site for test(..). >+This was thereby fixed for Eclipse Juno via bug <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=346038">346038</a> across all >+compliance levels. This is why the above code will no longer compile with Juno.</p> >+ >+<p>If you still want the above code to compile in compliance < 1.7, to mimic JDK 6 or below, you can use the >+system property <b>tolerateIllegalAmbiguousVarargsInvocation</b> to force Eclipse to tolerate the ambiguous varargs cases >+such as above. This property can be set in the eclipse.ini file after the -vmargs setting as shown below:</p> >+<pre> >+... >+-vmargs >+-DtolerateIllegalAmbiguousVarargsInvocation=true >+... >+</pre> >+<p>Note that with this setting, Eclipse Juno does not only mimic JDK 6 and below in letting the above code compile, but also >+mimics JDK 6 and below in raising an error in cases such as below, even though they're legal in both JDK 7 and in Eclipse Juno when >+the tolerateIllegalAmbiguousVarargsInvocation is disabled:</p> >+<pre> >+class Test { >+ public static void foo(int ...i) {} >+ public static void foo(double...d) {} >+ >+ public static void main(String[] args) { >+ foo(1, 2, 3); // foo flagged ambiguous >+ } >+} >+</pre> > </ol> > > <!--
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 383780
:
218230
|
218240
|
218319
| 218320 |
218798
|
219412