oscarxie / google-styleguide

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

When I try to import eclipse-java-google-style.xml formatter to Eclipse I've got a warning dialog #33

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1. Download 
http://code.google.com/p/google-styleguide/source/browse/trunk/eclipse-java-goog
le-style.xml 
2. Download latest Eclipse IDE for Java Developers (I used 
eclipse-java-luna-SR1-linux-gtk.tar.gz )
3. Extract downloaded archive and launch eclipse
4. Open Window->Preferences->Java->Code Style->Formatter
5. Import downloaded package
6. Eclipse shows a warning dialog that the importing profile has newer version 
than current eclipse supported version. I attach the file with the dialog 
screenshot.

Is it expected? How can I use this profile with full features turn on in 
eclipse?

Original issue reported on code.google.com by barinov.sergei@gmail.com on 28 Oct 2014 at 9:13

Attachments:

GoogleCodeExporter commented 9 years ago
I'm having the same issue in Luna SR1. Additionally, I've noticed that the 
resulting
org.eclipse.jdt.core.prefs file that is generated when using this template 
lacks several of the preferences found in the original xml.

To Reproduce:
1) Perform the steps in the original poster's message to import the xml style.
2) Applied this style to a specific project:
    a) Right Click Project -> Properties
    b) Java Code Style -> Formatter
    c) Check Enable Project Specific Settings
    d) Select GoogleStyle
    e) Click Ok
3) Use the following python 2 snippet to convert eclipse-java-google-style.xml 
to the eclipse preferences format (xml2prefs.py):

from xml.etree import ElementTree
settings = ElementTree.parse('eclipse-java-google-style.xml').getroot()[0]
for s in settings:
  print '{}={}'.format(s.attrib['id'], s.attrib['value'])

4) Use the following commands to diff the actual org.eclipse.jdt.core.prefs 
that was generated by eclipse in step 2) with the expected prefs file as 
generated synthetically in step 3):

python xml2prefs.py | sort > expected
sort org.eclipse.jdt.core.prefs > actual
diff expected actual

The below output is the result of these commands:
0a1
> eclipse.preferences.version=1
2a4
> org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
3a6,8
> org.eclipse.jdt.core.compiler.debug.lineNumber=generate
> org.eclipse.jdt.core.compiler.debug.localVariable=generate
> org.eclipse.jdt.core.compiler.debug.sourceFile=generate
7,18d11
< org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field=1585
< 
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_field.count_dependen
t=1585|-1|1585
< 
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable=1585
< 
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_local_variable.count
_dependent=1585|-1|1585
< org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method=1585
< 
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_method.count_depende
nt=1585|-1|1585
< org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package=1585
< 
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_package.count_depend
ent=1585|-1|1585
< org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter=1040
< 
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter.count_depe
ndent=1040|-1|1040
< org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type=1585
< 
org.eclipse.jdt.core.formatter.alignment_for_annotations_on_type.count_dependent
=1585|-1|1585
20d12
< 
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression.
count_dependent=16|5|80
22d13
< 
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation.count_depen
dent=16|-1|16
24d14
< 
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant.count_de
pendent=16|-1|16
26d15
< 
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
all.count_dependent=16|5|80
28d16
< 
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation.coun
t_dependent=16|5|80
30d17
< 
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_e
xpression.count_dependent=16|4|80
33,35d19
< 
org.eclipse.jdt.core.formatter.alignment_for_binary_expression.count_dependent=1
6|-1|16
< 
org.eclipse.jdt.core.formatter.alignment_for_cascading_method_invocation_with_ar
guments=16
< 
org.eclipse.jdt.core.formatter.alignment_for_cascading_method_invocation_with_ar
guments.count_dependent=16|-1|16
39d22
< 
org.eclipse.jdt.core.formatter.alignment_for_enum_constants.count_dependent=16|5
|48
41,46d23
< 
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer.co
unt_dependent=16|5|80
< org.eclipse.jdt.core.formatter.alignment_for_field_declaration=16
< org.eclipse.jdt.core.formatter.alignment_for_for_statement=16
< org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments=16
< 
org.eclipse.jdt.core.formatter.alignment_for_generic_type_arguments.count_depend
ent=16|-1|16
< org.eclipse.jdt.core.formatter.alignment_for_local_variable_declaration=16
49,50d25
< 
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields.count_dependent=16|
-1|16
< org.eclipse.jdt.core.formatter.alignment_for_new_anonymous_class=20
52d26
< 
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declarati
on.count_dependent=16|5|80
54d27
< 
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration.co
unt_dependent=16|5|80
57d29
< 
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation.count
_dependent=16|4|48
60d31
< 
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration
.count_dependent=16|4|49
62d32
< 
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration
.count_dependent=16|4|48
64d33
< 
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declar
ation.count_dependent=16|4|48
66d34
< 
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration
.count_dependent=16|4|48
87a56
> org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
104d72
< 
org.eclipse.jdt.core.formatter.comment_new_line_at_start_of_html_paragraph=true
111,113c79,80
< org.eclipse.jdt.core.formatter.disabling_tag=@formatter:off
< org.eclipse.jdt.core.formatter.enabling_tag=@formatter:on
< org.eclipse.jdt.core.formatter.force_if_else_statement_brace=true
---
> org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
> org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
134a102
> org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not 
insert
136a105
> 
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_ini
tializer=do not insert
180d148
< org.eclipse.jdt.core.formatter.insert_space_after_comment_prefix=do not insert
181a150
> org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
258a228
> org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
325,330d294
< org.eclipse.jdt.core.formatter.wrap_comment_inline_tags=false
< org.eclipse.jdt.core.formatter.wrap_non_simple_local_variable_annotation=true
< org.eclipse.jdt.core.formatter.wrap_non_simple_member_annotation=true
< org.eclipse.jdt.core.formatter.wrap_non_simple_package_annotation=true
< org.eclipse.jdt.core.formatter.wrap_non_simple_parameter_annotation=false
< org.eclipse.jdt.core.formatter.wrap_non_simple_type_annotation=true
332d295
< org.eclipse.jdt.core.formatter.wrap_prefer_two_fragments=false

-------

There are a few false positives, but mostly this shows a number of prefs that
aren't getting imported.

I've been trying to convert a few of my projects from my own hacked together 
eclipse
format style to this google style, so these issues are bumming me out :(.

Original comment by rtvei...@gmail.com on 22 Dec 2014 at 10:39