Bug 99882

Summary: No support for "new" assignment statement wrapping
Product: [Eclipse Project] JDT Reporter: Hacking Bear <cutebear103>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: chris, juergenkrey
Version: 3.1   
Target Milestone: 3.3 RC4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Hacking Bear CLA 2005-06-13 23:54:30 EDT
I twist around the Code Formatter but find not way to properly wrap an 
assignment statement.

Especially with Java 1.5 generics, assignment statement can become very long 
at the point of the new operator. For example, set the line length to 80, and 
the following statement is not wrapped nicely.

    private HashMap<String, String> m_stringKeyToValueMap = new 
HashMap<String, String>(8);

I can get the wrapping occurs at the parameter but it is already too far away 
and looks ugly.

We need to be able to wrap right before or after the equal sign.
Comment 1 Maxim Romashchenko CLA 2005-08-15 08:26:31 EDT
Another example of code which does not wrap well.
Actually, it does not wrap at all.


--------
import java.util.ArrayList;
import java.util.List;

import net.sf.acegisecurity.GrantedAuthority;
import net.sf.acegisecurity.providers.dao.AuthenticationDao;

public class AuthDao implements AuthenticationDao {
    public UserDetails loadUserByUsername(String username) {

        // the next line does not wrap:
        final List<GrantedAuthority> authorities = new
ArrayList<GrantedAuthority>();
    }
}
--------
Comment 2 Olivier Thomann CLA 2007-06-21 12:11:05 EDT
Closing as WORKSFORME.
In 3.3, you can set a line wrapping for assignment in:
Preferences>Java>Code Style>Formatter>Line Wrapping>Expressions>Àssigments