Community
Participate
Working Groups
Using jdk7b25, this code now compiles fine: public class X { public static void main(String[] args) { Object o = new X(); String s = "World"; o += s; System.out.println(o); } public String toString() { return "Hello"; } } We reject it with: [compiled 10 lines in 422 ms: 23.6 lines/s] ---------- 1. ERROR in D:\tests_sources\X.java (at line 5) o += s; ^^^^^^ The operator += is undefined for the argument type(s) Object, String ---------- 1 problem (1 error) JDK6 still fails to compile it. So this should be done only if the compliance is 1.7. See http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4741726 for further details.
This is related bug 39248. It looks like javac changed its mind again.
It depends if we want to fix it regardless of the compliance or only for compliance above 1.7.
Created attachment 100733 [details] Proposed fix Proposed fix if we don't want to check the compliance being >= 1.7.
Created attachment 100734 [details] Proposed fix (2) Proposed fix if we want to fix this only for compliance >= 1.7.
Since the fix is pretty simple, I think this is a good candidate for RC2. Just need to decide what patch to release. All tests should be run as this will very likely fail the regression tests for bug 39248.
Pls release the flavor of the fix which allows it from 1.7 on. We may want to relax the rule later on, but for now this should be a good emulation.
Created attachment 117602 [details] updated patch based on HEAD Adds new regression tests triggered only when a JDK7 VM is used.
Released for 3.5M4. New regression test added in org.eclipse.jdt.core.tests.compiler.regression.AssignmentTest_1_7
Verified for 3.5M4 using I20081209-0100