Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
GoogleCodeExporter opened this issue May 20, 2015 · 7 comments
Closed

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

GoogleCodeExporter opened this issue May 20, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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
Copy link
Author

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
Copy link
Author

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

@RawToast
Copy link

Is there any chance for this to get merged? We also have developers using IntelliJ and Eclipse and it would be great to no longer have to deal with this when merging.

@mkobit
Copy link

mkobit commented Oct 16, 2015

+1. There are several open pull requests for this:

  1. Static imports imported first #49
  2. Fix static import ordering. #60

bundeskanzler4711 pushed a commit to bundeskanzler4711/styleguide that referenced this issue Jun 8, 2016
…all my commits solves:

- Issue google#26 Static imports imported first, pull request google#49
- Issue google#69 intellij-java-google-style.xml was not applied correctly for Idea 14
- Pull Request google#58 Add package tld io to intellij import layout.
- Pull Request google#120 Adding io.* to IMPORT_LAYOUT_TABLE in IntelliJ style
- Pull Request google#115 Sync Java IDE styles with internal configuration
- Pull Request google#96 Modernize IntelliJ style file
- Pull Request google#75 Add Java code style for IntelliJ 15
bundeskanzler4711 pushed a commit to bundeskanzler4711/styleguide that referenced this issue Jun 8, 2016
…all my commits solves:

- Issue google#26 Static imports imported first, pull request google#49
- Issue google#69 intellij-java-google-style.xml was not applied correctly for Idea 14
- Pull Request google#58 Add package tld io to intellij import layout.
- Pull Request google#120 Adding io.* to IMPORT_LAYOUT_TABLE in IntelliJ style
- Pull Request google#115 Sync Java IDE styles with internal configuration
- Pull Request google#96 Modernize IntelliJ style file
- Pull Request google#75 Add Java code style for IntelliJ 15
bundeskanzler4711 added a commit to bundeskanzler4711/styleguide that referenced this issue Jun 8, 2016
…all my commits solves:

- Issue google#26 Static imports imported first, pull request google#49
- Issue google#69 intellij-java-google-style.xml was not applied correctly for Idea 14
- Pull Request google#58 Add package tld io to intellij import layout.
- Pull Request google#120 Adding io.* to IMPORT_LAYOUT_TABLE in IntelliJ style
- Pull Request google#115 Sync Java IDE styles with internal configuration
- Pull Request google#96 Modernize IntelliJ style file
- Pull Request google#75 Add Java code style for IntelliJ 15
@novalis
Copy link

novalis commented May 31, 2017

This seems to be working now and should probably be closed.

@shicks shicks closed this as completed Sep 5, 2017
tkruse added a commit to tkruse/styleguide that referenced this issue Feb 24, 2019
tkruse added a commit to tkruse/styleguide that referenced this issue Feb 24, 2019
Fix google#26 --version command and fork information in help output
m-chaturvedi pushed a commit to m-chaturvedi/styleguide that referenced this issue Feb 25, 2020
@rmkane
Copy link

rmkane commented Apr 22, 2021

The original referenced link is now broken, here is the new one:

https://google.github.io/styleguide/javaguide.html#s3.3.3-import-ordering-and-spacing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants