diff options
author | Alexander Kurtakov | 2018-06-07 09:15:00 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2018-06-07 09:15:00 +0000 |
commit | abb2cfed698dc1c6f070d6325ac580dd99ba45b6 (patch) | |
tree | dd567c90ad8fa2f1b2a709e395021ac032bc89d6 | |
parent | 1c26af582a12646a42c7b2bd96e8fa257204d8ff (diff) | |
download | rt.equinox.p2-abb2cfed698dc1c6f070d6325ac580dd99ba45b6.tar.gz rt.equinox.p2-abb2cfed698dc1c6f070d6325ac580dd99ba45b6.tar.xz rt.equinox.p2-abb2cfed698dc1c6f070d6325ac580dd99ba45b6.zip |
Bug 535636 - Update bundles to Java 1.8
Take care of p2.artifact.optimizers. All kind of modernizations to the
codebase done.
Change-Id: Ic4c0422a2d3aa320ef8d126c2974964c478177d7
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
16 files changed, 303 insertions, 213 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/.classpath b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.classpath index 64c5e31b7..eca7bdba8 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/.classpath +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.classpath @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <classpath> - <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> <classpathentry kind="src" path="src"/> <classpathentry kind="output" path="bin"/> diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.core.prefs index 08a943723..01dc9cade 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.core.prefs @@ -10,18 +10,22 @@ org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.compliance=1.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 org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000 +org.eclipse.jdt.core.compiler.problem.APILeak=warning org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=ignore @@ -33,7 +37,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod= org.eclipse.jdt.core.compiler.problem.discouragedReference=error org.eclipse.jdt.core.compiler.problem.emptyStatement=warning org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning @@ -53,7 +57,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore @@ -64,7 +68,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore @@ -72,20 +76,22 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled @@ -94,12 +100,16 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore @@ -107,6 +117,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedImport=error org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning @@ -119,9 +130,11 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647 org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 @@ -130,17 +143,25 @@ org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 -org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.formatter.alignment_for_module_statements=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=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_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=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_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 +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_package=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 @@ -160,26 +181,36 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line 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_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 +org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false -org.eclipse.jdt.core.formatter.comment.format_block_comments=false +org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=true +org.eclipse.jdt.core.formatter.comment.format_block_comments=true org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=false -org.eclipse.jdt.core.formatter.comment.format_line_comments=false +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true org.eclipse.jdt.core.formatter.comment.format_source_code=true 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.insert_new_line_before_root_tags=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 +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.compact_else_if=true org.eclipse.jdt.core.formatter.continuation_indentation=2 org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=false 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 @@ -189,9 +220,18 @@ org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true -org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert @@ -199,7 +239,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do no org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert -org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert @@ -210,7 +250,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert -org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert @@ -239,10 +279,11 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=inser org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert 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_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 -org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert @@ -257,12 +298,14 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invoca 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_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 org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert @@ -271,7 +314,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert @@ -286,11 +329,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invoc 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_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 org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert -org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert @@ -313,6 +357,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do n org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert @@ -341,6 +386,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invoc 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_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 org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert @@ -350,6 +396,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=inser org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert @@ -359,19 +406,37 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false -org.eclipse.jdt.core.formatter.lineSplit=800 +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_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines +org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines +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_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.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.incompatibleJDKLevel=ignore org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.ui.prefs index 900e4e143..3c6d1b01e 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.ui.prefs +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/.settings/org.eclipse.jdt.ui.prefs @@ -1,8 +1,7 @@ -#Mon Nov 05 16:53:31 EST 2007 eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_core -formatter_settings_version=11 +formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile +formatter_settings_version=14 org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.importorder=; org.eclipse.jdt.ui.ondemandthreshold=3 @@ -15,22 +14,26 @@ sp_cleanup.add_missing_deprecated_annotations=true sp_cleanup.add_missing_methods=false sp_cleanup.add_missing_nls_tags=false sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true sp_cleanup.add_serial_version_id=false sp_cleanup.always_use_blocks=true sp_cleanup.always_use_parentheses_in_expressions=false sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.convert_functional_interfaces=true +sp_cleanup.convert_to_enhanced_for_loop=true sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=false +sp_cleanup.insert_inferred_type_arguments=false sp_cleanup.make_local_variable_final=false sp_cleanup.make_parameters_final=false sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false sp_cleanup.make_variable_declarations_final=true sp_cleanup.never_use_blocks=false sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.on_save_use_additional_actions=true sp_cleanup.organize_imports=true sp_cleanup.qualify_static_field_accesses_with_declaring_class=false sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true @@ -38,12 +41,14 @@ sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class= sp_cleanup.qualify_static_member_accesses_with_declaring_class=false sp_cleanup.qualify_static_method_accesses_with_declaring_class=false sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_redundant_modifiers=true +sp_cleanup.remove_redundant_type_arguments=true +sp_cleanup.remove_trailing_whitespaces=true sp_cleanup.remove_trailing_whitespaces_all=true sp_cleanup.remove_trailing_whitespaces_ignore_empty=false sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true sp_cleanup.remove_unused_local_variables=false sp_cleanup.remove_unused_private_fields=true sp_cleanup.remove_unused_private_members=false @@ -51,8 +56,10 @@ sp_cleanup.remove_unused_private_methods=true sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false +sp_cleanup.use_anonymous_class_creation=false sp_cleanup.use_blocks=false sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_lambda=true sp_cleanup.use_parentheses_in_expressions=false sp_cleanup.use_this_for_non_static_field_access=false sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF index aa3c74647..5450fecb1 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.artifact.optimizers;singleton:=true -Bundle-Version: 1.0.0.qualifier +Bundle-Version: 1.1.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.artifact.optimizers.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -11,7 +11,7 @@ Export-Package: org.eclipse.equinox.internal.p2.artifact.optimizers;x-friends:=" org.eclipse.equinox.internal.p2.artifact.optimizers.pack200;x-internal:=true Require-Bundle: org.eclipse.equinox.common, org.eclipse.equinox.p2.artifact.repository -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-ActivationPolicy: lazy Import-Package: org.eclipse.equinox.app;version="1.0.0", org.eclipse.equinox.internal.p2.core.helpers, diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/pom.xml b/bundles/org.eclipse.equinox.p2.artifact.optimizers/pom.xml index 0bc4dc91b..9f1a34764 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/pom.xml +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/pom.xml @@ -9,6 +9,6 @@ </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.p2.artifact.optimizers</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>1.1.0-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/AbstractDeltaStep.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/AbstractDeltaStep.java index 7f3e16ab8..d11f20fe6 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/AbstractDeltaStep.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/AbstractDeltaStep.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 compeople AG and others. + * Copyright (c) 2007, 2018 compeople AG and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -24,8 +24,9 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; /** * The <code>AbstractDeltaDiffStep</code> is an abstract processing step that * retrieves a local artifact repository containing the serialized/encoded - * artifact key. It assumes that the artifact key is stored within the data property - * of the processing step descriptor and that is encoded with the <code>ArtifactKeySerializer</code>. + * artifact key. It assumes that the artifact key is stored within the data + * property of the processing step descriptor and that is encoded with the + * <code>ArtifactKeySerializer</code>. */ public abstract class AbstractDeltaStep extends AbstractBufferingStep { @@ -41,7 +42,9 @@ public abstract class AbstractDeltaStep extends AbstractBufferingStep { this.repository = repository; } - public void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) { + @Override + public void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, + IArtifactDescriptor context) { super.initialize(agent, descriptor, context); readArtifactKey(descriptor); } @@ -50,7 +53,10 @@ public abstract class AbstractDeltaStep extends AbstractBufferingStep { try { key = ArtifactKey.parse(descriptor.getData()); } catch (IllegalArgumentException e) { - setStatus(new Status(IStatus.ERROR, Activator.ID, "Predecessor artifact key for delta could not be deserialized. Serialized key is " + descriptor.getData(), e)); + setStatus(new Status(IStatus.ERROR, Activator.ID, + "Predecessor artifact key for delta could not be deserialized. Serialized key is " + + descriptor.getData(), + e)); } } @@ -58,16 +64,11 @@ public abstract class AbstractDeltaStep extends AbstractBufferingStep { if (repository instanceof IFileArtifactRepository) return ((IFileArtifactRepository) repository).getArtifactFile(descriptor); File result = null; - OutputStream resultStream = null; try { - try { - result = File.createTempFile(PREDECESSOR_ROOT, JAR_SUFFIX); - resultStream = new BufferedOutputStream(new FileOutputStream(result)); + result = File.createTempFile(PREDECESSOR_ROOT, JAR_SUFFIX); + try (OutputStream resultStream = new BufferedOutputStream(new FileOutputStream(result));) { setStatus(repository.getArtifact(descriptor, resultStream, getProgressMonitor())); return result; - } finally { - if (resultStream != null) - resultStream.close(); } } catch (IOException e) { } diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/Activator.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/Activator.java index 4d0ea17fd..20c850893 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/Activator.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/Activator.java @@ -1,10 +1,12 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2007, 2018 IBM Corporation and others. + * + * All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: + * + * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ @@ -21,11 +23,13 @@ public class Activator implements BundleActivator { return context; } - public void start(BundleContext context) throws Exception { - Activator.context = context; + @Override + public void start(BundleContext newcontext) throws Exception { + Activator.context = newcontext; } - public void stop(BundleContext context) throws Exception { + @Override + public void stop(BundleContext newcontext) throws Exception { } } diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/OptimizerApplication.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/OptimizerApplication.java index d5b37b2cc..5fb4b648d 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/OptimizerApplication.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/OptimizerApplication.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2011, 2015 IBM Corporation and others. + * Copyright (c) 2011, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -26,6 +26,7 @@ public abstract class OptimizerApplication implements IApplication { return (IArtifactRepositoryManager) getAgent().getService(IArtifactRepositoryManager.SERVICE_NAME); } + @Override public void stop() { // Nothing to do } diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/VersionlessArtifactKey.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/VersionlessArtifactKey.java index 8541881d3..982cbfe68 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/VersionlessArtifactKey.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/VersionlessArtifactKey.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 compeople AG and others. + * Copyright (c) 2007, 2018 compeople AG and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -11,10 +11,9 @@ *******************************************************************************/ package org.eclipse.equinox.internal.p2.artifact.optimizers; -import org.eclipse.equinox.p2.metadata.Version; - import org.eclipse.equinox.internal.p2.metadata.ArtifactKey; import org.eclipse.equinox.p2.metadata.IArtifactKey; +import org.eclipse.equinox.p2.metadata.Version; public class VersionlessArtifactKey extends ArtifactKey { @@ -26,12 +25,14 @@ public class VersionlessArtifactKey extends ArtifactKey { super(base.getClassifier(), base.getId(), Version.emptyVersion); } + @Override public int hashCode() { int hash = getId().hashCode(); hash = 17 * hash + getClassifier().hashCode(); return hash; } + @Override public boolean equals(Object obj) { if (!(obj instanceof IArtifactKey)) return false; diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java index 19e1dbe97..c8f669f55 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Application.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2007, 2018 IBM Corporation and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: + * + * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.internal.p2.artifact.optimizers.jardelta; @@ -18,7 +18,7 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; /** - * The optimizer <code>Application</code> for JBDiff based optimizations. + * The optimizer <code>Application</code> for JBDiff based optimizations. */ public class Application extends OptimizerApplication { @@ -26,6 +26,7 @@ public class Application extends OptimizerApplication { private int width = 1; private int depth = 1; + @Override public Object start(IApplicationContext context) throws Exception { Map<?, ?> args = context.getArguments(); initializeFromArguments((String[]) args.get("application.args")); //$NON-NLS-1$ @@ -47,11 +48,11 @@ public class Application extends OptimizerApplication { return; for (int i = 0; i < args.length; i++) { // check for args without parameters (i.e., a flag arg) - // if (args[i].equals("-pack")) - // pack = true; + // if (args[i].equals("-pack")) + // pack = true; - // check for args with parameters. If we are at the last argument or - // if the next one has a '-' as the first character, then we can't have + // check for args with parameters. If we are at the last argument or + // if the next one has a '-' as the first character, then we can't have // an arg with a param so continue. if (i == args.length - 1 || args[i + 1].startsWith("-")) //$NON-NLS-1$ continue; diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/DeltaComputer.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/DeltaComputer.java index 1de6f1885..8e7d7c4b0 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/DeltaComputer.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/DeltaComputer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. + * Copyright (c) 2007, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -15,9 +15,9 @@ import java.util.*; import java.util.zip.*; public class DeltaComputer { - private File target; - private File base; - private File destination; + private final File target; + private final File base; + private final File destination; private ZipFile baseJar; private ZipFile targetJar; private Set<String> baseEntries; @@ -43,15 +43,14 @@ public class DeltaComputer { } private void writeDelta() { - ZipOutputStream result = null; try { - try { - result = new ZipOutputStream(new FileOutputStream(destination)); + try (ZipOutputStream result = new ZipOutputStream(new FileOutputStream(destination))) { + // if the delta includes the manifest, be sure to write it first if (manifestJar != null) writeEntry(result, manifestJar.getEntry("META-INF/MANIFEST.MF"), manifestJar, true); - // write out the removals. These are all the entries left in the baseEntries - // since they were not seen in the targetJar. Here just write out an empty + // write out the removals. These are all the entries left in the baseEntries + // since they were not seen in the targetJar. Here just write out an empty // entry with a name that signals the delta processor to delete. for (String baseEntry : baseEntries) writeEntry(result, new ZipEntry(baseEntry + ".delete"), null, false); @@ -61,9 +60,6 @@ public class DeltaComputer { // write out the changes. for (ZipEntry entry : changes) writeEntry(result, entry, targetJar, false); - } finally { - if (result != null) - result.close(); } } catch (IOException e) { e.printStackTrace(); @@ -71,7 +67,8 @@ public class DeltaComputer { } } - private void writeEntry(ZipOutputStream result, ZipEntry entry, ZipFile sourceJar, boolean manifest) throws IOException { + private void writeEntry(ZipOutputStream result, ZipEntry entry, ZipFile sourceJar, boolean manifest) + throws IOException { if (!manifest && entry.getName().equalsIgnoreCase("META-INF/MANIFEST.MF")) return; // add the entry @@ -79,11 +76,9 @@ public class DeltaComputer { try { // if there is a sourceJar copy over the content for the entry into the result if (sourceJar != null) { - InputStream contents = sourceJar.getInputStream(entry); - try { + + try (InputStream contents = sourceJar.getInputStream(entry)) { transferStreams(contents, result); - } finally { - contents.close(); } } } finally { @@ -92,9 +87,9 @@ public class DeltaComputer { } /** - * Transfers all available bytes from the given input stream to the given - * output stream. Does not close either stream. - * + * Transfers all available bytes from the given input stream to the given output + * stream. Does not close either stream. + * * @param source * @param destination * @throws IOException @@ -116,8 +111,8 @@ public class DeltaComputer { } private void computeDelta() throws IOException { - changes = new ArrayList<ZipEntry>(); - additions = new ArrayList<ZipEntry>(); + changes = new ArrayList<>(); + additions = new ArrayList<>(); // start out assuming that all the base entries are being removed baseEntries = getEntries(baseJar); for (Enumeration<? extends ZipEntry> e = targetJar.entries(); e.hasMoreElements();) @@ -151,30 +146,33 @@ public class DeltaComputer { } } - /** - * Compare the given entry against the base JAR to see if/how it differs. Update the appropriate set - * based on the discovered difference. + /** + * Compare the given entry against the base JAR to see if/how it differs. Update + * the appropriate set based on the discovered difference. + * * @param entry the entry to test - * @throws IOException + * @throws IOException */ private void check(ZipEntry entry, ZipFile file) throws IOException { ZipEntry baseEntry = baseJar.getEntry(entry.getName()); // remember the manifest if we see it checkForManifest(entry, file); - // if there is no entry then this is an addition. remember the addition and return; + // if there is no entry then this is an addition. remember the addition and + // return; if (baseEntry == null) { additions.add(entry); return; } - // now we know each JAR has an entry for the name, compare and see how/if they differ + // now we know each JAR has an entry for the name, compare and see how/if they + // differ boolean changed = !equals(entry, baseEntry); if (changed) changes.add(entry); baseEntries.remove(baseEntry.getName()); } - // compare the two entries. We already know that they have the same name. + // compare the two entries. We already know that they have the same name. private boolean equals(ZipEntry entry, ZipEntry baseEntry) { if (entry.getSize() != baseEntry.getSize()) return false; @@ -189,7 +187,7 @@ public class DeltaComputer { } private Set<String> getEntries(ZipFile jar) { - HashSet<String> result = new HashSet<String>(jar.size()); + HashSet<String> result = new HashSet<>(jar.size()); for (Enumeration<? extends ZipEntry> e = jar.entries(); e.hasMoreElements();) { ZipEntry entry = e.nextElement(); checkForManifest(entry, jar); @@ -199,8 +197,9 @@ public class DeltaComputer { } /** - * Check to see if the given entry is the manifest. If so, remember it for use when writing - * the resultant JAR. + * Check to see if the given entry is the manifest. If so, remember it for use + * when writing the resultant JAR. + * * @param entry * @param jar */ diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/JarDeltaOptimizerStep.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/JarDeltaOptimizerStep.java index 3b5f273c8..ad3613296 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/JarDeltaOptimizerStep.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/JarDeltaOptimizerStep.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 compeople AG and others. + * Copyright (c) 2007, 2018 compeople AG and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -21,7 +21,7 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor; /** - * The JAR delta expects an input containing normal ".jar" data. + * The JAR delta expects an input containing normal ".jar" data. */ public class JarDeltaOptimizerStep extends AbstractDeltaStep { @@ -31,17 +31,20 @@ public class JarDeltaOptimizerStep extends AbstractDeltaStep { super(repository); } + @Override protected OutputStream createIncomingStream() throws IOException { incoming = File.createTempFile(INCOMING_ROOT, JAR_SUFFIX); return new BufferedOutputStream(new FileOutputStream(incoming)); } + @Override protected void cleanupTempFiles() { super.cleanupTempFiles(); if (incoming != null) incoming.delete(); } + @Override protected void performProcessing() throws IOException { File resultFile = null; try { diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Optimizer.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Optimizer.java index fc7fea2df..d4eb22d97 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Optimizer.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/jardelta/Optimizer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 compeople AG and others. + * Copyright (c) 2007, 2018 compeople AG and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -29,9 +29,9 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor; public class Optimizer { - private IArtifactRepository repository; - private int width; - private int depth; + private final IArtifactRepository repository; + private final int width; + private final int depth; private static final String JAR_DELTA_FORMAT = "jarDelta"; //$NON-NLS-1$ private static final String JAR_DELTA_PATCH_STEP = "org.eclipse.equinox.p2.processing.JarDeltaPatchStep"; //$NON-NLS-1$ @@ -40,16 +40,18 @@ public class Optimizer { private static final Comparator<IArtifactKey> ARTIFACT_KEY_VERSION_COMPARATOR = new ArtifactKeyVersionComparator(); /** - * This optimizer performs delta generation based on (currently) jbdiff. - * The optimization can be controlled with the ´width´ and the ´depth´ parameter. - * ´width´ defines for how many ´related´ artifact keys a delta should be generated, - * starting from the most up-to-date. - * ´depth´ defines to how many predecessor a delta should be generated. - * - * With AK(c-v) : AK - artifact key, c - artifact id, v - artifact version - * the ´repository content´ can be viewed a two dimensional array, where the - * artifact keys for the same component are in order of their version: - * <pre><code> + * This optimizer performs delta generation based on (currently) jbdiff. The + * optimization can be controlled with the ´width´ and the ´depth´ parameter. + * ´width´ defines for how many ´related´ artifact keys a delta should be + * generated, starting from the most up-to-date. ´depth´ defines to how many + * predecessor a delta should be generated. + * + * With AK(c-v) : AK - artifact key, c - artifact id, v - artifact version the + * ´repository content´ can be viewed a two dimensional array, where the + * artifact keys for the same component are in order of their version: + * + * <pre> + * <code> * w=1 w=2 * | | * | +------.------------+ d=2 @@ -60,10 +62,12 @@ public class Optimizer { * [ AK(y,2.0) AK(y,1.9) ] * [ AK(z,2.0) AK(z,1.5) AK(z,1.3) AK(z,1.0) ] * ] - * </code></pre> - * E.g: with a ´width´ of one and a ´depth´ of two the optimizer would - * create two deltas for component ´x´ from 1.5 to 2.0 and from 1.1 to 2.0. - * + * </code> + * </pre> + * + * E.g: with a ´width´ of one and a ´depth´ of two the optimizer would create + * two deltas for component ´x´ from 1.5 to 2.0 and from 1.1 to 2.0. + * * @param repository * @param width * @param depth @@ -78,14 +82,14 @@ public class Optimizer { System.out.println("Starting delta (jardelta) optimizations (width=" + width + ", depth=" + depth + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ IQueryResult<IArtifactKey> queryResult = repository.query(ArtifactKeyQuery.ALL_KEYS, null); IArtifactKey[][] keys = getSortedRelatedArtifactKeys(queryResult); - for (int i = 0; i < keys.length; i++) { - if (keys[i].length < 2) + for (IArtifactKey[] key2 : keys) { + if (key2.length < 2) // Nothing to diff here! continue; - int minWidth = Math.min(width, keys[i].length); + int minWidth = Math.min(width, key2.length); for (int j = 0; j < minWidth; j++) { - IArtifactKey key = keys[i][j]; - optimize(keys[i], key); + IArtifactKey key = key2[j]; + optimize(key2, key); } } System.out.println("Done."); //$NON-NLS-1$ @@ -95,8 +99,7 @@ public class Optimizer { private void optimize(IArtifactKey[] keys, IArtifactKey key) { IArtifactDescriptor[] descriptors = repository.getArtifactDescriptors(key); IArtifactDescriptor canonical = null; - for (int k = 0; k < descriptors.length; k++) { - IArtifactDescriptor descriptor = descriptors[k]; + for (IArtifactDescriptor descriptor : descriptors) { boolean optimized = false; if (isCanonical(descriptor)) canonical = descriptor; @@ -112,30 +115,34 @@ public class Optimizer { } /** - * This method retrieves a list of list of IArtifactKeys. The artifact keys in the - * list of artifact keys are all ´strongly related´ to each other such that are - * equal but not considering the versions. This list is sorted such that the - * newer versions are first in the list.<p> - * With AK(c-v) : AK - artifact key, c - artifact id, v - artifact version - * the result is than, e.g. - * <pre><code> + * This method retrieves a list of list of IArtifactKeys. The artifact keys in + * the list of artifact keys are all ´strongly related´ to each other such that + * are equal but not considering the versions. This list is sorted such that the + * newer versions are first in the list. + * <p> + * With AK(c-v) : AK - artifact key, c - artifact id, v - artifact version the + * result is than, e.g. + * + * <pre> + * <code> * [ * [ AK(x,2.0) AK(x,1.5) AK(x,1.1) ] * [ AK(y,2.0) AK(y,1.9) ] * [ AK(z,2.0) AK(z,1.5) AK(z,1.3) AK(z,1.0) ] * ] - * </code></pre> + * </code> + * </pre> + * * @param artifactKeys * @return the sorted artifact keys */ private IArtifactKey[][] getSortedRelatedArtifactKeys(IQueryResult<IArtifactKey> artifactKeys) { - Map<IArtifactKey, List<IArtifactKey>> map = new HashMap<IArtifactKey, List<IArtifactKey>>(); - for (Iterator<IArtifactKey> iter = artifactKeys.iterator(); iter.hasNext();) { - IArtifactKey nxt = iter.next(); + Map<IArtifactKey, List<IArtifactKey>> map = new HashMap<>(); + for (IArtifactKey nxt : artifactKeys) { IArtifactKey freeKey = getVersionlessKey(nxt); List<IArtifactKey> values = map.get(freeKey); if (values == null) { - values = new ArrayList<IArtifactKey>(); + values = new ArrayList<>(); map.put(freeKey, values); } values.add(nxt); @@ -148,12 +155,12 @@ public class Optimizer { lists[i++] = relatedArtifactKeys; } int candidates = 0; - for (int ii = 0; ii < lists.length; ii++) { - for (int jj = 0; jj < lists[ii].length; jj++) { - System.out.println(lists[ii][jj] + ", "); //$NON-NLS-1$ + for (IArtifactKey[] list : lists) { + for (IArtifactKey element : list) { + System.out.println(element + ", "); //$NON-NLS-1$ } System.out.println(""); //$NON-NLS-1$ - if (lists[ii].length > 1) + if (list.length > 1) candidates++; } System.out.println("Candidates found: " + candidates); //$NON-NLS-1$ @@ -163,73 +170,71 @@ public class Optimizer { private void optimize(IArtifactDescriptor canonical, IArtifactKey[] relatedArtifactKeys) { System.out.println("Optimizing " + canonical); //$NON-NLS-1$ - IArtifactDescriptor[] descriptors = getSortedCompletePredecessors(canonical.getArtifactKey(), relatedArtifactKeys); + IArtifactDescriptor[] descriptors = getSortedCompletePredecessors(canonical.getArtifactKey(), + relatedArtifactKeys); int minDepth = Math.min(depth, descriptors.length); for (int i = 0; i < minDepth; i++) { System.out.println("\t with jar delta against " + descriptors[i].getArtifactKey()); //$NON-NLS-1$ String predecessorData = descriptors[i].getArtifactKey().toExternalForm(); ArtifactDescriptor newDescriptor = new ArtifactDescriptor(canonical); - IProcessingStepDescriptor patchStep = new ProcessingStepDescriptor(JAR_DELTA_PATCH_STEP, predecessorData, true); - IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] {patchStep}; + IProcessingStepDescriptor patchStep = new ProcessingStepDescriptor(JAR_DELTA_PATCH_STEP, predecessorData, + true); + IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] { patchStep }; newDescriptor.setProcessingSteps(steps); newDescriptor.setProperty(IArtifactDescriptor.FORMAT, JAR_DELTA_FORMAT); - OutputStream repositoryStream = null; - try { - repositoryStream = repository.getOutputStream(newDescriptor); - + try (OutputStream repositoryStream = repository.getOutputStream(newDescriptor)) { // Add in all the processing steps needed to optimize (e.g., pack200, ...) ProcessingStep optimizerStep = new JarDeltaOptimizerStep(repository); optimizerStep.initialize(repository.getProvisioningAgent(), patchStep, newDescriptor); ProcessingStepHandler handler = new ProcessingStepHandler(); - OutputStream destination = handler.link(new ProcessingStep[] {optimizerStep}, repositoryStream, null); + OutputStream destination = handler.link(new ProcessingStep[] { optimizerStep }, repositoryStream, null); - // Do the actual work by asking the repo to get the artifact and put it in the destination. + // Do the actual work by asking the repo to get the artifact and put it in the + // destination. IStatus status = repository.getArtifact(canonical, destination, new NullProgressMonitor()); if (!status.isOK()) { System.out.println("Getting the artifact is not ok."); //$NON-NLS-1$ System.out.println(status); } + repositoryStream.close(); + status = ProcessingStepHandler.checkStatus(repositoryStream); + if (!status.isOK()) { + System.out.println("Skipping optimization of: " + descriptors[i].getArtifactKey()); //$NON-NLS-1$ + System.out.println(status.toString()); + } } catch (ProvisionException e) { System.out.println("Skipping optimization of: " + descriptors[i].getArtifactKey()); //$NON-NLS-1$ System.out.println(e.getMessage()); e.printStackTrace(); - } finally { - if (repositoryStream != null) - try { - repositoryStream.close(); - IStatus status = ProcessingStepHandler.checkStatus(repositoryStream); - if (!status.isOK()) { - System.out.println("Skipping optimization of: " + descriptors[i].getArtifactKey()); //$NON-NLS-1$ - System.out.println(status.toString()); - } - } catch (IOException e) { - System.out.println("Skipping optimization of: " + descriptors[i].getArtifactKey()); //$NON-NLS-1$ - System.out.println(e.getMessage()); - e.printStackTrace(); - } + } catch (IOException e) { + System.out.println("Skipping optimization of: " + descriptors[i].getArtifactKey()); //$NON-NLS-1$ + System.out.println(e.getMessage()); + e.printStackTrace(); } } } - private IArtifactDescriptor[] getSortedCompletePredecessors(IArtifactKey artifactKey, IArtifactKey[] relatedArtifactKeys) { + private IArtifactDescriptor[] getSortedCompletePredecessors(IArtifactKey artifactKey, + IArtifactKey[] relatedArtifactKeys) { // get all artifact keys - List<IArtifactDescriptor> completeDescriptors = new ArrayList<IArtifactDescriptor>(relatedArtifactKeys.length); - for (int i = 0; i < relatedArtifactKeys.length; i++) { + List<IArtifactDescriptor> completeDescriptors = new ArrayList<>(relatedArtifactKeys.length); + for (IArtifactKey relatedArtifactKey : relatedArtifactKeys) { // if we find ´our self´ skip - if (relatedArtifactKeys[i].equals(artifactKey)) + if (relatedArtifactKey.equals(artifactKey)) continue; - // look for a complete artifact descriptor of the current key - IArtifactDescriptor[] descriptors = repository.getArtifactDescriptors(relatedArtifactKeys[i]); - for (int j = 0; j < descriptors.length; j++) { - if (isCanonical(descriptors[j])) { - completeDescriptors.add(descriptors[j]); + // look for a complete artifact descriptor of the current key + IArtifactDescriptor[] descriptors = repository.getArtifactDescriptors(relatedArtifactKey); + for (IArtifactDescriptor descriptor : descriptors) { + if (isCanonical(descriptor)) { + completeDescriptors.add(descriptor); break; } } } - IArtifactDescriptor[] completeSortedDescriptors = completeDescriptors.toArray(new IArtifactDescriptor[completeDescriptors.size()]); + IArtifactDescriptor[] completeSortedDescriptors = completeDescriptors + .toArray(new IArtifactDescriptor[completeDescriptors.size()]); // Sort, so to allow a depth lookup! Arrays.sort(completeSortedDescriptors, ARTIFACT_DESCRIPTOR_VERSION_COMPARATOR); return completeSortedDescriptors; @@ -242,17 +247,20 @@ public class Optimizer { } private boolean isCanonical(IArtifactDescriptor descriptor) { - // TODO length != 0 is not necessarily an indicator for not being canonical! + // TODO length != 0 is not necessarily an indicator for not being canonical! return descriptor.getProcessingSteps().length == 0; } static final class ArtifactDescriptorVersionComparator implements Comparator<IArtifactDescriptor> { + @Override public int compare(IArtifactDescriptor artifactDescriptor0, IArtifactDescriptor artifactDescriptor1) { - return -1 * artifactDescriptor0.getArtifactKey().getVersion().compareTo(artifactDescriptor1.getArtifactKey().getVersion()); + return -1 * artifactDescriptor0.getArtifactKey().getVersion() + .compareTo(artifactDescriptor1.getArtifactKey().getVersion()); } } static final class ArtifactKeyVersionComparator implements Comparator<IArtifactKey> { + @Override public int compare(IArtifactKey artifactKey0, IArtifactKey artifactKey1) { return -1 * artifactKey0.getVersion().compareTo(artifactKey1.getVersion()); } diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java index a0455ef14..15050c799 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Application.java @@ -1,10 +1,10 @@ /******************************************************************************* - * Copyright (c) 2007, 2016 IBM Corporation and others. All rights reserved. This + * Copyright (c) 2007, 2018 IBM Corporation and others. All rights reserved. This * program and the accompanying materials are made available under the terms of * the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: + * + * Contributors: * IBM Corporation - initial API and implementation ******************************************************************************/ package org.eclipse.equinox.internal.p2.artifact.optimizers.pack200; @@ -18,15 +18,16 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository; import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager; public class Application extends OptimizerApplication { - //Application return code + // Application return code private static final Integer NON_WRITTABLE_REPOSITORY = -1; - //Application arguments + // Application arguments private static final String ARTIFACT_REPOSITORY_ARG = "-artifactRepository"; //$NON-NLS-1$ private static final String ARTIFACT_REPOSITORY_SHORT_ARG = "-ar"; //$NON-NLS-1$ private URI artifactRepositoryLocation; + @Override public Object start(IApplicationContext context) throws Exception { Map<?, ?> args = context.getArguments(); initializeFromArguments((String[]) args.get("application.args")); //$NON-NLS-1$ @@ -49,14 +50,15 @@ public class Application extends OptimizerApplication { if (args == null) return; for (int i = 0; i < args.length; i++) { - // check for args with parameters. If we are at the last argument or - // if the next one has a '-' as the first character, then we can't have + // check for args with parameters. If we are at the last argument or + // if the next one has a '-' as the first character, then we can't have // an arg with a param so continue. if (i == args.length - 1 || args[i + 1].startsWith("-")) //$NON-NLS-1$ continue; String arg = args[++i]; - if (args[i - 1].equalsIgnoreCase(ARTIFACT_REPOSITORY_ARG) || args[i - 1].equalsIgnoreCase(ARTIFACT_REPOSITORY_SHORT_ARG)) + if (args[i - 1].equalsIgnoreCase(ARTIFACT_REPOSITORY_ARG) + || args[i - 1].equalsIgnoreCase(ARTIFACT_REPOSITORY_SHORT_ARG)) artifactRepositoryLocation = new URI(arg); } } diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Optimizer.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Optimizer.java index a43efa3da..b23c99ff1 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Optimizer.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Optimizer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2010 IBM Corporation and others. + * Copyright (c) 2007, 2018 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,7 +12,6 @@ package org.eclipse.equinox.internal.p2.artifact.optimizers.pack200; import java.io.IOException; import java.io.OutputStream; -import java.util.Iterator; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStep; @@ -26,7 +25,7 @@ import org.eclipse.equinox.p2.repository.artifact.spi.ProcessingStepDescriptor; import org.eclipse.osgi.util.NLS; public class Optimizer { - private IArtifactRepository repository; + private final IArtifactRepository repository; public Optimizer(IArtifactRepository repository) { this.repository = repository; @@ -34,15 +33,13 @@ public class Optimizer { public void run() { IQueryResult<IArtifactKey> keys = repository.query(ArtifactKeyQuery.ALL_KEYS, null); - for (Iterator<IArtifactKey> iterator = keys.iterator(); iterator.hasNext();) { - IArtifactKey key = iterator.next(); + for (IArtifactKey key : keys) { if (!key.getClassifier().equals("plugin")) //$NON-NLS-1$ continue; IArtifactDescriptor[] descriptors = repository.getArtifactDescriptors(key); IArtifactDescriptor canonical = null; boolean optimized = false; - for (int j = 0; j < descriptors.length; j++) { - IArtifactDescriptor descriptor = descriptors[j]; + for (IArtifactDescriptor descriptor : descriptors) { if (isCanonical(descriptor)) canonical = descriptor; optimized |= isOptimized(descriptor); @@ -62,41 +59,38 @@ public class Optimizer { private void optimize(IArtifactDescriptor descriptor) { ArtifactDescriptor newDescriptor = new ArtifactDescriptor(descriptor); - IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] {new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true)}; //$NON-NLS-1$ + IProcessingStepDescriptor[] steps = new IProcessingStepDescriptor[] { + new ProcessingStepDescriptor("org.eclipse.equinox.p2.processing.Pack200Unpacker", null, true) }; //$NON-NLS-1$ newDescriptor.setProcessingSteps(steps); newDescriptor.setProperty(IArtifactDescriptor.FORMAT, IArtifactDescriptor.FORMAT_PACKED); - OutputStream repositoryStream = null; - try { - repositoryStream = repository.getOutputStream(newDescriptor); + try (OutputStream repositoryStream = repository.getOutputStream(newDescriptor)) { // Add in all the processing steps needed to optimize (e.g., pack200, ...) ProcessingStepHandler handler = new ProcessingStepHandler(); - OutputStream destination = handler.link(new ProcessingStep[] {new Pack200OptimizerStep()}, repositoryStream, null); + OutputStream destination = handler.link(new ProcessingStep[] { new Pack200OptimizerStep() }, + repositoryStream, null); - // Do the actual work by asking the repo to get the artifact and put it in the destination. + // Do the actual work by asking the repo to get the artifact and put it in the + // destination. IStatus status = repository.getArtifact(descriptor, destination, new NullProgressMonitor()); if (!status.isOK()) { System.out.println(NLS.bind(Messages.failed_getting_artifact, descriptor.getArtifactKey())); System.out.println(status); } + repositoryStream.close(); + status = ProcessingStepHandler.checkStatus(repositoryStream); + if (!status.isOK()) { + System.out.println(NLS.bind(Messages.skip_optimization, descriptor.getArtifactKey())); + System.out.println(status.toString()); + } } catch (ProvisionException e) { System.out.println(NLS.bind(Messages.skip_optimization, descriptor.getArtifactKey())); System.out.println(e.getMessage()); e.printStackTrace(); - } finally { - if (repositoryStream != null) - try { - repositoryStream.close(); - IStatus status = ProcessingStepHandler.checkStatus(repositoryStream); - if (!status.isOK()) { - System.out.println(NLS.bind(Messages.skip_optimization, descriptor.getArtifactKey())); - System.out.println(status.toString()); - } - } catch (IOException e) { - System.out.println(NLS.bind(Messages.skip_optimization, descriptor.getArtifactKey())); - System.out.println(e.getMessage()); - e.printStackTrace(); - } + } catch (IOException e) { + System.out.println(NLS.bind(Messages.skip_optimization, descriptor.getArtifactKey())); + System.out.println(e.getMessage()); + e.printStackTrace(); } } diff --git a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Pack200OptimizerStep.java b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Pack200OptimizerStep.java index f950b5da0..91ab26eb0 100644 --- a/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Pack200OptimizerStep.java +++ b/bundles/org.eclipse.equinox.p2.artifact.optimizers/src/org/eclipse/equinox/internal/p2/artifact/optimizers/pack200/Pack200OptimizerStep.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 compeople AG and others. + * Copyright (c) 2007, 2018 compeople AG and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,7 +22,7 @@ import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessorExec import org.eclipse.internal.provisional.equinox.p2.jarprocessor.JarProcessorExecutor.Options; /** - * The Pack200Packer expects an input containing normal ".jar" data. + * The Pack200Packer expects an input containing normal ".jar" data. */ public class Pack200OptimizerStep extends AbstractBufferingStep { private static final String PACKED_SUFFIX = ".pack.gz"; //$NON-NLS-1$ @@ -31,8 +31,8 @@ public class Pack200OptimizerStep extends AbstractBufferingStep { static { try { - // TODO This is not very elegant. But there is currently no other way to - // find it out. PackStep.canPack() is not visible due to restrictions. + // TODO This is not very elegant. But there is currently no other way to + // find it out. PackStep.canPack() is not visible due to restrictions. JarProcessor.getPackProcessor(null); pack200Available = true; } catch (UnsupportedOperationException e) { @@ -40,17 +40,20 @@ public class Pack200OptimizerStep extends AbstractBufferingStep { } } + @Override protected OutputStream createIncomingStream() throws IOException { incoming = File.createTempFile(INCOMING_ROOT, JAR_SUFFIX); return new BufferedOutputStream(new FileOutputStream(incoming)); } + @Override protected void cleanupTempFiles() { super.cleanupTempFiles(); if (incoming != null) incoming.delete(); } + @Override protected void performProcessing() throws IOException { File resultFile = null; try { @@ -75,7 +78,8 @@ public class Pack200OptimizerStep extends AbstractBufferingStep { // unpack Options options = new Options(); options.pack = true; - // TODO use false here assuming that all content is conditioned. Need to revise this + // TODO use false here assuming that all content is conditioned. Need to revise + // this options.processAll = false; options.input = incoming; options.outputDir = getWorkDir().getPath(); |