Add support for SportBukkit. FIXES Ticket-107
Dieser Commit ist enthalten in:
Ursprung
ce2079b0bc
Commit
92781be618
@ -1,4 +1,14 @@
|
|||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.fieldPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.fieldSuffixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.localPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.localSuffixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
|
||||||
|
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
@ -10,3 +20,283 @@ org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
|||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.6
|
org.eclipse.jdt.core.compiler.source=1.6
|
||||||
|
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
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||||
|
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=52
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=48
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||||
|
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=64
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=64
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=64
|
||||||
|
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_union_type_in_multicatch=16
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_after_imports=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_after_package=0
|
||||||
|
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=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_method=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=0
|
||||||
|
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_type_declarations=0
|
||||||
|
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
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
|
||||||
|
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_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.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=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=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=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
|
||||||
|
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=true
|
||||||
|
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_type_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||||
|
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.indentation.size=4
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||||
|
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=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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||||
|
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_superinterfaces=insert
|
||||||
|
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_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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||||
|
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_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_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=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=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||||
|
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_superinterfaces=do not insert
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||||
|
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_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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||||
|
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
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
|
||||||
|
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=100
|
||||||
|
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.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_binary_operator=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
||||||
|
@ -23,8 +23,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import com.google.common.cache.Cache;
|
import com.comphenix.protocol.utility.SafeCacheBuilder;
|
||||||
import com.google.common.cache.CacheBuilder;
|
|
||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
import com.google.common.cache.RemovalCause;
|
import com.google.common.cache.RemovalCause;
|
||||||
import com.google.common.cache.RemovalListener;
|
import com.google.common.cache.RemovalListener;
|
||||||
@ -42,7 +41,6 @@ import com.google.common.cache.RemovalNotification;
|
|||||||
*/
|
*/
|
||||||
public class BlockingHashMap<TKey, TValue> {
|
public class BlockingHashMap<TKey, TValue> {
|
||||||
// Map of values
|
// Map of values
|
||||||
private final Cache<TKey, TValue> backingCache;
|
|
||||||
private final ConcurrentMap<TKey, TValue> backingMap;
|
private final ConcurrentMap<TKey, TValue> backingMap;
|
||||||
|
|
||||||
// Map of locked objects
|
// Map of locked objects
|
||||||
@ -65,19 +63,19 @@ public class BlockingHashMap<TKey, TValue> {
|
|||||||
* Initialize a new map.
|
* Initialize a new map.
|
||||||
*/
|
*/
|
||||||
public BlockingHashMap() {
|
public BlockingHashMap() {
|
||||||
backingCache = CacheBuilder.newBuilder().weakValues().removalListener(
|
backingMap = SafeCacheBuilder.<TKey, TValue>newBuilder().
|
||||||
new RemovalListener<TKey, TValue>() {
|
weakValues().
|
||||||
@Override
|
removalListener(
|
||||||
public void onRemoval(RemovalNotification<TKey, TValue> entry) {
|
new RemovalListener<TKey, TValue>() {
|
||||||
// Clean up locks too
|
@Override
|
||||||
if (entry.getCause() != RemovalCause.REPLACED) {
|
public void onRemoval(RemovalNotification<TKey, TValue> entry) {
|
||||||
locks.remove(entry.getKey());
|
// Clean up locks too
|
||||||
}
|
if (entry.getCause() != RemovalCause.REPLACED) {
|
||||||
}
|
locks.remove(entry.getKey());
|
||||||
}).build(
|
}
|
||||||
BlockingHashMap.<TKey, TValue>newInvalidCacheLoader()
|
}
|
||||||
);
|
}).
|
||||||
backingMap = backingCache.asMap();
|
build(BlockingHashMap.<TKey, TValue> newInvalidCacheLoader());
|
||||||
|
|
||||||
// Normal concurrent hash map
|
// Normal concurrent hash map
|
||||||
locks = new ConcurrentHashMap<TKey, Object>();
|
locks = new ConcurrentHashMap<TKey, Object>();
|
||||||
|
@ -25,6 +25,7 @@ import java.net.Socket;
|
|||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import net.sf.cglib.proxy.Factory;
|
import net.sf.cglib.proxy.Factory;
|
||||||
@ -53,11 +54,10 @@ import com.comphenix.protocol.injector.server.InputStreamLookupBuilder;
|
|||||||
import com.comphenix.protocol.injector.server.SocketInjector;
|
import com.comphenix.protocol.injector.server.SocketInjector;
|
||||||
import com.comphenix.protocol.utility.MinecraftReflection;
|
import com.comphenix.protocol.utility.MinecraftReflection;
|
||||||
import com.comphenix.protocol.utility.MinecraftVersion;
|
import com.comphenix.protocol.utility.MinecraftVersion;
|
||||||
|
import com.comphenix.protocol.utility.SafeCacheBuilder;
|
||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Predicate;
|
import com.google.common.base.Predicate;
|
||||||
import com.google.common.cache.Cache;
|
|
||||||
import com.google.common.cache.CacheBuilder;
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -89,8 +89,8 @@ class ProxyPlayerInjectionHandler implements PlayerInjectionHandler {
|
|||||||
private WeakReference<PlayerInjector> lastSuccessfulHook;
|
private WeakReference<PlayerInjector> lastSuccessfulHook;
|
||||||
|
|
||||||
// Dummy injection
|
// Dummy injection
|
||||||
private Cache<Player, PlayerInjector> dummyInjectors =
|
private ConcurrentMap<Player, PlayerInjector> dummyInjectors =
|
||||||
CacheBuilder.newBuilder().
|
SafeCacheBuilder.newBuilder().
|
||||||
expireAfterWrite(30, TimeUnit.SECONDS).
|
expireAfterWrite(30, TimeUnit.SECONDS).
|
||||||
build(BlockingHashMap.<Player, PlayerInjector>newInvalidCacheLoader());
|
build(BlockingHashMap.<Player, PlayerInjector>newInvalidCacheLoader());
|
||||||
|
|
||||||
@ -622,7 +622,7 @@ class ProxyPlayerInjectionHandler implements PlayerInjectionHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inputStreamLookup.setSocketInjector(dummyInjector.getAddress(), dummyInjector);
|
inputStreamLookup.setSocketInjector(dummyInjector.getAddress(), dummyInjector);
|
||||||
dummyInjectors.asMap().put(player, dummyInjector);
|
dummyInjectors.put(player, dummyInjector);
|
||||||
return dummyInjector;
|
return dummyInjector;
|
||||||
|
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
|
@ -0,0 +1,324 @@
|
|||||||
|
package com.comphenix.protocol.utility;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
import com.comphenix.protocol.reflect.FieldAccessException;
|
||||||
|
import com.google.common.base.Ticker;
|
||||||
|
import com.google.common.cache.CacheBuilder;
|
||||||
|
import com.google.common.cache.CacheLoader;
|
||||||
|
import com.google.common.cache.RemovalListener;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a Guava CacheBuilder that is compatible with both Guava 10 and 13.
|
||||||
|
*
|
||||||
|
* @author Kristian
|
||||||
|
*/
|
||||||
|
public class SafeCacheBuilder<K, V> {
|
||||||
|
private CacheBuilder<K, V> builder;
|
||||||
|
|
||||||
|
private static Method BUILD_METHOD;
|
||||||
|
private static Method AS_MAP_METHOD;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private SafeCacheBuilder() {
|
||||||
|
builder = (CacheBuilder<K, V>) CacheBuilder.newBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a new safe cache builder.
|
||||||
|
*
|
||||||
|
* @return A new cache builder.
|
||||||
|
*/
|
||||||
|
public static <K, V> SafeCacheBuilder<K, V> newBuilder() {
|
||||||
|
return new SafeCacheBuilder<K, V>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Guides the allowed concurrency among update operations. Used as a hint
|
||||||
|
* for internal sizing. The table is internally partitioned to try to permit
|
||||||
|
* the indicated number of concurrent updates without contention. Because
|
||||||
|
* assignment of entries to these partitions is not necessarily uniform, the
|
||||||
|
* actual concurrency observed may vary. Ideally, you should choose a value
|
||||||
|
* to accommodate as many threads as will ever concurrently modify the
|
||||||
|
* table. Using a significantly higher value than you need can waste space
|
||||||
|
* and time, and a significantly lower value can lead to thread contention.
|
||||||
|
* But overestimates and underestimates within an order of magnitude do not
|
||||||
|
* usually have much noticeable impact. A value of one permits only one
|
||||||
|
* thread to modify the cache at a time, but since read operations can
|
||||||
|
* proceed concurrently, this still yields higher concurrency than full
|
||||||
|
* synchronization. Defaults to 4.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Note:</b>The default may change in the future. If you care about this
|
||||||
|
* value, you should always choose it explicitly.
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException if {@code concurrencyLevel} is
|
||||||
|
* nonpositive
|
||||||
|
* @throws IllegalStateException if a concurrency level was already set
|
||||||
|
*/
|
||||||
|
public SafeCacheBuilder<K, V> concurrencyLevel(int concurrencyLevel) {
|
||||||
|
builder.concurrencyLevel(concurrencyLevel);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies that each entry should be automatically removed from the cache
|
||||||
|
* once a fixed duration has elapsed after the entry's creation, or last
|
||||||
|
* access. Access time is reset by {@link Cache#get} and
|
||||||
|
* {@link Cache#getUnchecked}, but not by operations on the view returned by
|
||||||
|
* {@link Cache#asMap}.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* When {@code duration} is zero, elements will be evicted immediately after
|
||||||
|
* being loaded into the cache. This has the same effect as invoking
|
||||||
|
* {@link #maximumSize maximumSize}{@code (0)}. It can be useful in testing,
|
||||||
|
* or to disable caching temporarily without a code change.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Expired entries may be counted by {@link Cache#size}, but will never be
|
||||||
|
* visible to read or write operations. Expired entries are currently
|
||||||
|
* cleaned up during write operations, or during occasional read operations
|
||||||
|
* in the absense of writes; though this behavior may change in the future.
|
||||||
|
*
|
||||||
|
* @param duration the length of time after an entry is last accessed that
|
||||||
|
* it should be automatically removed
|
||||||
|
* @param unit the unit that {@code duration} is expressed in
|
||||||
|
* @throws IllegalArgumentException if {@code duration} is negative
|
||||||
|
* @throws IllegalStateException if the time to idle or time to live was
|
||||||
|
* already set
|
||||||
|
*/
|
||||||
|
|
||||||
|
public SafeCacheBuilder<K, V> expireAfterAccess(long duration, TimeUnit unit) {
|
||||||
|
builder.expireAfterAccess(duration, unit);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies that each entry should be automatically removed from the cache
|
||||||
|
* once a fixed duration has elapsed after the entry's creation, or the most
|
||||||
|
* recent replacement of its value.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* When {@code duration} is zero, elements will be evicted immediately after
|
||||||
|
* being loaded into the cache. This has the same effect as invoking
|
||||||
|
* {@link #maximumSize maximumSize}{@code (0)}. It can be useful in testing,
|
||||||
|
* or to disable caching temporarily without a code change.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Expired entries may be counted by {@link Cache#size}, but will never be
|
||||||
|
* visible to read or write operations. Expired entries are currently
|
||||||
|
* cleaned up during write operations, or during occasional read operations
|
||||||
|
* in the absense of writes; though this behavior may change in the future.
|
||||||
|
*
|
||||||
|
* @param duration the length of time after an entry is created that it
|
||||||
|
* should be automatically removed
|
||||||
|
* @param unit the unit that {@code duration} is expressed in
|
||||||
|
* @throws IllegalArgumentException if {@code duration} is negative
|
||||||
|
* @throws IllegalStateException if the time to live or time to idle was
|
||||||
|
* already set
|
||||||
|
*/
|
||||||
|
public SafeCacheBuilder<K, V> expireAfterWrite(long duration, TimeUnit unit) {
|
||||||
|
builder.expireAfterWrite(duration, unit);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the minimum total size for the internal hash tables. For example, if
|
||||||
|
* the initial capacity is {@code 60}, and the concurrency level is
|
||||||
|
* {@code 8}, then eight segments are created, each having a hash table of
|
||||||
|
* size eight. Providing a large enough estimate at construction time avoids
|
||||||
|
* the need for expensive resizing operations later, but setting this value
|
||||||
|
* unnecessarily high wastes memory.
|
||||||
|
*
|
||||||
|
* @throws IllegalArgumentException if {@code initialCapacity} is negative
|
||||||
|
* @throws IllegalStateException if an initial capacity was already set
|
||||||
|
*/
|
||||||
|
public SafeCacheBuilder<K, V> initialCapacity(int initialCapacity) {
|
||||||
|
builder.initialCapacity(initialCapacity);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the maximum number of entries the cache may contain. Note that
|
||||||
|
* the cache <b>may evict an entry before this limit is exceeded</b>. As the
|
||||||
|
* cache size grows close to the maximum, the cache evicts entries that are
|
||||||
|
* less likely to be used again. For example, the cache may evict an entry
|
||||||
|
* because it hasn't been used recently or very often.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* When {@code size} is zero, elements will be evicted immediately after
|
||||||
|
* being loaded into the cache. This has the same effect as invoking
|
||||||
|
* {@link #expireAfterWrite expireAfterWrite}{@code (0, unit)} or
|
||||||
|
* {@link #expireAfterAccess expireAfterAccess}{@code (0,
|
||||||
|
* unit)}. It can be useful in testing, or to disable caching temporarily
|
||||||
|
* without a code change.
|
||||||
|
*
|
||||||
|
* @param size the maximum size of the cache
|
||||||
|
* @throws IllegalArgumentException if {@code size} is negative
|
||||||
|
* @throws IllegalStateException if a maximum size was already set
|
||||||
|
*/
|
||||||
|
|
||||||
|
public SafeCacheBuilder<K, V> maximumSize(int size) {
|
||||||
|
builder.maximumSize(size);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies a listener instance, which all caches built using this
|
||||||
|
* {@code CacheBuilder} will notify each time an entry is removed from the
|
||||||
|
* cache by any means.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Each cache built by this {@code CacheBuilder} after this method is called
|
||||||
|
* invokes the supplied listener after removing an element for any reason
|
||||||
|
* (see removal causes in {@link RemovalCause}). It will invoke the listener
|
||||||
|
* during invocations of any of that cache's public methods (even read-only
|
||||||
|
* methods).
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Important note:</b> Instead of returning <em>this</em> as a
|
||||||
|
* {@code CacheBuilder} instance, this method returns
|
||||||
|
* {@code CacheBuilder<K1, V1>}. From this point on, either the original
|
||||||
|
* reference or the returned reference may be used to complete configuration
|
||||||
|
* and build the cache, but only the "generic" one is type-safe. That is, it
|
||||||
|
* will properly prevent you from building caches whose key or value types
|
||||||
|
* are incompatible with the types accepted by the listener already
|
||||||
|
* provided; the {@code CacheBuilder} type cannot do this. For best results,
|
||||||
|
* simply use the standard method-chaining idiom, as illustrated in the
|
||||||
|
* documentation at top, configuring a {@code CacheBuilder} and building
|
||||||
|
* your {@link Cache} all in a single statement.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Warning:</b> if you ignore the above advice, and use this
|
||||||
|
* {@code CacheBuilder} to build a cache whose key or value type is
|
||||||
|
* incompatible with the listener, you will likely experience a
|
||||||
|
* {@link ClassCastException} at some <i>undefined</i> point in the future.
|
||||||
|
*
|
||||||
|
* @throws IllegalStateException if a removal listener was already set
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <K1 extends K, V1 extends V> SafeCacheBuilder<K1, V1> removalListener(RemovalListener<? super K, ? super V> listener) {
|
||||||
|
builder.removalListener(listener);
|
||||||
|
return (SafeCacheBuilder<K1, V1>) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies a nanosecond-precision time source for use in determining when
|
||||||
|
* entries should be expired. By default, {@link System#nanoTime} is used.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* The primary intent of this method is to facilitate testing of caches
|
||||||
|
* which have been configured with {@link #expireAfterWrite} or
|
||||||
|
* {@link #expireAfterAccess}.
|
||||||
|
*
|
||||||
|
* @throws IllegalStateException if a ticker was already set
|
||||||
|
*/
|
||||||
|
public SafeCacheBuilder<K, V> ticker(Ticker ticker) {
|
||||||
|
builder.ticker(ticker);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies that each value (not key) stored in the cache should be wrapped
|
||||||
|
* in a {@link SoftReference} (by default, strong references are used).
|
||||||
|
* Softly-referenced objects will be garbage-collected in a <i>globally</i>
|
||||||
|
* least-recently-used manner, in response to memory demand.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Warning:</b> in most circumstances it is better to set a per-cache
|
||||||
|
* {@linkplain #maximumSize maximum size} instead of using soft references.
|
||||||
|
* You should only use this method if you are well familiar with the
|
||||||
|
* practical consequences of soft references.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Note:</b> when this method is used, the resulting cache will use
|
||||||
|
* identity ({@code ==}) comparison to determine equality of values.
|
||||||
|
*
|
||||||
|
* @throws IllegalStateException if the value strength was already set
|
||||||
|
*/
|
||||||
|
|
||||||
|
public SafeCacheBuilder<K, V> softValues() {
|
||||||
|
builder.softValues();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies that each key (not value) stored in the cache should be wrapped
|
||||||
|
* in a {@link WeakReference} (by default, strong references are used).
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Warning:</b> when this method is used, the resulting cache will use
|
||||||
|
* identity ({@code ==}) comparison to determine equality of keys.
|
||||||
|
*
|
||||||
|
* @throws IllegalStateException if the key strength was already set
|
||||||
|
*/
|
||||||
|
public SafeCacheBuilder<K, V> weakKeys() {
|
||||||
|
builder.weakKeys();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies that each value (not key) stored in the cache should be wrapped
|
||||||
|
* in a {@link WeakReference} (by default, strong references are used).
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* Weak values will be garbage collected once they are weakly reachable.
|
||||||
|
* This makes them a poor candidate for caching; consider
|
||||||
|
* {@link #softValues} instead.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Note:</b> when this method is used, the resulting cache will use
|
||||||
|
* identity ({@code ==}) comparison to determine equality of values.
|
||||||
|
*
|
||||||
|
* @throws IllegalStateException if the value strength was already set
|
||||||
|
*/
|
||||||
|
public SafeCacheBuilder<K, V> weakValues() {
|
||||||
|
builder.weakValues();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the cache wrapped as a ConcurrentMap.
|
||||||
|
* <>
|
||||||
|
* We can't return the direct Cache instance as it changed in Guava 13.
|
||||||
|
* @return The cache as a map.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public <K1 extends K, V1 extends V> ConcurrentMap<K1, V1> build(CacheLoader<? super K1, V1> loader) {
|
||||||
|
Object cache = null;
|
||||||
|
|
||||||
|
if (BUILD_METHOD == null) {
|
||||||
|
try {
|
||||||
|
BUILD_METHOD = builder.getClass().getDeclaredMethod("build", CacheLoader.class);
|
||||||
|
BUILD_METHOD.setAccessible(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new FieldAccessException("Unable to find CacheBuilder.build(CacheLoader)", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attempt to build the Cache
|
||||||
|
try {
|
||||||
|
cache = BUILD_METHOD.invoke(builder, loader);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new FieldAccessException("Unable to invoke " + BUILD_METHOD + " on " + builder, e);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (AS_MAP_METHOD == null) {
|
||||||
|
try {
|
||||||
|
AS_MAP_METHOD = cache.getClass().getMethod("asMap");
|
||||||
|
AS_MAP_METHOD.setAccessible(true);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new FieldAccessException("Unable to find Cache.asMap() in " + cache, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Retrieve it as a map
|
||||||
|
try {
|
||||||
|
return (ConcurrentMap<K1, V1>) AS_MAP_METHOD.invoke(cache);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new FieldAccessException("Unable to invoke " + AS_MAP_METHOD + " on " + cache, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
In neuem Issue referenzieren
Einen Benutzer sperren