0

Under the braces option , i have used all the properties to set to sameline. But on the Blank lines option, Number of empty lines to preserve is 1 . This is overriding my existing property.

Expected:

public class SamplePreparedStatement {
public static void main(String[] args) throws SQLException {

Actual

public class SamplePreparedStatement {
public static void main(String[] args) throws SQLException

{

Settings:

<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
    <setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>

Aleksandr M
  • 24,264
  • 12
  • 69
  • 143

1 Answers1

1

In eclipse menu Window - > Preferences -> Java -> Code Style ->Formatter

then import your current for-matter into eclipse and follow the below steps.

Window - > Preferences -> Java -> Code Style -> Formatter

Then click on Edit button a pup window will open. Again it has multiple tabs click on Braces.

Under which Class or interface declaration there will be a drop down box in which select Same line option.

Then save your for-matter post that changes will reflect.

Krishna
  • 198
  • 2
  • 2
  • 12