Community
Participate
Working Groups
There are a number of places in existing Java code that are written as: import java.util.Date; public class Test { public static void main(String args[]) throws Exception { StringBuffer buffer = new StringBuffer(); buffer.append("foo" + new Date() + "bar"); } } (see also bug 492230) This will result in two StringBuffers being initialised; one to perform the implicit String concatenation, and the other initialised explicitly on the first line. We should generate a warning when this occurs and offer a quick-fix to re-write this as: buffer.append("foo").append(new Date()).append("bar");
Moving to JDT Core for consideration.