diff options
author | Ayushman Jain | 2012-08-07 08:26:26 +0000 |
---|---|---|
committer | Dani Megert | 2013-01-16 11:59:20 +0000 |
commit | fcb6b9f4449034be93fe4a53d75826bae6f6b75e (patch) | |
tree | cd801e88e634528d2ca1c267b532c8d8ea9e147d | |
parent | 5d123b3183a3d7c95b21091af26177d81f5bb433 (diff) | |
download | eclipse.platform.common-fcb6b9f4449034be93fe4a53d75826bae6f6b75e.tar.gz eclipse.platform.common-fcb6b9f4449034be93fe4a53d75826bae6f6b75e.tar.xz eclipse.platform.common-fcb6b9f4449034be93fe4a53d75826bae6f6b75e.zip |
migration FAQ update for bug 383780
-rw-r--r-- | bundles/org.eclipse.jdt.doc.isv/porting/3.8/faq.html | 53 |
1 files changed, 48 insertions, 5 deletions
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 5355d88f0..5b7b7e276 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 @@ -1,7 +1,7 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html lang="en"> <head> -<meta name="copyright" content="Copyright (c) IBM Corporation and others 2011. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > +<meta name="copyright" content="Copyright (c) IBM Corporation and others 2012. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <meta http-equiv="Content-Style-Type" content="text/css"> <link rel="STYLESHEET" href="../../book.css" charset="ISO-8859-1" type="text/css"> @@ -13,11 +13,54 @@ <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> + +<p>For more information, please see <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=383780">bug 383780</a>.</p> <!-- <h2><a name="anchor1">Why ... ?</a></h2> |