cmsimike / google-styleguide

Automatically exported from code.google.com/p/google-styleguide
0 stars 0 forks source link

intellij-java-google-style.xml puts static imports last #26

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
According to 

http://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s3.3.3-import-o
rdering-and-spacing

"Import statements are divided into the following groups, in this order, with 
each group separated by a single blank line:
1. All static imports in a single group ..."

static imports should come first. But in intellij-java-google-style.xml they 
are listed as last:

https://code.google.com/p/google-styleguide/source/browse/trunk/intellij-java-go
ogle-style.xml#251

Steps to reproduce
1. Open the attached Test.java in IntelliJ
2. In IntelliJ IDEA, do Reformat Code (CTRL+ALT+L on Windows)
3. Check "Organize Import" and "Rearrange Entries"
4. Click OK

What is the expected output? 

package test;

import static java.lang.System.out;

import java.text.NumberFormat;

public class Test {

    public void test() {
      out.println(NumberFormat.getInstance().format(Math.PI));
    }
}

What do you see instead?

package test;

import java.text.NumberFormat;

import static java.lang.System.out;

public class Test {

    public void test() {
      out.println(NumberFormat.getInstance().format(Math.PI));
    }
}

What version of the product are you using? 

* r134 of intellij-java-google-style.xml
* IntelliJ IDEA 13.03
* JRE 1.7.0_40-b43 x86

On what operating system?
* Windows 7 Enterprise (V 6.1 SP1)

Please provide any additional information below.

I attached the corrected intellij-java-google-style.xml to places the static 
imports first as per the code style.

Original issue reported on code.google.com by florian....@gmail.com on 8 Jul 2014 at 5:39

Attachments:

GoogleCodeExporter commented 9 years ago
I'd like to point out this still hasn't been fixed. Static imports still come 
last.

Original comment by SupaHam...@gmail.com on 17 Sep 2014 at 8:32

GoogleCodeExporter commented 9 years ago
The IntelliJ XML settings file for Google Style seems to have a lot other 
errors as well. Expected: Line width limited to 100 characters. Actual: No 
specification.

This configuration file hasn't been updated since 2011, while the Eclipse file 
has been steadily updated over time. Could we please update this?

Original comment by andrew.p...@gmail.com on 11 Feb 2015 at 8:38

GoogleCodeExporter commented 9 years ago
I second (or 4th) this: we have developers working with IntelliJ and Eclipse 
and it doesn't make sense to have constant reformats because of this 
inconsistency.

Original comment by bitti1...@gmail.com on 26 Mar 2015 at 8:52