diff options
author | Alexander Kurtakov | 2020-05-11 05:18:14 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2020-05-11 15:30:19 +0000 |
commit | 0def880e929be4b7c72c38b34aa8554a94614bfd (patch) | |
tree | 9ceff5846edf5dc98bb1c77fdf569cccbc71e1eb | |
parent | a07f3fa8e690b3539d951d4841d9f7c60f27ce92 (diff) | |
download | rt.equinox.p2-0def880e929be4b7c72c38b34aa8554a94614bfd.tar.gz rt.equinox.p2-0def880e929be4b7c72c38b34aa8554a94614bfd.tar.xz rt.equinox.p2-0def880e929be4b7c72c38b34aa8554a94614bfd.zip |
Use List.sort directly.S4_16_0_M3I20200521-1000I20200520-1800I20200520-0600I20200519-1800I20200519-1130I20200519-1010I20200518-2220I20200518-1800I20200516-0600I20200515-1930I20200514-1800I20200513-1800I20200512-1800I20200511-1800
Rather than Collections.sort(list)
Change-Id: Idbc2a436629107cd5a5143d41965e282813ebad5
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
16 files changed, 224 insertions, 174 deletions
diff --git a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java index 701fb3427..d163af047 100644 --- a/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java +++ b/bundles/org.eclipse.equinox.p2.director.app/src/org/eclipse/equinox/internal/p2/director/app/DirectorApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2018 IBM Corporation and others. + * Copyright (c) 2007, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -715,7 +715,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener { } } - Collections.sort(allRoots); + allRoots.sort(null); String formattedString = listFormat.format(allRoots); System.out.println(formattedString); @@ -1290,7 +1290,7 @@ public class DirectorApplication implements IApplication, ProvisioningListener { Map<String, String> tags = registry.getProfileStateProperties(profile.getProfileId(), IProfile.STATE_PROP_TAG); //Sort the tags from the most recent to the oldest List<String> timeStamps = new ArrayList<>(tags.keySet()); - Collections.sort(timeStamps, Collections.reverseOrder()); + timeStamps.sort(Collections.reverseOrder()); for (String timestamp : timeStamps) { System.out.println(tags.get(timestamp)); } diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java index e7334a627..1929396c0 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OperationGenerator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 IBM Corporation and others. + * Copyright (c) 2007, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -36,10 +36,10 @@ public class OperationGenerator { tmpTo.removeAll(intersection); List<IInstallableUnit> from = new ArrayList<>(tmpFrom); - Collections.sort(from); + from.sort(null); List<IInstallableUnit> to = new ArrayList<>(tmpTo); - Collections.sort(to); + to.sort(null); generateUpdates(from, to); generateInstallUninstall(from, to); diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java index 51050fb7c..1d3cc1e80 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/OptimizationFunction.java @@ -73,7 +73,7 @@ public class OptimizationFunction { } // Set the weight such that things that are already installed are not updated - Collections.sort(conflictingEntries, Collections.reverseOrder()); + conflictingEntries.sort(Collections.reverseOrder()); BigInteger weight = POWER; // have we already found a version that is already installed? boolean foundInstalled = false; diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java index 36b0e7122..808c70e83 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/Projector.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2018 IBM Corporation and others. + * Copyright (c) 2007, 2020 IBM Corporation and others. * * This * program and the accompanying materials are made available under the terms of @@ -232,7 +232,7 @@ public class Projector { dependencyHelper = new DependencyHelper<>(solver); } List<IInstallableUnit> iusToOrder = new ArrayList<>(queryResult.toSet()); - Collections.sort(iusToOrder); + iusToOrder.sort(null); for (IInstallableUnit iu : iusToOrder) { if (monitor.isCanceled()) { result.merge(Status.CANCEL_STATUS); @@ -1009,7 +1009,7 @@ public class Projector { private void printSolution(Collection<IInstallableUnit> state) { ArrayList<IInstallableUnit> l = new ArrayList<>(state); - Collections.sort(l); + l.sort(null); Tracing.debug("Solution:"); //$NON-NLS-1$ Tracing.debug("Numbers of IUs selected: " + l.size()); //$NON-NLS-1$ for (IInstallableUnit s : l) { diff --git a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/UserDefinedOptimizationFunction.java b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/UserDefinedOptimizationFunction.java index 4f699cf25..f5cd7da1d 100644 --- a/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/UserDefinedOptimizationFunction.java +++ b/bundles/org.eclipse.equinox.p2.director/src/org/eclipse/equinox/internal/p2/director/UserDefinedOptimizationFunction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 Daniel Le Berre and others. + * Copyright (c) 2009, 2020 Daniel Le Berre and others. * * This * program and the accompanying materials are made available under the terms of @@ -152,8 +152,8 @@ public class UserDefinedOptimizationFunction extends OptimizationFunction { IQuery<IInstallableUnit> query = QueryUtil.createMatchQuery(req.getMatches()); IQueryResult<IInstallableUnit> matches = picker.query(query, null); List<IInstallableUnit> toSort = new ArrayList<>(matches.toUnmodifiableSet()); - Collections.sort(toSort, Collections.reverseOrder()); - if (toSort.size() == 0) + toSort.sort(Collections.reverseOrder()); + if (toSort.isEmpty()) continue; Projector.AbstractVariable abs = new Projector.AbstractVariable(); diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java index a0e2218f4..dbef034c3 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2018 IBM Corporation and others. + * Copyright (c) 2007, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -7,7 +7,7 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ @@ -32,15 +32,12 @@ public class ProfileWriter extends MetadataWriter implements ProfileXMLConstants attribute(TIMESTAMP_ATTRIBUTE, Long.toString(profile.getTimestamp())); writeProperties(profile.getProperties()); ArrayList<IInstallableUnit> ius = new ArrayList<>(profile.query(QueryUtil.createIUAnyQuery(), null).toUnmodifiableSet()); - Collections.sort(ius, new Comparator<IInstallableUnit>() { - @Override - public int compare(IInstallableUnit iu1, IInstallableUnit iu2) { - int IdCompare = iu1.getId().compareTo(iu2.getId()); - if (IdCompare != 0) - return IdCompare; + ius.sort((iu1, iu2) -> { + int IdCompare = iu1.getId().compareTo(iu2.getId()); + if (IdCompare != 0) + return IdCompare; - return iu1.getVersion().compareTo(iu2.getVersion()); - } + return iu1.getVersion().compareTo(iu2.getVersion()); }); writeInstallableUnits(ius.iterator(), ius.size()); writeInstallableUnitsProperties(ius.iterator(), ius.size(), profile); diff --git a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Expression.java b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Expression.java index 6d298fed7..74e029a0b 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Expression.java +++ b/bundles/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Expression.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2018 Cloudsmith Inc. and others. + * Copyright (c) 2009, 2020 Cloudsmith Inc. and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -403,7 +403,7 @@ public abstract class Expression implements IExpression, Comparable<Expression>, if (top == 1) return operands.get(0); - Collections.sort(operands); + operands.sort(null); List<Compacter> splits = new ArrayList<>(); int reverseOp = op == TYPE_AND ? TYPE_OR : TYPE_AND; @@ -421,7 +421,7 @@ public abstract class Expression implements IExpression, Comparable<Expression>, if (top == 1) return operands.get(0); - Collections.sort(operands); + operands.sort(null); Expression[] expArray = operands.toArray(new Expression[top]); return op == TYPE_AND ? new And(expArray) : new Or(expArray); } diff --git a/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.core.prefs index 0300aa8b3..fe0819f9a 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.core.prefs @@ -155,6 +155,7 @@ org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16 org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_record_components=16 org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 @@ -162,6 +163,7 @@ org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0 org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 @@ -169,7 +171,9 @@ org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 @@ -178,6 +182,7 @@ org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch=0 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line @@ -189,6 +194,8 @@ org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_record_constructor=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_record_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true @@ -206,6 +213,7 @@ org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false org.eclipse.jdt.core.formatter.comment.indent_root_tags=false org.eclipse.jdt.core.formatter.comment.indent_tag_description=false org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true @@ -221,6 +229,7 @@ org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=fals org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_empty_lines=false @@ -286,6 +295,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arg org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert @@ -294,6 +304,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert @@ -310,6 +321,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not ins org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert @@ -348,6 +360,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not in org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert @@ -374,6 +387,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_ar org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert @@ -393,6 +407,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_ org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert @@ -408,6 +424,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert @@ -447,6 +464,8 @@ org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line=one_line_never +org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false @@ -456,7 +475,12 @@ org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.lineSplit=120 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 +org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines @@ -466,11 +490,13 @@ org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=commo org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.text_block_indentation=0 org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true diff --git a/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.ui.prefs index 1f5e3b3ad..5df378ce1 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.ui.prefs +++ b/bundles/org.eclipse.equinox.p2.publisher/.settings/org.eclipse.jdt.ui.prefs @@ -1,7 +1,7 @@ eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile -formatter_settings_version=16 +formatter_settings_version=19 org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.importorder=; org.eclipse.jdt.ui.ondemandthreshold=3 diff --git a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AdviceFileParser.java b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AdviceFileParser.java index 0fe334ddb..c54c9c1f3 100644 --- a/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AdviceFileParser.java +++ b/bundles/org.eclipse.equinox.p2.publisher/src/org/eclipse/equinox/p2/publisher/AdviceFileParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 IBM Corporation and others. + * Copyright (c) 2009, 2020 IBM Corporation and others. * * This * program and the accompanying materials are made available under the terms of @@ -8,7 +8,7 @@ * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 - * + * * Contributors: IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.p2.publisher; @@ -71,7 +71,8 @@ public class AdviceFileParser { private static final String UPDATE_DESCRIPTOR_PREFIX = "update."; //$NON-NLS-1$ public static final Version COMPATIBLE_VERSION = Version.createOSGi(1, 0, 0); - public static final VersionRange VERSION_TOLERANCE = new VersionRange(COMPATIBLE_VERSION, true, Version.createOSGi(2, 0, 0), false); + public static final VersionRange VERSION_TOLERANCE = new VersionRange(COMPATIBLE_VERSION, true, + Version.createOSGi(2, 0, 0), false); private Map<String, String> adviceProperties = new HashMap<>(); private List<IProvidedCapability> adviceProvides = new ArrayList<>(); @@ -99,7 +100,7 @@ public class AdviceFileParser { checkAdviceVersion(adviceVersion); List<String> keys = new ArrayList<>(advice.keySet()); - Collections.sort(keys); + keys.sort(null); keysIterator = keys.iterator(); next(); @@ -158,15 +159,15 @@ public class AdviceFileParser { while (current != null && current.startsWith(prefix)) { String token = current.substring(prefix.length()); switch (token) { - case NAME: - propertyName = currentValue(); - break; - case VALUE: - propertyValue = currentValue(); - break; - // we ignore elements we do not understand - default: - break; + case NAME: + propertyName = currentValue(); + break; + case VALUE: + propertyValue = currentValue(); + break; + // we ignore elements we do not understand + default: + break; } next(); } @@ -177,42 +178,43 @@ public class AdviceFileParser { private IUpdateDescriptor parseUpdateDescriptor(String prefix, String id) { String name = id; String description = null; - String range = "[0.0.0,$version$)"; //$NON-NLS-1$ + String range = "[0.0.0,$version$)"; //$NON-NLS-1$ String severity = "0"; //$NON-NLS-1$ String match = null; while (current != null && current.startsWith(prefix)) { String token = current; switch (token) { - case UPDATE_MATCH_EXP: - match = currentValue(); - break; - case UPDATE_ID: - name = currentValue(); - break; - case UPDATE_DESCRIPTION: - description = currentValue(); - break; - case UPDATE_RANGE: - range = currentValue(); - break; - case UPDATE_SEVERITY: - severity = currentValue(); - break; - // ignore - default: - break; + case UPDATE_MATCH_EXP: + match = currentValue(); + break; + case UPDATE_ID: + name = currentValue(); + break; + case UPDATE_DESCRIPTION: + description = currentValue(); + break; + case UPDATE_RANGE: + range = currentValue(); + break; + case UPDATE_SEVERITY: + severity = currentValue(); + break; + // ignore + default: + break; } next(); } if (match != null) { - //When update.match is specified, versionRange and id are ignored + // When update.match is specified, versionRange and id are ignored IExpression expr = ExpressionUtil.parse(substituteVersionAndQualifier(match)); IMatchExpression<IInstallableUnit> matchExpression = ExpressionUtil.getFactory().matchExpression(expr); Collection<IMatchExpression<IInstallableUnit>> descriptors = new ArrayList<>(1); descriptors.add(matchExpression); - return MetadataFactory.createUpdateDescriptor(descriptors, Integer.valueOf(severity), description, (URI) null); + return MetadataFactory.createUpdateDescriptor(descriptors, Integer.valueOf(severity), description, + (URI) null); } range = substituteVersionAndQualifier(range); VersionRange versionRange = VersionRange.create(range); @@ -236,18 +238,18 @@ public class AdviceFileParser { while (current != null && current.startsWith(prefix)) { String token = current.substring(prefix.length()); switch (token) { - case NAME: - name = currentValue(); - break; - case NAMESPACE: - namespace = currentValue(); - break; - case VERSION: - capabilityVersion = Version.parseVersion(substituteVersionAndQualifier(currentValue())); - break; - // we ignore elements we do not understand - default: - break; + case NAME: + name = currentValue(); + break; + case NAMESPACE: + namespace = currentValue(); + break; + case VERSION: + capabilityVersion = Version.parseVersion(substituteVersionAndQualifier(currentValue())); + break; + // we ignore elements we do not understand + default: + break; } next(); } @@ -283,39 +285,39 @@ public class AdviceFileParser { while (current != null && current.startsWith(prefix)) { String token = current.substring(prefix.length()); switch (token) { - case GREEDY: - greedy = Boolean.parseBoolean(currentValue()); - break; - case OPTIONAL: - optional = Boolean.parseBoolean(currentValue()); - break; - case MULTIPLE: - multiple = Boolean.parseBoolean(currentValue()); - break; - case FILTER: - filter = currentValue(); - break; - case NAME: - name = currentValue(); - break; - case NAMESPACE: - namespace = currentValue(); - break; - case RANGE: - range = VersionRange.create(substituteVersionAndQualifier(currentValue())); - break; - case MIN: - min = Integer.valueOf(currentValue()).intValue(); - break; - case MAX: - max = Integer.valueOf(currentValue()).intValue(); - break; - case MATCH_EXP: - matchExp = currentValue(); - break; - // we ignore elements we do not understand - default: - break; + case GREEDY: + greedy = Boolean.parseBoolean(currentValue()); + break; + case OPTIONAL: + optional = Boolean.parseBoolean(currentValue()); + break; + case MULTIPLE: + multiple = Boolean.parseBoolean(currentValue()); + break; + case FILTER: + filter = currentValue(); + break; + case NAME: + name = currentValue(); + break; + case NAMESPACE: + namespace = currentValue(); + break; + case RANGE: + range = VersionRange.create(substituteVersionAndQualifier(currentValue())); + break; + case MIN: + min = Integer.valueOf(currentValue()).intValue(); + break; + case MAX: + max = Integer.valueOf(currentValue()).intValue(); + break; + case MATCH_EXP: + matchExp = currentValue(); + break; + // we ignore elements we do not understand + default: + break; } next(); } @@ -327,7 +329,8 @@ public class AdviceFileParser { capability = createRequirement(namespace, name, range, filter, optional, multiple, greedy); } } else { - //When a match expression is specified, namespace, name and versionRange are ignored + // When a match expression is specified, namespace, name and versionRange are + // ignored if (optional && min == -1 && max == -1) { min = 0; max = 1; @@ -339,19 +342,22 @@ public class AdviceFileParser { } } - protected IRequirement createRequirement(String requirement, String filter, int min, int max, boolean greedy, String description) { + protected IRequirement createRequirement(String requirement, String filter, int min, int max, boolean greedy, + String description) { IExpression expr = ExpressionUtil.parse(substituteVersionAndQualifier(requirement)); IMatchExpression<IInstallableUnit> requirementExp = ExpressionUtil.getFactory().matchExpression(expr); IMatchExpression<IInstallableUnit> filterExp = InstallableUnit.parseFilter(filter); return MetadataFactory.createRequirement(requirementExp, filterExp, min, max, greedy, description); } - protected IRequirement createRequirement(String namespace, String name, VersionRange range, String filter, int min, int max, boolean greedy) { + protected IRequirement createRequirement(String namespace, String name, VersionRange range, String filter, int min, + int max, boolean greedy) { IMatchExpression<IInstallableUnit> filterExpression = InstallableUnit.parseFilter(filter); return MetadataFactory.createRequirement(namespace, name, range, filterExpression, min, max, greedy); } - protected IRequirement createRequirement(String namespace, String name, VersionRange range, String filter, boolean optional, boolean multiple, boolean greedy) { + protected IRequirement createRequirement(String namespace, String name, VersionRange range, String filter, + boolean optional, boolean multiple, boolean greedy) { return MetadataFactory.createRequirement(namespace, name, range, filter, optional, multiple, greedy); } @@ -417,7 +423,7 @@ public class AdviceFileParser { List<IRequirement> unitMetaRequirements = new ArrayList<>(); List<ILicense> unitLicenses = new ArrayList<>(); Map<String, ITouchpointInstruction> unitInstructions = new HashMap<>(); - // updatedescriptor ?? + // updatedescriptor ?? while (current != null && current.startsWith(prefix)) { String token = current.substring(prefix.length()); @@ -479,7 +485,8 @@ public class AdviceFileParser { } } - InstallableUnitDescription description = unitHostRequirements.isEmpty() ? new InstallableUnitDescription() : new InstallableUnitFragmentDescription(); + InstallableUnitDescription description = unitHostRequirements.isEmpty() ? new InstallableUnitDescription() + : new InstallableUnitFragmentDescription(); description.setId(unitId); description.setVersion(unitVersion); description.setSingleton(unitSingleton); @@ -493,10 +500,12 @@ public class AdviceFileParser { } } if (unitTouchpointId != null) - description.setTouchpointType(MetadataFactory.createTouchpointType(unitTouchpointId, unitTouchpointVersion)); + description + .setTouchpointType(MetadataFactory.createTouchpointType(unitTouchpointId, unitTouchpointVersion)); if (unitUpdateId != null) - description.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(unitUpdateId, unitUpdateRange, unitUpdateSeverity, unitUpdateDescription)); + description.setUpdateDescriptor(MetadataFactory.createUpdateDescriptor(unitUpdateId, unitUpdateRange, + unitUpdateSeverity, unitUpdateDescription)); if (!unitLicenses.isEmpty()) description.setLicenses(unitLicenses.toArray(new ILicense[unitLicenses.size()])); @@ -505,7 +514,8 @@ public class AdviceFileParser { description.setArtifacts(unitArtifacts.toArray(new IArtifactKey[unitArtifacts.size()])); if (!unitHostRequirements.isEmpty()) - ((InstallableUnitFragmentDescription) description).setHost(unitHostRequirements.toArray(new IRequirement[unitHostRequirements.size()])); + ((InstallableUnitFragmentDescription) description) + .setHost(unitHostRequirements.toArray(new IRequirement[unitHostRequirements.size()])); if (!unitProperties.isEmpty()) { for (Entry<String, String> entry : unitProperties.entrySet()) { @@ -520,7 +530,8 @@ public class AdviceFileParser { description.setRequirements(unitRequires.toArray(new IRequirement[unitRequires.size()])); if (!unitMetaRequirements.isEmpty()) - description.setMetaRequirements(unitMetaRequirements.toArray(new IRequirement[unitMetaRequirements.size()])); + description + .setMetaRequirements(unitMetaRequirements.toArray(new IRequirement[unitMetaRequirements.size()])); if (!unitInstructions.isEmpty()) description.addTouchpointData(MetadataFactory.createTouchpointData(unitInstructions)); @@ -579,18 +590,18 @@ public class AdviceFileParser { while (current != null && current.startsWith(prefix)) { String token = current.substring(prefix.length()); switch (token) { - case CLASSIFIER: - artifactClassifier = currentValue(); - break; - case ID: - artifactId = currentValue(); - break; - case VERSION: - artifactVersion = Version.parseVersion(substituteVersionAndQualifier(currentValue())); - break; - // we ignore elements we do not understand - default: - break; + case CLASSIFIER: + artifactClassifier = currentValue(); + break; + case ID: + artifactId = currentValue(); + break; + case VERSION: + artifactVersion = Version.parseVersion(substituteVersionAndQualifier(currentValue())); + break; + // we ignore elements we do not understand + default: + break; } next(); diff --git a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java index 42a5fcfba..633d32088 100644 --- a/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java +++ b/bundles/org.eclipse.equinox.p2.reconciler.dropins/src/org/eclipse/equinox/internal/p2/reconciler/dropins/ProfileSynchronizer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2017 IBM Corporation and others. + * Copyright (c) 2007, 2020 IBM Corporation and others. * All rights reserved. * This program and the accompanying materials are made available under the * terms of the Eclipse Public License 2.0 which accompanies this distribution, @@ -449,7 +449,7 @@ public class ProfileSynchronizer { OSGiInstallArea = URIUtil.toURI(installArea).toString() + Constants.EXTENSION_LOCATION; // Sort the repositories so the extension location at the OSGi install folder is first. // See https://bugs.eclipse.org/246310. - Collections.sort(repositories, (left, right) -> { + repositories.sort((left, right) -> { if (OSGiInstallArea.equals(left)) return -1; if (OSGiInstallArea.equals(right)) diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestLicenseConsistency.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestLicenseConsistency.java index b81865083..e0c3f74e3 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestLicenseConsistency.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/TestLicenseConsistency.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2010, 2017 IBM Corporation and others. + * Copyright (c) 2010, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -15,7 +15,9 @@ package org.eclipse.equinox.p2.tests; import java.net.URI; import java.net.URISyntaxException; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.equinox.p2.core.ProvisionException; import org.eclipse.equinox.p2.metadata.IInstallableUnit; @@ -79,7 +81,7 @@ public class TestLicenseConsistency extends AbstractProvisioningTest { } private List<IInstallableUnit> sort(List<IInstallableUnit> noLicense) { - Collections.sort(noLicense); + noLicense.sort(null); return noLicense; } diff --git a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java index ca1049042..454736ce0 100644 --- a/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java +++ b/bundles/org.eclipse.equinox.p2.tests/src/org/eclipse/equinox/p2/tests/core/AggregateQueryTest.java @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (c) 2009, 2018 EclipseSource and others. +* Copyright (c) 2009, 2020 EclipseSource and others. * * This * program and the accompanying materials are made available under the terms of @@ -62,7 +62,7 @@ public class AggregateQueryTest { while (iterator.hasNext()) { list.add(iterator.next()); } - Collections.sort(list); + list.sort(null); result.accept(list.get(list.size() - 1)); return result; } @@ -114,7 +114,7 @@ public class AggregateQueryTest { while (iterator.hasNext()) { list.add(iterator.next()); } - Collections.sort(list); + list.sort(null); result.accept(list.get(list.size() - 1)); return result; } diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java index 99ef41487..e3dbccac9 100644 --- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java +++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/CleanupzipAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2017 IBM Corporation and others. + * Copyright (c) 2008, 2020 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -89,7 +89,8 @@ public class CleanupzipAction extends ProvisioningAction { try { store.backup(file); } catch (IOException e) { - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.backup_file_failed, file.getPath()), e); + return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, + NLS.bind(Messages.backup_file_failed, file.getPath()), e); } else file.delete(); @@ -97,7 +98,7 @@ public class CleanupzipAction extends ProvisioningAction { } // sort directories by path length longest path is in top // this will make sure that a sub folder will be removed before its parent - Collections.sort(directories, (f1, f2) -> { + directories.sort((f1, f2) -> { if (f1 == f2) return 0; if (f1 != null && f2 == null) @@ -119,7 +120,8 @@ public class CleanupzipAction extends ProvisioningAction { try { store.backupDirectory(directory); } catch (IOException e) { - return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, NLS.bind(Messages.backup_file_failed, directory.getPath()), e); + return new Status(IStatus.ERROR, Activator.ID, IStatus.OK, + NLS.bind(Messages.backup_file_failed, directory.getPath()), e); } } else directory.delete(); diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java index 2caadb6c8..f435ef242 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/PreviousConfigurationFinder.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2013, 2017 Ericsson AB and others. + * Copyright (c) 2013, 2020 Ericsson AB and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -38,7 +38,8 @@ public class PreviousConfigurationFinder { } /** - * @throws NumberFormatException if cannot parse the major and minor version components + * @throws NumberFormatException if cannot parse the major and minor version + * components */ Identifier(String versionString) { super(); @@ -58,18 +59,14 @@ public class PreviousConfigurationFinder { service = Integer.parseInt(tokenizer.nextToken()); } catch (NumberFormatException nfe) { // ignore the service qualifier in that case and default to 0 - // this will allow us to tolerate other non-conventional version numbers + // this will allow us to tolerate other non-conventional version numbers } } /** - * Returns true if this id is considered to be greater than or equal to the given baseline. - * e.g. - * 1.2.9 >= 1.3.1 -> false - * 1.3.0 >= 1.3.1 -> false - * 1.3.1 >= 1.3.1 -> true - * 1.3.2 >= 1.3.1 -> true - * 2.0.0 >= 1.3.1 -> true + * Returns true if this id is considered to be greater than or equal to the + * given baseline. e.g. 1.2.9 >= 1.3.1 -> false 1.3.0 >= 1.3.1 -> false 1.3.1 >= + * 1.3.1 -> true 1.3.2 >= 1.3.1 -> true 2.0.0 >= 1.3.1 -> true */ boolean isGreaterEqualTo(Identifier minimum) { if (major < minimum.major) @@ -132,7 +129,8 @@ public class PreviousConfigurationFinder { File configFolder; String os_ws_arch; - public ConfigurationDescriptor(String productId, Identifier version, String installPathHashcode, String platformConfig, File configFolder) { + public ConfigurationDescriptor(String productId, Identifier version, String installPathHashcode, + String platformConfig, File configFolder) { this.productId = productId; this.version = version; this.installPathHashcode = installPathHashcode; @@ -163,7 +161,8 @@ public class PreviousConfigurationFinder { public static class ConfigurationDescriptorComparator implements Comparator<ConfigurationDescriptor> { - // compare ConfigurationDescriptor according to their versions and when equals according to their lastModified field + // compare ConfigurationDescriptor according to their versions and when equals + // according to their lastModified field @Override public int compare(ConfigurationDescriptor o1, ConfigurationDescriptor o2) { int result = -1; @@ -198,7 +197,8 @@ public class PreviousConfigurationFinder { Matcher m = path.matcher(candidate.getName()); if (!m.matches()) return null; - return new ConfigurationDescriptor(m.group(1), new Identifier(m.group(2)), m.group(3), m.group(5), candidate.getAbsoluteFile()); + return new ConfigurationDescriptor(m.group(1), new Identifier(m.group(2)), m.group(3), m.group(5), + candidate.getAbsoluteFile()); } public IProvisioningAgent findPreviousInstalls(File searchRoot, File installFolder) { @@ -206,14 +206,16 @@ public class PreviousConfigurationFinder { ConfigurationDescriptor runningConfiguration = getConfigdataFromProductFile(installFolder); if (runningConfiguration == null) return null; - ConfigurationDescriptor match = findMostRelevantConfigurationFromInstallHashDir(potentialConfigurations, runningConfiguration); + ConfigurationDescriptor match = findMostRelevantConfigurationFromInstallHashDir(potentialConfigurations, + runningConfiguration); if (match == null) match = findMostRelevantConfigurationFromProductId(potentialConfigurations, runningConfiguration); if (match == null) match = findSpecifiedConfiguration(searchRoot); if (match == null) return null; - return AgentFromInstall.createAgentFrom(AutomaticUpdatePlugin.getDefault().getAgentProvider(), null, new File(match.getConfig(), "configuration"), null); //$NON-NLS-1$ + return AgentFromInstall.createAgentFrom(AutomaticUpdatePlugin.getDefault().getAgentProvider(), null, + new File(match.getConfig(), "configuration"), null); //$NON-NLS-1$ } @@ -240,13 +242,17 @@ public class PreviousConfigurationFinder { private ConfigurationDescriptor getConfigdataFromProductFile(File installFolder) { Object[] productFileInfo = loadEclipseProductFile(installFolder); - //Contrarily to the runtime, when the .eclipseproduct can't be found, we don't fallback to org.eclipse.platform. + // Contrarily to the runtime, when the .eclipseproduct can't be found, we don't + // fallback to org.eclipse.platform. if (productFileInfo.length == 0) return null; - return new ConfigurationDescriptor((String) productFileInfo[0], (Identifier) productFileInfo[1], getInstallDirHash(installFolder), Platform.getOS() + '_' + Platform.getWS() + '_' + Platform.getOSArch(), null); + return new ConfigurationDescriptor((String) productFileInfo[0], (Identifier) productFileInfo[1], + getInstallDirHash(installFolder), + Platform.getOS() + '_' + Platform.getWS() + '_' + Platform.getOSArch(), null); } - public ConfigurationDescriptor findMostRelevantConfigurationFromInstallHashDir(List<ConfigurationDescriptor> configurations, ConfigurationDescriptor configToMatch) { + public ConfigurationDescriptor findMostRelevantConfigurationFromInstallHashDir( + List<ConfigurationDescriptor> configurations, ConfigurationDescriptor configToMatch) { ConfigurationDescriptor bestMatch = null; int numberOfcriteriaMet = 0; for (ConfigurationDescriptor candidate : configurations) { @@ -259,7 +265,7 @@ public class PreviousConfigurationFinder { if (configToMatch.getProductId().equals(candidate.getProductId()) && // configToMatch.getPlatformConfig().equals(candidate.getPlatformConfig()) && // (!candidate.getVersion().isGreaterEqualTo(configToMatch.getVersion()))) { - //We have a match + // We have a match criteriaMet++; } @@ -282,30 +288,34 @@ public class PreviousConfigurationFinder { return bestMatch; } - //Out of a set of configuration, find the one with the most similar product info. - public ConfigurationDescriptor findMostRelevantConfigurationFromProductId(List<ConfigurationDescriptor> configurations, ConfigurationDescriptor configToMatch) { + // Out of a set of configuration, find the one with the most similar product + // info. + public ConfigurationDescriptor findMostRelevantConfigurationFromProductId( + List<ConfigurationDescriptor> configurations, ConfigurationDescriptor configToMatch) { ConfigurationDescriptor bestMatch = null; List<ConfigurationDescriptor> candidates = new ArrayList<>(); List<ConfigurationDescriptor> candidatesWithUnkonwArchitecture = new ArrayList<>(); for (ConfigurationDescriptor candidate : configurations) { - if (configToMatch.getProductId().equals(candidate.getProductId()) && configToMatch.getVersion().isGreaterEqualTo(candidate.getVersion())) { + if (configToMatch.getProductId().equals(candidate.getProductId()) + && configToMatch.getVersion().isGreaterEqualTo(candidate.getVersion())) { if (configToMatch.getPlatformConfig().equals(candidate.getPlatformConfig())) { candidates.add(candidate); - } else { //candidate.getPlatformConfig() returns null in legacy installation prior to 4.x.x releases + } else { // candidate.getPlatformConfig() returns null in legacy installation prior to + // 4.x.x releases candidatesWithUnkonwArchitecture.add(candidate); } } } if (!candidates.isEmpty()) { - Collections.sort(candidates, new ConfigurationDescriptorComparator()); + candidates.sort(new ConfigurationDescriptorComparator()); bestMatch = candidates.get(candidates.size() - 1); } if (bestMatch == null) { if (!candidatesWithUnkonwArchitecture.isEmpty()) { - Collections.sort(candidatesWithUnkonwArchitecture, new ConfigurationDescriptorComparator()); + candidatesWithUnkonwArchitecture.sort(new ConfigurationDescriptorComparator()); bestMatch = candidatesWithUnkonwArchitecture.get(candidatesWithUnkonwArchitecture.size() - 1); } } @@ -313,7 +323,8 @@ public class PreviousConfigurationFinder { return bestMatch; } - //Load the .eclipseproduct file in the base of the installation. This logic is very similar to the one found in the launcher + // Load the .eclipseproduct file in the base of the installation. This logic is + // very similar to the one found in the launcher private Object[] loadEclipseProductFile(File installDir) { final String ECLIPSE = "eclipse"; //$NON-NLS-1$ final String PRODUCT_SITE_MARKER = ".eclipseproduct"; //$NON-NLS-1$ @@ -341,10 +352,11 @@ public class PreviousConfigurationFinder { } else { return new String[0]; } - return new Object[] {appId, appVersion}; + return new Object[] { appId, appVersion }; } - //Iterate through a folder to look for potential configuration folders and reify them. + // Iterate through a folder to look for potential configuration folders and + // reify them. public List<ConfigurationDescriptor> readPreviousConfigurations(File configurationFolder) { File[] candidates = configurationFolder.listFiles(); List<ConfigurationDescriptor> configurations = new ArrayList<>(candidates.length); @@ -360,8 +372,8 @@ public class PreviousConfigurationFinder { return configurations; } - //This code computes the hashCode of the install location. - //This is a simplified version of the code that the launcher executes. + // This code computes the hashCode of the install location. + // This is a simplified version of the code that the launcher executes. private String getInstallDirHash(File installFolder) { try { return Integer.toString(installFolder.getCanonicalPath().hashCode()); diff --git a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java index 5b443c686..41829a01a 100644 --- a/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java +++ b/bundles/org.eclipse.equinox.p2.updatesite/src/org/eclipse/equinox/internal/p2/updatesite/SiteXMLAction.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2018 Code 9 and others. + * Copyright (c) 2008, 2020 Code 9 and others. * * This * program and the accompanying materials are made available under the terms of @@ -511,9 +511,9 @@ public class SiteXMLAction extends AbstractPublisherAction { URI associateLocation = new URI(siteLocation); String label = associatedSite.getAnnotation(); refs.add(new RepositoryReference(associateLocation, label, IRepository.TYPE_METADATA, - IRepository.ENABLED)); + IRepository.ENABLED)); refs.add(new RepositoryReference(associateLocation, label, IRepository.TYPE_ARTIFACT, - IRepository.ENABLED)); + IRepository.ENABLED)); } catch (URISyntaxException e) { String message = "Invalid site reference: " + siteLocation; //$NON-NLS-1$ LogHelper.log(new Status(IStatus.ERROR, Activator.ID, message)); @@ -613,7 +613,7 @@ public class SiteXMLAction extends AbstractPublisherAction { return 0; } }; - Collections.sort(categories, isNestedCategoryComparator); + categories.sort(isNestedCategoryComparator); // Then create categories in the right order Map<String, IInstallableUnit> nameToCategoryIU = new HashMap<>(); |