[384319] CPU utilization to 100% when this is appended to new object definition
diff --git a/features/org.eclipse.wst.jsdt_tests.feature/feature.xml b/features/org.eclipse.wst.jsdt_tests.feature/feature.xml index 9b1f334..d52216f 100644 --- a/features/org.eclipse.wst.jsdt_tests.feature/feature.xml +++ b/features/org.eclipse.wst.jsdt_tests.feature/feature.xml
@@ -1,64 +1,64 @@ -<?xml version="1.0" encoding="UTF-8"?> -<feature - id="org.eclipse.wst.jsdt_tests.feature" - label="%featureName" - version="1.4.1.qualifier" - provider-name="%providerName" - license-feature="org.eclipse.license" - license-feature-version="1.0.0.qualifier"> - - <description> - %description - </description> - - <copyright> - %copyright - </copyright> - - <license url="license.html"> - %license - </license> - - <plugin - id="org.eclipse.wst.jsdt.core.tests.compiler" - download-size="0" - install-size="0" - version="0.0.0"/> - - <plugin - id="org.eclipse.wst.jsdt.core.tests.model" - download-size="0" - install-size="0" - version="0.0.0"/> - - <plugin - id="org.eclipse.wst.jsdt.ui.tests" - download-size="0" - install-size="0" - version="0.0.0"/> - - <plugin - id="org.eclipse.wtp.releng.versionchecker" - download-size="0" - install-size="0" - version="0.0.0"/> - - <plugin - id="org.eclipse.wtp.releng.tests" - download-size="0" - install-size="0" - version="0.0.0"/> - - <plugin - id="org.eclipse.wst.jsdt.debug.rhino.tests" - download-size="0" - install-size="0" - version="0.0.0"/> - - <plugin - id="org.eclipse.wst.jsdt.debug.core.tests" - download-size="0" - install-size="0" - version="0.0.0"/> - -</feature> +<?xml version="1.0" encoding="UTF-8"?> +<feature + id="org.eclipse.wst.jsdt_tests.feature" + label="%featureName" + version="1.5.0.qualifier" + provider-name="%providerName" + license-feature="org.eclipse.license" + license-feature-version="1.0.0.qualifier"> + + <description> + %description + </description> + + <copyright> + %copyright + </copyright> + + <license url="license.html"> + %license + </license> + + <plugin + id="org.eclipse.wst.jsdt.core.tests.compiler" + download-size="0" + install-size="0" + version="0.0.0"/> + + <plugin + id="org.eclipse.wst.jsdt.core.tests.model" + download-size="0" + install-size="0" + version="0.0.0"/> + + <plugin + id="org.eclipse.wst.jsdt.ui.tests" + download-size="0" + install-size="0" + version="0.0.0"/> + + <plugin + id="org.eclipse.wtp.releng.versionchecker" + download-size="0" + install-size="0" + version="0.0.0"/> + + <plugin + id="org.eclipse.wtp.releng.tests" + download-size="0" + install-size="0" + version="0.0.0"/> + + <plugin + id="org.eclipse.wst.jsdt.debug.rhino.tests" + download-size="0" + install-size="0" + version="0.0.0"/> + + <plugin + id="org.eclipse.wst.jsdt.debug.core.tests" + download-size="0" + install-size="0" + version="0.0.0"/> + +</feature>
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.wst.jsdt.core.tests.compiler/.settings/org.eclipse.jdt.core.prefs index 839a233..c52af75 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/.settings/org.eclipse.jdt.core.prefs +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/.settings/org.eclipse.jdt.core.prefs
@@ -1,12 +1,394 @@ -#Mon Dec 07 03:40:31 EST 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 -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.problem.assertIdentifier=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning -org.eclipse.jdt.core.compiler.source=1.3 +#Wed Jul 18 22:25:27 EDT 2012 +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=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_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.compiler.problem.emptyStatement=warning +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=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_method_declaration=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_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +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_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=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_try=insert +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.classpath.exclusionPatterns=enabled +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=3 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=64 +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=78 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.builder.cleanOutputFolder=clean +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.continuation_indentation=3 +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=ignore +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=enabled +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled +org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.incompleteClasspath=error +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.join_lines_in_comments=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=warning +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=insert +org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 +org.eclipse.jdt.core.formatter.comment.format_html=true +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_closing_paren_in_enum_constant=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_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +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_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=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_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=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_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=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_new_line_before_finally_in_try_statement=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=insert +org.eclipse.jdt.core.circularClasspath=error +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=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_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=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.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.formatter.tabulation.char=tab +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert +org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.formatter.join_wrapped_lines=true +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=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.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.use_on_off_tags=false +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.indentation.size=4 +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.comment.indent_root_tags=true +org.eclipse.jdt.core.compiler.problem.deprecation=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.indent_empty_lines=false +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert +org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=48 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.compiler.problem.unusedLabel=error +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.builder.invalidClasspath=ignore +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=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_before_opening_paren_in_for=insert +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.incompatibleJDKLevel=ignore +org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.compiler.problem.nullReference=error +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.alignment_for_compact_if=32 +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=ignore +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled +org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=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_closing_paren_in_try=do not insert +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=3 +org.eclipse.jdt.core.formatter.lineSplit=999 +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled +org.eclipse.jdt.core.compiler.maxProblemPerUnit=100 +org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.formatter.tabulation.size=4 +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.builder.duplicateResourceTask=warning +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=insert +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=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_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on +org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=64 +org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert +org.eclipse.jdt.core.formatter.blank_lines_before_field=0
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/.settings/org.eclipse.jdt.ui.prefs b/tests/org.eclipse.wst.jsdt.core.tests.compiler/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 0000000..03aa56b --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,6 @@ +#Wed Jul 18 22:25:27 EDT 2012 +formatter_settings_version=11 +eclipse.preferences.version=1 +org.eclipse.jdt.ui.javadoc=true +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Licensed Materials - Property of IBM\r\n * \u00A9 Copyright IBM Corporation ${year}. All Rights Reserved.\r\n * U.S. Government Users Restricted Rights - Use, duplication or disclosure\r\n * restricted by GSA ADP Schedule Contract with IBM Corp. \r\n *******************************************************************************/\r\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> +formatter_profile=_SSE Formatting
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.jsdt.core.tests.compiler/META-INF/MANIFEST.MF index 810a2ee..966874b 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wst.jsdt.core.tests.compiler; singleton:=true -Bundle-Version: 1.0.502.qualifier +Bundle-Version: 1.0.600.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)", @@ -12,11 +12,8 @@ Export-Package: org.eclipse.wst.jsdt.core.tests.compiler, org.eclipse.wst.jsdt.core.tests.compiler.parser, org.eclipse.wst.jsdt.core.tests.compiler.regression, - org.eclipse.wst.jsdt.core.tests.eval.target, - org.eclipse.wst.jsdt.core.tests.future.compiler.regression, org.eclipse.wst.jsdt.core.tests.interpret, org.eclipse.wst.jsdt.core.tests.junit.extension, - org.eclipse.wst.jsdt.core.tests.runtime, org.eclipse.wst.jsdt.core.tests.util Bundle-RequiredExecutionEnvironment: J2SE-1.4 Bundle-ActivationPolicy: lazy
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTCompilerTests.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTCompilerTests.java index 7793053..7f5044e 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTCompilerTests.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/JSDTCompilerTests.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2012 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 @@ -17,15 +17,31 @@ import junit.framework.TestSuite; import org.eclipse.wst.jsdt.core.JavaScriptCore; +import org.eclipse.wst.jsdt.core.tests.compiler.parser.DualParseSyntaxErrorTest; +import org.eclipse.wst.jsdt.core.tests.compiler.parser.FieldAccessCompletionTest; +import org.eclipse.wst.jsdt.core.tests.compiler.parser.JavadocCompletionParserTest; +import org.eclipse.wst.jsdt.core.tests.compiler.parser.NameReferenceCompletionTest; +import org.eclipse.wst.jsdt.core.tests.compiler.parser.ParserTest; +import org.eclipse.wst.jsdt.core.tests.compiler.parser.ReferenceTypeCompletionTest; +import org.eclipse.wst.jsdt.core.tests.compiler.parser.SelectionTest; +import org.eclipse.wst.jsdt.core.tests.compiler.parser.SelectionTest3; +import org.eclipse.wst.jsdt.core.tests.compiler.parser.StatementRecoveryTest; import org.eclipse.wst.jsdt.core.tests.compiler.parser.SyntaxErrorTest; +import org.eclipse.wst.jsdt.core.tests.compiler.regression.ASTImplTests; +import org.eclipse.wst.jsdt.core.tests.compiler.regression.AssignmentTest; import org.eclipse.wst.jsdt.core.tests.compiler.regression.BasicAnalyseTests; +import org.eclipse.wst.jsdt.core.tests.compiler.regression.BasicJsdocTests; import org.eclipse.wst.jsdt.core.tests.compiler.regression.BasicParserTests; import org.eclipse.wst.jsdt.core.tests.compiler.regression.BasicResolveTests; import org.eclipse.wst.jsdt.core.tests.compiler.regression.CharOperationTest; +import org.eclipse.wst.jsdt.core.tests.compiler.regression.CompilerInvocationTests; import org.eclipse.wst.jsdt.core.tests.compiler.regression.InferTypesTests; +import org.eclipse.wst.jsdt.core.tests.compiler.regression.InternalScannerTest; +import org.eclipse.wst.jsdt.core.tests.compiler.regression.ScannerTest; import org.eclipse.wst.jsdt.core.tests.compiler.regression.UtilTest; import org.eclipse.wst.jsdt.core.tests.compiler.util.ExclusionTests; import org.eclipse.wst.jsdt.core.tests.interpret.BasicInterpretTest; +import org.eclipse.wst.jsdt.core.tests.search.SearchTests; /** * Run all compiler regression tests @@ -48,103 +64,47 @@ ArrayList standardTests = new ArrayList(); // regression tests - standardTests.add(BasicParserTests.class); - standardTests.add(InferTypesTests.class); - standardTests.add(BasicResolveTests.class); + standardTests.add(AssignmentTest.class); + standardTests.add(ASTImplTests.class); standardTests.add(BasicAnalyseTests.class); + standardTests.add(BasicJsdocTests.class); + standardTests.add(BasicParserTests.class); + standardTests.add(BasicResolveTests.class); standardTests.add(CharOperationTest.class); + standardTests.add(CompilerInvocationTests.class); + standardTests.add(InferTypesTests.class); + standardTests.add(InternalScannerTest.class); + standardTests.add(ScannerTest.class); standardTests.add(UtilTest.class); // parser tests + + standardTests.add(DualParseSyntaxErrorTest.class); + standardTests.add(FieldAccessCompletionTest.class); + standardTests.add(JavadocCompletionParserTest.class); + standardTests.add(NameReferenceCompletionTest.class); + standardTests.add(ParserTest.class); + standardTests.add(ReferenceTypeCompletionTest.class); + standardTests.add(SelectionTest.class); + standardTests.add(SelectionTest3.class); + standardTests.add(StatementRecoveryTest.class); standardTests.add(SyntaxErrorTest.class); + // interpret tests standardTests.add(BasicInterpretTest.class); - - -// standardTests.addAll(JavadocTest.allTestClasses); - -// standardTests.add(BasicErrorTests.class); - - // // add all javadoc tests -// for (int i=0, l=JavadocTest.ALL_CLASSES.size(); i<l; i++) { -// standardTests.add(JavadocTest.ALL_CLASSES.get(i)); -// } -// TestSuite all = new TestSuite("JSDT 'Compiler' Tests"); all.addTest(ExclusionTests.suite()); + all.addTest(SearchTests.suite()); - -// int possibleComplianceLevels = AbstractCompilerTest.getPossibleComplianceLevels(); -// if ((possibleComplianceLevels & AbstractCompilerTest.F_1_3) != 0) { -// ArrayList tests_1_3 = (ArrayList)standardTests.clone(); -// tests_1_3.add(Compliance_1_3.class); -// tests_1_3.add(JavadocTest_1_3.class); -// // Reset forgotten subsets tests -// TestCase.TESTS_PREFIX = null; -// TestCase.TESTS_NAMES = null; -// TestCase.TESTS_NUMBERS= null; -// TestCase.TESTS_RANGE = null; -// TestCase.RUN_ONLY_ID = null; -// all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_3, tests_1_3)); -// } -// if ((possibleComplianceLevels & AbstractCompilerTest.F_1_4) != 0) { -// ArrayList tests_1_4 = (ArrayList)standardTests.clone(); -// tests_1_4.add(AssertionTest.class); -// tests_1_4.add(Compliance_1_4.class); -// tests_1_4.add(ClassFileReaderTest_1_4.class); -// tests_1_4.add(JavadocTest_1_4.class); -// // Reset forgotten subsets tests -// TestCase.TESTS_PREFIX = null; -// TestCase.TESTS_NAMES = null; -// TestCase.TESTS_NUMBERS= null; -// TestCase.TESTS_RANGE = null; -// TestCase.RUN_ONLY_ID = null; -// all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_4, tests_1_4)); -// } -// if ((possibleComplianceLevels & AbstractCompilerTest.F_1_5) != 0) { -// ArrayList tests_1_5 = (ArrayList)standardTests.clone(); -// tests_1_5.addAll(RunComparableTests.ALL_CLASSES); -// tests_1_5.add(AssertionTest.class); -// tests_1_5.add(ClassFileReaderTest_1_5.class); -// tests_1_5.add(GenericTypeSignatureTest.class); -// tests_1_5.add(InternalHexFloatTest.class); -// tests_1_5.add(JavadocTest_1_5.class); -// tests_1_5.add(BatchCompilerTest.class); -// tests_1_5.add(ExternalizeStringLiterals15Test.class); -// // Reset forgotten subsets tests -// TestCase.TESTS_PREFIX = null; -// TestCase.TESTS_NAMES = null; -// TestCase.TESTS_NUMBERS= null; -// TestCase.TESTS_RANGE = null; -// TestCase.RUN_ONLY_ID = null; -// all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_5, tests_1_5)); -// } -// if ((possibleComplianceLevels & AbstractCompilerTest.F_1_6) != 0) { -// ArrayList tests_1_6 = (ArrayList)standardTests.clone(); -// tests_1_6.addAll(RunComparableTests.ALL_CLASSES); -// tests_1_6.add(AssertionTest.class); -// tests_1_6.add(ClassFileReaderTest_1_5.class); -// tests_1_6.add(GenericTypeSignatureTest.class); -// tests_1_6.add(InternalHexFloatTest.class); -// tests_1_6.add(JavadocTest_1_5.class); -// tests_1_6.add(BatchCompilerTest.class); -// tests_1_6.add(ExternalizeStringLiterals15Test.class); -// tests_1_6.add(StackMapAttributeTest.class); -// // Reset forgotten subsets tests -// TestCase.TESTS_PREFIX = null; -// TestCase.TESTS_NAMES = null; -// TestCase.TESTS_NUMBERS= null; -// TestCase.TESTS_RANGE = null; -// TestCase.RUN_ONLY_ID = null; -// all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_6, tests_1_6)); -// } + for (Iterator iter = standardTests.iterator(); iter.hasNext();) { Class test = (Class) iter.next(); all.addTestSuite(test); } + return all; } }
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java deleted file mode 100644 index bf642bb..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/AllocationExpressionCompletionTest.java +++ /dev/null
@@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import junit.framework.Test; - -/** - * Completion is expected to be an AllocationExpression. - */ -public class AllocationExpressionCompletionTest extends AbstractCompletionTest { -public AllocationExpressionCompletionTest(String testName) { - super(testName); -} -public static Test suite() { - return buildAllCompliancesTestSuite(AllocationExpressionCompletionTest.class); -} -/* - * Completion inside an if statement. - */ -public void testInIfStatement() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " if (true) { \n" + - " new z.y.X(1, 2, i); \n" + - " } \n" + - " } \n" + - "}\n", - // completeBehind: - "X(1, 2,", - // expectedCompletionNodeToString: - "<CompleteOnAllocationExpression:new z.y.X(1, 2)>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " <CompleteOnAllocationExpression:new z.y.X(1, 2)>;\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<complete inside an if statement>" - ); -} -/* - * Completion on a constructor invocation with no qualification and using a qualified type name. - * - * ie. ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt - * where ClassType is a qualified type name - */ -public void testNoQualificationQualifiedTypeName() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " new z.y.X(1, 2, i); \n" + - " } \n" + - "}\n", - // completeBehind: - "X(1, 2,", - // expectedCompletionNodeToString: - "<CompleteOnAllocationExpression:new z.y.X(1, 2)>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnAllocationExpression:new z.y.X(1, 2)>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<complete on non qualified instance creation with qualified type name>" - ); -} -/* - * Completion on a constructor invocation with no qualification and using a simple type name. - * - * ie. ClassInstanceCreationExpression ::= 'new' ClassType '(' ArgumentListopt ')' ClassBodyopt - * where ClassType is a simple type name - */ -public void testNoQualificationSimpleTypeName() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " new X(1, 2, i); \n" + - " } \n" + - "}\n", - // completeBehind: - "X(1, 2,", - // expectedCompletionNodeToString: - "<CompleteOnAllocationExpression:new X(1, 2)>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnAllocationExpression:new X(1, 2)>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<complete on non qualified instance creation with simple type name>" - ); -} -/* - * Completion on a constructor invocation qualified with a name. - * - * ie. ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt - */ -public void testQualifiedWithName() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar {\n" + - " void foo() { \n" + - " Buz.x.new X(1, 2, i); \n" + - " } \n" + - "}\n", - // completeBehind: - "X(1, 2,", - // expectedCompletionNodeToString: - "<CompleteOnQualifiedAllocationExpression:Buz.x.new X(1, 2)>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnQualifiedAllocationExpression:Buz.x.new X(1, 2)>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<complete on name qualified instance creation>" - ); -} -/* - * Completion on a constructor invocation qualified with a primary. - * - * ie. ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt - */ -public void testQualifiedWithPrimary() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " primary().new X(1, 2, i); \n" + - " } \n" + - "}\n", - // completeBehind: - "X(1, 2,", - // expectedCompletionNodeToString: - "<CompleteOnQualifiedAllocationExpression:primary().new X(1, 2)>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnQualifiedAllocationExpression:primary().new X(1, 2)>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<complete on primary qualified instance creation>" - ); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ClassLiteralAccessCompletionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ClassLiteralAccessCompletionTest.java deleted file mode 100644 index a0bf291..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ClassLiteralAccessCompletionTest.java +++ /dev/null
@@ -1,214 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import junit.framework.Test; - -/** - * Completion is expected to be a ClassLiteralAccess. - */ -public class ClassLiteralAccessCompletionTest extends AbstractCompletionTest { -public ClassLiteralAccessCompletionTest(String testName) { - super(testName); -} -public static Test suite() { - return buildAllCompliancesTestSuite(ClassLiteralAccessCompletionTest.class); -} -/* - * Completion on the keyword 'class' on an array type - */ -public void testArrayType() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " String[].; \n" + - " } \n" + - "} \n", - // completeBehind: - "String[].", - // expectedCompletionNodeToString: - "<CompleteOnClassLiteralAccess:String[].>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnClassLiteralAccess:String[].>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "String[].", - // test name - "<complete on array type member>" - ); -} -/* - * Test access to the keyword 'class' on an array type - * where the keyword is non empty. - */ -public void testArrayTypeWithNonEmptyIdentifier() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " String[].class; \n" + - " } \n" + - "} \n", - // completeBehind: - "String[].cl", - // expectedCompletionNodeToString: - "<CompleteOnClassLiteralAccess:String[].cl>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnClassLiteralAccess:String[].cl>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "cl", - // expectedReplacedSource: - "String[].class", - // test name - "<complete on array type member with non empty identifier>" - ); -} -/* - * Completion on the keyword 'class' on a primitive array type - */ -public void testPrimitiveArrayType() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int[].; \n" + - " } \n" + - "} \n", - // completeBehind: - "int[].", - // expectedCompletionNodeToString: - "<CompleteOnClassLiteralAccess:int[].>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnClassLiteralAccess:int[].>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "int[].", - // test name - "<complete on primitive array type member>" - ); -} -/* - * Completion on the keyword 'class' on a primitive array type where the - * keyword is non empty - */ -public void testPrimitiveArrayTypeWithNonEmptyIdentifier() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int[].class; \n" + - " } \n" + - "} \n", - // completeBehind: - "int[].cl", - // expectedCompletionNodeToString: - "<CompleteOnClassLiteralAccess:int[].cl>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnClassLiteralAccess:int[].cl>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "cl", - // expectedReplacedSource: - "int[].class", - // test name - "<complete on primitive array type member with non empty identifier>" - ); -} -/* - * Completion on the keyword 'class' on a primitive type - */ -public void testPrimitiveType() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int.; \n" + - " } \n" + - "} \n", - // completeBehind: - "int.", - // expectedCompletionNodeToString: - "<CompleteOnClassLiteralAccess:int.>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnClassLiteralAccess:int.>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "int.", - // test name - "<complete on primitive type member>" - ); -} -/* - * Completion on the keyword 'class' on a primitive type where the - * keyword is non empty - */ -public void testPrimitiveTypeWithNonEmptyIdentifier() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int.class; \n" + - " } \n" + - "} \n", - // completeBehind: - "int.cl", - // expectedCompletionNodeToString: - "<CompleteOnClassLiteralAccess:int.cl>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnClassLiteralAccess:int.cl>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "cl", - // expectedReplacedSource: - "int.class", - // test name - "<complete on primitive type member with non empty identifier>" - ); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTest.java deleted file mode 100644 index 3e3f3ce..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTest.java +++ /dev/null
@@ -1,8713 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.internal.codeassist.complete.*; - -public class CompletionParserTest extends AbstractCompletionTest { -public CompletionParserTest(String testName) { - super(testName); -} -static { -// TESTS_NAMES = new String[] { "testXA_1FGGUQF_1FHSL8H_1" }; -} -public static Test suite() { - return buildAllCompliancesTestSuite(CompletionParserTest.class); -} -public void testA() { - String str = - " function foo(){\n" + - " var i;\n" + - " if (i instanceof O) {\n" + - " }\n" + - " var s = \"hello\";\n" + - " s.}\n" + - "\n"; - - String testName = "<complete on methods/fields>"; - String completeBehind = "s."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:s.>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "function foo() {\n" + - " var i;\n" + - " if ((i instanceof O))\n" + - " {\n" + - " }\n" + - " var s = \"hello\";\n" + - " <CompleteOnMemberAccess:s.>;\n" + - "}" + - "\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testAA_1() { - String str = - " function foo() {\n" + - " var maxUnits = 0;\n" + - " var unitResult = \n" + - " new CompilationUnitResult(\n" + - " null, \n" + - " i, \n" + - " maxUnits); \n" + - " }" + - "}\n"; - - String completeBehind = "n"; - String expectedCompletionNodeToString = "<CompleteOnName:n>"; - String completionIdentifier = "n"; - String expectedUnitDisplayString = - "function foo() {\n" + - " var maxUnits = 0;\n" + - " var unitResult = <CompleteOnName:n>;\n" + - " CompilationUnitResult(null, i, maxUnits);\n"+ - "}\n"; - String expectedReplacedSource = "new"; - String testName = "<complete on initializer (new)>"; - - int cursorLocation = str.indexOf("new CompilationUnitResult(") + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} - -public void testAA_2() { - String str = - "// test unicode \\u000a var c = 1; \n" + - "var b =c; \n"; - String testName = "<unicode in comment complete on variable>"; - String expectedCompletionNodeToString = "<CompleteOnName:c>"; - String completionIdentifier = "c"; - String expectedReplacedSource = "c"; - int cursorLocation = str.indexOf("var b =c") -1 /*+ completeBehind.length() - 1*/; - String expectedUnitDisplayString = - "// test unicode \\u000a var c = 1; \n" + - "var b = <CompleteOnName:c>;\n"; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} - -//public void testAA_3() { -// String str = -// "'abc\\u0027def';\n"; -// String testName = "<unicode in comment complete on variable>"; -// String expectedCompletionNodeToString = "<CompleteOnName:c>"; -// String completionIdentifier = "c"; -// String expectedReplacedSource = "c"; -// int cursorLocation = str.indexOf("var b =") -1 /*+ completeBehind.length() - 1*/; -// String expectedUnitDisplayString = -// "'abc\\u0027def';\n"; -// checkMethodParse( -// str.toCharArray(), -// cursorLocation, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} - -//public void testAA_3() { -// String str = -// "package p; \n" + -// "import something; \n" + -// "import p2.; \n" + -// "public class AA {\n" + -// " void foo() {\n" + -// " int maxUnits = 0;\n" + -// " for (int i = 0; \n" + -// " i < maxUnits; \n" + -// " i++) {\n" + -// " CompilationUnitResult unitResult = \n" + -// " new CompilationUnitResult(\n" + -// " null, \n" + -// " i, \n" + -// " maxUnits); \n" + -// " }\n" + -// " }\n" + -// "}\n"; -// -// String testName = "<complete on call to constructor argument>"; -// String completeBehind = "i"; -// String expectedCompletionNodeToString = "<CompleteOnName:i>"; -// String completionIdentifier = "i"; -// String expectedReplacedSource = "i"; -// int cursorLocation = str.indexOf("i, ") + completeBehind.length() - 1; -// String expectedUnitDisplayString = -// "package p;\n" + -// "import something;\n" + -// "public class AA {\n" + -// " public AA() {\n" + -// " }\n" + -// " void foo() {\n" + -// " int maxUnits;\n" + -// " int i;\n" + -// " {\n" + -// " CompilationUnitResult unitResult = new CompilationUnitResult(null, <CompleteOnName:i>);\n" + -// " }\n" + -// " }\n" + -// "}\n"; -// -// checkMethodParse( -// str.toCharArray(), -// cursorLocation, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -//public void testAA_4() { -// String str = -// "package p; \n" + -// "import something; \n" + -// "import p2.; \n" + -// "public class AA {\n" + -// " void foo() {\n" + -// " int maxUnits = 0;\n" + -// " for (int i = 0; \n" + -// " i < maxUnits; \n" + -// " i++) {\n" + -// " CompilationUnitResult unitResult = \n" + -// " new CompilationUnitResult(\n" + -// " null, \n" + -// " i, \n" + -// " maxUnits); \n" + -// " }\n" + -// " }\n" + -// "}\n"; -// -// String testName = "<complete on constructor call argument>"; -// String completeBehind = "max"; -// String expectedCompletionNodeToString = "<CompleteOnName:max>"; -// String completionIdentifier = "max"; -// String expectedReplacedSource = "maxUnits"; -// int cursorLocation = str.indexOf("maxUnits); ") + completeBehind.length() - 1; -// String expectedUnitDisplayString = -// "package p;\n" + -// "import something;\n" + -// "public class AA {\n" + -// " public AA() {\n" + -// " }\n" + -// " void foo() {\n" + -// " int maxUnits;\n" + -// " int i;\n" + -// " {\n" + -// " CompilationUnitResult unitResult = new CompilationUnitResult(null, i, <CompleteOnName:max>);\n" + -// " }\n" + -// " }\n" + -// "}\n"; -// -// checkMethodParse( -// str.toCharArray(), -// cursorLocation, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -//public void testAB_1FHU9LU() { -// String str = -// "package p; \n" + -// "/**\n" + -// " * 1FHU9LU\n" + -// " */\n" + -// "class SuperClass {\n" + -// " static void eFooStatic() {\n" + -// " }\n" + -// " void eFoo() {\n" + -// " }\n" + -// "}\n" + -// "public class AB\n" + -// " extends SuperClass {\n" + -// " void eBar() {\n" + -// " super.eFoo();\n" + -// " }\n" + -// "}\n"; -// -// String testName = "<complete on methods/fields from super class>"; -// String completeBehind = "super."; -// String expectedCompletionNodeToString = "<CompleteOnMemberAccess:super.>"; -// String completionIdentifier = ""; -// String expectedReplacedSource = "super."; -// int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; -// String expectedUnitDisplayString = -// "package p;\n" + -// "class SuperClass {\n" + -// " SuperClass() {\n" + -// " }\n" + -// " static void eFooStatic() {\n" + -// " }\n" + -// " void eFoo() {\n" + -// " }\n" + -// "}\n" + -// "public class AB extends SuperClass {\n" + -// " public AB() {\n" + -// " }\n" + -// " void eBar() {\n" + -// " <CompleteOnMemberAccess:super.>;\n" + -// " }\n" + -// "}\n"; -// -// checkMethodParse( -// str.toCharArray(), -// cursorLocation, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -//public void testAC_1FJ8D9Z_1() { -// String str = -// "package p; \n" + -// "/**\n" + -// " * 1FJ8D9Z\n" + -// " */\n" + -// "import java.io.*;\n" + -// "public class AC {\n" + -// " AC() {\n" + -// " }\n" + -// " AC(int i) {\n" + -// " }\n" + -// " AC(int i, String s) {\n" + -// " }\n" + -// " void foo() {\n" + -// " new AC(new File(\n" + -// " new java\n" + -// " .util\n" + -// " .Vector(}\n" + -// "}\n"; -// -// String testName = "<complete on constructor argument>"; -// String completeBehind = "new AC("; -// String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new AC()>"; -// String completionIdentifier = ""; -// String expectedReplacedSource = ""; -// int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; -// String expectedUnitDisplayString = -// "package p;\n" + -// "import java.io.*;\n" + -// "public class AC {\n" + -// " AC() {\n" + -// " }\n" + -// " AC(int i) {\n" + -// " }\n" + -// " AC(int i, String s) {\n" + -// " }\n" + -// " void foo() {\n" + -// " <CompleteOnAllocationExpression:new AC()>;\n" + -// " }\n" + -// "}\n"; -// -// checkMethodParse( -// str.toCharArray(), -// cursorLocation, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -//public void testAC_1FJ8D9Z_2() { -// String str = -// "package p; \n" + -// "/**\n" + -// " * 1FJ8D9Z\n" + -// " */\n" + -// "import java.io.*;\n" + -// "public class AC {\n" + -// " AC() {\n" + -// " }\n" + -// " AC(int i) {\n" + -// " }\n" + -// " AC(int i, String s) {\n" + -// " }\n" + -// " void foo() {\n" + -// " new AC(new File(\n" + -// " new java\n" + -// " .util\n" + -// " .Vector(}\n" + -// "}\n"; -// -// String testName = "<complete on constructor argument>"; -// String completeBehind = "new File("; -// String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new File()>"; -// String completionIdentifier = ""; -// String expectedReplacedSource = ""; -// int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; -// String expectedUnitDisplayString = -// "package p;\n" + -// "import java.io.*;\n" + -// "public class AC {\n" + -// " AC() {\n" + -// " }\n" + -// " AC(int i) {\n" + -// " }\n" + -// " AC(int i, String s) {\n" + -// " }\n" + -// " void foo() {\n" + -// " <CompleteOnAllocationExpression:new File()>;\n" + -// " }\n" + -// "}\n"; -// -// checkMethodParse( -// str.toCharArray(), -// cursorLocation, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -//public void testAC_1FJ8D9Z_3() { -// String str = -// "package p; \n" + -// "/**\n" + -// " * 1FJ8D9Z\n" + -// " */\n" + -// "import java.io.*;\n" + -// "public class AC {\n" + -// " AC() {\n" + -// " }\n" + -// " AC(int i) {\n" + -// " }\n" + -// " AC(int i, String s) {\n" + -// " }\n" + -// " void foo() {\n" + -// " new AC(new File(\n" + -// " new java.util.Vector(}\n" + -// "}\n"; -// -// String testName = "<complete on constructor argument>"; -// String completeBehind = "new java.util.Vector("; -// String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new java.util.Vector()>"; -// String completionIdentifier = ""; -// String expectedReplacedSource = ""; -// int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; -// String expectedUnitDisplayString = -// "package p;\n" + -// "import java.io.*;\n" + -// "public class AC {\n" + -// " AC() {\n" + -// " }\n" + -// " AC(int i) {\n" + -// " }\n" + -// " AC(int i, String s) {\n" + -// " }\n" + -// " void foo() {\n" + -// " <CompleteOnAllocationExpression:new java.util.Vector()>;\n" + -// " }\n" + -// "}\n"; -// -// checkMethodParse( -// str.toCharArray(), -// cursorLocation, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -public void testB() { - String str = - "function B() {\n" + - " var o = new Object \n}\n"; - - String testName = "<complete on type into type creation>"; - String completeBehind = "new Object"; - String expectedCompletionNodeToString = "<CompleteOnName:Object>"; - String completionIdentifier = "Object"; - String expectedReplacedSource = "Object"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "function B() {\n" + - " var o = new <CompleteOnType:Object>;\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -//public void testBA_1() { -// String str = -// "package p; \n" + -// "public class BA {\n" + -// " void foo() {\n" + -// " java.util.Vector v2;\n" + -// " java.util.Vector v1;\n" + -// " }\n" + -// "}\n"; -// -// String testName = "<complete on package name>"; -// String completeBehind = "java."; -// String expectedCompletionNodeToString = "<CompleteOnName:java.>"; -// String completionIdentifier = ""; -// String expectedReplacedSource = "java."; -// int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; -// String expectedUnitDisplayString = -// "package p;\n" + -// "public class BA {\n" + -// " public BA() {\n" + -// -// " }\n" + -// " void foo() {\n" + -// " <CompleteOnName:java.>;\n" + -// " }\n" + -// "}\n"; -// -// checkMethodParse( -// str.toCharArray(), -// cursorLocation, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -//public void testBA_2() { -// String str = -// "package p; \n" + -// "public class BA {\n" + -// " void foo() {\n" + -// " java.util.Vector v2;\n" + -// " java.util.Vector v1;\n" + -// " }\n" + -// "}\n"; -// -// String testName = "<complete on package contents>"; -// String completeBehind = "java.util."; -// String expectedCompletionNodeToString = "<CompleteOnName:java.util.>"; -// String completionIdentifier = ""; -// String expectedReplacedSource = "java.util."; -// int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; -// String expectedUnitDisplayString = -// "package p;\n" + -// "public class BA {\n" + -// " public BA() {\n" + -// " }\n" + -// " void foo() {\n" + -// " <CompleteOnName:java.util.>;\n" + -// " }\n" + -// "}\n"; -// -// checkMethodParse( -// str.toCharArray(), -// cursorLocation, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -public void testBB_1FHJ8H9() { - String str = - "function bar() {\n" + - " z }\n" + - "\n"; - - String testName = "<complete on method/field from implicit method call>"; - String completeBehind = "z"; - String expectedCompletionNodeToString = "<CompleteOnName:z>"; - String completionIdentifier = "z"; - String expectedReplacedSource = "z"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "function bar() {\n" + - " <CompleteOnName:z>;\n" + - "}" + - "\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -//public void testBC_1FJ4GSG_1() { -// String str = -// "package p; \n" + -// "/**\n" + -// " * 1FJ4GSG\n" + -// " */\n" + -// "import java.util.Vector;\n" + -// "public class BC {\n" + -// " int Value1 = 0;\n" + -// " interface Constants {\n" + -// " int OK = 1;\n" + -// " int CANCEL = 2;\n" + -// " }\n" + -// " void foo() {\n" + -// " Vector v = \n" + -// " new Vector(\n" + -// " Value1, \n" + -// " BC.Constants.OK\n" + -// " | BC.Constants.CANCEL); \n" + -// " Object ans = v.elementAt(1);\n" + -// " }\n" + -// "}\n"; -// -// String testName = "<complete on member type>"; -// String completeBehind = "BC."; -// String expectedCompletionNodeToString = "<CompleteOnName:BC.>"; -// String completionIdentifier = ""; -// String expectedReplacedSource = "BC."; -// int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; -// String expectedUnitDisplayString = -// "package p;\n" + -// "import java.util.Vector;\n" + -// "public class BC {\n" + -// " interface Constants {\n" + -// " int OK;\n" + -// " int CANCEL;\n" + -// " <clinit>() {\n" + -// " }\n" + -// " }\n" + -// " int Value1;\n" + -// " public BC() {\n" + -// " }\n" + -// " void foo() {\n" + -// " Vector v = new Vector(Value1, <CompleteOnName:BC.>);\n" + -// " }\n" + -// "}\n"; -// -// checkMethodParse( -// str.toCharArray(), -// cursorLocation, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -//public void testBC_1FJ4GSG_2() { -// String str = -// "package p; \n" + -// "/**\n" + -// " * 1FJ4GSG\n" + -// " */\n" + -// "import java.util.Vector;\n" + -// "public class BC {\n" + -// " int Value1 = 0;\n" + -// " interface Constants {\n" + -// " int OK = 1;\n" + -// " int CANCEL = 2;\n" + -// " }\n" + -// " void foo() {\n" + -// " Vector v = \n" + -// " new Vector(\n" + -// " Value1, \n" + -// " BC.Constants.OK\n" + -// " | BC.Constants.CANCEL); \n" + -// " Object ans = v.elementAt(1);\n" + -// " }\n" + -// "}\n"; -// -// String testName = "<complete on member type method/field>"; -// String completeBehind = "| BC.Constants."; -// String expectedCompletionNodeToString = "<CompleteOnName:BC.Constants.>"; -// String completionIdentifier = ""; -// String expectedReplacedSource = "BC.Constants."; -// int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; -// String expectedUnitDisplayString = -// "package p;\n" + -// "import java.util.Vector;\n" + -// "public class BC {\n" + -// " interface Constants {\n" + -// " int OK;\n" + -// " int CANCEL;\n" + -// " <clinit>() {\n" + -// " }\n" + -// " }\n" + -// " int Value1;\n" + -// " public BC() {\n" + -// " }\n" + -// " void foo() {\n" + -// " Vector v = (BC.Constants.OK | <CompleteOnName:BC.Constants.>);\n" + -// " }\n" + -// "}\n"; -// -// checkMethodParse( -// str.toCharArray(), -// cursorLocation, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -public void testMsgSend() { - String str = - " function foo() {\n"+ - " var removed = 0;\n"+ - " toto(Test.vvv).titi(removed);\n"+ - " }\n"; - - String testName = "<complete on method call>"; - String completeBehind = "removed"; - String expectedCompletionNodeToString = "<CompleteOnName:removed>"; - String completionIdentifier = "removed"; - String expectedReplacedSource = "removed"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "function foo() {\n" + - " var removed = 0;\n" + - " toto(Test.vvv).titi(<CompleteOnName:removed>);\n" + - "}" + - "\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} - -public void testMsgSend2() { - String str = - " abc.titi();\n"+ - ""; - - String testName = "<complete on method call 2>"; - String completeBehind = "titi"; - String expectedCompletionNodeToString = "<CompleteOnMessageSend:abc.titi()>"; - String completionIdentifier = "titi"; - String expectedReplacedSource = "titi()"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "<CompleteOnMessageSend:abc.titi()>;" + - "\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} - -public void testMsgSend3() { - String str = - " function foo() {\n"+ - " var removed = 0;\n"+ - " toto(Test.vvv).titi(removed);\n"+ - " }\n"; - - String testName = "<complete on method call 3>"; - String completeBehind = "titi"; - String expectedCompletionNodeToString = "<CompleteOnMessageSend:toto(Test.vvv).titi(removed)>"; - String completionIdentifier = "titi"; - String expectedReplacedSource = "titi(removed)"; - int cursorLocation = str.lastIndexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "function foo() {\n" + - " var removed = 0;\n" + - " <CompleteOnMessageSend:toto(Test.vvv).titi(removed)>;\n" + - "}" + - "\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} - - -public void testBC_1FJ4GSG_3() { - String str = - " function foo() {\n" + - " var v = \n" + - " new Vector();\n" + - " var ans = v.elementAt(1);\n" + - " }\n" + - "\n"; - - String testName = "<complete on method/field>"; - String completeBehind = "v."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:v.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "v."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "function foo() {\n" + - " var v = new Vector();\n" + - " var ans = <CompleteOnMemberAccess:v.>;\n" + - "}" + - "\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} - - -public void testC() { - String str = - "function foo() {\n" + - " var string = n;\n" + - " }\n" + - "\n"; - - String completeBehind = "= n"; - String expectedCompletionNodeToString = "<CompleteOnName:n>"; - String completionIdentifier = "n"; - String expectedUnitDisplayString = - "function foo() {\n" + - " var string = <CompleteOnName:n>;\n" + - "}\n"; - String expectedReplacedSource = "n"; - String testName = "<complete on local variable initializer>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testCA_1FGPJQZ() { - String str = - " function moo() {\n" + - " unknownField.}\n" + - "}\n"; - - String testName = "<complete on method/field>"; - String completeBehind = "unknownField."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:unknownField.>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - String expectedUnitDisplayString = - "function moo() {\n" + - " <CompleteOnMemberAccess:unknownField.>;\n" + - "}\n"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testCB_1FHSKQ9_1() { - String str = - " function foo() {\n" + - " var i = 0;\n" + - " var tab1 = 0;\n" + - " System.out.println(\n" + - " \" \" + (i + 1)); \n" + - "}\n"; - - String testName = "<complete on method call argument>"; - String completeBehind = "+ (i"; - String expectedCompletionNodeToString = "<CompleteOnName:i>"; - String completionIdentifier = "i"; - String expectedReplacedSource = "i"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "function foo() {\n" + - " var i = 0;\n" + - " var tab1 = 0;\n" + - " System.out.println((\" \" + (<CompleteOnName:i> + 1)));\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testCB_1FHSKQ9_2() { - String str = - " function foo() {\n" + - " var i = 0;\n" + - " System.out.println(\n" + - " \" \" + (i + 1)); \n" + - "}\n"; - - String completeBehind = "i + 1"; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = ""; - String expectedUnitDisplayString = null; - String expectedReplacedSource = NONE; - String testName = "<complete on digit into method call argument>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - - try { - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); - assertTrue("failed to detect invalid cursor location", false); - } catch(InvalidCursorLocation e){ - assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_NUMBER); - } -} -//public void testCC_1FJ64I9() { -// String str = -// "package p; \n" + -// "/**\n" + -// " * 1FJ64I9\n" + -// " */\n" + -// "class CCHelper {\n" + -// " class Member1 {\n" + -// " }\n" + -// " class Member2 {\n" + -// " }\n" + -// " void foo() {\n" + -// " }\n" + -// "}\n" + -// "public class CC {\n" + -// " void foo() {\n" + -// " new CCHelper()\n" + -// " .new CCHelper()\n" + -// " .new M }\n" + -// "}\n"; -// -// String testName = "<complete on qualified member type>"; -// String completeBehind = ".new M"; -// String expectedCompletionNodeToString = "<CompleteOnType:M>"; -// String completionIdentifier = "M"; -// String expectedReplacedSource = "M"; -// int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; -// String expectedUnitDisplayString = -// "package p;\n" + -// "class CCHelper {\n" + -// " class Member1 {\n" + -// " Member1() {\n" + -// " }\n" + -// " }\n" + -// " class Member2 {\n" + -// " Member2() {\n" + -// " }\n" + -// " }\n" + -// " CCHelper() {\n" + -// " }\n" + -// " void foo() {\n" + -// " }\n" + -// "}\n" + -// "public class CC {\n" + -// " public CC() {\n" + -// " }\n" + -// " void foo() {\n" + -// " new CCHelper().new CCHelper().new <CompleteOnType:M>();\n" + -// " }\n" + -// "}\n"; -// -// checkMethodParse( -// str.toCharArray(), -// cursorLocation, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -//public void testD_1() { -// String str = -// "package p; \n" + -// "import java.util.*;\n" + -// "public class D {\n" + -// " static int i;\n" + -// " static {\n" + -// " i = 5;\n" + -// " }\n" + -// " public int j;\n" + -// " Vector a = new Vector();\n" + -// " void foo(String s) {\n" + -// " String string = null;\n" + -// " int soso;\n" + -// " float f;\n" + -// " string.regionMatches(\n" + -// " 0, \n" + -// " \"\", \n" + -// " 0, \n" + -// " 0); \n" + -// " }\n" + -// "}\n"; -// -// String testName = "<complete on variable into type initializer>"; -// String completeBehind = "i"; -// String expectedCompletionNodeToString = "<CompleteOnName:i>"; -// String completionIdentifier = "i"; -// String expectedReplacedSource = "i"; -// int cursorLocation = str.indexOf("i = 5;") + completeBehind.length() - 1; -// String expectedUnitDisplayString = -// "package p;\n" + -// "import java.util.*;\n" + -// "public class D {\n" + -// " static int i;\n" + -// " static {\n" + -// " <CompleteOnName:i>;\n" + -// " }\n" + -// " public int j;\n" + -// " Vector a;\n" + -// " <clinit>() {\n" + -// " }\n" + -// " public D() {\n" + -// " }\n" + -// " void foo(String s) {\n" + -// " }\n" + -// "}\n"; -// -// checkMethodParse( -// str.toCharArray(), -// cursorLocation, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -public void testD_2() { - String str = - " var a = new Vector();\n" + - " function foo(s) {\n" + - " var string = null;\n" + - " var soso;\n" + - " var f;\n" + - " string.regionMatches(\n" + - " 0, \n" + - " \"\", \n" + - " 0, \n" + - " 0); \n" + - "}\n"; - - String testName = "<complete on method/field>"; - String completeBehind = "string."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:string.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "string."; - String expectedUnitDisplayString = - "var a = new Vector();\n" + - "function foo(s) {\n" + - " var string = null;\n" + - " var soso;\n" + - " var f;\n" + - " <CompleteOnMemberAccess:string.>;\n" + - "}\n"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testD_2b() { - String str = - " function foo(s) {\n" + - " foo(string.regionMatches);\n" + - "}\n"; - - String testName = "<complete on method/field>"; - String completeBehind = "string."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:string.>"; - String completionIdentifier = "string."; - String expectedReplacedSource = "regionMatches"; - String expectedUnitDisplayString = - "function foo(s) {\n" + - " foo(<CompleteOnMemberAccess:string.>);\n" + - "}\n"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testD_2c() { - String str = - " var obj= {\n" + - " a: string.regionMatches\n" + - "}\n"; - - String testName = "<complete on method/field>"; - String completeBehind = "string."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:string.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "regionMatches"; - String expectedUnitDisplayString = - "var obj = {\n" + - " a : <CompleteOnMemberAccess:string.>\n" + - "};\n"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} - -public void testDA_1() { - String str = - "package p; \n" + - "public class DA {\n" + - " void foo() {\n" + - " new TestCase(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " };\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field into anonymous declaration>"; - String completeBehind = "v"; - String expectedCompletionNodeToString = "<CompleteOnName:v>"; - String completionIdentifier = "v"; - String expectedReplacedSource = "v"; - int cursorLocation = str.indexOf("v }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class DA {\n" + - " public DA() {\n" + - " }\n" + - " void foo() {\n" + - " new TestCase(\"error\") {\n" + - " () {\n" + - " }\n" + - " protected void runTest() {\n" + - " Vector v11111;\n" + - " <CompleteOnName:v>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testDA_2() { - String str = - "package p; \n" + - "public class DA {\n" + - " void foo() {\n" + - " new TestCase(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " };\n" + - " }\n" + - "}\n"; - - String completeBehind = "protected v"; - String expectedCompletionNodeToString = "<CompleteOnType:v>"; - String completionIdentifier = "v"; - String expectedUnitDisplayString = - "package p;\n" + - "public class DA {\n" + - " public DA() {\n" + - " }\n" + - " void foo() {\n" + - " new TestCase(\"error\") {\n" + - " <CompleteOnType:v>;\n" + - " () {\n" + - " }\n" + - " runTest() {\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "void"; - String testName = "<complete on return type into anonymous declaration>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testDA_3() { - String str = - "package p; \n" + - "public class DA {\n" + - " void foo() {\n" + - " new TestCase(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " };\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method selector into anonymous declaration>"; - String completeBehind = "r"; - String expectedCompletionNodeToString = "<CompleteOnFieldName:void r>;"; - String completionIdentifier = "r"; - String expectedReplacedSource = "runTest"; - int cursorLocation = str.indexOf("runTest") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class DA {\n" + - " public DA() {\n" + - " }\n" + - " void foo() {\n" + - " new TestCase(\"error\") {\n" + - " <CompleteOnFieldName:void r>;\n" + - " {\n" + - " }\n" + - " () {\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testDA_4() { - String str = - "package p; \n" + - "public class DA {\n" + - " void foo() {\n" + - " new TestCase(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " };\n" + - " }\n" + - "}\n"; - - String testName = "<complete on local variable type into anonymous declaration>"; - String completeBehind = "V"; - String expectedCompletionNodeToString = "<CompleteOnName:V>"; - String completionIdentifier = "V"; - String expectedReplacedSource = "Vector"; - int cursorLocation = str.indexOf("Vector v11111") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class DA {\n" + - " public DA() {\n" + - " }\n" + - " void foo() {\n" + - " new TestCase(\"error\") {\n" + - " () {\n" + - " }\n" + - " protected void runTest() {\n" + - " <CompleteOnName:V>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testDA_5() { - String str = - "package p; \n" + - "public class DA {\n" + - " void foo() {\n" + - " new TestCase(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " };\n" + - " }\n" + - "}\n"; - - String testName = "<complete on local type into anonymous declaration>"; - String completeBehind = "v"; - String expectedCompletionNodeToString = "<CompleteOnName:v>"; - String completionIdentifier = "v"; - String expectedReplacedSource = "v"; - int cursorLocation = str.indexOf("v }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class DA {\n" + - " public DA() {\n" + - " }\n" + - " void foo() {\n" + - " new TestCase(\"error\") {\n" + - " () {\n" + - " }\n" + - " protected void runTest() {\n" + - " Vector v11111;\n" + - " <CompleteOnName:v>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testDB_1FHSLDR() { - String str = - "package p; \n" + - "/**\n" + - " * 1FHSLDR\n" + - " */\n" + - "public class DB {\n" + - " void foo() {\n" + - " try {\n" + - " System.out.println(\"\");\n" + - " }\n" + - " fi }\n" + - "}\n"; - - String testName = "<complete on finally keyword>"; - String completeBehind = "fi"; - String expectedCompletionNodeToString = "<CompleteOnKeyword:fi>"; - String completionIdentifier = "fi"; - String expectedReplacedSource = "fi"; - int cursorLocation = str.indexOf("fi }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class DB {\n" + - " public DB() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnKeyword:fi>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testDC_1FJJ0JR_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FJJ0JR\n" + - " */\n" + - "public class DC\n" + - " extends ModelChangeOperation {\n" + - " ISec public SetSecondarySourceOperation(\n" + - " ISecondarySourceContainer element, \n" + - " VersionID id) {\n" + - " }\n" + - " protected abstract void doExecute(IProgressMonitor monitor)\n" + - " throws OperationFailedException {\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method return type>"; - String completeBehind = "ISec"; - String expectedCompletionNodeToString = "<CompleteOnType:ISec>"; - String completionIdentifier = "ISec"; - String expectedReplacedSource = "ISec"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class DC extends ModelChangeOperation {\n" + - " <CompleteOnType:ISec>;\n" + - " public DC() {\n" + - " }\n" + - " public SetSecondarySourceOperation(ISecondarySourceContainer element, VersionID id) {\n" + - " }\n" + - " protected abstract void doExecute(IProgressMonitor monitor) throws OperationFailedException;\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testE_1FG1YDS_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FG1YDS\n" + - " */\n" + - "public class E {\n" + - " {\n" + - " new Y()\n" + - " }\n" + - " {\n" + - " new Y().}\n" + - " class Y\n" + - " extends java.util.Vector {\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on type into type creation>"; - String completeBehind = "Y"; - String expectedCompletionNodeToString = "<CompleteOnType:Y>"; - String completionIdentifier = "Y"; - String expectedReplacedSource = "Y"; - String expectedUnitDisplayString = - "package p;\n" + - "public class E {\n" + - " class Y extends java.util.Vector {\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " {\n" + - " new <CompleteOnType:Y>();\n" + - " }\n" + - " {\n" + - " }\n" + - " public E() {\n" + - " }\n" + - "}\n"; - - int cursorLocation = str.indexOf("Y()\n") + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testE_1FG1YDS_2() { - String str = - "package p; \n" + - "/**\n" + - " * 1FG1YDS\n" + - " */\n" + - "public class E {\n" + - " {\n" + - " new Y()\n" + - " }\n" + - " {\n" + - " new Y().}\n" + - " class Y\n" + - " extends java.util.Vector {\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on implicit method call into intializer>"; - String completeBehind = "new Y()."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Y().>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - String expectedUnitDisplayString = - "package p;\n" + - "public class E {\n" + - " class Y extends java.util.Vector {\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " {\n" + - " }\n" + - " {\n" + - " <CompleteOnMemberAccess:new Y().>;\n" + - " }\n" + - " public E() {\n" + - " }\n" + - "}\n"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testE_1FG1YDS_3() { - String str = - "package p; \n" + - "/**\n" + - " * 1FG1YDS\n" + - " */\n" + - "public class E {\n" + - " {\n" + - " new Y()\n" + - " }\n" + - " {\n" + - " new Y().}\n" + - " class Y\n" + - " extends java.util.Vector {\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on extend type>"; - String completeBehind = "java.util."; - String expectedCompletionNodeToString = "<CompleteOnClass:java.util.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "java.util.Vector"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class E {\n" + - " class Y extends <CompleteOnClass:java.util.> {\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " {\n" + - " }\n" + - " {\n" + - " }\n" + - " public E() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testEA_1() { - String str = - "package p; \n" + - "public class EA {\n" + - " void foo() {\n" + - " try {\n" + - " throw new Error();\n" + - " } catch (Exception eeee) {\n" + - " eeee.}\n" + - " }\n" + - "}\n"; - - String testName = "<complete on catch block exception type declaration>"; - String completeBehind = "E"; - String expectedCompletionNodeToString = "<CompleteOnException:E>"; - String completionIdentifier = "E"; - String expectedReplacedSource = "Exception"; - String expectedUnitDisplayString = - "package p;\n" + - "public class EA {\n" + - " public EA() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnException:E>;\n" + - " }\n" + - "}\n"; - - int cursorLocation = str.indexOf("Exception eeee") + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testEA_2() { - String str = - "package p; \n" + - "public class EA {\n" + - " void foo() {\n" + - " try {\n" + - " throw new Error();\n" + - " } catch (Exception eeee) {\n" + - " eeee.}\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of thrown exception into catch block>"; - String completeBehind = "eeee."; - String expectedCompletionNodeToString = "<CompleteOnName:eeee.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "eeee."; - String expectedUnitDisplayString = - "package p;\n" + - "public class EA {\n" + - " public EA() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " Exception eeee;\n" + - " <CompleteOnName:eeee.>;\n" + - " }\n" + - " }\n" + - "}\n"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testEB_1FI74S3() { - String str = - "package p; \n" + - "/**\n" + - " * 1FI74S3\n" + - " */\n" + - "public class EB {\n" + - " int[] table;\n" + - " void foo() {\n" + - " int x = table.}\n" + - "}\n"; - - String testName = "<complete on method/field of array>"; - String completeBehind = "table."; - String expectedCompletionNodeToString = "<CompleteOnName:table.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "table."; - String expectedUnitDisplayString = - "package p;\n" + - "public class EB {\n" + - " int[] table;\n" + - " public EB() {\n" + - " }\n" + - " void foo() {\n" + - " int x = <CompleteOnName:table.>;\n" + - " }\n" + - "}\n"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testEC_1FSBZ2Y() { - String str = - "package p; \n" + - "/**\n" + - " * 1FSBZ2Y\n" + - " */\n" + - "class EC {\n" + - " void foo() {\n" + - " EC\n" + - " }\n" + - "}\n" + - "class ECOtherTopLevel {\n" + - "}\n"; - - String testName = "<complete on local variable decaration type>"; - String completeBehind = "EC"; - String expectedCompletionNodeToString = "<CompleteOnName:EC>"; - String completionIdentifier = "EC"; - String expectedReplacedSource = "EC"; - String expectedUnitDisplayString = - "package p;\n" + - "class EC {\n" + - " EC() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:EC>;\n" + - " }\n" + - "}\n" + - "class ECOtherTopLevel {\n" + - " ECOtherTopLevel() {\n" + - " }\n" + - "}\n"; - - int cursorLocation = str.indexOf("EC\n") + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testF() { - String str = - "package p; \n" + - "public class F {\n" + - " void bar() {\n" + - " }\n" + - " class Y {\n" + - " void foo() {\n" + - " ba }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field explicit access>"; - String completeBehind = "ba"; - String expectedCompletionNodeToString = "<CompleteOnName:ba>"; - String completionIdentifier = "ba"; - String expectedReplacedSource = "ba"; - String expectedUnitDisplayString = - "package p;\n" + - "public class F {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:ba>;\n" + - " }\n" + - " }\n" + - " public F() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - int cursorLocation = str.indexOf("ba }") + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testFA_1() { - String str = - "package p; \n" + - "public class FA {\n" + - " byte value;\n" + - " public float foo() {\n" + - " return (float) value;\n" + - " }\n" + - "}\n"; - - String testName = "<complete on cast expression type>"; - String completeBehind = "f"; - String expectedCompletionNodeToString = "<CompleteOnName:f>"; - String completionIdentifier = "f"; - String expectedReplacedSource = "float"; - String expectedUnitDisplayString = - "package p;\n" + - "public class FA {\n" + - " byte value;\n" + - " public FA() {\n" + - " }\n" + - " public float foo() {\n" + - " return <CompleteOnName:f>;\n" + - " }\n" + - "}\n"; - - int cursorLocation = str.indexOf("float)") + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testFA_2() { - String str = - "package p; \n" + - "public class FA {\n" + - " byte value;\n" + - " public float foo() {\n" + - " return (float) value; \n" + - " }\n" + - "}\n"; - - String testName = "<complete on returned value>"; - String completeBehind = "v"; - String expectedCompletionNodeToString = "<CompleteOnName:v>"; - String completionIdentifier = "v"; - String expectedReplacedSource = "value"; - String expectedUnitDisplayString = - "package p;\n" + - "public class FA {\n" + - " byte value;\n" + - " public FA() {\n" + - " }\n" + - " public float foo() {\n" + - " (float) <CompleteOnName:v>;\n" + - " }\n" + - "}\n"; - - int cursorLocation = str.indexOf("value; \n") + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testFB_1FI74S3() { - String str = - "package p; \n" + - "/**\n" + - " * 1FI74S3\n" + - " */\n" + - "public class FB {\n" + - " int[] table;\n" + - " void foo() {\n" + - " int x = table[1].}\n" + - "}\n"; - - String testName = "<complete on method/field of array element>"; - String completeBehind = "table[1]."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:table[1].>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - String expectedUnitDisplayString = - "package p;\n" + - "public class FB {\n" + - " int[] table;\n" + - " public FB() {\n" + - " }\n" + - " void foo() {\n" + - " int x = <CompleteOnMemberAccess:table[1].>;\n" + - " }\n" + - "}\n"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testFC_1FSBZ9B() { - String str = - "package p; \n" + - "/**\n" + - " * 1FSBZ9B\n" + - " */\n" + - "class FC {\n" + - " UNKOWNTYPE field;\n" + - " void foo() {\n" + - " f\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field implicit access>"; - String completeBehind = "f"; - String expectedCompletionNodeToString = "<CompleteOnName:f>"; - String completionIdentifier = "f"; - String expectedReplacedSource = "f"; - int cursorLocation = str.indexOf("f\n") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class FC {\n" + - " UNKOWNTYPE field;\n" + - " FC() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:f>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testG() { - String str = - "package p; \n" + - "public class G {\n" + - " int bar() {\n" + - " }\n" + - " class Y {\n" + - " void foo(int b) {\n" + - " return b }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on return value>"; - String completeBehind = "b"; - String expectedCompletionNodeToString = "<CompleteOnName:b>"; - String completionIdentifier = "b"; - String expectedReplacedSource = "b"; - String expectedUnitDisplayString = - "package p;\n" + - "public class G {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " void foo(int b) {\n" + - " return <CompleteOnName:b>;\n" + - " }\n" + - " }\n" + - " public G() {\n" + - " }\n" + - " int bar() {\n" + - " }\n" + - "}\n"; - - int cursorLocation = str.indexOf("b }") + completeBehind.length() - 1; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testGA() { - String str = - "package p; \n" + - "public class GA {\n" + - " void foo(String s) {\n" + - " String string = s;\n" + - " }\n" + - "}\n"; - - String testName = "<complete on local variable initializer>"; - String completeBehind = "s"; - String expectedCompletionNodeToString = "<CompleteOnName:s>"; - String completionIdentifier = "s"; - String expectedReplacedSource = "s"; - int cursorLocation = str.indexOf("s;") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class GA {\n" + - " public GA() {\n" + - " }\n" + - " void foo(String s) {\n" + - " String string = <CompleteOnName:s>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testGB_1FI74S3() { - String str = - "package p; \n" + - "/**\n" + - " * 1FI74S3\n" + - " */\n" + - "public class GB {\n" + - " String[] table;\n" + - " void foo() {\n" + - " int x = table[1].}\n" + - "}\n"; - - String testName = "<complete on method/field of array element>"; - String completeBehind = "table[1]."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:table[1].>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class GB {\n" + - " String[] table;\n" + - " public GB() {\n" + - " }\n" + - " void foo() {\n" + - " int x = <CompleteOnMemberAccess:table[1].>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testGC_1FSHLHV_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FSHLHV\n" + - " */\n" + - "public class GC {\n" + - "public static void main(String[] args) {\n" + - " Object l = new Object() {\n" + - " public void handleEvent(String[] event) {\n" + - " String s = new String();\n" + - " s.\n" + - " try {\n" + - " event.;\n" + - " }\n" + - " catch (Exception e) {\n" + - " e.\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n" + - "}\n"; - - String testName = "<complete on anonymous declaration type>"; - String completeBehind = "O"; - String expectedCompletionNodeToString = "<CompleteOnType:O>"; - String completionIdentifier = "O"; - String expectedReplacedSource = "Object"; - int cursorLocation = str.indexOf("Object()") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class GC {\n" + - " public GC() {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " Object l = new <CompleteOnType:O>();\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testGC_1FSHLHV_2() { - String str = - "package p; \n" + - "/**\n" + - " * 1FSHLHV\n" + - " */\n" + - "public class GC {\n" + - "public static void main(String[] args) {\n" + - " Object l = new Object() {\n" + - " public void handleEvent(String[] event) {\n" + - " String s = new String();\n" + - " s.\n" + - " try {\n" + - " event.;\n" + - " }\n" + - " catch (Exception e) {\n" + - " e.\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n" + - "}\n"; - - String testName = "<complete on method/field of local variable into anonymous declaration>"; - String completeBehind = "s."; - String expectedCompletionNodeToString = "<CompleteOnName:s.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "s."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class GC {\n" + - " public GC() {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " Object l;\n" + - " new Object() {\n" + - " () {\n" + - " }\n" + - " public void handleEvent(String[] event) {\n" + - " String s;\n" + - " <CompleteOnName:s.>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testGC_1FSHLHV_3() { - String str = - "package p; \n" + - "/**\n" + - " * 1FSHLHV\n" + - " */\n" + - "public class GC {\n" + - "public static void main(String[] args) {\n" + - " Object l = new Object() {\n" + - " public void handleEvent(String[] event) {\n" + - " String s = new String();\n" + - " s.\n" + - " try {\n" + - " event.;\n" + - " }\n" + - " catch (Exception e) {\n" + - " e.\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n" + - "}\n"; - - String testName = "<complete on method/field of array>"; - String completeBehind = "event."; - String expectedCompletionNodeToString = "<CompleteOnName:event.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "event."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class GC {\n" + - " public GC() {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " Object l;\n" + - " new Object() {\n" + - " () {\n" + - " }\n" + - " public void handleEvent(String[] event) {\n" + - " String s;\n" + - " {\n" + - " <CompleteOnName:event.>;\n" + - " }\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testGC_1FSHLHV_4() { - String str = - "package p; \n" + - "/**\n" + - " * 1FSHLHV\n" + - " */\n" + - "public class GC {\n" + - "public static void main(String[] args) {\n" + - " Object l = new Object() {\n" + - " public void handleEvent(String[] event) {\n" + - " String s = new String();\n" + - " s.\n" + - " try {\n" + - " event.;\n" + - " }\n" + - " catch (Exception e) {\n" + - " e.\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n" + - "}\n"; - - String testName = "<complete on method/field of thrown exception into catch block into anonymous declaration>"; - String completeBehind = "e."; - String expectedCompletionNodeToString = "<CompleteOnName:e.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "e."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class GC {\n" + - " public GC() {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " Object l;\n" + - " new Object() {\n" + - " () {\n" + - " }\n" + - " public void handleEvent(String[] event) {\n" + - " String s;\n" + - " {\n" + - " Exception e;\n" + - " <CompleteOnName:e.>;\n" + - " }\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} - -public void testH0() { - String str = - " function foo() {\n" + - " whil \n" + - "\n"; - - String testName = "<complete on while keyword argument>"; - String completeBehind = "whil"; - String expectedCompletionNodeToString = "<CompleteOnName:whil>"; - String completionIdentifier = "whil"; - String expectedReplacedSource = "whil"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "function foo() {\n" + - " <CompleteOnName:whil>;\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} - - - -public void testH() { - String str = - " function foo(bbbb) {\n" + - " while (Xbm }\n" + - " function bar() {\n" + - " }\n" + - "}\n"; - - String testName = "<complete on while keyword argument>"; - String completeBehind = "Xbm"; - String expectedCompletionNodeToString = "<CompleteOnName:Xbm>"; - String completionIdentifier = "Xbm"; - String expectedReplacedSource = "Xbm"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class H {\n" + - " public H() {\n" + - " }\n" + - " function foo( bbbb) {\n" + - " <CompleteOnName:Xbm>;\n" + - " }\n" + - " function bar() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testHA_1() { - String str = - "package p; \n" + - "public class HA {\n" + - " void foo() {\n" + - " x.y.Z[] field1; \n" + - " field1[1].}\n" + - "}\n"; - - String testName = "<complete on package member type>"; - String completeBehind = "x.y."; - String expectedCompletionNodeToString = "<CompleteOnName:x.y.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "x.y."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class HA {\n" + - " public HA() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:x.y.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testHA_2() { - String str = - "package p; \n" + - "public class HA {\n" + - " void foo() {\n" + - " x.y.Z[] field1; \n" + - " field1[1].}\n" + - "}\n"; - - String testName = "<complete on method/field of array element>"; - String completeBehind = "field1[1]."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:field1[1].>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class HA {\n" + - " public HA() {\n" + - " }\n" + - " void foo() {\n" + - " x.y.Z[] field1;\n" + - " <CompleteOnMemberAccess:field1[1].>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testHB_1FHSLDR() { - String str = - "package p; \n" + - "/**\n" + - " * 1FHSLDR\n" + - " */\n" + - "public class HB {\n" + - " void foo() {\n" + - " for (; i < totalUnits; i++) {\n" + - " unit = unitsToProcess[i];\n" + - " try {\n" + - " if (options.verbose) {\n" + - " System.out.println(\n" + - " \"process \"\n" + - " + (i + 1)\n" + - " + \"/\"\n" + - " + totalUnits\n" + - " + \" : \"\n" + - " + unitsToProcess[i]\n" + - " .sourceFileName()); \n" + - " }\n" + - " process(unit, i);\n" + - " }\n" + - " fi }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on finally keyword>"; - String completeBehind = "fi"; - String expectedCompletionNodeToString = "<CompleteOnKeyword:fi>"; - String completionIdentifier = "fi"; - String expectedReplacedSource = "fi"; - int cursorLocation = str.indexOf("fi }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class HB {\n" + - " public HB() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " <CompleteOnKeyword:fi>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testHC_1FMPYO3_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FMPYO3\n" + - " */\n" + - "class HC {\n" + - " HC(Object o){}\n" + - " void foo(){\n" + - " HC a = new HC(new Object()).\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of object creation>"; - String completeBehind = "new HC(new Object())."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new HC(new Object()).>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class HC {\n" + - " HC(Object o) {\n" + - " }\n" + - " void foo() {\n" + - " HC a = <CompleteOnMemberAccess:new HC(new Object()).>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testHC_1FMPYO3_2() { - String str = - "package p; \n" + - "/**\n" + - " * 1FMPYO3\n" + - " */\n" + - "class HC {\n" + - " HC(Object o){}\n" + - " void foo(){\n" + - " A a = new A(new Object()).\n" + - " }\n" + - "}\n"; - - String testName = "<complete on object of nested object creation declaration>"; - String completeBehind = "O"; - String expectedCompletionNodeToString = "<CompleteOnType:O>"; - String completionIdentifier = "O"; - String expectedReplacedSource = "Object"; - int cursorLocation = str.indexOf("Object()") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class HC {\n" + - " HC(Object o) {\n" + - " }\n" + - " void foo() {\n" + - " A a = new A(new <CompleteOnType:O>());\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testI() { - String str = - "package p; \n" + - "public class I {\n" + - " Component }\n"; - - String testName = "<complete on incomplete field declaration type>"; - String completeBehind = "C"; - String expectedCompletionNodeToString = "<CompleteOnType:C>"; - String completionIdentifier = "C"; - String expectedReplacedSource = "Component"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class I {\n" + - " <CompleteOnType:C>;\n" + - " public I() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testIA_1FGNBPR_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGNBPR\n" + - " */\n" + - "public class IA {\n" + - " void foo1() {\n" + - " label1 : while (true) {\n" + - " class A {\n" + - " void foo2() {\n" + - " label2 : while (true) {\n" + - " break la }\n" + - " }\n" + - " }\n" + - " A a = new A();\n" + - " break la }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on label name>"; - String completeBehind = "la"; - String expectedCompletionNodeToString = "break <CompleteOnLabel:la>;"; - String completionIdentifier = "la"; - String expectedReplacedSource = "la"; - int cursorLocation = str.indexOf("la }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class IA {\n" + - " public IA() {\n" + - " }\n" + - " void foo1() {\n" + - " {\n" + - " class A {\n" + - " A() {\n" + - " }\n" + - " void foo2() {\n" + - " break <CompleteOnLabel:la>;\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testIA_1FGNBPR_2() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGNBPR\n" + - " */\n" + - "public class IA {\n" + - " void foo1() {\n" + - " label1 : while (true) {\n" + - " class A {\n" + - " void foo2() {\n" + - " label2 : while (true) {\n" + - " break la }\n" + - " }\n" + - " }\n" + - " A a = new A();\n" + - " break la }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on label name>"; - String completeBehind = "la"; - String expectedCompletionNodeToString = "break <CompleteOnLabel:la>;"; - String completionIdentifier = "la"; - String expectedReplacedSource = "la"; - int cursorLocation = str.indexOf("la }", str.indexOf("la }") + 1) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class IA {\n" + - " public IA() {\n" + - " }\n" + - " void foo1() {\n" + - " {\n" + - " class A {\n" + - " A() {\n" + - " super();\n" + // could be optimized out ? - " }\n" + - " void foo2() {\n" + - " }\n" + - " }\n" + - " A a;\n" + - " break <CompleteOnLabel:la>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testIB() { - String str = - "package p; \n" + - "public class IB {\n" + - " UnknownFieldTYPE field;\n" + - " void foo() {\n" + - " field.}\n" + - "}\n"; - - String testName = "<complete on method/field of field of unkown type>"; - String completeBehind = "field."; - String expectedCompletionNodeToString = "<CompleteOnName:field.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "field."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class IB {\n" + - " UnknownFieldTYPE field;\n" + - " public IB() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:field.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testIC_1FMGUPR() { - String str = - "package p; \n" + - "/**\n" + - " * 1FMGUPR\n" + - " */\n" + - "public class IC {\n" + - " void foo(){\n" + - " new String().toString().\n" + - " }\n" + - "}\n"; - - String testName = "<complete on multiple method/field call>"; - String completeBehind = "new String().toString()."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String().toString().>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class IC {\n" + - " public IC() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:new String().toString().>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testJ() { - String str = - "package p; \n" + - "public class J {\n" + - " int foo1()[void foo2() int i;\n" + - " void foo3() {\n" + - " f }\n"; - - String testName = "<complete on method/field access into corrupted method declaration>"; - String completeBehind = "f"; - String expectedCompletionNodeToString = "<CompleteOnName:f>"; - String completionIdentifier = "f"; - String expectedReplacedSource = "f"; - int cursorLocation = str.indexOf("f }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class J {\n" + - " public J() {\n" + - " }\n" + - " int foo1() {\n" + - " }\n" + - " void foo2() {\n" + - " }\n" + - " void foo3() {\n" + - " <CompleteOnName:f>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testJA_1FGQVW2_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGQVW2\n" + - " */\n" + - "public class JA {\n" + - " void foo() {\n" + - " \"abc.txt\". 'a'.}\n" + - "}\n"; - - String testName = "<complete on string literal>"; - String completeBehind = "\"abc.txt\"."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:\"abc.txt\".>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class JA {\n" + - " public JA() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:\"abc.txt\".>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testJA_1FGQVW2_2() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGQVW2\n" + - " */\n" + - "public class JA {\n" + - " void foo() {\n" + - " \"abc.txt\". 'a'.}\n" + - "}\n"; - - String testName = "<complete on char literal>"; - String completeBehind = "'a'."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:'a'.>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class JA {\n" + - " public JA() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:'a'.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testJB() { - String str = - "package p; \n" + - "public class JB\n" + - " extends UnknownSUPERCLASS\n" + - " implements UnknownSUPERINTERFACE {\n" + - " void foo() {\n" + - " f }\n" + - "}\n"; - - String testName = "<complete into method declared into corrupted class declaration>"; - String completeBehind = "f"; - String expectedCompletionNodeToString = "<CompleteOnName:f>"; - String completionIdentifier = "f"; - String expectedReplacedSource = "f"; - int cursorLocation = str.indexOf("f }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class JB extends UnknownSUPERCLASS implements UnknownSUPERINTERFACE {\n" + - " public JB() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:f>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testJC_1FLG1ZC() { - String str = - "package p; \n" + - "/**\n" + - " * 1FLG1ZC\n" + - " */\n" + - "public class JC {\n" + - " void foo() {\n" + - " new String ().\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of object creation with dummy spaces>"; - String completeBehind = "new String ()."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String().>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class JC {\n" + - " public JC() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:new String().>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testK_1() { - String str = - "package p; \n" + - "class Other {\n" + - " void foo() {\n" + - " }\n" + - "}\n" + - "public class K {\n" + - " public static void main(\n" + - " java.lang.String[] args) {\n" + - " java.io.File bbbb = \n" + - " new File(\"c:\\abc.txt\"); \n" + - " O bb bbbb.}\n" + - "}\n"; - -// str = -// "public class K {\n" + -// " void foo() {\n" + -// " new X(\"c:abc.txt\"); \n" + -// " O" + -// " }\n" + -// "}\n"; - - String testName = "<complete on corrupted local variable declaration>"; - String completeBehind = " O"; - String expectedCompletionNodeToString = "<CompleteOnName:O>"; - String completionIdentifier = "O"; - String expectedReplacedSource = "O"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class Other {\n" + - " Other() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n" + - "public class K {\n" + - " public K() {\n" + - " }\n" + - " public static void main(java.lang.String[] args) {\n" + - " java.io.File bbbb;\n" + - " <CompleteOnName:O>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testK_2() { - String str = - "package p; \n" + - "class Other {\n" + - " void foo() {\n" + - " }\n" + - "}\n" + - "public class K {\n" + - " public static void main(\n" + - " java.lang.String[] args) {\n" + - " java.io.File bbbb = \n" + - " new File(\"c:\\abc.txt\"); \n" + - " O bb bbbb.}\n" + - "}\n"; - - String testName = "<complete on corrupted local variable declaration name>"; - String completeBehind = "bb"; - String expectedCompletionNodeToString = "<CompleteOnLocalName:O bb>;"; - String completionIdentifier = "bb"; - String expectedReplacedSource = "bb"; - int cursorLocation = str.indexOf("bb bbbb.") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class Other {\n" + - " Other() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n" + - "public class K {\n" + - " public K() {\n" + - " }\n" + - " public static void main(java.lang.String[] args) {\n" + - " java.io.File bbbb;\n" + - " <CompleteOnLocalName:O bb>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testK_3() { - String str = - "package p; \n" + - "class Other {\n" + - " void foo() {\n" + - " }\n" + - "}\n" + - "public class K {\n" + - " public static void main(\n" + - " java.lang.String[] args) {\n" + - " java.io.File bbbb = \n" + - " new File(\"c:\\abc.txt\"); \n" + - " O bb bbbb.}\n" + - "}\n"; - - String testName = "<complete on corrupted local variable declaration>"; - String completeBehind = "bbbb"; - String expectedCompletionNodeToString = "<CompleteOnName:bbbb>"; - String completionIdentifier = "bbbb"; - String expectedReplacedSource = "bbbb"; - int cursorLocation = str.indexOf("bbbb.}") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class Other {\n" + - " Other() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n" + - "public class K {\n" + - " public K() {\n" + - " }\n" + - " public static void main(java.lang.String[] args) {\n" + - " java.io.File bbbb;\n" + - " O bb;\n" + - " <CompleteOnName:bbbb>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testK_4() { - String str = - "package p; \n" + - "class Other {\n" + - " void foo() {\n" + - " }\n" + - "}\n" + - "public class K {\n" + - " public static void main(\n" + - " java.lang.String[] args) {\n" + - " java.io.File bbbb = \n" + - " new File(\"c:\\abc.txt\"); \n" + - " O bb bbbb.}\n" + - "}\n"; - - String testName = "<complete on method/field of local variable with corrupted declaration>"; - String completeBehind = "bbbb."; - String expectedCompletionNodeToString = "<CompleteOnName:bbbb.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "bbbb."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class Other {\n" + - " Other() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n" + - "public class K {\n" + - " public K() {\n" + - " }\n" + - " public static void main(java.lang.String[] args) {\n" + - " java.io.File bbbb;\n" + - " O bb;\n" + - " <CompleteOnName:bbbb.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testKA_1FH5SU5() { - String str = - "package p; \n" + - "/**\n" + - " * 1FH5SU5\n" + - " */\n" + - "class KAHelper\n" + - " extends java.util.Vector {\n" + - "}\n" + - "public class KA {\n" + - " public int hashCode() {\n" + - " return 10;\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " KA a = new KA;\n" + - " a.has }\n" + - "}\n"; - - String testName = "<complete on method/field>"; - String completeBehind = "a.has"; - String expectedCompletionNodeToString = "<CompleteOnName:a.has>"; - String completionIdentifier = "has"; - String expectedReplacedSource = "a.has"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class KAHelper extends java.util.Vector {\n" + - " KAHelper() {\n" + - " }\n" + - "}\n" + - "public class KA {\n" + - " public KA() {\n" + - " }\n" + - " public int hashCode() {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " KA a;\n" + - " <CompleteOnName:a.has>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testKB() { - String str = - "package p; \n" + - "public class KB {\n" + - " void foo()[i }\n" + - "}\n"; - - String testName = "<complete on corrupted method header>"; - String completeBehind = "void foo()[i"; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = "i"; - String expectedReplacedSource = "i"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class KB {\n" + - " public KB() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testKC_1FLG1ZC() { - String str = - "package p; \n" + - "/**\n" + - " * 1FLG1ZC\n" + - " */\n" + - "import java.io.*;\n" + - "public class KC {\n" + - "private static char[] read(String fileName){\n" + - " try {\n" + - " File file = new File(fileName);\n" + - " FileReader reader =\n" + - " new FileReader(file);\n" + - " int length;\n" + - " char[] contents =\n" + - " new char[\n" + - " length =\n" + - " (int) file.length()];\n" + - " int len = 0;\n" + - " int readSize = 0;\n" + - " while ((readSize != -1)\n" + - " && (len != length)) {\n" + - " readSize = reader.read(\n" + - " contents,\n" + - " len,\n" + - " length - len);\n" + - " len += readSize;\n" + - " }\n" + - " reader. t\n"; - - String testName = "<complete on method/field with dummy spaces>"; - String completeBehind = "reader. t"; - String expectedCompletionNodeToString = "<CompleteOnName:reader.t>"; - String completionIdentifier = "t"; - String expectedReplacedSource = "reader. t"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "import java.io.*;\n" + - "public class KC {\n" + - " public KC() {\n" + - " }\n" + - " private static char[] read(String fileName) {\n" + - " {\n" + - " File file;\n" + - " FileReader reader;\n" + - " int length;\n" + - " char[] contents;\n" + - " int len;\n" + - " int readSize;\n" + - " <CompleteOnName:reader.t>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testL_1() { - String str = - "package p; \n" + - "public class L {\n" + - " void foo() {\n" + - " x.y.Z[] field1, \n" + - " field2; \n" + - " field1.if (int[].class }\n" + - "}\n"; - - String testName = "<complete on method/field>"; - String completeBehind = "field1."; - String expectedCompletionNodeToString = "<CompleteOnName:field1.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "field1."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class L {\n" + - " public L() {\n" + - " }\n" + - " void foo() {\n" + - " x.y.Z[] field1;\n" + - " x.y.Z[] field2;\n" + - " <CompleteOnName:field1.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testL_2() { - String str = - "package p; \n" + - "public class L {\n" + - " void foo() {\n" + - " x.y.Z[] field1, \n" + - " field2; \n" + - " field1.if (int[].class }\n" + - "}\n"; - - String testName = "<complete on method/field of array>"; - String completeBehind = "int[]."; - String expectedCompletionNodeToString = "<CompleteOnClassLiteralAccess:int[].>"; - String completionIdentifier = ""; - String expectedReplacedSource = "int[]."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class L {\n" + - " public L() {\n" + - " }\n" + - " void foo() {\n" + - " x.y.Z[] field1;\n" + - " x.y.Z[] field2;\n" + - " <CompleteOnClassLiteralAccess:int[].>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testL_3() { - String str = - "package p; \n" + - "public class L {\n" + - " void foo() {\n" + - " x.y.Z[] field1, \n" + - " field2; \n" + - " field1.if (int[].class }\n" + - "}\n"; - - String testName = "<complete on argument of corrupted if statement>"; - String completeBehind = "int"; - String expectedCompletionNodeToString = "<CompleteOnName:int>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class L {\n" + - " public L() {\n" + - " }\n" + - " void foo() {\n" + - " x.y.Z[] field1;\n" + - " x.y.Z[] field2;\n" + - " <CompleteOnName:int>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testLA_1FGLMOF() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGLMOF\n" + - " */\n" + - "public class LA {\n" + - " void[] foo() {\n" + - " }\n" + - " void bar() {\n" + - " f }\n" + - "}\n"; - - String testName = "<complete on method/field with corrupted method header>"; - String completeBehind = "f"; - String expectedCompletionNodeToString = "<CompleteOnName:f>"; - String completionIdentifier = "f"; - String expectedReplacedSource = "f"; - int cursorLocation = str.indexOf("f }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class LA {\n" + - " public LA() {\n" + - " }\n" + - " void[] foo() {\n" + - " }\n" + - " void bar() {\n" + - " <CompleteOnName:f>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testLB() { - String str = - "package p; \n" + - "public class LB {\n" + - " void foo() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " i }\n" + - "}\n"; - - String testName = "<complete on method/field with duplicate method declaration>"; - String completeBehind = "i"; - String expectedCompletionNodeToString = "<CompleteOnName:i>"; - String completionIdentifier = "i"; - String expectedReplacedSource = "i"; - int cursorLocation = str.indexOf("i }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class LB {\n" + - " public LB() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " <CompleteOnName:i>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testLC_1FLG1E2() { - String str = - "package p; \n" + - "/**\n" + - " * 1FLG1E2\n" + - " */\n" + - "public class LC {\n" + - " void foo() {\n" + - " Object[] x = new Object[10];\n" + - " x [1].\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of array element with dummy spaces>"; - String completeBehind = "x [1]."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:x[1].>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class LC {\n" + - " public LC() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] x;\n" + - " <CompleteOnMemberAccess:x[1].>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testM_1FGGLMT() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGGLMT\n" + - " */\n" + - "public class M {\n" + - " class Member {\n" + - " void fooMember() {\n" + - " }\n" + - " }\n" + - " void foo() {\n" + - " new Member().}\n" + - "}\n" + - "class MemberOfCU {\n" + - "}\n"; - - String testName = "<complete on method/field of explicit object creation>"; - String completeBehind = "new Member()."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Member().>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class M {\n" + - " class Member {\n" + - " Member() {\n" + - " }\n" + - " void fooMember() {\n" + - " }\n" + - " }\n" + - " public M() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:new Member().>;\n" + - " }\n" + - "}\n" + - "class MemberOfCU {\n" + - " MemberOfCU() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testMA_1() { - String str = - "package p; \n" + - "public class MA {\n" + - " class Member\n" + - " extends java.util.Vector {\n" + - " static void fooStaticMember() {\n" + - " }\n" + - " void fooMember() {\n" + - " }\n" + - " class MemberMember {\n" + - " void fooMemberMember() {\n" + - " MemberOfCUMA m = \n" + - " new MemberOfCUMA(); \n" + - " }\n" + - " }\n" + - " class MemberMember2 {\n" + - " }\n" + - " }\n" + - " void foo() {\n" + - " Membe }\n" + - " void foobar() {\n" + - " new Member().}\n" + - " class Member2 {\n" + - " }\n" + - "}\n" + - "class MemberOfCUMA {\n" + - "}\n"; - - String testName = "<complete on local variable declaration type>"; - String completeBehind = "Membe"; - String expectedCompletionNodeToString = "<CompleteOnName:Membe>"; - String completionIdentifier = "Membe"; - String expectedReplacedSource = "Membe"; - int cursorLocation = str.indexOf("Membe }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class MA {\n" + - " class Member extends java.util.Vector {\n" + - " class MemberMember {\n" + - " MemberMember() {\n" + - " }\n" + - " void fooMemberMember() {\n" + - " }\n" + - " }\n" + - " class MemberMember2 {\n" + - " MemberMember2() {\n" + - " }\n" + - " }\n" + - " Member() {\n" + - " }\n" + - " static void fooStaticMember() {\n" + - " }\n" + - " void fooMember() {\n" + - " }\n" + - " }\n" + - " class Member2 {\n" + - " Member2() {\n" + - " }\n" + - " }\n" + - " public MA() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:Membe>;\n" + - " }\n" + - " void foobar() {\n" + - " }\n" + - "}\n" + - "class MemberOfCUMA {\n" + - " MemberOfCUMA() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testMA_2() { - String str = - "package p; \n" + - "public class MA {\n" + - " class Member\n" + - " extends java.util.Vector {\n" + - " static void fooStaticMember() {\n" + - " }\n" + - " void fooMember() {\n" + - " }\n" + - " class MemberMember {\n" + - " void fooMemberMember() {\n" + - " MemberOfCUMA m = \n" + - " new MemberOfCUMA(); \n" + - " }\n" + - " }\n" + - " class MemberMember2 {\n" + - " }\n" + - " }\n" + - " void foo() {\n" + - " Membe }\n" + - " void foobar() {\n" + - " new Member().}\n" + - " class Member2 {\n" + - " }\n" + - "}\n" + - "class MemberOfCUMA {\n" + - "}\n"; - - String testName = "<complete on object creation type>"; - String completeBehind = "MemberOfCU"; - String expectedCompletionNodeToString = "<CompleteOnType:MemberOfCU>"; - String completionIdentifier = "MemberOfCU"; - String expectedReplacedSource = "MemberOfCUMA"; - int cursorLocation = str.indexOf("MemberOfCUMA();") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class MA {\n" + - " class Member extends java.util.Vector {\n" + - " class MemberMember {\n" + - " MemberMember() {\n" + - " }\n" + - " void fooMemberMember() {\n" + - " MemberOfCUMA m = new <CompleteOnType:MemberOfCU>();\n" + - " }\n" + - " }\n" + - " class MemberMember2 {\n" + - " MemberMember2() {\n" + - " }\n" + - " }\n" + - " Member() {\n" + - " }\n" + - " static void fooStaticMember() {\n" + - " }\n" + - " void fooMember() {\n" + - " }\n" + - " }\n" + - " class Member2 {\n" + - " Member2() {\n" + - " }\n" + - " }\n" + - " public MA() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void foobar() {\n" + - " }\n" + - "}\n" + - "class MemberOfCUMA {\n" + - " MemberOfCUMA() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testMA_3() { - String str = - "package p; \n" + - "public class MA {\n" + - " class Member\n" + - " extends java.util.Vector {\n" + - " static void fooStaticMember() {\n" + - " }\n" + - " void fooMember() {\n" + - " }\n" + - " class MemberMember {\n" + - " void fooMemberMember() {\n" + - " MemberOfCUMA m = \n" + - " new MemberOfCUMA(); \n" + - " }\n" + - " }\n" + - " class MemberMember2 {\n" + - " }\n" + - " }\n" + - " void foo() {\n" + - " Membe }\n" + - " void foobar() {\n" + - " new Member().}\n" + - " class Member2 {\n" + - " }\n" + - "}\n" + - "class MemberOfCUMA {\n" + - "}\n"; - - String testName = "<complete on method/field of object creation>"; - String completeBehind = "new Member()."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Member().>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class MA {\n" + - " class Member extends java.util.Vector {\n" + - " class MemberMember {\n" + - " MemberMember() {\n" + - " }\n" + - " void fooMemberMember() {\n" + - " }\n" + - " }\n" + - " class MemberMember2 {\n" + - " MemberMember2() {\n" + - " }\n" + - " }\n" + - " Member() {\n" + - " }\n" + - " static void fooStaticMember() {\n" + - " }\n" + - " void fooMember() {\n" + - " }\n" + - " }\n" + - " class Member2 {\n" + - " Member2() {\n" + - " }\n" + - " }\n" + - " public MA() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void foobar() {\n" + - " <CompleteOnMemberAccess:new Member().>;\n" + - " }\n" + - "}\n" + - "class MemberOfCUMA {\n" + - " MemberOfCUMA() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testMB_1FHSLMQ_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FHSLMQ\n" + - " */\n" + - "public class MB {\n" + - " void foo() {\n" + - " try {\n" + - " System.out.println(\"\");\n" + - " } catch (Exception eFirst) {\n" + - " e } catch (Exception eSecond) {\n" + - " e }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on local variable name into catch block>"; - String completeBehind = "e"; - String expectedCompletionNodeToString = "<CompleteOnName:e>"; - String completionIdentifier = "e"; - String expectedReplacedSource = "e"; - int cursorLocation = str.indexOf("e }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class MB {\n" + - " public MB() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " Exception eFirst;\n" + - " <CompleteOnName:e>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testMB_1FHSLMQ_2() { - String str = - "package p; \n" + - "/**\n" + - " * 1FHSLMQ\n" + - " */\n" + - "public class MB {\n" + - " void foo() {\n" + - " try {\n" + - " System.out.println(\"\");\n" + - " } catch (Exeption eFirst) {\n" + - " e } catch (Exception eSecond) {\n" + - " e }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on local variable name into catch block>"; - String completeBehind = "e"; - String expectedCompletionNodeToString = "<CompleteOnName:e>"; - String completionIdentifier = "e"; - String expectedReplacedSource = "e"; - int cursorLocation = str.indexOf("e }\n") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class MB {\n" + - " public MB() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " Exception eSecond;\n" + - " <CompleteOnName:e>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testMC_1FJ8D9Z() { - String str = - "package p; \n" + - "/**\n" + - " * 1FJ8D9Z\n" + - " */\n" + - "public class MC {\n" + - " p2.X someField;\n" + - " public void foo() {\n" + - " new p2.X(\n" + - " }\n" + - "}\n"; - - String testName = "<complete on object creation argument>"; - String completeBehind = "new p2.X("; - String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new p2.X()>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class MC {\n" + - " p2.X someField;\n" + - " public MC() {\n" + - " }\n" + - " public void foo() {\n" + - " <CompleteOnAllocationExpression:new p2.X()>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testN() { - String str = - "package p; \n" + - "public class N extends p.M {\n" + - " void foo() {\n" + - " class MLocal\n" + - " extends Schmurz {\n" + - " void foo() {\n" + - " }\n" + - " int field1;\n" + - " class MLocalMember\n" + - " extends myInnerC {\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " new M }\n" + - " }\n" + - " class MLocalMember2 {\n" + - " void fooMyInnerC() {\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on object creation type>"; - String completeBehind = "new M"; - String expectedCompletionNodeToString = "<CompleteOnType:M>"; - String completionIdentifier = "M"; - String expectedReplacedSource = "M"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class N extends p.M {\n" + - " public N() {\n" + - " }\n" + - " void foo() {\n" + - " class MLocal extends Schmurz {\n" + - " class MLocalMember extends myInnerC {\n" + - " MLocalMember() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " new <CompleteOnType:M>();\n" + - " }\n" + - " }\n" + - " class MLocalMember2 {\n" + - " MLocalMember2() {\n" + - " }\n" + - " void fooMyInnerC() {\n" + - " }\n" + - " }\n" + - " int field1;\n" + - " MLocal() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testNA_1() { - String str = - "package p; \n" + - "class NException2\n" + - " extends NoClassDefFoundError {\n" + - "}\n" + - "interface NInterface {\n" + - " void foo();\n" + - "}\n" + - "class DAB {\n" + - " public DA foo() {\n" + - " }\n" + - " public int foufou;\n" + - "}\n" + - "class DANA {\n" + - " public int f;\n" + - " N fieldC;\n" + - "}\n" + - "public class NA\n" + - " extends NException2\n" + - " implements N {\n" + - " DA fieldB;\n" + - " class freak {\n" + - " }\n" + - " void dede() {\n" + - " DA local;\n" + - " local.fieldC.foo();\n" + - " }\n" + - "}\n" + - "interface NCool {\n" + - "}\n"; - - String testName = "<complete on local variable name>"; - String completeBehind = "l"; - String expectedCompletionNodeToString = "<CompleteOnName:l>"; - String completionIdentifier = "l"; - String expectedReplacedSource = "local"; - int cursorLocation = str.indexOf("local.") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class NException2 extends NoClassDefFoundError {\n" + - " NException2() {\n" + - " }\n" + - "}\n" + - "interface NInterface {\n" + - " void foo();\n" + - "}\n" + - "class DAB {\n" + - " public int foufou;\n" + - " DAB() {\n" + - " }\n" + - " public DA foo() {\n" + - " }\n" + - "}\n" + - "class DANA {\n" + - " public int f;\n" + - " N fieldC;\n" + - " DANA() {\n" + - " }\n" + - "}\n" + - "public class NA extends NException2 implements N {\n" + - " class freak {\n" + - " freak() {\n" + - " }\n" + - " }\n" + - " DA fieldB;\n" + - " public NA() {\n" + - " }\n" + - " void dede() {\n" + - " DA local;\n" + - " <CompleteOnName:l>;\n" + - " }\n" + - "}\n" + - "interface NCool {\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testNA_2() { - String str = - "package p; \n" + - "class NException2\n" + - " extends NoClassDefFoundError {\n" + - "}\n" + - "interface NInterface {\n" + - " void foo();\n" + - "}\n" + - "class DAB {\n" + - " public DA foo() {\n" + - " }\n" + - " public int foufou;\n" + - "}\n" + - "class DANA {\n" + - " public int f;\n" + - " N fieldC;\n" + - "}\n" + - "public class NA\n" + - " extends NException2\n" + - " implements N {\n" + - " DA fieldB;\n" + - " class freak {\n" + - " }\n" + - " void dede() {\n" + - " DA local;\n" + - " local.fieldC.foo();\n" + - " }\n" + - "}\n" + - "interface NCool {\n" + - "}\n"; - - String testName = "<complete on method/field of local variable>"; - String completeBehind = "local.f"; - String expectedCompletionNodeToString = "<CompleteOnName:local.f>"; - String completionIdentifier = "f"; - String expectedReplacedSource = "local.fieldC"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class NException2 extends NoClassDefFoundError {\n" + - " NException2() {\n" + - " }\n" + - "}\n" + - "interface NInterface {\n" + - " void foo();\n" + - "}\n" + - "class DAB {\n" + - " public int foufou;\n" + - " DAB() {\n" + - " }\n" + - " public DA foo() {\n" + - " }\n" + - "}\n" + - "class DANA {\n" + - " public int f;\n" + - " N fieldC;\n" + - " DANA() {\n" + - " }\n" + - "}\n" + - "public class NA extends NException2 implements N {\n" + - " class freak {\n" + - " freak() {\n" + - " }\n" + - " }\n" + - " DA fieldB;\n" + - " public NA() {\n" + - " }\n" + - " void dede() {\n" + - " DA local;\n" + - " <CompleteOnName:local.f>;\n" + - " }\n" + - "}\n" + - "interface NCool {\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testNA_3() { - String str = - "package p; \n" + - "class NException2\n" + - " extends NoClassDefFoundError {\n" + - "}\n" + - "interface NInterface {\n" + - " void foo();\n" + - "}\n" + - "class DAB {\n" + - " public DA foo() {\n" + - " }\n" + - " public int foufou;\n" + - "}\n" + - "class DANA {\n" + - " public int f;\n" + - " N fieldC;\n" + - "}\n" + - "public class NA\n" + - " extends NException2\n" + - " implements N {\n" + - " DA fieldB;\n" + - " class freak {\n" + - " }\n" + - " void dede() {\n" + - " DA local;\n" + - " local.fieldC.foo();\n" + - " }\n" + - "}\n" + - "interface NCool {\n" + - "}\n"; - - String testName = "<complete on method/field of local variable>"; - String completeBehind = "local.fieldC."; - String expectedCompletionNodeToString = "<CompleteOnName:local.fieldC.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "local.fieldC."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class NException2 extends NoClassDefFoundError {\n" + - " NException2() {\n" + - " }\n" + - "}\n" + - "interface NInterface {\n" + - " void foo();\n" + - "}\n" + - "class DAB {\n" + - " public int foufou;\n" + - " DAB() {\n" + - " }\n" + - " public DA foo() {\n" + - " }\n" + - "}\n" + - "class DANA {\n" + - " public int f;\n" + - " N fieldC;\n" + - " DANA() {\n" + - " }\n" + - "}\n" + - "public class NA extends NException2 implements N {\n" + - " class freak {\n" + - " freak() {\n" + - " }\n" + - " }\n" + - " DA fieldB;\n" + - " public NA() {\n" + - " }\n" + - " void dede() {\n" + - " DA local;\n" + - " <CompleteOnName:local.fieldC.>;\n" + - " }\n" + - "}\n" + - "interface NCool {\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testNB() { - String str = - "package p; \n" + - "public class NB {\n" + - " void foo() {\n" + - " int iOutside;\n" + - " if (i != 0) {\n" + - " for (int i = 10; --i >= 0;)\n" + - " unit[i].parseMethod(\n" + - " parser, \n" + - " unit); \n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on variable name into for statement>"; - String completeBehind = "i"; - String expectedCompletionNodeToString = "<CompleteOnName:i>"; - String completionIdentifier = "i"; - String expectedReplacedSource = "i"; - int cursorLocation = str.indexOf("i >=") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class NB {\n" + - " public NB() {\n" + - " }\n" + - " void foo() {\n" + - " int iOutside;\n" + - " {\n" + - " int i;\n" + - " -- <CompleteOnName:i>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testNC_1FJ8D9Z() { - String str = - "package p; \n" + - "/**\n" + - " * 1FJ8D9Z\n" + - " */\n" + - "public class NC {\n" + - " String s = new String(\n"; - - String testName = "<complete on field intializer into corrupted class declaration>"; - String completeBehind = "new String("; - String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new String()>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class NC {\n" + - " String s = <CompleteOnAllocationExpression:new String()>;\n" + - " public NC() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testO_1FG1YU0() { - String str = - "package p; \n" + - "/**\n" + - " * 1FG1YU0\n" + - " */\n" + - "public class O\n" + - " extends java.util.Vector {\n" + - " void bar(boolean bbbb) {\n" + - " this.}\n" + - "}\n"; - - String testName = "<complete on method/field of explicit this>"; - String completeBehind = "this."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "this."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class O extends java.util.Vector {\n" + - " public O() {\n" + - " }\n" + - " void bar(boolean bbbb) {\n" + - " <CompleteOnMemberAccess:this.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testOA_1() { - String str = - "package p; \n" + - "public class OA {\n" + - " void proc() {\n" + - " int[] a = new int[10];\n" + - " Object b = a;\n" + - " Class c = a.getClass();\n" + - " String s = a.toString();\n" + - " boolean l = a.equals(b);\n" + - " int h = a.hashCode();\n" + - " try {\n" + - " a.wait();\n" + - " a.wait(3);\n" + - " a.wait(4, 5);\n" + - " } catch (Exception e) {\n" + - " }\n" + - " a.notify();\n" + - " a.notifyAll();\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of array>"; - String completeBehind = "a.n"; - String expectedCompletionNodeToString = "<CompleteOnName:a.n>"; - String completionIdentifier = "n"; - String expectedReplacedSource = "a.notify"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class OA {\n" + - " public OA() {\n" + - " }\n" + - " void proc() {\n" + - " int[] a;\n" + - " Object b;\n" + - " Class c;\n" + - " String s;\n" + - " boolean l;\n" + - " int h;\n" + - " <CompleteOnName:a.n>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testOA_2() { - String str = - "package p; \n" + - "public class OA {\n" + - " void proc() {\n" + - " int[] a = new int[10];\n" + - " Object b = a;\n" + - " Class c = a.getClass();\n" + - " String s = a.toString();\n" + - " boolean l = a.equals(b);\n" + - " int h = a.hashCode();\n" + - " try {\n" + - " a.wait();\n" + - " a.wait(3);\n" + - " a.wait(4, 5);\n" + - " } catch (Exception e) {\n" + - " }\n" + - " a.notify();\n" + - " a.notifyAll();\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of array>"; - String completeBehind = "a.w"; - String expectedCompletionNodeToString = "<CompleteOnName:a.w>"; - String completionIdentifier = "w"; - String expectedReplacedSource = "a.wait"; - int cursorLocation = str.indexOf("a.wait(4, 5)") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class OA {\n" + - " public OA() {\n" + - " }\n" + - " void proc() {\n" + - " int[] a;\n" + - " Object b;\n" + - " Class c;\n" + - " String s;\n" + - " boolean l;\n" + - " int h;\n" + - " {\n" + - " <CompleteOnName:a.w>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testOB_1() { - String str = - "package p; \n" + - "public class OB {\n" + - " void foo() {\n" + - " label : while (true) {\n" + - " System.out.println(\"\");\n" + - " break label;\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on keyword>"; - String completeBehind = "b"; - String expectedCompletionNodeToString = "<CompleteOnName:b>"; - String completionIdentifier = "b"; - String expectedReplacedSource = "break"; - int cursorLocation = str.indexOf("break") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class OB {\n" + - " public OB() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " <CompleteOnName:b>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testOB_2() { - String str = - "package p; \n" + - "public class OB {\n" + - " void foo() {\n" + - " label : while (true) {\n" + - " System.out.println(\"\");\n" + - " break label;\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on label name>"; - String completeBehind = "l"; - String expectedCompletionNodeToString = "<CompleteOnName:l>"; - String completionIdentifier = "l"; - String expectedReplacedSource = "label"; - int cursorLocation = str.indexOf("label") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class OB {\n" + - " public OB() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:l>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testOC_1FM7J7F() { - String str = - "package p; \n" + - "/**\n" + - " * 1FM7J7F\n" + - " */\n" + - "class OC {\n" + - " String s = new String(\n" + - "}\n"; - - String testName = "<complete on field initializer>"; - String completeBehind = "new String("; - String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new String()>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class OC {\n" + - " String s = <CompleteOnAllocationExpression:new String()>;\n" + - " OC() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testP_1FG1YU0() { - String str = - "package p; \n" + - "/**\n" + - " * 1FG1YU0\n" + - " */\n" + - "public class P {\n" + - " {\n" + - " void bar() {\n" + - " f }\n" + - " void foo() {\n" + - " }\n" + - " }\n"; - - String testName = "<complete on method/field>"; - String completeBehind = "f"; - String expectedCompletionNodeToString = "<CompleteOnName:f>"; - String completionIdentifier = "f"; - String expectedReplacedSource = "f"; - int cursorLocation = str.indexOf("f }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class P {\n" + - " {\n" + - " }\n" + - " public P() {\n" + - " }\n" + - " void bar() {\n" + - " <CompleteOnName:f>;\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); } -public void testPA_1() { - String str = - "package p; \n" + - "class PAHelper {\n" + - " public int fieldPublic;\n" + - " protected int fieldProtected;\n" + - " private int fieldPrivate;\n" + - " int fieldDefault;\n" + - " static void staticFoo() {\n" + - " }\n" + - " static int i = 1;\n" + - " int neuneu1() {\n" + - " return 0;\n" + - " }\n" + - " void neuneu2() {\n" + - " }\n" + - "}\n" + - "public class PA\n" + - " extends PAHelper {\n" + - " void foo() {\n" + - " B[] b = \n" + - " new java.lang.Number[]; \n" + - " java.lang.Short s;\n" + - " // b[1].;\n" + - " }\n" + - "}\n"; - - String testName = "<complete on comment>"; - String completeBehind = "b[1]."; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = ""; - String expectedReplacedSource = NONE; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = null; - - try { - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); - assertTrue("failed to detect invalid cursor location", false); - } catch(InvalidCursorLocation e){ - assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT); - } -} -public void testPA_2() { - String str = - "package p; \n" + - "class PAHelper {\n" + - " public int fieldPublic;\n" + - " protected int fieldProtected;\n" + - " private int fieldPrivate;\n" + - " int fieldDefault;\n" + - " static void staticFoo() {\n" + - " }\n" + - " static int i = 1;\n" + - " int neuneu1() {\n" + - " return 0;\n" + - " }\n" + - " void neuneu2() {\n" + - " }\n" + - "}\n" + - "public class PA\n" + - " extends PAHelper {\n" + - " void foo() {\n" + - " B[] b = \n" + - " new java.lang.Number[]; \n" + - " java.lang.Short s;\n" + - " // b[1].;\n" + - " }\n" + - "}\n"; - - String testName = "<complete on new keyword>"; - String completeBehind = "n"; - String expectedCompletionNodeToString = "<CompleteOnName:n>"; - String completionIdentifier = "n"; - String expectedReplacedSource = "new"; - int cursorLocation = str.indexOf("new ") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class PAHelper {\n" + - " public int fieldPublic;\n" + - " protected int fieldProtected;\n" + - " private int fieldPrivate;\n" + - " int fieldDefault;\n" + - " static int i;\n" + - " <clinit>() {\n" + - " }\n" + - " PAHelper() {\n" + - " }\n" + - " static void staticFoo() {\n" + - " }\n" + - " int neuneu1() {\n" + - " }\n" + - " void neuneu2() {\n" + - " }\n" + - "}\n" + - "public class PA extends PAHelper {\n" + - " public PA() {\n" + - " }\n" + - " void foo() {\n" + - " B[] b = <CompleteOnName:n>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testPB() { - String str = - "package p; \n" + - "public class PB {\n" + - " void foo() {\n" + - " class Local {\n" + - " void foo() {\n" + - " }\n" + - " class LocalMember1 {\n" + - " void foo() {\n" + - " class LocalMemberLocal {\n" + - " void foo() {\n" + - " f\n"+ - " }\n" + - " }\n" + - " }\n" + - " }\n" + - " class LocalMember2 {\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field into nested local type>"; - String completeBehind = "f"; - String expectedCompletionNodeToString = "<CompleteOnName:f>"; - String completionIdentifier = "f"; - String expectedReplacedSource = "f"; - int cursorLocation = str.indexOf("f\n") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class PB {\n" + - " public PB() {\n" + - " }\n" + - " void foo() {\n" + - " class Local {\n" + - " class LocalMember1 {\n" + - " LocalMember1() {\n" + - " }\n" + - " void foo() {\n" + - " class LocalMemberLocal {\n" + - " LocalMemberLocal() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:f>;\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - " class LocalMember2 {\n" + - " LocalMember2() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " Local() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testPC_1FSU4EF() { - String str = - "package p; \n" + - "/**\n" + - " * 1FSU4EF\n" + - " */\n" + - "import java.util.Vector;\n" + - "public class PC {\n" + - " void foo() {\n" + - " class Inner {\n" + - " Vector v = new Vector();\n" + - " void foo() {\n" + - " Vector v = new Vector();\n" + - " v.addElement();\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field into local type>"; - String completeBehind = "v.a"; - String expectedCompletionNodeToString = "<CompleteOnName:v.a>"; - String completionIdentifier = "a"; - String expectedReplacedSource = "v.addElement"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "import java.util.Vector;\n" + - "public class PC {\n" + - " public PC() {\n" + - " }\n" + - " void foo() {\n" + - " class Inner {\n" + - " Vector v;\n" + - " Inner() {\n" + - " }\n" + - " void foo() {\n" + - " Vector v;\n" + - " <CompleteOnName:v.a>;\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testQ_1FG1YU0() { - String str = - "package p; \n" + - "/**\n" + - " * 1FG1YU0\n" + - " */\n" + - "public class Q {\n" + - " void bar(boolean bbbb) {\n" + - " this.}\n" + - "}\n"; - - String testName = "<complete on method/field>"; - String completeBehind = "this."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "this."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class Q {\n" + - " public Q() {\n" + - " }\n" + - " void bar(boolean bbbb) {\n" + - " <CompleteOnMemberAccess:this.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testQA_1() { - String str = - "package p; \n" + - "class QAHelper {\n" + - " int i = 10;\n" + - " void f() {\n" + - " Chk.chkIntVal(\n" + - " \"err_0\", \n" + - " \"i\", \n" + - " this.i, \n" + - " i); \n" + - " }\n" + - " static class Y\n" + - " extends QAHelper {\n" + - " public void f() {\n" + - " super.f();\n" + - " int j = super.i;\n" + - " }\n" + - " public static void main(String a[]) {\n" + - " Y oy = new Y();\n" + - " oy.f();\n" + - " }\n" + - " }\n" + - "}\n" + - "public class QA {\n" + - " static String s[] = \n" + - " {\"Dolby\", \"Thx\",}; \n" + - " void check() {\n" + - " new QAHelper().new Y().main(\n" + - " s); \n" + - " }\n" + - " static public void main(String args[]) {\n" + - " new QA().check();\n" + - " Chk.endTest(\"ciner111\");\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field>"; - String completeBehind = "new QAHelper().new Y().m"; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new QAHelper().new Y().m>"; - String completionIdentifier = "m"; - String expectedReplacedSource = "main"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class QAHelper {\n" + - " static class Y extends QAHelper {\n" + - " Y() {\n" + - " }\n" + - " public void f() {\n" + - " }\n" + - " public static void main(String[] a) {\n" + - " }\n" + - " }\n" + - " int i;\n" + - " QAHelper() {\n" + - " }\n" + - " void f() {\n" + - " }\n" + - "}\n" + - "public class QA {\n" + - " static String[] s;\n" + - " <clinit>() {\n" + - " }\n" + - " public QA() {\n" + - " }\n" + - " void check() {\n" + - " <CompleteOnMemberAccess:new QAHelper().new Y().m>;\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testQA_2() { - String str = - "package p; \n" + - "class QAHelper {\n" + - " int i = 10;\n" + - " void f() {\n" + - " Chk.chkIntVal(\n" + - " \"err_0\", \n" + - " \"i\", \n" + - " this.i, \n" + - " i); \n" + - " }\n" + - " static class Y\n" + - " extends QAHelper {\n" + - " public void f() {\n" + - " super.f();\n" + - " int j = super.i;\n" + - " }\n" + - " public static void main(String a[]) {\n" + - " Y oy = new Y();\n" + - " oy.f();\n" + - " }\n" + - " }\n" + - "}\n" + - "public class QA {\n" + - " static String s[] = \n" + - " {\"Dolby\", \"Thx\",}; \n" + - " void check() {\n" + - " new QAHelper().new Y().main(\n" + - " s); \n" + - " }\n" + - " static public void main(String args[]) {\n" + - " new QA().check();\n" + - " Chk.endTest(\"ciner111\");\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of object creation>"; - String completeBehind = "new QAHelper()."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new QAHelper().>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class QAHelper {\n" + - " static class Y extends QAHelper {\n" + - " Y() {\n" + - " }\n" + - " public void f() {\n" + - " }\n" + - " public static void main(String[] a) {\n" + - " }\n" + - " }\n" + - " int i;\n" + - " QAHelper() {\n" + - " }\n" + - " void f() {\n" + - " }\n" + - "}\n" + - "public class QA {\n" + - " static String[] s;\n" + - " <clinit>() {\n" + - " }\n" + - " public QA() {\n" + - " }\n" + - " void check() {\n" + - " <CompleteOnMemberAccess:new QAHelper().>;\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testQA_3() { - String str = - "package p; \n" + - "class QAHelper {\n" + - " int i = 10;\n" + - " void f() {\n" + - " Chk.chkIntVal(\n" + - " \"err_0\", \n" + - " \"i\", \n" + - " this.i, \n" + - " i); \n" + - " }\n" + - " static class Y\n" + - " extends QAHelper {\n" + - " public void f() {\n" + - " super.f();\n" + - " int j = super.i;\n" + - " }\n" + - " public static void main(String a[]) {\n" + - " Y oy = new Y();\n" + - " oy.f();\n" + - " }\n" + - " }\n" + - "}\n" + - "public class QA {\n" + - " static String s[] = \n" + - " {\"Dolby\", \"Thx\",}; \n" + - " void check() {\n" + - " new QAHelper().new Y().main(\n" + - " s); \n" + - " }\n" + - " static public void main(String args[]) {\n" + - " new QA().check();\n" + - " Chk.endTest(\"ciner111\");\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of object creation>"; - String completeBehind = "new QAHelper().new Y()."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new QAHelper().new Y().>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class QAHelper {\n" + - " static class Y extends QAHelper {\n" + - " Y() {\n" + - " }\n" + - " public void f() {\n" + - " }\n" + - " public static void main(String[] a) {\n" + - " }\n" + - " }\n" + - " int i;\n" + - " QAHelper() {\n" + - " }\n" + - " void f() {\n" + - " }\n" + - "}\n" + - "public class QA {\n" + - " static String[] s;\n" + - " <clinit>() {\n" + - " }\n" + - " public QA() {\n" + - " }\n" + - " void check() {\n" + - " <CompleteOnMemberAccess:new QAHelper().new Y().>;\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testQA_4() { - String str = - "package p; \n" + - "class QAHelper {\n" + - " int i = 10;\n" + - " void f() {\n" + - " Chk.chkIntVal(\n" + - " \"err_0\", \n" + - " \"i\", \n" + - " this.i, \n" + - " i); \n" + - " }\n" + - " static class Y\n" + - " extends QAHelper {\n" + - " public void f() {\n" + - " super.f();\n" + - " int j = super.i;\n" + - " }\n" + - " public static void main(String a[]) {\n" + - " Y oy = new Y();\n" + - " oy.f();\n" + - " }\n" + - " }\n" + - "}\n" + - "public class QA {\n" + - " static String s[] = \n" + - " {\"Dolby\", \"Thx\",}; \n" + - " void check() {\n" + - " new QAHelper().new Y().main(\n" + - " s); \n" + - " }\n" + - " static public void main(String args[]) {\n" + - " new QA().check();\n" + - " Chk.endTest(\"ciner111\");\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of object creation>"; - String completeBehind = "new QA()."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new QA().>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class QAHelper {\n" + - " static class Y extends QAHelper {\n" + - " Y() {\n" + - " }\n" + - " public void f() {\n" + - " }\n" + - " public static void main(String[] a) {\n" + - " }\n" + - " }\n" + - " int i;\n" + - " QAHelper() {\n" + - " }\n" + - " void f() {\n" + - " }\n" + - "}\n" + - "public class QA {\n" + - " static String[] s;\n" + - " <clinit>() {\n" + - " }\n" + - " public QA() {\n" + - " }\n" + - " void check() {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " <CompleteOnMemberAccess:new QA().>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testQB_1FIK820() { - String str = - "package p; \n" + - "/**\n" + - " * 1FIK820\n" + - " */\n" + - "public class QB {\n" + - " void foo() {\n" + - " {\n" + - " }\n" + - " .}\n" + - "}\n"; - - String testName = "<complete on block (no answers wanted)>"; - String completeBehind = "."; - String expectedCompletionNodeToString = "<CompleteOnName:>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(".}") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class QB {\n" + - " public QB() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testR_1FGD31E() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGD31E\n" + - " */\n" + - "public class R {\n" + - " void moo() {\n" + - " b }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field>"; - String completeBehind = "b"; - String expectedCompletionNodeToString = "<CompleteOnName:b>"; - String completionIdentifier = "b"; - String expectedReplacedSource = "b"; - int cursorLocation = str.indexOf("b }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class R {\n" + - " public R() {\n" + - " }\n" + - " void moo() {\n" + - " <CompleteOnName:b>;\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testRA_1() { - String str = - "package p; \n" + - "public class RA extends A {\n" + - " private int f = 5;\n" + - " int i(int k) {\n" + - " }\n" + - " class B extends I {\n" + - " void foo();\n" + - " class C extends Z {\n" + - " }\n" + - " final int fo;\n" + - " }\n" + - " final void foo(k j) {\n" + - " }\n" + - " o o() throws Exc, Exc {\n" + - " }\n" + - " static {\n" + - " this.ff = 5;\n" + - " }\n" + - "}\n"; - - String testName = "<complete on incorrect this call>"; - String completeBehind = "t"; - String expectedCompletionNodeToString = "<CompleteOnName:t>"; - String completionIdentifier = "t"; - String expectedReplacedSource = "this"; - int cursorLocation = str.indexOf("this.ff") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class RA extends A {\n" + - " class B extends I {\n" + - " class C extends Z {\n" + - " C() {\n" + - " }\n" + - " }\n" + - " final int fo;\n" + - " B() {\n" + - " }\n" + - " void foo();\n" + - " }\n" + - " private int f;\n" + - " static {\n" + - " <CompleteOnName:t>;\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " public RA() {\n" + - " }\n" + - " int i(int k) {\n" + - " }\n" + - " final void foo(k j) {\n" + - " }\n" + - " o o() throws Exc, Exc {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testRA_2() { - String str = - "package p; \n" + - "public class RA extends A {\n" + - " private int f = 5;\n" + - " int i(int k) {\n" + - " }\n" + - " class B extends I {\n" + - " void foo();\n" + - " class C extends Z {\n" + - " }\n" + - " final int fo;\n" + - " }\n" + - " final void foo(k j) {\n" + - " }\n" + - " o o() throws Exc, Exc {\n" + - " }\n" + - " static {\n" + - " this.ff = 5;\n" + - " }\n" + - "}\n"; - - String testName = "<complete on t>"; - String completeBehind = "t"; - String expectedCompletionNodeToString = "<CompleteOnName:t>"; - String completionIdentifier = "t"; - String expectedReplacedSource = "this"; - int cursorLocation = str.indexOf("this") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class RA extends A {\n" + - " class B extends I {\n" + - " class C extends Z {\n" + - " C() {\n" + - " }\n" + - " }\n" + - " final int fo;\n" + - " B() {\n" + - " }\n" + - " void foo();\n" + - " }\n" + - " private int f;\n" + - " static {\n" + - " <CompleteOnName:t>;\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " public RA() {\n" + - " }\n" + - " int i(int k) {\n" + - " }\n" + - " final void foo(k j) {\n" + - " }\n" + - " o o() throws Exc, Exc {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testRA_3() { - String str = - "package p; \n" + - "public class RA extends A {\n" + - " private int f = 5;\n" + - " int i(int k) {\n" + - " }\n" + - " class B extends I {\n" + - " void foo();\n" + - " class C extends Z {\n" + - " }\n" + - " final int fo;\n" + - " }\n" + - " final void foo(k j) {\n" + - " }\n" + - " o o() throws Exc, Exc {\n" + - " }\n" + - " static {\n" + - " this.ff = 5;\n" + - " }\n" + - "}\n"; - - String testName = "<complete on exception type>"; - String completeBehind = "Exc"; - String expectedCompletionNodeToString = "<CompleteOnException:Exc>"; - String completionIdentifier = "Exc"; - String expectedReplacedSource = "Exc"; - int cursorLocation = str.indexOf("Exc {") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class RA extends A {\n" + - " class B extends I {\n" + - " class C extends Z {\n" + - " C() {\n" + - " }\n" + - " }\n" + - " final int fo;\n" + - " B() {\n" + - " }\n" + - " void foo();\n" + - " }\n" + - " private int f;\n" + - " static {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " public RA() {\n" + - " }\n" + - " int i(int k) {\n" + - " }\n" + - " final void foo(k j) {\n" + - " }\n" + - " o o() throws Exc, <CompleteOnException:Exc> {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testRB_1FI74S3() { - String str = - "package p; \n" + - "/**\n" + - " * 1FI74S3\n" + - " */\n" + - "public class RB {\n" + - " int[] table;\n" + - " void foo() {\n" + - " int x = table.}\n" + - "}\n"; - - String testName = "<complete on method/field of arry>"; - String completeBehind = "table."; - String expectedCompletionNodeToString = "<CompleteOnName:table.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "table."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class RB {\n" + - " int[] table;\n" + - " public RB() {\n" + - " }\n" + - " void foo() {\n" + - " int x = <CompleteOnName:table.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testS_1FGF64P_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGF64P\n" + - " */\n" + - "public class S {\n" + - " {\n" + - " new Y()..}\n" + - " class Y {\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on incorrect call>"; - String completeBehind = "new Y().."; - String expectedCompletionNodeToString = "<CompleteOnName:>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class S {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " {\n" + - " {\n" + - " <CompleteOnName:>;\n" + - " }\n" + - " }\n" + - " public S() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testS_1FGF64P_2() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGF64P\n" + - " */\n" + - "public class S {\n" + - " {\n" + - " new Y()..}\n" + - " class Y {\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of object creation>"; - String completeBehind = "new Y()."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Y().>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class S {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " {\n" + - " <CompleteOnMemberAccess:new Y().>;\n" + - " }\n" + - " public S() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testS_1FGF64P_3() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGF64P\n" + - " */\n" + - "public class S {\n" + - " {\n" + - " new Y()..}\n" + - " class Y {\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on incorrect call>"; - String completeBehind = "new Y().."; - String expectedCompletionNodeToString = "<CompleteOnName:>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class S {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " {\n" + - " {\n" + - " <CompleteOnName:>;\n" + - " }\n" + - " }\n" + - " public S() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testSA() { - String str = - "package p; \n" + - "public class SA {\n" + - " public sy void foo() {\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method modifier>"; - String completeBehind = "sy"; - String expectedCompletionNodeToString = "<CompleteOnType:sy>"; - String completionIdentifier = "sy"; - String expectedReplacedSource = "sy"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class SA {\n" + - " <CompleteOnType:sy>;\n" + - " public SA() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testSB_1FILFDG() { - String str = - "package p; \n" + - "/**\n" + - " * 1FILFDG\n" + - " */\n" + - "public class SB {\n" + - " public void foo() {\n" + - " String s = \"hello\n" + - " int}\n" + - "}\n"; - - String testName = "<complete on field declaration type>"; - String completeBehind = "int"; - String expectedCompletionNodeToString = "<CompleteOnName:int>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class SB {\n" + - " public SB() {\n" + - " }\n" + - " public void foo() {\n" + - " String s;\n" + - " <CompleteOnName:int>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testT_1FGF64P() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGF64P\n" + - " */\n" + - "public class T {\n" + - " {\n" + - " new Y().}\n" + - " class Y {\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on object creation>"; - String completeBehind = "new Y()."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new Y().>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class T {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " {\n" + - " <CompleteOnMemberAccess:new Y().>;\n" + - " }\n" + - " public T() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testTA_1FHISJJ_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FHISJJ\n" + - " */\n" + - "public class TA {\n" + - " void foo() {\n" + - " Object[] items = \n" + - " {\n" + - " \"Mark unublishable\", \n" + - " null, \n" + - " \"Properties...\"}\n" + - " .;\n" + - " items.}\n" + - "}\n"; - - String testName = "<complete on array intializer value>"; - String completeBehind = "n"; - String expectedCompletionNodeToString = "<CompleteOnName:n>"; - String completionIdentifier = "n"; - String expectedReplacedSource = "null"; - int cursorLocation = str.indexOf("null, ") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class TA {\n" + - " public TA() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] items = {<CompleteOnName:n>};\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testTA_1FHISJJ_2() { - String str = - "package p; \n" + - "/**\n" + - " * 1FHISJJ\n" + - " */\n" + - "public class TA {\n" + - " void foo() {\n" + - " Object[] items = \n" + - " {\n" + - " \"Mark unublishable\", \n" + - " null, \n" + - " \"Properties...\"}\n" + - " .;\n" + - " items.}\n" + - "}\n"; - - String testName = "<complete on method/field of array intializer>"; - String completeBehind = - " {\n" + - " \"Mark unublishable\", \n" + - " null, \n" + - " \"Properties...\"}\n" + - " ."; - String expectedCompletionNodeToString = "<CompleteOnName:>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class TA {\n" + - " public TA() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] items;\n" + - " <CompleteOnName:>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testTA_1FHISJJ_3() { - String str = - "package p; \n" + - "/**\n" + - " * 1FHISJJ\n" + - " */\n" + - "public class TA {\n" + - " void foo() {\n" + - " Object[] items = \n" + - " {\n" + - " \"Mark unublishable\", \n" + - " null, \n" + - " \"Properties...\"}\n" + - " .;\n" + - " items.}\n" + - "}\n"; - - String testName = "<complete on method/field of array>"; - String completeBehind = "items."; - String expectedCompletionNodeToString = "<CompleteOnName:items.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "items."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class TA {\n" + - " public TA() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] items;\n" + - " <CompleteOnName:items.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testTB_1FHSLMQ() { - String str = - "package p; \n" + - "/**\n" + - " * 1FHSLMQ\n" + - " */\n" + - "public class TB {\n" + - " void foo() {\n" + - " if (true)\n" + - " System.out.println(\"\");\n" + - " e }\n" + - "}\n"; - - String testName = "<complete on else keyword>"; - String completeBehind = "e"; - String expectedCompletionNodeToString = "<CompleteOnName:e>"; - String completionIdentifier = "e"; - String expectedReplacedSource = "e"; - int cursorLocation = str.indexOf("e }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class TB {\n" + - " public TB() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:e>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testU_1FGGUME() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGGUME\n" + - " */\n" + - "public class U {\n" + - " public static final int Source = \n" + - " 5; \n" + - "}\n"; - - String testName = "<complete on digit>"; - String completeBehind = "5"; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = ""; - String expectedReplacedSource = NONE; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = null; - - try { - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); - assertTrue("failed to detect invalid cursor location", false); - } catch(InvalidCursorLocation e){ - assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_NUMBER); - } -} -public void testUA_1FHISJJ_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FHISJJ\n" + - " */\n" + - "public class UA {\n" + - " void foo() {\n" + - " Object[] items = \n" + - " new String[] {\n" + - " \"Mark unublishable\", \n" + - " null, \n" + - " \"Properties...\"}\n" + - " .;\n" + - " items.}\n" + - "}\n"; - - String testName = "<complete on array initializer>"; - String completeBehind = - "new String[] {\n" + - " \"Mark unublishable\", \n" + - " null, \n" + - " \"Properties...\"}\n" + - " ."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String[]{\"Mark unublishable\", null, \"Properties...\"}.>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class UA {\n" + - " public UA() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] items = <CompleteOnMemberAccess:new String[]{\"Mark unublishable\", null, \"Properties...\"}.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testUA_1FHISJJ_2() { - String str = - "package p; \n" + - "/**\n" + - " * 1FHISJJ\n" + - " */\n" + - "public class UA {\n" + - " void foo() {\n" + - " Object[] items = \n" + - " new String[] {\n" + - " \"Mark unublishable\", \n" + - " null, \n" + - " \"Properties...\"}\n" + - " .;\n" + - " items.}\n" + - "}\n"; - - String testName = "<complete on method/field of array>"; - String completeBehind = "items."; - String expectedCompletionNodeToString = "<CompleteOnName:items.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "items."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class UA {\n" + - " public UA() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] items;\n" + - " <CompleteOnName:items.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testUB_1FSBZ02() { - String str = - "package p; \n" + - "/**\n" + - " * 1FSBZ02\n" + - " */\n" + - "class UB {\n" + - " void bar() {\n" + - " }\n" + - " class UBMember {\n" + - " void bar2() {\n" + - " }\n" + - " void foo() {\n" + - " b\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on keyword>"; - String completeBehind = "b"; - String expectedCompletionNodeToString = "<CompleteOnName:b>"; - String completionIdentifier = "b"; - String expectedReplacedSource = "b"; - int cursorLocation = str.indexOf("b\n") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class UB {\n" + - " class UBMember {\n" + - " UBMember() {\n" + - " }\n" + - " void bar2() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:b>;\n" + - " }\n" + - " }\n" + - " UB() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testV_1FGGUOO_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGGUOO\n" + - " */\n" + - "public class V i java\n" + - " .io\n" + - " .Serializable {\n" + - "}\n"; - - String testName = "<complete on implements keyword>"; - String completeBehind = "i"; - String expectedCompletionNodeToString = "<CompleteOnKeyword:i>"; - String completionIdentifier = "i"; - String expectedReplacedSource = "i"; - int cursorLocation = str.indexOf("i java") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class V extends <CompleteOnKeyword:i> {\n" + - " {\n" + - " }\n" + - " public V() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testV_1FGGUOO_2() { - String str = - "package x.y.z; \n" + - "/**\n" + - " * 1FGGUOO\n" + - " */\n" + - "public class V implements java.io.Serializable {\n" + - "}\n"; - - String testName = "<complete on package>"; - String completeBehind = "y"; - String expectedCompletionNodeToString = "<CompleteOnPackage:x.y>"; - String completionIdentifier = "y"; - String expectedReplacedSource = - "x.y.z"; - int cursorLocation = str.indexOf("y") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package <CompleteOnPackage:x.y>;\n" + - "public class V implements java.io.Serializable {\n" + - " public V() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testVA_1FHISJJ_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FHISJJ\n" + - " */\n" + - "public class VA {\n" + - " void foo() {\n" + - " Object item = new String() {\n" + - " public boolean equals() {\n" + - " return false;\n" + - " }\n" + - " }\n" + - " .;\n" + - " item.}\n" + - "}\n"; - - String testName = "<complete on anonymous type declaration>"; - String completeBehind = - "new String() {\n" + - " public boolean equals() {\n" + - " return false;\n" + - " }\n" + - " }\n" + - " ."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String() {\n" + - " public boolean equals() {\n" + - " return false;\n" + - " }\n" + - "}.>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class VA {\n" + - " public VA() {\n" + - " }\n" + - " void foo() {\n" + - " Object item = <CompleteOnMemberAccess:new String() {\n" + - " public boolean equals() {\n" + - " return false;\n" + - " }\n" + - "}.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testVA_1FHISJJ_2() { - String str = - "package p; \n" + - "/**\n" + - " * 1FHISJJ\n" + - " */\n" + - "public class VA {\n" + - " void foo() {\n" + - " Object item = new String() {\n" + - " public boolean equals() {\n" + - " return false;\n" + - " }\n" + - " }\n" + - " .;\n" + - " item.}\n" + - "}\n"; - - String testName = "<complete on local variable>"; - String completeBehind = "item."; - String expectedCompletionNodeToString = "<CompleteOnName:item.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "item."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class VA {\n" + - " public VA() {\n" + - " }\n" + - " void foo() {\n" + - " Object item;\n" + - " <CompleteOnName:item.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testVB_1() { - String str = - "package p; \n" + - "public class VB {\n" + - " void foo() {\n" + - " new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " }\n" + - " .;\n" + - " }\n" + - "}\n"; - - String testName = "<complete on local variable name into anonymous declaration>"; - String completeBehind = "v"; - String expectedCompletionNodeToString = "<CompleteOnName:v>"; - String completionIdentifier = "v"; - String expectedReplacedSource = "v"; - int cursorLocation = str.indexOf("v }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class VB {\n" + - " public VB() {\n" + - " }\n" + - " void foo() {\n" + - " new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111;\n" + - " <CompleteOnName:v>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -// TODO excluded test (completion on field access on anonymous inner class with syntax error) -public void _testVB_2() { - String str = - "package p; \n" + - "public class VB {\n" + - " void foo() {\n" + - " new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " }.\n" + - " }\n" + - "}\n"; - - String testName = "<complete on anonymous type declaration>"; - String completeBehind = - "new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " }."; - String expectedCompletionNodeToString = - "<CompleteOnMemberAccess:new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " }\n" + - "}.>"; - String completionIdentifier = ""; - String expectedReplacedSource = - "new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " }."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class VB {\n" + - " public VB() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " }\n" + - "}.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testVB_3() { - String str = - "package p; \n" + - "public class VB {\n" + - " void foo() {\n" + - " new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " }\n" + - " .;\n" + - " }\n" + - "}\n"; - - String testName = "<complete on constructor>"; - String completeBehind = "new java.io.File("; - String expectedCompletionNodeToString = "<CompleteOnAllocationExpression:new java.io.File()>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class VB {\n" + - " public VB() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnAllocationExpression:new java.io.File()>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -// TODO excluded test (completion on field access on anonymous inner class with syntax error) -public void _testVB_4() { - String str = - "package p; \n" + - "public class VB {\n" + - " void foo() {\n" + - " new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " }\n" + - " .;\n" + - " }\n" + - "}\n"; - - String testName = "<complete on anonymous type declaration with dummy spaces>"; - String completeBehind = - "new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " }\n" + - " ."; - String expectedCompletionNodeToString = - "<CompleteOnName:new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " }\n" + - "}.>"; - String completionIdentifier = ""; - String expectedReplacedSource = - "new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " }\n" + - " ."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class VB {\n" + - " public VB() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " }\n" + - "}.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -// TODO excluded test (completion on field access on anonymous inner class with syntax error) -public void _testVB_5() { - String str = - "package p; \n" + - "public class VB {\n" + - " void foo() {\n" + - " new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " }.;\n" + - " }\n" + - "}\n"; - - String testName = "<complete on anonymous type declaration with trailing semi-colon>"; - String completeBehind = - "new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " }."; - String expectedCompletionNodeToString = - "<CompleteOnMemberAccess:new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " }\n" + - "}.>"; - String completionIdentifier = ""; - String expectedReplacedSource = - "new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " Vector v11111 = new Vector();\n" + - " v }\n" + - " }."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class VB {\n" + - " public VB() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:new java.io.File(\"error\") {\n" + - " protected void runTest() {\n" + - " }\n" + - "}.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testW_1FGGUS4() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGGUS4\n" + - " */\n" + - "public class W {\n" + - " public static final int LA = \n" + - " 1; \n" + - " public static final int LAB = \n" + - " 2; \n" + - " public static final int LABO = \n" + - " 4; \n" + - " public int produceDebugAttributes = \n" + - " LABO; \n" + - "}\n"; - - String testName = "<complete on field initializer>"; - String completeBehind = "L"; - String expectedCompletionNodeToString = "<CompleteOnName:L>"; - String completionIdentifier = "L"; - String expectedReplacedSource = "LABO"; - int cursorLocation = str.indexOf("LABO;") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class W {\n" + - " public static final int LA;\n" + - " public static final int LAB;\n" + - " public static final int LABO;\n" + - " public int produceDebugAttributes = <CompleteOnName:L>;\n" + - " public W() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testWA_1() { - String str = - "package p; \n" + - "public class WA {\n" + - " void foo() {\n" + - " int value = 10;\n" + - " v int[] tab = new int[value];\n" + - " }\n"; - - String testName = "<complete on array size value>"; - String completeBehind = "v"; - String expectedCompletionNodeToString = "<CompleteOnName:v>"; - String completionIdentifier = "v"; - String expectedReplacedSource = "value"; - int cursorLocation = str.indexOf("value];") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class WA {\n" + - " public WA() {\n" + - " }\n" + - " void foo() {\n" + - " int value;\n" + - " int[] tab = new int[<CompleteOnName:v>];\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testWA_2() { - String str = - "package p; \n" + - "public class WA {\n" + - " void foo() {\n" + - " int value = 10;\n" + - " v int[] tab = new int[value];\n" + - " }\n"; - - String testName = "<complete on corrupter local variable declaration>"; - String completeBehind = "v"; - String expectedCompletionNodeToString = "<CompleteOnName:v>"; - String completionIdentifier = "v"; - String expectedReplacedSource = "v"; - int cursorLocation = str.indexOf("v int[]") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class WA {\n" + - " public WA() {\n" + - " }\n" + - " void foo() {\n" + - " int value;\n" + - " <CompleteOnName:v>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testWB_1FI313C() { - String str = - "package p; \n" + - "/*\n" + - " * 1FI313C\n" + - " */\n" + - "class WBHelper {\n" + - " public int fieldPublic;\n" + - " protected int fieldProtected;\n" + - " private int fieldPrivate;\n" + - " int fieldDefault;\n" + - " static void staticFoo() {\n" + - " }\n" + - " static int i = d;\n" + - " int neuneu1() {\n" + - " }\n" + - " void neuneu2() {\n" + - " }\n" + - "}\n" + - "public class WB\n" + - " extends WBHelper {\n" + - " void foo() {\n" + - " BIJOUR[] b = \n" + - " new java.lang.Number[]; \n" + - " java.lang.Short s;\n" + - " b[1].}\n" + - " B() {\n" + - " }\n" + - " B(int) {\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of array element>"; - String completeBehind = "b[1]."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:b[1].>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "class WBHelper {\n" + - " public int fieldPublic;\n" + - " protected int fieldProtected;\n" + - " private int fieldPrivate;\n" + - " int fieldDefault;\n" + - " static int i;\n" + - " WBHelper() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " static void staticFoo() {\n" + - " }\n" + - " int neuneu1() {\n" + - " }\n" + - " void neuneu2() {\n" + - " }\n" + - "}\n" + - "public class WB extends WBHelper {\n" + - " public WB() {\n" + - " }\n" + - " void foo() {\n" + - " BIJOUR[] b;\n" + - " java.lang.Short s;\n" + - " <CompleteOnMemberAccess:b[1].>;\n" + - " }\n" + - " B() {\n" + - " }\n" + - " B() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testX_1FGGV8C_1() { - String str = - "package p; \n" + - "import p2.Y; \n" + - "/**\n" + - " * 1FGGV8C and 1FGPE8E\n" + - " */\n" + - "public class X {\n" + - " public static final float Vars; \n" + - " public static final float Lines; \n" + - " public static final float Source; \n" + - " public static final float UnreachableCode; \n" + - " public static final float produceDebugAttributes; \n" + - " void foo() {\n" + - " int locale, \n" + - " errorThreshold, \n" + - " preserveAllLocalVariables; \n" + - " return new Y[] {\n" + - " new Y(\n" + - " \"debug.vars\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Vars)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new Y(\n" + - " \"debug.lines\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Lines)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new Y(\n" + - " \"debug.source\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Source)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new Y(\n" + - " \"debug.preserveAllLocals\", \n" + - " this, \n" + - " locale, \n" + - " preserveAllLocalVariables\n" + - " ? 0\n" + - " : 1), \n" + - " new Y(\n" + - " \"optionalError.unReachableCode\", \n" + - " this, \n" + - " locale, \n" + - " (errorThreshold\n" + - " & UnreachableCode)\n" + - " != 0\n" + - " ? 0\n" + - " : 1)\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on argument of anonymous type declaration>"; - String completeBehind = "t"; - String expectedCompletionNodeToString = "<CompleteOnName:t>"; - String completionIdentifier = "t"; - String expectedReplacedSource = "this"; - int cursorLocation = str.indexOf("this, ") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "import p2.Y;\n" + - "public class X {\n" + - " public static final float Vars;\n" + - " public static final float Lines;\n" + - " public static final float Source;\n" + - " public static final float UnreachableCode;\n" + - " public static final float produceDebugAttributes;\n" + - " <clinit>() {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int locale;\n" + - " int errorThreshold;\n" + - " int preserveAllLocalVariables;\n" + - " new Y(\"debug.vars\", <CompleteOnName:t>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testX_1FGGV8C_2() { - String str = - "package p; \n" + - "import p2.YZA; \n" + - "/**\n" + - " * 1FGGV8C and 1FGPE8E\n" + - " */\n" + - "public class X {\n" + - " public static final float Vars; \n" + - " public static final float Lines; \n" + - " public static final float Source; \n" + - " public static final float UnreachableCode; \n" + - " public static final float produceDebugAttributes; \n" + - " void foo() {\n" + - " int locale, \n" + - " errorThreshold, \n" + - " preserveAllLocalVariables; \n" + - " return new YZA[] {\n" + - " new YZA(\n" + - " \"debug.vars\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Vars)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new YZA(\n" + - " \"debug.lines\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Lines)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new YZA(\n" + - " \"debug.source\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Source)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new YZA(\n" + - " \"debug.preserveAllLocals\", \n" + - " this, \n" + - " locale, \n" + - " preserveAllLocalVariables\n" + - " ? 0\n" + - " : 1), \n" + - " new YZA(\n" + - " \"optionalError.unReachableCode\", \n" + - " this, \n" + - " locale, \n" + - " (errorThreshold\n" + - " & UnreachableCode)\n" + - " != 0\n" + - " ? 0\n" + - " : 1)\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on anonymous type declaration into a return statement>"; - String completeBehind = "Y"; - String expectedCompletionNodeToString = "<CompleteOnType:Y>"; - String completionIdentifier = "Y"; - String expectedReplacedSource = "YZA"; - int cursorLocation = str.indexOf("YZA[]") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "import p2.YZA;\n" + - "public class X {\n" + - " public static final float Vars;\n" + - " public static final float Lines;\n" + - " public static final float Source;\n" + - " public static final float UnreachableCode;\n" + - " public static final float produceDebugAttributes;\n" + - " <clinit>() {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int locale;\n" + - " int errorThreshold;\n" + - " int preserveAllLocalVariables;\n" + - " return new <CompleteOnType:Y>();\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testX_1FGGV8C_3() { - String str = - "package p; \n" + - "import p2.YZA; \n" + - "/**\n" + - " * 1FGGV8C and 1FGPE8E\n" + - " */\n" + - "public class X {\n" + - " public static final float Vars; \n" + - " public static final float Lines; \n" + - " public static final float Source; \n" + - " public static final float UnreachableCode; \n" + - " public static final float produceDebugAttributes; \n" + - " void foo() {\n" + - " int locale, \n" + - " errorThreshold, \n" + - " preserveAllLocalVariables; \n" + - " return new YZA[] {\n" + - " new YZA(\n" + - " \"debug.vars\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Vars)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new YZA(\n" + - " \"debug.lines\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Lines)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new YZA(\n" + - " \"debug.source\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Source)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new YZA(\n" + - " \"debug.preserveAllLocals\", \n" + - " this, \n" + - " locale, \n" + - " preserveAllLocalVariables\n" + - " ? 0\n" + - " : 1), \n" + - " new YZA(\n" + - " \"optionalError.unReachableCode\", \n" + - " this, \n" + - " locale, \n" + - " (errorThreshold\n" + - " & UnreachableCode)\n" + - " != 0\n" + - " ? 0\n" + - " : 1)\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on anonymous type declaration nested into an array initializer>"; - String completeBehind = "Y"; - String expectedCompletionNodeToString = "<CompleteOnType:Y>"; - String completionIdentifier = "Y"; - String expectedReplacedSource = "YZA"; - int cursorLocation = str.indexOf("YZA(") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "import p2.YZA;\n" + - "public class X {\n" + - " public static final float Vars;\n" + - " public static final float Lines;\n" + - " public static final float Source;\n" + - " public static final float UnreachableCode;\n" + - " public static final float produceDebugAttributes;\n" + - " <clinit>() {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int locale;\n" + - " int errorThreshold;\n" + - " int preserveAllLocalVariables;\n" + - " new YZA[]{new <CompleteOnType:Y>()};\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testX_1FGGV8C_4() { - String str = - "package p; \n" + - "import p2.Y; \n" + - "/**\n" + - " * 1FGGV8C and 1FGPE8E\n" + - " */\n" + - "public class X {\n" + - " public static final float Vars; \n" + - " public static final float Lines; \n" + - " public static final float Source; \n" + - " public static final float UnreachableCode; \n" + - " public static final float produceDebugAttributes; \n" + - " void foo() {\n" + - " int locale, \n" + - " errorThreshold, \n" + - " preserveAllLocalVariables; \n" + - " return new Y[] {\n" + - " new Y(\n" + - " \"debug.vars\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Vars)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new Y(\n" + - " \"debug.lines\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Lines)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new Y(\n" + - " \"debug.source\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Source)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new Y(\n" + - " \"debug.preserveAllLocals\", \n" + - " this, \n" + - " locale, \n" + - " preserveAllLocalVariables\n" + - " ? 0\n" + - " : 1), \n" + - " new Y(\n" + - " \"optionalError.unReachableCode\", \n" + - " this, \n" + - " locale, \n" + - " (errorThreshold\n" + - " & UnreachableCode)\n" + - " != 0\n" + - " ? 0\n" + - " : 1)\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field into array intializer>"; - String completeBehind = "n"; - String expectedCompletionNodeToString = "<CompleteOnName:n>"; - String completionIdentifier = "n"; - String expectedReplacedSource = "new"; - int cursorLocation = str.indexOf("new Y(") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "import p2.Y;\n" + - "public class X {\n" + - " public static final float Vars;\n" + - " public static final float Lines;\n" + - " public static final float Source;\n" + - " public static final float UnreachableCode;\n" + - " public static final float produceDebugAttributes;\n" + - " <clinit>() {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int locale;\n" + - " int errorThreshold;\n" + - " int preserveAllLocalVariables;\n" + - " new Y[]{<CompleteOnName:n>};\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testX_1FGPE8E() { - String str = - "package p; \n" + - "import p2.Y; \n" + - "/**\n" + - " * 1FGGV8C and 1FGPE8E\n" + - " */\n" + - "public class X {\n" + - " public static final float Vars; \n" + - " public static final float Lines; \n" + - " public static final float Source; \n" + - " public static final float UnreachableCode; \n" + - " public static final float produceDebugAttributes; \n" + - " void foo() {\n" + - " int locale, \n" + - " errorThreshold, \n" + - " preserveAllLocalVariables; \n" + - " return new Y[] {\n" + - " new Y(\n" + - " \"debug.vars\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Vars)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new Y(\n" + - " \"debug.lines\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Lines)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new Y(\n" + - " \"debug.source\", \n" + - " this, \n" + - " locale, \n" + - " (produceDebugAttributes\n" + - " & Source)\n" + - " != 0\n" + - " ? 0\n" + - " : 1), \n" + - " new Y(\n" + - " \"debug.preserveAllLocals\", \n" + - " this, \n" + - " locale, \n" + - " preserveAllLocalVariables\n" + - " ? 0\n" + - " : 1), \n" + - " new Y(\n" + - " \"optionalError.unReachableCode\", \n" + - " this, \n" + - " locale, \n" + - " (errorThreshold\n" + - " & UnreachableCode)\n" + - " != 0\n" + - " ? 0\n" + - " : 1)\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field into return statement>"; - String completeBehind = "n"; - String expectedCompletionNodeToString = "<CompleteOnName:n>"; - String completionIdentifier = "n"; - String expectedReplacedSource = "new"; - int cursorLocation = str.indexOf("new Y[]") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "import p2.Y;\n" + - "public class X {\n" + - " public static final float Vars;\n" + - " public static final float Lines;\n" + - " public static final float Source;\n" + - " public static final float UnreachableCode;\n" + - " public static final float produceDebugAttributes;\n" + - " <clinit>() {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int locale;\n" + - " int errorThreshold;\n" + - " int preserveAllLocalVariables;\n" + - " return <CompleteOnName:n>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -// Disabled since javadoc completion has been implemented -public void _testXA_1FGGUQF_1FHSL8H_1() { - String str = - "// int\n" + - "package p; \n" + - "/**\n" + - " * 1FGGUQF and 1FHSL8H\n" + - " */\n" + - "/**\n" + - " * int\n" + - " */\n" + - "/*\n" + - " * int\n" + - " */\n" + - "// int\n" + - "/**\n" + - "int.\n" + - " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + - " */\n" + - "/**\n" + - " * int\n" + - " */\n" + - "public class XA {\n" + - " // int\n" + - " /* int */\n" + - " /** int */\n" + - " /**\n" + - " int.\n" + - " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + - " */\n" + - " void /* int */\n" + - " foo() {\n" + - " // int\n" + - " /* int */\n" + - " /** int */\n" + - " }\n" + - " /**\n" + - " int.\n" + - " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + - " */\n" + - " int field /* int */\n" + - " ;\n" + - " /*\n" + - " int\n" + - " */\n" + - " static {\n" + - " // int\n" + - " }\n" + - "}\n" + - "// int\n" + - "/* int */\n" + - "/** int */\n"; - - String testName = "<complete on comment>"; - String completeBehind = "int."; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = ""; - String expectedReplacedSource = NONE; - int cursorLocation = str.indexOf("int.\n") + completeBehind.length() - 1; - String expectedUnitDisplayString = null; - - try { - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); - assertTrue("failed to detect invalid cursor location", false); - } catch(InvalidCursorLocation e){ - assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT); - } -} -public void testXA_1FGGUQF_1FHSL8H_2() { - String str = - "// int\n" + - "package p; \n" + - "/**\n" + - " * 1FGGUQF and 1FHSL8H\n" + - " */\n" + - "/**\n" + - " * int\n" + - " */\n" + - "/*\n" + - " * int\n" + - " */\n" + - "// int\n" + - "/**\n" + - "int.\n" + - " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + - " */\n" + - "/**\n" + - " * int\n" + - " */\n" + - "public class XA {\n" + - " // int\n" + - " /* int */\n" + - " /** int */\n" + - " /**\n" + - " int.\n" + - " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + - " */\n" + - " void /* int */\n" + - " foo() {\n" + - " // int\n" + - " /* int */\n" + - " /** int */\n" + - " }\n" + - " /**\n" + - " int.\n" + - " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + - " */\n" + - " int field /* int */\n" + - " ;\n" + - " /*\n" + - " int\n" + - " */\n" + - " static {\n" + - " // int\n" + - " }\n" + - "}\n" + - "// int\n" + - "/* int */\n" + - "/** int */\n"; - - String testName = "<complete on comment>"; - String completeBehind = "i"; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = ""; - String expectedReplacedSource = NONE; - int cursorLocation = str.indexOf("int\n") + completeBehind.length() - 1; - String expectedUnitDisplayString = null; - - try { - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); - assertTrue("failed to detect invalid cursor location", false); - } catch(InvalidCursorLocation e){ - assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT); - } -} -public void testXA_1FGGUQF_1FHSL8H_3() { - String str = - "// int\n" + - "package p; \n" + - "/**\n" + - " * 1FGGUQF and 1FHSL8H\n" + - " */\n" + - "/**\n" + - " * int\n" + - " */\n" + - "/*\n" + - " * int\n" + - " */\n" + - "// int\n" + - "/**\n" + - "int.\n" + - " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + - " */\n" + - "/**\n" + - " * int\n" + - " */\n" + - "public class XA {\n" + - " // int\n" + - " /* int */\n" + - " /** int */\n" + - " /**\n" + - " int.\n" + - " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + - " */\n" + - " void /* int */ foo() {\n" + - " // int\n" + - " /* int */\n" + - " /** int */\n" + - " }\n" + - " /**\n" + - " int.\n" + - " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + - " */\n" + - " int field /* int */\n" + - " ;\n" + - " /*\n" + - " int\n" + - " */\n" + - " static {\n" + - " // int\n" + - " }\n" + - "}\n" + - "// int\n" + - "/* int */\n" + - "/** int */\n"; - - String testName = "<complete on comment>"; - String completeBehind = "i"; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = ""; - String expectedReplacedSource = NONE; - int cursorLocation = str.indexOf("int */") + completeBehind.length() - 1; - String expectedUnitDisplayString = null; - - try { - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); - assertTrue("failed to detect invalid cursor location", false); - } catch(InvalidCursorLocation e){ - assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT); - } -} -public void testXA_1FGGUQF_1FHSL8H_4() { - String str = - "// int\n" + - "package p; \n" + - "/**\n" + - " * 1FGGUQF and 1FHSL8H\n" + - " */\n" + - "/**\n" + - " * int\n" + - " */\n" + - "/*\n" + - " * int\n" + - " */\n" + - "// int\n" + - "/**\n" + - "int.\n" + - " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + - " */\n" + - "/**\n" + - " * int\n" + - " */\n" + - "public class XA {\n" + - " // int\n" + - " /* int */\n" + - " /** int */\n" + - " /**\n" + - " int.\n" + - " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + - " */\n" + - " void /* int */ foo() {\n" + - " // int\n" + - " /* int */\n" + - " /** int */\n" + - " }\n" + - " /**\n" + - " int.\n" + - " * Internal API used to resolve a compilation unit minimally for code assist engine\n" + - " */\n" + - " int field /* int */\n" + - " ;\n" + - " /*\n" + - " int\n" + - " */\n" + - " static {\n" + - " // int\n" + - " }\n" + - "}\n" + - "// int\n" + - "/* int */\n" + - "/** int */\n"; - - String testName = "<complete on comment>"; - String completeBehind = "i"; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = ""; - String expectedReplacedSource = NONE; - int cursorLocation = str.indexOf("int */ foo()") + completeBehind.length() - 1; - String expectedUnitDisplayString = null; - - try { - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); - assertTrue("failed to detect invalid cursor location", false); - } catch(InvalidCursorLocation e){ - assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT); - } -} -public void testXB_1FIYM5I_1() { - String str = - "package p; \n" + - "/*\n" + - " * 1FIYM5I\n" + - " */\n" + - "public class XB\n" + - " extends java.io.File {\n" + - " void foo() {\n" + - " XB xb = new XB();\n" + - " this.separator.;\n" + - " this.bar().;\n" + - " }\n" + - " String bar() {\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of explicit this access>"; - String completeBehind = "this.s"; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.s>"; - String completionIdentifier = "s"; - String expectedReplacedSource = "this.separator"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class XB extends java.io.File {\n" + - " public XB() {\n" + - " }\n" + - " void foo() {\n" + - " XB xb;\n" + - " <CompleteOnMemberAccess:this.s>;\n" + - " }\n" + - " String bar() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testXB_1FIYM5I_2() { - String str = - "package p; \n" + - "/*\n" + - " * 1FIYM5I\n" + - " */\n" + - "public class XB\n" + - " extends java.io.File {\n" + - " void foo() {\n" + - " XB xb = new XB();\n" + - " this.separator.;\n" + - " this.bar().;\n" + - " }\n" + - " String bar() {\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of explicitly accessed field>"; - String completeBehind = "this.separator."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.separator.>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class XB extends java.io.File {\n" + - " public XB() {\n" + - " }\n" + - " void foo() {\n" + - " XB xb;\n" + - " <CompleteOnMemberAccess:this.separator.>;\n" + - " }\n" + - " String bar() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testXB_1FIYM5I_3() { - String str = - "package p; \n" + - "/*\n" + - " * 1FIYM5I\n" + - " */\n" + - "public class XB\n" + - " extends java.io.File {\n" + - " void foo() {\n" + - " XB xb = new XB();\n" + - " this.separator.;\n" + - " this.bar().;\n" + - " }\n" + - " String bar() {\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of explicit this access>"; - String completeBehind = "this.b"; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.b>"; - String completionIdentifier = "b"; - String expectedReplacedSource = "this.bar"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class XB extends java.io.File {\n" + - " public XB() {\n" + - " }\n" + - " void foo() {\n" + - " XB xb;\n" + - " <CompleteOnMemberAccess:this.b>;\n" + - " }\n" + - " String bar() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testXB_1FIYM5I_4() { - String str = - "package p; \n" + - "/*\n" + - " * 1FIYM5I\n" + - " */\n" + - "public class XB\n" + - " extends java.io.File {\n" + - " void foo() {\n" + - " XB xb = new XB();\n" + - " this.separator.;\n" + - " this.bar().;\n" + - " }\n" + - " String bar() {\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field of explicitly accessed method>"; - String completeBehind = "this.bar()."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.bar().>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class XB extends java.io.File {\n" + - " public XB() {\n" + - " }\n" + - " void foo() {\n" + - " XB xb;\n" + - " <CompleteOnMemberAccess:this.bar().>;\n" + - " }\n" + - " String bar() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testY_1FGPESI() { - String str = - "package p; \n" + - "import p2.; \n" + - "/**\n" + - " * 1FGPESI\n" + - " */\n" + - "public class Y {\n" + - "}\n"; - - String testName = "<complete on imports>"; - String completeBehind = "p2."; - String expectedCompletionNodeToString = "<CompleteOnImport:p2.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "p2."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnImport:p2.>;\n" + - "public class Y {\n" + - " public Y() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testYA_1FGRIUH() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGRIUH\n" + - " */\n" + - "public class YA\n" + - " extends YASecondTopLevel {\n" + - " void eFoo() {\n" + - " }\n" + - " class YAMember {\n" + - " void eFoo() {\n" + - " }\n" + - " void eBar() {\n" + - " e }\n" + - " }\n" + - "}\n" + - "class YASecondTopLevel {\n" + - " public boolean equals(YA yaya) {\n" + - " return true;\n" + - " }\n" + - " public eFoo() {\n" + - " }\n" + - " public void eFooBar() {\n" + - " }\n" + - "}\n"; - - String testName = "<complete on method/field>"; - String completeBehind = "e"; - String expectedCompletionNodeToString = "<CompleteOnName:e>"; - String completionIdentifier = "e"; - String expectedReplacedSource = "e"; - int cursorLocation = str.indexOf("e }") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class YA extends YASecondTopLevel {\n" + - " class YAMember {\n" + - " YAMember() {\n" + - " }\n" + - " void eFoo() {\n" + - " }\n" + - " void eBar() {\n" + - " <CompleteOnName:e>;\n" + - " }\n" + - " }\n" + - " public YA() {\n" + - " }\n" + - " void eFoo() {\n" + - " }\n" + - "}\n" + - "class YASecondTopLevel {\n" + - " YASecondTopLevel() {\n" + - " }\n" + - " public boolean equals(YA yaya) {\n" + - " }\n" + - " public eFoo() {\n" + - " }\n" + - " public void eFooBar() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testYB_1FJ4D46_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FJ4D46\n" + - " */\n" + - "public class YB {\n" + - " void foo() {\n" + - " new String(\"asdf\".getBytes()).}\n" + - "}\n"; - - String testName = "<complete on method/field of object creation>"; - String completeBehind = "new String(\"asdf\".getBytes())."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:new String(\"asdf\".getBytes()).>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class YB {\n" + - " public YB() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:new String(\"asdf\".getBytes()).>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testZ_1FGPF3D_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGPF3D\n" + - " */\n" + - "public class Z imp Pro.Sev, \n" + - " Bla.Blo {\n" + - "}\n"; - - String testName = "<complete on implements keyword>"; - String completeBehind = "imp"; - String expectedCompletionNodeToString = "<CompleteOnKeyword:imp>"; - String completionIdentifier = "imp"; - String expectedReplacedSource = "imp"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class Z extends <CompleteOnKeyword:imp> {\n" + - " {\n" + - " }\n" + - " public Z() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testZ_1FGPF3D_2() { - String str = - "package p; \n" + - "/**\n" + - " * 1FGPF3D\n" + - " */\n" + - "public class Z implements Pro.Sev, \n" + - " Bla.Blo {\n" + - "}\n"; - - String testName = "<complete on implented interface>"; - String completeBehind = "P"; - String expectedCompletionNodeToString = "<CompleteOnInterface:P>"; - String completionIdentifier = "P"; - String expectedReplacedSource = "Pro"; - int cursorLocation = str.indexOf("Pro.Sev") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class Z implements <CompleteOnInterface:P>, Bla.Blo {\n" + - " public Z() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testZA_1() { - String str = - "package p; \n" + - "import java.util.Vector;\n"; - - String testName = "<complete on import keyword>"; - String completeBehind = "i"; - String expectedCompletionNodeToString = "<CompleteOnKeyword:i>"; - String completionIdentifier = "i"; - String expectedReplacedSource = "import"; - int cursorLocation = str.indexOf("import") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnKeyword:i>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testZA_2() { - String str = - "package p; \n" + - "import java.util.Vector;\n"; - - String testName = "<complete on imported package>"; - String completeBehind = "jav"; - String expectedCompletionNodeToString = "<CompleteOnImport:jav>"; - String completionIdentifier = "jav"; - String expectedReplacedSource = "java.util.Vector"; - int cursorLocation = str.indexOf("java.util.Vector") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnImport:jav>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testZA_3() { - String str = - "package p; \n" + - "import java.util.Vector;\n"; - - String testName = "<complete on imported type>"; - String completeBehind = "java.util.V"; - String expectedCompletionNodeToString = "<CompleteOnImport:java.util.V>"; - String completionIdentifier = "V"; - String expectedReplacedSource = "java.util.Vector"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnImport:java.util.V>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testZB_1FJ4D46_1() { - String str = - "package p; \n" + - "/**\n" + - " * 1FJ4D46\n" + - " */\n" + - "import java.util.zip.CRC32;\n" + - "import java.io.*;\n" + - "public class ZB {\n" + - " public static void main(\n" + - " java.lang.String[] args) {\n" + - " File file = \n" + - " new File(\"d:\\\\314\"); \n" + - " CRC32 crc = new CRC32();\n" + - " file.}\n" + - "}\n"; - - String testName = "<complete on method/field of local variable>"; - String completeBehind = "file."; - String expectedCompletionNodeToString = "<CompleteOnName:file.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "file."; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "import java.util.zip.CRC32;\n" + - "import java.io.*;\n" + - "public class ZB {\n" + - " public ZB() {\n" + - " }\n" + - " public static void main(java.lang.String[] args) {\n" + - " File file;\n" + - " CRC32 crc;\n" + - " <CompleteOnName:file.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void testZB_1FJ4D46_2() { - String str = - "package p; \n" + - "/**\n" + - " * 1FJ4D46\n" + - " */\n" + - "import java.util.zip.CRC32;\n" + - "import java.io.*;\n" + - "public class ZB {\n" + - " public static void main(\n" + - " java.lang.String[] args) {\n" + - " File file = \n" + - " new File(\"d:\\\\314\"); \n" + - " CRC32 crc = new CRC32();\n" + - " file.}\n" + - "}\n"; - - String testName = "<complete on local variable type>"; - String completeBehind = "CRC"; - String expectedCompletionNodeToString = "<CompleteOnName:CRC>"; - String completionIdentifier = "CRC"; - String expectedReplacedSource = "CRC32"; - int cursorLocation = str.indexOf("CRC32 crc") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "import java.util.zip.CRC32;\n" + - "import java.io.*;\n" + - "public class ZB {\n" + - " public ZB() {\n" + - " }\n" + - " public static void main(java.lang.String[] args) {\n" + - " File file;\n" + - " <CompleteOnName:CRC>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * Complete in initializer - */ -public void test001(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " int v1;\n" + - " {\n" + - " Obj\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete in initializer>"; - String completeBehind = "Obj"; - String expectedCompletionNodeToString = "<CompleteOnName:Obj>"; - String completionIdentifier = "Obj"; - String expectedReplacedSource = "Obj"; - int cursorLocation = str.indexOf("Obj") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int v1;\n" + - " {\n" + - " <CompleteOnName:Obj>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * Complete after initializer - */ -public void test002(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " int v1;\n" + - " {\n" + - " int v2\n" + - " }\n" + - " Obj" + - " }\n" + - "}\n"; - - String testName = "<complete after initializer>"; - String completeBehind = "Obj"; - String expectedCompletionNodeToString = "<CompleteOnName:Obj>"; - String completionIdentifier = "Obj"; - String expectedReplacedSource = "Obj"; - int cursorLocation = str.indexOf("Obj") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int v1;\n" + - " <CompleteOnName:Obj>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * Complete in initializer - */ -public void test003(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " int v1;\n" + - " {\n" + - " this.\n" + - " }\n" + - " }\n" + - "}\n"; - - String testName = "<complete in initializer>"; - String completeBehind = "this."; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.>"; - String completionIdentifier = ""; - String expectedReplacedSource = "this."; - int cursorLocation = str.indexOf("this.") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int v1;\n" + - " {\n" + - " <CompleteOnMemberAccess:this.>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} - -/** - * Complete in switch - */ -public void test004(){ - String str = - "public class X {\n" + - " final static int ZZZ = 1;\n"+ - " void foo(){\n" + - " switch(2)\n" + - " case 0 + ZZZ :\n" + - " case 1 + ZZZ :\n" + - " bar(ZZZ)\n" + - " }\n" + - " void bar(int y) {}\n"+ - "}\n"; - - String testName = "<complete in switch>"; - String completeBehind = "ZZZ"; - String expectedCompletionNodeToString = "<CompleteOnName:ZZZ>"; - String completionIdentifier = "ZZZ"; - String expectedReplacedSource = "ZZZ"; - int cursorLocation = str.lastIndexOf("ZZZ") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class X {\n" + - " static final int ZZZ;\n" + - " <clinit>() {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " bar(<CompleteOnName:ZZZ>);\n" + - " }\n" + - " void bar(int y) {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * Complete in method type. - */ -public void test005(){ - String str = - "public class X {\n" + - " clon foo(){\n" + - " }\n" + - "}\n"; - - String testName = "<complete in method type>"; - String completeBehind = "clon"; - String expectedCompletionNodeToString = "<CompleteOnType:clon>"; - String completionIdentifier = "clon"; - String expectedReplacedSource = "clon"; - int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " <CompleteOnType:clon>\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * Complete in method type. - */ -public void test006(){ - String str = - "public class X {\n" + - " clon\n" + - " foo();\n" + - "}\n"; - - String testName = "<complete in method type>"; - String completeBehind = "clon"; - String expectedCompletionNodeToString = "<CompleteOnType:clon>;"; - String completionIdentifier = "clon"; - String expectedReplacedSource = "clon"; - int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:clon>;\n" + - " public X() {\n" + - " }\n" + - " foo();\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * Complete in field type. - */ -public void test007(){ - String str = - "public class X {\n" + - " clon x;\n" + - "}\n"; - - String testName = "<complete in field type>"; - String completeBehind = "clon"; - String expectedCompletionNodeToString = "<CompleteOnType:clon>;"; - String completionIdentifier = "clon"; - String expectedReplacedSource = "clon"; - int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:clon>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * Complete in field type. - */ -public void test008(){ - String str = - "public class X {\n" + - " clon\n" + - " x;\n" + - "}\n"; - - String testName = "<complete in field type>"; - String completeBehind = "clon"; - String expectedCompletionNodeToString = "<CompleteOnType:clon>;"; - String completionIdentifier = "clon"; - String expectedReplacedSource = "clon"; - int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:clon>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * Complete in field type. - */ -public void test009(){ - String str = - "public class X {\n" + - " clon\n" + - " x y;\n" + - "}\n"; - - String testName = "<complete in field tpye>"; - String completeBehind = "clon"; - String expectedCompletionNodeToString = "<CompleteOnType:clon>;"; - String completionIdentifier = "clon"; - String expectedReplacedSource = "clon"; - int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:clon>;\n" + - " x y;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * Complete in method type. - */ -public void test010(){ - String str = - "public class X {\n" + - " clon\n" + - " x y(){}\n" + - "}\n"; - - String testName = "<complete in method type>"; - String completeBehind = "clon"; - String expectedCompletionNodeToString = "<CompleteOnType:clon>;"; - String completionIdentifier = "clon"; - String expectedReplacedSource = "clon"; - int cursorLocation = str.lastIndexOf("clon") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:clon>;\n" + - " public X() {\n" + - " }\n" + - " x y() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=25233 - */ -public void test011(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " new Object[]{\n" + - " bar(zzz)\n" + - " };\n" + - " }\n" + - "}\n"; - - String testName = "<bug 25233>"; - String completeBehind = "zzz"; - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - int cursorLocation = str.lastIndexOf("zzz") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " bar(<CompleteOnName:zzz>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=27370 - */ -public void test012(){ - String str = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " Object o = new ZZZ\n" + - "}\n"; - - String testName = "<bug 27370>"; - String completeBehind = "ZZZ"; - String expectedCompletionNodeToString = "<CompleteOnType:ZZZ>"; - String completionIdentifier = "ZZZ"; - String expectedReplacedSource = "ZZZ"; - int cursorLocation = str.lastIndexOf("ZZZ") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class X {\n" + - " Object o = new <CompleteOnType:ZZZ>();\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=27735 - */ -public void test013(){ - String str = - "public class Bar {\n" + - " #\n" + - " Bar foo1 = new Bar(){};\n" + - " {int i;}\n" + - " synchronized void foo3() {}\n" + - " zzz\n" + - "}\n"; - - String testName = "<bug 27735>"; - String completeBehind = "zzz"; - String expectedCompletionNodeToString = "<CompleteOnType:zzz>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - int cursorLocation = str.lastIndexOf("zzz") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class Bar {\n" + - " Bar foo1;\n" + - " {\n" + - " }\n" + - " <CompleteOnType:zzz>;\n" + - " public Bar() {\n" + - " }\n" + - " synchronized void foo3() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=27941 - */ -public void test014(){ - String str = - "public class Bar {\n" + - " void foo() {\n" + - " String s = \"a\" + \"b\";\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String testName = "<bug 27941>"; - String completeBehind = "zzz"; - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - int cursorLocation = str.lastIndexOf("zzz") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class Bar {\n" + - " public Bar() {\n" + - " }\n" + - " void foo() {\n" + - " String s;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=39502 - */ -public void test015(){ - String str = - "public class Bar {\n" + - " void foo() {\n" + - " Object o = new Object[]{};\n" + - " foo();\n" + - " }\n" + - "}\n"; - - String testName = "<bug 39502>"; - String completeBehind = "foo("; - String expectedCompletionNodeToString = "<CompleteOnMessageSend:foo()>"; - String completionIdentifier = ""; - String expectedReplacedSource = "foo("; - int cursorLocation = str.lastIndexOf("foo(") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class Bar {\n" + - " public Bar() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " <CompleteOnMessageSend:foo()>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/** - * http://dev.eclipse.org/bugs/show_bug.cgi?id=39502 - */ -public void test016(){ - String str = - "public class Bar {\n" + - " void foo() {\n" + - " Object o = new Object[0];\n" + - " foo();\n" + - " }\n" + - "}\n"; - - String testName = "<bug 39502>"; - String completeBehind = "foo("; - String expectedCompletionNodeToString = "<CompleteOnMessageSend:foo()>"; - String completionIdentifier = ""; - String expectedReplacedSource = "foo("; - int cursorLocation = str.lastIndexOf("foo(") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class Bar {\n" + - " public Bar() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " <CompleteOnMessageSend:foo()>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} - -public void test017(){ - String str = - "public class Bar {\n" + - " String s;\n" + - " /**/\n" + - "}\n"; - - String testName = ""; - String completeBehind = "/**/"; - String expectedCompletionNodeToString = "<CompleteOnType:>"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - int cursorLocation = str.lastIndexOf("/**/") + completeBehind.length() - 1; - String expectedUnitDisplayString = - "public class Bar {\n" + - " String s;\n" + - " <CompleteOnType:>;\n" + - " public Bar() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} - -public void testRECOVERY001() { - String str = - "var foo;\n" + - "if (f) {\n"; - - String testName = "<complete on name inside if>"; - String completeBehind = "(f"; - String expectedCompletionNodeToString = "<CompleteOnName:f>"; - String completionIdentifier = "f"; - String expectedReplacedSource = "f"; - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - String expectedUnitDisplayString = - "var foo;\n" + - "if (<CompleteOnName:f>)\n" + - "\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} - -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTest2.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTest2.java deleted file mode 100644 index 866e47b..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTest2.java +++ /dev/null
@@ -1,9671 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import junit.framework.Test; - -public class CompletionParserTest2 extends AbstractCompletionTest { -public CompletionParserTest2(String testName) { - super(testName); -} -public static Test suite() { - return buildAllCompliancesTestSuite(CompletionParserTest2.class); -} -public void test0001(){ - String str = - "package p;\n" + - "public class X {\n" + - " Object o = zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "Object o = <CompleteOnName:zzz>;"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o = <CompleteOnName:zzz>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -public void test0002(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "Object o = <CompleteOnName:zzz>;"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = <CompleteOnName:zzz>;\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0003(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o = zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "Object o = <CompleteOnName:zzz>;"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o = <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0004(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " Object o = zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "Object o = <CompleteOnName:zzz>;"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o = <CompleteOnName:zzz>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -public void test0005(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object o = zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "Object o = <CompleteOnName:zzz>;"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object o = <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0006(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " Object o = zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "Object o = <CompleteOnName:zzz>;"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o = <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0007(){ - String str = - "package p;\n" + - "public class X {\n" + - " Object o = new zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:zzz>"; - String expectedParentNodeToString = "Object o = new <CompleteOnType:zzz>();"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o = new <CompleteOnType:zzz>();\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -public void test0008(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = new zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnType:zzz>"; - expectedParentNodeToString = "Object o = new <CompleteOnType:zzz>();"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = new <CompleteOnType:zzz>();\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0009(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o = new zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnType:zzz>"; - expectedParentNodeToString = "Object o = new <CompleteOnType:zzz>();"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o = new <CompleteOnType:zzz>();\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0010(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " Object o = new zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:zzz>"; - String expectedParentNodeToString = "Object o = new <CompleteOnType:zzz>();"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o = new <CompleteOnType:zzz>();\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -public void test0011(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object o = new zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnType:zzz>"; - expectedParentNodeToString = "Object o = new <CompleteOnType:zzz>();"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object o = new <CompleteOnType:zzz>();\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0012(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " Object o = new zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnType:zzz>"; - expectedParentNodeToString = "Object o = new <CompleteOnType:zzz>();"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o = new <CompleteOnType:zzz>();\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0013(){ - String str = - "package p;\n" + - "public class X {\n" + - " Object o = yyy;\n" + - " zzz\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:zzz>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o;\n" + - " <CompleteOnType:zzz>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - -public void test0014(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = yyy;\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0015(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o = yyy;\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0016(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " Object o = yyy;\n" + - " zzz\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:zzz>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o;\n" + - " <CompleteOnType:zzz>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - -public void test0017(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object o = yyy;\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object o;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0018(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " Object o = yyy;\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0019(){ - String str = - "package p;\n" + - "public class X {\n" + - " Object o = bar(zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "bar(<CompleteOnName:zzz>)"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o = bar(<CompleteOnName:zzz>);\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - -public void test0020(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = bar(zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "bar(<CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = bar(<CompleteOnName:zzz>);\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0021(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o = bar(zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "bar(<CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o = bar(<CompleteOnName:zzz>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0022(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " Object o = bar(zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "bar(<CompleteOnName:zzz>)"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o = bar(<CompleteOnName:zzz>);\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - -public void test0023(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object o = bar(zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "bar(<CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object o = bar(<CompleteOnName:zzz>);\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0024(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " Object o = bar(zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "bar(<CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o = bar(<CompleteOnName:zzz>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0025(){ - String str = - "package p;\n" + - "public class X {\n" + - " Object o = new X(zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X(<CompleteOnName:zzz>)"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o = new X(<CompleteOnName:zzz>);\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - - -public void test0026(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = new X(zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X(<CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = new X(<CompleteOnName:zzz>);\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0027(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o = new X(zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X(<CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o = new X(<CompleteOnName:zzz>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0028(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " Object o = new X(zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X(<CompleteOnName:zzz>)"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o = new X(<CompleteOnName:zzz>);\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - - -public void test0029(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object o = new X(zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X(<CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object o = new X(<CompleteOnName:zzz>);\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0030(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " Object o = new X(zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X(<CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o = new X(<CompleteOnName:zzz>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0031(){ - String str = - "package p;\n" + - "public class X {\n" + - " Object o = {zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o;\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0032(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = {zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0033(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o = {zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0034(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " Object o = {zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o;\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0035(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object o = {zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0036(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " Object o = {zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0037(){ - String str = - "package p;\n" + - "public class X {\n" + - " Object[] o = {zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "Object[] o = {<CompleteOnName:zzz>};"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object[] o = {<CompleteOnName:zzz>};\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - - -public void test0038(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object[] o = {zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "Object[] o = {<CompleteOnName:zzz>};"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object[] o = {<CompleteOnName:zzz>};\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0039(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object[] o = {zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "Object[] o = {<CompleteOnName:zzz>};"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] o = {<CompleteOnName:zzz>};\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0040(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " Object[] o = {zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "Object[] o = {<CompleteOnName:zzz>};"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object[] o = {<CompleteOnName:zzz>};\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - - -public void test0041(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object[] o = {zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "Object[] o = {<CompleteOnName:zzz>};"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object[] o = {<CompleteOnName:zzz>};\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0042(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " Object[] o = {zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "Object[] o = {<CompleteOnName:zzz>};"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] o = {<CompleteOnName:zzz>};\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0043(){ - String str = - "package p;\n" + - "public class X {\n" + - " Object[] o = new X[zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X[<CompleteOnName:zzz>]"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object[] o = new X[<CompleteOnName:zzz>];\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - - - -public void test0044(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object[] o = new X[zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object[] o = new X[<CompleteOnName:zzz>];\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - - -public void test0045(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object[] o = new X[zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] o = new X[<CompleteOnName:zzz>];\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - - -public void test0046(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " Object[] o = new X[zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X[<CompleteOnName:zzz>]"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object[] o = new X[<CompleteOnName:zzz>];\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - - - -public void test0047(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object[] o = new X[zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object[] o = new X[<CompleteOnName:zzz>];\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - - -public void test0048(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " Object[] o = new X[zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] o = new X[<CompleteOnName:zzz>];\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0049(){ - String str = - "package p;\n" + - "public class X {\n" + - " Object[] o = new X[]{zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object[] o = new X[]{<CompleteOnName:zzz>};\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -public void test0050(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object[] o = new X[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object[] o = new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0051(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object[] o = new X[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] o = new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0052(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " Object[] o = new X[]{zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object[] o = new X[]{<CompleteOnName:zzz>};\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -public void test0053(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object[] o = new X[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object[] o = new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0054(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " Object[] o = new X[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] o = new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0055(){ - String str = - "package p;\n" + - "public class X {\n" + - " Object[] o = zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "Object[] o = <CompleteOnName:zzz>;"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object[] o = <CompleteOnName:zzz>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - -public void test0056(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object[] o = zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "Object[] o = <CompleteOnName:zzz>;"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object[] o = <CompleteOnName:zzz>;\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0057(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object[] o = zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "Object[] o = <CompleteOnName:zzz>;"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] o = <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0058(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " Object[] o = zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "Object[] o = <CompleteOnName:zzz>;"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object[] o = <CompleteOnName:zzz>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - -public void test0059(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object[] o = zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "Object[] o = <CompleteOnName:zzz>;"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object[] o = <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0060(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " Object[] o = zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "Object[] o = <CompleteOnName:zzz>;"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object[] o = <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0061(){ - String str = - "package p;\n" + - "public class X {\n" + - " Object o = new X[zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X[<CompleteOnName:zzz>]"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o = new X[<CompleteOnName:zzz>];\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - -public void test0062(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = new X[zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = new X[<CompleteOnName:zzz>];\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0063(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o = new X[zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o = new X[<CompleteOnName:zzz>];\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0064(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " Object o = new X[zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X[<CompleteOnName:zzz>]"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o = new X[<CompleteOnName:zzz>];\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - -public void test0065(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object o = new X[zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object o = new X[<CompleteOnName:zzz>];\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0066(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " Object o = new X[zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o = new X[<CompleteOnName:zzz>];\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0067(){ - String str = - "package p;\n" + - "public class X {\n" + - " Object o = new X[]{zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o;\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0068(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = new X[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0069(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o = new X[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o = new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0070(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " Object o = new X[]{zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o;\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0071(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object o = new X[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0072(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " Object o = new X[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0073(){ - String str = - "package p;\n" + - "public class X {\n" + - " int o = new int[zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new int[<CompleteOnName:zzz>]"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " int o = new int[<CompleteOnName:zzz>];\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - - -public void test0074(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " int o = new int[zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new int[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " int o = new int[<CompleteOnName:zzz>];\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0075(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " int o = new int[zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new int[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int o = new int[<CompleteOnName:zzz>];\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0076(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " int o = new int[zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new int[<CompleteOnName:zzz>]"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " int o = new int[<CompleteOnName:zzz>];\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - - -public void test0077(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " int o = new int[zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new int[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " int o = new int[<CompleteOnName:zzz>];\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0078(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " int o = new int[zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new int[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int o = new int[<CompleteOnName:zzz>];\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0079(){ - String str = - "package p;\n" + - "public class X {\n" + - " int o = new int[]{zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " int o;\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " int o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0080(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " int o = new int[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>}"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " int o = new int[]{<CompleteOnName:zzz>};\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0081(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " int o = new int[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>}"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " new int[]{<CompleteOnName:zzz>};\n" + - " }\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>}"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int o = new int[]{<CompleteOnName:zzz>};\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0082(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " int o = new int[]{zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " int o;\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " int o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0083(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " int o = new int[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " int o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0084(){ - - - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " int o = new int[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new int[]{<CompleteOnName:zzz>}"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " new int[]{<CompleteOnName:zzz>};\n" + - " }\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0085(){ - String str = - "package p;\n" + - "public class X {\n" + - " X o = new X[]{zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " X o;\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " X o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0086(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " X o = new X[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " X o = new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0087(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " X o = new X[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " X o = new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0088(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " X o = new X[]{zzz;\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " X o;\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " X o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0089(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " X o = new X[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " X o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0090(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " X o = new X[]{zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "new X[]{<CompleteOnName:zzz>}"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " new X[]{<CompleteOnName:zzz>};\n" + - " }\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " X o;\n" + - " {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0091(){ - String str = - "package p;\n" + - "public class X {\n" + - " Object o = \"yyy;\n" + - " zzz\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:zzz>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o;\n" + - " <CompleteOnType:zzz>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - - -public void test0092(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o = \"yyy;\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " Object o;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0093(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o = \"yyy;\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0094(){ - String str = - "package p;\n" + - "public class X {\n" + - " #\n" + - " Object o = \"yyy;\n" + - " zzz\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:zzz>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " Object o;\n" + - " <CompleteOnType:zzz>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} - - -public void test0095(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object o = \"yyy;\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object o;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - - -public void test0096(){ - String str = - "package p;\n" + - "public class X {\n" + - " {\n" + - " #\n" + - " Object o = \"yyy;\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " {\n" + - " {\n" + - " Object o;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0097(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o;\n" + - " o = zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "o = <CompleteOnName:zzz>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " o = <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0098(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o;\n" + - " o = zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "o = <CompleteOnName:zzz>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " o = <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0099(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o;\n" + - " o = new zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnType:zzz>"; - expectedParentNodeToString = "o = new <CompleteOnType:zzz>()"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " o = new <CompleteOnType:zzz>();\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0100(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o;\n" + - " o = new zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnType:zzz>"; - expectedParentNodeToString = "o = new <CompleteOnType:zzz>()"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " o = new <CompleteOnType:zzz>();\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0101(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o;\n" + - " o = yyy;\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0102(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o;\n" + - " o = yyy;\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0103(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o;\n" + - " o = \"yyy;\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0104(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " Object o;\n" + - " o = \"yyy;\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} - -public void test0105(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " int x = 1 + zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "(1 + <CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int x = (1 + <CompleteOnName:zzz>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0106(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " int x = 1 + (zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "(1 + <CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int x = (1 + <CompleteOnName:zzz>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0107(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " int x = 0;\n" + - " int y = 1 + x;\n" + - " zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int x;\n" + - " int y;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0108(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " int x = -zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "(- <CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int x = (- <CompleteOnName:zzz>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0109(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " int x = -(zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "(- <CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int x = (- <CompleteOnName:zzz>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0110(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " int x = 0;\n" + - " int y = -x;\n" + - " zzz;\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int x;\n" + - " int y;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0111(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " if(1 == zzz) {}\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "(1 == <CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " (1 == <CompleteOnName:zzz>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0112(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " if(1 == (zzz)) {}\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "(1 == <CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " (1 == <CompleteOnName:zzz>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0113(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(Object x){\n" + - " if(x instanceof ZZZ) {}\n" + - " }\n" + - "}\n"; - - String completeBehind = "ZZZ"; - int cursorLocation = str.indexOf("ZZZ") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo(Object x) {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnType:ZZZ>"; - expectedParentNodeToString = "(x instanceof <CompleteOnType:ZZZ>)"; - completionIdentifier = "ZZZ"; - expectedReplacedSource = "ZZZ"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo(Object x) {\n" + - " (x instanceof <CompleteOnType:ZZZ>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0114(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " boolean a, b, c;\n" + - " c = a == b ? zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "c = <CompleteOnName:zzz>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " boolean a;\n" + - " boolean b;\n" + - " boolean c;\n" + - " c = <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0115(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " boolean a, b;\n" + - " a == b ? zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " boolean a;\n" + - " boolean b;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0116(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " boolean a, b, c;\n" + - " c = a == b ? a : zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "c = ((a == b) ? a : <CompleteOnName:zzz>)"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " boolean a;\n" + - " boolean b;\n" + - " boolean c;\n" + - " c = ((a == b) ? a : <CompleteOnName:zzz>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0117(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " boolean a, b, c;\n" + - " c = a == b ? a : (zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "c = <CompleteOnName:zzz>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " boolean a;\n" + - " boolean b;\n" + - " boolean c;\n" + - " c = <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0118(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " boolean a, b, c;\n" + - " c = a# == b ? a : zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " boolean a;\n" + - " boolean b;\n" + - " boolean c;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0119(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " switch(1) {\n" + - " case zzz\n" + - " }\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = - "switch (1) {\n" + - "case <CompleteOnName:zzz> : ;\n" + - "}"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " switch (1) {\n" + - " case <CompleteOnName:zzz> : ;\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0120(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " switch(1) {\n" + - " case Something :\n" + - " case zzz\n" + - " }\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = - "switch (1) {\n" + - "case Something : ;\n" + - "case <CompleteOnName:zzz> : ;\n" + - "}"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " switch (1) {\n" + - " case Something : ;\n" + - " case <CompleteOnName:zzz> : ;\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0121(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " tab[zzz]\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "tab[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " tab[<CompleteOnName:zzz>];\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0122(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " tab[].zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnClassLiteralAccess:tab[].zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "tab[].zzz"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnClassLiteralAccess:tab[].zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0123(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " tab[0].zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnMemberAccess:tab[0].zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:tab[0].zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0124(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " foo()[zzz]\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "foo()[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " foo()[<CompleteOnName:zzz>];\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0125(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " foo()[].zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0126(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " foo()[1].zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnMemberAccess:foo()[1].zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:foo()[1].zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0127(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " if (zzz() == null) bar = null;\n" + - " }\n" + - " Object o = new O();\n" + - "}\n"; - - String completeBehind = "O"; - int cursorLocation = str.lastIndexOf("O") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:O>"; - String expectedParentNodeToString = "Object o = new <CompleteOnType:O>();"; - String completionIdentifier = "O"; - String expectedReplacedSource = "O"; - String expectedUnitDisplayString = - "public class X {\n" + - " Object o = new <CompleteOnType:O>();\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -public void test0128(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " new Object() {\n" + - " void bar() {\n" + - " a[zzz\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "a[<CompleteOnName:zzz>]"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " new Object() {\n" + - " void bar() {\n" + - " a[<CompleteOnName:zzz>];\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0129(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " Object local;\n" + - " double bar;\n" + - " for(;;) {\n" + - " bar = (double)0;\n" + - " }\n" + - " zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "zzz"; - expectedReplacedSource = "zzz"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Object local;\n" + - " double bar;\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=42856 - */ -public void test0130(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " A.B c = null;\n" + - " zzz();\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz("; - int cursorLocation = str.indexOf("zzz(") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnMessageSend:zzz()>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = ""; - expectedReplacedSource = "zzz("; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " A.B c;\n" + - " <CompleteOnMessageSend:zzz()>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=42856 - */ -public void test0131(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " try {\n" + - " } catch(A.B e) {\n" + - " zzz();\n" + - " }\n" + - " }\n" + - "}\n"; - - String completeBehind = "zzz("; - int cursorLocation = str.indexOf("zzz(") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnMessageSend:zzz()>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = ""; - expectedReplacedSource = "zzz("; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " A.B e;\n" + - " <CompleteOnMessageSend:zzz()>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=44647 - */ -public void test0132(){ - String str = - "public class A\n" + - "{\n" + - " public A(final String str1, final String str2)\n" + - " {\n" + - " \n" + - " }\n" + - " \n" + - " private A[] methodA(final String str1, final String str2)\n" + - " {\n" + - " return new A[]\n" + - " {\n" + - " new A(str1, str2)\n" + - " {\n" + - " //initialiser!\n" + - " {\n" + - " methodA(\"1\", \"2\");\n" + - " }\n" + - " },\n" + - " new A(\"hello\".c) //<--------code complete to \"hello\".concat()\n" + - " };\n" + - " \n" + - " }\n" + - "}\n"; - - - String completeBehind = "\"2\");"; - int cursorLocation = str.indexOf("\"2\");") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class A {\n" + - " public A(final String str1, final String str2) {\n" + - " }\n" + - " private A[] methodA(final String str1, final String str2) {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = ""; - expectedReplacedSource = ""; - expectedUnitDisplayString = - "public class A {\n" + - " public A(final String str1, final String str2) {\n" + - " }\n" + - " private A[] methodA(final String str1, final String str2) {\n" + - " new A(str1, str2) {\n" + - " {\n" + - " <CompleteOnName:>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=46470 - */ -public void test0133(){ - String str = - "public class X {\n" + - " int x;\n" + - " void foo() {\n" + - " switch(x){\n" + - " case 0:\n" + - " break;\n" + - " }\n" + - " bar\n" + - " }\n" + - "}\n"; - - - String completeBehind = "bar"; - int cursorLocation = str.indexOf("bar") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " int x;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:bar>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "bar"; - expectedReplacedSource = "bar"; - expectedUnitDisplayString = - "public class X {\n" + - " int x;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:bar>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=43212 - */ -public void test0134(){ - String str = - "public class X {\n" + - " Object o = new Object() {\n" + - " void foo() {\n" + - " try {\n" + - " } catch(Exception e) {\n" + - " e.\n" + - " }\n" + - " }\n" + - " };\n" + - "}\n"; - - - String completeBehind = "e."; - int cursorLocation = str.indexOf("e.") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<CompleteOnName:e.>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = ""; - String expectedReplacedSource = "e."; - String expectedUnitDisplayString = - "public class X {\n" + - " Object o = new Object() {\n" + - " void foo() {\n" + - " {\n" + - " Exception e;\n" + - " <CompleteOnName:e.>;\n" + - " }\n" + - " }\n" + - " };\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=43212 - */ -public void test0135(){ - String str = - "public class X {\n" + - " void bar(){\n" + - " #\n" + - " class Inner {\n" + - " void foo() {\n" + - " try {\n" + - " } catch(Exception e) {\n" + - " e.\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - - String completeBehind = "e."; - int cursorLocation = str.indexOf("e.") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:e.>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = ""; - expectedReplacedSource = "e."; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void bar() {\n" + - " class Inner {\n" + - " Inner() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " Exception e;\n" + - " <CompleteOnName:e.>;\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48070 - */ -public void test0136(){ - String str = - "public class X {\n" + - " void bar(){\n" + - " }\n" + - "}\n"; - - - String completeBehind = "ba"; - int cursorLocation = str.indexOf("ba") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<CompletionOnMethodName:void ba()>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ba"; - String expectedReplacedSource = "bar()"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " <CompletionOnMethodName:void ba()>\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=53624 - */ -public void test0137(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " new Object(){\n" + - " void bar(){\n" + - " super.zzz();\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - - String completeBehind = "zzz("; - int cursorLocation = str.indexOf("zzz(") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnMessageSend:super.zzz()>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = ""; - expectedReplacedSource = "zzz("; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " new Object() {\n" + - " void bar() {\n" + - " <CompleteOnMessageSend:super.zzz()>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=41395 - */ -public void test0138(){ - String str = - "public class X{\n" + - " public void foo() {\n" + - " new Y() {\n" + - " public void bar() {\n" + - " switch (zzz){\n" + - " case 1 :\n" + - " };\n" + - " }\n" + - " new Z() {\n" + - " public void toto() { \n" + - " }\n" + - " });\n" + - " });\n" + - " }\n" + - "}\n" + - "\n"; - - - String completeBehind = "to"; - int cursorLocation = str.indexOf("to") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnFieldName:void to>;"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "to"; - expectedReplacedSource = "toto"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " new Y() {\n" + - " public void bar() {\n" + - " new Z() {\n" + - " <CompleteOnFieldName:void to>;\n" + - " {\n" + - " }\n" + - " };\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0139(){ - String str = - "public class X extends Z. # {\n" + - "}"; - - - String completeBehind = "Z."; - int cursorLocation = str.indexOf("Z.") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<CompleteOnClass:Z.>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = ""; - String expectedReplacedSource = "Z."; - String expectedUnitDisplayString = - "public class X extends <CompleteOnClass:Z.> {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n" - ; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=32061 - */ -public void test0140(){ - String str = - "public class X {\n" + - " public void baz() {\n" + - " new Object() {\n" + - " public void bar() {\n" + - " }\n" + - " };\n" + - " }\n" + - " private Object var = new Object() {\n" + - " public void foo(Object e) {\n" + - " e.\n" + - " }\n" + - " };\n" + - "}"; - - - String completeBehind = "e."; - int cursorLocation = str.indexOf("e.") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<CompleteOnName:e.>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = ""; - String expectedReplacedSource = "e."; - String expectedUnitDisplayString = - "public class X {\n" + - " private Object var = new Object() {\n" + - " public void foo(Object e) {\n" + - " <CompleteOnName:e.>;\n" + - " }\n" + - " };\n" + - " public X() {\n" + - " }\n" + - " public void baz() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=32061 - */ -public void test0141(){ - String str = - "public class X {\n" + - " Object var1 = new Object() {};\n" + - " void bar() {\n" + - " new Object() {};\n" + - " bar();\n" + - " }\n" + - " Object var2 = new \n" + - "}"; - - - String completeBehind = "var2 = new "; - int cursorLocation = str.indexOf("var2 = new ") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<CompleteOnType:>"; - String expectedParentNodeToString = "Object var2 = new <CompleteOnType:>();"; - String completionIdentifier = ""; - String expectedReplacedSource = ""; - String expectedUnitDisplayString = - "public class X {\n" + - " Object var1;\n" + - " Object var2 = new <CompleteOnType:>();\n" + - " public X() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=39499 - */ -public void test0142(){ - String str = - "public class X{\n" + - " public void foo() {\n" + - " bar(new Object(){\n" + - " public void toto() {\n" + - " if(a instanceof Object) {}\n" + - " }\n" + - " });\n" + - " }\n" + - "}\n" + - "\n"; - - - String completeBehind = "instanceof"; - int cursorLocation = str.indexOf("instanceof") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnKeyword:instanceof>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "instanceof"; - expectedReplacedSource = "instanceof"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " new Object() {\n" + - " public void toto() {\n" + - " <CompleteOnKeyword:instanceof>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=71702 - */ -public void test0143(){ - String str = - "public class X{\n" + - " public void foo() {\n" + - " Object o =(int) tmp;\n" + - " bar\n" + - " }\n" + - "}\n" + - "\n"; - - - String completeBehind = "bar"; - int cursorLocation = str.indexOf("bar") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:bar>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "bar"; - expectedReplacedSource = "bar"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " Object o;\n" + - " <CompleteOnName:bar>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=71702 - */ -public void test0144(){ - String str = - "public class X{\n" + - " public void foo() {\n" + - " Object o =(int[]) tmp;\n" + - " bar\n" + - " }\n" + - "}\n" + - "\n"; - - - String completeBehind = "bar"; - int cursorLocation = str.indexOf("bar") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:bar>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "bar"; - expectedReplacedSource = "bar"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " Object o;\n" + - " <CompleteOnName:bar>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=71702 - */ -public void test0145(){ - String str = - "public class X{\n" + - " public void foo() {\n" + - " Object o =(X) tmp;\n" + - " bar\n" + - " }\n" + - "}\n" + - "\n"; - - - String completeBehind = "bar"; - int cursorLocation = str.indexOf("bar") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:bar>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "bar"; - expectedReplacedSource = "bar"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " Object o;\n" + - " <CompleteOnName:bar>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=71702 - */ -public void test0146(){ - String str = - "public class X{\n" + - " public void foo() {\n" + - " Object o =(X[]) tmp;\n" + - " bar\n" + - " }\n" + - "}\n" + - "\n"; - - - String completeBehind = "bar"; - int cursorLocation = str.indexOf("bar") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:bar>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "bar"; - expectedReplacedSource = "bar"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " Object o;\n" + - " <CompleteOnName:bar>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=72352 - */ -public void test0147(){ - String str = - "public class Test {\n" + - " Object m;\n" + - " String[] values = (String[]) m;\n" + - " lo\n" + - " }"; - - String completeBehind = "lo"; - int cursorLocation = str.indexOf("lo") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<CompleteOnType:lo>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "lo"; - String expectedReplacedSource = "lo"; - String expectedUnitDisplayString = - "public class Test {\n" + - " Object m;\n" + - " String[] values;\n" + - " <CompleteOnType:lo>;\n" + - " public Test() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=83236 - */ -public void test0148(){ - String str = - "public class Test {\n" + - " Boolean\n" + - " * some text <b>bold<i>both</i></b>\n" + - " */\n" + - " public void foo(String s) {\n" + - " }\n" + - "}\n"; - - String completeBehind = "Boolean"; - int cursorLocation = str.indexOf("Boolean") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<CompleteOnType:Boolean>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "Boolean"; - String expectedReplacedSource = "Boolean"; - String expectedUnitDisplayString = - "public class Test {\n" + - " <CompleteOnType:Boolean>;\n" + - " some text;\n" + - " bold<i> both;\n" + - " public Test() {\n" + - " }\n" + - " public void foo(String s) {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=91371 - */ -public void test0149(){ - String str = - "public class X{\n" + - " public void foo() {\n" + - " new Object(){\n" + - " void bar(){\n" + - " if((titi & (ZZ\n" + - "}\n" + - "\n"; - - - String completeBehind = "ZZ"; - int cursorLocation = str.indexOf("ZZ") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ZZ"; - String expectedReplacedSource = "ZZ"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:ZZ>"; - expectedParentNodeToString = "(titi & <CompleteOnName:ZZ>)"; - completionIdentifier = "ZZ"; - expectedReplacedSource = "ZZ"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " new Object() {\n" + - " void bar() {\n" + - " (titi & <CompleteOnName:ZZ>);\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=91371 - */ -public void test0150(){ - String str = - "public class X{\n" + - " public void foo() {\n" + - " if((titi & (ZZ\n" + - "}\n" + - "\n"; - - - String completeBehind = "ZZ"; - int cursorLocation = str.indexOf("ZZ") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ZZ"; - String expectedReplacedSource = "ZZ"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:ZZ>"; - expectedParentNodeToString = "(titi & <CompleteOnName:ZZ>)"; - completionIdentifier = "ZZ"; - expectedReplacedSource = "ZZ"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " (titi & <CompleteOnName:ZZ>);\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=92451 - */ -public void test0151(){ - String str = - "public class X {\n" + - " public static void main(String[] args) {\n" + - " java.util.List elements = null;\n" + - " new Test(Test.toStrings((Test[])elements.toArray(new Test[0])));\n" + - " //code assist fails on this line\n" + - " }\n" + - "}\n"; - - - String completeBehind = ""; - int cursorLocation = str.indexOf(" //code assis") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = ""; - expectedReplacedSource = ""; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " java.util.List elements;\n" + - " <CompleteOnName:>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=98115 - */ -public void test0152(){ - String str = - "public class X {\n" + - " Object var = new Object() {\n" + - " void bar() {\n" + - " int i = 0;\n" + - " }\n" + - " void foo() {\n" + - " zzz\n" + - " }\n" + - " };\n" + - "}\n"; - - - String completeBehind = "zzz"; - int cursorLocation = str.indexOf("zzz") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<CompleteOnName:zzz>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "zzz"; - String expectedReplacedSource = "zzz"; - String expectedUnitDisplayString = - "public class X {\n" + - " Object var = new Object() {\n" + - " void bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:zzz>;\n" + - " }\n" + - " };\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 - */ -public void test0153(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " label1 : for(;;) {\n" + - " break lab\n" + - " }\n" + - " }\n" + - "}\n"; - - - String completeBehind = "lab"; - int cursorLocation = str.lastIndexOf("lab") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "break <CompleteOnLabel:lab>;"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "lab"; - expectedReplacedSource = "lab"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " break <CompleteOnLabel:lab>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 - */ -public void test0154(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " label1 : for(;;) {\n" + - " break lab\n" + - " }\n" + - " }\n" + - "}\n"; - - - String completeBehind = "lab"; - int cursorLocation = str.lastIndexOf("lab") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "break <CompleteOnLabel:lab>;"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "lab"; - expectedReplacedSource = "lab"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " break <CompleteOnLabel:lab>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 - */ -public void test0155(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " label1 : for(;;) {\n" + - " continue lab\n" + - " }\n" + - " }\n" + - "}\n"; - - - String completeBehind = "lab"; - int cursorLocation = str.lastIndexOf("lab") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "continue <CompleteOnLabel:lab>;"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "lab"; - expectedReplacedSource = "lab"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " continue <CompleteOnLabel:lab>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 - */ -public void test0156(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " label1 : for(;;) {\n" + - " continue lab\n" + - " }\n" + - " }\n" + - "}\n"; - - - String completeBehind = "lab"; - int cursorLocation = str.lastIndexOf("lab") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "continue <CompleteOnLabel:lab>;"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "lab"; - expectedReplacedSource = "lab"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " continue <CompleteOnLabel:lab>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 - */ -public void test0157(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " label1 : for(;;) {\n" + - " class X {\n" + - " void foo() {\n" + - " label2 : for(;;) foo();\n" + - " }\n" + - " }\n" + - " continue lab\n" + - " }\n" + - " }\n" + - "}\n"; - - - String completeBehind = "lab"; - int cursorLocation = str.lastIndexOf("lab") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "continue <CompleteOnLabel:lab>;"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "lab"; - expectedReplacedSource = "lab"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " class X {\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " continue <CompleteOnLabel:lab>;\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=22072 - */ -public void test0158(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " label1 : for(;;) {\n" + - " class X {\n" + - " void foo() {\n" + - " label2 : for(;;) {\n" + - " continue lab\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - - String completeBehind = "lab"; - int cursorLocation = str.lastIndexOf("lab") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "continue <CompleteOnLabel:lab>;"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "lab"; - expectedReplacedSource = "lab"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " continue <CompleteOnLabel:lab>;\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -public void test0159() { - - String str = - "public class X {\n" + - " String s = \"ZZZZZ\";\n" + - "}\n"; - - String completeBehind = "ZZZ"; - String expectedCompletionNodeToString = "<CompletionOnString:\"ZZZ\">"; - String completionIdentifier = "ZZZ"; - String expectedUnitDisplayString = - "public class X {\n" + - " String s = <CompletionOnString:\"ZZZ\">;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "\"ZZZZZ\""; - String testName = "<complete inside a string literal>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void test0160() { - - String str = - "public class X {\n" + - " String s = \\u0022ZZ\\u005AZZ\\u0022;\n" + - "}\n"; - - String completeBehind = "ZZ\\u005A"; - String expectedCompletionNodeToString = "<CompletionOnString:\"ZZZ\">"; - String completionIdentifier = "ZZZ"; - String expectedUnitDisplayString = - "public class X {\n" + - " String s = <CompletionOnString:\"ZZZ\">;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "\\u0022ZZ\\u005AZZ\\u0022"; - String testName = "<complete inside a string literal>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void test0161() { - - String str = - "public class X {\n" + - " String s = \"AAAAA\" + \"ZZZZZ\";\n" + - "}\n"; - - String completeBehind = "ZZZ"; - String expectedCompletionNodeToString = "<CompletionOnString:\"ZZZ\">"; - String completionIdentifier = "ZZZ"; - String expectedUnitDisplayString = - "public class X {\n" + - " String s = (\"AAAAA\" + <CompletionOnString:\"ZZZ\">);\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "\"ZZZZZ\""; - String testName = "<complete inside a string literal>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void test0162() { - - String str = - "public class X {\n" + - " String s = \"ZZZZZ\n" + - "}\n"; - - String completeBehind = "ZZZ"; - String expectedCompletionNodeToString = "<CompletionOnString:\"ZZZ\">"; - String completionIdentifier = "ZZZ"; - String expectedUnitDisplayString = - "public class X {\n" + - " String s = <CompletionOnString:\"ZZZ\">;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "\"ZZZZZ"; - String testName = "<complete inside a string literal>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void test0163() { - - String str = - "public class X {\n" + - " String s = \"ZZZZZ"; - - String completeBehind = "ZZZ"; - String expectedCompletionNodeToString = "<CompletionOnString:\"ZZZ\">"; - String completionIdentifier = "ZZZ"; - String expectedUnitDisplayString = - "public class X {\n" + - " String s = <CompletionOnString:\"ZZZ\">;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "\"ZZZZZ"; - String testName = "<complete inside a string literal>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void test0164() { - - String str = - "public class X {\n" + - " String s = \"\\u005AZZZZ\\u000D\\u0022" + - "}\n"; - - String completeBehind = "\\u005AZZ"; - String expectedCompletionNodeToString = "<CompletionOnString:\"ZZZ\">"; - String completionIdentifier = "ZZZ"; - String expectedUnitDisplayString = - "public class X {\n" + - " String s = <CompletionOnString:\"ZZZ\">;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "\"\\u005AZZZZ"; - String testName = "<complete inside a string literal>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=122755 -public void test0165() { - - String str = - "public class X {\n" + - " void foo() {" + - " /**" + - " *" + - " */." + - " }" + - "}\n"; - - String completeBehind = "/."; - int cursorLocation = str.lastIndexOf("/.") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = ""; - expectedReplacedSource = ""; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=137623 -public void test0166() { - - String str = - "public class X {\n" + - " public boolean foo() {\n" + - " if(this.equals(null))\n" + - " {\n" + - " (zzz==int.\n" + - " }\n" + - " }" + - "}\n"; - - String completeBehind = "int."; - int cursorLocation = str.lastIndexOf("int.") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public boolean foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnClassLiteralAccess:int.>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = ""; - expectedReplacedSource = "int."; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public boolean foo() {\n" + - " <CompleteOnClassLiteralAccess:int.>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void test0167() { - - String str = - "public class X {\n" + - " public boolean foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IllegalAccessException e) {\n" + - " bar();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"; - - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf("IZZ") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public boolean foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnException:IZZ>"; - expectedParentNodeToString = - "try \n" + - " {\n" + - " throwing();\n" + - " }\n" + - "catch (IllegalAccessException e) {\n" + - " }\n" + - "catch (<CompleteOnException:IZZ> ) {\n" + - " }"; - completionIdentifier = "IZZ"; - expectedReplacedSource = "IZZ"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public boolean foo() {\n" + - " try \n" + - " {\n" + - " throwing();\n" + - " }\n" + - " catch (IllegalAccessException e) {\n" + - " }\n" + - " catch (<CompleteOnException:IZZ> ) {\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void test0168() { - - String str = - "public class X {\n" + - " public boolean foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IllegalAccessException e) {\n" + - " bar();\n" + - " }\n" + - " catch (IZZ\n" + - " }" + - "}\n"; - - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf("IZZ") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public boolean foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnException:IZZ>"; - expectedParentNodeToString = - "try \n" + - " {\n" + - " throwing();\n" + - " }\n" + - "catch (IllegalAccessException e) {\n" + - " }\n" + - "catch (<CompleteOnException:IZZ> ) {\n" + - " }"; - completionIdentifier = "IZZ"; - expectedReplacedSource = "IZZ"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public boolean foo() {\n" + - " try \n" + - " {\n" + - " throwing();\n" + - " }\n" + - " catch (IllegalAccessException e) {\n" + - " }\n" + - " catch (<CompleteOnException:IZZ> ) {\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void test0169() { - - String str = - "public class X {\n" + - " public boolean foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IllegalAccessException e) {\n" + - " bar()\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"; - - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf("IZZ") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public boolean foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnException:IZZ>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "IZZ"; - expectedReplacedSource = "IZZ"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public boolean foo() {\n" + - " <CompleteOnException:IZZ>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void test0170() { - - String str = - "public class X {\n" + - " public boolean foo() {\n" + - " #\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IllegalAccessException e) {\n" + - " bar();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"; - - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf("IZZ") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public boolean foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnException:IZZ>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "IZZ"; - expectedReplacedSource = "IZZ"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public boolean foo() {\n" + - " <CompleteOnException:IZZ>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=157584 -public void test0171() { - - String str = - "public class X {\n" + - " public boolean foo() {\n" + - " try {\n" + - " throwing();\n" + - " }\n" + - " catch (IZZ) {\n" + - " }\n" + - " }" + - "}\n"; - - String completeBehind = "IZZ"; - int cursorLocation = str.lastIndexOf("IZZ") + completeBehind.length() - 1; - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public boolean foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnException:IZZ>"; - expectedParentNodeToString = - "try \n" + - " {\n" + - " throwing();\n" + - " }\n" + - "catch (<CompleteOnException:IZZ> ) {\n" + - " }" -; - completionIdentifier = "IZZ"; - expectedReplacedSource = "IZZ"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public boolean foo() {\n" + - " try \n" + - " {\n" + - " throwing();\n" + - " }\n" + - " catch (<CompleteOnException:IZZ> ) {\n" + - " }\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTestKeyword.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTestKeyword.java index 5a4cc80..528432e 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTestKeyword.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionParserTestKeyword.java
@@ -10,792 +10,17 @@ *******************************************************************************/ package org.eclipse.wst.jsdt.core.tests.compiler.parser; -import junit.framework.Test; - public class CompletionParserTestKeyword extends AbstractCompletionTest { public CompletionParserTestKeyword(String testName) { super(testName); } -public static Test suite() { - return buildAllCompliancesTestSuite(CompletionParserTestKeyword.class); -} -/* - * Test for 'abstract' keyword. - */ -public void test0001(){ - String str = - "abst"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0002(){ - String str = - "abst zzz"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0003(){ - String str = - "package p;\n" + - "abst"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0004(){ - String str = - "package p;\n" + - "abst zzz"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0005(){ - String str = - "package p;\n" + - "import yyy;\n" + - "abst"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0006(){ - String str = - "package p;\n" + - "import yyy;\n" + - "abst zzz"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0007(){ - String str = - "package p;\n" + - "import yyy;\n" + - "public abst"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0008(){ - String str = - "package p;\n" + - "import yyy;\n" + - "public abst zzz"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0009(){ - String str = - "package p;\n" + - "import yyy;\n" + - "abstract abst"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0010(){ - String str = - "package p;\n" + - "import yyy;\n" + - "abstract abst zzz"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0011(){ - String str = - "package p;\n" + - "import \n" + - "abst"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnImport:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnImport:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0012(){ - String str = - "package p;\n" + - "import yyy;\n" + - "public class X {}\n" + - "abst"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0013(){ - String str = - "package p;\n" + - "import yyy;\n" + - "public class X {}\n" + - "abst zzz"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0014(){ - String str = - "package p;\n" + - "import yyy;\n" + - "final abst"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0015(){ - String str = - "package p;\n" + - "public class X {\n" + - " abst\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " <CompleteOnType:abst>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0016(){ - String str = - "package p;\n" + - "public class X {\n" + - " abst zzz\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:abst>;"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " <CompleteOnType:abst>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0017(){ - String str = - "package p;\n" + - "public class X {\n" + - " public abst zzz\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:abst>;"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " <CompleteOnType:abst>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0018(){ - String str = - "package p;\n" + - "public class X {\n" + - " final abst\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " <CompleteOnType:abst>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0019(){ - String str = - "package p;\n" + - "public class X {\n" + - " abstract abst\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " <CompleteOnType:abst>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0020(){ - String str = - "package p;\n" + - "public class X {\n" + - " static abst\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " <CompleteOnType:abst>;\n" + - " public X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0021(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " abst\n" + - " }\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:abst>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "abst"; - expectedReplacedSource = "abst"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:abst>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0022(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " abst zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:abst>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "abst"; - expectedReplacedSource = "abst"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:abst>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} /* * Test for 'break' keyword. */ public void test0023(){ String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " bre\n" + - " }\n" + + "function foo(){\n" + + " bre\n" + "}\n"; String completeBehind = "bre"; @@ -806,12 +31,7 @@ String completionIdentifier = "<NONE>"; String expectedReplacedSource = "<NONE>"; String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + + "function foo() {\n" + "}\n"; checkDietParse( @@ -829,13 +49,8 @@ completionIdentifier = "bre"; expectedReplacedSource = "bre"; expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:bre>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnName:bre>;\n" + "}\n"; checkMethodParse( @@ -1167,423 +382,6 @@ "full ast"); } /* - * Test for 'class' keyword. - */ -public void test0029(){ - String str = - "cla"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:cla>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0030(){ - String str = - "public cla"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:cla>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0031(){ - String str = - "public final cla"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:cla>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0032(){ - String str = - "public final cla X"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:cla>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0033(){ - String str = - "public class X {\n" + - " cla\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:cla>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0034(){ - String str = - "public class X {\n" + - " public cla\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:cla>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0035(){ - String str = - "public class X {\n" + - " public final cla\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:cla>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0036(){ - String str = - "public class X {\n" + - " public final cla Y\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:cla>;"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:cla>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0037(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " cla\n" + - " }\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:cla>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "cla"; - expectedReplacedSource = "cla"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:cla>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0038(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " final cla\n" + - " }\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:cla>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "cla"; - expectedReplacedSource = "cla"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:cla>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0039(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " final cla Y\n" + - " }\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:cla>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "cla"; - expectedReplacedSource = "cla"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:cla>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* * Test for 'continue' keyword. */ public void test0040(){ @@ -2029,239 +827,6 @@ "full ast"); } /* - * Test for 'extends' keyword. - */ -public void test0047(){ - String str = - "ext"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:ext>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0048(){ - String str = - "X ext"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - ""; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0049(){ - String str = - "ext Y"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:ext>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0050(){ - String str = - "class X ext"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:ext> {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0051(){ - String str = - "class X ext Y"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:ext> {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0052(){ - String str = - "class X ext Y {"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:ext> {\n" + - " {\n" + - " }\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0053(){ - String str = - "class X extends Y ext"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:ext> {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0054(){ - String str = - "class X implements Y ext"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "class X implements Y {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* * Test for 'finally' keyword. */ public void test0055(){ @@ -2573,968 +1138,6 @@ "full ast"); } /* - * Test for 'implements' keyword. - */ -public void test0060(){ - String str = - "impl"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:impl>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0061(){ - String str = - "X impl"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - ""; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0062(){ - String str = - "impl Y"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:impl>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0063(){ - String str = - "class X impl"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:impl> {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0064(){ - String str = - "class X impl Y"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:impl> {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0065(){ - String str = - "class X impl Y {"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:impl> {\n" + - " {\n" + - " }\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0066(){ - String str = - "class X extends Y impl"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:impl> {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0067(){ - String str = - "class X implements Y impl"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "class X implements Y {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'import' keyword. - */ -public void test0068(){ - String str = - "impo"; - - String completeBehind = "impo"; - int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impo"; - String expectedReplacedSource = "impo"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:impo>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'import' keyword. - */ -public void test0069(){ - String str = - "package p;\n" + - "impo"; - - String completeBehind = "impo"; - int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impo"; - String expectedReplacedSource = "impo"; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnKeyword:impo>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'import' keyword. - */ -public void test0070(){ - String str = - "package p;\n" + - "import p2.Y;\n" + - "impo"; - - String completeBehind = "impo"; - int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impo"; - String expectedReplacedSource = "impo"; - String expectedUnitDisplayString = - "package p;\n" + - "import p2.Y;\n" + - "import <CompleteOnKeyword:impo>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'import' keyword. - */ -public void test0071(){ - String str = - "impo p2.Y"; - - String completeBehind = "impo"; - int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impo"; - String expectedReplacedSource = "impo"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:impo>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0072(){ - String str = - "int"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:int>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0073(){ - String str = - "public int"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:int>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0074(){ - String str = - "public abstract int"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:int>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0075(){ - String str = - "public abstract int X"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:int>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0076(){ - String str = - "public class X {\n" + - " int\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:int>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0077(){ - String str = - "public class X {\n" + - " public int\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:int>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0078(){ - String str = - "public class X {\n" + - " public abstract int\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:int>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0079(){ - String str = - "public class X {\n" + - " public abstract int Y\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:int>;"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:int>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0080(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " int\n" + - " }\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:int>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "int"; - expectedReplacedSource = "int"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:int>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0081(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " abstract int\n" + - " }\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:int>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "int"; - expectedReplacedSource = "int"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:int>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0082(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " abstract int Y\n" + - " }\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:int>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "int"; - expectedReplacedSource = "int"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:int>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0083(){ - String str = - "public final int"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:int>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0084(){ - String str = - "public final int X"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:int>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'package' keyword. - */ -public void test0085(){ - String str = - "pac"; - - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pac"; - String expectedReplacedSource = "pac"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pac>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'package' keyword. - */ -public void test0086(){ - String str = - "pac p"; - - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pac"; - String expectedReplacedSource = "pac"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pac>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'package' keyword. - */ -public void test0087(){ - String str = - "package p;" + - "pac"; - - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pac"; - String expectedReplacedSource = "pac"; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnKeyword:pac>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'package' keyword. - */ -public void test0088(){ - String str = - "import p;" + - "pac"; - - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pac"; - String expectedReplacedSource = "pac"; - String expectedUnitDisplayString = - "import p;\n" + - "import <CompleteOnKeyword:pac>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'package' keyword. - */ -public void test0089(){ - String str = - "class X {}" + - "pac"; - - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pac"; - String expectedReplacedSource = "pac"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pac>;\n" + - "class X {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* * Test for 'return' keyword. */ public void test0090(){ @@ -4184,214 +1787,6 @@ "full ast"); } /* - * Test for 'throws' keyword. - */ -public void test0101(){ - String str = - "public class X {\n" + - " void foo() thr\n" + - " }\n" + - "}"; - - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "thr"; - String expectedReplacedSource = "thr"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() throws <CompleteOnKeyword:thr> {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'throws' keyword. - */ -public void test0102(){ - String str = - "public class X {\n" + - " void foo() thr {\n" + - " }\n" + - "}"; - - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "thr"; - String expectedReplacedSource = "thr"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() throws <CompleteOnKeyword:thr> {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'throws' keyword. - */ -public void test0103(){ - String str = - "public class X {\n" + - " void foo() thr E {\n" + - " }\n" + - "}"; - - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "thr"; - String expectedReplacedSource = "thr"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() throws <CompleteOnKeyword:thr> {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'throws' keyword. - */ -public void test0104(){ - String str = - "public class X {\n" + - " void foo() throws E thr\n" + - " }\n" + - "}"; - - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "thr"; - String expectedReplacedSource = "thr"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() throws E {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'throws' keyword. - */ -public void test0105(){ - String str = - "public class X {\n" + - " X() thr\n" + - " }\n" + - "}"; - - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "thr"; - String expectedReplacedSource = "thr"; - String expectedUnitDisplayString = - "public class X {\n" + - " X() throws <CompleteOnKeyword:thr> {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'throws' keyword. - */ -public void test0106(){ - String str = - "public class X {\n" + - " int foo()[] thr\n" + - " }\n" + - "}"; - - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "thr"; - String expectedReplacedSource = "thr"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " int[] foo() throws <CompleteOnKeyword:thr> {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* * Test for 'while' keyword. */ public void test0107(){ @@ -4510,2438 +1905,6 @@ "full ast"); } /* - * Test for 'assert' keyword. - */ -public void test0109(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " ass\n" + - " }\n" + - "}"; - - String completeBehind = "ass"; - int cursorLocation = str.lastIndexOf("ass") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:ass>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "ass"; - expectedReplacedSource = "ass"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:ass>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'assert' keyword. - */ -public void test0110(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " if(ass\n" + - " }\n" + - "}"; - - String completeBehind = "ass"; - int cursorLocation = str.lastIndexOf("ass") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:ass>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "ass"; - expectedReplacedSource = "ass"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:ass>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0111(){ - String str = - "fin"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:fin>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0112(){ - String str = - "public fin"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:fin>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0113(){ - String str = - "fin zzz"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:fin>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0114(){ - String str = - "final fin"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:fin>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0115(){ - String str = - "abstract fin"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:fin>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0116(){ - String str = - "public fin class X {}"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:fin>;\n" + - "class X {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0117(){ - String str = - "public class X {\n" + - " fin\n" + - "}"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:fin>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0118(){ - String str = - "public class X {\n" + - " public fin\n" + - "}"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:fin>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0119(){ - String str = - "public class X {\n" + - " fin zzz\n" + - "}"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:fin>;"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:fin>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0120(){ - String str = - "public class X {\n" + - " final fin\n" + - "}"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:fin>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0121(){ - String str = - "public class X {\n" + - " abstract fin\n" + - "}"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:fin>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'native' keyword. - */ -public void test0122(){ - String str = - "public class X {\n" + - " nat\n" + - "}"; - - String completeBehind = "nat"; - int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:nat>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "nat"; - String expectedReplacedSource = "nat"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:nat>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'native' keyword. - */ -public void test0123(){ - String str = - "public class X {\n" + - " public nat\n" + - "}"; - - String completeBehind = "nat"; - int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:nat>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "nat"; - String expectedReplacedSource = "nat"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:nat>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'native' keyword. - */ -public void test0124(){ - String str = - "public class X {\n" + - " transient nat\n" + - "}"; - - String completeBehind = "nat"; - int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:nat>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "nat"; - String expectedReplacedSource = "nat"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:nat>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'native' keyword. - */ -public void test0125(){ - String str = - "public class X {\n" + - " transient nat\n" + - "}"; - - String completeBehind = "nat"; - int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:nat>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "nat"; - String expectedReplacedSource = "nat"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:nat>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'native' keyword. - */ -public void test0126(){ - String str = - "public class X {\n" + - " volatile nat\n" + - "}"; - - String completeBehind = "nat"; - int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:nat>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "nat"; - String expectedReplacedSource = "nat"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:nat>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'strictfp' keyword. - */ -public void test0127(){ - String str = - "public class X {\n" + - " str\n" + - "}"; - - String completeBehind = "str"; - int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:str>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "str"; - String expectedReplacedSource = "str"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:str>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'strictfp' keyword. - */ -public void test0128(){ - String str = - "public class X {\n" + - " public str\n" + - "}"; - - String completeBehind = "str"; - int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:str>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "str"; - String expectedReplacedSource = "str"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:str>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'strictfp' keyword. - */ -public void test0129(){ - String str = - "public class X {\n" + - " transient str\n" + - "}"; - - String completeBehind = "str"; - int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:str>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "str"; - String expectedReplacedSource = "str"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:str>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'strictfp' keyword. - */ -public void test0130(){ - String str = - "public class X {\n" + - " transient str\n" + - "}"; - - String completeBehind = "str"; - int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:str>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "str"; - String expectedReplacedSource = "str"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:str>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'strictfp' keyword. - */ -public void test0131(){ - String str = - "public class X {\n" + - " volatile str\n" + - "}"; - - String completeBehind = "str"; - int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:str>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "str"; - String expectedReplacedSource = "str"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:str>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'volatile' keyword. - */ -public void test0132(){ - String str = - "public class X {\n" + - " vol\n" + - "}"; - - String completeBehind = "vol"; - int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:vol>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "vol"; - String expectedReplacedSource = "vol"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:vol>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'volatile' keyword. - */ -public void test0133(){ - String str = - "public class X {\n" + - " public vol\n" + - "}"; - - String completeBehind = "vol"; - int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:vol>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "vol"; - String expectedReplacedSource = "vol"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:vol>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'volatile' keyword. - */ -public void test0134(){ - String str = - "public class X {\n" + - " transient vol\n" + - "}"; - - String completeBehind = "vol"; - int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:vol>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "vol"; - String expectedReplacedSource = "vol"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:vol>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'volatile' keyword. - */ -public void test0135(){ - String str = - "public class X {\n" + - " volatile vol\n" + - "}"; - - String completeBehind = "vol"; - int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:vol>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "vol"; - String expectedReplacedSource = "vol"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:vol>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'volatile' keyword. - */ -public void test0136(){ - String str = - "public class X {\n" + - " native vol\n" + - "}"; - - String completeBehind = "vol"; - int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:vol>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "vol"; - String expectedReplacedSource = "vol"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:vol>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'transient' keyword. - */ -public void test0137(){ - String str = - "public class X {\n" + - " tra\n" + - "}"; - - String completeBehind = "tra"; - int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:tra>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "tra"; - String expectedReplacedSource = "tra"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:tra>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'transient' keyword. - */ -public void test0138(){ - String str = - "public class X {\n" + - " public tra\n" + - "}"; - - String completeBehind = "tra"; - int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:tra>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "tra"; - String expectedReplacedSource = "tra"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:tra>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'transient' keyword. - */ -public void test0139(){ - String str = - "public class X {\n" + - " transient tra\n" + - "}"; - - String completeBehind = "tra"; - int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:tra>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "tra"; - String expectedReplacedSource = "tra"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:tra>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'transient' keyword. - */ -public void test0140(){ - String str = - "public class X {\n" + - " volatile tra\n" + - "}"; - - String completeBehind = "tra"; - int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:tra>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "tra"; - String expectedReplacedSource = "tra"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:tra>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'transient' keyword. - */ -public void test0141(){ - String str = - "public class X {\n" + - " native tra\n" + - "}"; - - String completeBehind = "tra"; - int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:tra>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "tra"; - String expectedReplacedSource = "tra"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:tra>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0142(){ - String str = - "public class X {\n" + - " syn\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:syn>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "syn"; - String expectedReplacedSource = "syn"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:syn>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0143(){ - String str = - "public class X {\n" + - " public syn\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:syn>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "syn"; - String expectedReplacedSource = "syn"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:syn>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0144(){ - String str = - "public class X {\n" + - " transient syn\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:syn>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "syn"; - String expectedReplacedSource = "syn"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:syn>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0145(){ - String str = - "public class X {\n" + - " transient syn\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:syn>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "syn"; - String expectedReplacedSource = "syn"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:syn>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0146(){ - String str = - "public class X {\n" + - " volatile syn\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:syn>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "syn"; - String expectedReplacedSource = "syn"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:syn>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0147(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " syn\n" + - " }\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:syn>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "syn"; - expectedReplacedSource = "syn"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:syn>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0148(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " if(syn\n" + - " }\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:syn>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "syn"; - expectedReplacedSource = "syn"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:syn>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'static' keyword. - */ -public void test0149(){ - String str = - "public class X {\n" + - " sta\n" + - "}"; - - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf("sta") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:sta>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "sta"; - String expectedReplacedSource = "sta"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:sta>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'static' keyword. - */ -public void test0150(){ - String str = - "public class X {\n" + - " public sta\n" + - "}"; - - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf("sta") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:sta>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "sta"; - String expectedReplacedSource = "sta"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:sta>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0151(){ - String str = - "pub"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pub>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0152(){ - String str = - "final pub"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pub>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0153(){ - String str = - "public pub"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pub>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0154(){ - String str = - "private pub"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pub>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0155(){ - String str = - "public class X{}\n" + - "pub"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pub>;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0156(){ - String str = - "public class X{\n" + - " pub\n" + - "}"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pub>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0157(){ - String str = - "public class X{\n" + - " public pub\n" + - "}"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pub>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0158(){ - String str = - "public class X{\n" + - " private pub\n" + - "}"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pub>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0159(){ - String str = - "public class X{\n" + - " protected pub\n" + - "}"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pub>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0160(){ - String str = - "public class X{\n" + - " abstract pub\n" + - "}"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pub>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0161(){ - String str = - "pro"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - ""; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0162(){ - String str = - "final pro"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pro>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0163(){ - String str = - "public pro"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pro>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0164(){ - String str = - "private pro"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pro>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0165(){ - String str = - "public class X{}\n" + - "pro"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pro>;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0166(){ - String str = - "public class X{\n" + - " pro\n" + - "}"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pro>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0167(){ - String str = - "public class X{\n" + - " public pro\n" + - "}"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pro>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0168(){ - String str = - "public class X{\n" + - " private pro\n" + - "}"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pro>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0169(){ - String str = - "public class X{\n" + - " protected pro\n" + - "}"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pro>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0170(){ - String str = - "public class X{\n" + - " abstract pro\n" + - "}"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pro>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0171(){ - String str = - "pri"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - ""; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0172(){ - String str = - "final pri"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pri>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0173(){ - String str = - "public pri"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pri>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0174(){ - String str = - "private pri"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pri>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0175(){ - String str = - "public class X{}\n" + - "pri"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pri>;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0176(){ - String str = - "public class X{\n" + - " pri\n" + - "}"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pri>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0177(){ - String str = - "public class X{\n" + - " public pri\n" + - "}"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pri>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0178(){ - String str = - "public class X{\n" + - " private pri\n" + - "}"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pri>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0179(){ - String str = - "public class X{\n" + - " protected pri\n" + - "}"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pri>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0180(){ - String str = - "public class X{\n" + - " abstract pri\n" + - "}"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pri>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'super' keyword. - */ -public void test0181(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " sup\n" + - " }\n" + - "}\n"; - - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf("sup") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:sup>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "sup"; - expectedReplacedSource = "sup"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:sup>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* * Test for 'this' keyword. */ public void test0182(){ @@ -7694,795 +2657,6 @@ ///////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////// /* - * Test for 'abstract' keyword. - */ -public void test0194(){ - String str = - "#\n" + - "abst"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0195(){ - String str = - "#\n" + - "abst zzz"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0196(){ - String str = - "#\n" + - "package p;\n" + - "abst"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0197(){ - String str = - "#\n" + - "package p;\n" + - "abst zzz"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0198(){ - String str = - "#\n" + - "package p;\n" + - "import yyy;\n" + - "abst"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0199(){ - String str = - "#\n" + - "package p;\n" + - "import yyy;\n" + - "abst zzz"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0200(){ - String str = - "#\n" + - "package p;\n" + - "import yyy;\n" + - "public abst"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0201(){ - String str = - "#\n" + - "package p;\n" + - "import yyy;\n" + - "public abst zzz"; - - String completeBehind = "abst"; - int cursorLocation = str.indexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0202(){ - String str = - "#\n" + - "package p;\n" + - "import yyy;\n" + - "abstract abst"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0203(){ - String str = - "#\n" + - "package p;\n" + - "import yyy;\n" + - "abstract abst zzz"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0204(){ - String str = - "#\n" + - "package p;\n" + - "import \n" + - "abst"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnImport:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnImport:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0205(){ - String str = - "#\n" + - "package p;\n" + - "import yyy;\n" + - "public class X {}\n" + - "abst"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0206(){ - String str = - "#\n" + - "package p;\n" + - "import yyy;\n" + - "public class X {}\n" + - "abst zzz"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0207(){ - String str = - "#\n" + - "package p;\n" + - "import yyy;\n" + - "final abst"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "import yyy;\n" + - "import <CompleteOnKeyword:abst>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0208(){ - String str = - "#\n" + - "package p;\n" + - "public class X {\n" + - " abst\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " <CompleteOnType:abst>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0209(){ - String str = - "#\n" + - "package p;\n" + - "public class X {\n" + - " abst zzz\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:abst>;"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " <CompleteOnType:abst>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0210(){ - String str = - "#\n" + - "package p;\n" + - "public class X {\n" + - " public abst zzz\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:abst>;"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " <CompleteOnType:abst>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0211(){ - String str = - "#\n" + - "package p;\n" + - "public class X {\n" + - " final abst\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " <CompleteOnType:abst>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0212(){ - String str = - "#\n" + - "package p;\n" + - "public class X {\n" + - " abstract abst\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " <CompleteOnType:abst>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0213(){ - String str = - "#\n" + - "package p;\n" + - "public class X {\n" + - " static abst\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:abst>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "abst"; - String expectedReplacedSource = "abst"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " <CompleteOnType:abst>;\n" + - " public X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0214(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " abst\n" + - " }\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:abst>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "abst"; - expectedReplacedSource = "abst"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:abst>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'abstract' keyword. - */ -public void test0216(){ - String str = - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " abst zzz\n" + - " }\n" + - "}\n"; - - String completeBehind = "abst"; - int cursorLocation = str.lastIndexOf("abst") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:abst>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "abst"; - expectedReplacedSource = "abst"; - expectedUnitDisplayString = - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:abst>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* * Test for 'break' keyword. */ public void test0217(){ @@ -8870,434 +3044,7 @@ expectedReplacedSource, "full ast"); } -/* - * Test for 'class' keyword. - */ -public void test0223(){ - String str = - "#\n" + - "cla"; - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:cla>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0224(){ - String str = - "#\n" + - "public cla"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:cla>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0225(){ - String str = - "#\n" + - "public final cla"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:cla>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0226(){ - String str = - "#\n" + - "public final cla X"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:cla>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0227(){ - String str = - "#\n" + - "public class X {\n" + - " cla\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:cla>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0228(){ - String str = - "#\n" + - "public class X {\n" + - " public cla\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:cla>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0229(){ - String str = - "#\n" + - "public class X {\n" + - " public final cla\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:cla>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:cla>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0230(){ - String str = - "#\n" + - "public class X {\n" + - " public final cla Y\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:cla>;"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "cla"; - String expectedReplacedSource = "cla"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:cla>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0231(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " cla\n" + - " }\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:cla>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "cla"; - expectedReplacedSource = "cla"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:cla>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0232(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " final cla\n" + - " }\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:cla>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "cla"; - expectedReplacedSource = "cla"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:cla>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'class' keyword. - */ -public void test0233(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " final cla Y\n" + - " }\n" + - "}"; - - String completeBehind = "cla"; - int cursorLocation = str.lastIndexOf("cla") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:cla>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "cla"; - expectedReplacedSource = "cla"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:cla>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} /* * Test for 'continue' keyword. */ @@ -9751,247 +3498,6 @@ "full ast"); } /* - * Test for 'extends' keyword. - */ -public void test0241(){ - String str = - "#\n" + - "ext"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:ext>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0242(){ - String str = - "#\n" + - "X ext"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - ""; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0243(){ - String str = - "#\n" + - "ext Y"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:ext>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0244(){ - String str = - "#\n" + - "class X ext"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:ext> {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0245(){ - String str = - "#\n" + - "class X ext Y"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:ext> {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0246(){ - String str = - "#\n" + - "class X ext Y {"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:ext> {\n" + - " {\n" + - " }\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0247(){ - String str = - "#\n" + - "class X extends Y ext"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:ext> {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'extends' keyword. - */ -public void test0248(){ - String str = - "#\n" + - "class X implements Y ext"; - - String completeBehind = "ext"; - int cursorLocation = str.lastIndexOf("ext") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "ext"; - String expectedReplacedSource = "ext"; - String expectedUnitDisplayString = - "class X implements Y {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* * Test for 'finally' keyword. */ public void test0249(){ @@ -10308,998 +3814,6 @@ "full ast"); } /* - * Test for 'implements' keyword. - */ -public void test0254(){ - String str = - "#\n" + - "impl"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:impl>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0255(){ - String str = - "#\n" + - "X impl"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - ""; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0256(){ - String str = - "#\n" + - "impl Y"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:impl>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0257(){ - String str = - "#\n" + - "class X impl"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:impl> {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0258(){ - String str = - "#\n" + - "class X impl Y"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:impl> {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0259(){ - String str = - "#\n" + - "class X impl Y {"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:impl> {\n" + - " {\n" + - " }\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0260(){ - String str = - "#\n" + - "class X extends Y impl"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impl>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "class X extends <CompleteOnKeyword:impl> {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'implements' keyword. - */ -public void test0261(){ - String str = - "#\n" + - "class X implements Y impl"; - - String completeBehind = "impl"; - int cursorLocation = str.lastIndexOf("impl") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impl"; - String expectedReplacedSource = "impl"; - String expectedUnitDisplayString = - "class X implements Y {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'import' keyword. - */ -public void test0262(){ - String str = - "#\n" + - "impo"; - - String completeBehind = "impo"; - int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impo"; - String expectedReplacedSource = "impo"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:impo>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'import' keyword. - */ -public void test0263(){ - String str = - "#\n" + - "package p;\n" + - "impo"; - - String completeBehind = "impo"; - int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impo"; - String expectedReplacedSource = "impo"; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnKeyword:impo>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'import' keyword. - */ -public void test0264(){ - String str = - "#\n" + - "package p;\n" + - "import p2.Y;\n" + - "impo"; - - String completeBehind = "impo"; - int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impo"; - String expectedReplacedSource = "impo"; - String expectedUnitDisplayString = - "package p;\n" + - "import p2.Y;\n" + - "import <CompleteOnKeyword:impo>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'import' keyword. - */ -public void test0265(){ - String str = - "#\n" + - "impo p2.Y"; - - String completeBehind = "impo"; - int cursorLocation = str.lastIndexOf("impo") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:impo>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "impo"; - String expectedReplacedSource = "impo"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:impo>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0266(){ - String str = - "#\n" + - "int"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:int>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0267(){ - String str = - "#\n" + - "public int"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:int>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0268(){ - String str = - "#\n" + - "public abstract int"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:int>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0269(){ - String str = - "#\n" + - "public abstract int X"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:int>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0270(){ - String str = - "#\n" + - "public class X {\n" + - " int\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:int>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0271(){ - String str = - "#\n" + - "public class X {\n" + - " public int\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:int>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0272(){ - String str = - "#\n" + - "public class X {\n" + - " public abstract int\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:int>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0273(){ - String str = - "#\n" + - "public class X {\n" + - " public abstract int Y\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:int>;"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:int>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0274(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " int\n" + - " }\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:int>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "int"; - expectedReplacedSource = "int"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:int>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0275(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " abstract int\n" + - " }\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:int>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "int"; - expectedReplacedSource = "int"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:int>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0276(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " abstract int Y\n" + - " }\n" + - "}"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:int>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "int"; - expectedReplacedSource = "int"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:int>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0277(){ - String str = - "#\n" + - "public final int"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:int>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'interface' keyword. - */ -public void test0278(){ - String str = - "#\n" + - "public final int X"; - - String completeBehind = "int"; - int cursorLocation = str.lastIndexOf("int") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:int>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "int"; - String expectedReplacedSource = "int"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:int>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'package' keyword. - */ -public void test0279(){ - String str = - "#\n" + - "pac"; - - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pac"; - String expectedReplacedSource = "pac"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pac>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'package' keyword. - */ -public void test0280(){ - String str = - "#\n" + - "pac p"; - - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pac"; - String expectedReplacedSource = "pac"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pac>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'package' keyword. - */ -public void test0281(){ - String str = - "#\n" + - "package p;" + - "pac"; - - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pac"; - String expectedReplacedSource = "pac"; - String expectedUnitDisplayString = - "package p;\n" + - "import <CompleteOnKeyword:pac>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'package' keyword. - */ -public void test0282(){ - String str = - "#\n" + - "import p;" + - "pac"; - - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pac"; - String expectedReplacedSource = "pac"; - String expectedUnitDisplayString = - "import p;\n" + - "import <CompleteOnKeyword:pac>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'package' keyword. - */ -public void test0283(){ - String str = - "#\n" + - "class X {}" + - "pac"; - - String completeBehind = "pac"; - int cursorLocation = str.lastIndexOf("pac") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pac>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pac"; - String expectedReplacedSource = "pac"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pac>;\n" + - "class X {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* * Test for 'return' keyword. */ public void test0284(){ @@ -11960,220 +4474,6 @@ "full ast"); } /* - * Test for 'throws' keyword. - */ -public void test0295(){ - String str = - "#\n" + - "public class X {\n" + - " void foo() thr\n" + - " }\n" + - "}"; - - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "thr"; - String expectedReplacedSource = "thr"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() throws <CompleteOnKeyword:thr> {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'throws' keyword. - */ -public void test0296(){ - String str = - "#\n" + - "public class X {\n" + - " void foo() thr {\n" + - " }\n" + - "}"; - - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "thr"; - String expectedReplacedSource = "thr"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() throws <CompleteOnKeyword:thr> {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'throws' keyword. - */ -public void test0297(){ - String str = - "#\n" + - "public class X {\n" + - " void foo() thr E {\n" + - " }\n" + - "}"; - - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "thr"; - String expectedReplacedSource = "thr"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() throws <CompleteOnKeyword:thr> {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'throws' keyword. - */ -public void test0298(){ - String str = - "#\n" + - "public class X {\n" + - " void foo() throws E thr\n" + - " }\n" + - "}"; - - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "thr"; - String expectedReplacedSource = "thr"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() throws E {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'throws' keyword. - */ -public void test0299(){ - String str = - "#\n" + - "public class X {\n" + - " X() thr\n" + - " }\n" + - "}"; - - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "thr"; - String expectedReplacedSource = "thr"; - String expectedUnitDisplayString = - "public class X {\n" + - " X() throws <CompleteOnKeyword:thr> {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'throws' keyword. - */ -public void test0300(){ - String str = - "#\n" + - "public class X {\n" + - " int foo()[] thr\n" + - " }\n" + - "}"; - - String completeBehind = "thr"; - int cursorLocation = str.lastIndexOf("thr") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:thr>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "thr"; - String expectedReplacedSource = "thr"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " int[] foo() throws <CompleteOnKeyword:thr> {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* * Test for 'while' keyword. */ public void test0301(){ @@ -12294,2511 +4594,6 @@ "full ast"); } /* - * Test for 'assert' keyword. - */ -public void test0303(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " ass\n" + - " }\n" + - "}"; - - String completeBehind = "ass"; - int cursorLocation = str.lastIndexOf("ass") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:ass>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "ass"; - expectedReplacedSource = "ass"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:ass>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'assert' keyword. - */ -public void test0304(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " if(ass\n" + - " }\n" + - "}"; - - String completeBehind = "ass"; - int cursorLocation = str.lastIndexOf("ass") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:ass>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "ass"; - expectedReplacedSource = "ass"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:ass>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0305(){ - String str = - "#\n" + - "fin"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:fin>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0306(){ - String str = - "#\n" + - "public fin"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:fin>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0307(){ - String str = - "#\n" + - "fin zzz"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:fin>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0308(){ - String str = - "#\n" + - "final fin"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:fin>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0309(){ - String str = - "#\n" + - "abstract fin"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:fin>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0310(){ - String str = - "#\n" + - "public fin class X {}"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:fin>;\n" + - "class X {\n" + - " X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0311(){ - String str = - "#\n" + - "public class X {\n" + - " fin\n" + - "}"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:fin>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0312(){ - String str = - "#\n" + - "public class X {\n" + - " public fin\n" + - "}"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:fin>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0313(){ - String str = - "#\n" + - "public class X {\n" + - " fin zzz\n" + - "}"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:fin>;"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:fin>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0314(){ - String str = - "#\n" + - "public class X {\n" + - " final fin\n" + - "}"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:fin>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'final' keyword. - */ -public void test0315(){ - String str = - "#\n" + - "public class X {\n" + - " abstract fin\n" + - "}"; - - String completeBehind = "fin"; - int cursorLocation = str.lastIndexOf("fin") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:fin>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "fin"; - String expectedReplacedSource = "fin"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:fin>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'native' keyword. - */ -public void test0316(){ - String str = - "#\n" + - "public class X {\n" + - " nat\n" + - "}"; - - String completeBehind = "nat"; - int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:nat>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "nat"; - String expectedReplacedSource = "nat"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:nat>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'native' keyword. - */ -public void test0317(){ - String str = - "#\n" + - "public class X {\n" + - " public nat\n" + - "}"; - - String completeBehind = "nat"; - int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:nat>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "nat"; - String expectedReplacedSource = "nat"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:nat>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'native' keyword. - */ -public void test0318(){ - String str = - "#\n" + - "public class X {\n" + - " transient nat\n" + - "}"; - - String completeBehind = "nat"; - int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:nat>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "nat"; - String expectedReplacedSource = "nat"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:nat>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'native' keyword. - */ -public void test0319(){ - String str = - "#\n" + - "public class X {\n" + - " transient nat\n" + - "}"; - - String completeBehind = "nat"; - int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:nat>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "nat"; - String expectedReplacedSource = "nat"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:nat>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'native' keyword. - */ -public void test0320(){ - String str = - "#\n" + - "public class X {\n" + - " volatile nat\n" + - "}"; - - String completeBehind = "nat"; - int cursorLocation = str.lastIndexOf("nat") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:nat>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "nat"; - String expectedReplacedSource = "nat"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:nat>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'strictfp' keyword. - */ -public void test0321(){ - String str = - "#\n" + - "public class X {\n" + - " str\n" + - "}"; - - String completeBehind = "str"; - int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:str>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "str"; - String expectedReplacedSource = "str"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:str>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'strictfp' keyword. - */ -public void test0322(){ - String str = - "#\n" + - "public class X {\n" + - " public str\n" + - "}"; - - String completeBehind = "str"; - int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:str>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "str"; - String expectedReplacedSource = "str"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:str>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'strictfp' keyword. - */ -public void test0323(){ - String str = - "#\n" + - "public class X {\n" + - " transient str\n" + - "}"; - - String completeBehind = "str"; - int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:str>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "str"; - String expectedReplacedSource = "str"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:str>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'strictfp' keyword. - */ -public void test0324(){ - String str = - "#\n" + - "public class X {\n" + - " transient str\n" + - "}"; - - String completeBehind = "str"; - int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:str>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "str"; - String expectedReplacedSource = "str"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:str>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'strictfp' keyword. - */ -public void test0325(){ - String str = - "#\n" + - "public class X {\n" + - " volatile str\n" + - "}"; - - String completeBehind = "str"; - int cursorLocation = str.lastIndexOf("str") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:str>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "str"; - String expectedReplacedSource = "str"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:str>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'volatile' keyword. - */ -public void test0326(){ - String str = - "#\n" + - "public class X {\n" + - " vol\n" + - "}"; - - String completeBehind = "vol"; - int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:vol>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "vol"; - String expectedReplacedSource = "vol"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:vol>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'volatile' keyword. - */ -public void test0327(){ - String str = - "#\n" + - "public class X {\n" + - " public vol\n" + - "}"; - - String completeBehind = "vol"; - int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:vol>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "vol"; - String expectedReplacedSource = "vol"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:vol>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'volatile' keyword. - */ -public void test0328(){ - String str = - "#\n" + - "public class X {\n" + - " transient vol\n" + - "}"; - - String completeBehind = "vol"; - int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:vol>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "vol"; - String expectedReplacedSource = "vol"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:vol>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'volatile' keyword. - */ -public void test0329(){ - String str = - "#\n" + - "public class X {\n" + - " volatile vol\n" + - "}"; - - String completeBehind = "vol"; - int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:vol>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "vol"; - String expectedReplacedSource = "vol"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:vol>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'volatile' keyword. - */ -public void test0330(){ - String str = - "#\n" + - "public class X {\n" + - " native vol\n" + - "}"; - - String completeBehind = "vol"; - int cursorLocation = str.lastIndexOf("vol") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:vol>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "vol"; - String expectedReplacedSource = "vol"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:vol>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'transient' keyword. - */ -public void test0331(){ - String str = - "#\n" + - "public class X {\n" + - " tra\n" + - "}"; - - String completeBehind = "tra"; - int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:tra>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "tra"; - String expectedReplacedSource = "tra"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:tra>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'transient' keyword. - */ -public void test0332(){ - String str = - "#\n" + - "public class X {\n" + - " public tra\n" + - "}"; - - String completeBehind = "tra"; - int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:tra>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "tra"; - String expectedReplacedSource = "tra"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:tra>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'transient' keyword. - */ -public void test0333(){ - String str = - "#\n" + - "public class X {\n" + - " transient tra\n" + - "}"; - - String completeBehind = "tra"; - int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:tra>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "tra"; - String expectedReplacedSource = "tra"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:tra>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'transient' keyword. - */ -public void test0334(){ - String str = - "#\n" + - "public class X {\n" + - " volatile tra\n" + - "}"; - - String completeBehind = "tra"; - int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:tra>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "tra"; - String expectedReplacedSource = "tra"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:tra>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'transient' keyword. - */ -public void test0335(){ - String str = - "#\n" + - "public class X {\n" + - " native tra\n" + - "}"; - - String completeBehind = "tra"; - int cursorLocation = str.lastIndexOf("tra") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:tra>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "tra"; - String expectedReplacedSource = "tra"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:tra>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0336(){ - String str = - "#\n" + - "public class X {\n" + - " syn\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:syn>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "syn"; - String expectedReplacedSource = "syn"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:syn>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0337(){ - String str = - "#\n" + - "public class X {\n" + - " public syn\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:syn>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "syn"; - String expectedReplacedSource = "syn"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:syn>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0338(){ - String str = - "#\n" + - "public class X {\n" + - " transient syn\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:syn>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "syn"; - String expectedReplacedSource = "syn"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:syn>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0339(){ - String str = - "#\n" + - "public class X {\n" + - " transient syn\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:syn>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "syn"; - String expectedReplacedSource = "syn"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:syn>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0340(){ - String str = - "#\n" + - "public class X {\n" + - " volatile syn\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:syn>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "syn"; - String expectedReplacedSource = "syn"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:syn>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0341(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " syn\n" + - " }\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:syn>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "syn"; - expectedReplacedSource = "syn"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:syn>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'synchronized' keyword. - */ -public void test0342(){ - String str = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " if(syn\n" + - " }\n" + - "}"; - - String completeBehind = "syn"; - int cursorLocation = str.lastIndexOf("syn") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:syn>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "syn"; - expectedReplacedSource = "syn"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:syn>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* - * Test for 'static' keyword. - */ -public void test0343(){ - String str = - "#\n" + - "public class X {\n" + - " sta\n" + - "}"; - - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf("sta") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:sta>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "sta"; - String expectedReplacedSource = "sta"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:sta>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'static' keyword. - */ -public void test0344(){ - String str = - "#\n" + - "public class X {\n" + - " public sta\n" + - "}"; - - String completeBehind = "sta"; - int cursorLocation = str.lastIndexOf("sta") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:sta>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "sta"; - String expectedReplacedSource = "sta"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:sta>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0345(){ - String str = - "#\n" + - "pub"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pub>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0346(){ - String str = - "#\n" + - "final pub"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pub>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0347(){ - String str = - "#\n" + - "public pub"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pub>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0348(){ - String str = - "#\n" + - "private pub"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pub>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0349(){ - String str = - "#\n" + - "public class X{}\n" + - "pub"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pub>;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0350(){ - String str = - "#\n" + - "public class X{\n" + - " pub\n" + - "}"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pub>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0351(){ - String str = - "#\n" + - "public class X{\n" + - " public pub\n" + - "}"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pub>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0352(){ - String str = - "#\n" + - "public class X{\n" + - " private pub\n" + - "}"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pub>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0353(){ - String str = - "#\n" + - "public class X{\n" + - " protected pub\n" + - "}"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pub>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'public' keyword. - */ -public void test0354(){ - String str = - "#\n" + - "public class X{\n" + - " abstract pub\n" + - "}"; - - String completeBehind = "pub"; - int cursorLocation = str.lastIndexOf("pub") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pub>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pub"; - String expectedReplacedSource = "pub"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pub>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0355(){ - String str = - "#\n" + - "pro"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - ""; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0356(){ - String str = - "#\n" + - "final pro"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pro>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0357(){ - String str = - "#\n" + - "public pro"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pro>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0358(){ - String str = - "#\n" + - "private pro"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pro>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0359(){ - String str = - "#\n" + - "public class X{}\n" + - "pro"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pro>;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0360(){ - String str = - "#\n" + - "public class X{\n" + - " pro\n" + - "}"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pro>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0361(){ - String str = - "#\n" + - "public class X{\n" + - " public pro\n" + - "}"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pro>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0362(){ - String str = - "#\n" + - "public class X{\n" + - " private pro\n" + - "}"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pro>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0363(){ - String str = - "#\n" + - "public class X{\n" + - " protected pro\n" + - "}"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pro>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'protected' keyword. - */ -public void test0364(){ - String str = - "#\n" + - "public class X{\n" + - " abstract pro\n" + - "}"; - - String completeBehind = "pro"; - int cursorLocation = str.lastIndexOf("pro") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pro>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pro"; - String expectedReplacedSource = "pro"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pro>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0365(){ - String str = - "#\n" + - "pri"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - ""; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0366(){ - String str = - "#\n" + - "final pri"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pri>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0367(){ - String str = - "#\n" + - "public pri"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pri>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0368(){ - String str = - "#\n" + - "private pri"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pri>;\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0369(){ - String str = - "#\n" + - "public class X{}\n" + - "pri"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnKeyword:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "import <CompleteOnKeyword:pri>;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0370(){ - String str = - "#\n" + - "public class X{\n" + - " pri\n" + - "}"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pri>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0371(){ - String str = - "#\n" + - "public class X{\n" + - " public pri\n" + - "}"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pri>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0372(){ - String str = - "#\n" + - "public class X{\n" + - " private pri\n" + - "}"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pri>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0373(){ - String str = - "#\n" + - "public class X{\n" + - " protected pri\n" + - "}"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pri>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'private' keyword. - */ -public void test0374(){ - String str = - "#\n" + - "public class X{\n" + - " abstract pri\n" + - "}"; - - String completeBehind = "pri"; - int cursorLocation = str.lastIndexOf("pri") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<CompleteOnType:pri>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "pri"; - String expectedReplacedSource = "pri"; - String expectedUnitDisplayString = - "public class X {\n" + - " <CompleteOnType:pri>;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); -} -/* - * Test for 'super' keyword. - */ -public void test0375(){ - String str = - "public class X {\n" + - " void foo(){\n" + - " #\n" + - " sup\n" + - " }\n" + - "}\n"; - - String completeBehind = "sup"; - int cursorLocation = str.lastIndexOf("sup") + completeBehind.length() - 1; - - String expectedCompletionNodeToString = "<NONE>"; - String expectedParentNodeToString = "<NONE>"; - String completionIdentifier = "<NONE>"; - String expectedReplacedSource = "<NONE>"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "diet ast"); - - expectedCompletionNodeToString = "<CompleteOnName:sup>"; - expectedParentNodeToString = "<NONE>"; - completionIdentifier = "sup"; - expectedReplacedSource = "sup"; - expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:sup>;\n" + - " }\n" + - "}\n"; - - checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedParentNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - "full ast"); -} -/* * Test for 'this' keyword. */ public void test0376(){
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionRecoveryTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionRecoveryTest.java deleted file mode 100644 index b0ce013..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/CompletionRecoveryTest.java +++ /dev/null
@@ -1,1031 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import junit.framework.Test; - -public class CompletionRecoveryTest extends AbstractCompletionTest { -public CompletionRecoveryTest(String testName){ - super(testName); -} -static { -// TESTS_NUMBERS = new int[] { 22 }; -} -public static Test suite() { - return buildAllCompliancesTestSuite(CompletionRecoveryTest.class); -} -/* - * Complete on variable behind ill-formed declaration - */ -public void test01() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOException { \n" + - " int foo(){ \n" + - " String str = ; \n" + - " str. \n"; - - String completeBehind = "str."; - String expectedCompletionNodeToString = "<CompleteOnName:str.>"; - String completionIdentifier = ""; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends IOException {\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " String str;\n" + - " <CompleteOnName:str.>;\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "str."; - String testName = "<complete on variable behind ill-formed declaration>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on variable behind ill-formed declaration and nested block - */ -public void test02() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOException { \n" + - " int foo(){ \n" + - " String str = ; \n" + - " { \n" + - " int i; \n" + - " str. \n"; - - String completeBehind = "str."; - String expectedCompletionNodeToString = "<CompleteOnName:str.>"; - String completionIdentifier = ""; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends IOException {\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " String str;\n" + - " {\n" + - " int i;\n" + - " <CompleteOnName:str.>;\n" + - " }\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "str."; - String testName = "<complete on variable behind ill-formed declaration and nested block>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on variable behind ill-formed declaration and inside local type field initialization - */ -public void test03() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOException { \n" + - " int foo(){ \n" + - " final String str = ; \n" + - " class L { \n" + - " int i = str \n"; - - String completeBehind = "i = str"; - String expectedCompletionNodeToString = "<CompleteOnName:str>"; - String completionIdentifier = "str"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends IOException {\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " final String str;\n" + - " class L {\n" + - " int i = <CompleteOnName:str>;\n" + - " L() {\n" + - " super();\n" + // could be optimized out - " }\n" + - " }\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "str"; - String testName = "<complete on variable behind ill-formed declaration and inside local type field initialization>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on variable behind closed scope - */ -public void test04() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends \n" + - " int foo(String str) \n" + - " String variable = ; \n" + - " { \n" + - " String variableNotInScope; \n" + - " } \n" + - " foo(varia \n"; - - String completeBehind = "foo(var"; - String expectedCompletionNodeToString = "<CompleteOnName:var>"; - String completionIdentifier = "var"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " int foo(String str) {\n" + - " String variable;\n" + - " foo(<CompleteOnName:var>);\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "varia"; - String testName = "<complete on variable behind closed scope>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on variable str with sibling method stringAppend() - */ -public void test05() { - - String str = - "import java.io.*; \n"+ - " \n"+ - "public class X extends \n"+ - " int foo(String str) \n"+ - " String str = ; \n"+ - " { \n"+ - " String strNotInScope; \n"+ - " } \n"+ - " class L { \n"+ - " int bar(){ \n"+ - " foo(str \n"+ - " void stringAppend(String s1, String s2) \n"; - - String completeBehind = "foo(str"; - String expectedCompletionNodeToString = "<CompleteOnName:str>"; - String completionIdentifier = "str"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " int foo(String str) {\n" + - " String str;\n" + - " class L {\n" + - " L() {\n" + - " }\n" + - " int bar() {\n" + - " foo(<CompleteOnName:str>);\n" + - " }\n" + - " void stringAppend(String s1, String s2) {\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "str"; - String testName = "<complete on variable str with sibling method stringAppend()>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on variable str with sibling method stringAppend(), eliminating - * uninteresting method bodies - */ -public void test06() { - - String str = - "import java.io.*; \n"+ - " \n"+ - "public class X extends \n"+ - " int foo(String str) \n"+ - " String str = ; \n"+ - " { \n"+ - " String strNotInScope; \n"+ - " } \n"+ - " class L { \n"+ - " int notInterestingBody(){ \n"+ - " System.out.println(); \n"+ - " } \n"+ - " int bar(){ \n"+ - " foo(str \n"+ - " void stringAppend(String s1, String s2) \n"; - - String completeBehind = "foo(str"; - String expectedCompletionNodeToString = "<CompleteOnName:str>"; - String completionIdentifier = "str"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " int foo(String str) {\n" + - " String str;\n" + - " class L {\n" + - " L() {\n" + - " }\n" + - " int notInterestingBody() {\n" + - " }\n" + - " int bar() {\n" + - " foo(<CompleteOnName:str>);\n" + - " }\n" + - " void stringAppend(String s1, String s2) {\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedReplacedSource = "str"; - String testName = "<complete on variable eliminating other uninteresting method bodies>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on new keyword - */ -public void test07(){ - - String str = - "import java.io.* \n" + - " \n" + - "public class X extends IOException { \n" + - " int foo() { \n" + - " X x = new X( \n" + - "} \n"; - - String completeBehind = "= n"; - String expectedCompletionNodeToString = "<CompleteOnName:n>"; - String completionIdentifier = "n"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends IOException {\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " X x = <CompleteOnName:n>;\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "new"; - String testName = "<complete on new keyword>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkMethodParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on field type in anonymous type. - */ -public void test08() { - this.runTestCheckDietParse( - // compilationUnit: - "package test;\n" + - "import java.util.Vector;\n" + - "public class VA {\n" + - " Object o1 = new Object() {\n" + - " V\n" + - " void foo2() {\n" + - " int i = 1;\n" + - " }\n" + - " };\n" + - " String s2;\n" + - " void bar() {\n" + - " }\n" + - " void foo() { \n" + - " new String[] {}..equals()\n" + - " }\n" + - "}\n", - // completeBehind: - " V", - // expectedCompletionNodeToString: - "<CompleteOnType:V>", - // expectedUnitDisplayString: - "package test;\n" + - "import java.util.Vector;\n" + - "public class VA {\n" + - " Object o1 = new Object() {\n" + - " <CompleteOnType:V>;\n" + - " void foo2() {\n" + - " }\n" + - " };\n" + - " String s2;\n" + - " public VA() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "V", - // expectedReplacedSource: - "V", - // test name - "<completion on field type in anonymous type>" - ); -} -/* - * Complete on argument name - */ -public void test09() { - this.runTestCheckDietParse( - // compilationUnit: - "package pack; \n"+ - "class A { \n"+ - " \n"+ - " public static void main(String[] argv \n"+ - " new Member().f \n"+ - " ; \n"+ - " } \n"+ - " class Member { \n"+ - " int foo() \n"+ - " } \n"+ - " } \n"+ - "}; \n", - // completeBehind: - "argv", - // expectedCompletionNodeToString: - "<CompleteOnArgumentName:String[] argv>", - // expectedUnitDisplayString: - "package pack;\n" + - "class A {\n" + - " class Member {\n" + - " Member() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " }\n" + - " A() {\n" + - " }\n" + - " public static void main(<CompleteOnArgumentName:String[] argv>) {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "argv", - // expectedReplacedSource: - "argv", - // test name - "<completion on argument name>" - ); -} -/* - * Complete on argument name - */ -public void test10() { - this.runTestCheckMethodParse( - // compilationUnit: - "package pack; \n"+ - "class A { \n"+ - " \n"+ - " public static void main(String[] argv \n"+ - " new Member().f \n"+ - " ; \n"+ - " } \n"+ - " class Member { \n"+ - " int foo() \n"+ - " } \n"+ - " } \n"+ - "}; \n", - // completeBehind: - "argv", - // expectedCompletionNodeToString: - "<CompleteOnName:>", - // expectedUnitDisplayString: - "package pack;\n" + - "class A {\n" + - " class Member {\n" + - " Member() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " }\n" + - " A() {\n" + - " }\n" + - " public static void main(<CompleteOnArgumentName:String[] argv>) {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<completion on argument name>" - ); -} -/* - * Complete inside method with incomplete signature - */ -public void test11() { - this.runTestCheckMethodParse( - // compilationUnit: - "package pack; \n"+ - "class A { \n"+ - " \n"+ - " public static void main(String[] argv \n"+ - " new Member().f \n"+ - " ; \n"+ - " } \n"+ - " class Member { \n"+ - " int foo() \n"+ - " } \n"+ - " } \n"+ - "}; \n", - // completeBehind: - "new Member().f", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:new Member().f>", - // expectedUnitDisplayString: - "package pack;\n" + - "class A {\n" + - " class Member {\n" + - " Member() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " }\n" + - " A() {\n" + - " }\n" + - " public static void main(String[] argv) {\n" + - " <CompleteOnMemberAccess:new Member().f>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "f", - // expectedReplacedSource: - "f", - // test name - "<complete inside method with incomplete signature>" - ); -} -/* - * Complete on argument name with class decl later on - */ -public void test12() { - this.runTestCheckMethodParse( - // compilationUnit: - "class DD { \n"+ - " public static void main(String[] argv \n"+ - " \n"+ - "class D { \n"+ - " \n"+ - " int i; \n"+ - " class Mem1 {} \n"+ - " int dumb(String s) \n"+ - " int dumb(float fNum, double dNum) { \n"+ - " dumb(\"world\", i); \n"+ - " \n"+ - " if (i == 0) { \n"+ - " class Local { \n"+ - " \n"+ - " int hello() \n", - // completeBehind: - "argv", - // expectedCompletionNodeToString: - "<CompleteOnName:>", - // expectedUnitDisplayString: - "class DD {\n" + - " DD() {\n" + - " }\n" + - " public static void main(<CompleteOnArgumentName:String[] argv>) {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<complete on argument name with class decl later on>" - ); -} -/* - * Complete behind array type - */ -public void test13() { - this.runTestCheckMethodParse( - // compilationUnit: - "class C { \n"+ - " void test() { \n"+ - " String[]. \n"+ - " } \n"+ - "} \n", - // completeBehind: - "String[].", - // expectedCompletionNodeToString: - "<CompleteOnClassLiteralAccess:String[].>", - // expectedUnitDisplayString: - "class C {\n" + - " C() {\n" + - " }\n" + - " void test() {\n" + - " <CompleteOnClassLiteralAccess:String[].>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "String[].", - // test name - "<complete behind array type>" - ); -} -/* - * Complete inside array type - */ -public void test14() { - this.runTestCheckDietParse( - // compilationUnit: - "public class B { \n"+ - " class Member {} \n"+ - " \n"+ - " int[] j; \n", - // completeBehind: - "int[", - // expectedCompletionNodeToString: - NONE, - // expectedUnitDisplayString: - "public class B {\n" + - " class Member {\n" + - " Member() {\n" + - " }\n" + - " }\n" + - " public B() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - NONE, - // test name - "<complete inside array type>" - ); -} -/* - * Complete inside array type - */ -public void test15() { - this.runTestCheckDietParse( - // compilationUnit: - "public class B { \n"+ - " class Member {} \n"+ - " \n"+ - " int[ \n", - // completeBehind: - "int[", - // expectedCompletionNodeToString: - NONE, - // expectedUnitDisplayString: - "public class B {\n" + - " class Member {\n" + - " Member() {\n" + - " }\n" + - " }\n" + - " public B() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - NONE, - // test name - "<complete inside array type>" - ); -} -/* - * Complete behind invalid array type - */ -public void test16() { - this.runTestCheckDietParse( - // compilationUnit: - "public class B { \n"+ - " class Member {} \n"+ - " \n"+ - " int[ \n"+ - " Obje \n", - // completeBehind: - "Obje", - // expectedCompletionNodeToString: - "<CompleteOnType:Obje>", - // expectedUnitDisplayString: - "public class B {\n" + - " class Member {\n" + - " Member() {\n" + - " }\n" + - " }\n" + - " <CompleteOnType:Obje>;\n" + - " public B() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "Obje", - // expectedReplacedSource: - "Obje", - // test name - "<complete behind invalid array type>" - ); -} -/* - * Complete behind invalid base type - */ -public void test17() { - this.runTestCheckMethodParse( - // compilationUnit: - "class D { \n" + - " class Member {} \n" + - " \n" + - " void test() { \n" + - " int. \n" + - " test(); \n" + - " } \n", - // completeBehind: - "int.", - // expectedCompletionNodeToString: - "<CompleteOnClassLiteralAccess:int.>", - // expectedUnitDisplayString: - "class D {\n" + - " class Member {\n" + - " Member() {\n" + - " }\n" + - " }\n" + - " D() {\n" + - " }\n" + - " void test() {\n" + - " <CompleteOnClassLiteralAccess:int.>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "int.", - // test name - "<complete behind invalid base type>" - ); -} -/* - * Complete behind incomplete local method header - */ -public void test18() { - this.runTestCheckMethodParse( - // compilationUnit: - "class E { \n"+ - " int bar() { \n"+ - " class Local { \n"+ - " int hello() { \n", - // completeBehind: - "hello()", - // expectedCompletionNodeToString: - "<CompleteOnName:>", - // expectedUnitDisplayString: - "class E {\n" + - " E() {\n" + - " }\n" + - " int bar() {\n" + - " class Local {\n" + - " Local() {\n" + - " }\n" + - " int hello() {\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<complete behind incomplete local method header>" - ); -} -/* - * Complete behind catch variable - */ -public void test19() { - this.runTestCheckMethodParse( - // compilationUnit: - "public class Test { \n" + - " void foo() { \n" + - " try { \n" + - " } catch (Exception e) { \n" + - " } \n" + - " e \n" + - " } \n" + - "} \n", - // completeBehind: - "\n\t\te", - // expectedCompletionNodeToString: - "<CompleteOnName:e>", - // expectedUnitDisplayString: - "public class Test {\n" + - " public Test() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:e>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "e", - // expectedReplacedSource: - "e", - // test name - "<complete behind catch variable>" - ); -} -/* - * Complete on catch variable - */ -public void test20() { - this.runTestCheckMethodParse( - // compilationUnit: - "public class Test { \n" + - " void foo() { \n" + - " try { \n" + - " } catch (Exception e) { \n" + - " e \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "\n\t\t\te", - // expectedCompletionNodeToString: - "<CompleteOnName:e>", - // expectedUnitDisplayString: - "public class Test {\n" + - " public Test() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " Exception e;\n" + - " <CompleteOnName:e>;\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "e", - // expectedReplacedSource: - "e", - // test name - "<complete on catch variable>" - ); -} -/* - * Complete on catch variable after syntax error - */ -public void test21() { - this.runTestCheckMethodParse( - // compilationUnit: - "public class Test { \n" + - " void foo() { \n" + - " try { \n" + - " bar \n" + - " } catch (Exception e) { \n" + - " e \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "\n\t\t\te", - // expectedCompletionNodeToString: - "<CompleteOnName:e>", - // expectedUnitDisplayString: - "public class Test {\n" + - " public Test() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " Exception e;\n" + - " <CompleteOnName:e>;\n" + - " }\n" + - " }\n" + - "}\n" - , - // expectedCompletionIdentifier: - "e", - // expectedReplacedSource: - "e", - // test name - "<complete on catch variable after syntax error>" - ); -} -/* - * Complete on constructor type name - * 1G1HF7P: ITPCOM:WIN98 - CodeAssist may not work in constructor signature - */ -public void test22() { - this.runTestCheckDietParse( - // compilationUnit: - "public class SomeType {\n" + - " public SomeType(int i){}\n" + - "}\n" + - "\n" + - "class SomeOtherType extends SomeType {\n" + - " SomeOtherType(int i){\n" + - " super(i);\n" + - " }\n" + - "}\n", - // completeBehind: - " SomeOther", - // expectedCompletionNodeToString: - "<CompleteOnType:SomeOther>", - // expectedUnitDisplayString: - "public class SomeType {\n" + - " public SomeType(int i) {\n" + - " }\n" + - "}\n" + - "class SomeOtherType extends SomeType {\n" + - " <CompleteOnType:SomeOther>;\n" + - " int i;\n" + - " {\n" + - " }\n" + - " SomeOtherType() {\n" + - " }\n" + - "}\n" - , - // expectedCompletionIdentifier: - "SomeOther", - // expectedReplacedSource: - "SomeOtherType", - // test name - "<complete on constructor type name>" - ); -} -/** - * Complete in initializer in recovery mode - */ -public void test23() { - this.runTestCheckMethodParse( - // compilationUnit: - "package p;\n" + - "public class X {\n" + - " void foo(){)\n" + - " {\n" + - " Obj\n" + - " }\n" + - " }\n" + - "}\n", - // completeBehind: - "Obj", - // expectedCompletionNodeToString: - "<CompleteOnName:Obj>", - // expectedUnitDisplayString: - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " <CompleteOnName:Obj>;\n" + - " }\n" + - " }\n" + - "}\n" - , - // expectedCompletionIdentifier: - "Obj", - // expectedReplacedSource: - "Obj", - // test name - "<complete in initializer>" - ); -} -/** - * Complete after initializer in recovery mode - */ -public void test24() { - this.runTestCheckMethodParse( - // compilationUnit: - "package p;\n" + - "public class X {\n" + - " void foo(){)\n" + - " int v1;\n" + - " {\n" + - " int v2\n" + - " }\n" + - " Obj" + - " }\n" + - "}\n", - // completeBehind: - "Obj", - // expectedCompletionNodeToString: - "<CompleteOnName:Obj>", - // expectedUnitDisplayString: - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " int v1;\n" + - " <CompleteOnName:Obj>;\n" + - " }\n" + - "}\n" - , - // expectedCompletionIdentifier: - "Obj", - // expectedReplacedSource: - "Obj", - // test name - "<complete after initializer>" - ); -} -/** - * Complete after dot, before a number .<|>12 - */ -public void test25() { - this.runTestCheckMethodParse( - // compilationUnit: - "package p;\n" + - "public class X {\n" + - " void foo(){\n" + - " this.12\n" + - " }\n" + - "}\n", - // completeBehind: - "this.", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:this.>", - // expectedUnitDisplayString: - "package p;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:this.>;\n" + - " }\n" + - "}\n" - , - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "this.", - // test name - "<complete after dot number>" - ); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java deleted file mode 100644 index c384268..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java +++ /dev/null
@@ -1,2375 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.core.tests.compiler.regression.AbstractRegressionTest; - -public class ComplianceDiagnoseTest extends AbstractRegressionTest { - public ComplianceDiagnoseTest(String name) { - super(name); - } -// Static initializer to specify tests subset using TESTS_* static variables -// All specified tests which does not belong to the class are skipped... -//static { -// TESTS_NAMES = new String[] { "test000" }; -// TESTS_NUMBERS = new int[] { 50 }; -// TESTS_RANGE = new int[] { 21, 50 }; -//} -public static Test suite() { - return buildAllCompliancesTestSuite(testClass()); -} -public static Class testClass() { - return ComplianceDiagnoseTest.class; -} -public void runComplianceParserTest( - String[] testFiles, - String expected13ProblemLog, - String expected14ProblemLog, - String expected15ProblemLog){ - if(COMPLIANCE_1_3.equals(this.complianceLevel)) { - this.runNegativeTest(testFiles, expected13ProblemLog); - } else if(COMPLIANCE_1_4.equals(this.complianceLevel)) { - this.runNegativeTest(testFiles, expected14ProblemLog); - } else if(this.complianceLevel.compareTo(COMPLIANCE_1_5) >= 0) { - this.runNegativeTest(testFiles, expected15ProblemLog); - } -} -public void test0001() { - String[] testFiles = new String[] { - "X.java", - "import static aaa.BBB.*;\n" + - "public class X {\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import static aaa.BBB.*;\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error, static imports are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " import static aaa.BBB.*;\n" + - " ^^^\n" + - "The import aaa cannot be resolved\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import static aaa.BBB.*;\n" + - " ^^^\n" + - "The import aaa cannot be resolved\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0002() { - String[] testFiles = new String[] { - "X.java", - "import static aaa.BBB.CCC;\n" + - "public class X {\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import static aaa.BBB.CCC;\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error, static imports are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " import static aaa.BBB.CCC;\n" + - " ^^^\n" + - "The import aaa cannot be resolved\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import static aaa.BBB.CCC;\n" + - " ^^^\n" + - "The import aaa cannot be resolved\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0003() { - String[] testFiles = new String[] { - "X.java", - "public enum X {\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public enum X {\n" + - " ^^^^\n" + - "Syntax error on token \"enum\", interface expected\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - ""; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0004() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo(){\n" + - " for(String o: c) {\n" + - " }\n" + - " }\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " for(String o: c) {\n" + - " ^^^^^^^^^^^\n" + - "Syntax error, \'for each\' statements are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 3)\n" + - " for(String o: c) {\n" + - " ^\n" + - "c cannot be resolved\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " for(String o: c) {\n" + - " ^\n" + - "c cannot be resolved\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0005() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo(Z ... arg){\n" + - " }\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " void foo(Z ... arg){\n" + - " ^^^^^^^^^\n" + - "Syntax error, varargs are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " void foo(Z ... arg){\n" + - " ^\n" + - "Z cannot be resolved to a type\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " void foo(Z ... arg){\n" + - " ^\n" + - "Z cannot be resolved to a type\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0006() { - String[] testFiles = new String[] { - "X.java", - "public class X <T1 extends String, T2> extends Y {\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X <T1 extends String, T2> extends Y {\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error, type parameters are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " public class X <T1 extends String, T2> extends Y {\n" + - " ^\n" + - "Y cannot be resolved to a type\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. WARNING in X.java (at line 1)\n" + - " public class X <T1 extends String, T2> extends Y {\n" + - " ^^^^^^\n" + - "The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " public class X <T1 extends String, T2> extends Y {\n" + - " ^\n" + - "Y cannot be resolved to a type\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0007() { - String[] testFiles = new String[] { - "X.java", - "public interface X <T1 extends String, T2> extends Y {\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public interface X <T1 extends String, T2> extends Y {\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error, type parameters are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " public interface X <T1 extends String, T2> extends Y {\n" + - " ^\n" + - "Y cannot be resolved to a type\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. WARNING in X.java (at line 1)\n" + - " public interface X <T1 extends String, T2> extends Y {\n" + - " ^^^^^^\n" + - "The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " public interface X <T1 extends String, T2> extends Y {\n" + - " ^\n" + - "Y cannot be resolved to a type\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0008() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " public <T1 extends String, T2> int foo(){\n" + - " }\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " public <T1 extends String, T2> int foo(){\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error, type parameters are only available if source level is 5.0\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. WARNING in X.java (at line 2)\n" + - " public <T1 extends String, T2> int foo(){\n" + - " ^^^^^^\n" + - "The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " public <T1 extends String, T2> int foo(){\n" + - " ^^^^^\n" + - "This method must return a result of type int\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0009() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " public <T1 extends String, T2> X(){\n" + - " }\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " public <T1 extends String, T2> X(){\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error, type parameters are only available if source level is 5.0\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. WARNING in X.java (at line 2)\n" + - " public <T1 extends String, T2> X(){\n" + - " ^^^^^^\n" + - "The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0010() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " Z<Y1, Y2> var;\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^\n" + - "Z cannot be resolved to a type\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^^^^^^\n" + - "Syntax error, parameterized types are only available if source level is 5.0\n" + - "----------\n" + - "3. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^^\n" + - "Y1 cannot be resolved to a type\n" + - "----------\n" + - "4. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^^\n" + - "Y2 cannot be resolved to a type\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^\n" + - "Z cannot be resolved to a type\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^^\n" + - "Y1 cannot be resolved to a type\n" + - "----------\n" + - "3. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^^\n" + - "Y2 cannot be resolved to a type\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0011() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " public X(){\n" + - " <Y1, Y2>this(null);\n" + - " }\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " <Y1, Y2>this(null);\n" + - " ^^^^^^\n" + - "Syntax error, parameterized types are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 3)\n" + - " <Y1, Y2>this(null);\n" + - " ^^\n" + - "Y1 cannot be resolved to a type\n" + - "----------\n" + - "3. ERROR in X.java (at line 3)\n" + - " <Y1, Y2>this(null);\n" + - " ^^\n" + - "Y2 cannot be resolved to a type\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " <Y1, Y2>this(null);\n" + - " ^^\n" + - "Y1 cannot be resolved to a type\n" + - "----------\n" + - "2. ERROR in X.java (at line 3)\n" + - " <Y1, Y2>this(null);\n" + - " ^^\n" + - "Y2 cannot be resolved to a type\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0012() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo() {\n" + - " assert true;\n" + - " }\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. WARNING in X.java (at line 3)\n" + - " assert true;\n" + - " ^^^^^^\n" + - "\'assert\' should not be used as an identifier, since it is a reserved keyword from source level 1.4 on\n" + - "----------\n" + - "2. ERROR in X.java (at line 3)\n" + - " assert true;\n" + - " ^^^^^^\n" + - "Syntax error on token \"assert\", AssignmentOperator expected after this token\n" + - "----------\n"; - String expected14ProblemLog = - ""; - - String expected15ProblemLog = - expected14ProblemLog; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0013() { - String[] testFiles = new String[] { - "X.java", - "import static aaa.*\n" + - "public class X {\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import static aaa.*\n" + - " ^^^^^^^^^^^^^^^^^\n" + - "Syntax error, static imports are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " import static aaa.*\n" + - " ^^^\n" + - "The import aaa cannot be resolved\n" + - "----------\n" + - "3. ERROR in X.java (at line 1)\n" + - " import static aaa.*\n" + - " ^\n" + - "Syntax error on token \"*\", ; expected after this token\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import static aaa.*\n" + - " ^^^\n" + - "The import aaa cannot be resolved\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " import static aaa.*\n" + - " ^\n" + - "Syntax error on token \"*\", ; expected after this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0014() { - String[] testFiles = new String[] { - "X.java", - "public enum X \n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public enum X \n" + - "}\n" + - " ^^^^^^^^^\n" + - "Syntax error on tokens, delete these tokens\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public enum X \n" + - " ^\n" + - "Syntax error on token \"X\", { expected after this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0015() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo(){\n" + - " for(String o: c) {\n" + - " #\n" + - " }\n" + - " }\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " for(String o: c) {\n" + - " ^^^^^^^^^^^\n" + - "Syntax error, \'for each\' statements are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 4)\n" + - " #\n" + - " ^\n" + - "Syntax error on token \"Invalid Character\", delete this token\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 4)\n" + - " #\n" + - " ^\n" + - "Syntax error on token \"Invalid Character\", delete this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0016() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo(Z ... arg){\n" + - " }\n" + - " #\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " void foo(Z ... arg){\n" + - " ^^^^^^^^^\n" + - "Syntax error, varargs are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " void foo(Z ... arg){\n" + - " ^\n" + - "Z cannot be resolved to a type\n" + - "----------\n" + - "3. ERROR in X.java (at line 4)\n" + - " #\n" + - " ^\n" + - "Syntax error on token \"Invalid Character\", delete this token\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " void foo(Z ... arg){\n" + - " ^\n" + - "Z cannot be resolved to a type\n" + - "----------\n" + - "2. ERROR in X.java (at line 4)\n" + - " #\n" + - " ^\n" + - "Syntax error on token \"Invalid Character\", delete this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0017() { - String[] testFiles = new String[] { - "X.java", - "public class X <T1 extends String, T2> extends Y {\n" + - " #\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X <T1 extends String, T2> extends Y {\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error, type parameters are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " public class X <T1 extends String, T2> extends Y {\n" + - " ^\n" + - "Y cannot be resolved to a type\n" + - "----------\n" + - "3. ERROR in X.java (at line 2)\n" + - " #\n" + - " ^\n" + - "Syntax error on token \"Invalid Character\", delete this token\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. WARNING in X.java (at line 1)\n" + - " public class X <T1 extends String, T2> extends Y {\n" + - " ^^^^^^\n" + - "The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " public class X <T1 extends String, T2> extends Y {\n" + - " ^\n" + - "Y cannot be resolved to a type\n" + - "----------\n" + - "3. ERROR in X.java (at line 2)\n" + - " #\n" + - " ^\n" + - "Syntax error on token \"Invalid Character\", delete this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0018() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " public <T1 extends String, T2> int foo(){\n" + - " }\n" + - " #\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " public <T1 extends String, T2> int foo(){\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error, type parameters are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 4)\n" + - " #\n" + - " ^\n" + - "Syntax error on token \"Invalid Character\", delete this token\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. WARNING in X.java (at line 2)\n" + - " public <T1 extends String, T2> int foo(){\n" + - " ^^^^^^\n" + - "The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" + - "----------\n" + - "2. ERROR in X.java (at line 4)\n" + - " #\n" + - " ^\n" + - "Syntax error on token \"Invalid Character\", delete this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0019() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " Z<Y1, Y2> var;\n" + - " #\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^\n" + - "Z cannot be resolved to a type\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^^^^^^\n" + - "Syntax error, parameterized types are only available if source level is 5.0\n" + - "----------\n" + - "3. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^^\n" + - "Y1 cannot be resolved to a type\n" + - "----------\n" + - "4. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^^\n" + - "Y2 cannot be resolved to a type\n" + - "----------\n" + - "5. ERROR in X.java (at line 3)\n" + - " #\n" + - " ^\n" + - "Syntax error on token \"Invalid Character\", delete this token\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^\n" + - "Z cannot be resolved to a type\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^^\n" + - "Y1 cannot be resolved to a type\n" + - "----------\n" + - "3. ERROR in X.java (at line 2)\n" + - " Z<Y1, Y2> var;\n" + - " ^^\n" + - "Y2 cannot be resolved to a type\n" + - "----------\n" + - "4. ERROR in X.java (at line 3)\n" + - " #\n" + - " ^\n" + - "Syntax error on token \"Invalid Character\", delete this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0020() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo() {\n" + - " assert true;\n" + - " #\n" + - " }\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. WARNING in X.java (at line 3)\n" + - " assert true;\n" + - " ^^^^^^\n" + - "\'assert\' should not be used as an identifier, since it is a reserved keyword from source level 1.4 on\n" + - "----------\n" + - "2. ERROR in X.java (at line 3)\n" + - " assert true;\n" + - " ^^^^^^\n" + - "Syntax error on token \"assert\", AssignmentOperator expected after this token\n" + - "----------\n" + - "3. ERROR in X.java (at line 4)\n" + - " #\n" + - " ^\n" + - "Syntax error on token \"Invalid Character\", delete this token\n" + - "----------\n"; - String expected14ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 4)\n" + - " #\n" + - " ^\n" + - "Syntax error on token \"Invalid Character\", delete this token\n" + - "----------\n"; - - String expected15ProblemLog = - expected14ProblemLog; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -//TODO (david) suspicious behavior -public void test0021() { - String[] testFiles = new String[] { - "X.java", - "import staic aaa.*;\n" + - "public class X {\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import staic aaa.*;\n" + - " ^^^^^\n" + - "The import staic cannot be resolved\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " import staic aaa.*;\n" + - " ^^^\n" + - "Syntax error on token \"aaa\", delete this token\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import staic aaa.*;\n" + - " ^^^^^\n" + - "Syntax error on token \"staic\", static expected\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " import staic aaa.*;\n" + - " ^^^^^\n" + - "The import staic cannot be resolved\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -//TODO (david) suspicious behavior -public void test0022() { - String[] testFiles = new String[] { - "X.java", - "import static aaa.*.*;\n" + - "public class X {\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import static aaa.*.*;\n" + - " ^^^^^^^^^^^^^^^^^\n" + - "Syntax error, static imports are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " import static aaa.*.*;\n" + - " ^^^\n" + - "The import aaa cannot be resolved\n" + - "----------\n" + - "3. ERROR in X.java (at line 1)\n" + - " import static aaa.*.*;\n" + - " ^^\n" + - "Syntax error on tokens, delete these tokens\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import static aaa.*.*;\n" + - " ^^^\n" + - "The import aaa cannot be resolved\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " import static aaa.*.*;\n" + - " ^\n" + - "Syntax error on token \"*\", Identifier expected\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0023() { - String[] testFiles = new String[] { - "X.java", - "import static for;\n" + - "public class X {\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import static for;\n" + - " ^^^^^^^^^^\n" + - "Syntax error on tokens, Name expected instead\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import static for;\n" + - " ^^^\n" + - "Syntax error on token \"for\", Identifier expected\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} - -//TODO (david) reenable once bug is fixed -public void _test0024() { - String[] testFiles = new String[] { - "X.java", - "import static {aaa};\n" + - "public class X {\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import static {aaa};\n" + - " ^^^^^^^^^^^^\n" + - "Syntax error on tokens, Name expected instead\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " import static {aaa};\n" + - " ^^^^^\n" + - "Syntax error on tokens, Name expected instead\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0025() { - String[] testFiles = new String[] { - "X.java", - "static aaa.*;\n" + - "public class X {\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " static aaa.*;\n" + - " ^^^^^^\n" + - "Syntax error on token \"static\", import expected\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " static aaa.*;\n" + - " ^^^^^^\n" + - "Syntax error on token \"static\", import expected before this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0026() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo(){\n" + - " for(Object o ? c){\n" + - " }\n" + - " }\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " for(Object o ? c){\n" + - " ^^^^^^\n" + - "Syntax error on token \"Object\", ( expected\n" + - "----------\n" + - "2. ERROR in X.java (at line 3)\n" + - " for(Object o ? c){\n" + - " ^^^\n" + - "Syntax error on token(s), misplaced construct(s)\n" + - "----------\n" + - "3. ERROR in X.java (at line 3)\n" + - " for(Object o ? c){\n" + - " ^\n" + - "Syntax error, insert \"AssignmentOperator Expression\" to complete Assignment\n" + - "----------\n" + - "4. ERROR in X.java (at line 3)\n" + - " for(Object o ? c){\n" + - " ^\n" + - "Syntax error, insert \"; ; ) Statement\" to complete BlockStatements\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " for(Object o ? c){\n" + - " ^\n" + - "Syntax error on token \"?\", : expected\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0027() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo(){\n" + - " for(Object o : switch){\n" + - " }\n" + - " }\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " for(Object o : switch){\n" + - " ^\n" + - "Syntax error, insert \"; ; ) Statement\" to complete BlockStatements\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " for(Object o : switch){\n" + - " ^^^^^^\n" + - "Syntax error on token \"switch\", invalid Expression\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0028() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo(int ... ){\n" + - " }\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X {\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " void foo(int ... ){\n" + - " ^^^\n" + - "Syntax error on token \"...\", invalid VariableDeclaratorId\n" + - "----------\n" + - "3. ERROR in X.java (at line 4)\n" + - " }\n" + - " ^\n" + - "Syntax error on token \"}\", delete this token\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X {\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " void foo(int ... ){\n" + - " ^^^\n" + - "Syntax error on token \"...\", VariableDeclaratorId expected after this token\n" + - "----------\n" + - "3. ERROR in X.java (at line 4)\n" + - " }\n" + - " ^\n" + - "Syntax error on token \"}\", delete this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0029() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo(int ... for){\n" + - " }\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X {\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " void foo(int ... for){\n" + - " ^^^^^^^\n" + - "Syntax error on tokens, VariableDeclaratorId expected instead\n" + - "----------\n" + - "3. ERROR in X.java (at line 4)\n" + - " }\n" + - " ^\n" + - "Syntax error on token \"}\", delete this token\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X {\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " void foo(int ... for){\n" + - " ^^^\n" + - "Syntax error on token \"for\", invalid VariableDeclaratorId\n" + - "----------\n" + - "3. ERROR in X.java (at line 4)\n" + - " }\n" + - " ^\n" + - "Syntax error on token \"}\", delete this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0030() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo(int .. aaa){\n" + - " }\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X {\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " void foo(int .. aaa){\n" + - " ^^\n" + - "Syntax error on tokens, delete these tokens\n" + - "----------\n" + - "3. ERROR in X.java (at line 4)\n" + - " }\n" + - " ^\n" + - "Syntax error on token \"}\", delete this token\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X {\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " void foo(int .. aaa){\n" + - " ^^\n" + - "Syntax error on tokens, delete these tokens\n" + - "----------\n" + - "3. ERROR in X.java (at line 4)\n" + - " }\n" + - " ^\n" + - "Syntax error on token \"}\", delete this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0031() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo(int ... aaa bbb){\n" + - " }\n" + - "}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X {\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " void foo(int ... aaa bbb){\n" + - " ^^^^^^^^^^^\n" + - "Syntax error, varargs are only available if source level is 5.0\n" + - "----------\n" + - "3. ERROR in X.java (at line 2)\n" + - " void foo(int ... aaa bbb){\n" + - " ^^^^^^^\n" + - "Syntax error on token(s), misplaced construct(s)\n" + - "----------\n" + - "4. ERROR in X.java (at line 4)\n" + - " }\n" + - " ^\n" + - "Syntax error on token \"}\", delete this token\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X {\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " void foo(int ... aaa bbb){\n" + - " ^^^\n" + - "Syntax error on token \"bbb\", delete this token\n" + - "----------\n" + - "3. ERROR in X.java (at line 4)\n" + - " }\n" + - " ^\n" + - "Syntax error on token \"}\", delete this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0032() { - String[] testFiles = new String[] { - "X.java", - "public class X <T1 extends String, T2 extends Y {\n" + - " \n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X <T1 extends String, T2 extends Y {\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error on token(s), misplaced construct(s)\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. WARNING in X.java (at line 1)\n" + - " public class X <T1 extends String, T2 extends Y {\n" + - " ^^^^^^\n" + - "The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " public class X <T1 extends String, T2 extends Y {\n" + - " ^\n" + - "Syntax error, insert \">\" to complete ReferenceType1\n" + - "----------\n" + - "3. ERROR in X.java (at line 1)\n" + - " public class X <T1 extends String, T2 extends Y {\n" + - " ^\n" + - "Y cannot be resolved to a type\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0033() { - String[] testFiles = new String[] { - "X.java", - "public class X T1 extends String, T2> extends Y {\n" + - " \n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X T1 extends String, T2> extends Y {\n" + - " ^^\n" + - "Syntax error on token \"T1\", delete this token\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " public class X T1 extends String, T2> extends Y {\n" + - " ^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error on tokens, delete these tokens\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X T1 extends String, T2> extends Y {\n" + - " ^\n" + - "Syntax error on token \"X\", < expected after this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0034() { - String[] testFiles = new String[] { - "X.java", - "public class X <T1 extnds String, T2> extends Y {\n" + - " \n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X <T1 extnds String, T2> extends Y {\n" + - " ^\n" + - "Syntax error on token \"<\", { expected\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " public class X <T1 extnds String, T2> extends Y {\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error on tokens, InterfaceHeaderName expected instead\n" + - "----------\n" + - "3. ERROR in X.java (at line 1)\n" + - " public class X <T1 extnds String, T2> extends Y {\n" + - " ^^^^^^\n" + - "extnds cannot be resolved to a type\n" + - "----------\n" + - "4. ERROR in X.java (at line 1)\n" + - " public class X <T1 extnds String, T2> extends Y {\n" + - " ^^^^^^\n" + - "Syntax error on token \"String\", delete this token\n" + - "----------\n" + - "5. ERROR in X.java (at line 3)\n" + - " }\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X <T1 extnds String, T2> extends Y {\n" + - " ^^^^^^\n" + - "Syntax error on token \"extnds\", extends expected\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " public class X <T1 extnds String, T2> extends Y {\n" + - " ^^^^^^\n" + - "extnds cannot be resolved to a type\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0035() { - String[] testFiles = new String[] { - "X.java", - "public class X <T1 extends for, T2> extends Y {\n" + - " \n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X <T1 extends for, T2> extends Y {\n" + - " ^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error on tokens, delete these tokens\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public class X <T1 extends for, T2> extends Y {\n" + - " ^^^\n" + - "Syntax error on token \"for\", invalid ReferenceType\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0036() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " public <T1 extends String, T2> foo(){\n" + - " }\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " public <T1 extends String, T2> foo(){\n" + - " ^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error, type parameters are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " public <T1 extends String, T2> foo(){\n" + - " ^^^^^\n" + - "Return type for the method is missing\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. WARNING in X.java (at line 2)\n" + - " public <T1 extends String, T2> foo(){\n" + - " ^^^^^^\n" + - "The type parameter T1 should not be bounded by the final type String. Final types cannot be further extended\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " public <T1 extends String, T2> foo(){\n" + - " ^^^^^\n" + - "Return type for the method is missing\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0037() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " public <T1 extnds String, T2> int foo(){\n" + - " }\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " public <T1 extnds String, T2> int foo(){\n" + - " ^^^\n" + - "Syntax error on token(s), misplaced construct(s)\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " public <T1 extnds String, T2> int foo(){\n" + - " ^^\n" + - "T1 cannot be resolved to a type\n" + - "----------\n" + - "3. ERROR in X.java (at line 2)\n" + - " public <T1 extnds String, T2> int foo(){\n" + - " ^\n" + - "Syntax error on token \">\", ; expected\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " public <T1 extnds String, T2> int foo(){\n" + - " ^^\n" + - "T1 cannot be resolved to a type\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " public <T1 extnds String, T2> int foo(){\n" + - " ^^^^^^\n" + - "Syntax error on token \"extnds\", extends expected\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0038() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " public <T1 extends String T2> int foo(){\n" + - " }\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " public <T1 extends String T2> int foo(){\n" + - " ^^^^^^^^^^^\n" + - "Syntax error on token(s), misplaced construct(s)\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " public <T1 extends String T2> int foo(){\n" + - " ^\n" + - "Syntax error on token \">\", ; expected\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " public <T1 extends String T2> int foo(){\n" + - " ^^\n" + - "Syntax error on token \"T2\", delete this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0039() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " Z Y1, Y2> var;\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " Z Y1, Y2> var;\n" + - " ^\n" + - "Z cannot be resolved to a type\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " Z Y1, Y2> var;\n" + - " ^\n" + - "Syntax error on token \">\", , expected\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " Z Y1, Y2> var;\n" + - " ^\n" + - "Z cannot be resolved to a type\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " Z Y1, Y2> var;\n" + - " ^\n" + - "Syntax error on token \">\", , expected\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0040() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " Z <Y1, Y2 var;\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " Z <Y1, Y2 var;\n" + - " ^^^^^^^\n" + - "Syntax error on token(s), misplaced construct(s)\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " Z <Y1, Y2 var;\n" + - " ^^\n" + - "Y2 cannot be resolved to a type\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " Z <Y1, Y2 var;\n" + - " ^^\n" + - "Syntax error, insert \">\" to complete ReferenceType1\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " Z <Y1, Y2 var;\n" + - " ^^\n" + - "Y2 cannot be resolved to a type\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0041() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " Z <Y1, for Y2> var;\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " Z <Y1, for Y2> var;\n" + - " ^^^^^^^^^^^^\n" + - "Syntax error on tokens, delete these tokens\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " Z <Y1, for Y2> var;\n" + - " ^^^\n" + - "Syntax error on token \"for\", delete this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0042() { - String[] testFiles = new String[] { - "X.java", - "void ___eval() {\n" + - " new Runnable() {\n" + - " int ___run() throws Throwable {\n" + - " return blah;\n" + - " }\n" + - " private String blarg;\n" + - " public void run() {\n" + - " }\n" + - " };\n" + - "}\n" + - "public class X {\n" + - " private static int x;\n" + - " private String blah;\n" + - " public static void main(String[] args) {\n" + - " }\n" + - " public void hello() {\n" + - " }\n" + - " public boolean blah() {\n" + - " return false;\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 7)\n" + - " public void run() {\n" + - " }\n" + - " };\n" + - "}\n" + - " ^^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error on tokens, delete these tokens\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " void ___eval() {\n" + - " ^^^^\n" + - "Syntax error on token \"void\", @ expected\n" + - "----------\n" + - "2. ERROR in X.java (at line 1)\n" + - " void ___eval() {\n" + - " ^\n" + - "Syntax error on token \")\", delete this token\n" + - "----------\n" + - "3. ERROR in X.java (at line 9)\n" + - " };\n" + - " ^\n" + - "Syntax error on token \"}\", { expected\n" + - "----------\n" + - "4. ERROR in X.java (at line 23)\n" + - " }\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + - "----------\n" + - "5. ERROR in X.java (at line 23)\n" + - " }\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete MemberValueArrayInitializer\n" + - "----------\n" + - "6. ERROR in X.java (at line 23)\n" + - " }\n" + - " ^\n" + - "Syntax error, insert \")\" to complete Modifiers\n" + - "----------\n" + - "7. ERROR in X.java (at line 23)\n" + - " }\n" + - " ^\n" + - "Syntax error, insert \"enum Identifier\" to complete EnumHeader\n" + - "----------\n" + - "8. ERROR in X.java (at line 23)\n" + - " }\n" + - " ^\n" + - "Syntax error, insert \"EnumBody\" to complete JavaScriptUnit\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=72942 - */ -public void test0043() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - "}\n" + - "public static void foo(){}\n" + - "\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " }\n" + - " ^\n" + - "Syntax error on token \"}\", delete this token\n" + - "----------\n" + - "2. ERROR in X.java (at line 3)\n" + - " public static void foo(){}\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - expected13ProblemLog; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=62472 - */ -public void test0044() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " public <T> X(T t){\n" + - " System.out.println(t);\n" + - " }\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " class Local extends X {\n" + - " Local() {\n" + - " <String>super(\"SUCCESS\");\n" + - " }\n" + - " }\n" + - " new Local();\n" + - " }\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " public <T> X(T t){\n" + - " ^\n" + - "Syntax error, type parameters are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " public <T> X(T t){\n" + - " ^\n" + - "T cannot be resolved to a type\n" + - "----------\n" + - "3. ERROR in X.java (at line 5)\n" + - " }\n" + - " ^\n" + - "Syntax error on token \"}\", delete this token\n" + - "----------\n" + - "4. ERROR in X.java (at line 9)\n" + - " <String>super(\"SUCCESS\");\n" + - " ^^^^^^\n" + - "Syntax error, type parameters are only available if source level is 5.0\n" + - "----------\n" + - "5. ERROR in X.java (at line 9)\n" + - " <String>super(\"SUCCESS\");\n" + - " ^^^^^^\n" + - "Syntax error, parameterized types are only available if source level is 5.0\n" + - "----------\n" + - "6. ERROR in X.java (at line 9)\n" + - " <String>super(\"SUCCESS\");\n" + - " ^^^^^^^^^^^^^^^^^\n" + - "The constructor X(String) is undefined\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 5)\n" + - " }\n" + - " ^\n" + - "Syntax error on token \"}\", delete this token\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=62472 - */ -public void test0045() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " public void foo(){\n" + - " }\n" + - " }\n" + - " public void bar() {\n" + - " }\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 4)\n" + - " }\n" + - " ^\n" + - "Syntax error on token \"}\", delete this token\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - expected13ProblemLog; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=74519 - */ -public void test0046() { - String[] testFiles = new String[] { - "X.java", - "public @interface X {\n" + - " String annName();\n" + - "}" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " public @interface X {\n" + - " ^\n" + - "Syntax error, annotation declarations are only available if source level is 5.0\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = ""; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=74519 - */ -public void test0047() { - String[] testFiles = new String[] { - "A.java", - "public @interface A {}", - "X.java", - "@A public class X {\n" + - "}" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in A.java (at line 1)\n" + - " public @interface A {}\n" + - " ^\n" + - "Syntax error, annotation declarations are only available if source level is 5.0\n" + - "----------\n" + - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " @A public class X {\n" + - " ^^\n" + - "Syntax error, annotations are only available if source level is 5.0\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = ""; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0048() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo(X ... arg[]){\n" + - " }\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " void foo(X ... arg[]){\n" + - " ^^^^^^^^^\n" + - "Syntax error, varargs are only available if source level is 5.0\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " void foo(X ... arg[]){\n" + - " ^^^\n" + - "Extended dimensions are illegal for a variable argument\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0049() { - String[] testFiles = new String[] { - "X.java", - "@interface MyAnn {\n" + - " String value1() default \"\";\n" + - " String value2();\n" + - "}\n" + - "class ZZZ {} \n" + - "public @MyAnn(\"\",\"\") class Test { \n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 1)\n" + - " @interface MyAnn {\n" + - " ^^^^^\n" + - "Syntax error, annotation declarations are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 6)\n" + - " public @MyAnn(\"\",\"\") class Test { \n" + - " ^^\n" + - "Syntax error, insert \")\" to complete Modifier\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " public @MyAnn(\"\",\"\") class Test { \n" + - " ^\n" + - "Syntax error on token \",\", / expected\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0050() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo(List<String>... args) {}\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " void foo(List<String>... args) {}\n" + - " ^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error, varargs are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " void foo(List<String>... args) {}\n" + - " ^^^^\n" + - "List cannot be resolved to a type\n" + - "----------\n" + - "3. ERROR in X.java (at line 2)\n" + - " void foo(List<String>... args) {}\n" + - " ^^^^^^\n" + - "Syntax error, parameterized types are only available if source level is 5.0\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " void foo(List<String>... args) {}\n" + - " ^^^^\n" + - "List cannot be resolved to a type\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -public void test0051() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo(java.util.List2<String>... args) {}\n" + - "}\n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " void foo(java.util.List2<String>... args) {}\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Syntax error, varargs are only available if source level is 5.0\n" + - "----------\n" + - "2. ERROR in X.java (at line 2)\n" + - " void foo(java.util.List2<String>... args) {}\n" + - " ^^^^^^^^^^^^^^^\n" + - "java.util.List2 cannot be resolved to a type\n" + - "----------\n" + - "3. ERROR in X.java (at line 2)\n" + - " void foo(java.util.List2<String>... args) {}\n" + - " ^^^^^^\n" + - "Syntax error, parameterized types are only available if source level is 5.0\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " void foo(java.util.List2<String>... args) {}\n" + - " ^^^^^^^^^^^^^^^\n" + - "java.util.List2 cannot be resolved to a type\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=154811 -public void test0052() { - String[] testFiles = new String[] { - "X.java", - "public class X {\n" + - " void foo1() {\n" + - " class Y {\n" + - " }\n" + - " void foo2() {\n" + - " }\n" + - " class Z<T> { \n" + - " }\n" + - " }\n" + - "} \n" - }; - - String expected13ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 5)\n" + - " void foo2() {\n" + - " ^^^^\n" + - "Syntax error on token \"void\", new expected\n" + - "----------\n" + - "2. ERROR in X.java (at line 7)\n" + - " class Z<T> { \n" + - " ^^^^^\n" + - "Syntax error on token \"class\", invalid AssignmentOperator\n" + - "----------\n" + - "3. ERROR in X.java (at line 7)\n" + - " class Z<T> { \n" + - " ^\n" + - "Syntax error on token \">\", ; expected\n" + - "----------\n"; - String expected14ProblemLog = - expected13ProblemLog; - - String expected15ProblemLog = - "----------\n" + - "1. ERROR in X.java (at line 5)\n" + - " void foo2() {\n" + - " ^^^^\n" + - "Syntax error on token \"void\", new expected\n" + - "----------\n" + - "2. ERROR in X.java (at line 6)\n" + - " }\n" + - " ^\n" + - "Syntax error, insert \";\" to complete Statement\n" + - "----------\n"; - - runComplianceParserTest( - testFiles, - expected13ProblemLog, - expected14ProblemLog, - expected15ProblemLog - ); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/DietCompletionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/DietCompletionTest.java deleted file mode 100644 index ed93f7f..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/DietCompletionTest.java +++ /dev/null
@@ -1,2033 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.internal.codeassist.complete.InvalidCursorLocation; - -public class DietCompletionTest extends AbstractCompletionTest { -public DietCompletionTest(String testName){ - super(testName); -} -public static Test suite() { - return buildAllCompliancesTestSuite(DietCompletionTest.class); -} -/* - * Complete on superclass - */ -public void test01() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOException { \n" + - "} \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompleteOnClass:IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends <CompleteOnClass:IOEx> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOException"; - String testName = "<complete on superclass>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on superinterface - */ -public void test02() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOException implements Serializable { \n" + - " int foo(){} \n" + - "} \n"; - - String completeBehind = "Seria"; - String expectedCompletionNodeToString = "<CompleteOnInterface:Seria>"; - String completionIdentifier = "Seria"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends IOException implements <CompleteOnInterface:Seria> {\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "Serializable"; - String testName = "<complete on superinterface>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on qualified superclass - */ -public void test03() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends java.io.IOException { \n" + - "} \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompleteOnClass:java.io.IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends <CompleteOnClass:java.io.IOEx> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "java.io.IOException"; - String testName = "<complete on qualified superclass>"; - - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); - -} -/* - * Complete on qualified superinterface - */ -public void test04() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOException implements java.io.Serializable { \n" + - "} \n"; - - String completeBehind = "Seria"; - String expectedCompletionNodeToString = "<CompleteOnInterface:java.io.Seria>"; - String completionIdentifier = "Seria"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends IOException implements <CompleteOnInterface:java.io.Seria> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "java.io.Serializable"; - String testName = "<complete on qualified superinterface>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on incomplete superclass - */ -public void test05() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOEx { \n" + - "} \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompleteOnClass:IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends <CompleteOnClass:IOEx> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOEx"; - String testName = "<complete on incomplete superclass>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on incomplete superinterface - */ -public void test06() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOException implements Seria { \n" + - "} \n"; - - String completeBehind = "Seria"; - String expectedCompletionNodeToString = "<CompleteOnInterface:Seria>"; - String completionIdentifier = "Seria"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends IOException implements <CompleteOnInterface:Seria> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "Seria"; - String testName = "<complete on incomplete superinterface>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on incomplete qualified superclass - */ -public void test07() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends java.io.IOEx { \n" + - "} \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompleteOnClass:java.io.IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = "import java.io.*;\n" + - "public class X extends <CompleteOnClass:java.io.IOEx> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "java.io.IOEx"; - String testName = "<complete on incomplete qualified superclass>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on incomplete qualified superinterface - */ -public void test08() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOException implements java.io.Seria { \n" + - "} \n"; - - String completeBehind = "Seria"; - String expectedCompletionNodeToString = "<CompleteOnInterface:java.io.Seria>"; - String completionIdentifier = "Seria"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends IOException implements <CompleteOnInterface:java.io.Seria> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "java.io.Seria"; - String testName = "<complete on incomplete qualified superinterface>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete inside qualified superclass - */ -public void test09() { - - String str = - " \n" + - "public class X extends java.io.IOException { \n" + - "} \n"; - - String completeBehind = ".io"; - String expectedCompletionNodeToString = "<CompleteOnClass:java.io>"; - String completionIdentifier = "io"; - String expectedUnitDisplayString = - "public class X extends <CompleteOnClass:java.io> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "java.io.IOException"; - String testName = "<complete inside qualified superclass>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete inside qualified superinterface - */ -public void test10() { - - String str = - "public class X extends IOException implements java.io.Serializable { \n" + - "} \n"; - - String completeBehind = ".io"; - String expectedCompletionNodeToString = "<CompleteOnInterface:java.io>"; - String completionIdentifier = "io"; - String expectedUnitDisplayString = - "public class X extends IOException implements <CompleteOnInterface:java.io> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "java.io.Serializable"; - String testName = "<complete inside qualified superinterface>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete inside qualified superclass ending with dot - */ -public void test11() { - - String str = - " \n" + - "public class X extends java.io. { \n" + - "} \n"; - - String completeBehind = ".io."; - String expectedCompletionNodeToString = "<CompleteOnClass:java.io.>"; - String completionIdentifier = ""; - String expectedUnitDisplayString = - "public class X extends <CompleteOnClass:java.io.> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "java.io."; - String testName = "<complete inside qualified superclass ending with dot>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete inside qualified superinterface ending with dot - */ -public void test12() { - - String str = - "public class X extends IOException implements java.io. { \n" + - "} \n"; - - String completeBehind = ".io."; - String expectedCompletionNodeToString = "<CompleteOnInterface:java.io.>"; - String completionIdentifier = ""; - String expectedUnitDisplayString = - "public class X extends IOException implements <CompleteOnInterface:java.io.> {\n" + - " public X() {\n" + - - " }\n" + - "}\n"; - String expectedReplacedSource = "java.io."; - String testName = "<complete inside qualified superinterface ending with dot>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on empty superclass - */ -public void test13() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends { \n" + - "} \n"; - - String completeBehind = "extends "; - String expectedCompletionNodeToString = "<CompleteOnClass:>"; - String completionIdentifier = ""; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends <CompleteOnClass:> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = ""; - String testName = "<complete on empty superclass>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on empty superinterface - */ -public void test14() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOException implements { \n" + - "} \n"; - - String completeBehind = "implements "; - String expectedCompletionNodeToString = "<CompleteOnInterface:>"; - String completionIdentifier = ""; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends IOException implements <CompleteOnInterface:> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = ""; - String testName = "<complete on empty superinterface>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on empty superclass followed by identifier - */ -public void test15() { - - String str = - "public class X extends java.io. IOException { \n" + - "} \n"; - - String completeBehind = "java.io."; - String expectedCompletionNodeToString = "<CompleteOnClass:java.io.>"; - String completionIdentifier = ""; - String expectedUnitDisplayString = - "public class X extends <CompleteOnClass:java.io.> {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "java.io."; - String testName = "<complete on empty superclass followed by identifier>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on keyword extends - */ -public void test16() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends { \n" + - "} \n"; - - String completeBehind = "extends"; - String expectedCompletionNodeToString = "<CompleteOnKeyword:extends>"; - String completionIdentifier = "extends"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends <CompleteOnKeyword:extends> {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "extends"; - String testName = "<complete on keyword extends>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in keyword extends - */ -public void test17() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X ext { \n" + - "} \n"; - - String completeBehind = "ext"; - String expectedCompletionNodeToString = "<CompleteOnKeyword:ext>"; - String completionIdentifier = "ext"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends <CompleteOnKeyword:ext> {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "ext"; - String testName = "<complete in keyword extends>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in field type - */ -public void test18() { - - String str = - "class X { \n" + - " \n" + - " IOException x; \n" + - "} \n"; - - String completeBehind = "IO"; - String expectedCompletionNodeToString = "<CompleteOnType:IO>;"; - String completionIdentifier = "IO"; - String expectedUnitDisplayString = - "class X {\n" + - " <CompleteOnType:IO>;\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOException"; - String testName = "<complete in field type>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete at beginning of field type - */ -public void test19() { - - String str = - "class X { \n" + - " \n" + - " final IOException x; \n" + - "} \n"; - - String completeBehind = "final "; - String expectedCompletionNodeToString = "<CompleteOnType:>;"; - String completionIdentifier = ""; - String expectedUnitDisplayString = - "class X {\n" + - " <CompleteOnType:>;\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOException"; - String testName = "<complete at beginning of field type>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete at beginning of superclass - */ -public void test20() { - - String str = - "class X extends IOException { \n" + - " \n" + - "} \n"; - - String completeBehind = "extends "; - String expectedCompletionNodeToString = "<CompleteOnClass:>"; - String completionIdentifier = ""; - String expectedUnitDisplayString = - "class X extends <CompleteOnClass:> {\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOException"; - String testName = "<complete at beginning of superclass>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in return type - */ -public void test21() { - - String str = - "class X { \n" + - " IOEx \n" + - "} \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompleteOnType:IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "class X {\n" + - " <CompleteOnType:IOEx>;\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOEx"; - String testName = "<complete in return type>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in argument type - */ -public void test22() { - - String str = - "class X { \n" + - " int foo(IOEx \n" + - "} \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompleteOnType:IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "class X {\n" + - " <CompleteOnType:IOEx>;\n" + - " X() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOEx"; - String testName = "<complete in argument type>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in return type - */ -public void test23() { - - String str = - "class X { \n" + - " IOEx \n" + - " \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompleteOnType:IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "class X {\n" + - " <CompleteOnType:IOEx>;\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOEx"; - String testName = "<complete in return type>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in argument type (no closing brace for type) - */ -public void test24() { - - String str = - "class X { \n" + - " int foo(IOEx \n" + - " \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompleteOnType:IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "class X {\n" + - " <CompleteOnType:IOEx>;\n" + - " X() {\n" + - - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOEx"; - String testName = "<complete in argument type>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in return type with modifiers - */ -public void test25() { - - String str = - "class X { \n" + - " public final IOEx \n" + - " \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompleteOnType:IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "class X {\n" + - " <CompleteOnType:IOEx>;\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOEx"; - String testName = "<complete in return type with modifiers>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in field initialization - */ -public void test26() { - - String str = - "class X { \n" + - " public final int x = IOEx \n" + - " \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompleteOnName:IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "class X {\n" + - " public final int x = <CompleteOnName:IOEx>;\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOEx"; - String testName = "<complete in field initialization>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in nth argument type - */ -public void test27() { - - String str = - "class X { \n" + - " int foo(AA a, BB b, IOEx \n" + - " \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompleteOnType:IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "class X {\n" + - " <CompleteOnType:IOEx>;\n" + - " X() {\n" + - " }\n" + - " int foo(AA a, BB b) {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOEx"; - String testName = "<complete in nth argument type>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in nth argument qualified type - */ -public void test28() { - - String str = - "class X { \n" + - " int foo(AA a, BB b, java.io.IOEx \n" + - " \n"; - - String completeBehind = ".io."; - String expectedCompletionNodeToString = "<CompleteOnType:java.io.>"; - String completionIdentifier = ""; - String expectedUnitDisplayString = - "class X {\n" + - " <CompleteOnType:java.io.>;\n" + - " X() {\n" + - " }\n" + - " int foo(AA a, BB b) {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "java.io.IOEx"; - String testName = "<complete in nth argument qualified type>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in nth thrown exception qualified type - */ -public void test29() { - - String str = - "class X { \n" + - " public int foo(AA a, BB b) throws AA, java.io.IOEx \n" + - " \n"; - - String completeBehind = ".io"; - String expectedCompletionNodeToString = "<CompleteOnException:java.io>"; - String completionIdentifier = "io"; - String expectedUnitDisplayString = - "class X {\n" + - " X() {\n" + - " }\n" + - " public int foo(AA a, BB b) throws AA, <CompleteOnException:java.io> {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "java.io.IOEx"; - String testName = "<complete in nth thrown exception qualified type>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in completed argument - */ -public void test30() { - - String str = - "class X { \n" + - " public int foo(AA a, java.io.BB b) \n" + - " \n"; - - String completeBehind = "io."; - String expectedCompletionNodeToString = "<CompleteOnType:java.io.>"; - String completionIdentifier = ""; - String expectedUnitDisplayString = - "class X {\n" + - " X() {\n" + - " }\n" + - " public int foo(AA a, <CompleteOnType:java.io.> b) {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "java.io.BB"; - String testName = "<complete in in completed argument>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Negative test: no diet completion in allocation expression - */ -public void test31() { - - String str = - "class Bar { \n"+ - " void foo() { \n"+ - " new X().zzz(); \n"+ - " } \n"+ - "}\n"; - - String completeBehind = "new X"; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = NONE; - String expectedUnitDisplayString = - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = null; - String testName = "<no diet completion in allocation expression>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Completion in package statement - */ -public void test32() { - - String str = - "package x.abc \n"+ - "import x.util.*; \n"+ - "import x.*; \n"+ - "class X extends util{ \n"+ - " X(){} \n"+ - " X(int a, int b){} \n"+ - "} \n"; - - String completeBehind = "x.ab"; - String expectedCompletionNodeToString = "<CompleteOnPackage:x.ab>"; - String completionIdentifier = "ab"; - String expectedUnitDisplayString = - "package <CompleteOnPackage:x.ab>;\n" + - "import x.util.*;\n" + - "import x.*;\n" + - "class X extends util {\n" + - " X() {\n" + - " }\n" + - " X(int a, int b) {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "x.abc"; - String testName = "<complete in package statement>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Completion in import statement - */ -public void test33() { - - String str = - "package x.abc; \n"+ - "import x.util \n"+ - "import x.*; \n"+ - "class X extends util{ \n"+ - " X(){} \n"+ - " X(int a, int b){} \n"+ - "} \n"; - - String completeBehind = "x.util"; - String expectedCompletionNodeToString = "<CompleteOnImport:x.util>"; - String completionIdentifier = "util"; - String expectedUnitDisplayString = - "package x.abc;\n" + - "import <CompleteOnImport:x.util>;\n" + - "import x.*;\n" + - "class X extends util {\n" + - " X() {\n" + - " }\n" + - " X(int a, int b) {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "x.util"; - String testName = "<complete in import statement>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on superclass behind a unicode - * - * -- compute the unicode representation for a given string -- - [ String str = "IOEx"; - StringBuffer buffer = new StringBuffer("\""); - for (int i = 0; i < str.length(); i++){ - String hex = Integer.toHexString(str.charAt(i)); - buffer.append("\\u0000".substring(0, 6-hex.length())); - buffer.append(hex); - } - buffer.append("\""); - buffer.toString() - ] - */ -public void test34() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOE\\u0078ception { \n" + - "} \n"; - - String completeBehind = "IOE\\u0078"; - String expectedCompletionNodeToString = "<CompleteOnClass:IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends <CompleteOnClass:IOEx> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOE\\u0078ception"; - String testName = "<complete on superclass behind a unicode>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void test34a() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOException { \n" + - "} \n"; - - String completeBehind = "IOE"; - String expectedCompletionNodeToString = "<CompleteOnClass:IOE>"; - String completionIdentifier = "IOE"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends <CompleteOnClass:IOE> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOException"; - String testName = "<complete on superclass before a unicode>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void test34b() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOE\\u0078c\\u0065ption { \n" + - "} \n"; - - String completeBehind = "IOE\\u0078c\\u0065p"; - String expectedCompletionNodeToString = "<CompleteOnClass:IOExcep>"; - String completionIdentifier = "IOExcep"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends <CompleteOnClass:IOExcep> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOE\\u0078c\\u0065ption"; - String testName = "<complete on superclass behind a unicode>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -public void test34c() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X \\u0065xt\\u0065nds IOE\\u0078c\\u0065ption { \n" + - "} \n"; - - String completeBehind = "IOE\\u0078c\\u0065p"; - String expectedCompletionNodeToString = "<CompleteOnClass:IOExcep>"; - String completionIdentifier = "IOExcep"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X extends <CompleteOnClass:IOExcep> {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOE\\u0078c\\u0065ption"; - String testName = "<complete on superclass behind a unicode>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Invalid completion inside a unicode - * - * -- compute the unicode representation for a given string -- - [ String str = "IOEx"; - StringBuffer buffer = new StringBuffer("\""); - for (int i = 0; i < str.length(); i++){ - String hex = Integer.toHexString(str.charAt(i)); - buffer.append("\\u0000".substring(0, 6-hex.length())); - buffer.append(hex); - } - buffer.append("\""); - buffer.toString() - ] - */ -public void test35() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends IOE\\u0078ception { \n" + - "} \n"; - - String completeBehind = "IOE\\u00"; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = NONE; - String expectedUnitDisplayString = ""; - String expectedReplacedSource = NONE; - String testName = "<complete inside unicode>"; - - try { - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); - assertTrue("failed to detect invalid cursor location", false); - } catch(InvalidCursorLocation e){ - assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_UNICODE); - } -} -/* - * Invalid completion inside a comment - * - */ -public void test36() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends /*IOException*/ { \n" + - "} \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = NONE; - String expectedUnitDisplayString = ""; - String expectedReplacedSource = NONE; - String testName = "<complete inside comment>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - try { - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); - assertTrue("failed to detect invalid cursor location", false); - } catch(InvalidCursorLocation e){ - assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_COMMENT); - } -} -/* - * Invalid completion inside a string literal - * - */ -public void test37() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X { \n" + - " String s = \"IOException\"; \n" + - "} \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompletionOnString:\"IOEx\">"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X {\n" + - " String s = <CompletionOnString:\"IOEx\">;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "\"IOException\""; - String testName = "<complete inside a string literal>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Invalid completion inside a number literal - * - */ -public void test38() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X { \n" + - " int s = 12345678; \n" + - "} \n"; - - String completeBehind = "1234"; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = NONE; - String expectedUnitDisplayString = ""; - String expectedReplacedSource = NONE; - String testName = "<complete inside a number literal>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - try{ - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); - assertTrue("failed to detect invalid cursor location", false); - } catch(InvalidCursorLocation e){ - assertEquals("invalid cursor location: ", e.irritant, InvalidCursorLocation.NO_COMPLETION_INSIDE_NUMBER); - } -} -/* - * Completion in import statement at the end of the unit - */ -public void test39() { - - String str = - "package x.abc; \n"+ - "import x.util"; - - String completeBehind = "x.util"; - String expectedCompletionNodeToString = "<CompleteOnImport:x.util>"; - String completionIdentifier = "util"; - String expectedUnitDisplayString = - "package x.abc;\n" + - "import <CompleteOnImport:x.util>;\n"; - String expectedReplacedSource = "x.util"; - String testName = "<complete in import statement at the end of the unit>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Completion in import statement at the end of the unit (qualified empty name) - */ -public void test40() { - - String str = - "package a.b; \n"+ - "import java."; - - String completeBehind = "java."; - String expectedCompletionNodeToString = "<CompleteOnImport:java.>"; - String completionIdentifier = ""; - String expectedUnitDisplayString = - "package a.b;\n" + - "import <CompleteOnImport:java.>;\n"; - String expectedReplacedSource = "java."; - String testName = "<complete in import statement at the end of the unit>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Should not find any diet completion - */ -public void test41() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X extends \n" + - " int foo(String str) \n" + - " String variable = ; \n" + - " { \n" + - " String variableNotInScope; \n" + - " } \n" + - " foo(varia \n"; - - String completeBehind = "foo(var"; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = "var"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " int foo(String str) {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "varia"; - String testName = "<should not find diet completion>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on array type with prefix dimensions - */ -public void test42() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X { \n" + - " int[] foo(String str) \n"; - - String completeBehind = "int"; - String expectedCompletionNodeToString = "<CompleteOnType:int>"; - String completionIdentifier = "int"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " <CompleteOnType:int>\n" + - "}\n"; - String expectedReplacedSource = "int"; - String testName = "<completion on array type with prefix dimensions>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on array type with postfix dimensions - */ -public void test43() { - - String str = - "import java.io.*; \n" + - " \n" + - "public class X { \n" + - " int foo(String str) [] \n"; - - String completeBehind = "int"; - String expectedCompletionNodeToString = "<CompleteOnType:int>"; - String completionIdentifier = "int"; - String expectedUnitDisplayString = - "import java.io.*;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " <CompleteOnType:int>\n" + - "}\n"; - String expectedReplacedSource = "int"; - String testName = "<completion on array type with postfix dimensions>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in return type behind other member - */ -public void test44() { - - String str = - "class X { \n" + - " int i; \n" + - " IOEx \n" + - "} \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompleteOnType:IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "class X {\n" + - " int i;\n" + - " <CompleteOnType:IOEx>;\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOEx"; - String testName = "<complete in return type>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in return type behind other member - */ -public void test45() { - - String str = - "class X { \n" + - " int i; \n" + - " public IOEx \n" + - "} \n"; - - String completeBehind = "IOEx"; - String expectedCompletionNodeToString = "<CompleteOnType:IOEx>"; - String completionIdentifier = "IOEx"; - String expectedUnitDisplayString = - "class X {\n" + - " int i;\n" + - " <CompleteOnType:IOEx>;\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "IOEx"; - String testName = "<complete in return type>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on name in field initializer - */ -public void test46() { - - String str = - "class X { \n" + - " String s = \"hello\"; \n" + - " int f = s. \n" + - "} \n"; - - String completeBehind = "= s"; - String expectedCompletionNodeToString = "<CompleteOnName:s>"; - String completionIdentifier = "s"; - String expectedUnitDisplayString = - "class X {\n" + - " String s;\n" + - " int f = <CompleteOnName:s>;\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "s"; - String testName = "<complete on name in field initializer>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete in field initializer in innner class - */ -public void test47() { - - String str = - "class X { \n" + - " class Y { \n" + - " Object[] f = { this.foo } \n" + - " Object foo(){ return this; } \n" + - "} \n"; - - String completeBehind = "this.foo"; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:this.foo>"; - String completionIdentifier = "foo"; - String expectedUnitDisplayString = - "class X {\n" + - " class Y {\n" + - " Object[] f = {<CompleteOnMemberAccess:this.foo>};\n" + - " Y() {\n" + - " }\n" + - " Object foo() {\n" + - " }\n" + - " }\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "this.foo"; - String testName = "<complete in field initializer in inner class>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Should not find fake field of type <CompleteOnType:f> - */ -public void test48() { - - String str = - "package pack; \n"+ - "class A { \n"+ - " \n"+ - " public static void main(String[] argv) \n"+ - " new Member().f \n"+ - " ; \n"+ - " } \n"+ - " class Member { \n"+ - " int foo() \n"+ - " } \n"+ - " } \n"+ - "}; \n"; - - String completeBehind = "new Member().f"; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = "f"; - String expectedUnitDisplayString = - "package pack;\n" + - "class A {\n" + - " class Member {\n" + - " Member() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " }\n" + - " A() {\n" + - " }\n" + - " public static void main(String[] argv) {\n" + - " }\n" + - "}\n"; - - String expectedReplacedSource = "f"; - String testName = "<should not find fake field of type f>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Completion in middle of package import statement - */ -public void test49() { - - String str = - "import java.lang.reflect.*; \n"+ - "class X { \n"+ - "} \n"; - - String completeBehind = "java.la"; - String expectedCompletionNodeToString = "<CompleteOnImport:java.la>"; - String completionIdentifier = "la"; - String expectedUnitDisplayString = - "import <CompleteOnImport:java.la>;\n" + - "class X {\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "java.lang.reflect"; - String testName = "<complete in middle of package import statement>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on instance creation in field initializer. - */ -public void test50() { - - String str = - "class X { \n" + - " String s = \"hello\"; \n" + - " Object o = new Xyz(); \n" + - "} \n"; - - String completeBehind = "new X"; - String expectedCompletionNodeToString = "<CompleteOnType:X>"; - String completionIdentifier = "X"; - String expectedUnitDisplayString = - "class X {\n" + - " String s;\n" + - " Object o = new <CompleteOnType:X>();\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "Xyz"; - String testName = "<complete on instance creation in field initializer>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on member access in field initializer. - */ -public void test51() { - - String str = - "class X { \n" + - " String s = \"hello\"; \n" + - " Object o = fred().xyz; \n" + - "} \n"; - - String completeBehind = "fred().x"; - String expectedCompletionNodeToString = "<CompleteOnMemberAccess:fred().x>"; - String completionIdentifier = "x"; - String expectedUnitDisplayString = - "class X {\n" + - " String s;\n" + - " Object o = <CompleteOnMemberAccess:fred().x>;\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "xyz"; - String testName = "<complete on member access in field initializer>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on class literal access in field initializer. - */ -public void test52() { - - String str = - "class X { \n" + - " String s = \"hello\"; \n" + - " Class c = int[].class; \n" + - "} \n"; - - String completeBehind = "int[].c"; - String expectedCompletionNodeToString = "<CompleteOnClassLiteralAccess:int[].c>"; - String completionIdentifier = "c"; - String expectedUnitDisplayString = - "class X {\n" + - " String s;\n" + - " Class c = <CompleteOnClassLiteralAccess:int[].c>;\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "int[].class"; - String testName = "<complete on class literal access in field initializer>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on method invocation in field initializer. - */ -public void test53() { - - String str = - "class X { \n" + - " String s = \"hello\"; \n" + - " Object o = s.concat(); \n" + - "} \n"; - - String completeBehind = "s.concat("; - String expectedCompletionNodeToString = "<CompleteOnMessageSend:s.concat()>"; - String completionIdentifier = ""; - String expectedUnitDisplayString = - "class X {\n" + - " String s;\n" + - " Object o = <CompleteOnMessageSend:s.concat()>;\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "concat("; - String testName = "<complete on method invocation in field initializer>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Should not find fake field of type <CompleteOnType:f> - */ -public void test54() { - - String str = - "package pack; \n"+ - "class A { \n"+ - " \n"+ - " public static void main(String[] argv \n"+ - " new Member().f \n"+ - " ; \n"+ - " } \n"+ - " class Member { \n"+ - " int foo() \n"+ - " } \n"+ - " } \n"+ - "}; \n"; - - String completeBehind = "new Member().f"; - String expectedCompletionNodeToString = NONE; - String completionIdentifier = "f"; - String expectedUnitDisplayString = - "package pack;\n" + - "class A {\n" + - " class Member {\n" + - " Member() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " }\n" + - " A() {\n" + - " }\n" + - " public static void main(String[] argv) {\n" + - " }\n" + - "}\n"; - - String expectedReplacedSource = "f"; - String testName = "<should not find fake field of type f>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -/* - * Complete on anonymous type in field initializer. - */ -public void test55() { - - String str = - "class X { \n" + - " Object o = new Object(){ \n" + - " void foo(){ \n" + - " String x = \"\"; \n" + - " x.index \n" + - " } \n" + - " \n" + - " void bar(){ \n" + - " String y = \"\"; \n" + - " } \n" + - " }; \n" + - "} \n"; - - String completeBehind = "x.index"; - String expectedCompletionNodeToString = "<CompleteOnName:x.index>"; - String completionIdentifier = "index"; - String expectedUnitDisplayString = - "class X {\n" + - " Object o = new Object() {\n" + - " void foo() {\n" + - " String x;\n" + - " <CompleteOnName:x.index>;\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " };\n" + - " X() {\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "x.index"; - String testName = "<complete on anonymous type in field initializer>"; - - int cursorLocation = str.indexOf(completeBehind) + completeBehind.length() - 1; - this.checkDietParse( - str.toCharArray(), - cursorLocation, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/DietRecoveryTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/DietRecoveryTest.java deleted file mode 100644 index 344e6f0..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/DietRecoveryTest.java +++ /dev/null
@@ -1,7680 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import java.util.Locale; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.core.tests.util.AbstractCompilerTest; -import org.eclipse.wst.jsdt.core.tests.util.Util; -import org.eclipse.wst.jsdt.internal.codeassist.complete.CompletionParser; -import org.eclipse.wst.jsdt.internal.compiler.CompilationResult; -import org.eclipse.wst.jsdt.internal.compiler.DefaultErrorHandlingPolicies; -import org.eclipse.wst.jsdt.internal.compiler.SourceElementParser; -import org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration; -import org.eclipse.wst.jsdt.internal.compiler.batch.CompilationUnit; -import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.wst.jsdt.internal.compiler.env.ICompilationUnit; -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; -import org.eclipse.wst.jsdt.internal.compiler.parser.Parser; -import org.eclipse.wst.jsdt.internal.compiler.problem.DefaultProblemFactory; -import org.eclipse.wst.jsdt.internal.compiler.problem.ProblemReporter; - -public class DietRecoveryTest extends AbstractCompilerTest { - public static boolean optimizeStringLiterals = false; - public static long sourceLevel = ClassFileConstants.JDK1_3; //$NON-NLS-1$ -static { -// TESTS_NUMBERS = new int[] { 113 }; -} -public static Test suite() { - return buildAllCompliancesTestSuite(DietRecoveryTest.class); -} - -public DietRecoveryTest(String testName){ - super(testName); -} - -public void checkParse( - char[] source, - String expectedDietUnitToString, - String expectedDietPlusBodyUnitToString, - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - String expectedFullUnitToString, - String expectedCompletionDietUnitToString, String testName) { - - /* using regular parser in DIET mode */ - { - Parser parser = - new Parser( - new ProblemReporter( - DefaultErrorHandlingPolicies.proceedWithAllProblems(), - new CompilerOptions(getCompilerOptions()), - new DefaultProblemFactory(Locale.getDefault())), - optimizeStringLiterals); - - ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); - CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); - - CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult); - String computedUnitToString = computedUnit.toString(); - if (!expectedDietUnitToString.equals(computedUnitToString)){ - System.out.println(Util.displayString(computedUnitToString)); - } - assertEquals( - "Invalid unit diet structure" + testName, - expectedDietUnitToString, - computedUnitToString); - } - /* using regular parser in DIET mode + getMethodBodies */ - { - Parser parser = - new Parser( - new ProblemReporter( - DefaultErrorHandlingPolicies.proceedWithAllProblems(), - new CompilerOptions(getCompilerOptions()), - new DefaultProblemFactory(Locale.getDefault())), - optimizeStringLiterals); - parser.setMethodsFullRecovery(false); - parser.setStatementsRecovery(false); - - ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); - CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); - - CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult); - String computedUnitToString = computedUnit.toString(); - if (!expectedDietUnitToString.equals(computedUnitToString)){ - System.out.println(Util.displayString(computedUnitToString)); - } - assertEquals( - "Invalid unit diet structure" + testName, - expectedDietUnitToString, - computedUnitToString); - if (computedUnit.types != null) { - for (int i = computedUnit.types.length; --i >= 0;){ - computedUnit.types[i].parseMethod(parser, computedUnit); - } - } - computedUnitToString = computedUnit.toString(); - if (!expectedDietPlusBodyUnitToString.equals(computedUnitToString)){ - System.out.println(Util.displayString(computedUnitToString)); - } - - assertEquals( - "Invalid unit diet+body structure" + testName, - expectedDietPlusBodyUnitToString, - computedUnitToString); - } - /* using regular parser in DIET mode + getMethodBodies + statements recovery */ - { - Parser parser = - new Parser( - new ProblemReporter( - DefaultErrorHandlingPolicies.proceedWithAllProblems(), - new CompilerOptions(getCompilerOptions()), - new DefaultProblemFactory(Locale.getDefault())), - optimizeStringLiterals); - parser.setMethodsFullRecovery(true); - parser.setStatementsRecovery(true); - - ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); - CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); - - CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult); - String computedUnitToString = computedUnit.toString(); - if (!expectedDietUnitToString.equals(computedUnitToString)){ - System.out.println(Util.displayString(computedUnitToString)); - } - assertEquals( - "Invalid unit diet structure" + testName, - expectedDietUnitToString, - computedUnitToString); - if (computedUnit.types != null) { - for (int i = computedUnit.types.length; --i >= 0;){ - computedUnit.types[i].parseMethod(parser, computedUnit); - } - } - computedUnitToString = computedUnit.toString(); - if (!expectedDietPlusBodyPlusStatementsRecoveryUnitToString.equals(computedUnitToString)){ - System.out.println(Util.displayString(computedUnitToString)); - } - - assertEquals( - "Invalid unit diet+body structure with statements recovery" + testName, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - computedUnitToString); - } - /* using regular parser in FULL mode */ - { - Parser parser = - new Parser( - new ProblemReporter( - DefaultErrorHandlingPolicies.proceedWithAllProblems(), - new CompilerOptions(getCompilerOptions()), - new DefaultProblemFactory(Locale.getDefault())), - optimizeStringLiterals); - - ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); - CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); - - CompilationUnitDeclaration computedUnit = parser.parse(sourceUnit, compilationResult); - String computedUnitToString = computedUnit.toString(); - if (!expectedFullUnitToString.equals(computedUnitToString)){ - System.out.println(Util.displayString(computedUnitToString)); - } - assertEquals( - "Invalid unit full structure" + testName, - expectedFullUnitToString, - computedUnitToString); - - } - /* using source element parser in DIET mode */ - { - SourceElementParser parser = - new SourceElementParser( - new TestSourceElementRequestor(), - new DefaultProblemFactory(Locale.getDefault()), - new CompilerOptions(getCompilerOptions()), - false/*don't record local declarations*/, - true/*optimize string literals*/); - - ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); - CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); - - CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult); - String computedUnitToString = computedUnit.toString(); - if (!expectedDietUnitToString.equals(computedUnitToString)){ - System.out.println(Util.displayString(computedUnitToString)); - } - assertEquals( - "Invalid source element diet structure" + testName, - expectedDietUnitToString, - computedUnitToString); - } - /* using source element parser in FULL mode */ - { - SourceElementParser parser = - new SourceElementParser( - new TestSourceElementRequestor(), - new DefaultProblemFactory(Locale.getDefault()), - new CompilerOptions(getCompilerOptions()), - false/*don't record local declarations*/, - true/*optimize string literals*/); - - ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); - CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); - - CompilationUnitDeclaration computedUnit = parser.parse(sourceUnit, compilationResult); - String computedUnitToString = computedUnit.toString(); - if (!expectedFullUnitToString.equals(computedUnitToString)){ - System.out.println(Util.displayString(computedUnitToString)); - } - assertEquals( - "Invalid source element full structure" + testName, - expectedFullUnitToString, - computedUnitToString); - } - /* using completion parser in DIET mode */ - { - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - CompletionParser parser = - new CompletionParser( - new ProblemReporter( - DefaultErrorHandlingPolicies.proceedWithAllProblems(), - options, - new DefaultProblemFactory(Locale.getDefault()))); - - ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); - CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); - - CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult, Integer.MAX_VALUE); - String computedUnitToString = computedUnit.toString(); - if (!expectedCompletionDietUnitToString.equals(computedUnitToString)){ - System.out.println(Util.displayString(computedUnitToString)); - } - assertEquals( - "Invalid completion diet structure" + testName, - expectedCompletionDietUnitToString, - computedUnitToString); - } -} -/* - * Should treat variables 'h' and 'i' as fields since 'public'. - */ -public void test01() { - - String s = - "package a; \n" - + "import java.lang.*; \n" - + "import java.util.*; \n" - + " \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " \n" - + " public int h; \n" - + " public int[] i = { 0, 1 }; \n" - + " \n" - + " void bar(){ \n" - + " void truc(){ \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public int[] i;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String testName = "<promote local vars into fields>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should filter out local type altogether - */ -public void test02() { - - String s = - "package a; \n" - + "import java.lang.*; \n" - + "import java.util.*; \n" - + " \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " \n" - + " class L { \n" - + " void baz(){} \n" - + " } \n" - + " \n" - + " public int h; \n" - + " public int[] i = { 0, 1 }; \n" - + " \n" - + " void bar(){ \n" - + " void truc(){ \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class L {\n" + - " L() {\n" + - " super();\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - " }\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public int[] i;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String testName = "<filter out local type>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should still be finding last method (#baz) - */ - -public void test03() { - - String s = - "package a; \n" - + "import java.lang.*; \n" - + "import java.util.*; \n" - + " \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " \n" - + " public int h; \n" - + " public int[] i = { 0, 1 }; \n" - + " \n" - + " void bar(){ \n" - + " void baz(){ \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public int[] i;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - "}\n"; - - String testName = "<should find last method>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should finding 5 fields. - */ - -public void test04() { - - String s = - "package a; \n" - + "import java.lang.*; \n" - + "import java.util.*; \n" - + " \n" - + "public class X { \n" - + " X x; \n" - + " Object a, b = null; \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " \n" - + " public int h; \n" - + " public int[] i = { 0, 1 }; \n" - + " \n" - + " void bar(){ \n" - + " void truc(){ \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " X x;\n" + - " Object a;\n" + - " Object b = null;\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " X x;\n" + - " Object a;\n" + - " Object b = null;\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " X x;\n" + - " Object a;\n" + - " Object b;\n" + - " public int h;\n" + - " public int[] i;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String testName = "<five fields>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Diet parse thinks it is successful - no recovery - */ - -public void test05() { - - String s = - "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " void baz(){} \n" - + " } \n" - + " \n" - + " void bar(){ \n" - + " } \n" - + " void truc(){ \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new baz() {\n" + - " };\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<diet was successful>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Recovery will not restart from scratch, and miss some signatures (#baz()) - */ - -public void test06() { - - String s = - "import java.lang.*; \n" - + " \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " void baz(){} \n" - + " } \n" - + " \n" - + " void bar(){ \n" - + " } \n" - + " void truc(){ \n" - + "} \n"; - - String expectedDietUnitToString = - "import java.lang.*;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "import java.lang.*;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<will not miss nested method>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Attaching orphan methods and fields - */ - -public void test07() { - - String s = - "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + "} \n" - + " void bar(){ \n" - + " } \n" - + " int x; \n" - + " void baz(){ \n" - + " } \n" - + " int y; \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " {\n" + - " }\n" + - " int x;\n" + - " int y;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " {\n" + - " }\n" + - " int x;\n" + - " int y;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<attaching orphans>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Properly attaching fields/methods to member type - */ - -public void test08() { - - String s = - "public class X { \n" - + " class Y { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " public int h; \n" - + " public int[] i = {0, 1}; \n" - + " void bar(){ \n" - + " void baz(){ \n" - + " } \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " class Y {\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " class Y {\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "public class X {\n" + - " class Y {\n" + - " public int h;\n" + - " public int[] i;\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String testName = "<attaching to member type>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Properly attaching fields/methods to enclosing type - */ - -public void test09() { - - String s = - "public class X { \n" - + " class Y { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " public int h; \n" - + " public int[] i = {0, 1}; \n" - + " void bar(){ \n" - + " void baz(){ \n" - + " } \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " public X() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " }\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " public int h;\n" + - " public int[] i;\n" + - " public X() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - "}\n"; - - String testName = "<attaching to enclosing type>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Properly attaching fields/methods to member type in presence of missing - * member type opening brace (Y) (and array initializer for (i)). - */ - -public void test10() { - - String s = - "public class X { \n" - + " class Y \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " public int h; \n" - + " public int[] i = {0, 1}; \n" - + " void bar(){ \n" - + " void baz(){ \n" - + " } \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " class Y {\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " class Y {\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "public class X {\n" + - " class Y {\n" + - " public int h;\n" + - " public int[] i;\n" + - " Y() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String testName = "<missing brace + array initializer>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Attaching orphan methods and fields, by counting brackets - * variable 'x' should be eliminated (looks like a local variable) - */ - -public void test11() { - - String s = - "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + "} \n" - + " void bar(){ \n" - + " int x; \n" - + " void baz(){ \n" - + " } \n" - + " int y; \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " {\n" + - " }\n" + - " int y;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " {\n" + - " }\n" + - " int y;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " void bar() {\n" + - " int x;\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<attaching orphans with missing brackets>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Attaching orphan methods and fields, by counting brackets - * variable 'x' should NOT be eliminated given it looks like a field - */ - -public void test12() { - - String s = - "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + "} \n" - + " void bar(){ \n" - + " public int x; \n" - + " void baz(){ \n" - + " } \n" - + " int y; \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " {\n" + - " }\n" + - " public int x;\n" + - " int y;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " {\n" + - " }\n" + - " public int x;\n" + - " int y;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<attaching orphans with missing brackets 2>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString , - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should still recover incomplete type signature (missing superclass) - */ - -public void test13() { - - String s = - "public class X extends { \n" - + " void foo() { \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<invalid type header>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should still recover incomplete method signature (missing opening brace) - */ - -public void test14() { - - String s = - "public class X extends Thread { \n" - + " void foo() \n" - + " void bar() \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "public class X extends Thread {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X extends Thread {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<method header missing opening brace>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should still recover incomplete method signature (missing thrown exceptions) - */ - -public void test15() { - - String s = - "public class X extends Thread { \n" - + " void foo() throws \n" - + " void bar() \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "public class X extends Thread {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X extends Thread {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class X extends Thread {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " ;\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<method header missing thrown exceptions>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should still recover incomplete type signature (missing superinterfaces) - */ - -public void test16() { - - String s = - "public class X implements \n" - + " void foo() \n" - + " void bar() \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<type header missing superinterfaces>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should still recover incomplete type signature (missing superinterfaces) - */ - -public void test17() { - - String s = - "public class X implements Y, \n" - + " void foo() \n" - + " void bar() \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "public class X implements Y {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X implements Y {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<type header missing superinterfaces 2>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should find member type behind incomplete enclosing type header - */ - -public void test18() { - - String s = - "public class X implements \n" - + " class Y { \n" - + " void bar() \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<member type behind incomplete enclosing type>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should find member type when missing opening brace - */ - -public void test19() { - - String s = - "public class X \n" - + " class Y { \n" - + " void bar() \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " super();\n"+ - " }\n" + - " void bar() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<member type when missing opening brace>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should not find fieldX signature behind missing brace - */ - -public void test20() { - - String s = - "public class X \n" - + " fieldX; \n" - + " class Y { \n" - + " void bar() \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " super();\n"+ - " }\n" + - " void bar() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<no field behind missing brace>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should find Y as member type - */ - -public void test21() { - - String s = - "public class X \n" - + " fieldX; \n" - + " class Y \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " super();\n"+ - " }\n" + - " }\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should find Y as member type>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should filter out incomplete local type - */ - -public void test22() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " class L extends { \n" + - " public int l; \n" + - " void baz(){} \n" + - " } \n" + - " \n" + - " public int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class L {\n" + - " public int l;\n" + - " L() {\n" + - " super();\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - " }\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should filter out incomplete local type>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should filter out incomplete local type and method signature - */ - -public void test23() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " class L extends { \n" + - " public int l; \n" + - " void baz() throws {} \n" + - " } \n" + - " \n" + - " public int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class L {\n" + - " public int l;\n" + - " L() {\n" + - " super();\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - " }\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should filter out incomplete local type/method>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should filter out anonymous type - */ - -public void test24() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " new X(){ \n" + - " void baz() {} \n" + - " }.baz(); \n" + - " \n" + - " public int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new X() {\n" + - " void baz() {\n" + - " }\n" + - "}.baz();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should filter out incomplete anonymous type/method>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should filter out incomplete anonymous type - */ - -public void test25() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " new X(){ \n" + - " void baz() {} \n" + - " \n" + - " public int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new X() {\n" + - " public int h;\n" + - " void baz() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should filter out incomplete anonymous type>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should filter out incomplete anonymous method - */ - -public void test26() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " new X(){ \n" + - " void baz() \n" + - " } \n" + - " } \n" + - " public int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should filter out incomplete anonymous method>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should filter out incomplete local type and local var h - */ - -public void test27() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " class L extends { \n" + - " public int l; \n" + - " void baz(){} \n" + - " } \n" + - " \n" + - " int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class L {\n" + - " public int l;\n" + - " L() {\n" + - " super();\n" + - " }\n" + - " void baz() {\n" + - " }\n" + - " }\n" + - " int h;\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should filter incomplete local type L and variable h>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should find <y> as a field in Y - */ - -public void test28() { - - String s = - "public class X { \n" + - " int x; \n" + - " \n" + - " int foo(){ } \n" + - " \n" + - " class Y { \n" + - " int y; \n" + - "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " class Y {\n" + - " int y;\n" + - " Y() {\n" + - " }\n" + - " }\n" + - " int x;\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " class Y {\n" + - " int y;\n" + - " Y() {\n" + - " super();\n"+ - " }\n" + - " }\n" + - " int x;\n" + - " public X() {\n" + - " super();\n"+ - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should find <y> as a field in Y>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should find <y> as a field in X - */ - -public void test29() { - - String s = - "public class X { \n" + - " int x; \n" + - " \n" + - " int foo(){ } \n" + - " \n" + - " class Y { \n" + - "} \n" + - " int y; \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " }\n" + - " int x;\n" + - " int y;\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " int x;\n" + - " int y;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should find <y> as a field in X>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should find <y> as a field in X - */ - -public void test30() { - - String s = - "public class X { \n" + - " int x; \n" + - " \n" + - " int foo(){ } \n" + - " \n" + - " class Y \n" + - "} \n" + - " int y; \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " }\n" + - " int x;\n" + - " int y;\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " class Y {\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " int x;\n" + - " int y;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should find <y> as a field in X>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should recover from partial method header foo() - */ - -public void test31() { - - String s = - "package a; \n"+ - "import java.lang.*; \n"+ - "import java.util.*; \n"+ - " \n"+ - "public class X { \n"+ - " void foo() \n"+ - " System.out.println(); \n"+ - " \n"+ - " public int h; \n"+ - " public int[] i = { 0, 1 }; \n"+ - " \n"+ - " void bar(){ \n"+ - " void truc(){ \n"+ - "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public int[] i = {0, 1};\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "package a;\n" + - "import java.lang.*;\n" + - "import java.util.*;\n" + - "public class X {\n" + - " public int h;\n" + - " public int[] i;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void truc() {\n" + - " }\n" + - "}\n"; - - String testName = "<should recover from partial method header>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should recover from method with missing argument names - */ - -public void test32() { - - String s = - "public class WB2 { \n"+ - " public void foo(java.util.Locale, java.util.Vector) { \n"+ - " int i; \n"+ - " if(i instanceof O) { \n"+ - " } \n"+ - " String s = \"hello\"; \n"+ - " s. \n"+ - " } \n"+ - "} \n"; - - String expectedDietUnitToString = - "public class WB2 {\n" + - " public WB2() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class WB2 {\n" + - " public WB2() {\n" + - " super();\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString; - if(COMPLIANCE_1_3.equals(this.complianceLevel) || - COMPLIANCE_1_4.equals(this.complianceLevel)) { - expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class WB2 {\n" + - " public WB2() {\n" + - " super();\n" + - " }\n" + - " public void foo() {\n" + - " java.util.Locale.java.util.Vector $missing$;\n" + - " }\n" + - "}\n"; - } else { - expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - expectedDietPlusBodyUnitToString; - } - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should recover from method with missing argument names>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should not find message with no argument as a constructor - */ - -public void test33() { - - String s = - "public class X { \n"+ - " void hello() \n"+ - " public X(int i) \n"+ - " void foo() { \n"+ - " System.out.println(); \n"+ - " \n"+ - "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " void hello() {\n" + - " }\n" + - " public X(int i) {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " void hello() {\n" + - " }\n" + - " public X(int i) {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should not find message with no argument as a constructor>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should not find allocation as a constructor - */ - -public void test34() { - - String s = - "public class X { \n"+ - " void hello() \n"+ - " public X(int i) \n"+ - " static void foo() { \n"+ - " X x; \n"+ - " x = new X(23); \n"+ - " System.out.println(); \n"+ - " \n"+ - "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " void hello() {\n" + - " }\n" + - " public X(int i) {\n" + - " }\n" + - " static void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " void hello() {\n" + - " }\n" + - " public X(int i) {\n" + - " super();\n" + - " }\n" + - " static void foo() {\n" + - " X x;\n" + - " x = new X(23);\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should not find allocation as a constructor>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Incomplete field header - */ - -public void test35() { - - String s = - "public class X { \n" + - " int x \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " int x;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " int x;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<incomplete field header>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Incomplete multiple field headers - */ - -public void test36() { - - String s = - "public class X { \n" + - " int x, y \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " int x;\n" + - " int y;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " int x;\n" + - " int y;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<incomplete multiple field headers>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Field header with started string initializer - */ - -public void test37() { - - String s = - "public class X { \n" + - " String s = \" \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " String s;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " String s;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<field header with started string initializer>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Field header with started string initializer combined with incomplete superinterface - */ - -public void test38() { - - String s = - "public class X implements Y, { \n" + - " String s = \" \n"; - - String expectedDietUnitToString = - "public class X implements Y {\n" + - " String s;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X implements Y {\n" + - " String s;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<field header and incomplete superinterface>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Field signature behind keyword implements - */ - -public void test39() { - - String s = - "public class X implements \n"+ - "int x \n"+ - "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " int x;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " int x;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<field signature behind keyword implements>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Field type read as interface - */ - -public void test40() { - - String s = - "public class X implements Y, \n" + - " String s = \" \n"; - - String expectedDietUnitToString = - "public class X implements Y, String {\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X implements Y, String {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<field type read as interface>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Contiguous headers (checking checkpoint positions) - */ - -public void test41() { - - String s = - "public class X public int foo(int bar(static String s"; - - String expectedDietUnitToString = - "public class X {\n" + - " static String s;\n" + - " public X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " public int foo() {\n" + - " }\n" + - " int bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " static String s;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " public int foo() {\n" + - " }\n" + - " int bar() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<contiguous headers>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Contiguous headers without comma (checking checkpoint positions) - */ - -public void test42() { - - String s = - "public class X public int foo(int x, int bar public String s;"; - - String expectedDietUnitToString = - "public class X {\n" + - " public String s;\n" + - " public X() {\n" + - " }\n" + - " public int foo(int x, int bar) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public String s;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " public int foo(int x, int bar) {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<contiguous headers without comma>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Contiguous headers without comma (checking checkpoint positions) - */ - -public void test43() { - - String s = - "public class X \n" + - " public int foo( \n" + - " int bar( \n" + - " static String s, int x \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " static String s;\n" + - " int x;\n" + - " public X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " public int foo() {\n" + - " }\n" + - " int bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " static String s;\n" + - " int x;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " public int foo() {\n" + - " }\n" + - " int bar() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<contiguous headers without comma>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should find static field <x> - */ - -public void test44() { - - String s = - "class X { \n" + - " String s; \n" + - " \n" + - " public void foo( \n" + - " static int x \n" + - "} \n"; - - String expectedDietUnitToString = - "class X {\n" + - " String s;\n" + - " static int x;\n" + - " X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " String s;\n" + - " static int x;\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should find static field x>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Missing string literal quote inside method - */ - -public void test45() { - - String s = - "public class X { \n"+ - " int foo(){ \n"+ - " String s = \" \n"+ - " } \n"+ - "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<missing string literal quote inside method>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Detecting member type closing when missing brackets - */ - -public void test46() { - - String s = - "class X \n"+ - " String s = \"class y \n"+ - " class Member \n"+ - " int foo() \n"+ - " public int x; \n"+ - " } \n"+ - " int bar() \n"; - - String expectedDietUnitToString = - "class X {\n" + - " class Member {\n" + - " public int x;\n" + - " Member() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " }\n" + - " String s;\n" + - " X() {\n" + - " }\n" + - " int bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " class Member {\n" + - " public int x;\n" + - " Member() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " }\n" + - " String s;\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " int bar() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<detecting member type closing when missing brackets>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Unterminated method arguments - */ - -public void test47() { - - String s = - - "class X { \n" + - " int foo(AA a, BB b, IOEx \n" + - " \n"; - - String expectedDietUnitToString = - "class X {\n" + - " X() {\n" + - " }\n" + - " int foo(AA a, BB b) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " int foo(AA a, BB b) {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<unterminated method arguments>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Unterminated literal string in method body - */ - -public void test48() { - - String s = - "public class X { \n"+ - " final static int foo(){ \n"+ - " return \"1; \n"+ - " } \n"+ - " public static void main(String argv[]){ \n"+ - " foo(); \n"+ - " } \n"+ - "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " static final int foo() {\n" + - " }\n" + - " public static void main(String[] argv) {\n" + - " }\n" + - "}\n"; - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " static final int foo() {\n" + - " }\n" + - " public static void main(String[] argv) {\n" + - " foo();\n" + - " }\n" + - "}\n"; - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<unterminated literal string in method body>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Unterminated initializer with local declaration - */ - -public void test49() { - - String s = - "public class X { \n"+ - " { \n"+ - " int x; \n"+ - " \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<unterminated initializer with local declaration>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Unterminated if statement - */ - -public void test50() { - - String s = - "public class X { \n"+ - " int foo(){ \n"+ - " if(true){ \n"+ - " int x; \n"+ - " \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " if (true)\n" + - " {\n" + - " int x;\n" + - " }\n" + - " else\n" + - " ;\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<unterminated if statement>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Unterminated nested block with local declaration - */ - -public void test51() { - - String s = - "public class X { \n"+ - " int foo(){ \n"+ - " { \n"+ - " int x; \n"+ - " \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " {\n" + - " int x;\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<unterminated nested block with local declaration>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Unterminated nested block with field declaration - */ - -public void test52() { - - String s = - "public class X { \n"+ - " int foo(){ \n"+ - " { \n"+ - " public int x; \n"+ - " \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public int x;\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public int x;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<unterminated nested block with field declaration>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Unterminated initializer with field declaration - */ - -public void test53() { - - String s = - "public class X { \n"+ - " { \n"+ - " public int x; \n"+ - " \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " {\n" + - " }\n" + - " public int x;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " {\n" + - " }\n" + - " public int x;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<unterminated initializer with field declaration>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Invalid class name - */ - -public void test54() { - - String s = - "package p; \n"+ - "public class ZPro.Sev.Blo { \n"+ - "void ThisIsADummyMethodThatIsCreatedOnlyForThePurposesOfTheCompletionEngine() { \n"+ - " System.out.println(this.getClass()); \n"+ - "} \n"+ - " // COMMENT \n"+ - "} \n"; - - String expectedDietUnitToString = - "package p;\n" + - "public class ZPro {\n" + - " {\n" + - " }\n" + - " public ZPro() {\n" + - " }\n" + - " void ThisIsADummyMethodThatIsCreatedOnlyForThePurposesOfTheCompletionEngine() {\n" + - " }\n" + - "}\n"; - String expectedDietPlusBodyUnitToString = - "package p;\n" + - "public class ZPro {\n" + - " {\n" + - " }\n" + - " public ZPro() {\n" + - " super();\n" + - " }\n" + - " void ThisIsADummyMethodThatIsCreatedOnlyForThePurposesOfTheCompletionEngine() {\n" + - " System.out.println(this.getClass());\n" + - " }\n" + - "}\n"; - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<Invalid class name>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Unterminated static initializer with field declaration - */ - -public void test55() { - - String s = - "public class X { \n"+ - " static { \n"+ - " public int x; \n"+ - " \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " static {\n" + - " }\n" + - " public int x;\n" + - " public X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " static {\n" + - " }\n" + - " public int x;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<unterminated static initializer with field declaration>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Multiple initializers combined with array initializer - */ - -public void test56() { - - String s = - "public class X \n"+ - " static int zz \n"+ - " { \n"+ - " } \n"+ - " static { \n"+ - " public int x; \n"+ - " int[] y = { 0, 1}; \n"+ - " { \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " static int zz;\n" + - " {\n" + - " }\n" + - " static {\n" + - " }\n" + - " public int x;\n" + - " int[] y = {0, 1};\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " static int zz;\n" + - " {\n" + - " }\n" + - " static {\n" + - " }\n" + - " public int x;\n" + - " int[] y = {0, 1};\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "public class X {\n" + - " static int zz;\n" + - " {\n" + - " }\n" + - " static {\n" + - " }\n" + - " public int x;\n" + - " int[] y;\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - String testName = "<multiple initializers combined with array initializer>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Combination of unterminated methods and fields - */ - -public void test57() { - - String s = - "class X \n"+ - " void foo(){ \n"+ - " { \n"+ - " public static int x; \n"+ - " void bar() \n"+ - " } \n"+ - " int y; \n"; - - String expectedDietUnitToString = - "class X {\n" + - " public static int x;\n" + - " int y;\n" + - " X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " public static int x;\n" + - " int y;\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<combination of unterminated methods and fields>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Illegal unicode inside method body - */ - -public void test58() { - - String s = - "package p; \n"+ - " \n"+ - "class A { \n"+ - " void bar() { \n"+ - " String s = \"\\u000D\"; \n"+ - " } \n"+ - "} \n"; - - String expectedDietUnitToString = - "package p;\n" + - "class A {\n" + - " A() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package p;\n" + - "class A {\n" + - " A() {\n" + - " super();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<illegal unicode inside method body>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Extra identifier in type signature - */ - -public void test59() { - - String s = - "public class X extends java.io.IOException IOException { \n" + - "} \n"; - - String expectedDietUnitToString = - "public class X extends java.io.IOException {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X extends java.io.IOException {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<extra identifier in type signature>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Extra identifier in method signature - */ - -public void test60() { - - String s = - "public class X extends java.io.IOException { \n" + - " int foo() ExtraIdentifier { \n" + - "} \n"; - - String expectedDietUnitToString = - "public class X extends java.io.IOException {\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X extends java.io.IOException {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<extra identifier in method signature>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Extra identifier behind thrown exception - */ - -public void test61() { - - String s = - "public class X extends { \n" + - " int foo() throws IOException ExtraIdentifier { \n" + - "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " int foo() throws IOException {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " int foo() throws IOException {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<extra identifier behind thrown exception>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Unterminated array initializer - */ - -public void test62() { - - String s = - "class X { \n"+ - " class Y \n"+ - " public String s; \n"+ - " int foo(){ \n"+ - " return 1; \n"+ - " static int y = {; \n"+ // can only be an initializer since type is not array one - " } \n"+ - " public int i = 0; \n"+ - " \n"+ - " int baz() \n"+ - " \n"+ - "} \n"; - - String expectedDietUnitToString = - "class X {\n" + - " class Y {\n" + - " public String s;\n" + - " static int y;\n" + - " {\n" + - " }\n" + - " public int i = 0;\n" + - " Y() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " int baz() {\n" + - " }\n" + - " }\n" + - " X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " class Y {\n" + - " public String s;\n" + - " static int y;\n" + - " {\n" + - " ;\n" + - " }\n" + - " public int i = 0;\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " int foo() {\n" + - " return 1;\n" + - " }\n" + - " int baz() {\n" + - " }\n" + - " }\n" + - " X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "class X {\n" + - " class Y {\n" + - " public String s;\n" + - " static int y;\n" + - " {\n" + - " }\n" + - " public int i;\n" + - " Y() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " int baz() {\n" + - " }\n" + - " }\n" + - " X() {\n" + - " }\n" + - "}\n"; - - String testName = "<unterminated array initializer>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Initializer behind array initializer - */ - -public void test63() { - - String s = - "class X { \n"+ - " int x[] = {0, 1} \n"+ - " { \n"+ - " } \n"+ - "} \n"; - - String expectedDietUnitToString = - "class X {\n" + - " int[] x = {0, 1};\n" + - " {\n" + - " }\n" + - " X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " int[] x = {0, 1};\n" + - " {\n" + - " }\n" + - " X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "class X {\n" + - " int[] x;\n" + - " {\n" + - " }\n" + - " X() {\n" + - " }\n" + - "}\n"; - - String testName = "<initializer behind array initializer>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Initializers mixed with fields - */ - -public void test64() { - - String s = - "public class X \n"+ - " int[] x = { 0, 1}; \n"+ - " static int zz \n"+ - " { \n"+ - " } \n"+ - " static { \n"+ - " public int x; \n"+ - " { \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " int[] x = {0, 1};\n" + - " static int zz;\n" + - " {\n" + - " }\n" + - " static {\n" + - " }\n" + - " public int x;\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " int[] x = {0, 1};\n" + - " static int zz;\n" + - " {\n" + - " }\n" + - " static {\n" + - " }\n" + - " public int x;\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "public class X {\n" + - " int[] x;\n" + - " static int zz;\n" + - " {\n" + - " }\n" + - " static {\n" + - " }\n" + - " public int x;\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - String testName = "<initializers mixed with fields>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should find method behind some() - */ - -public void test65() { - - String s = - "import java.lang.*; \n" + - " \n" + - "public class Hanoi { \n" + - "private Post[] posts; \n" + - "public static void main (String args[]) { \n" + - "} \n" + - "public void some(){ \n" + - " \n" + - "private void moveDisk (Post source, Post destination) { \n" + - "} \n" + - "protected void reportMove (Post source, Post destination) { \n" + - "} \n" + - "private void reset () { \n" + - "} \n" + - "public void solve () { \n" + - "} \n" + - "private void solve (int depth, Post start, Post free, Post end) { \n" + - "} \n" + - "} \n"; - - String expectedDietUnitToString = - "import java.lang.*;\n" + - "public class Hanoi {\n" + - " private Post[] posts;\n" + - " public Hanoi() {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " }\n" + - " public void some() {\n" + - " }\n" + - " private void moveDisk(Post source, Post destination) {\n" + - " }\n" + - " protected void reportMove(Post source, Post destination) {\n" + - " }\n" + - " private void reset() {\n" + - " }\n" + - " public void solve() {\n" + - " }\n" + - " private void solve(int depth, Post start, Post free, Post end) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "import java.lang.*;\n" + - "public class Hanoi {\n" + - " private Post[] posts;\n" + - " public Hanoi() {\n" + - " super();\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " }\n" + - " public void some() {\n" + - " }\n" + - " private void moveDisk(Post source, Post destination) {\n" + - " }\n" + - " protected void reportMove(Post source, Post destination) {\n" + - " }\n" + - " private void reset() {\n" + - " }\n" + - " public void solve() {\n" + - " }\n" + - " private void solve(int depth, Post start, Post free, Post end) {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should find method behind some()>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should detect X(int) as a method with no return type - */ - -public void test66() { - - String s = - "class X { \n"+ - " class Y { \n"+ - " X(int i){} \n"+ - "} \n"; - - String expectedDietUnitToString = - "class X {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " X(int i) {\n" + - " }\n" + - " }\n" + - " X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " class Y {\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " X(int i) {\n" + - " }\n" + - " }\n" + - " X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should detect X(int) as a method with no return type>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should detect orphan X(int) as a constructor - */ - -public void test67() { - - String s = - "class X { \n"+ - " class Y { \n"+ - " } \n"+ - "} \n"+ - " X(int i){ \n"+ - " } \n"; - - String expectedDietUnitToString = - "class X {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " }\n" + - " {\n" + - " }\n" + - " X(int i) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " class Y {\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " {\n" + - " }\n" + - " X(int i) {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should detect orphan X(int) as a constructor>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Empty unit - */ - -public void test68() { - - String s = ""; - - String expectedDietUnitToString = ""; - - String expectedDietPlusBodyUnitToString = expectedDietUnitToString; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<empty unit>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Unit reduced to a method declaration - */ - -public void test69() { - - String s = - " int foo(){ \n" + - " System.out.println(); \n" + - " } \n"; - - String expectedDietUnitToString = ""; - - String expectedDietPlusBodyUnitToString = expectedDietUnitToString; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<unit reduced to a method declaration>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Unit reduced to a constructor declaration - */ - -public void test70() { - - String s = - " X(){ \n" + - " System.out.println(); \n" + - " } \n"; - - String expectedDietUnitToString = ""; - - String expectedDietPlusBodyUnitToString = expectedDietUnitToString; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<unit reduced to a constructor declaration>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Unit reduced to a field declaration - */ - -public void test71() { - - String s = - " String str = new String();"; - - String expectedDietUnitToString = ""; - - String expectedDietPlusBodyUnitToString = expectedDietUnitToString; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<unit reduced to a field declaration>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Unit reduced to a field declaration with array initializer - */ - -public void test72() { - - String s = - " String[] str = { \"hello\" };"; - - String expectedDietUnitToString = ""; - - String expectedDietPlusBodyUnitToString = expectedDietUnitToString; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<unit reduced to a field declaration with array initializer>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should not pick-up any constructor with no arg - */ - -public void test73() { - - String s = - " class X { \n" + - " X(int i){} \n" + - " int foo(){ \n" + - " new X( \n"; - - String expectedDietUnitToString = - "class X {\n" + - " X(int i) {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " X(int i) {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "class X {\n" + - " X(int i) {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " new X();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should not pick-up any constructor with no arg>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should not detect any field - */ - -public void test74() { - - String s = - "package pack; \n" + - " \n" + - "class A extends IOException { \n" + - " \n" + - " S{ \n" + - " int x; \n" + - " } \n" + - "} \n"; - - String expectedDietUnitToString = - "package pack;\n" + - "class A extends IOException {\n" + - " {\n" + - " }\n" + - " A() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package pack;\n" + - "class A extends IOException {\n" + - " {\n" + - " int x;\n" + - " }\n" + - " A() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should not detect any field>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Bunch of syntax errors - */ - -public void test75() { - - String s = - "package ZKentTest;\n"+ - "\n"+ - "import java.awt.color.*;\n"+ - "\n"+ - "public class A {\n"+ - " A foo(int i) { return this; }\n"+ - " int[] ii = {0, 1clone()\n"+ - "\n"+ - " int bar() {\n"+ - " class Local {\n"+ - " int hello(){\n"+ - " fo\n"+ - " }\n"+ - " int world()\n"+ - " }\n"+ - " void foo() {\n"+ - " ba \n"; - - String expectedDietUnitToString = - "package ZKentTest;\n" + - "import java.awt.color.*;\n" + - "public class A {\n" + - " int[] ii;\n" + - " public A() {\n" + - " }\n" + - " A foo(int i) {\n" + - " }\n" + - " int bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package ZKentTest;\n" + - "import java.awt.color.*;\n" + - "public class A {\n" + - " int[] ii;\n" + - " public A() {\n" + - " super();\n" + - " }\n" + - " A foo(int i) {\n" + - " return this;\n" + - " }\n" + - " int bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "package ZKentTest;\n" + - "import java.awt.color.*;\n" + - "public class A {\n" + - " int[] ii;\n" + - " public A() {\n" + - " super();\n" + - " }\n" + - " A foo(int i) {\n" + - " return this;\n" + - " }\n" + - " int bar() {\n" + - " class Local {\n" + - " Local() {\n" + - " super();\n" + - " }\n" + - " int hello() {\n" + - " fo = $missing$;\n" + - " }\n" + - " int world() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " int hello;\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "package ZKentTest;\n" + - "import java.awt.color.*;\n" + - "public class A {\n" + - " int[] ii;\n" + - " public A() {\n" + - " }\n" + - " A foo(int i) {\n" + - " }\n" + - " clone() {\n" + - " }\n" + - " int bar() {\n" + - " }\n" + - "}\n"; - - String testName = "<bunch of syntax errors>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should find Member as a member type - */ - -public void test76() { - - String s = - "package pack; \n"+ - "class A { \n"+ - " \n"+ - " public static void main(String[] argv) \n"+ - " new Member().f \n"+ - " ; \n"+ - " } \n"+ - " class Member { \n"+ - " int foo() \n"+ - " } \n"+ - " } \n"+ - "}; \n"; - - String expectedDietUnitToString = - "package pack;\n" + - "class A {\n" + - " class Member {\n" + - " Member() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " }\n" + - " A() {\n" + - " }\n" + - " public static void main(String[] argv) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package pack;\n" + - "class A {\n" + - " class Member {\n" + - " Member() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " }\n" + - " A() {\n" + - " super();\n" + - " }\n" + - " public static void main(String[] argv) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "package pack;\n" + - "class A {\n" + - " class Member {\n" + - " Member() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " }\n" + - " A() {\n" + - " super();\n" + - " }\n" + - " public static void main(String[] argv) {\n" + - " new Member().f = $missing$;\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should find Member as a member type>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should not recover duplicate field numberOfDisks - */ - -public void test77() { - - String s = - "package p; \n"+ - " \n"+ - "import java.lang.*; \n"+ - " \n"+ - "class IncompleteHanoi { \n"+ - "private Post[] posts; \n"+ - "private int numberOfDisks; \n"+ - " \n"+ - "public Hanoi (int numberOfDisks) { \n"+ - " this.numberOfDisks = numberOfDisks; \n"+ - "'' this.posts = new Post[3]; \n"+ - " String[] postNames = new String[]{\"Left\", \"Middle\", \"Right\"}; \n"+ - " \n"+ - " for (int i = 0; i < 3; ++i) \n"+ - " this.posts[i] = new Post(postNames[i], numberOfDisks); \n"+ - "} \n"+ - " \n"+ - "private void solve (int depth, Post start, Post free, Post end) { \n"+ - " if (depth == 1) \n"+ - " moveDisk(start, end); \n"+ - " else if (depth > 1) { \n"+ - " sol \n"; - - String expectedDietUnitToString = - "package p;\n" + - "import java.lang.*;\n" + - "class IncompleteHanoi {\n" + - " private Post[] posts;\n" + - " private int numberOfDisks;\n" + - " IncompleteHanoi() {\n" + - " }\n" + - " public Hanoi(int numberOfDisks) {\n" + - " }\n" + - " private void solve(int depth, Post start, Post free, Post end) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package p;\n" + - "import java.lang.*;\n" + - "class IncompleteHanoi {\n" + - " private Post[] posts;\n" + - " private int numberOfDisks;\n" + - " IncompleteHanoi() {\n" + - " super();\n" + - " }\n" + - " public Hanoi(int numberOfDisks) {\n" + - " }\n" + - " private void solve(int depth, Post start, Post free, Post end) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "package p;\n" + - "import java.lang.*;\n" + - "class IncompleteHanoi {\n" + - " private Post[] posts;\n" + - " private int numberOfDisks;\n" + - " IncompleteHanoi() {\n" + - " super();\n" + - " }\n" + - " public Hanoi(int numberOfDisks) {\n" + - " }\n" + - " private void solve(int depth, Post start, Post free, Post end) {\n" + - " if ((depth == 1))\n" + - " moveDisk(start, end);\n" + - " else\n" + - " if ((depth > 1))\n" + - " {\n" + - " sol = $missing$;\n" + - " }\n" + - " else\n" + - " ;\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should not recover duplicate field numberOfDisks>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should not detect a field v (1/2) - */ - -public void test78() { - - String s = - "class X { \n" + - " int foo(){ \n" + - " Vector v = new Vector(); \n" + - " s \n" + - " v.addElement( \n" + - " } \n"; - - String expectedDietUnitToString = - "class X {\n" + - " X() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "class X {\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " Vector v = new Vector();\n" + - " s v;\n" + - " addElement();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should not detect a field v>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should not detect a field v (2/2) - */ - -public void test79() { - - String s = - "class X { \n" + - " int foo(){ \n" + - " Vector v = new Vector(); \n" + - " public s v.addElement( \n" + - " } \n"; - - String expectedDietUnitToString = - "class X {\n" + - " X() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "class X {\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " Vector v = new Vector();\n" + - " public s v;\n" + - " addElement();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should not detect a field v>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should not detect a method bar - */ - -public void test80() { - - String s = - "class X { \n" + - " int test(){ \n" + - " int[] i; \n" + - " i \n" + - " // some comment \n" + - " bar(1); \n" + - " } \n"; - - String expectedDietUnitToString = - "class X {\n" + - " X() {\n" + - " }\n" + - " int test() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " int test() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "class X {\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " int test() {\n" + - " int[] i;\n" + - " i bar = 1;\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should not detect a method bar>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should not pick-up any constructor with no arg - */ - -public void test81() { - - String s = - " class X { \n" + - " X(int i){} \n" + - " int foo(){ \n" + - " X(12) \n"; - - String expectedDietUnitToString = - "class X {\n" + - " X(int i) {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " X(int i) {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "class X {\n" + - " X(int i) {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " X(12);\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should not pick-up any constructor with no arg>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should not promote message sending as a method - */ - -public void test82() { - - String s = - "public class A { \n"+ - " \n"+ - " void foo() \n"+ - " if (true) { \n"+ - " } else { \n"+ - " Bar s; \n"+ - " s.fred(); \n"+ - " } \n"+ - " } \n"+ - "} \n"; - String expectedDietUnitToString = - "public class A {\n" + - " public A() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class A {\n" + - " public A() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " if (true)\n" + - " {\n" + - " }\n" + - " else\n" + - " {\n" + - " Bar s;\n" + - " s.fred();\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should not promote message sending as a method>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should not promote message sending as a method 2 - */ - -public void test83() { - - String s = - "public class A { \n"+ - " \n"+ - " void foo() if (true) { \n"+ - " } else { \n"+ - " Bar s; \n"+ - " s.fred(); \n"+ - " } \n"+ - " } \n"+ - "} \n"; - String expectedDietUnitToString = - "public class A {\n" + - " public A() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class A {\n" + - " public A() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " if (true)\n" + - " {\n" + - " }\n" + - " else\n" + - " {\n" + - " Bar s;\n" + - " s.fred();\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should not promote message sending as a method>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should find a static initializer - */ - -public void test84() { - - String s = - "public class A extends \n" + - " \n" + - " static { \n" + - "} \n"; - String expectedDietUnitToString = - "public class A {\n" + - " static {\n" + - " }\n" + - " public A() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class A {\n" + - " static {\n" + - " }\n" + - " public A() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should find a static initializer>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should find a static initializer - */ - -public void test85() { - - String s = - "public class A \n" + - " \n" + - " static { \n" + - "} \n"; - String expectedDietUnitToString = - "public class A {\n" + - " static {\n" + - " }\n" + - " public A() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class A {\n" + - " static {\n" + - " }\n" + - " public A() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should find a static initializer>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should find an initializer - */ - -public void test86() { - - String s = - "public class A \n" + - " \n" + - " int \n" + - " { \n" + - "} \n"; - String expectedDietUnitToString = - "public class A {\n" + - " {\n" + - " }\n" + - " public A() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class A {\n" + - " {\n" + - " }\n" + - " public A() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should find an initializer>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Should find an initializer - */ - -public void test87() { - - String s = - "public class A \n" + - " \n" + - " int x; \n" + - " { \n" + - " int y; \n" + - "} \n"; - String expectedDietUnitToString = - "public class A {\n" + - " int x;\n" + - " {\n" + - " }\n" + - " public A() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class A {\n" + - " int x;\n" + - " {\n" + - " int y;\n" + - " }\n" + - " public A() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<should find an initializer>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * 1FVRQG0: ITPCOM:WINNT - NullPointerException in recovery mode - */ - -public void test88() { - - String s = - "package p1; \n" + - " \n" + - "public class X { \n" + - " int foo(String s, int x) \n" + - " public int y = new X() { \n" + - " \n" + - "} \n"; - - String expectedDietUnitToString = - "package p1;\n" + - "public class X {\n" + - " public int y;\n" + - " public X() {\n" + - " }\n" + - " int foo(String s, int x) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "package p1;\n" + - "public class X {\n" + - " public int y;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " int foo(String s, int x) {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "package p1;\n" + - "public class X {\n" + - " public int y;\n" + - " public X() {\n" + - " }\n" + - " int foo(String s, int x) {\n" + - " }\n" + - "}\n"; - - String testName = "<1FVRQG0: ITPCOM:WINNT - NullPointerException in recovery mode>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * 1FVRN9V: ITPJCORE:WIN98 - Internal builder error compiling servlet - */ - -public void test89() { - - String s = - "import javax.servlet.*; \n" + - "import javax.servlet.http.*; \n" + - " \n" + - "public class Servlet1 extends HttpServlet { \n" + - " protected (HttpServletRequest req, HttpServletResponse resp) { \n" + - " } \n" + - "} \n"; - - String expectedDietUnitToString = - "import javax.servlet.*;\n" + - "import javax.servlet.http.*;\n" + - "public class Servlet1 extends HttpServlet {\n" + - " HttpServletRequest req;\n" + - " HttpServletRequest HttpServletResponse;\n" + - " {\n" + - " }\n" + - " public Servlet1() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "import javax.servlet.*;\n" + - "import javax.servlet.http.*;\n" + - "public class Servlet1 extends HttpServlet {\n" + - " HttpServletRequest req;\n" + - " HttpServletRequest HttpServletResponse;\n" + - " {\n" + - " }\n" + - " public Servlet1() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<1FVRN9V: ITPJCORE:WIN98 - Internal builder error compiling servlet>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * 1FVXQZ4: ITPCOM:WIN98 - Walkback during parsing recovery - */ - -public void test90() { - - String s = - "public class Test { \n"+ - " \n"+ - " int x; \n"+ - " int foo( \n"+ - " int bar( \n"+ - " baz(A a \n"+ - "} \n"; - String expectedDietUnitToString = - "public class Test {\n" + - " int x;\n" + - " public Test() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " int bar() {\n" + - " }\n" + - " baz(A a) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class Test {\n" + - " int x;\n" + - " public Test() {\n" + - " super();\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - " int bar() {\n" + - " }\n" + - " baz(A a) {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<1FVXQZ4: ITPCOM:WIN98 - Walkback during parsing recovery>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * 1FVXWKI: ITPCOM:WIN98 - Walkback when parsing a bogus interface - */ - -public void test91() { - - String s = - "public interface Fred { \n" + - " void foo(); \n" + - " void bar(); \n" + - " public fred(X x, int y); \n" + - "} \n"; - String expectedDietUnitToString = - "public interface Fred {\n" + - " void foo();\n" + - " void bar();\n" + - " public fred(X x, int y);\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = expectedDietUnitToString; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<1FVXWKI: ITPCOM:WIN98 - Walkback when parsing a bogus interface>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * Variation on 1FVXWKI: ITPCOM:WIN98 - Walkback when parsing a bogus interface - */ - -public void test92() { - String s = - "public interface Test { \n"+ - " void foo(); \n"+ - " \n"+ - " public fred(Fred x, int y); \n"+ - "} \n"; - String expectedDietUnitToString = - "public interface Test {\n" + - " void foo();\n" + - " public fred(Fred x, int y);\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = expectedDietUnitToString; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<1FVXWKI: ITPCOM:WIN98 - Walkback when parsing a bogus interface>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * 1FW5A4E: ITPCOM:WIN98 - Walkback reconciling - */ - -public void test93() { - String s = - "class X{ \n" + - " int foo() \n" + - " static { } \n" + - "} \n"; - String expectedDietUnitToString = - "class X {\n" + - " static {\n" + - " }\n" + - " X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " static {\n" + - " }\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<1FW5A4E: ITPCOM:WIN98 - Walkback reconciling>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * 1FW3663: ITPCOM:WIN98 - Outline - does not show method #fred() - */ - -public void test94() { - String s = - "public class X { \n" + - " int[] array; \n" + - " \n" + - "void foo() { \n" + - " bar(this.array.length, 10, fred( \n" + - " \n" + - "int fred( \n" + - "} \n"; - String expectedDietUnitToString = - "public class X {\n" + - " int[] array;\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " int fred() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " int[] array;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " int fred() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class X {\n" + - " int[] array;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " bar(this.array.length, 10, fred());\n" + - " }\n" + - " int fred() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<1FW3663: ITPCOM:WIN98 - Outline - does not show method #fred()>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * 1FW6M5M: ITPJUI:ALL - NPE in SourceElementParser - */ - -public void test95() { - String s = - "public interface IP { \n"+ - " public static toString() { \n"+ - " } \n"+ - "} \n"; - String expectedDietUnitToString = - "public interface IP {\n" + - " public static toString() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = expectedDietUnitToString; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<1FW6M5M: ITPJUI:ALL - NPE in SourceElementParser>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * 1FWHXX7: ITPCOM:WINNT - ClassCastException compiling invalid import - */ - -public void test96() { - String s = - "import ;\n"+ - "class X {\n"+ - " int foo(){\n"+ - " System.out.println();\n"+ - " }\n"+ - " static {\n"+ - " int i = j;\n"+ - " }\n"+ - "}\n"; - String expectedDietUnitToString = - "class X {\n" + - " static {\n" + - " }\n" + - " X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " static {\n" + - " int i = j;\n" + - " }\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " int foo() {\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<1FWHXX7: ITPCOM:WINNT - ClassCastException compiling invalid import>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * variation on 1FWHXX7: ITPCOM:WINNT - ClassCastException compiling invalid import - */ - -public void test97() { - String s = - "import ;\n"+ - "class X {\n"+ - " int foo(){\n"+ - " System.out.println();\n"+ - " }\n"+ - " static {\n"+ - " }\n"+ - "}\n"; - String expectedDietUnitToString = - "class X {\n" + - " static {\n" + - " }\n" + - " X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " int foo() {\n" + - " }\n" + - "}\n"; - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " static {\n" + - " }\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " int foo() {\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<variation on 1FWHXX7: ITPCOM:WINNT - ClassCastException compiling invalid import>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -/* - * http://dev.eclipse.org/bugs/show_bug.cgi?id=9084 - */ - -public void test98() { - - String s = - "public class A { \n"+ - " class Platform { \n"+ - " public static void run(Runnable r) { \n"+ - " } \n"+ - " } \n"+ - " Object [] array = null; \n"+ - " for (int nX = 0; nX < array.length; nX ++) { \n"+ - " final String part = \"\"; \n"+ - " final String sel = \"\"; \n"+ - " Object l = null; \n"+ - " if ((part != null && sel != null) || l instanceof String) { \n"+ - " Platform.run(new Runnable() { \n"+ - " public void run() { \n"+ - " } \n"+ - " public void handleException(Throwable e) { \n"+ - " } \n"+ - " }); \n"+ - " } \n"+ - " } \n"+ - "} \n"; - - String expectedDietUnitToString = - "public class A {\n"+ - " class Platform {\n"+ - " Platform() {\n"+ - " }\n"+ - " public static void run(Runnable r) {\n"+ - " }\n"+ - " }\n"+ - " Object[] array = null;\n"+ - " int nX = 0;\n"+ - " {\n"+ - " }\n"+ - " public A() {\n"+ - " }\n"+ - "}\n"; - - - String expectedDietPlusBodyUnitToString = "public class A {\n"+ - " class Platform {\n"+ - " Platform() {\n"+ - " super();\n"+ - " }\n"+ - " public static void run(Runnable r) {\n"+ - " }\n"+ - " }\n"+ - " Object[] array = null;\n"+ - " int nX = 0;\n"+ - " {\n"+ - " final String part = \"\";\n"+ - " final String sel = \"\";\n"+ - " Object l = null;\n"+ - " if ((((part != null) && (sel != null)) || (l instanceof String)))\n"+ - " {\n"+ - " Platform.run(new Runnable() {\n"+ - " public void run() {\n"+ - " }\n"+ - " public void handleException(Throwable e) {\n"+ - " }\n"+ - "});\n"+ - " }\n"+ - " }\n"+ - " public A() {\n"+ - " super();\n"+ - " }\n"+ - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "public class A {\n"+ - " class Platform {\n"+ - " Platform() {\n"+ - " }\n"+ - " public static void run(Runnable r) {\n"+ - " }\n"+ - " }\n"+ - " Object[] array;\n"+ - " int nX;\n"+ - " {\n"+ - " }\n"+ - " public A() {\n"+ - " }\n"+ - "}\n"; - - String testName = "<check for null inside RecoveredInitializer>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} - -public void test99() { - String s = - "import ;\n"+ - "class X {\n"+ - "}\n"+ - "- public void addThreadFilter(IJavaThread thread) - restricts breakpoint to \n"+ - "given thread and any other previously specified threads\n"+ - "- public void removeThreadFilter(IJavaThread thread)- removes the given thread \n"+ - "restriction (will need to re-create breakpoint request as JDI does not support \n"+ - "the removal of thread filters)\n"+ - "- public IJavaThread[] getThreadFilters() - return the set of threads this \n"+ - "breakpoint is currently restricted to\n"; - String expectedDietUnitToString = - "class X {\n" + - " {\n" + - " }\n" + - " X() {\n" + - " }\n" + - " public void addThreadFilter(IJavaThread thread) {\n" + - " }\n" + - " public void removeThreadFilter(IJavaThread thread) {\n" + - " }\n" + - " public IJavaThread[] getThreadFilters() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "class X {\n" + - " {\n" + - " }\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " public void addThreadFilter(IJavaThread thread) {\n" + - " }\n" + - " public void removeThreadFilter(IJavaThread thread) {\n" + - " }\n" + - " public IJavaThread[] getThreadFilters() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "class X {\n" + - " {\n" + - " }\n" + - " X() {\n" + - " super();\n" + - " }\n" + - " public void addThreadFilter(IJavaThread thread) {\n" + - " restricts breakpoint;\n" + - " given thread;\n" + - " any other;\n" + - " specified = $missing$;\n" + - " }\n" + - " public void removeThreadFilter(IJavaThread thread) {\n" + - " removes the;\n" + - " thread restriction;\n" + - " will need = (re - create);\n" + - " request as;\n" + - " does not;\n" + - " the removal;\n" + - " thread = $missing$;\n" + - " }\n" + - " public IJavaThread[] getThreadFilters() {\n" + - " return the;\n" + - " of threads;\n" + - " breakpoint is;\n" + - " restricted to;\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<9101 - Parse error while typing in Java editor>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -public void test100() { - String s = - "public class Bug {\n" + - " static boolean bold = false;\n" + - "public static void main(String arguments[]) {\n" + - " Shell shell = new Shell(SWT.MENU | SWT.RESIZE | SWT.TITLE | SWT.H_SCROLL);\n" + - " StyledText text = new StyledText(shell, SWT.WRAP); \n" + - " shell.addListener(SWT.Resize, new Listener() {\n" + - " public void handleEvent(Event e) {\n" + - " text.setBounds(shell.getClientArea()); \n" + - " } \n" + - " }); \n" + - " shell.addListener(SWT.KeyDown, bew Listener () {\n" + - " public void handleEvent(Event e) {\n" + - " bold = !bold;\n" + - " }\n" + - " }); \n" + - " text.addLineStyleListener(new LineStyleListener() { \n" + - " public void lineGetStyle(LineStyleEvent event) {\n" + - " }\n" + - " });\n" + - "}\n" + - "}\n"; - - String expectedDietUnitToString = - "public class Bug {\n" + - " static boolean bold = false;\n" + - " <clinit>() {\n" + - " }\n" + - " public Bug() {\n" + - " }\n" + - " public static void main(String[] arguments) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class Bug {\n" + - " static boolean bold = false;\n" + - " <clinit>() {\n" + - " }\n" + - " public Bug() {\n" + - " super();\n" + - " }\n" + - " public static void main(String[] arguments) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class Bug {\n" + - " static boolean bold = false;\n" + - " <clinit>() {\n" + - " }\n" + - " public Bug() {\n" + - " super();\n" + - " }\n" + - " public static void main(String[] arguments) {\n" + - " Shell shell = new Shell((((SWT.MENU | SWT.RESIZE) | SWT.TITLE) | SWT.H_SCROLL));\n" + - " StyledText text = new StyledText(shell, SWT.WRAP);\n" + - " shell.addListener(SWT.Resize, new Listener() {\n" + - " public void handleEvent(Event e) {\n" + - " text.setBounds(shell.getClientArea());\n" + - " }\n" + - "});\n" + - " shell.addListener(SWT.KeyDown, new Listener() {\n" + - " public void handleEvent(Event e) {\n" + - " bold = (! bold);\n" + - " }\n" + - "});\n" + - " text.addLineStyleListener(new LineStyleListener() {\n" + - " public void lineGetStyle(LineStyleEvent event) {\n" + - " }\n" + - "});\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - "public class Bug {\n" + - " static boolean bold = false;\n" + - " public Bug() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " public static void main(String[] arguments) {\n" + - " }\n" + - " bew Listener() {\n" + - " }\n" + - " public void handleEvent(Event e) {\n" + - " }\n" + - "}\n"; - - String expectedCompletionDietUnitToString = - "public class Bug {\n" + - " static boolean bold;\n" + - " <clinit>() {\n" + - " }\n" + - " public Bug() {\n" + - " }\n" + - " public static void main(String[] arguments) {\n" + - " }\n" + - "}\n"; - - String testName = "<10616 - local type outside method>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -public void _test101() { - String s = - "public class X { \n"+ - " Object foo(Stack<X> s) { \n"+ - " } \n"+ - " List<T> bar(int pos, T x1, T x2, List<T> l) { \n"+ - " } \n"+ - "} \n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " Object foo() {\n" + - " }\n" + - " bar(int pos, T x1, T x2) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " Object foo() {\n" + - " }\n" + - " bar(int pos, T x1, T x2) {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<12387 out of memory with generics>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -public void test102() { - String s = - "void ___eval() { \n"+ - "new Runnable(){ \n"+ - "void ___run() throws Throwable { \n"+ - "return blah; \n"+ - "} \n"+ - "private String blarg; \n"+ - "public void run (){ \n"+ - " class Local { \n" + - " void baz() { \n"+ - " } \n" + - " } \n"+ - "} \n"+ - "} \n"+ - ";} \n"+ - "public class Hello{ \n"+ - "private static int x; \n"+ - "private String blah; \n"+ - "public static void main (String[] args){ \n"+ - "} \n"+ - "public void hello (){ \n"+ - "} \n"+ - "public boolean blah (){ \n"+ - "return false;} \n"+ - "public void foo (){ \n"+ - "} \n"+ - "} \n"; - - String expectedDietUnitToString = - "public class Hello {\n" + - " private static int x;\n" + - " private String blah;\n" + - " public Hello() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " }\n" + - " public void hello() {\n" + - " }\n" + - " public boolean blah() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n" ; - - String expectedDietPlusBodyUnitToString = - "public class Hello {\n" + - " private static int x;\n" + - " private String blah;\n" + - " public Hello() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " }\n" + - " public void hello() {\n" + - " }\n" + - " public boolean blah() {\n" + - " return false;\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<12454 - handling toplevel anonymous>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -public void test103() { - String s = - "public class X{ \n"+ - " void foo(int x, int y, void z"; - - String expectedDietUnitToString = - "public class X {\n" + - " void z;\n" + - " public X() {\n" + - " }\n" + - " void foo(int x, int y) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " void z;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo(int x, int y) {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<14038 - third argument type is void>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -public void test104() { - String s = - "public class P#AField {\n" + - " public void setP#A(String P#A) {\n" + - " this.P#A = P#A;\n" + - " }\n" + - "}"; - - String expectedDietUnitToString = - "public class P {\n" + - " {\n" + - " }\n" + - " public void setP;\n" + - " public P() {\n" + - " }\n" + - " A(String P) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class P {\n" + - " {\n" + - " }\n" + - " public void setP;\n" + - " public P() {\n" + - " super();\n" + - " }\n" + - " A(String P) {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = expectedDietUnitToString; - - String testName = "<16126>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -public void test105() { - String s = - "public class X {\n" + - " static int foo(int[] a, int[] b) {\n" + - " return 0;\n" + - " }\n" + - " static int B =\n" + - " foo(\n" + - " new int[]{0, 0},\n" + - " new int[]{0, 0}\n" + - " );\n" + - " #\n"; - - String expectedDietUnitToString = - "public class X {\n" + - " static int B = foo(new int[]{0, 0}, new int[]{0, 0});\n" + - " public X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " static int foo(int[] a, int[] b) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " static int B = foo(new int[]{0, 0}, new int[]{0, 0});\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " static int foo(int[] a, int[] b) {\n" + - " return 0;\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "public class X {\n" + - " static int B;\n" + - " {\n" + - " }\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " static int foo(int[] a, int[] b) {\n" + - " }\n" + - "}\n"; - - String testName = ""; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -public void test106() { - String s = - "public class X {\n" + - " clon\n" + - " foo();\n" + - "}\n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " clon foo();\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " clon foo();\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietPlusBodyUnitToString; - - String expectedCompletionDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " clon foo();\n" + - "}\n"; - - String testName = ""; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -public void test107() { - String s = - "public class X {\n" + - " int[] a = new int[]{0, 0}, b = new int[]{0, 0};\n" + - " #\n"; - - String expectedDietUnitToString = - "public class X {\n" + - " int[] a = new int[]{0, 0};\n" + - " int[] b = new int[]{0, 0};\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " int[] a = new int[]{0, 0};\n" + - " int[] b = new int[]{0, 0};\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "public class X {\n" + - " int[] a;\n" + - " int[] b;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String testName = ""; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -public void test108() { - String s = - "public class X {\n" + - " int a = new int[]{0, 0}, b = new int[]{0, 0};\n" + - " #\n"; - - String expectedDietUnitToString = - "public class X {\n" + - " int a = new int[]{0, 0};\n" + - " int b = new int[]{0, 0};\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " int a = new int[]{0, 0};\n" + - " int b = new int[]{0, 0};\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "public class X {\n" + - " int a;\n" + - " {\n" + - " }\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String testName = ""; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -public void test109() { - String s = - "public class X {\n" + - " Object o = new Object() {\n" + - " void foo() {\n" + - " try {\n" + - " } catch(Exception e) {\n" + - " e.\n" + - " }\n" + - " }\n" + - " };\n" + - "}"; - - String expectedDietUnitToString = - "public class X {\n" + - " Object o;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " Object o;\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "public class X {\n" + - " Object o;\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String testName = ""; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -public void test110() { - String s = - "public class X {\n" + - " void bar(){\n" + - " #\n" + - " class Inner {\n" + - " void foo() {\n" + - " try {\n" + - " } catch(Exception e) {\n" + - " e.\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - "}"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void bar() {\n" + - " class Inner {\n" + - " Inner() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " try \n" + - " {\n" + - " }\n" + - " catch (Exception e) {\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - "}\n"; - - String testName = ""; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -public void test111() { - String s = - "public class X {\n" + - " void bar(){\n" + - " }\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}"; - - String expectedDietUnitToString = - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = ""; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=100797 -public void test112() { - String s = - "public class X {\n"+ - " public void foo()\n"+ - " try { \n"+ - " } catch (Exception e) {\n"+ - " bar(\"blabla\");\n"+ - " throw new Exception(prefix \"bloblo\");\n"+ - " }\n"+ - " }\n"+ - "}\n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " public void foo() {\n" + - " try \n" + - " {\n" + - " }\n" + - " catch (Exception e) {\n" + - " bar(\"blabla\");\n" + - " throw new Exception(prefix);\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = ""; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=111618 -public void test113() { - String s = - "public class X {\n"+ - " public void foo(Object[] tab)\n"+ - " for (Object o : tab) {\n"+ - " o.toString();\n"+ - " }\n"+ - " }\n"+ - "}\n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo(Object[] tab) {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " public void foo(Object[] tab) {\n" + - " for (Object o : tab) \n" + - " {\n" + - " o.toString();\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = "test foreach toString"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=129142 -public void test114() { - String s = - "public class X {\n"+ - " public void foo() {\n"+ - " int int;\n"+ - " }\n"+ - "}\n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " public void foo() {\n" + - " int $missing$;\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = "test foreach toString"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=80339 -public void test115() { - String s = - "public interface Test {\n"+ - " public void myMethod()\n"+ - "}\n"; - - String expectedDietUnitToString = - "public interface Test {\n" + - " public void myMethod() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public interface Test {\n" + - " public void myMethod() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public interface Test {\n" + - " public void myMethod() {\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = "test foreach toString"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=80339 -public void test116() { - String s = - "public interface Test {\n"+ - " public void myMethod()\n"+ - " System.out.println();\n"+ - "}\n"; - - String expectedDietUnitToString = - "public interface Test {\n" + - " public void myMethod() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public interface Test {\n" + - " public void myMethod() {\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public interface Test {\n" + - " public void myMethod() {\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = "test foreach toString"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=154811 -public void test117() { - String s = - "public class X {\n" + - " void foo1() {\n" + - " class Y {\n" + - " }\n" + - " void foo2() {\n" + - " }\n" + - " class Z<T> { \n" + - " }\n" + - " }\n" + - "} \n"; - - String expectedDietUnitToString = null; - String expectedDietPlusBodyUnitToString = null; - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = null; - String expectedFullUnitToString = null; - String expectedCompletionDietUnitToString = null; - - - if(COMPLIANCE_1_3.equals(this.complianceLevel) || - COMPLIANCE_1_4.equals(this.complianceLevel)) { - - expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo1() {\n" + - " }\n" + - "}\n"; - - expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo1() {\n" + - " }\n" + - "}\n"; - - expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo1() {\n" + - " class Y {\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " class Z<T> {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - expectedFullUnitToString = - "public class X {\n" + - " class Z<T> {\n" + - " Z() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " void foo1() {\n" + - " }\n" + - " void foo2() {\n" + - " }\n" + - "}\n"; - - expectedCompletionDietUnitToString = - expectedDietUnitToString; - } else if(this.complianceLevel.compareTo(COMPLIANCE_1_5) >= 0) { - - expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo1() {\n" + - " }\n" + - "}\n"; - - expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo1() {\n" + - " }\n" + - "}\n"; - - expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo1() {\n" + - " class Y {\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " new foo2() {\n" + - " };\n" + - " class Z<T> {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - expectedFullUnitToString = - "public class X {\n" + - " class Z<T> {\n" + - " Z() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " void foo1() {\n" + - " }\n" + - " void foo2() {\n" + - " }\n" + - "}\n"; - - expectedCompletionDietUnitToString = - expectedDietUnitToString; - } - - String testName = "test foreach toString"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=154811 -public void test117_2() { - String s = - "public class X {\n" + - " void foo1() {\n" + - " class Y {\n" + - " }\n" + - " void foo2() {\n" + - " }\n" + - " class Z { \n" + - " }\n" + - " }\n" + - "} \n"; - - String expectedDietUnitToString = null; - String expectedDietPlusBodyUnitToString = null; - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = null; - String expectedFullUnitToString = null; - String expectedCompletionDietUnitToString = null; - - expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo1() {\n" + - " }\n" + - "}\n"; - - expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo1() {\n" + - " }\n" + - "}\n"; - - expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo1() {\n" + - " class Y {\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " new foo2() {\n" + - " };\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - expectedFullUnitToString = - "public class X {\n" + - " class Z {\n" + - " Z() {\n" + - " }\n" + - " }\n" + - " public X() {\n" + - " }\n" + - " void foo1() {\n" + - " }\n" + - " void foo2() {\n" + - " }\n" + - "}\n"; - - expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = "test foreach toString"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=162056 -public void test118() { - String s = - "interface Irrelevant {}\n"+ - "interface I {\n"+ - " Object foo(Number n);\n"+ - "}\n"+ - "interface J extends I {\n"+ - " String foo(Number n);\n"+ - "}\n"+ - "interface K {\n"+ - " Object foo(Number n);\n"+ - "}\n"+ - "public class {\n"+ - " void foo() {\n"+ - "\n"+ - " }\n"+ - "} \n"; - - String expectedDietUnitToString = - "interface Irrelevant {\n" + - "}\n" + - "interface I {\n" + - " Object foo(Number n);\n" + - "}\n" + - "interface J extends I {\n" + - " String foo(Number n);\n" + - "}\n" + - "interface K {\n" + - " Object foo(Number n);\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "interface Irrelevant {\n" + - "}\n" + - "interface I {\n" + - " Object foo(Number n);\n" + - "}\n" + - "interface J extends I {\n" + - " String foo(Number n);\n" + - "}\n" + - "interface K {\n" + - " Object foo(Number n);\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - expectedDietPlusBodyUnitToString; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = "test foreach toString"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=162056 -public void test119() { - String s = - "interface Irrelevant {}\n"+ - "interface I {\n"+ - " Object foo(Number n);\n"+ - "}\n"+ - "interface J extends I {\n"+ - " String foo(Number n);\n"+ - "}\n"+ - "abstract class K {\n"+ - " abstract Object foo(Number n);\n"+ - "}\n"+ - "public class {\n"+ - " void foo() {\n"+ - "\n"+ - " }\n"+ - "} \n"; - - String expectedDietUnitToString = - "interface Irrelevant {\n" + - "}\n" + - "interface I {\n" + - " Object foo(Number n);\n" + - "}\n" + - "interface J extends I {\n" + - " String foo(Number n);\n" + - "}\n" + - "abstract class K {\n" + - " {\n" + - " }\n" + - " K() {\n" + - " }\n" + - " abstract Object foo(Number n);\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "interface Irrelevant {\n" + - "}\n" + - "interface I {\n" + - " Object foo(Number n);\n" + - "}\n" + - "interface J extends I {\n" + - " String foo(Number n);\n" + - "}\n" + - "abstract class K {\n" + - " {\n" + - " }\n" + - " K() {\n" + - " super();\n" + - " }\n" + - " abstract Object foo(Number n);\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - expectedDietPlusBodyUnitToString; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = "test foreach toString"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140980 -public void test120() { - String s = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " try {\n" + - " System.out.println(); \n" + - " } catch (Exception e) {\n" + - " }\n" + - " class Z {}\n" + - " }\n" + - "}\n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " try \n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " catch (Exception e) {\n" + - " }\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = "test foreach toString"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140980 -public void test121() { - String s = - "public class X {\n" + - " void foo() {\n" + - " #\n" + - " try {\n" + - " System.out.println(); \n" + - " } catch (Exception e) {\n" + - " class Z {}\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedDietUnitToString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " try \n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " catch (Exception e) {\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = "test foreach toString"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140980 -public void test122() { - String s = - "public class Test\n" + - "{\n" + - " public void func1()\n" + - " {\n" + - " try\n" + - " {\n" + - " catch ( Exception exception)\n" + - " {\n" + - " exception.printStackTrace();\n" + - " }\n" + - " }\n" + - "\n" + - " class Clazz\n" + - " {\n" + - " }\n" + - "}\n" + - "\n"; - - String expectedDietUnitToString = - "public class Test {\n" + - " public Test() {\n" + - " }\n" + - " public void func1() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class Test {\n" + - " public Test() {\n" + - " super();\n" + - " }\n" + - " public void func1() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class Test {\n" + - " public Test() {\n" + - " super();\n" + - " }\n" + - " public void func1() {\n" + - " try \n" + - " {\n" + - " }\n" + - " catch (Exception exception) {\n" + - " exception.printStackTrace();\n" + - " }\n" + - " class Clazz {\n" + - " Clazz() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = "test foreach toString"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140980 -public void test123() { - String s = - "public class SwitchBug {\n" + - " void aMethod() {\n" + - " int i=0;\n" + - " try {\n" + - " switch( i ) {\n" + - " } catch( Exception ex ) {\n" + - " }\n" + - " }\n" + - " class Nested {\n" + - " }\n" + - "}\n"; - - String expectedDietUnitToString = - "public class SwitchBug {\n" + - " public SwitchBug() {\n" + - " }\n" + - " void aMethod() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class SwitchBug {\n" + - " public SwitchBug() {\n" + - " super();\n" + - " }\n" + - " void aMethod() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class SwitchBug {\n" + - " public SwitchBug() {\n" + - " super();\n" + - " }\n" + - " void aMethod() {\n" + - " int i = 0;\n" + - " try \n" + - " {\n" + - " switch (i) {\n" + - " }\n" + - " }\n" + - " catch (Exception ex) {\n" + - " }\n" + - " class Nested {\n" + - " Nested() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = expectedDietUnitToString; - - String expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = "test foreach toString"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=157570 -public void test124() { - String s = - "public class Test {\n" + - " void aMethod() {\n" + - " public static void m1()\n" + - " {\n" + - " int a;\n" + - " int b;\n" + - " }\n" + - " public static void m2()\n" + - " {\n" + - " int c;\n" + - " int d;\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedDietUnitToString = - "public class Test {\n" + - " public Test() {\n" + - " }\n" + - " void aMethod() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyUnitToString = - "public class Test {\n" + - " public Test() {\n" + - " super();\n" + - " }\n" + - " void aMethod() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyPlusStatementsRecoveryUnitToString = null; - if(COMPLIANCE_1_3.equals(this.complianceLevel) || - COMPLIANCE_1_4.equals(this.complianceLevel)) { - expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class Test {\n" + - " public Test() {\n" + - " super();\n" + - " }\n" + - " void aMethod() {\n" + - " m1();\n" + - " {\n" + - " int a;\n" + - " int b;\n" + - " }\n" + - " m2();\n" + - " {\n" + - " int c;\n" + - " int d;\n" + - " }\n" + - " }\n" + - "}\n"; - } else { - expectedDietPlusBodyPlusStatementsRecoveryUnitToString = - "public class Test {\n" + - " public Test() {\n" + - " super();\n" + - " }\n" + - " void aMethod() {\n" + - " public static @m1() enum $missing$ {\n" + - " public $missing$() {\n" + - " super();\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - } - - String expectedFullUnitToString = - "public class Test {\n" + - " public Test() {\n" + - " }\n" + - " void aMethod() {\n" + - " }\n" + - " public static void m1() {\n" + - " }\n" + - " public static void m2() {\n" + - " }\n" + - "}\n"; - - String expectedCompletionDietUnitToString = - expectedDietUnitToString; - - String testName = "test"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyPlusStatementsRecoveryUnitToString, - expectedFullUnitToString, - expectedCompletionDietUnitToString, testName); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/DualParseSyntaxErrorTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/DualParseSyntaxErrorTest.java index 3e75351..44686a7 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/DualParseSyntaxErrorTest.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/DualParseSyntaxErrorTest.java
@@ -100,14 +100,12 @@ public void test01() { String s = - "public class X { \n"+ - " int fX; \n"+ - " void foo() { \n"+ - " fX = 0; \n"+ - " } \n"+ - " public void bar() { \n"+ - " } \n"+ - "} \n"; + "var fX; \n"+ + "function foo() { \n"+ + " fX = 0; \n"+ + "} \n"+ + "function bar() { \n"+ + "} \n"; String expectedSyntaxErrorDiagnosis = ""; @@ -121,20 +119,18 @@ public void test02() { String s = - "public class X { \n"+ - " int fX; \n"+ - " void foo() { \n"+ - " fX = 0; \n"+ - " public void bar() { \n"+ - " } \n"+ - "} \n"; + "var fX; \n"+ + "function foo() { \n"+ + " fX = 0; \n"+ + "function bar() { \n"+ + "} \n"; String expectedSyntaxErrorDiagnosis = - "----------\n" + - "1. ERROR in <test2> (at line 4)\n" + - " fX = 0; \n" + - " ^\n" + - "Syntax error, insert \"}\" to complete MethodBody\n" + + "----------\n" + + "1. ERROR in <test2> (at line 5)\n" + + " } \n" + + " ^\n" + + "Syntax error, insert \"}\" to complete MethodBody\n" + "----------\n"; String testName = "<test2>"; @@ -143,16 +139,14 @@ expectedSyntaxErrorDiagnosis, testName); } -public void test03() { +public void Xtest03() { String s = - "public class X { \n"+ - " int fX; \n"+ - " void foo() \n"+ - " fX = 0; \n"+ - " public void bar() { \n"+ - " } \n"+ - "} \n"; + "var fX; \n"+ + "function foo() \n"+ + " fX = 0; \n"+ + "function bar() { \n"+ + "} \n"; String expectedSyntaxErrorDiagnosis = "----------\n" + @@ -176,20 +170,18 @@ public void test04() { String s = - "public class X { \n"+ - " int fX; \n"+ - " void foo() \n"+ - " fX = 0; \n"+ - " } \n"+ - " public void bar() { \n"+ - " } \n"+ - "} \n"; + "var fX; \n"+ + "function foo() \n"+ + " fX = 0; \n"+ + "} \n"+ + "function bar() { \n"+ + "} \n"; String expectedSyntaxErrorDiagnosis = "----------\n" + - "1. ERROR in <test4> (at line 3)\n" + - " void foo() \n" + - " ^\n" + + "1. ERROR in <test4> (at line 2)\n" + + " function foo() \n" + + " ^\n" + "Syntax error on token \")\", { expected after this token\n" + "----------\n"; @@ -202,21 +194,19 @@ public void test05() { String s = - "public class X { \n"+ - " int fX; \n"+ - " void foo() { \n"+ - " if(true){ \n"+ - " } \n"+ - " public void bar() { \n"+ - " } \n"+ - "} \n"; + "var fX; \n"+ + "function foo() { \n"+ + " if(true){ \n"+ + "} \n"+ + "function bar() { \n"+ + "} \n"; String expectedSyntaxErrorDiagnosis = - "----------\n" + - "1. ERROR in <test5> (at line 4)\n" + - " if(true){ \n" + - " ^\n" + - "Syntax error, insert \"}\" to complete Statement\n" + + "----------\n" + + "1. ERROR in <test5> (at line 6)\n" + + " } \n" + + " ^\n" + + "Syntax error, insert \"}\" to complete MethodBody\n" + "----------\n"; String testName = "<test5>"; @@ -228,22 +218,20 @@ public void test06() { String s = - "public class X { \n"+ - " int fX; \n"+ - " void foo() { \n"+ - " if(true){ \n"+ - " } \n"+ - " //comment \n"+ - " public void bar() { \n"+ - " } \n"+ - "} \n"; + "var fX; \n"+ + "function foo() { \n"+ + " if(true){ \n"+ + "} \n"+ + "//comment \n"+ + "function bar() { \n"+ + "} \n"; String expectedSyntaxErrorDiagnosis = - "----------\n" + - "1. ERROR in <test6> (at line 4)\n" + - " if(true){ \n" + - " ^\n" + - "Syntax error, insert \"}\" to complete Statement\n" + + "----------\n" + + "1. ERROR in <test6> (at line 7)\n" + + " } \n" + + " ^\n" + + "Syntax error, insert \"}\" to complete MethodBody\n" + "----------\n"; String testName = "<test6>"; @@ -255,22 +243,20 @@ public void test07() { String s = - "public class X { \n"+ - " int fX; \n"+ - " void foo() { \n"+ - " if(true){ \n"+ - " } \n"+ - " System.out.println(); \n"+ - " public void bar() { \n"+ - " } \n"+ - "} \n"; + "var fX; \n"+ + "function foo() { \n"+ + " if(true){ \n"+ + "} \n"+ + "System.out.println(); \n"+ + "function bar() { \n"+ + "} \n"; String expectedSyntaxErrorDiagnosis = - "----------\n" + - "1. ERROR in <test7> (at line 6)\n" + - " System.out.println(); \n" + - " ^\n" + - "Syntax error, insert \"}\" to complete MethodBody\n" + + "----------\n" + + "1. ERROR in <test7> (at line 7)\n" + + " } \n" + + " ^\n" + + "Syntax error, insert \"}\" to complete MethodBody\n" + "----------\n"; String testName = "<test7>"; @@ -282,20 +268,18 @@ public void test08() { String s = - "public class X { \n"+ - " int fX; \n"+ - " void foo() { \n"+ - " if(true){ \n"+ - " } \n"+ - " public int bar; \n"+ - "} \n"; + "var fX; \n"+ + "function foo() { \n"+ + " if(true){ \n"+ + "} \n"+ + "var bar; \n"; String expectedSyntaxErrorDiagnosis = "----------\n" + - "1. ERROR in <test8> (at line 4)\n" + - " if(true){ \n" + - " ^\n" + - "Syntax error, insert \"}\" to complete Statement\n" + + "1. ERROR in <test8> (at line 5)\n" + + " var bar; \n" + + " ^\n" + + "Syntax error, insert \"}\" to complete MethodBody\n" + "----------\n"; String testName = "<test8>"; @@ -307,21 +291,19 @@ public void test09() { String s = - "public class X { \n"+ - " int fX; \n"+ - " void foo() { \n"+ - " if(true){ \n"+ - " } \n"+ - " //comment \n"+ - " public int bar; \n"+ - "} \n"; + "var fX; \n"+ + "function foo() { \n"+ + " if(true){ \n"+ + "} \n"+ + "//comment \n"+ + "var bar; \n"; String expectedSyntaxErrorDiagnosis = "----------\n" + - "1. ERROR in <test9> (at line 4)\n" + - " if(true){ \n" + - " ^\n" + - "Syntax error, insert \"}\" to complete Statement\n" + + "1. ERROR in <test9> (at line 6)\n" + + " var bar; \n" + + " ^\n" + + "Syntax error, insert \"}\" to complete MethodBody\n" + "----------\n"; String testName = "<test9>"; @@ -333,20 +315,18 @@ public void test10() { String s = - "public class X { \n"+ - " int fX; \n"+ - " void foo() { \n"+ - " if(true){ \n"+ - " } \n"+ - " System.out.println(); \n"+ - " public int bar; \n"+ - "} \n"; + "var fX; \n"+ + "function foo() { \n"+ + " if(true){ \n"+ + "} \n"+ + "System.out.println(); \n"+ + "var bar; \n"; String expectedSyntaxErrorDiagnosis = "----------\n" + "1. ERROR in <test10> (at line 6)\n" + - " System.out.println(); \n" + - " ^\n" + + " var bar; \n" + + " ^\n" + "Syntax error, insert \"}\" to complete MethodBody\n" + "----------\n";
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ExplicitConstructorInvocationCompletionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ExplicitConstructorInvocationCompletionTest.java deleted file mode 100644 index 174f94f..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ExplicitConstructorInvocationCompletionTest.java +++ /dev/null
@@ -1,385 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import junit.framework.Test; - -/** - * Completion is expected to be an ExplicitConstructorInvocation - * or inside an ExplicitConstructorInvocation - */ -public class ExplicitConstructorInvocationCompletionTest extends AbstractCompletionTest { -public ExplicitConstructorInvocationCompletionTest(String testName) { - super(testName); -} -public static Test suite() { - return buildAllCompliancesTestSuite(ExplicitConstructorInvocationCompletionTest.class); -} -/* - * Completion on a qualified 'super' constructor invocation. - * - * ie. ExplicitConstructorInvocation ::= Primary '.' 'super' '(' ArgumentListopt ')' ';' - */ -public void testPrimarySuper() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " static Bar x; \n" + - " public class InnerBar { \n" + - " InnerBar(Bar x) { \n" + - " } \n" + - " } \n" + - " public class SubInnerBar extends InnerBar { \n" + - " SubInnerBar(Bar x) { \n" + - " primary().super(1, 2, i); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "super(1, 2,", - // expectedCompletionNodeToString: - "<CompleteOnExplicitConstructorCall:primary().super(1, 2)>;", - // expectedUnitDisplayString: - "class Bar {\n" + - " public class InnerBar {\n" + - " InnerBar(Bar x) {\n" + - " }\n" + - " }\n" + - " public class SubInnerBar extends InnerBar {\n" + - " SubInnerBar(Bar x) {\n" + - " <CompleteOnExplicitConstructorCall:primary().super(1, 2)>;\n" + - " }\n" + - " }\n" + - " static Bar x;\n" + - " <clinit>() {\n" + - " }\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<complete on explicit constructor invocation primary super>" - ); -} -/* - * Completion on a qualified 'this' constructor invocation. - * - * ie. ExplicitConstructorInvocation ::= Primary '.' 'this' '(' ArgumentListopt ')' ';' - */ -public void testPrimaryThis() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " static Bar x; \n" + - " public class InnerBar { \n" + - " InnerBar(Bar x) { \n" + - " } \n" + - " } \n" + - " public class SubInnerBar extends InnerBar { \n" + - " SubInnerBar(Bar x) { \n" + - " primary().this(1, 2, i); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "this(1, 2,", - // expectedCompletionNodeToString: - "<CompleteOnExplicitConstructorCall:primary().this(1, 2)>;", - // expectedUnitDisplayString: - "class Bar {\n" + - " public class InnerBar {\n" + - " InnerBar(Bar x) {\n" + - " }\n" + - " }\n" + - " public class SubInnerBar extends InnerBar {\n" + - " SubInnerBar(Bar x) {\n" + - " <CompleteOnExplicitConstructorCall:primary().this(1, 2)>;\n" + - " }\n" + - " }\n" + - " static Bar x;\n" + - " <clinit>() {\n" + - " }\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<complete on explicit constructor invocation primary this>" - ); -} -/* - * Completion on a 'super' constructor invocation. - * - * ie. ExplicitConstructorInvocation ::= 'super' '(' ArgumentListopt ')' ';' - */ -public void testSuper() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " Bar() { \n" + - " super(1, 2, i); \n" + - " } \n" + - "} \n", - // completeBehind: - "super(1, 2,", - // expectedCompletionNodeToString: - "<CompleteOnExplicitConstructorCall:super(1, 2)>;", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " <CompleteOnExplicitConstructorCall:super(1, 2)>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<completion on 'super' constructor invocation>" - ); -} -/* - * Completion on a 'this' constructor invocation. - * - * ie. ExplicitConstructorInvocation ::= 'this' '(' ArgumentListopt ')' ';' - */ -public void testThis() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " Bar() { \n" + - " this(1, 2, i); \n" + - " } \n" + - "} \n", - // completeBehind: - "this(1, 2,", - // expectedCompletionNodeToString: - "<CompleteOnExplicitConstructorCall:this(1, 2)>;", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " <CompleteOnExplicitConstructorCall:this(1, 2)>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<completion on 'this' constructor invocation>" - ); -} -/* - * ExplicitConstructorInvocation ::= Name '.' 'super' '(' <ArgumentListopt> ')' ';' - */ -public void testWrapperNameSuper() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " static Bar x; \n" + - " public class InnerBar { \n" + - " InnerBar(Bar x) { \n" + - " } \n" + - " } \n" + - " public class SubInnerBar extends InnerBar { \n" + - " SubInnerBar() { \n" + - " Bar.super(fred().xyz); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "fred().x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " public class InnerBar {\n" + - " InnerBar(Bar x) {\n" + - " }\n" + - " }\n" + - " public class SubInnerBar extends InnerBar {\n" + - " SubInnerBar() {\n" + - " super(<CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + - " }\n" + - " static Bar x;\n" + - " <clinit>() {\n" + - " }\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on wrapper name super>" - ); -} -/* - * ExplicitConstructorInvocation ::= Name '.' 'this' '(' <ArgumentListopt> ')' ';' - */ -public void testWrapperNameThis() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " static Bar x; \n" + - " public class InnerBar { \n" + - " InnerBar(Bar x) { \n" + - " } \n" + - " } \n" + - " public class SubInnerBar extends InnerBar { \n" + - " SubInnerBar() { \n" + - " Bar.this(fred().xyz); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "fred().x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " public class InnerBar {\n" + - " InnerBar(Bar x) {\n" + - " }\n" + - " }\n" + - " public class SubInnerBar extends InnerBar {\n" + - " SubInnerBar() {\n" + - " this(<CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + - " }\n" + - " static Bar x;\n" + - " <clinit>() {\n" + - " }\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on wrapper name this>" - ); -} -/* - * ExplicitConstructorInvocation ::= Primary '.' 'this' '(' <ArgumentListopt> ')' ';' - */ -public void testWrapperPrimarySuper() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " static Bar x; \n" + - " public class InnerBar { \n" + - " InnerBar(Bar x) { \n" + - " } \n" + - " } \n" + - " public class SubInnerBar extends InnerBar { \n" + - " SubInnerBar(Bar x) { \n" + - " primary().super(fred().xyz); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "fred().x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " public class InnerBar {\n" + - " InnerBar(Bar x) {\n" + - " }\n" + - " }\n" + - " public class SubInnerBar extends InnerBar {\n" + - " SubInnerBar(Bar x) {\n" + - " super(<CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + - " }\n" + - " static Bar x;\n" + - " <clinit>() {\n" + - " }\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on wrapper primary super>" - ); -} -/* - * ExplicitConstructorInvocation ::= 'super' '(' <ArgumentListopt> ')' ';' - */ -public void testWrapperSuper() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " Bar() { \n" + - " super(fred().xyz); \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " super(<CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on wrapper super>" - ); -} -/* - * ExplicitConstructorInvocation ::= 'this' '(' <ArgumentListopt> ')' ';' - */ -public void testWrapperThis() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " Bar() { \n" + - " this(fred().xyz); \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " this(<CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on wrapper this>" - ); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ExplicitConstructorInvocationSelectionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ExplicitConstructorInvocationSelectionTest.java deleted file mode 100644 index 541b7f2..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ExplicitConstructorInvocationSelectionTest.java +++ /dev/null
@@ -1,229 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -/** - * Selection is expected to be wrapped with an explicit constructor invocation. - */ -public class ExplicitConstructorInvocationSelectionTest extends AbstractSelectionTest { -public ExplicitConstructorInvocationSelectionTest(String testName) { - super(testName); -} -/* - * ExplicitConstructorInvocation ::= Name '.' 'super' '(' <ArgumentListopt> ')' ';' - */ -public void testNameSuper() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " static Bar x; \n" + - " public class InnerBar { \n" + - " InnerBar(Bar x) { \n" + - " } \n" + - " } \n" + - " public class SubInnerBar extends InnerBar { \n" + - " SubInnerBar() { \n" + - " Bar.super(fred()); \n" + - " } \n" + - " } \n" + - "} \n", - // selectionStartBehind: - "Bar.super(", - // selectionEndBehind: - "fred", - // expectedSelectionNodeToString: - "<SelectOnMessageSend:fred()>", - // expectedUnitDisplayString: - "class Bar {\n" + - " public class InnerBar {\n" + - " InnerBar(Bar x) {\n" + - " }\n" + - " }\n" + - " public class SubInnerBar extends InnerBar {\n" + - " SubInnerBar() {\n" + - " super(<SelectOnMessageSend:fred()>);\n" + - " }\n" + - " }\n" + - " static Bar x;\n" + - " <clinit>() {\n" + - " }\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedSelectionIdentifier: - "fred", - // expectedReplacedSource: - "fred()", - // testName: - "<select on explicit constructor invocation name super>" - ); -} -/* - * ExplicitConstructorInvocation ::= Name '.' 'this' '(' <ArgumentListopt> ')' ';' - */ -public void testNameThis() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " static Bar x; \n" + - " public class InnerBar { \n" + - " InnerBar(Bar x) { \n" + - " } \n" + - " } \n" + - " public class SubInnerBar extends InnerBar { \n" + - " SubInnerBar() { \n" + - " Bar.this(fred()); \n" + - " } \n" + - " } \n" + - "} \n", - // selectionStartBehind: - "Bar.this(", - // selectionEndBehind: - "fred", - // expectedSelectionNodeToString: - "<SelectOnMessageSend:fred()>", - // expectedUnitDisplayString: - "class Bar {\n" + - " public class InnerBar {\n" + - " InnerBar(Bar x) {\n" + - " }\n" + - " }\n" + - " public class SubInnerBar extends InnerBar {\n" + - " SubInnerBar() {\n" + - " this(<SelectOnMessageSend:fred()>);\n" + - " }\n" + - " }\n" + - " static Bar x;\n" + - " <clinit>() {\n" + - " }\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedSelectionIdentifier: - "fred", - // expectedReplacedSource: - "fred()", - // testName: - "<select on explicit constructor invocation name this>" - ); -} -/* - * ExplicitConstructorInvocation ::= Primary '.' 'this' '(' <ArgumentListopt> ')' ';' - */ -public void testPrimarySuper() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " static Bar x; \n" + - " public class InnerBar { \n" + - " InnerBar(Bar x) { \n" + - " } \n" + - " } \n" + - " public class SubInnerBar extends InnerBar { \n" + - " SubInnerBar(Bar x) { \n" + - " primary().super(fred()); \n" + - " } \n" + - " } \n" + - "} \n", - // selectionStartBehind: - "super(", - // selectionEndBehind: - "fred", - // expectedSelectionNodeToString: - "<SelectOnMessageSend:fred()>", - // expectedUnitDisplayString: - "class Bar {\n" + - " public class InnerBar {\n" + - " InnerBar(Bar x) {\n" + - " }\n" + - " }\n" + - " public class SubInnerBar extends InnerBar {\n" + - " SubInnerBar(Bar x) {\n" + - " super(<SelectOnMessageSend:fred()>);\n" + - " }\n" + - " }\n" + - " static Bar x;\n" + - " <clinit>() {\n" + - " }\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedSelectionIdentifier: - "fred", - // expectedReplacedSource: - "fred()", - // testName: - "<select on explicit constructor invocation primary super>" - ); -} -/* - * ExplicitConstructorInvocation ::= 'super' '(' <ArgumentListopt> ')' ';' - */ -public void testSuper() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " Bar() { \n" + - " super(fred()); \n" + - " } \n" + - "} \n", - // selectionStartBehind: - "super(", - // selectionEndBehind: - "fred", - // expectedSelectionNodeToString: - "<SelectOnMessageSend:fred()>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " super(<SelectOnMessageSend:fred()>);\n" + - " }\n" + - "}\n", - // expectedSelectionIdentifier: - "fred", - // expectedReplacedSource: - "fred()", - // testName: - "<select on explicit constructor invocation super>" - ); -} -/* - * ExplicitConstructorInvocation ::= 'this' '(' <ArgumentListopt> ')' ';' - */ -public void testThis() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " Bar() { \n" + - " this(fred()); \n" + - " } \n" + - "} \n", - // selectionStartBehind: - "this(", - // selectionEndBehind: - "fred", - // expectedSelectionNodeToString: - "<SelectOnMessageSend:fred()>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " this(<SelectOnMessageSend:fred()>);\n" + - " }\n" + - "}\n", - // expectedSelectionIdentifier: - "fred", - // expectedReplacedSource: - "fred()", - // testName: - "<select on explicit constructor invocation this>" - ); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/FieldAccessCompletionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/FieldAccessCompletionTest.java index f02fb25..a1e8c1e 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/FieldAccessCompletionTest.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/FieldAccessCompletionTest.java
@@ -19,31 +19,22 @@ public FieldAccessCompletionTest(String testName) { super(testName); } -public static Test suite() { - return buildAllCompliancesTestSuite(FieldAccessCompletionTest.class); -} /* * AdditiveExpression ::= AdditiveExpression '-' <MultiplicativeExpression> */ public void testAdditiveExpressionMinus() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " int foo() { \n" + - " return 1 - fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return 1 - fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " int foo() {\n" + - " (1 - <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (1 - <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -59,22 +50,16 @@ public void testAdditiveExpressionPlus() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " int foo() { \n" + - " return 1 + fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return 1 + fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " int foo() {\n" + - " (1 + <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (1 + <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -90,22 +75,16 @@ public void testAndExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " boolean foo() { \n" + - " return isTrue & fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return isTrue & fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " boolean foo() {\n" + - " (isTrue & <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (isTrue & <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -121,22 +100,16 @@ public void testArgumentList() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " bizz(1, \"2\", fred().xyz); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " bizz(1, \"2\", fred().xyz); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " bizz(1, \"2\", <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " bizz(1, \"2\", <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -152,22 +125,16 @@ public void testArrayAccess() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " int foo() { \n" + - " return v[fred().xyz]; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return v[fred().xyz]; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " int foo() {\n" + - " v[<CompleteOnMemberAccess:fred().x>];\n" + - " }\n" + + "function foo() {\n" + + " return v[<CompleteOnMemberAccess:fred().x>];\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -178,58 +145,21 @@ ); } /* - * ArrayAccess ::= PrimaryNoNewArray '[' <Expression> ']' - */ -public void testArrayAccessPrimaryNoNewArray() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " int foo() { \n" + - " return buzz()[fred().xyz]; \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " int foo() {\n" + - " buzz()[<CompleteOnMemberAccess:fred().x>];\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on array access primary no new array>" - ); -} -/* * ArrayInitializer ::= '{' <VariableInitializers> '}' */ public void testArrayInitializer() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int[] i = new int[] {fred().xyz} \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var i = [fred().xyz]; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int[] i = new int[]{<CompleteOnMemberAccess:fred().x>};\n" + - " }\n" + + "function foo() {\n" + + " var i = [<CompleteOnMemberAccess:fred().x>];\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -244,23 +174,17 @@ */ public void testArrayInitializerComma() { this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int[] i = new int[] {fred().xyz,} \n" + - " } \n" + - "} \n", - // completeBehind: + // compilationUnit: + "function foo() { \n" + + " var i = [fred().xyz]; \n" + + "} \n", + // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int[] i = new int[]{<CompleteOnMemberAccess:fred().x>};\n" + - " }\n" + + "function foo() {\n" + + " var i = [<CompleteOnMemberAccess:fred().x>];\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -276,22 +200,16 @@ public void testAssignment() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " i = fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " i = fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " i = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " i = <CompleteOnMemberAccess:fred().x>;\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -307,26 +225,23 @@ public void testBlock() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " try { \n" + - " fred().xyz = new Foo(); \n" + - " } catch (Exception e) {} \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " try { \n" + + " fred().xyz = new Foo(); \n" + + " } catch (e) {} \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + + "function foo() {\n" + + " try \n" + " {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + + " <CompleteOnMemberAccess:fred().x> = new Foo();\n" + " }\n" + - " }\n" + + " catch (e) {\n" + + " }\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -342,24 +257,18 @@ public void testBlockStatements() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0; \n" + - " fred().xyz = new Foo(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var i = 0; \n" + + " fred().xyz = new Foo(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " var i = 0;\n" + + " <CompleteOnMemberAccess:fred().x> = new Foo();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -370,37 +279,6 @@ ); } /* - * ConstructorBody ::= NestedMethod '{' ExplicitConstructorInvocation <BlockStatements> '}' - */ -public void testBlockStatementsInConstructorBody() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " Bar() { \n" + - " super(); \n" + - " fred().xyz = new Foo(); \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " super();\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on block statements in constructor body>" - ); -} -/* * BlockStatements ::= BlockStatements <BlockStatement> * * in a non static initializer. @@ -408,9 +286,9 @@ public void testBlockStatementsInInitializer() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + + "function Bar() { \n" + " { \n" + - " int i = 0; \n" + + " var i = 0; \n" + " fred().xyz = new Foo(); \n" + " } \n" + "} \n", @@ -419,12 +297,10 @@ // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + + "function Bar() {\n" + " {\n" + - " int i;\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - " Bar() {\n" + + " var i = 0;\n" + + " <CompleteOnMemberAccess:fred().x> = new Foo();\n" + " }\n" + "}\n", // expectedCompletionIdentifier: @@ -436,132 +312,21 @@ ); } /* - * BlockStatements ::= BlockStatements <BlockStatement> - * - * in a static initializer. - */ -public void testBlockStatementsInStaticInitializer() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " static { \n" + - " int i = 0; \n" + - " fred().xyz = new Foo(); \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " static {\n" + - " int i;\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - " <clinit>() {\n" + - " }\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on block statements in static initializer>" - ); -} -/* - * CastExpression ::= PushLPAREN <Expression> PushRPAREN UnaryExpressionNotPlusMinus - * - * NB: Valid syntaxically but not semantically - */ -public void testCastExpression() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " Bar foo() { \n" + - " return (fred().xyz)buzz(); \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " Bar foo() {\n" + - " return <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on cast expression>" - ); -} -/* - * CastExpression ::= PushLPAREN PrimitiveType Dimsopt PushRPAREN <UnaryExpression> - * or - * CastExpression ::= PushLPAREN Name Dims PushRPAREN <UnaryExpressionNotPlusMinus> - * or - * CastExpression ::= PushLPAREN Expression PushRPAREN <UnaryExpressionNotPlusMinus> - */ -public void testCastExpressionUnaryExpression() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " Bar foo() { \n" + - " return (Bar)(fred().xyz); \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " Bar foo() {\n" + - " (Bar) <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on cast expression unary expression>" - ); -} -/* * ClassInstanceCreationExpression ::= 'new' ClassType '(' <ArgumentListopt> ')' ClassBodyopt */ public void testClassInstanceCreationExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " new Bar(fred().xyz); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " new Bar(fred().xyz); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " new Bar(<CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " new Bar(<CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -572,89 +337,21 @@ ); } /* - * ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt - */ -public void testClassInstanceCreationExpressionName() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " Bar.new Bar(fred().xyz); \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " Bar.new Bar(<CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on class instance creation expression name>" - ); -} -/* - * ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' <ArgumentListopt> ')' ClassBodyopt - */ -public void testClassInstanceCreationExpressionPrimary() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " bizz().new Bar(fred().xyz); \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " bizz().new Bar(<CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on class instance creation expression primary>" - ); -} -/* * ConditionalAndExpression ::= ConditionalAndExpression '&&' <InclusiveOrExpression> */ public void testConditionalAndExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " boolean foo() { \n" + - " return isTrue && fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return isTrue && fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " boolean foo() {\n" + - " (isTrue && <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (isTrue && <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -670,22 +367,16 @@ public void testConditionalExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " Bar foo() { \n" + - " return fred().xyz == null ? null : new Bar(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return fred().xyz == null ? null : new Bar(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " Bar foo() {\n" + - " return <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " return ((<CompleteOnMemberAccess:fred().x> == null) ? null : new Bar());\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -701,22 +392,16 @@ public void testConditionalExpressionConditionalExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " boolean foo() { \n" + - " return isTrue ? true : fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return isTrue ? true : fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " boolean foo() {\n" + - " (isTrue ? true : <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (isTrue ? true : <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -732,22 +417,16 @@ public void testConditionalOrExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " boolean foo() { \n" + - " return isTrue || fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return isTrue || fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " boolean foo() {\n" + - " (isTrue || <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (isTrue || <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -758,90 +437,25 @@ ); } /* - * ConstructorBody ::= NestedMethod '{' <BlockStatementsopt> '}' - */ -public void testConstructorBody() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " Bar() { \n" + - " fred().xyz = new Foo(); \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " super();\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on constructor body>" - ); -} -/* - * DimWithOrWithOutExpr ::= '[' <Expression> ']' - */ -public void testDimWithOrWithOutExpr() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int[] v = new int[fred().xyz]; \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int[] v = new int[<CompleteOnMemberAccess:fred().x>];\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on dim with or without expr>" - ); -} -/* * DoStatement ::= 'do' Statement 'while' '(' <Expression> ')' ';' */ public void testDoExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " do \n" + - " System.out.println(); \n" + - " while (fred().xyz); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " do \n" + + " System.out.println(); \n" + + " while (fred().xyz); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " do\n" + + " System.out.println();\n" + + "while (<CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -857,24 +471,20 @@ public void testDoStatement() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " do \n" + - " fred().xyz = new Foo(); \n" + - " while (true); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " do \n" + + " fred().xyz = new Foo(); \n" + + " while (true); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " do\n" + + " <CompleteOnMemberAccess:fred().x> = new Foo();\n" + + "while (true);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -890,22 +500,16 @@ public void testEqualityExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " boolean foo() { \n" + - " return 1 == fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return 1 == fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " boolean foo() {\n" + - " (1 == <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (1 == <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -921,22 +525,16 @@ public void testEqualityExpressionNot() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " boolean foo() { \n" + - " return 1 != fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return 1 != fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " boolean foo() {\n" + - " (1 != <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (1 != <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -952,22 +550,16 @@ public void testExclusiveOrExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " boolean foo() { \n" + - " return isTrue ^ fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return isTrue ^ fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " boolean foo() {\n" + - " (isTrue ^ <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (isTrue ^ <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -978,54 +570,6 @@ ); } /* - * ConstructorBody ::= NestedMethod '{' <ExplicitConstructorInvocation> '}' - * or - * ConstructorBody ::= NestedMethod '{' <ExplicitConstructorInvocation> BlockStatements '}' - */ -public void testExplicitConstructorInvocationInConstructorBody() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " static Bar x; \n" + - " public class InnerBar { \n" + - " } \n" + - " public class SubInnerBar extends InnerBar { \n" + - " SubInnerBar() { \n" + - " Bar.x.x.super(); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "Bar.x.x", - // expectedCompletionNodeToString: - "<CompleteOnName:Bar.x.x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " public class InnerBar {\n" + - " public InnerBar() {\n" + - " }\n" + - " }\n" + - " public class SubInnerBar extends InnerBar {\n" + - " SubInnerBar() {\n" + - " super();\n" + - " <CompleteOnName:Bar.x.x>;\n" + - " }\n" + - " }\n" + - " static Bar x;\n" + - " <clinit>() {\n" + - " }\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "Bar.x.x", - // test name - "<complete on explicit constructor invocation in constructor body>" - ); -} -/* * ForStatement ::= 'for' '(' <ForInitopt> ';' Expressionopt ';' ForUpdateopt ')' Statement * or * ForStatementNoShortIf ::= 'for' '(' <ForInitopt> ';' Expressionopt ';' ForUpdateopt ')' StatementNoShortIf @@ -1033,23 +577,18 @@ public void testForInit() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " for (int i = fred().xyz; i < 2; i++) \n" + - " System.out.println(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " for (var i = fred().xyz; i < 2; i++) \n" + + " System.out.println(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " for (var i = <CompleteOnMemberAccess:fred().x>;; (i < 2); i ++) \n" + + " System.out.println();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1067,24 +606,18 @@ public void testForStatement() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " for (int i = 0; i < 2; i++) \n" + - " fred().xyz = new Foo(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " for (var i = 0; i < 2; i++) \n" + + " fred().xyz = new Foo(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " for (var i = 0;; (i < 2); i ++) \n" + + " <CompleteOnMemberAccess:fred().x> = new Foo();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1102,24 +635,18 @@ public void testForStatementExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " for (int i = 0; fred().xyz > i; i++) \n" + - " Systemout.println(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " for(var i = 0; fred().xyz > i; i++) \n" + + " System.out.println(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " for (var i = 0;; (<CompleteOnMemberAccess:fred().x> > i); i ++) \n" + + " System.out.println();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1137,24 +664,18 @@ public void testForUpdate() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " for (int i = 0; i < 2; i+= fred().xyz) \n" + - " System.out.println(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " for (var i = 0; i < 2; i+= fred().xyz) \n" + + " System.out.println(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " i += <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " for (var i = 0;; (i < 2); i += <CompleteOnMemberAccess:fred().x>) \n" + + " System.out.println();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1170,23 +691,18 @@ public void testIfExpresionThen() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " if (fred().xyz) \n" + - " System.out.println(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " if (fred().xyz) \n" + + " System.out.println(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " if (<CompleteOnMemberAccess:fred().x>)\n" + + " System.out.println();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1204,25 +720,22 @@ public void testIfExpresionThenElse() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " if (fred().xyz) \n" + - " System.out.println(); \n" + - " else \n" + - " System.out.println(); \n" + - " } \n" + + "function foo() { \n" + + " if (fred().xyz) \n" + + " System.out.println(); \n" + + " else \n" + + " System.out.println(); \n" + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " if (<CompleteOnMemberAccess:fred().x>)\n" + + " System.out.println();\n" + + " else\n" + + " System.out.println();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1240,25 +753,22 @@ public void testIfThenElseStatement() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " if (false) \n" + - " System.out.println(); \n" + - " else \n" + - " fred().xyz = new Foo(); \n" + - " } \n" + + "function foo() { \n" + + " if (false) \n" + + " System.out.println(); \n" + + " else \n" + + " fred().xyz = new Foo(); \n" + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " if (false)\n" + + " System.out.println();\n" + + " else\n" + + " <CompleteOnMemberAccess:fred().x> = new Foo();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1274,23 +784,18 @@ public void testIfThenStatement() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " if (true) \n" + - " fred().xyz = new Foo(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " if (true) \n" + + " fred().xyz = new Foo(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " if (true)\n" + + " <CompleteOnMemberAccess:fred().x> = new Foo();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1308,25 +813,22 @@ public void testIfThenStatementElse() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " if (true) \n" + - " fred().xyz = new Foo(); \n" + - " else \n" + - " System.out.println(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " if (true) \n" + + " fred().xyz = new Foo(); \n" + + " else \n" + + " System.out.println(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " if (true)\n" + + " <CompleteOnMemberAccess:fred().x> = new Foo();\n" + + " else\n" + + " System.out.println();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1342,22 +844,16 @@ public void testInclusiveOrExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " boolean foo() { \n" + - " return isTrue | fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return isTrue | fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " boolean foo() {\n" + - " (isTrue | <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (isTrue | <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1375,22 +871,16 @@ public void testLabeledStatement() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " fredCall: fred().xyz = new Foo(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " fredCall: fred().xyz = new Foo(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " fredCall: <CompleteOnMemberAccess:fred().x> = new Foo();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1408,22 +898,16 @@ public void testMethodBody() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " fred().xyz = new Foo(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " fred().xyz = new Foo(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMemberAccess:fred().x> = new Foo();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1439,22 +923,16 @@ public void testMethodInvocation() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " bizz(fred().xyz); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " bizz(fred().xyz); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " bizz(<CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " bizz(<CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1470,22 +948,16 @@ public void testMethodInvocationPrimary() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " buzz().bizz(fred().xyz); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " buzz().bizz(fred().xyz); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " buzz().bizz(<CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " buzz().bizz(<CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1496,58 +968,21 @@ ); } /* - * FunctionInvocation ::= 'super' '.' 'Identifier' '(' <ArgumentListopt> ')' + * MultiplicativeExpression ::= MultiplicativeExpression '/' <UnaryExpression> */ -public void testMethodInvocationSuper() { +public void testMultiplicativeExpressiondDivision() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " super.bizz(fred().xyz); \n" + - " } \n" + + "function foo() { \n" + + " return 2 / fred().xyz; \n" + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " super.bizz(<CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on method invocation super>" - ); -} -/* - * MultiplicativeExpression ::= MultiplicativeExpression '/' <UnaryExpression> - */ -public void testMultiplicativeExpressiondDivision() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " double foo() { \n" + - " return 2 / fred().xyz; \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " double foo() {\n" + - " (2 / <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (2 / <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1563,22 +998,16 @@ public void testMultiplicativeExpressionMultiplication() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " int foo() { \n" + - " return 2 * fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return 2 * fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " int foo() {\n" + - " (2 * <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (2 * <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1594,22 +1023,16 @@ public void testMultiplicativeExpressionRemainder() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " int foo() { \n" + - " return 2 % fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return 2 % fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " int foo() {\n" + - " (2 % <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (2 % <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1625,22 +1048,16 @@ public void testPreIncrementExpressionMinusMinus() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " -- fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " -- fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " -- <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " -- <CompleteOnMemberAccess:fred().x>;\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1656,22 +1073,16 @@ public void testPreIncrementExpressionPlusPlus() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " ++ fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " ++ fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " ++ <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " ++ <CompleteOnMemberAccess:fred().x>;\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1687,27 +1098,21 @@ public void testPrimaryNoNewArray() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " (fred().xyz).zzz(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " (fred().xyz).zzz(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMemberAccess:fred().x>.zzz();\n" + "}\n", // expectedCompletionIdentifier: "x", // expectedReplacedSource: - "xyz", + "(fred().xyz)", // test name "<complete on primary no new array>" ); @@ -1718,22 +1123,16 @@ public void testRelationalExpressionGreaterThan() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " boolean foo() { \n" + - " return 1 > fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return 1 > fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " boolean foo() {\n" + - " (1 > <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (1 > <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1749,22 +1148,16 @@ public void testRelationalExpressionGreaterThanOrEquals() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " boolean foo() { \n" + - " return 1 >= fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return 1 >= fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " boolean foo() {\n" + - " (1 >= <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (1 >= <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1780,22 +1173,16 @@ public void testRelationalExpressionLessThan() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " boolean foo() { \n" + - " return 1 < fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return 1 < fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " boolean foo() {\n" + - " (1 < <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (1 < <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1811,22 +1198,16 @@ public void testRelationalExpressionLessThanOrEqual() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " boolean foo() { \n" + - " return 1 <= fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return 1 <= fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " boolean foo() {\n" + - " (1 <= <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (1 <= <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1842,22 +1223,16 @@ public void testReturnStatement() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " int foo() { \n" + - " return fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " int foo() {\n" + - " return <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " return <CompleteOnMemberAccess:fred().x>;\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1873,22 +1248,16 @@ public void testShiftExpressionLeft() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " int foo() { \n" + - " return i << fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return i << fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " int foo() {\n" + - " (i << <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (i << <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1904,22 +1273,16 @@ public void testShiftExpressionRight() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " int foo() { \n" + - " return i >> fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return i >> fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " int foo() {\n" + - " (i >> <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (i >> <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1935,22 +1298,16 @@ public void testShiftExpressionRightUnSigned() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " int foo() { \n" + - " return i >>> fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return i >>> fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " int foo() {\n" + - " (i >>> <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " return (i >>> <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1966,24 +1323,18 @@ public void testStatementExpressionList() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " for (int i = 0, length = fred().xyz; i < 2; i++) \n" + - " System.out.println(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " for (var i = 0, length = fred().xyz; i < 2; i++) \n" + + " System.out.println(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " int length = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " for (var i = 0;, var length = <CompleteOnMemberAccess:fred().x>;; (i < 2); i ++) \n" + + " System.out.println();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -1999,28 +1350,23 @@ public void testSwitchBlockStatement() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0; \n" + - " switch (i) { \n" + - " case 0: fred().xyz = new Foo(); \n" + - " } \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var i = 0; \n" + + " switch (i) { \n" + + " case 0: fred().xyz = new Foo(); \n" + + " } \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - " }\n" + + "function foo() {\n" + + " var i = 0;\n" + + " switch (i) {\n" + + " case 0 : ;\n" + + " <CompleteOnMemberAccess:fred().x> = new Foo();\n" + + " }\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -2036,24 +1382,21 @@ public void testSwitchExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " switch (fred().xyz) { \n" + - " case 0: System.out.println(); \n" + - " } \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " switch (fred().xyz) { \n" + + " case 0: System.out.println(); \n" + + " } \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " switch (<CompleteOnMemberAccess:fred().x>) {\n" + + " case 0 : ;\n" + + " System.out.println();\n" + + " }\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -2069,29 +1412,22 @@ public void testSwitchLabel() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0; \n" + - " switch (i) { \n" + - " case fred().xyz: System.out.println(); \n" + - " } \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var i = 0; \n" + + " switch (i) { \n" + + " case fred().xyz: System.out.println(); \n" + + " } \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " {\n" + - " switch (i) {\n" + - " case <CompleteOnMemberAccess:fred().x> : ;\n" + - " }\n" + - " }\n" + + "function foo() {\n" + + " var i = 0;\n" + + " switch (i) {\n" + + " case <CompleteOnMemberAccess:fred().x> : ;\n" + + " System.out.println();\n" + " }\n" + "}\n", // expectedCompletionIdentifier: @@ -2103,60 +1439,21 @@ ); } /* - * SynchronizedStatement ::= OnlySynchronized '(' <Expression> ')' Block - */ -public void testSynchronizedStatement() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " synchronized (fred().xyz) { \n" + - " System.out.println(); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete on synchronized expression>" - ); -} -/* * ThrowStatement ::= 'throw' <Expression> ';' */ public void testThrowExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " throw fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " throw fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " throw <CompleteOnMemberAccess:fred().x>;\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -2172,22 +1469,16 @@ public void testUnaryExpressionBitwiseComplement() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " i = ~ fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " i = ~ fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " (~ <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " i = (~ <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -2203,22 +1494,16 @@ public void testUnaryExpressionLogicalComplement() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " i = ! fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " i = ! fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " (! <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " i = (! <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -2234,22 +1519,16 @@ public void testUnaryExpressionMinus() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " i = - fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " i = - fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " (- <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " i = (- <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -2265,22 +1544,16 @@ public void testUnaryExpressionPlus() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " i = + fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " i = + fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " (+ <CompleteOnMemberAccess:fred().x>);\n" + - " }\n" + + "function foo() {\n" + + " i = (+ <CompleteOnMemberAccess:fred().x>);\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -2296,22 +1569,16 @@ public void testVariableDeclarator() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var i = fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " var i = <CompleteOnMemberAccess:fred().x>;\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -2327,23 +1594,16 @@ public void testVariableInitializers() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0, j = fred().xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var i = 0, j = fred().xyz; \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " int j = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " var i = 0, j = <CompleteOnMemberAccess:fred().x>;\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -2361,23 +1621,18 @@ public void testWhileExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " while (fred().xyz) \n" + - " System.out.println(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " while (fred().xyz) \n" + + " System.out.println(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " while (<CompleteOnMemberAccess:fred().x>)" + + " System.out.println();\n" + "}\n", // expectedCompletionIdentifier: "x", @@ -2395,23 +1650,18 @@ public void testWhileStatement() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " while (true) \n" + - " fred().xyz = new Foo(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " while (true) \n" + + " fred().xyz = new Foo(); \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: "<CompleteOnMemberAccess:fred().x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + + "function foo() {\n" + + " while (true)" + + " <CompleteOnMemberAccess:fred().x> = new Foo();\n" + "}\n", // expectedCompletionIdentifier: "x",
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/InnerTypeCompletionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/InnerTypeCompletionTest.java deleted file mode 100644 index 6ff33c9..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/InnerTypeCompletionTest.java +++ /dev/null
@@ -1,456 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import junit.framework.Test; - -/** - * Completion is expected to be in an inner type - */ -public class InnerTypeCompletionTest extends AbstractCompletionTest { -public InnerTypeCompletionTest(String testName) { - super(testName); -} -public static Test suite() { - return buildAllCompliancesTestSuite(InnerTypeCompletionTest.class); -} -/* - * Test completion in the first method of an anonymous inner class - */ -public void testAnonymousFirstMethod() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " Object o = new Object() { \n" + - " void buzz() { \n" + - " int i = fred().xyz; \n" + - " } \n" + - " void fuzz() { \n" + - " } \n" + - " }; \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " new Object() {\n" + - " void buzz() {\n" + - " int i = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - " void fuzz() {\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete in anonymous inner class in first method>" - ); -} -/* - * Test completion in anonymous inner class with no statement defined before. - */ -public void testAnonymousNoStatementBefore() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " Object o = new Object() { \n" + - " void buzz() { \n" + - " int i = fred().xyz; \n" + - " } \n" + - " }; \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " new Object() {\n" + - " void buzz() {\n" + - " int i = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete in anonymous inner class with no statement before>" - ); -} -/* - * Test completion in anonymous inner class with one field defined before - * the method containing the completion. - */ -public void testAnonymousOneFieldBefore() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " Object o = new Object() { \n" + - " int field = 1; \n" + - " void buzz() { \n" + - " int i = fred().xyz; \n" + - " } \n" + - " }; \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " new Object() {\n" + - " int field;\n" + - " void buzz() {\n" + - " int i = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete in anonymous inner class with one field before>" - ); -} -/* - * Test completion in anonymous inner class with one statement defined before. - */ -public void testAnonymousOneStatementBefore() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 1; \n" + - " Object o = new Object() { \n" + - " void buzz() { \n" + - " int i = fred().xyz; \n" + - " } \n" + - " }; \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " Object o;\n" + - " new Object() {\n" + - " void buzz() {\n" + - " int i = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete in anonymous inner class with one statement before>" - ); -} -/* - * Test completion in the second method of an anonymous inner class - */ -public void testAnonymousSecondMethod() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " Object o = new Object() { \n" + - " void fuzz() { \n" + - " } \n" + - " void buzz() { \n" + - " int i = fred().xyz; \n" + - " } \n" + - " }; \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " Object o;\n" + - " new Object() {\n" + - " void fuzz() {\n" + - " }\n" + - " void buzz() {\n" + - " int i = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete in anonymous inner class in second method>" - ); -} -/* - * Test completion in the first method of a local type declaration - */ -public void testLocalTypeFirstMethod() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " class InnerBar { \n" + - " void buzz() { \n" + - " int i = fred().xyz; \n" + - " } \n" + - " void fuzz() { \n" + - " } \n" + - " }; \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " class InnerBar {\n" + - " InnerBar() {\n" + - " }\n" + - " void buzz() {\n" + - " int i = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - " void fuzz() {\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete in local type declaration in first method>" - ); -} -/* - * Test completion in local type declaration with no statement defined before. - */ -public void testLocalTypeNoStatementBefore() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " class InnerBar { \n" + - " void buzz() { \n" + - " int i = fred().xyz; \n" + - " } \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " class InnerBar {\n" + - " InnerBar() {\n" + - " }\n" + - " void buzz() {\n" + - " int i = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete in local type declaration with no statement before>" - ); -} -/* - * Test completion in local type declaration with one field defined before - * the method containing the completion. - */ -public void testLocalTypeOneFieldBefore() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " class InnerBar { \n" + - " int field = 1; \n" + - " void buzz() { \n" + - " int i = fred().xyz; \n" + - " } \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " class InnerBar {\n" + - " int field;\n" + - " InnerBar() {\n" + - " }\n" + - " void buzz() {\n" + - " int i = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete in local type declaration with one field before>" - ); -} -/* - * Test completion in local type declaration with one statement defined before. - */ -public void testLocalTypeOneStatementBefore() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 1; \n" + - " class InnerBar { \n" + - " void buzz() { \n" + - " int i = fred().xyz; \n" + - " } \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " class InnerBar {\n" + - " InnerBar() {\n" + - " }\n" + - " void buzz() {\n" + - " int i = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete in local type declaration with 1 statement before>" - ); -} -/* - * Test completion in the second method of a local type declaration - */ -public void testLocalTypeSecondMethod() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " class InnerBar { \n" + - " void fuzz() { \n" + - " } \n" + - " void buzz() { \n" + - " int i = fred().xyz; \n" + - " } \n" + - " }; \n" + - " } \n" + - "} \n", - // completeBehind: - "x", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:fred().x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " class InnerBar {\n" + - " InnerBar() {\n" + - " }\n" + - " void fuzz() {\n" + - " }\n" + - " void buzz() {\n" + - " int i = <CompleteOnMemberAccess:fred().x>;\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "xyz", - // test name - "<complete in local type declaration in second method>" - ); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/JavadocCompletionParserTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/JavadocCompletionParserTest.java index 809ee43..3f24ead 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/JavadocCompletionParserTest.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/JavadocCompletionParserTest.java
@@ -42,30 +42,11 @@ } CompletionJavadoc javadoc; - String sourceLevel; public JavadocCompletionParserTest(String testName) { super(testName); } -static { - // org.eclipse.wst.jsdt.internal.codeassist.CompletionEngine.DEBUG = true; -// TESTS_NUMBERS = new int[] { 8 }; -// TESTS_RANGE = new int[] { 20, -1 }; -} - -public static Test suite() { - return buildAllCompliancesTestSuite(JavadocCompletionParserTest.class); -} - -/* (non-Javadoc) - * @see org.eclipse.test.performance.PerformanceTestCase#setUp() - */ -protected void setUp() throws Exception { - super.setUp(); - this.sourceLevel = null; -} - protected void assertCompletionNodeResult(String source, String expected) { ASTNode completionNode = this.javadoc.getCompletionNode(); assertNotNull("Javadoc should have a completion node!!!", completionNode); @@ -85,14 +66,6 @@ actual ); } -protected Map getCompilerOptions() { - Map options = super.getCompilerOptions(); - if (this.sourceLevel == null) { - return options; - } - options.put(CompilerOptions.OPTION_Source, this.sourceLevel); - return options; -} protected void verifyCompletionInJavadoc(String source, String after) { CompilerOptions options = new CompilerOptions(getCompilerOptions()); CompletionParser parser = new CompletionParser(new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(), @@ -168,82 +141,73 @@ /** * @tests Test completions for javadoc tag names */ -public void test001() { - String source = "package javadoc;\n" + +public void Xtest001() { + String source = "/**\n" + " * Completion on empty tag name:\n" + " * @\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "@"); verifyAllTagsCompletion(); } public void test002() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * Completion on impossible tag name:\n" + " * @none\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "@none"); verifyCompletionOnJavadocTag("none".toCharArray(), null, false); } public void test003() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * Completion on one letter:\n" + " * @v\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "@v"); - char[][] allTags = this.complianceLevel.equals(COMPLIANCE_1_3) - ? new char[][] { TAG_VERSION } - : new char[][] { TAG_VERSION }; - verifyCompletionOnJavadocTag(new char[] { 'v' }, allTags, false); + verifyCompletionOnJavadocTag(new char[] { 'v' }, new char[][] { TAG_VERSION }, false); } public void test004() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * Completion with several letters:\n" + " * @deprec\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "@deprec"); verifyCompletionOnJavadocTag("deprec".toCharArray(), new char[][] { TAG_DEPRECATED }, false); } public void test005() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * Completion on full tag name:\n" + " * @link\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "@link"); - char[][] allTags = this.complianceLevel.equals(COMPLIANCE_1_3) - ? new char[][] { TAG_LINK } - : new char[][] { TAG_LINK }; - verifyCompletionOnJavadocTag("link".toCharArray(), allTags, false); + verifyCompletionOnJavadocTag("link".toCharArray(), new char[][] { TAG_LINK }, false); } -public void test006() { - String source = "package javadoc;\n" + +public void Xtest006() { + String source = "/**\n" + " * Completion on empty tag name @ but inside text\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "@"); - char[][] allTags = { - TAG_LINK - }; - verifyCompletionOnJavadocTag(null, allTags, false); + verifyCompletionOnJavadocTag(null, new char[][] { TAG_LINK }, false); } -public void test007() { - String source = "package javadoc;\n" + +public void Xtest007() { + String source = "/**\n" + " * Completion on :\n" + " * @\n" + @@ -252,22 +216,7 @@ " * + \"@ {@linkplain }\"\n" + " * + \"@ {@literal }\"\n" + " */\n" + - "public class Test {}\n"; - verifyCompletionInJavadoc(source, "@"); - verifyAllTagsCompletion(); -} -/** - * @bug [javadoc][assist] @linkplain no longer proposed when 1.4 compliance is used - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=123096" - */ -public void test008() { - this.sourceLevel = CompilerOptions.VERSION_1_3; - String source = "package javadoc;\n" + - "/**\n" + - " * Completion on empty tag name:\n" + - " * @\n" + - " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "@"); verifyAllTagsCompletion(); } @@ -278,11 +227,11 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=113506" */ public void test010() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * @see \n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "@see "); assertCompletionNodeResult(source, "<CompletionOnJavadocSingleTypeReference:\n" + @@ -292,11 +241,11 @@ } public void test011() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * {@link }\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "@link "); assertCompletionNodeResult(source, "<CompletionOnJavadocSingleTypeReference:\n" + @@ -304,8 +253,8 @@ ">" ); } -public void test012() { - String source = "package javadoc;\n" + +public void Xtest012() { + String source = "/**\n" + " * @see Str\n" + " */\n" + @@ -319,11 +268,11 @@ } public void test013() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * {@link Str}\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "Str"); assertCompletionNodeResult(source, "<CompletionOnJavadocSingleTypeReference:Str\n" + @@ -332,11 +281,11 @@ ); } public void test014() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * @see String Subclass of Obj\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "Obj"); assertCompletionNodeResult(source, "<CompletionOnJavadocSingleTypeReference:Obj\n" + @@ -346,11 +295,11 @@ } public void test015() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * {@link String Subclass of Obj}\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "Obj"); assertCompletionNodeResult(source, "<CompletionOnJavadocSingleTypeReference:Obj\n" + @@ -359,73 +308,30 @@ ); } -/** - * @test Bug 113469: CompletionOnJavadocTag token is not correct - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=113649" - */ -public void test020() { - String source = "package javadoc;\n" + - "/**\n" + - " * @see\n" + - " */\n" + - "public class Test {}\n"; - verifyCompletionInJavadoc(source, "@s"); - verifyCompletionOnJavadocTag("s".toCharArray(), new char[][] { TAG_SEE, TAG_SINCE/*, TAG_SERIAL, TAG_SERIAL_DATA, TAG_SERIAL_FIELD*/ }, false); - CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode(); - assertEquals("Invalid tag start position", 24, completionTag.tagSourceStart); - assertEquals("Invalid tag end position", 28, completionTag.tagSourceEnd+1); -} - public void test021() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * @see\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "@se"); verifyCompletionOnJavadocTag("se".toCharArray(), new char[][] { TAG_SEE/*, TAG_SERIAL, TAG_SERIAL_DATA, TAG_SERIAL_FIELD */}, false); CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode(); - assertEquals("Invalid tag start position", 24, completionTag.tagSourceStart); - assertEquals("Invalid tag end position", 28, completionTag.tagSourceEnd+1); + assertEquals("Invalid tag start position", 7, completionTag.tagSourceStart); + assertEquals("Invalid tag end position", 11, completionTag.tagSourceEnd+1); } public void test022() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * @see\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "@see"); verifyCompletionOnJavadocTag("see".toCharArray(), new char[][] { TAG_SEE }, false); CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode(); - assertEquals("Invalid tag start position", 24, completionTag.tagSourceStart); - assertEquals("Invalid tag end position", 28, completionTag.tagSourceEnd+1); -} - -public void test023() { - String source = "package javadoc;\n" + - "/**\n" + - " * @ebj-tag\n" + - " */\n" + - "public class Test {}\n"; - verifyCompletionInJavadoc(source, "ebj"); - verifyCompletionOnJavadocTag("ebj".toCharArray(), null, false); - CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode(); - assertEquals("Invalid tag start position", 24, completionTag.tagSourceStart); - assertEquals("Invalid tag end position", 32, completionTag.tagSourceEnd+1); -} - -public void test024() { - String source = "package javadoc;\n" + - "/**\n" + - " * @ebj-tag\n" + - " */\n" + - "public class Test {}\n"; - verifyCompletionInJavadoc(source, "tag"); - verifyCompletionOnJavadocTag("ebj-tag".toCharArray(), null, false); - CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode(); - assertEquals("Invalid tag start position", 24, completionTag.tagSourceStart); - assertEquals("Invalid tag end position", 32, completionTag.tagSourceEnd+1); + assertEquals("Invalid tag start position", 7, completionTag.tagSourceStart); + assertEquals("Invalid tag end position", 11, completionTag.tagSourceEnd+1); } /** @@ -433,11 +339,11 @@ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=114091" */ public void test025() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * {@</code>\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "{@"); char[][] allTags = { TAG_LINK @@ -451,18 +357,13 @@ } public void test026() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * {@li</code>\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "{@li"); - char[][] allTags = complianceLevel.equals(COMPLIANCE_1_3) - ? new char[][] { TAG_LINK } - : (complianceLevel.equals(COMPLIANCE_1_4) - ? new char[][] { TAG_LINK} - : new char[][] { TAG_LINK }); - verifyCompletionOnJavadocTag("li".toCharArray(), allTags, false); + verifyCompletionOnJavadocTag("li".toCharArray(), new char[][] { TAG_LINK}, false); CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode(); int start = source.indexOf("{@"); assertEquals("Invalid tag start position", start, completionTag.tagSourceStart); @@ -471,16 +372,13 @@ } public void test027() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * {@link</code>\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "{@link"); - char[][] allTags = complianceLevel.equals(COMPLIANCE_1_3) - ? new char[][] { TAG_LINK } - : new char[][] { TAG_LINK }; - verifyCompletionOnJavadocTag("link".toCharArray(), allTags, false); + verifyCompletionOnJavadocTag("link".toCharArray(), new char[][] { TAG_LINK }, false); CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode(); int start = source.indexOf("{@"); assertEquals("Invalid tag start position", start, completionTag.tagSourceStart); @@ -488,16 +386,13 @@ assertEquals("Invalid tag end position", end, completionTag.tagSourceEnd); } public void test028() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * {@|\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "{@"); - char[][] allTags = { - TAG_LINK - }; - verifyCompletionOnJavadocTag("".toCharArray(), allTags, false); + verifyCompletionOnJavadocTag("".toCharArray(), new char[][] { TAG_LINK }, false); CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode(); int start = source.indexOf("{@"); assertEquals("Invalid tag start position", start, completionTag.tagSourceStart); @@ -506,18 +401,13 @@ } public void test029() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * {@li/\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "{@li"); - char[][] allTags = complianceLevel.equals(COMPLIANCE_1_3) - ? new char[][] { TAG_LINK } - : (complianceLevel.equals(COMPLIANCE_1_4) - ? new char[][] { TAG_LINK } - : new char[][] { TAG_LINK }); - verifyCompletionOnJavadocTag("li".toCharArray(), allTags, false); + verifyCompletionOnJavadocTag("li".toCharArray(), new char[][] { TAG_LINK }, false); CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode(); int start = source.indexOf("{@"); assertEquals("Invalid tag start position", start, completionTag.tagSourceStart); @@ -526,16 +416,13 @@ } public void test030() { - String source = "package javadoc;\n" + + String source = "/**\n" + " * {@link+\n" + " */\n" + - "public class Test {}\n"; + "function Test() {}\n"; verifyCompletionInJavadoc(source, "{@link"); - char[][] allTags = complianceLevel.equals(COMPLIANCE_1_3) - ? new char[][] { TAG_LINK } - : new char[][] { TAG_LINK }; - verifyCompletionOnJavadocTag("link".toCharArray(), allTags, false); + verifyCompletionOnJavadocTag("link".toCharArray(), new char[][] { TAG_LINK }, false); CompletionOnJavadocTag completionTag = (CompletionOnJavadocTag) this.javadoc.getCompletionNode(); int start = source.indexOf("{@"); assertEquals("Invalid tag start position", start, completionTag.tagSourceStart);
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/LabelStatementCompletionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/LabelStatementCompletionTest.java deleted file mode 100644 index 5745f15..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/LabelStatementCompletionTest.java +++ /dev/null
@@ -1,492 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import junit.framework.Test; - -/** - * Completion is expected to be in a LabeledStatement. - */ -public class LabelStatementCompletionTest extends AbstractCompletionTest { -public LabelStatementCompletionTest(String testName) { - super(testName); -} -public static Test suite() { - return buildAllCompliancesTestSuite(LabelStatementCompletionTest.class); -} -/* - * Completion inside an inner class defined inside a labeled statement. - */ -public void test1FTEO9L() { - String cu = - "package p; \n" + - " \n" + - "class CCHelper { \n" + - " class Member1 { \n" + - " } \n" + - " class Member2 { \n" + - " } \n" + - " void foo() { \n" + - " } \n" + - "} \n" + - " \n" + - "public class CC { \n" + - " void foo() { \n" + - " new CCHelper() \n" + - " .new CCHelper() \n" + - " .new M \n" + - " } \n" + - "} \n"; - // first case - this.runTestCheckMethodParse( - // compilationUnit: - cu, - // completeBehind: - " .n", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:new CCHelper().n>", - // expectedUnitDisplayString: - "package p;\n" + - "class CCHelper {\n" + - " class Member1 {\n" + - " Member1() {\n" + - " }\n" + - " }\n" + - " class Member2 {\n" + - " Member2() {\n" + - " }\n" + - " }\n" + - " CCHelper() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n" + - "public class CC {\n" + - " public CC() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:new CCHelper().n>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "n", - // expectedReplacedSource: - "new", - // test name - "<regression test 1FTEO9L (first case)>" - ); - // second case - this.runTestCheckMethodParse( - // compilationUnit: - cu, - // completeBehind: - " .new CC", - // expectedCompletionNodeToString: - "<CompleteOnType:CC>", - // expectedUnitDisplayString: - "package p;\n" + - "class CCHelper {\n" + - " class Member1 {\n" + - " Member1() {\n" + - " }\n" + - " }\n" + - " class Member2 {\n" + - " Member2() {\n" + - " }\n" + - " }\n" + - " CCHelper() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n" + - "public class CC {\n" + - " public CC() {\n" + - " }\n" + - " void foo() {\n" + - " new CCHelper().new <CompleteOnType:CC>();\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "CC", - // expectedReplacedSource: - "CCHelper", - // test name - "<regression test 1FTEO9L (second case)>" - ); - // third case - this.runTestCheckMethodParse( - // compilationUnit: - cu, - // completeBehind: - " .new CCHelper() \n" + - " .n", - // expectedCompletionNodeToString: - "<CompleteOnMemberAccess:new CCHelper().new CCHelper().n>", - // expectedUnitDisplayString: - "package p;\n" + - "class CCHelper {\n" + - " class Member1 {\n" + - " Member1() {\n" + - " }\n" + - " }\n" + - " class Member2 {\n" + - " Member2() {\n" + - " }\n" + - " }\n" + - " CCHelper() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n" + - "public class CC {\n" + - " public CC() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMemberAccess:new CCHelper().new CCHelper().n>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "n", - // expectedReplacedSource: - "new", - // test name - "<regression test 1FTEO9L (third case)>" - ); - // fourth case - this.runTestCheckMethodParse( - // compilationUnit: - cu, - // completeBehind: - " .new CCHelper() \n" + - " .new M", - // expectedCompletionNodeToString: - "<CompleteOnType:M>", - // expectedUnitDisplayString: - "package p;\n" + - "class CCHelper {\n" + - " class Member1 {\n" + - " Member1() {\n" + - " }\n" + - " }\n" + - " class Member2 {\n" + - " Member2() {\n" + - " }\n" + - " }\n" + - " CCHelper() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n" + - "public class CC {\n" + - " public CC() {\n" + - " }\n" + - " void foo() {\n" + - " new CCHelper().new CCHelper().new <CompleteOnType:M>();\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "M", - // expectedReplacedSource: - "M", - // test name - "<regression test 1FTEO9L (fourth case)>" - ); -} -/* - * Completion inside a case that has an identifier as its constant expression. - */ -public void testInCaseWithIdentifier() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " label1: { \n" + - " switch (i) { \n" + - " case a: label2: X o = new Object(); \n" + - " } \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " {\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "X", - // expectedLabels: - new String[] {"label1", "label2"}, - // test name - "<complete in case with identifier>" - ); -} -/* - * Completion inside a case that has a number as its constant expression. - */ -public void testInCaseWithNumberConstant() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " label1: { \n" + - " switch (i) { \n" + - " case 1: label2: X o = new Object(); \n" + - " } \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " {\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "X", - // expectedLabels: - new String[] {"label1", "label2"}, - // test name - "<complete in case with number>" - ); -} -/* - * Completion inside an inner class defined inside a labeled statement. - */ -public void testInLabeledInnerClass() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " label1: { \n" + - " Object o = new Object() { \n" + - " void fred() { \n" + - " label2: { \n" + - " X o = new Object(); \n" + - " } \n" + - " } \n" + - " }; \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " Object o;\n" + - " new Object() {\n" + - " void fred() {\n" + - " {\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - " }\n" + - " };\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "X", - // expectedLabels: - new String[] {"label2"}, - // test name - "<complete in labeled inner class>" - ); -} -/* - * Completion inside an inner class defined inside a labeled statement with a syntax error - * just before the labeled statement. - */ -public void testInLabeledInnerClassWithErrorBefore() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i == 2; \n" + - " label1: { \n" + - " Object o = new Object() { \n" + - " void fred() { \n" + - " label2: { \n" + - " X o = new Object(); \n" + - " } \n" + - " } \n" + - " }; \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " {\n" + - " Object o;\n" + - " new Object() {\n" + - " void fred() {\n" + - " {\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - " }\n" + - " };\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "X", - // expectedLabels: - new String[] {"label2"}, - // test name - "<complete in labeled inner class with syntax error before>" - ); -} -/* - * Completion inside a labeled statement one level deep. - */ -public void testOneLevelDeep() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " label1: X o = new Object(); \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "X", - // expectedLabels: - new String[] {"label1"}, - // test name - "<complete in one level deep>" - ); -} -/* - * Completion inside a labeled statement which is the second one in the method. - */ -public void testSecondLabel() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " label1: buzz(); \n" + - " label2: X o = new Object(); \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "X", - // expectedLabels: - new String[] {"label2"}, - // test name - "<complete in second labeled statement>" - ); -} -/* - * Completion inside a labeled statement two level deep. - */ -public void testTwoLevelDeep() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " label1: { \n" + - " label2: X o = new Object(); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "X", - // expectedLabels: - new String[] {"label1", "label2"}, - // test name - "<complete in two level deep>" - ); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/MethodInvocationCompletionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/MethodInvocationCompletionTest.java index e96a683..e4ab891 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/MethodInvocationCompletionTest.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/MethodInvocationCompletionTest.java
@@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wst.jsdt.core.tests.compiler.parser; -import junit.framework.Test; - /** * Completion is expected to be a FunctionInvocation. */ @@ -19,33 +17,24 @@ public MethodInvocationCompletionTest(String testName) { super(testName); } -public static Test suite() { - return buildAllCompliancesTestSuite(MethodInvocationCompletionTest.class); -} /* * Completion with no receiver inside a for statement. */ public void test1FVVWS8_1() { this.runTestCheckMethodParse( // compilationUnit: - "class X { \n" + - " void foo() { \n" + - " for (int i = 10; i > 0; --i) \n" + - " fred( \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " for (var i = 10; i > 0; --i) \n" + + " fred( \n" + + "} \n", // completeBehind: "fred(", // expectedCompletionNodeToString: "<CompleteOnMessageSend:fred()>", // expectedUnitDisplayString: - "class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " <CompleteOnMessageSend:fred()>;\n" + - " }\n" + + "function foo() {\n" + + " var i;\n" + + " <CompleteOnMessageSend:fred()>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -61,23 +50,17 @@ public void test1FVVWS8_2() { this.runTestCheckMethodParse( // compilationUnit: - "class X { \n" + - " void foo() { \n" + - " if (true) \n" + - " fred( \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " if (true) \n" + + " fred( \n" + + "} \n", // completeBehind: "fred(", // expectedCompletionNodeToString: "<CompleteOnMessageSend:fred()>", // expectedUnitDisplayString: - "class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:fred()>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:fred()>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -94,26 +77,20 @@ public void test1FW2ZTB_1() { this.runTestCheckMethodParse( // compilationUnit: - "class X { \n" + - " int[] array; \n" + - " void foo() { \n" + - " for (int i = this.array.length; i > 0; --i) \n" + - " fred( \n" + - " } \n" + - "} \n", + "var array = []; \n" + + "function foo() { \n" + + " for (var i = this.array.length; i > 0; --i) \n" + + " fred( \n" + + "} \n", // completeBehind: "fred(", // expectedCompletionNodeToString: "<CompleteOnMessageSend:fred()>", // expectedUnitDisplayString: - "class X {\n" + - " int[] array;\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " <CompleteOnMessageSend:fred()>;\n" + - " }\n" + + "var array = [];\n" + + "void foo() {\n" + + " var i;\n" + + " <CompleteOnMessageSend:fred()>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -124,62 +101,22 @@ ); } /* - * Completion with no receiver inside another message send - * and after a field access in a previous argument. - */ -public void test1FW2ZTB_2() { - this.runTestCheckMethodParse( - // compilationUnit: - "class X { \n" + - " int[] array; \n" + - " void foo() { \n" + - " bar(this.array.length, 10, fred( \n" + - " } \n" + - "} \n", - // completeBehind: - "fred(", - // expectedCompletionNodeToString: - "<CompleteOnMessageSend:fred()>", - // expectedUnitDisplayString: - "class X {\n" + - " int[] array;\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:fred()>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "fred(", - // test name - "<1FW2ZTB_2" - ); -} -/* * Complete on method invocation with expression receiver * inside another invocation with no receiver. */ public void test1FW35YZ_1() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " bar(primary().fred( \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " bar(primary().fred( \n" + + "} \n", // completeBehind: "fred(", // expectedCompletionNodeToString: "<CompleteOnMessageSend:primary().fred()>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:primary().fred()>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:primary().fred()>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -190,59 +127,21 @@ ); } /* - * Complete on qualified allocation expression - * inside an invocation with no receiver. - */ -public void test1FW35YZ_2() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " bar(primary().new X( \n" + - " } \n" + - "} \n", - // completeBehind: - "X(", - // expectedCompletionNodeToString: - "<CompleteOnQualifiedAllocationExpression:primary().new X()>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnQualifiedAllocationExpression:primary().new X()>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<1FW35YZ_2>" - ); -} -/* * Completion with primary receiver. */ public void test1FWYBKF() { this.runTestCheckMethodParse( // compilationUnit: - "class X { \n" + - " void foo() { \n" + - " this.x.bar( \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " this.x.bar( \n" + + "} \n", // completeBehind: "bar(", // expectedCompletionNodeToString: "<CompleteOnMessageSend:this.x.bar()>", // expectedUnitDisplayString: - "class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:this.x.bar()>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:this.x.bar()>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -258,22 +157,16 @@ public void test1GAJBUQ() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " x.y.Z.fred(buzz()); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " x.y.Z.fred(buzz()); \n" + + "} \n", // completeBehind: "fred(buzz()", // expectedCompletionNodeToString: "<CompleteOnMessageSend:x.y.Z.fred(buzz())>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:x.y.Z.fred(buzz())>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:x.y.Z.fred(buzz())>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -284,60 +177,21 @@ ); } /* - * Completion just before the second parameter, the first parameter being an empty - * anonymous class. - */ -public void testAfterEmptyAnonymous() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " this.fred(new Runnable() {}, 2, i); \n" + - " } \n" + - "} \n", - // completeBehind: - "fred(new Runnable() {}, ", - // expectedCompletionNodeToString: - "<CompleteOnMessageSend:this.fred(new Runnable() {\n})>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:this.fred(new Runnable() {\n" + - "})>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "fred(new Runnable() {}, ", - // test name - "<completion just before second parameter, the first parameter being an empty anonymous class>" - ); -} -/* * Completion just after the first parameter. */ public void testAfterFirstParameter() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " this.fred(\"abc\" , 2, i); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " this.fred(\"abc\" , 2, i); \n" + + "} \n", // completeBehind: "fred(\"abc\" ", // expectedCompletionNodeToString: "<CompleteOnMessageSend:this.fred(\"abc\")>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:this.fred(\"abc\")>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:this.fred(\"abc\")>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -353,22 +207,16 @@ public void testBeforeFirstParameter() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " this.fred(1, 2, i); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " this.fred(1, 2, i); \n" + + "} \n", // completeBehind: "fred(", // expectedCompletionNodeToString: "<CompleteOnMessageSend:this.fred()>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:this.fred()>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:this.fred()>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -384,22 +232,16 @@ public void testBeforeLastParameter() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " this.fred(1, 2, i); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " this.fred(1, 2, i); \n" + + "} \n", // completeBehind: "fred(1, 2,", // expectedCompletionNodeToString: "<CompleteOnMessageSend:this.fred(1, 2)>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:this.fred(1, 2)>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:this.fred(1, 2)>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -415,22 +257,16 @@ public void testBeforeSecondParameter() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " this.fred(1, 2, i); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " this.fred(1, 2, i); \n" + + "} \n", // completeBehind: "fred(1, ", // expectedCompletionNodeToString: "<CompleteOnMessageSend:this.fred(1)>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:this.fred(1)>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:this.fred(1)>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -446,22 +282,16 @@ public void testEmptyInFirstParameter() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " this.fred(\"abc\" + , 2, i); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " this.fred(\"abc\" + , 2, i); \n" + + "} \n", // completeBehind: "fred(\"abc\" +", // expectedCompletionNodeToString: "<CompleteOnName:>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " (\"abc\" + <CompleteOnName:>);\n" + - " }\n" + + "function foo() {\n" + + " (\"abc\" + <CompleteOnName:>);\n" + "}\n", // expectedCompletionIdentifier: "", @@ -477,22 +307,16 @@ public void testInFirstParameter() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " this.fred(\"abc\" + bizz, 2, i); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " this.fred(\"abc\" + bizz, 2, i); \n" + + "} \n", // completeBehind: "fred(\"abc\" + bi", // expectedCompletionNodeToString: "<CompleteOnName:bi>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " (\"abc\" + <CompleteOnName:bi>);\n" + - " }\n" + + "function foo() {\n" + + " (\"abc\" + <CompleteOnName:bi>);\n" + "}\n", // expectedCompletionIdentifier: "bi", @@ -508,25 +332,19 @@ public void testInIfStatement() { this.runTestCheckMethodParse( // compilationUnit: - "class X { \n" + - " void foo() { \n" + - " if (true) { \n" + - " bar.fred(); \n" + - " } \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " if (true) { \n" + + " bar.fred(); \n" + + " } \n" + + "} \n", // completeBehind: "fred(", // expectedCompletionNodeToString: "<CompleteOnMessageSend:bar.fred()>", // expectedUnitDisplayString: - "class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " <CompleteOnMessageSend:bar.fred()>;\n" + - " }\n" + + "function foo() {\n" + + " {\n" + + " <CompleteOnMessageSend:bar.fred()>;\n" + " }\n" + "}\n", // expectedCompletionIdentifier: @@ -543,22 +361,16 @@ public void testLabeledWithExpressionReceiver() { this.runTestCheckMethodParse( // compilationUnit: - "class X { \n" + - " void foo() { \n" + - " label1: bar().fred(1, 2, o); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " label1: bar().fred(1, 2, o); \n" + + "} \n", // completeBehind: "fred(1, 2,", // expectedCompletionNodeToString: "<CompleteOnMessageSend:bar().fred(1, 2)>", // expectedUnitDisplayString: - "class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:bar().fred(1, 2)>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:bar().fred(1, 2)>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -576,22 +388,16 @@ public void testLabeledWithoutReceiver() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " label1: fred(1, 2, o); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " label1: fred(1, 2, o); \n" + + "} \n", // completeBehind: "fred(1, 2,", // expectedCompletionNodeToString: "<CompleteOnMessageSend:fred(1, 2)>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:fred(1, 2)>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:fred(1, 2)>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -609,22 +415,16 @@ public void testNoReceiver() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " fred(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " fred(); \n" + + "} \n", // completeBehind: "fred(", // expectedCompletionNodeToString: "<CompleteOnMessageSend:fred()>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:fred()>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:fred()>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -640,22 +440,16 @@ public void testSpaceThenFirstParameter() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " this.fred( 1, 2, i); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " this.fred( 1, 2, i); \n" + + "} \n", // completeBehind: "fred( ", // expectedCompletionNodeToString: "<CompleteOnMessageSend:this.fred()>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:this.fred()>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:this.fred()>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -666,58 +460,21 @@ ); } /* - * FunctionInvocation ::= 'super' '.' 'Identifier' '(' ArgumentListopt ')' - */ -public void testSuper() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " super.fred(1, 2, i); \n" + - " } \n" + - "} \n", - // completeBehind: - "fred(", - // expectedCompletionNodeToString: - "<CompleteOnMessageSend:super.fred()>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:super.fred()>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "fred(", - // test name - "<completion on super method invocation>" - ); -} -/* * Complete on method invocation with expression receiver. */ public void testWithExpressionReceiver() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " bar().fred(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " bar().fred(); \n" + + "} \n", // completeBehind: "fred(", // expectedCompletionNodeToString: "<CompleteOnMessageSend:bar().fred()>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:bar().fred()>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:bar().fred()>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -733,24 +490,18 @@ public void testWithNameReceiver() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " Vector v = new Vector(); \n" + - " v.addElement(\"1\"); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var v = new Vector(); \n" + + " v.addElement(\"1\"); \n" + + "} \n", // completeBehind: "addElement(", // expectedCompletionNodeToString: "<CompleteOnMessageSend:v.addElement()>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " Vector v;\n" + - " <CompleteOnMessageSend:v.addElement()>;\n" + - " }\n" + + "function foo() {\n" + + " var v = new Vector();\n" + + " <CompleteOnMessageSend:v.addElement()>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -766,23 +517,17 @@ public void testWithNameReceiverAfterConditionalExpression() { this.runTestCheckMethodParse( // compilationUnit: - "class X { \n" + - " void foo() { \n" + - " buzz.test(cond ? max : min); \n" + - " bar.fred(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " buzz.test(cond ? max : min); \n" + + " bar.fred(); \n" + + "} \n", // completeBehind: "fred(", // expectedCompletionNodeToString: "<CompleteOnMessageSend:bar.fred()>", // expectedUnitDisplayString: - "class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnMessageSend:bar.fred()>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMessageSend:bar.fred()>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -800,24 +545,18 @@ public void testWithNameReceiverAndTwoArgs() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " X x = new X(); \n" + - " x.fred(1, 2, o); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var x = new X(); \n" + + " x.fred(1, 2, o); \n" + + "} \n", // completeBehind: "x.fred(1, 2,", // expectedCompletionNodeToString: "<CompleteOnMessageSend:x.fred(1, 2)>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " X x;\n" + - " <CompleteOnMessageSend:x.fred(1, 2)>;\n" + - " }\n" + + "function foo() {\n" + + " var x = new X();\n" + + " <CompleteOnMessageSend:x.fred(1, 2)>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -833,24 +572,18 @@ public void testWithQualifiedNameReceiver() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " X x = new X(); \n" + - " y.x.fred(1, 2, o); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var x = new X(); \n" + + " y.x.fred(1, 2, o); \n" + + "} \n", // completeBehind: "x.fred(1, 2,", // expectedCompletionNodeToString: "<CompleteOnMessageSend:y.x.fred(1, 2)>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " X x;\n" + - " <CompleteOnMessageSend:y.x.fred(1, 2)>;\n" + - " }\n" + + "function foo() {\n" + + " var x = new X();\n" + + " <CompleteOnMessageSend:y.x.fred(1, 2)>;\n" + "}\n", // expectedCompletionIdentifier: "",
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/NameReferenceCompletionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/NameReferenceCompletionTest.java index ffb632c..268b998 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/NameReferenceCompletionTest.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/NameReferenceCompletionTest.java
@@ -19,9 +19,6 @@ public NameReferenceCompletionTest(String testName) { super(testName); } -public static Test suite() { - return buildAllCompliancesTestSuite(NameReferenceCompletionTest.class); -} /* * Regression test for 1FTZ849. * The instance creation before the completion is not properly closed, and thus @@ -30,29 +27,23 @@ public void test1FTZ849() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " X o = new X; \n" + - " fred.xyz; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var o = new X; \n" + + " fred.xyz; \n" + + "} \n", // completeBehind: "fred.x", // expectedCompletionNodeToString: - "<CompleteOnName:fred.x>", + "<CompleteOnMemberAccess:fred.x>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " X o;\n" + - " <CompleteOnName:fred.x>;\n" + - " }\n" + + "function foo() {\n" + + " var o = new X;\n" + + " <CompleteOnMemberAccess:fred.x>;\n" + "}\n", // expectedCompletionIdentifier: "x", // expectedReplacedSource: - "fred.xyz", + "xyz", // test name "<1FTZ849>" ); @@ -63,20 +54,15 @@ public void test1FUUP73() { this.runTestCheckDietParse( // compilationUnit: - "public class A { \n" + - " String s = \"hello\"; \n" + - " Object o = s.concat(\"boo\"); \n", + "var s = \"hello\"; \n" + + "var o = s.concat(\"boo\"); \n", // completeBehind: - "Object o = s", + "var o = s", // expectedCompletionNodeToString: "<CompleteOnName:s>", // expectedUnitDisplayString: - "public class A {\n" + - " String s;\n" + - " Object o = <CompleteOnName:s>;\n" + - " public A() {\n" + - " }\n" + - "}\n", + "var s = \"hello\";\n" + + "var o = <CompleteOnName:s>.concat(\"boo\");\n", // expectedCompletionIdentifier: "s", // expectedReplacedSource: @@ -86,246 +72,41 @@ ); this.runTestCheckDietParse( // compilationUnit: - "public class A { \n" + - " String s = \"hello\"; \n" + - " Object o = s.concat(\"boo\"); \n", + "var s = \"hello\"; \n" + + "var o = s.concat(\"boo\"); \n", // completeBehind: - "Object o = s.c", + "var o = s.c", // expectedCompletionNodeToString: - "<CompleteOnName:s.c>", + "<CompleteOnMessageSend:s.c(\"boo\")>", // expectedUnitDisplayString: - "public class A {\n" + - " String s;\n" + - " Object o = <CompleteOnName:s.c>;\n" + - " public A() {\n" + - " }\n" + - "}\n", + "var s = \"hello\";\n" + + "var o = <CompleteOnMessageSend:s.c(\"boo\")>;\n", // expectedCompletionIdentifier: "c", // expectedReplacedSource: - "s.concat", + "concat(\"boo\")", // test name "<1FUUP73>" ); } /* - * Regression test for 1FVRQQA. - */ -public void test1FVRQQA_1() { - this.runTestCheckMethodParse( - // compilationUnit: - "class X { \n" + - " void foo() { \n" + - " Enumeration e = null; \n" + - " e.to \n" + - " } \n" + - "} \n", - // completeBehind: - "e.to", - // expectedCompletionNodeToString: - "<CompleteOnName:e.to>", - // expectedUnitDisplayString: - "class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " Enumeration e;\n" + - " <CompleteOnName:e.to>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "to", - // expectedReplacedSource: - "e.to", - // test name - "<1FVRQQA_1>" - ); -} -/* - * Regression test for 1FVRQQA. - */ -public void test1FVRQQA_2() { - this.runTestCheckMethodParse( - // compilationUnit: - "class X { \n" + - " void foo() { \n" + - " for (Enumeration e = getSomeEnumeration(); e.has \n" + - " } \n" + - "} \n", - // completeBehind: - "e.has", - // expectedCompletionNodeToString: - "<CompleteOnName:e.has>", - // expectedUnitDisplayString: - "class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " Enumeration e;\n" + - " <CompleteOnName:e.has>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "has", - // expectedReplacedSource: - "e.has", - // test name - "<1FVRQQA_2>" - ); -} -/* - * Regression test for 1FVT66Q. - */ -public void test1FVT66Q_1() { - this.runTestCheckMethodParse( - // compilationUnit: - "package test; \n" + - " \n" + - "public class Test { \n" + - " public void foo() { \n" + - " final int codeAssistTarget= 3; \n" + - " \n" + - " Thread t= new Thread() { \n" + - " public void run() { \n" + - " codeAss \n" + - " } \n" + - " }; \n" + - " codeA \n" + - " } \n" + - "} \n", - // completeBehind: - " codeAss", - // expectedCompletionNodeToString: - "<CompleteOnName:codeAss>", - // expectedUnitDisplayString: - "package test;\n" + - "public class Test {\n" + - " public Test() {\n" + - " }\n" + - " public void foo() {\n" + - " final int codeAssistTarget;\n" + - " Thread t;\n" + - " new Thread() {\n" + - " public void run() {\n" + - " <CompleteOnName:codeAss>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "codeAss", - // expectedReplacedSource: - "codeAss", - // test name - "<1FVT66Q_1>" - ); -} -/* - * Regression test for 1FVT66Q. - */ -public void test1FVT66Q_2() { - this.runTestCheckMethodParse( - // compilationUnit: - "package test; \n" + - " \n" + - "public class Test { \n" + - " public void foo() { \n" + - " final int codeAssistTarget= 3; \n" + - " \n" + - " Thread t= new Thread() { \n" + - " public void run() { \n" + - " codeAss \n" + - " } \n" + - " }; \n" + - " codeA \n" + - " } \n" + - "} \n", - // completeBehind: - "\n codeA", - // expectedCompletionNodeToString: - "<CompleteOnName:codeA>", - // expectedUnitDisplayString: - "package test;\n" + - "public class Test {\n" + - " public Test() {\n" + - " }\n" + - " public void foo() {\n" + - " final int codeAssistTarget;\n" + - " Thread t;\n" + - " <CompleteOnName:codeA>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "codeA", - // expectedReplacedSource: - "codeA", - // test name - "<1FVT66Q_2>" - ); -} -/* - * Regression test for 1G8DE30. - */ -public void test1G8DE30() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " new Runnable() { \n" + - " public void run() { \n" + - " Bar \n" + - " } \n" + - " }; \n" + - " } \n" + - "} \n", - // completeBehind: - "public void run() { \n ", - // expectedCompletionNodeToString: - "<CompleteOnName:>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " new Runnable() {\n" + - " public void run() {\n" + - " <CompleteOnName:>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<1G8DE30>" - ); -} -/* * Completion on an empty name reference. */ public void testEmptyNameReference() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0; \n" + + "function foo() { \n" + + " var i = 0; \n" + " \n" + - " } \n" + - "} \n", + "} \n", // completeBehind: - "int i = 0; \n ", + "var i = 0; \n ", // expectedCompletionNodeToString: "<CompleteOnName:>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " <CompleteOnName:>;\n" + - " }\n" + + "function foo() {\n" + + " var i = 0;\n" + + " <CompleteOnName:>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -336,60 +117,22 @@ ); } /* - * Completion on an empty name reference after a cast. - */ -public void testEmptyNameReferenceAfterCast() { - this.runTestCheckMethodParse( - // compilationUnit: - "class X { \n" + - " void foo() { \n" + - " X x = (X) \n" + - " \n" + - " } \n" + - "} \n", - // completeBehind: - "(X)", - // expectedCompletionNodeToString: - "<CompleteOnName:>", - // expectedUnitDisplayString: - "class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " X x = (X) <CompleteOnName:>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<complete on empty name reference after cast>" - ); -} -/* * Completion on an empty name reference after + operator. */ public void testEmptyNameReferenceAfterPlus() { this.runTestCheckMethodParse( // compilationUnit: - "class X { \n" + - " void foo() { \n" + - " 1 + \n" + + "function foo() { \n" + + " 1 + \n" + " \n" + - " } \n" + - "} \n", + "} \n", // completeBehind: "1 +", // expectedCompletionNodeToString: "<CompleteOnName:>", // expectedUnitDisplayString: - "class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:>;\n" + - " }\n" + + "function foo() {\n" + + " (1 + <CompleteOnName:>);\n" + "}\n", // expectedCompletionIdentifier: "", @@ -400,103 +143,24 @@ ); } /* - * Completion on an empty name reference in an array dimension. - */ -public void testEmptyNameReferenceInArrayDim() { - this.runTestCheckMethodParse( - // compilationUnit: - "class X { \n" + - " void foo() { \n" + - " int[] \n" + - " \n" + - " } \n" + - "} \n", - // completeBehind: - "int[", - // expectedCompletionNodeToString: - "<CompleteOnName:>", - // expectedUnitDisplayString: - "class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<complete on empty name reference in array dim>" - ); -} -/* - * Completion on an empty name reference in inner class. - */ -public void testEmptyNameReferenceInInnerClass() { - this.runTestCheckMethodParse( - // compilationUnit: - "class X { \n" + - " void foo() { \n" + - " class Y { \n" + - " void bar() { \n" + - " \n" + - " } \n" + - " } \n" + - " \n" + - " } \n" + - "} \n", - // completeBehind: - "\n ", - // expectedCompletionNodeToString: - "<CompleteOnName:>", - // expectedUnitDisplayString: - "class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " class Y {\n" + - " Y() {\n" + - " }\n" + - " void bar() {\n" + - " <CompleteOnName:>;\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "", - // test name - "<complete on empty name reference in inner class>" - ); -} -/* * Completion in the statement following an if expression. */ public void testInIfThenStatement() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " if (bar()) \n" + + "function foo() { \n" + + " if (bar()) \n" + " \n" + " \n" + - " } \n" + - "} \n", + "} \n", // completeBehind: "\n ", // expectedCompletionNodeToString: "<CompleteOnName:>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:>;\n" + - " }\n" + + "function foo() {\n" + + " if (bar())\n" + + " <CompleteOnName:>;\n" + "}\n", // expectedCompletionIdentifier: "", @@ -507,62 +171,21 @@ ); } /* - * Completion on a name reference inside an inner class in a field initializer. - */ -public void testInnerClassFieldInitializer() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar { \n" + - " Object o = new Object() { \n" + - " void foo() { \n" + - " xyz \n" + - " } \n" + - " }; \n" + - "} \n", - // completeBehind: - "xyz", - // expectedCompletionNodeToString: - "<CompleteOnName:xyz>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Object o = new Object() {\n" + - " void foo() {\n" + - " <CompleteOnName:xyz>;\n" + - " }\n" + - " };\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "xyz", - // expectedReplacedSource: - "xyz", - // test name - "<complete on name reference in inner class in field initializer>" - ); -} -/* * Completion on an empty name reference inside an invocation in a field initializer. */ public void testInvocationFieldInitializer() { this.runTestCheckDietParse( // compilationUnit: - "class Bar { \n" + - " String s = fred(1 + ); \n" + - " void foo() { \n" + - " } \n" + - "} \n", + "var s = fred(1 + ); \n" + + "function foo() { \n" + + "} \n", // completeBehind: "(1 + ", // expectedCompletionNodeToString: "<CompleteOnName:>", // expectedUnitDisplayString: - "class Bar {\n" + - " String s = (1 + <CompleteOnName:>);\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + + "var s = fred((1 + <CompleteOnName:>));\n" + + "function foo() {\n" + "}\n", // expectedCompletionIdentifier: "", @@ -573,349 +196,26 @@ ); } /* - * Completion inside an anonymous inner class which is - * inside a method invocation with receiver. - */ -public void testMethodInvocationAnonymousInnerClass() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " primary().bizz( \n" + - " new X() { \n" + - " void fuzz() { \n" + - " x.y.z \n" + - " } \n" + - " } \n" + - " ); \n" + - " } \n" + - "} \n", - // completeBehind: - "x.", - // expectedCompletionNodeToString: - "<CompleteOnName:x.>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " new X() {\n" + - " void fuzz() {\n" + - " <CompleteOnName:x.>;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "x.", - // test name - "<complete inside anonymous inner class inside method invocation 1>" - ); -} -/* - * Completion on a qualified name reference, where the cursor is in the - * first type reference. - */ -public void testQualifiedNameReferenceShrinkAll() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0; \n" + - " a.b.c.Xxx o = new Y(i); \n" + - " } \n" + - "} \n", - // completeBehind: - " a", - // expectedCompletionNodeToString: - "<CompleteOnName:a>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " <CompleteOnName:a>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "a", - // expectedReplacedSource: - "a", - // test name - "<complete on qualified name reference (shrink all)>" - ); -} -/* - * Completion on a qualified name reference, where the cursor is right after the first dot. - */ -public void testQualifiedNameReferenceShrinkAllButOne() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " static Bar x; \n" + - " public class InnerBar { \n" + - " } \n" + - " public class SubInnerBar extends InnerBar { \n" + - " SubInnerBar() { \n" + - " Bar.x.x.super(); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "Bar.", - // expectedCompletionNodeToString: - "<CompleteOnName:Bar.>", - // expectedUnitDisplayString: - "class Bar {\n" + - " public class InnerBar {\n" + - " public InnerBar() {\n" + - " }\n" + - " }\n" + - " public class SubInnerBar extends InnerBar {\n" + - " SubInnerBar() {\n" + - " super();\n" + - " <CompleteOnName:Bar.>;\n" + - " }\n" + - " }\n" + - " static Bar x;\n" + - " <clinit>() {\n" + - " }\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "Bar.", - // test name - "<complete on qualified name reference (shrink all but one)>" - ); -} -/* - * Completion on a qualified name reference, where the cursor is right after the first dot. - */ -public void testQualifiedNameReferenceShrinkAllButOne2() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0; \n" + - " a.b.c.X o = new Y(i); \n" + - " } \n" + - "} \n", - // completeBehind: - " a.", - // expectedCompletionNodeToString: - "<CompleteOnName:a.>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " <CompleteOnName:a.>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "a.", - // test name - "<complete on qualified name reference (shrink all but one) 2>" - ); -} -/* - * Completion on a qualified name reference,where the cursor is right after the end - * of the last name reference. - */ -public void testQualifiedNameReferenceShrinkNone() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " static Bar x; \n" + - " public class InnerBar { \n" + - " } \n" + - " public class SubInnerBar extends InnerBar { \n" + - " SubInnerBar() { \n" + - " Bar.x.x.super(); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "Bar.x.x", - // expectedCompletionNodeToString: - "<CompleteOnName:Bar.x.x>", - // expectedUnitDisplayString: - "class Bar {\n" + - " public class InnerBar {\n" + - " public InnerBar() {\n" + - " }\n" + - " }\n" + - " public class SubInnerBar extends InnerBar {\n" + - " SubInnerBar() {\n" + - " super();\n" + - " <CompleteOnName:Bar.x.x>;\n" + - " }\n" + - " }\n" + - " static Bar x;\n" + - " <clinit>() {\n" + - " }\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "x", - // expectedReplacedSource: - "Bar.x.x", - // test name - "<complete on qualified name reference (shrink none)>" - ); -} -/* - * Completion on a qualified name reference, where the cursor is right after the end - * of the last type reference. - */ -public void testQualifiedNameReferenceShrinkNone2() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0; \n" + - " a.b.c.Xxx o = new Y(i); \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:a.b.c.X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " <CompleteOnName:a.b.c.X>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "a.b.c.Xxx", - // test name - "<complete on qualified name reference (shrink none) 2>" - ); -} -/* - * Completion on a qualified name reference, where the cursor is right after the - * last dot. - */ -public void testQualifiedNameReferenceShrinkOne() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " static Bar x; \n" + - " public class InnerBar { \n" + - " } \n" + - " public class SubInnerBar extends InnerBar { \n" + - " SubInnerBar() { \n" + - " Bar.x.x.super(); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "Bar.x.", - // expectedCompletionNodeToString: - "<CompleteOnName:Bar.x.>", - // expectedUnitDisplayString: - "class Bar {\n" + - " public class InnerBar {\n" + - " public InnerBar() {\n" + - " }\n" + - " }\n" + - " public class SubInnerBar extends InnerBar {\n" + - " SubInnerBar() {\n" + - " super();\n" + - " <CompleteOnName:Bar.x.>;\n" + - " }\n" + - " }\n" + - " static Bar x;\n" + - " <clinit>() {\n" + - " }\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "Bar.x.", - // test name - "<complete on qualified name reference (shrink one)>" - ); -} -/* - * Completion on a qualified name reference, where the cursor is right after the - * last dot. - */ -public void testQualifiedNameReferenceShrinkOne2() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0; \n" + - " a.b.c.X o = new Y(i); \n" + - " } \n" + - "} \n", - // completeBehind: - "a.b.c.", - // expectedCompletionNodeToString: - "<CompleteOnName:a.b.c.>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " <CompleteOnName:a.b.c.>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "", - // expectedReplacedSource: - "a.b.c.", - // test name - "<complete on qualified name reference (shrink one) 2>" - ); -} -/* * Completion on a qualified name reference that contains a unicode. */ public void testUnicode() { this.runTestCheckMethodParse( // compilationUnit: - "class X { \n" + - " void foo() { \n" + - " bar.\\u005ax \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " bar.\\u005ax \n" + + "} \n", // completeBehind: "x", // expectedCompletionNodeToString: - "<CompleteOnName:bar.Zx>", + "<CompleteOnMemberAccess:bar.Zx>", // expectedUnitDisplayString: - "class X {\n" + - " X() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:bar.Zx>;\n" + - " }\n" + + "function foo() {\n" + + " <CompleteOnMemberAccess:bar.Zx>;\n" + "}\n", // expectedCompletionIdentifier: "Zx", // expectedReplacedSource: - "bar.\\u005ax", + "\\u005ax", // test name "<complete on unicode>" );
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ParserTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ParserTest.java index 2d80c97..370ffd9 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ParserTest.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ParserTest.java
@@ -25,12 +25,12 @@ public ParserTest(String name) { super(name); } -public void test001() { +public void Xtest001() { this.runNegativeTest( new String[] { "X.js", - " function foo(){\n" + - " throws\n" + + "function foo(){\n" + + " throws\n" + "}\n" }, "----------\n" + @@ -41,7 +41,7 @@ "----------\n" ); } -public void test002() { +public void Xtest002() { this.runNegativeTest( new String[] { "X.js", @@ -52,12 +52,12 @@ "----------\n" + "1. ERROR in X.js (at line 2)\n" + " throws new\n" + - " ^^^^^^^^^^\n" + + " ^^^\n" + "Syntax error on tokens, delete these tokens\n" + "----------\n" ); } -public void test003() { +public void Xtest003() { this.runNegativeTest( new String[] { "X.js", @@ -70,11 +70,6 @@ " throws new X\n" + " ^^^^^^\n" + "Syntax error on token \"throws\", throw expected\n" + - "----------\n" + - "2. ERROR in X.js (at line 2)\n" + - " throws new X\n" + - " ^\n" + - "Syntax error, unexpected end of method\n" + "----------\n" ); } @@ -114,7 +109,7 @@ // "----------\n" // ); //} -public void test006() { +public void Xtest006() { this.runNegativeTest( new String[] { "X.js", @@ -184,7 +179,7 @@ // "----------\n" // ); //} -public void test009() { +public void Xtest009() { this.runNegativeTest( new String[] { "X.js", @@ -358,8 +353,8 @@ "----------\n" + "1. ERROR in X.js (at line 2)\n" + " var s = \"\n" + - " ^\n" + - "String literal is not properly closed by a double-quote\n" + + " ^\n" + + "String literal is not properly closed by a matching quote\n" + "----------\n" ); } @@ -376,8 +371,8 @@ "----------\n" + "1. ERROR in X.js (at line 2)\n" + " var c = \'\n" + - " ^\n" + - "Invalid character constant\n" + + " ^\n" + + "String literal is not properly closed by a matching quote\n" + "----------\n" ); } @@ -394,7 +389,7 @@ "----------\n" + "1. ERROR in X.js (at line 2)\n" + " var c = \'\\u0\n" + - " ^^^\n" + + " ^^^\n" + "Invalid unicode\n" + "----------\n" ); @@ -402,7 +397,7 @@ /* * https://bugs.eclipse.org/bugs/show_bug.cgi?id=12287 */ -public void test019() { +public void Xtest019() { this.runNegativeTest( new String[] { "X.js", @@ -427,7 +422,7 @@ /* * https://bugs.eclipse.org/bugs/show_bug.cgi?id=38895 */ -public void test020() { +public void Xtest020() { this.runNegativeTest( new String[] { "X.js", @@ -462,19 +457,17 @@ "----------\n" ); } -public void test021() { +public void Xtest021() { StringBuffer buffer = new StringBuffer(); -// buffer.append("public class X {\n"); for (int i = 0; i < 1000; i++) { - buffer.append("\tvar field_" + i + " = 0; \n"); + buffer.append("var field_" + i + " = 0; \n"); } for (int i = 0; i < 1000; i++) { if (i == 0) - buffer.append("\tfunction method_" + i + "() { /* default */ } \n"); + buffer.append("function method_" + i + "() { /* default */ } \n"); else - buffer.append("\tfunction method_" + i + "() { method_" + (i - 1) + "() \n"); + buffer.append("function method_" + i + "() { method_" + (i - 1) + "() \n"); } -// buffer.append("}\n"); Hashtable options = new Hashtable(); options.put(CompilerOptions.OPTION_MaxProblemPerUnit, "10"); @@ -542,43 +535,17 @@ /* * https://bugs.eclipse.org/bugs/show_bug.cgi?id=156119 */ -public void test022() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportEmptyStatement, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - "interface X {\n" + - " int f= 1;;\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.js (at line 2)\n" + - " int f= 1;;\n" + - " ^\n" + - "Unnecessary semicolon\n" + - "----------\n", - null, // custom classpath - true, // flush previous output dir content - options // custom options - ); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=156119 - */ public void test023() { Map options = getCompilerOptions(); options.put(CompilerOptions.OPTION_ReportEmptyStatement, CompilerOptions.ERROR); this.runNegativeTest( new String[] { "X.js", - "class X {\n" + - " int f= 1;;\n" + - "}" + "var f= 1;;\n" }, "----------\n" + - "1. ERROR in X.js (at line 2)\n" + - " int f= 1;;\n" + + "1. ERROR in X.js (at line 1)\n" + + " var f= 1;;\n" + " ^\n" + "Unnecessary semicolon\n" + "----------\n", @@ -587,107 +554,4 @@ options // custom options ); } -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=156119 - */ -public void test024() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportEmptyStatement, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - "interface X {\n" + - " int f= 1;\\u003B\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.js (at line 2)\n" + - " int f= 1;\\u003B\n" + - " ^^^^^^\n" + - "Unnecessary semicolon\n" + - "----------\n", - null, // custom classpath - true, // flush previous output dir content - options // custom options - ); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=160337 - */ -public void test025() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportUndocumentedEmptyBlock, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - "public class X {\n" + - " static class Y {\n" + - " public void foo(int i) {}\n" + - " }\n" + - " static Y FakeInvocationSite = new Y(){\n" + - " public void foo(int i) {}\n" + - " };\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.js (at line 3)\n" + - " public void foo(int i) {}\n" + - " ^^\n" + - "Empty block should be documented\n" + - "----------\n" + - "2. ERROR in X.js (at line 6)\n" + - " public void foo(int i) {}\n" + - " ^^\n" + - "Empty block should be documented\n" + - "----------\n", - null, // custom classpath - true, // flush previous output dir content - options // custom options - ); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=160337 - */ -public void test026() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportUndocumentedEmptyBlock, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - "public class X {\n" + - " static class Y {\n" + - " public void foo(int i) {}\n" + - " }\n" + - " static Y FakeInvocationSite = new Y(){\n" + - " public void foo(int i) {\n" + - " class A {\n" + - " A() {}\n" + - " public void bar() {}\n" + - " }\n" + - " new A().bar();\n" + - " }\n" + - " };\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.js (at line 3)\n" + - " public void foo(int i) {}\n" + - " ^^\n" + - "Empty block should be documented\n" + - "----------\n" + - "2. ERROR in X.js (at line 8)\n" + - " A() {}\n" + - " ^^\n" + - "Empty block should be documented\n" + - "----------\n" + - "3. ERROR in X.js (at line 9)\n" + - " public void bar() {}\n" + - " ^^\n" + - "Empty block should be documented\n" + - "----------\n", - null, // custom classpath - true, // flush previous output dir content - options // custom options - ); -} }
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java index bc4427a..7aef750 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/ReferenceTypeCompletionTest.java
@@ -10,8 +10,6 @@ *******************************************************************************/ package org.eclipse.wst.jsdt.core.tests.compiler.parser; -import junit.framework.Test; - /** * Completion is expected to be a ReferenceType. */ @@ -19,313 +17,22 @@ public ReferenceTypeCompletionTest(String testName) { super(testName); } -public static Test suite() { - return buildAllCompliancesTestSuite(ReferenceTypeCompletionTest.class); -} -/* - * Regression test for 1FTZCIG. - */ -public void test1FTZCIG() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " new X() { \n" + - " protected void bar() { \n" + - " } \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "p", - // expectedCompletionNodeToString: - "<CompleteOnType:p>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " new X() {\n" + - " <CompleteOnType:p>;\n" + - " void bar() {\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "p", - // expectedReplacedSource: - "protected", - // test name - "<1FTZCIG>" - ); -} -/* - * Block ::= OpenBlock '{' <BlockStatementsopt> '}' - */ -public void testBlock() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " try { \n" + - " Xxx o = new Y(); \n" + - " } catch (Exception e) { \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on block>" - ); -} -/* - * BlockStatements ::= BlockStatements <BlockStatement> - */ -public void testBlockStatements() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0; \n" + - " Xxx o = new Y(); \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on block statements>" - ); -} -/* - * CatchClause ::= 'catch' '(' <FormalParameter> ')' Block - */ -public void testCatchClause1() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " try { \n" + - " fred(); \n" + - " } catch (Xxx e) { \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnException:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " try \n" + - " {\n" + - " fred();\n" + - " }\n" + - " catch (<CompleteOnException:X> ) {\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on catch clause 1>" - ); -} -/* - * CatchClause ::= 'catch' '(' <FormalParameter> ')' Block - */ -public void testCatchClause2() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " try { \n" + - " fred(); \n" + - " } catch (final Xxx e) { \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnException:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " try \n" + - " {\n" + - " fred();\n" + - " }\n" + - " catch (<CompleteOnException:X> ) {\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on catch clause 2>" - ); -} -/* - * CatchClause ::= 'catch' '(' <FormalParameter> ')' Block - */ -public void testCatchClause3() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " try { \n" + - " fred(); \n" + - " } catch (x.y.Xxx e) { \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "x.y.X", - // expectedCompletionNodeToString: - "<CompleteOnException:x.y.X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " try \n" + - " {\n" + - " fred();\n" + - " }\n" + - " catch (<CompleteOnException:x.y.X> ) {\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "x.y.Xxx", - // test name - "<complete on catch clause 3>" - ); -} -/* - * ClassBody ::= '{' <ClassBodyDeclarationsopt> '}' - */ -public void testClassBody() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar { \n" + - " Xxx foo() { \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " <CompleteOnType:X>\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on class body>" - ); -} -/* - * ClassBodyDeclarations ::= ClassBodyDeclarations <ClassBodyDeclaration> - */ -public void testClassBodyDeclarations() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar { \n" + - " int i = 0; \n" + - " Xxx foo() { \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " int i;\n" + - " Bar() {\n" + - " }\n" + - " <CompleteOnType:X>\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on class body declarations>" - ); -} /* * ClassInstanceCreationExpression ::= 'new' <ClassType> '(' ArgumentListopt ')' ClassBodyopt */ public void testClassInstanceCreationExpression1() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " new Xxx().zzz(); \n" + - " } \n" + - "}\n", + "function foo() { \n" + + " new Xxx().zzz(); \n" + + "} \n", // completeBehind: "X", // expectedCompletionNodeToString: - "<CompleteOnType:X>", + "<CompleteOnName:X>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " new <CompleteOnType:X>();\n" + - " }\n" + + "function foo() {\n" + + " new <CompleteOnType:X>().zzz();\n" + "}\n", // expectedCompletionIdentifier: "X", @@ -341,22 +48,16 @@ public void testClassInstanceCreationExpression2() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " new Y(new Xxx()).zzz(); \n" + - " } \n" + - "}\n", + "function foo() { \n" + + " new Y(new Xxx()).zzz(); \n" + + "} \n", // completeBehind: "X", // expectedCompletionNodeToString: - "<CompleteOnType:X>", + "<CompleteOnName:X>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " new Y(new <CompleteOnType:X>());\n" + - " }\n" + + "function foo() {\n" + + " new Y(new <CompleteOnType:X>()).zzz();\n" + "}\n", // expectedCompletionIdentifier: "X", @@ -372,22 +73,16 @@ public void testClassInstanceCreationExpression3() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " new Y(1, true, new Xxx()).zzz(); \n" + - " } \n" + - "}\n", + "function foo() { \n" + + " new Y(1, true, new Xxx()).zzz(); \n" + + "} \n", // completeBehind: "X", // expectedCompletionNodeToString: - "<CompleteOnType:X>", + "<CompleteOnName:X>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " new Y(1, true, new <CompleteOnType:X>());\n" + - " }\n" + + "function foo() {\n" + + " new Y(1, true, new <CompleteOnType:X>()).zzz();\n" + "}\n", // expectedCompletionIdentifier: "X", @@ -398,719 +93,21 @@ ); } /* - * ClassInstanceCreationExpression ::= 'new' <ClassType> '(' ArgumentListopt ')' ClassBodyopt - */ -public void testClassInstanceCreationExpression4() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " fred().new Y(new Xxx()).zzz(); \n" + - " } \n" + - "}\n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " fred().new Y(new <CompleteOnType:X>());\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on class instance creation expression 4>" - ); -} -/* - * ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt - */ -public void testClassInstanceCreationExpressionName1() { - this.runTestCheckMethodParse( - // compilationUnit: - "public class Bar { \n" + - " static Bar baz; \n" + - " public class X { \n" + - " void foo() { \n" + - " Bar.baz.new Xxx(); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "new X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "public class Bar {\n" + - " public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " Bar.baz.new <CompleteOnType:X>();\n" + - " }\n" + - " }\n" + - " static Bar baz;\n" + - " <clinit>() {\n" + - " }\n" + - " public Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on class instance creation expression with name 1>" - ); -} -/* - * ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt - */ -public void testClassInstanceCreationExpressionName2() { - this.runTestCheckMethodParse( - // compilationUnit: - "public class Bar { \n" + - " static Bar baz; \n" + - " public class X { \n" + - " void foo() { \n" + - " new Y(Bar.baz.new Xxx()); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "new X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "public class Bar {\n" + - " public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " new Y(Bar.baz.new <CompleteOnType:X>());\n" + - " }\n" + - " }\n" + - " static Bar baz;\n" + - " <clinit>() {\n" + - " }\n" + - " public Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on class instance creation expression with name 2>" - ); -} -/* - * ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt - */ -public void testClassInstanceCreationExpressionName3() { - this.runTestCheckMethodParse( - // compilationUnit: - "public class Bar { \n" + - " static Bar baz; \n" + - " public class X { \n" + - " void foo() { \n" + - " new Y(1, true, Bar.baz.new Xxx()); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "new X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "public class Bar {\n" + - " public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " new Y(1, true, Bar.baz.new <CompleteOnType:X>());\n" + - " }\n" + - " }\n" + - " static Bar baz;\n" + - " <clinit>() {\n" + - " }\n" + - " public Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on class instance creation expression with name 3>" - ); -} -/* - * ClassInstanceCreationExpression ::= ClassInstanceCreationExpressionName 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt - */ -public void testClassInstanceCreationExpressionName4() { - this.runTestCheckMethodParse( - // compilationUnit: - "public class Bar { \n" + - " static Bar baz; \n" + - " public class X { \n" + - " void foo() { \n" + - " fred().new Y(Bar.baz.new Xxx()); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "new X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "public class Bar {\n" + - " public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " fred().new Y(Bar.baz.new <CompleteOnType:X>());\n" + - " }\n" + - " }\n" + - " static Bar baz;\n" + - " <clinit>() {\n" + - " }\n" + - " public Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on class instance creation expression with name 4>" - ); -} -/* - * ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt - */ -public void testClassInstanceCreationExpressionPrimary1() { - this.runTestCheckMethodParse( - // compilationUnit: - "public class Bar { \n" + - " public class X { \n" + - " void foo() { \n" + - " new Bar().new Xxx(); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "new X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "public class Bar {\n" + - " public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " new Bar().new <CompleteOnType:X>();\n" + - " }\n" + - " }\n" + - " public Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on class instance creation expression with primary 1>" - ); -} -/* - * ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt - */ -public void testClassInstanceCreationExpressionPrimary2() { - this.runTestCheckMethodParse( - // compilationUnit: - "public class Bar { \n" + - " public class X { \n" + - " void foo() { \n" + - " new Y(new Bar().new Xxx()); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "new X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "public class Bar {\n" + - " public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " new Y(new Bar().new <CompleteOnType:X>());\n" + - " }\n" + - " }\n" + - " public Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on class instance creation expression with primary 2>" - ); -} -/* - * ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt - */ -public void testClassInstanceCreationExpressionPrimary3() { - this.runTestCheckMethodParse( - // compilationUnit: - "public class Bar { \n" + - " public class X { \n" + - " void foo() { \n" + - " fred().new Y(new Bar().new Xxx()); \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "new X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "public class Bar {\n" + - " public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " fred().new Y(new Bar().new <CompleteOnType:X>());\n" + - " }\n" + - " }\n" + - " public Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on class instance creation expression with primary 3>" - ); -} -/* - * ClassInstanceCreationExpression ::= Primary '.' 'new' SimpleName '(' ArgumentListopt ')' ClassBodyopt - */ -public void testClassInstanceCreationExpressionPrimary4() { - this.runTestCheckMethodParse( - // compilationUnit: - "public class Bar { \n" + - " public class X { \n" + - " void foo() { \n" + - " new Y(1, true, new Bar().new Xxx());\n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "new X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "public class Bar {\n" + - " public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " new Y(1, true, new Bar().new <CompleteOnType:X>());\n" + - " }\n" + - " }\n" + - " public Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on class instance creation expression with primary 4>" - ); -} -/* - * ClassTypeList ::= ClassTypeList ',' <ClassTypeElt> - */ -public void testClassTypeList() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar { \n" + - " void foo() throws Exception, Xxx { \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnException:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() throws Exception, <CompleteOnException:X> {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on class type list>" - ); -} -/* - * ConstructorBody ::= NestedMethod '{' <BlockStatementsopt> '}' - */ -public void testConstructorBody() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " Bar() { \n" + - " Xxx o = new Y(); \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " super();\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on constructor body>" - ); -} -/* - * ConstructorDeclarator ::= 'Identifier' '(' <FormalParameterListopt> ')' - */ -public void testConstructorDeclarator() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar { \n" + - " Bar(Xxx o) { \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar(<CompleteOnType:X> o) {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on constructor declarator>" - ); -} -/* - * The reference type is burried in several blocks - */ -public void testDeepReference() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " if (a == 2) { \n" + - " } \n" + - " try { \n" + - " } finally { \n" + - " if (1 == fgh) { \n" + - " Xxx o = null; \n" + - " } \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " {\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on deep type>" - ); -} -/* - * Super ::= 'extends' <ClassType> - */ -public void testExtendsClass() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar extends Xxx { \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnClass:X>", - // expectedUnitDisplayString: - "class Bar extends <CompleteOnClass:X> {\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on extends>" - ); -} -/* - * ExtendsInterfaces ::= 'extends' <InterfaceTypeList> - */ -public void testExtendsInterface() { - this.runTestCheckDietParse( - // compilationUnit: - "interface Bar extends Xxx { \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnInterface:X>", - // expectedUnitDisplayString: - "interface Bar extends <CompleteOnInterface:X> {\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on extends>" - ); -} -/* - * FieldDeclaration ::= Modifiersopt <Type> VariableDeclarators ';' - * where Modifiersopt is not empty - */ -public void testFieldDeclarationWithModifiers() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar { \n" + - " public final Xxx foo; \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>;", - // expectedUnitDisplayString: - "class Bar {\n" + - " <CompleteOnType:X>;\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on field declaration with modifiers>" - ); -} -/* - * FieldDeclaration ::= Modifiersopt <Type> VariableDeclarators ';' - * where Modifiersopt is empty - */ -public void testFieldDeclarationWithoutModifiers() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar { \n" + - " Xxx foo; \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>;", - // expectedUnitDisplayString: - "class Bar {\n" + - " <CompleteOnType:X>;\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on field declaration without modifiers>" - ); -} -/* - * FormalParameter ::= Modifiers <Type> VariableDeclaratorId - */ -public void testFormalParameter() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar { \n" + - " void foo(final Xxx x) { \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo(final <CompleteOnType:X> x) {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on formal parameter>" - ); -} -/* - * FormalParameterList ::= FormalParameterList ',' <FormalParameter> - */ -public void testFormalParameterList() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar { \n" + - " void foo(int i, final Object o, Xxx x) {\n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo(int i, final Object o, <CompleteOnType:X> x) {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on formal parameter list>" - ); -} -/* - * ForStatement ::= 'for' '(' <ForInitopt> ';' Expressionopt ';' ForUpdateopt ')' Statement - * or - * ForStatementNoShortIf ::= 'for' '(' <ForInitopt> ';' Expressionopt ';' ForUpdateopt ')' StatementNoShortIf - */ -public void testForStatement() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " for (Xxx o = new Y(); o.size() < 10; ) {\n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on for statement>" - ); -} -/* - * Interfaces ::= 'implements' <InterfaceTypeList> - */ -public void testImplements() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar implements Xxx { \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnInterface:X>", - // expectedUnitDisplayString: - "class Bar implements <CompleteOnInterface:X> {\n" + - " Bar() {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on implements>" - ); -} -/* * RelationalExpression ::= RelationalExpression 'instanceof' <ReferenceType> */ public void testInstanceOf() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " boolean foo() { \n" + - " return this instanceof Xxx; \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " return this instanceof Xxx; \n" + + "} \n", // completeBehind: "X", // expectedCompletionNodeToString: - "<CompleteOnType:X>", + "<CompleteOnName:X>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " boolean foo() {\n" + - " (this instanceof <CompleteOnType:X>);\n" + - " }\n" + + "function foo() {\n" + + " return (this instanceof <CompleteOnName:X>);\n" + "}\n", // expectedCompletionIdentifier: "X", @@ -1120,230 +117,31 @@ "<complete on instanceof>" ); } + /* - * InterfaceBody ::= '{' <InterfaceMemberDeclarationsopt> '}' + * RelationalExpression ::= RelationalExpression 'typeof' <ReferenceType> */ -public void testInterfaceBody() { - this.runTestCheckDietParse( - // compilationUnit: - "interface Bar { \n" + - " Xxx foo(); \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "interface Bar {\n" + - " <CompleteOnType:X>\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on interface body>" - ); -} -/* - * InterfaceMemberDeclarations ::= InterfaceMemberDeclarations <InterfaceMemberDeclaration> - */ -public void testInterfaceMemberDeclarations() { - this.runTestCheckDietParse( - // compilationUnit: - "interface Bar { \n" + - " int CONSTANT = 0; \n" + - " Xxx foo(); \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "interface Bar {\n" + - " int CONSTANT;\n" + - " <clinit>() {\n" + - " }\n" + - " <CompleteOnType:X>\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on interface member declarations>" - ); -} -/* - * InterfaceTypeList ::= InterfaceTypeList ',' <InterfaceType> - */ -public void testInterfaceTypeList() { - this.runTestCheckDietParse( - // compilationUnit: - "interface Bar extends Comparable, Xxx { \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnInterface:X>", - // expectedUnitDisplayString: - "interface Bar extends Comparable, <CompleteOnInterface:X> {\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on interface list>" - ); -} -/* - * LocalVariableDeclaration ::= Modifiers <Type> VariableDeclarators - */ -public void testLocalVariableDeclaration() { +public void testTypeOf() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " final Xxx o = new Y(); \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on local variable declaration>" - ); -} -/* - * MethodBody ::= NestedMethod '{' <BlockStatementsopt> '}' - */ -public void testMethodBody() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " Xxx o = new Y(); \n" + - " } \n" + + "function foo() { \n" + + " return this typeof Xxx; \n" + "} \n", // completeBehind: "X", // expectedCompletionNodeToString: "<CompleteOnName:X>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - "}\n", + "function foo() {\n" + + " (typeof <CompleteOnName:X>);\n" + + "}\n" + + ";\n", // expectedCompletionIdentifier: "X", // expectedReplacedSource: "Xxx", // test name - "<complete on method body>" - ); -} -/* - * MethodDeclarator ::= 'Identifier' '(' <FormalParameterListopt> ')' Dimsopt - */ -public void testMethodDeclarator() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar { \n" + - " void foo(Xxx o) { \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo(<CompleteOnType:X> o) {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on method declarator>" - ); -} -/* - * MethodHeader ::= Modifiersopt <Type> MethodDeclarator Throwsopt - * where Modifiersopt is not empty - */ -public void testMethodHeaderWithModifiers() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar { \n" + - " public static Xxx foo() { \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " <CompleteOnType:X>\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on method header with modifiers>" - ); -} -/* - * MethodHeader ::= Modifiersopt <Type> MethodDeclarator Throwsopt - * where Modifiersopt is empty - */ -public void testMethodHeaderWithoutModifiers() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar { \n" + - " Xxx foo() { \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnType:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " <CompleteOnType:X>\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on method header without modifiers>" + "<complete on instanceof>" ); } /* @@ -1353,24 +151,18 @@ public void testQualifiedTypeReferenceShrinkAll() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0; \n" + - " new a.b.c.Xxx(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var i = 0; \n" + + " new a.b.c.Xxx(); \n" + + "} \n", // completeBehind: - " new a", + " new a", // expectedCompletionNodeToString: - "<CompleteOnType:a>", + "<CompleteOnName:a>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " new <CompleteOnType:a>();\n" + - " }\n" + + "function foo() {\n" + + " var i = 0;\n" + + " new <CompleteOnName:a>.b.c.Xxx();\n" + "}\n", // expectedCompletionIdentifier: "a", @@ -1386,29 +178,23 @@ public void testQualifiedTypeReferenceShrinkAllButOne() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0; \n" + - " new a.b.c.Xxx(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var i = 0; \n" + + " new a.b.c.Xxx(); \n" + + "} \n", // completeBehind: "a.", // expectedCompletionNodeToString: - "<CompleteOnType:a.>", + "<CompleteOnMemberAccess:a.>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " new <CompleteOnType:a.>();\n" + - " }\n" + + "function foo() {\n" + + " var i = 0;\n" + + " new <CompleteOnMemberAccess:a.>.c.Xxx();\n" + "}\n", // expectedCompletionIdentifier: "", // expectedReplacedSource: - "a.", + "b", // test name "<complete on qualified type reference (shrink all but one)>" ); @@ -1420,29 +206,23 @@ public void testQualifiedTypeReferenceShrinkNone() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0; \n" + - " new a.b.c.Xxx(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var i = 0; \n" + + " new a.b.c.Xxx(); \n" + + "} \n", // completeBehind: "X", // expectedCompletionNodeToString: - "<CompleteOnType:a.b.c.X>", + "<CompleteOnMemberAccess:a.b.c.X>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " new <CompleteOnType:a.b.c.X>();\n" + - " }\n" + + "function foo() {\n" + + " var i = 0;\n" + + " new <CompleteOnType:a.b.c.X>();\n" + "}\n", // expectedCompletionIdentifier: "X", // expectedReplacedSource: - "a.b.c.Xxx", + "Xxx", // test name "<complete on qualified type reference (shrink none)>" ); @@ -1454,100 +234,25 @@ public void testQualifiedTypeReferenceShrinkOne() { this.runTestCheckMethodParse( // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 0; \n" + - " new a.b.c.Xxx(); \n" + - " } \n" + - "} \n", + "function foo() { \n" + + " var i = 0; \n" + + " new a.b.c.Xxx(); \n" + + "} \n", // completeBehind: "a.b.c.", // expectedCompletionNodeToString: - "<CompleteOnType:a.b.c.>", + "<CompleteOnMemberAccess:a.b.c.>", // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " new <CompleteOnType:a.b.c.>();\n" + - " }\n" + + "function foo() {\n" + + " var i = 0;\n" + + " new <CompleteOnType:a.b.c.>();\n" + "}\n", // expectedCompletionIdentifier: "", // expectedReplacedSource: - "a.b.c.", + "Xxx", // test name "<complete on qualified type reference (shrink one)>" ); } -/* - * SwitchBlockStatement ::= SwitchLabels <BlockStatements> - */ -public void testSwitchBlockStatement() { - this.runTestCheckMethodParse( - // compilationUnit: - "class Bar { \n" + - " void foo() { \n" + - " int i = 1; \n" + - " switch (i) { \n" + - " case 1: \n" + - " Xxx o = fred(i); \n" + - " break; \n" + - " default: \n" + - " } \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnName:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() {\n" + - " int i;\n" + - " {\n" + - " <CompleteOnName:X>;\n" + - " }\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on switch block statement>" - ); -} -/* - * Throws ::= 'throws' <ClassTypeList> - */ -public void testThrows() { - this.runTestCheckDietParse( - // compilationUnit: - "class Bar { \n" + - " void foo() throws Xxx { \n" + - " } \n" + - "} \n", - // completeBehind: - "X", - // expectedCompletionNodeToString: - "<CompleteOnException:X>", - // expectedUnitDisplayString: - "class Bar {\n" + - " Bar() {\n" + - " }\n" + - " void foo() throws <CompleteOnException:X> {\n" + - " }\n" + - "}\n", - // expectedCompletionIdentifier: - "X", - // expectedReplacedSource: - "Xxx", - // test name - "<complete on throws>" - ); -} }
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/RunCompletionParserTests.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/RunCompletionParserTests.java deleted file mode 100644 index 0c7d6d9..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/RunCompletionParserTests.java +++ /dev/null
@@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase; -import org.eclipse.wst.jsdt.core.tests.util.AbstractCompilerTest; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class RunCompletionParserTests extends junit.framework.TestCase { - - public final static List TEST_CLASSES = new ArrayList(); - public final static List TEST_CLASSES_1_5 = new ArrayList(); - static { - TEST_CLASSES.add(AllocationExpressionCompletionTest.class); - TEST_CLASSES.add(CompletionParserTest.class); - TEST_CLASSES.add(CompletionParserTest2.class); - TEST_CLASSES.add(CompletionParserTestKeyword.class); - TEST_CLASSES.add(CompletionRecoveryTest.class); - TEST_CLASSES.add(FieldAccessCompletionTest.class); - TEST_CLASSES.add(JavadocCompletionParserTest.class); - TEST_CLASSES.add(LabelStatementCompletionTest.class); - TEST_CLASSES.add(MethodInvocationCompletionTest.class); - TEST_CLASSES.add(NameReferenceCompletionTest.class); - - } - - public RunCompletionParserTests(String name) { - super(name); - } - - public static Test suite() { - ArrayList testClasses = new ArrayList(); - - testClasses.addAll(RunCompletionParserTests.TEST_CLASSES); - - TestSuite all = new TestSuite(TestAll.class.getName()); - int possibleComplianceLevels = AbstractCompilerTest.getPossibleComplianceLevels(); - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_3) != 0) { - ArrayList tests_1_3 = (ArrayList)testClasses.clone(); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_3, tests_1_3)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_4) != 0) { - ArrayList tests_1_4 = (ArrayList)testClasses.clone(); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_4, tests_1_4)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_5) != 0) { - ArrayList tests_1_5 = (ArrayList)testClasses.clone(); - tests_1_5.addAll(TEST_CLASSES_1_5); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_5, tests_1_5)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_6) != 0) { - ArrayList tests_1_6 = (ArrayList)testClasses.clone(); - tests_1_6.addAll(TEST_CLASSES_1_5); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_6, tests_1_6)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_7) != 0) { - ArrayList tests_1_7 = (ArrayList)testClasses.clone(); - tests_1_7.addAll(TEST_CLASSES_1_5); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_7, tests_1_7)); - } - - - return all; - } -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionJavadocTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionJavadocTest.java deleted file mode 100644 index 3bc19ba..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionJavadocTest.java +++ /dev/null
@@ -1,865 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import java.util.Locale; - -import org.eclipse.wst.jsdt.core.tests.util.Util; -import org.eclipse.wst.jsdt.internal.codeassist.select.SelectionJavadoc; -import org.eclipse.wst.jsdt.internal.codeassist.select.SelectionParser; -import org.eclipse.wst.jsdt.internal.compiler.ASTVisitor; -import org.eclipse.wst.jsdt.internal.compiler.CompilationResult; -import org.eclipse.wst.jsdt.internal.compiler.DefaultErrorHandlingPolicies; -import org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration; -import org.eclipse.wst.jsdt.internal.compiler.ast.ConstructorDeclaration; -import org.eclipse.wst.jsdt.internal.compiler.ast.FieldDeclaration; -import org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration; -import org.eclipse.wst.jsdt.internal.compiler.ast.TypeDeclaration; -import org.eclipse.wst.jsdt.internal.compiler.batch.CompilationUnit; -import org.eclipse.wst.jsdt.internal.compiler.env.ICompilationUnit; -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; -import org.eclipse.wst.jsdt.internal.compiler.lookup.BlockScope; -import org.eclipse.wst.jsdt.internal.compiler.lookup.ClassScope; -import org.eclipse.wst.jsdt.internal.compiler.lookup.CompilationUnitScope; -import org.eclipse.wst.jsdt.internal.compiler.lookup.MethodScope; -import org.eclipse.wst.jsdt.internal.compiler.lookup.Scope; -import org.eclipse.wst.jsdt.internal.compiler.problem.DefaultProblemFactory; -import org.eclipse.wst.jsdt.internal.compiler.problem.ProblemReporter; - -import junit.framework.Test; - -/** - * Class to test selection in Javadoc comments. - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=54968" - */ -public class SelectionJavadocTest extends AbstractSelectionTest { - - String source; - StringBuffer result; - ICompilationUnit unit; - - public SelectionJavadocTest(String testName) { - super(testName); - } - - static { -// TESTS_NUMBERS = new int[] { 9, 10 }; -// TESTS_RANGE = new int[] { 26, -1 }; - } - - public static Test suite() { - return buildAllCompliancesTestSuite(SelectionJavadocTest.class); - } - - class SelectionVisitor extends ASTVisitor { - - public boolean visit(ConstructorDeclaration constructor, ClassScope scope) { - if (constructor.javadoc != null) { - assertTrue("Invalid type for Javadoc on " + constructor, constructor.javadoc instanceof SelectionJavadoc); - SelectionJavadocTest.this.result.append(constructor.javadoc.toString()); - } - return super.visit(constructor, scope); - } - - public boolean visit(FieldDeclaration field, MethodScope scope) { - if (field.javadoc != null) { - assertTrue("Invalid type for Javadoc on " + field, field.javadoc instanceof SelectionJavadoc); - SelectionJavadocTest.this.result.append(field.javadoc.toString()); - } - return super.visit(field, scope); - } - - public boolean visit(MethodDeclaration method, Scope scope) { - if (method.javadoc != null) { - assertTrue("Invalid type for Javadoc on " + method, method.javadoc instanceof SelectionJavadoc); - SelectionJavadocTest.this.result.append(method.javadoc.toString()); - } - return super.visit(method, scope); - } - - public boolean visit(TypeDeclaration type, BlockScope scope) { - if (type.javadoc != null) { - assertTrue("Invalid type for Javadoc on " + type, type.javadoc instanceof SelectionJavadoc); - SelectionJavadocTest.this.result.append(type.javadoc.toString()); - } - return super.visit(type, scope); - } - - public boolean visit(TypeDeclaration type, ClassScope scope) { - if (type.javadoc != null) { - assertTrue("Invalid type for Javadoc on " + type, type.javadoc instanceof SelectionJavadoc); - SelectionJavadocTest.this.result.append(type.javadoc.toString()); - } - return super.visit(type, scope); - } - - public boolean visit(TypeDeclaration type, CompilationUnitScope scope) { - if (type.javadoc != null) { - assertTrue("Invalid type for Javadoc on " + type, type.javadoc instanceof SelectionJavadoc); - SelectionJavadocTest.this.result.append(type.javadoc.toString()); - } - return super.visit(type, scope); - } - } - - protected void assertValid(String expected) { - String actual = this.result.toString(); - if (!actual.equals(expected)) { - System.out.println("Expected result for test "+testName()+":"); - System.out.println(Util.displayString(actual, 3)); - System.out.println(" source: ["); - System.out.print(Util.indentString(this.source, 2)); - System.out.println("]\n"); - assertEquals("Invalid selection node", expected, actual); - } - } - protected void setUp() throws Exception { - super.setUp(); - this.unit = null; - } - - void setUnit(String name, String source) { - this.source = source; - this.unit = new CompilationUnit(source.toCharArray(), name, null); - this.result = new StringBuffer(); - } - - /* - * Parse a method with selectionNode check - */ - protected void findJavadoc(String selection) { - findJavadoc(selection, 1); - } - - protected void findJavadoc(String selection, int occurences) { - - // Verify unit - assertNotNull("Missing compilation unit!", this.unit); - - // Get selection start and end - int selectionStart = source.indexOf(selection); - int length = selection.length(); - int selectionEnd = selectionStart + length - 1; - for (int i = 1; i < occurences; i++) { - selectionStart = source.indexOf(selection, selectionEnd); - selectionEnd = selectionStart + length - 1; - } - - // Parse unit - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - SelectionParser parser = new SelectionParser(new ProblemReporter(DefaultErrorHandlingPolicies.proceedWithAllProblems(), - options, - new DefaultProblemFactory(Locale.getDefault()))); - CompilationUnitDeclaration unitDecl = parser.dietParse(this.unit, new CompilationResult(this.unit, 0, 0, 0), selectionStart, selectionEnd); - parser.getMethodBodies(unitDecl); - - // Visit compilation unit declaration to find javadoc - unitDecl.traverse(new SelectionVisitor(), unitDecl.scope); - } - - public void test01() { - setUnit("Test.java", - "public class Test {\n" + - " /** @see #foo() */\n" + - " void bar() {\n" + - " foo();\n" + - " }\n" + - " void foo() {}\n" + - "}\n" - ); - findJavadoc("foo"); - assertValid("/**<SelectOnMethod:#foo()>*/\n"); - } - - public void test02() { - setUnit("Test.java", - "public class Test {\n" + - " /** {@link #foo() foo} */\n" + - " void bar() {\n" + - " foo();\n" + - " }\n" + - " void foo() {}\n" + - "}\n" - ); - findJavadoc("foo"); - assertValid("/**<SelectOnMethod:#foo()>*/\n"); - } - - public void test03() { - setUnit("Test.java", - "public class Test {\n" + - " /** @see Test */\n" + - " void foo() {}\n" + - "}\n" - ); - findJavadoc("Test", 2); - assertValid("/**<SelectOnType:Test>*/\n"); - } - - public void test04() { - setUnit("Test.java", - "public class Test {\n" + - " /** Javadoc {@link Test} */\n" + - " void foo() {}\n" + - "}\n" - ); - findJavadoc("Test", 2); - assertValid("/**<SelectOnType:Test>*/\n"); - } - - public void test05() { - setUnit("Test.java", - "public class Test {\n" + - " int field;\n" + - " /** @see #field */\n" + - " void foo() {}\n" + - "}\n" - ); - findJavadoc("field", 2); - assertValid("/**<SelectOnField:#field>*/\n"); - } - - public void test06() { - setUnit("Test.java", - "public class Test {\n" + - " int field;\n" + - " /**{@link #field}*/\n" + - " void foo() {}\n" + - "}\n" - ); - findJavadoc("field", 2); - assertValid("/**<SelectOnField:#field>*/\n"); - } - - public void test07() { - setUnit("Test.java", - "public class Test {\n" + - " /**\n" + - " * @see Test#field\n" + - " * @see #foo(int, String)\n" + - " * @see Test#foo(int, String)\n" + - " */\n" + - " void bar() {\n" + - " foo(0, \"\");\n" + - " }\n" + - " int field;\n" + - " void foo(int x, String s) {}\n" + - "}\n" - ); - findJavadoc("foo"); - findJavadoc("String"); - findJavadoc("Test", 2); - findJavadoc("foo", 2); - findJavadoc("String", 2); - findJavadoc("Test", 3); - findJavadoc("field"); - assertValid( - "/**<SelectOnMethod:#foo(int , String )>*/\n" + - "/**<SelectOnType:String>*/\n" + - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnMethod:Test#foo(int , String )>*/\n" + - "/**<SelectOnType:String>*/\n" + - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnField:Test#field>*/\n" - ); - } - - public void test08() { - setUnit("Test.java", - "public class Test {\n" + - " /**\n" + - " * First {@link #foo(int, String)}\n" + - " * Second {@link Test#foo(int, String) method foo}\n" + - " * Third {@link Test#field field}\n" + - " */\n" + - " void bar() {\n" + - " foo(0, \"\");\n" + - " }\n" + - " int field;\n" + - " void foo(int x, String s) {}\n" + - "}\n" - ); - findJavadoc("foo"); - findJavadoc("String"); - findJavadoc("Test", 2); - findJavadoc("foo", 2); - findJavadoc("String", 2); - findJavadoc("Test", 3); - findJavadoc("field"); - assertValid( - "/**<SelectOnMethod:#foo(int , String )>*/\n" + - "/**<SelectOnType:String>*/\n" + - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnMethod:Test#foo(int , String )>*/\n" + - "/**<SelectOnType:String>*/\n" + - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnField:Test#field>*/\n" - ); - } - - public void test09() { - setUnit("test/junit/Test.java", - "package test.junit;\n" + - "public class Test {\n" + - " /**\n" + - " * @see test.junit.Test\n" + - " * @see test.junit.Test#field\n" + - " * @see test.junit.Test#foo(Object[] array)\n" + - " */\n" + - " void bar() {\n" + - " foo(null);\n" + - " }\n" + - " int field;\n" + - " void foo(Object[] array) {}\n" + - "}\n" - ); - findJavadoc("test", 2); - findJavadoc("junit", 2); - findJavadoc("Test", 2); - findJavadoc("test", 3); - findJavadoc("junit", 3); - findJavadoc("Test", 3); - findJavadoc("field"); - findJavadoc("test", 4); - findJavadoc("junit", 4); - findJavadoc("Test", 4); - findJavadoc("foo"); - findJavadoc("Object"); - findJavadoc("array"); - assertValid( - "/**<SelectOnType:test>*/\n" + - "/**<SelectOnType:test.junit>*/\n" + - "/**<SelectOnType:test.junit.Test>*/\n" + - "/**<SelectOnType:test>*/\n" + - "/**<SelectOnType:test.junit>*/\n" + - "/**<SelectOnType:test.junit.Test>*/\n" + - "/**<SelectOnField:test.junit.Test#field>*/\n" + - "/**<SelectOnType:test>*/\n" + - "/**<SelectOnType:test.junit>*/\n" + - "/**<SelectOnType:test.junit.Test>*/\n" + - "/**<SelectOnMethod:test.junit.Test#foo(Object[] array)>*/\n" + - "/**<SelectOnType:Object>*/\n" + - "/**\n" + - " */\n" - ); - } - - public void test10() { - setUnit("test/junit/Test.java", - "package test.junit;\n" + - "public class Test {\n" + - " /** Javadoc {@linkplain test.junit.Test}\n" + - " * {@linkplain test.junit.Test#field field}\n" + - " * last line {@linkplain test.junit.Test#foo(Object[] array) foo(Object[])}\n" + - " */\n" + - " void bar() {\n" + - " foo(null);\n" + - " }\n" + - " int field;\n" + - " void foo(Object[] array) {}\n" + - "}\n" - ); - findJavadoc("test", 2); - findJavadoc("junit", 2); - findJavadoc("Test", 2); - findJavadoc("test", 3); - findJavadoc("junit", 3); - findJavadoc("Test", 3); - findJavadoc("field"); - findJavadoc("test", 4); - findJavadoc("junit", 4); - findJavadoc("Test", 4); - findJavadoc("foo"); - findJavadoc("Object"); - findJavadoc("array"); - assertValid( - "/**<SelectOnType:test>*/\n" + - "/**<SelectOnType:test.junit>*/\n" + - "/**<SelectOnType:test.junit.Test>*/\n" + - "/**<SelectOnType:test>*/\n" + - "/**<SelectOnType:test.junit>*/\n" + - "/**<SelectOnType:test.junit.Test>*/\n" + - "/**<SelectOnField:test.junit.Test#field>*/\n" + - "/**<SelectOnType:test>*/\n" + - "/**<SelectOnType:test.junit>*/\n" + - "/**<SelectOnType:test.junit.Test>*/\n" + - "/**<SelectOnMethod:test.junit.Test#foo(Object[] array)>*/\n" + - "/**<SelectOnType:Object>*/\n" + - "/**\n" + - " */\n" - ); - } - - public void test11() { - setUnit("Test.java", - "public class Test {\n" + - " /**\n" + - " * @throws RuntimeException runtime exception\n" + - " * @throws InterruptedException interrupted exception\n" + - " */\n" + - " void foo() {}\n" + - "}\n" - ); - findJavadoc("RuntimeException"); - findJavadoc("InterruptedException"); - assertValid( - "/**<SelectOnType:RuntimeException>*/\n" + - "/**<SelectOnType:InterruptedException>*/\n" - ); - } - - public void test12() { - setUnit("Test.java", - "public class Test {\n" + - " /**\n" + - " * @exception RuntimeException runtime exception\n" + - " * @exception InterruptedException interrupted exception\n" + - " */\n" + - " void foo() {}\n" + - "}\n" - ); - findJavadoc("RuntimeException"); - findJavadoc("InterruptedException"); - assertValid( - "/**<SelectOnType:RuntimeException>*/\n" + - "/**<SelectOnType:InterruptedException>*/\n" - ); - } - - public void test13() { - setUnit("Test.java", - "public class Test {\n" + - " /**\n" + - " * @param xxx integer param\n" + - " * @param str string param\n" + - " */\n" + - " void foo(int xxx, String str) {}\n" + - "}\n" - ); - findJavadoc("xxx"); - findJavadoc("str"); - assertValid( - "/**<SelectOnLocalVariable:xxx>*/\n" + - "/**<SelectOnLocalVariable:str>*/\n" - ); - } - - public void test14() { - setUnit("Test.java", - "/**\n" + - " * Javadoc of {@link Test}\n" + - " * @see Field#foo\n" + - " */\n" + - "public class Test {}\n" + - "/**\n" + - " * Javadoc on {@link Field} to test selection in javadoc field references\n" + - " * @see #foo\n" + - " */\n" + - "class Field {\n" + - " /**\n" + - " * Javadoc on {@link #foo} to test selection in javadoc field references\n" + - " * @see #foo\n" + - " * @see Field#foo\n" + - " */\n" + - " int foo;\n" + - "}\n" - ); - findJavadoc("Field"); - findJavadoc("foo"); - findJavadoc("Field", 2); - findJavadoc("foo", 2); - findJavadoc("foo", 3); - findJavadoc("foo", 4); - findJavadoc("Field", 4); - findJavadoc("foo", 5); - assertValid( - "/**<SelectOnType:Field>*/\n" + - "/**<SelectOnField:Field#foo>*/\n" + - "/**<SelectOnType:Field>*/\n" + - "/**<SelectOnField:#foo>*/\n" + - "/**<SelectOnField:#foo>*/\n" + - "/**<SelectOnField:#foo>*/\n" + - "/**<SelectOnType:Field>*/\n" + - "/**<SelectOnField:Field#foo>*/\n" - ); - } - - public void test15() { - setUnit("Test.java", - "/**\n" + - " * Javadoc of {@link Test}\n" + - " * @see Method#foo(int, String)\n" + - " */\n" + - "public class Test {}\n" + - "/**\n" + - " * Javadoc on {@link Method} to test selection in javadoc method references\n" + - " * @see #foo(int, String)\n" + - " */\n" + - "class Method {\n" + - " /**\n" + - " * Javadoc on {@link #foo(int,String)} to test selection in javadoc method references\n" + - " * @see #foo(int, String)\n" + - " * @see Method#foo(int, String)\n" + - " */\n" + - " void bar() {}\n" + - " /**\n" + - " * Method with parameter and throws clause to test selection in javadoc\n" + - " * @param xxx TODO\n" + - " * @param str TODO\n" + - " * @throws RuntimeException blabla\n" + - " * @throws InterruptedException bloblo\n" + - " */\n" + - " void foo(int xxx, String str) throws RuntimeException, InterruptedException {}\n" + - "}\n" - ); - findJavadoc("Method"); - findJavadoc("foo"); - findJavadoc("Method", 2); - findJavadoc("foo", 2); - findJavadoc("foo", 3); - findJavadoc("foo", 4); - findJavadoc("Method", 4); - findJavadoc("foo", 5); - findJavadoc("xxx"); - findJavadoc("str"); - findJavadoc("RuntimeException"); - findJavadoc("InterruptedException"); - assertValid( - "/**<SelectOnType:Method>*/\n" + - "/**<SelectOnMethod:Method#foo(int , String )>*/\n" + - "/**<SelectOnType:Method>*/\n" + - "/**<SelectOnMethod:#foo(int , String )>*/\n" + - "/**<SelectOnMethod:#foo(int , String )>*/\n" + - "/**<SelectOnMethod:#foo(int , String )>*/\n" + - "/**<SelectOnType:Method>*/\n" + - "/**<SelectOnMethod:Method#foo(int , String )>*/\n" + - "/**<SelectOnLocalVariable:xxx>*/\n" + - "/**<SelectOnLocalVariable:str>*/\n" + - "/**<SelectOnType:RuntimeException>*/\n" + - "/**<SelectOnType:InterruptedException>*/\n" - ); - } - - public void test16() { - setUnit("Test.java", - "/**\n" + - " * Javadoc of {@link Test}\n" + - " * @see Other\n" + - " */\n" + - "public class Test {}\n" + - "/**\n" + - " * Javadoc of {@link Other}\n" + - " * @see Test\n" + - " */\n" + - "class Other {}\n" - ); - findJavadoc("Test"); - findJavadoc("Other"); - findJavadoc("Test", 3); - findJavadoc("Other", 2); - assertValid( - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnType:Other>*/\n" + - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnType:Other>*/\n" - ); - } - - public void test17() { - setUnit("Test.java", - "/**\n" + - " * @see Test.Field#foo\n" + - " */\n" + - "public class Test {\n" + - " /**\n" + - " * @see Field#foo\n" + - " */\n" + - " class Field {\n" + - " /**\n" + - " * @see #foo\n" + - " * @see Field#foo\n" + - " * @see Test.Field#foo\n" + - " */\n" + - " int foo;\n" + - " }\n" + - "}\n" - ); - findJavadoc("Test"); - findJavadoc("Field"); - findJavadoc("foo"); - findJavadoc("Field", 2); - findJavadoc("foo", 2); - findJavadoc("foo", 3); - findJavadoc("Field", 4); - findJavadoc("foo", 4); - findJavadoc("Test", 3); - findJavadoc("Field", 5); - findJavadoc("foo", 5); - assertValid( - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnType:Test.Field>*/\n" + - "/**<SelectOnField:Test.Field#foo>*/\n" + - "/**<SelectOnType:Field>*/\n" + - "/**<SelectOnField:Field#foo>*/\n" + - "/**<SelectOnField:#foo>*/\n" + - "/**<SelectOnType:Field>*/\n" + - "/**<SelectOnField:Field#foo>*/\n" + - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnType:Test.Field>*/\n" + - "/**<SelectOnField:Test.Field#foo>*/\n" - ); - } - - public void test18() { - setUnit("Test.java", - "/**\n" + - " * @see Test.Method#foo()\n" + - " */\n" + - "public class Test {\n" + - " /**\n" + - " * @see Method#foo()\n" + - " */\n" + - " class Method {\n" + - " /**\n" + - " * @see #foo()\n" + - " * @see Method#foo()\n" + - " * @see Test.Method#foo()\n" + - " */\n" + - " void foo() {}\n" + - " }\n" + - "}" - ); - findJavadoc("Test"); - findJavadoc("Method"); - findJavadoc("foo"); - findJavadoc("Method", 2); - findJavadoc("foo", 2); - findJavadoc("foo", 3); - findJavadoc("Method", 4); - findJavadoc("foo", 4); - findJavadoc("Test", 3); - findJavadoc("Method", 5); - findJavadoc("foo", 5); - assertValid( - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnType:Test.Method>*/\n" + - "/**<SelectOnMethod:Test.Method#foo()>*/\n" + - "/**<SelectOnType:Method>*/\n" + - "/**<SelectOnMethod:Method#foo()>*/\n" + - "/**<SelectOnMethod:#foo()>*/\n" + - "/**<SelectOnType:Method>*/\n" + - "/**<SelectOnMethod:Method#foo()>*/\n" + - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnType:Test.Method>*/\n" + - "/**<SelectOnMethod:Test.Method#foo()>*/\n" - ); - } - - public void test19() { - setUnit("Test.java", - "/**\n" + - " * @see Test.Other\n" + - " */\n" + - "public class Test {\n" + - " /**\n" + - " * @see Test\n" + - " * @see Other\n" + - " * @see Test.Other\n" + - " */\n" + - " class Other {}\n" + - "}" - ); - findJavadoc("Test"); - findJavadoc("Other"); - findJavadoc("Test", 3); - findJavadoc("Other", 2); - findJavadoc("Test", 4); - findJavadoc("Other", 3); - assertValid( - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnType:Test.Other>*/\n" + - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnType:Other>*/\n" + - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnType:Test.Other>*/\n" - ); - } - - public void test20() { - setUnit("Test.java", - "public class Test {\n" + - " void bar() {\n" + - " /**\n" + - " * @see Field#foo\n" + - " */\n" + - " class Field {\n" + - " /**\n" + - " * @see #foo\n" + - " * @see Field#foo\n" + - " */\n" + - " int foo;\n" + - " }\n" + - " }\n" + - "}\n" - ); - findJavadoc("Field"); - findJavadoc("foo"); - findJavadoc("foo", 2); - findJavadoc("Field", 3); - findJavadoc("foo", 3); - assertValid( - "/**<SelectOnType:Field>*/\n" + - "/**<SelectOnField:Field#foo>*/\n" + - "/**<SelectOnField:#foo>*/\n" + - "/**<SelectOnType:Field>*/\n" + - "/**<SelectOnField:Field#foo>*/\n" - ); - } - - public void test21() { - setUnit("Test.java", - "public class Test {\n" + - " void bar() {\n" + - " /**\n" + - " * @see Method#foo()\n" + - " */\n" + - " class Method {\n" + - " /**\n" + - " * @see #foo()\n" + - " * @see Method#foo()\n" + - " */\n" + - " void foo() {}\n" + - " }\n" + - " }\n" + - "}" - ); - findJavadoc("Method"); - findJavadoc("foo"); - findJavadoc("foo", 2); - findJavadoc("Method", 3); - findJavadoc("foo", 3); - assertValid( - "/**<SelectOnType:Method>*/\n" + - "/**<SelectOnMethod:Method#foo()>*/\n" + - "/**<SelectOnMethod:#foo()>*/\n" + - "/**<SelectOnType:Method>*/\n" + - "/**<SelectOnMethod:Method#foo()>*/\n" - ); - } - - public void test22() { - setUnit("Test.java", - "public class Test {\n" + - " void bar() {\n" + - " /**\n" + - " * @see Test\n" + - " * @see Other\n" + - " */\n" + - " class Other {}\n" + - " }\n" + - "}" - ); - findJavadoc("Test", 2); - findJavadoc("Other"); - assertValid( - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnType:Other>*/\n" - ); - } - - public void test23() { - setUnit("Test.java", - "public class Test {\n" + - " void bar() {\n" + - " new Object() {\n" + - " /**\n" + - " * @see Field#foo\n" + - " */\n" + - " class Field {\n" + - " /**\n" + - " * @see #foo\n" + - " * @see Field#foo\n" + - " */\n" + - " int foo;\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n" - ); - findJavadoc("Field"); - findJavadoc("foo"); - findJavadoc("foo", 2); - findJavadoc("Field", 3); - findJavadoc("foo", 3); - assertValid( - "/**<SelectOnType:Field>*/\n" + - "/**<SelectOnField:Field#foo>*/\n" + - "/**<SelectOnField:#foo>*/\n" + - "/**<SelectOnType:Field>*/\n" + - "/**<SelectOnField:Field#foo>*/\n" - ); - } - - public void test24() { - setUnit("Test.java", - "public class Test {\n" + - " void bar() {\n" + - " new Object() {\n" + - " /**\n" + - " * @see Method#foo()\n" + - " */\n" + - " class Method {\n" + - " /**\n" + - " * @see #foo()\n" + - " * @see Method#foo()\n" + - " */\n" + - " void foo() {}\n" + - " }\n" + - " };\n" + - " }\n" + - "}" - ); - findJavadoc("Method"); - findJavadoc("foo"); - findJavadoc("foo", 2); - findJavadoc("Method", 3); - findJavadoc("foo", 3); - assertValid( - "/**<SelectOnType:Method>*/\n" + - "/**<SelectOnMethod:Method#foo()>*/\n" + - "/**<SelectOnMethod:#foo()>*/\n" + - "/**<SelectOnType:Method>*/\n" + - "/**<SelectOnMethod:Method#foo()>*/\n" - ); - } - - public void test25() { - setUnit("Test.java", - "public class Test {\n" + - " void bar() {\n" + - " new Object() {\n" + - " /**\n" + - " * @see Test\n" + - " * @see Other\n" + - " */\n" + - " class Other {}\n" + - " };\n" + - " }\n" + - "}" - ); - findJavadoc("Test", 2); - findJavadoc("Other"); - assertValid( - "/**<SelectOnType:Test>*/\n" + - "/**<SelectOnType:Other>*/\n" - ); - } -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionTest.java index 3ac33c8..6ca4c85 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionTest.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionTest.java
@@ -10,15 +10,7 @@ *******************************************************************************/ package org.eclipse.wst.jsdt.core.tests.compiler.parser; -import junit.framework.Test; - public class SelectionTest extends AbstractSelectionTest { -static { -// TESTS_NUMBERS = new int[] { 53 }; -} -public static Test suite() { - return buildAllCompliancesTestSuite(SelectionTest.class); -} public SelectionTest(String testName) { super(testName); @@ -74,7 +66,7 @@ "var i = <SelectOnMessageSend:bb.foo()>;\n" + "" + ""; - String expectedReplacedSource = "bb.foo()"; + String expectedReplacedSource = "foo()"; String testName = "<select message send>"; int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); @@ -247,8 +239,9 @@ public void test05() { String str = - " function foo(){ \n" + - " System.out.println(\"hello\"); \n"; + "function foo(){ \n" + + " System.out.println(\"hello\"); \n" + + "}"; String selectionStartBehind = "System.out."; String selectionEndBehind = "println"; @@ -260,7 +253,7 @@ " <SelectOnMessageSend:System.out.println(\"hello\")>;\n" + "}\n" + ""; - String expectedReplacedSource = "System.out.println(\"hello\")"; + String expectedReplacedSource = "println(\"hello\")"; String testName = "<select message send>"; int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); @@ -290,7 +283,7 @@ String expectedUnitDisplayString = "<SelectOnMessageSend:System.out.println(\"hello\")>;\n" + ""; - String expectedReplacedSource = "System.out.println(\"hello\")"; + String expectedReplacedSource = "println(\"hello\")"; String testName = "<select message send>"; int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); @@ -324,9 +317,10 @@ String expectedUnitDisplayString = "function foo() {\n" + " <SelectOnMessageSend:System.out.println(\"hello\")>;\n" + + " ;\n" + "}\n" + ""; - String expectedReplacedSource = "System.out.println(\"hello\")"; + String expectedReplacedSource = "println(\"hello\")"; String testName = "<select message send with recovery before>"; int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); @@ -350,6 +344,7 @@ String str = " function foo(){ \n" + " this.bar(\"hello\"); \n" + + " }\n" + " function bar( s){ \n" + " return s.length(); \n" + " } \n" + @@ -365,6 +360,7 @@ " <SelectOnMessageSend:this.bar(\"hello\")>;\n" + "}\n" + "function bar(s) {\n" + + " return s.length();\n" + "}\n" + ""; String expectedReplacedSource = "this.bar(\"hello\")"; @@ -392,7 +388,7 @@ " var num = 0; \n" + " function foo(){ \n" + " var j = this.num; \n" + - ""; + " }"; String selectionStartBehind = "this."; String selectionEndBehind = "this.num"; @@ -400,7 +396,7 @@ String expectedCompletionNodeToString = "<SelectionOnFieldReference:this.num>"; String completionIdentifier = "num"; String expectedUnitDisplayString = - "var num;\n" + + "var num = 0;\n" + "function foo() {\n" + " var j = <SelectionOnFieldReference:this.num>;\n" + "}\n" + @@ -510,16 +506,16 @@ String selectionStartBehind = "new "; String selectionEndBehind = "new X"; - String expectedCompletionNodeToString = "<SelectOnAllocationExpression:new X(j)>"; + String expectedCompletionNodeToString = "<SelectOnAllocationExpression:new <SelectOnName:X>(j)>"; String completionIdentifier = "X"; String expectedUnitDisplayString = "function X(i) {\n" + - " }\n" + + "}\n" + "function foo() {\n" + - " var j;\n" + - " var x = <SelectOnAllocationExpression:new X(j)>;\n" + + " var j = 0;\n" + + " var x = <SelectOnAllocationExpression:new <SelectOnName:X>(j)>;\n" + "}\n"; - String expectedReplacedSource = "new X(j)"; + String expectedReplacedSource = NONE; String testName = "<select allocation>"; int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); @@ -601,13 +597,13 @@ String selectionStartBehind = "java.lang."; String selectionEndBehind = "java.lang.System"; - String expectedCompletionNodeToString = "<SelectOnName:java.lang.System>"; + String expectedCompletionNodeToString = "<SelectionOnFieldReference:java.lang.System>"; String completionIdentifier = "System"; String expectedUnitDisplayString = "function foo() {\n" + - " <SelectOnName:java.lang.System>;\n" + + " <SelectionOnFieldReference:java.lang.System>.out.println();\n" + "}\n"; - String expectedReplacedSource = "java.lang.System.out"; + String expectedReplacedSource = "System"; String testName = "<select qualified name receiver>"; int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); @@ -629,20 +625,20 @@ public void test14() { String str = - " int foo(){ \n" + + " function foo(){ \n" + " var sys = java.lang.System; \n" + "} \n"; String selectionStartBehind = "java.lang."; String selectionEndBehind = "java.lang.System"; - String expectedCompletionNodeToString = "<SelectOnName:java.lang.System>"; + String expectedCompletionNodeToString = "<SelectionOnFieldReference:java.lang.System>"; String completionIdentifier = "System"; String expectedUnitDisplayString = "function foo() {\n" + - " var sys = <SelectOnName:java.lang.System>;\n" + + " var sys = <SelectionOnFieldReference:java.lang.System>;\n" + "}\n"; - String expectedReplacedSource = "java.lang.System"; + String expectedReplacedSource = "System"; String testName = "<select qualified name>"; int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); @@ -777,424 +773,6 @@ testName); } /* - * Select anonymous type - */ -//public void test18() { -// -// String str = -// "public class X { \n" + -// " int foo(){ \n" + -// " new Object(){ \n" + -// " int bar(){} \n" + -// " } \n" + -// " } \n" + -// "} \n"; -// -// String selectionStartBehind = "new "; -// String selectionEndBehind = "new Object"; -// -// String expectedCompletionNodeToString = -// "<SelectOnAllocationExpression:new Object() {\n" + -// " () {\n" + -// " super();\n" + -// " }\n" + -// "}>"; -// String completionIdentifier = "Object"; -// String expectedUnitDisplayString = -// "public class X {\n" + -// " public X() {\n" + -// " }\n" + -// " int foo() {\n" + -// " <SelectOnAllocationExpression:new Object() {\n" + -// " () {\n" + -// " super();\n" + -// " }\n" + -// " }>;\n" + -// " }\n" + -// "}\n"; -// -// String expectedReplacedSource = "new Object()"; -// String testName = "<select anonymous type>"; -// -// int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); -// int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; -// -// this.checkMethodParse( -// str.toCharArray(), -// selectionStart, -// selectionEnd, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -/* - * Select cast type - */ -//public void test19() { -// -// String str = -// "public class X { \n" + -// " Object foo(){ \n" + -// " return (Object) this; \n" + -// " } \n" + -// " } \n" + -// "} \n"; -// -// String selectionStartBehind = "return ("; -// String selectionEndBehind = "return (Object"; -// -// String expectedCompletionNodeToString = "<SelectOnName:Object>"; -// String completionIdentifier = "Object"; -// String expectedUnitDisplayString = -// "public class X {\n" + -// " public X() {\n" + -// " }\n" + -// " Object foo() {\n" + -// " <SelectOnName:Object>;\n" + -// " }\n" + -// "}\n"; -// -// String expectedReplacedSource = "Object"; -// String testName = "<select cast type>"; -// -// int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); -// int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; -// -// this.checkMethodParse( -// str.toCharArray(), -// selectionStart, -// selectionEnd, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -/* - * Select package - */ -//public void test20() { -// -// String str = -// "package x.y.other; \n" + -// "public class X { \n" + -// " int foo(){ \n" + -// " } \n" + -// " } \n" + -// "} \n"; -// -// String selectionStartBehind = "x."; -// String selectionEndBehind = "x.y"; -// -// String expectedCompletionNodeToString = "<SelectOnPackage:x.y>"; -// String completionIdentifier = "y"; -// String expectedUnitDisplayString = -// "package <SelectOnPackage:x.y>;\n" + -// "public class X {\n" + -// " public X() {\n" + -// " }\n" + -// " int foo() {\n" + -// " }\n" + -// "}\n"; -// -// String expectedReplacedSource = "x.y.other"; -// String testName = "<select package>"; -// -// int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); -// int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; -// -// this.checkDietParse( -// str.toCharArray(), -// selectionStart, -// selectionEnd, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -///* -// * Select import -// */ -//public void test21() { -// -// String str = -// "import x.y.Other; \n" + -// "public class X { \n" + -// " int foo(){ \n" + -// " } \n" + -// " } \n" + -// "} \n"; -// -// String selectionStartBehind = "y."; -// String selectionEndBehind = "y.Other"; -// -// String expectedCompletionNodeToString = "<SelectOnImport:x.y.Other>"; -// String completionIdentifier = "Other"; -// String expectedUnitDisplayString = -// "import <SelectOnImport:x.y.Other>;\n" + -// "public class X {\n" + -// " public X() {\n" + -// " }\n" + -// " int foo() {\n" + -// " }\n" + -// "}\n"; -// -// String expectedReplacedSource = "x.y.Other"; -// String testName = "<select import>"; -// -// int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); -// int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; -// -// this.checkDietParse( -// str.toCharArray(), -// selectionStart, -// selectionEnd, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -///* -// * Select import on demand -// */ -//public void test22() { -// -// String str = -// "import x.y.other.*; \n" + -// "public class X { \n" + -// " int foo(){ \n" + -// " } \n" + -// " } \n" + -// "} \n"; -// -// String selectionStartBehind = "y."; -// String selectionEndBehind = "y.other"; -// -// String expectedCompletionNodeToString = "<SelectOnImport:x.y.other>"; -// String completionIdentifier = "other"; -// String expectedUnitDisplayString = -// "import <SelectOnImport:x.y.other>;\n" + -// "public class X {\n" + -// " public X() {\n" + -// " }\n" + -// " int foo() {\n" + -// " }\n" + -// "}\n"; -// -// String expectedReplacedSource = "x.y.other"; -// String testName = "<select import on demand>"; -// -// int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); -// int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; -// -// this.checkDietParse( -// str.toCharArray(), -// selectionStart, -// selectionEnd, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -/* - * Select array initializer type - */ -public void test23() { - - String str = - "public class X { \n" + - " int foo(){ \n" + - " String[] p = new String[]{\"Left\"};\n" + -// " } \n" + - " } \n" + - "} \n"; - - String selectionStartBehind = "new "; - String selectionEndBehind = "new String"; - String expectedCompletionNodeToString = "<SelectOnType:String>"; - String completionIdentifier = "String"; - String expectedUnitDisplayString = - "public class X {\n" + - " public X() {\n" + - " }\n" + - " int foo() {\n" + - " String[] p = <SelectOnType:String>;\n" + - " }\n" + - "}\n"; - - String expectedReplacedSource = "String"; - String testName = "<select array initializer type>"; - - int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); - int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; - - this.checkMethodParse( - str.toCharArray(), - selectionStart, - selectionEnd, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); -} -///* -// * Select nested type superclass with syntax error behind -// */ -//public void test24() { -// -// String str = -// "public class G { \n" + -// " void foo() { \n" + -// " class X { \n" + -// " class Y extends G { \n" + -// " int foo() \n" + -// " } \n" + -// " } \n" + -// " } \n" + -// "} \n"; -// -// String selectionStartBehind = "extends "; -// String selectionEndBehind = "extends G"; -// -// String expectedCompletionNodeToString = "<SelectOnType:G>"; -// -// String completionIdentifier = "G"; -// String expectedUnitDisplayString = -// "public class G {\n" + -// " public G() {\n" + -// " }\n" + -// " void foo() {\n" + -// " class X {\n" + -// " class Y extends <SelectOnType:G> {\n" + -// " Y() {\n" + -// " }\n" + -// " int foo() {\n" + -// " }\n" + -// " }\n" + -// " X() {\n" + -// " }\n" + -// " }\n" + -// " }\n" + -// "}\n"; -// -// String expectedReplacedSource = "G"; -// String testName = "<select nested type superclass>"; -// -// int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); -// int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; -// -// this.checkMethodParse( -// str.toCharArray(), -// selectionStart, -// selectionEnd, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -/* - * Select super - */ -//public void test25() { -// -// String str = -// "public class G { \n" + -// " Object foo() { \n" + -// " return super.foo(); \n" + -// " } \n" + -// "} \n"; -// -// String selectionStartBehind = "return "; -// String selectionEndBehind = "return super"; -// -// String expectedCompletionNodeToString = "<SelectOnSuper:super>"; -// -// String completionIdentifier = "super"; -// String expectedUnitDisplayString = -// "public class G {\n" + -// " public G() {\n" + -// " }\n" + -// " Object foo() {\n" + -// " <SelectOnSuper:super>;\n" + -// " }\n" + -// "}\n"; -// -// String expectedReplacedSource = "super"; -// String testName = "<select super>"; -// -// int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); -// int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; -// -// this.checkMethodParse( -// str.toCharArray(), -// selectionStart, -// selectionEnd, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -/* - * Select qualified super - */ -//public void test26() { -// -// String str = -// "public class G { \n" + -// " Object foo() { \n" + -// " new X(){ \n" + -// " Object bar(){ \n" + -// " return G.super.foo(); \n" + -// " } \n" + -// " } \n" + -// " } \n" + -// "} \n"; -// -// String selectionStartBehind = "G."; -// String selectionEndBehind = "G.super"; -// -// String expectedCompletionNodeToString = "<SelectOnQualifiedSuper:G.super>"; -// -// String completionIdentifier = "super"; -// String expectedUnitDisplayString = -// "public class G {\n" + -// " public G() {\n" + -// " }\n" + -// " Object foo() {\n" + -// " new X() {\n" + -// " () {\n" + -// " }\n" + -// " Object bar() {\n" + -// " <SelectOnQualifiedSuper:G.super>;\n" + -// " }\n" + -// " };\n" + -// " }\n" + -// "}\n"; -// String expectedReplacedSource = "G.super"; -// String testName = "<select qualified super>"; -// -// int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); -// int selectionEnd = str.indexOf(selectionEndBehind) + selectionEndBehind.length() - 1; -// -// this.checkMethodParse( -// str.toCharArray(), -// selectionStart, -// selectionEnd, -// expectedCompletionNodeToString, -// expectedUnitDisplayString, -// completionIdentifier, -// expectedReplacedSource, -// testName); -//} -/* * Select super constructor call */ //public void test27() { @@ -1452,7 +1030,7 @@ " var currentChar = <SelectOnMessageSend:\"hello\".toLowerCase()>;\n" + "}\n"; - String expectedReplacedSource = "\"hello\".toLowerCase()"; + String expectedReplacedSource = "toLowerCase()"; String testName = "<1FWT4AJ: ITPCOM:WIN98 - SelectionParser produces duplicate type declaration>"; int selectionStart = str.indexOf(selectionStartBehind) + selectionStartBehind.length(); @@ -1534,7 +1112,7 @@ String completionIdentifier = NONE; String expectedUnitDisplayString = "function foo() {\n" + - " var array;\n" + + " var array = new Object();\n" + " return array.length;\n" + "}\n"; @@ -2156,14 +1734,13 @@ String selection = "X"; - String expectedCompletionNodeToString = "<SelectOnAllocationExpression:new X()>" + String expectedCompletionNodeToString = "<SelectOnAllocationExpression:new <SelectOnName:X>()>" ; String completionIdentifier = "X"; String expectedUnitDisplayString = - "var x = <SelectOnAllocationExpression:new X()>\n" + - "\n"; - String expectedReplacedSource = "new X()"; + "var x = <SelectOnAllocationExpression:new <SelectOnName:X>()>;\n"; + String expectedReplacedSource = NONE; String testName = "<select anonymous type>"; int selectionStart = str.lastIndexOf(selection); @@ -2451,14 +2028,14 @@ String selection = "Sub"; - String expectedCompletionNodeToString = "<SelectOnAllocationExpression:new Test.Sub()>"; + String expectedCompletionNodeToString = "<SelectionOnFieldReference:Test.Sub>"; String completionIdentifier = "Sub"; String expectedUnitDisplayString = "function foo() {\n" + - " <SelectOnAllocationExpression:new Test.Sub()>;\n" + + " new <SelectionOnFieldReference:Test.Sub>();\n" + "}\n"; - String expectedReplacedSource = "new Test.Sub()"; + String expectedReplacedSource = "Sub"; String testName = "<select>"; int selectionStart = str.indexOf(selection); @@ -2505,16 +2082,21 @@ String completionIdentifier = "var1"; String expectedUnitDisplayString = "function foo() {\n" + - " var var1;\n" + - " var var2;\n" + - " <SelectOnName:var1>;\n" + - " {\n" + - " var var3;\n" + - " }\n" + - " {\n" + - " var var3;\n" + - " }\n" + - " var var4;\n" + + " var var1 = new Object();\n" + + " var var2 = 1;\n" + + " <SelectOnName:var1>.toString();\n" + + " var2 ++;\n" + + " if ((var2 == 3))\n" + + " {\n" + + " var var3 = var1;\n" + + " var3.hashCode();\n" + + " }\n" + + " else\n" + + " {\n" + + " var var3 = new Object();\n" + + " var3.toString();\n" + + " }\n" + + " var var4 = 1;\n" + "}\n"; String expectedReplacedSource = "var1";
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionTest2.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionTest2.java deleted file mode 100644 index 8ca4666..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionTest2.java +++ /dev/null
@@ -1,229 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import java.util.Locale; - -import org.eclipse.wst.jsdt.core.compiler.CharOperation; -import org.eclipse.wst.jsdt.internal.codeassist.select.SelectionParser; -import org.eclipse.wst.jsdt.internal.codeassist.select.SelectionScanner; -import org.eclipse.wst.jsdt.internal.compiler.CompilationResult; -import org.eclipse.wst.jsdt.internal.compiler.DefaultErrorHandlingPolicies; -import org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration; -import org.eclipse.wst.jsdt.internal.compiler.ast.ASTNode; -import org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration; -import org.eclipse.wst.jsdt.internal.compiler.ast.FieldDeclaration; -import org.eclipse.wst.jsdt.internal.compiler.ast.Initializer; -import org.eclipse.wst.jsdt.internal.compiler.ast.TypeDeclaration; -import org.eclipse.wst.jsdt.internal.compiler.batch.CompilationUnit; -import org.eclipse.wst.jsdt.internal.compiler.env.ICompilationUnit; -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; -import org.eclipse.wst.jsdt.internal.compiler.problem.DefaultProblemFactory; -import org.eclipse.wst.jsdt.internal.compiler.problem.ProblemReporter; - -public class SelectionTest2 extends AbstractSelectionTest { - -public SelectionTest2(String testName) { - super(testName); -} -boolean thereWasAnNPE = false; -private class SpecialSelectionParser extends SelectionParser { - public SpecialSelectionParser(ProblemReporter problemReporter) { - super(problemReporter); - } - public void doNPEInParser(){ - this.stack = null; - } -} - - SpecialSelectionParser createParser(){ - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - SpecialSelectionParser parser = - new SpecialSelectionParser( - new ProblemReporter( - DefaultErrorHandlingPolicies.proceedWithAllProblems(), - options, - new DefaultProblemFactory(Locale.getDefault()))); - return parser; -} -void checkMethodParse( - SelectionParser parser, - char[] source, - int selectionStart, - int selectionEnd, - String expectedSelection, - String expectedUnitToString, - String expectedSelectionIdentifier, - String expectedSelectedSource, - - String testName) { - - ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); - CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0); - - CompilationUnitDeclaration unit = parser.dietParse(sourceUnit, compilationResult, selectionStart, selectionEnd); - - ASTNode foundMethod = null; - if (unit.types != null) { - for (int i = 0; i < unit.types.length; i++) { - TypeDeclaration type = unit.types[i]; - ASTNode method = findMethod(type, selectionStart); - if (method != null) { - foundMethod = method; - break; - } - } - } - assertTrue("no method found at cursor location", foundMethod != null); - if (foundMethod instanceof AbstractMethodDeclaration) { - parser.parseBlockStatements((AbstractMethodDeclaration)foundMethod, unit); - } else { - TypeDeclaration type = (TypeDeclaration)foundMethod; - if (type.fields != null) { - for (int i = 0; i < type.fields.length; i++) { - FieldDeclaration field = type.fields[i]; - if (field instanceof Initializer && field.sourceStart <= selectionStart && selectionStart <= field.sourceEnd) { - parser.parseBlockStatements((Initializer)field, type, unit); - break; - } - } - } - } - - String computedUnitToString = unit.toString(); - //System.out.println(computedUnitToString); - //System.out.println(Util.displayString(computedUnitToString)); - //System.out.println(expectedUnitToString); - - String computedCompletion = parser.assistNode == null - ? NONE - : parser.assistNode.toString(); - assertEquals( - "invalid selection node-" + testName, - expectedSelection, - computedCompletion); - - assertEquals( - "invalid selection location-"+testName, - expectedUnitToString, - computedUnitToString); - - if (expectedSelectionIdentifier != null){ - char[] chars = ((SelectionScanner)parser.scanner).selectionIdentifier; - String computedSelectionIdentifier = chars == null ? NONE : new String(chars); - assertEquals( - "invalid selection identifier-" + testName, - expectedSelectionIdentifier, - computedSelectionIdentifier); - } - if (expectedSelectedSource != null){ - char[] chars = null; - if (parser.assistNode != null){ - chars = CharOperation.subarray( - parser.scanner.source, - parser.assistNode.sourceStart, - parser.assistNode.sourceEnd + 1); - } else { - if (parser.assistIdentifier() != null){ - if (((SelectionScanner)parser.scanner).selectionEnd - >= ((SelectionScanner)parser.scanner).selectionStart){ - chars = CharOperation.subarray( - parser.scanner.source, - ((SelectionScanner)parser.scanner).selectionStart, - ((SelectionScanner)parser.scanner).selectionEnd + 1); - } - } - } - String computedReplacedSource = chars == null ? NONE : new String(chars); - assertEquals( - "invalid replaced source-" + testName, - expectedSelectedSource, - computedReplacedSource); - } -} -/* - * http://dev.eclipse.org/bugs/show_bug.cgi?id=30946 - */ -public void testBug30946() { - final SpecialSelectionParser parser = createParser(); - Thread query = new Thread( - new Runnable(){ - public void run(){ - String str = - "public class A {\n" + - " void foo() {\n" + - " if (true) {\n" + - " if()\n" + - " switch (1) {\n" + - " case A.B:\n" + - " C d= (C) s;\n" + - " here\n" + - " }\n" + - " }\n" + - " }\n" + - "}n"; - - String selection = "here"; - - String expectedCompletionNodeToString = "<SelectOnName:here>"; - - String completionIdentifier = "here"; - String expectedUnitDisplayString = - "public class A {\n" + - " public A() {\n" + - " }\n" + - " void foo() {\n" + - " {\n" + - " {\n" + - " C d;\n" + - " <SelectOnName:here>;\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - String expectedReplacedSource = "here"; - String testName = "<inifinite loop test>"; - - int selectionStart = str.lastIndexOf(selection); - int selectionEnd = str.lastIndexOf(selection) + selection.length() - 1; - - try { - SelectionTest2.this.checkMethodParse( - parser, - str.toCharArray(), - selectionStart, - selectionEnd, - expectedCompletionNodeToString, - expectedUnitDisplayString, - completionIdentifier, - expectedReplacedSource, - testName); - } catch (NullPointerException e) { - SelectionTest2.this.thereWasAnNPE = true; - } - } - }); - - query.start(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - } - // force parser to stop - parser.doNPEInParser(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - } - assertTrue("there is an infinite loop", !thereWasAnNPE); - -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionTest3.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionTest3.java new file mode 100644 index 0000000..af85cc5 --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SelectionTest3.java
@@ -0,0 +1,176 @@ +/******************************************************************************* + * Copyright (c) 2012 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.wst.jsdt.core.tests.compiler.parser; + +import java.io.ByteArrayInputStream; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IProjectDescription; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.wst.jsdt.core.IJavaScriptElement; +import org.eclipse.wst.jsdt.core.IJavaScriptUnit; +import org.eclipse.wst.jsdt.core.JavaScriptCore; + +public class SelectionTest3 extends AbstractSelectionTest { +private String fContents1 = "/*\n" + +" * Attempt content assist on each function, verify that the proposal shows up, that\n" + +" * camel case CA works, the the propsoal looks correct, the proposal info is displayed,\n" + +" * that occurance support works, that F3 works, that hover help is displayed, and that\n" + +" * the function is correctly displayed in the outline.\n" + +" * \n" + +" * Also test out local functions, check functions that mask global functions. Try out\n" + +" * F3 and occurance support on function calls that have different parameter numbers than\n" + +" * the declared function.\n" + +" */\n" + +"\n" + +"function zooKeeper() {\n" + +" \n" + +"}\n" + +"\n" + +"/**\n" + +" * Some doc about zooKeeper1, can you see it?\n" + +" */\n" + +"function zooKeeper1() {\n" + +" \n" + +"}\n" + +"\n" + +"function zooKeeper2() {\n" + +" return \"zoo\";\n" + +"}\n" + +"\n" + +"/**\n" + +" * \n" + +" * @returns {Boolean}\n" + +" */\n" + +"function zooKeeper3() {\n" + +" return a;\n" + +"}\n" + +"\n" + +"function zooKeeper4(a, b) {\n" + +" \n" + +"}\n" + +"\n" + +"/**\n" + +" * Some doc about zooKeeper5\n" + +" * \n" + +" * @param {String} a\n" + +" * @param {Number} b\n" + +" */\n" + +"function zooKeeper5(a, b) {\n" + +"}\n" + +"\n" + +"function zooKeeper6(a) {\n" + +" return true;\n" + +"}\n" + +"\n" + +"/**\n" + +" * hi\n" + +" * @param {Date} a\n" + +" * @returns {Date}\n" + +" */\n" + +"function zooKeeper7(a) {\n" + +" return a;\n" + +"}\n" + +"\n" + +"zooKeeper();\n" + +"zooKeeper(1);\n" + +"zooKeeper1();\n" + +"zooKeeper2();\n" + +"zooKeeper3();\n" + +"zooKeeper4(1, 3);\n" + +"zooKeeper5(\"hi\", 3);\n" + +"zooKeeper6(1);\n" + +"zooKeeper7(new Date());\n" + +"zooKeeper7();\n" + +"\n" + +"function local1() {\n" + +" /**\n" + +" * hi\n" + +" */\n" + +" function zooKeeper7() {}\n" + +" function zooKeeper8(a) {}\n" + +" \n" + +" zooKeeper7();\n" + +"}\n"; + +static { +// TESTS_NUMBERS = new int[] { 53 }; +} +//public static Test suite() { +// return buildAllCompliancesTestSuite(SelectionTest3.class); +//} + +public SelectionTest3(String testName) { + super(testName); +} +/** + * @param string + */ +private IJavaScriptUnit getUnit(String string) throws Exception { + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("SelectionTest3_" + getName()); + IProjectDescription description = ResourcesPlugin.getWorkspace().newProjectDescription("SelectionTest3_" + getName()); + description.setNatureIds(new String[]{JavaScriptCore.NATURE_ID}); + project.create(description, null); + project.open(null); + IFile file = project.getFile("testfile.js"); + file.create(new ByteArrayInputStream(string.getBytes()), true, null); + return (IJavaScriptUnit) JavaScriptCore.create(file); +} + +public void test01() throws Exception { + IJavaScriptUnit unit = getUnit(fContents1); + + int offset = fContents1.indexOf("zooKeeper();\n"); + IJavaScriptElement[] selected = unit.codeSelect(offset, 9); + assertEquals("unexpected number of elements", 1, selected.length); + assertEquals("unexpected element", "zooKeeper", selected[0].getElementName()); + assertEquals("unexpected element type", IJavaScriptElement.METHOD, selected[0].getElementType()); +} +public void test02() throws Exception { + IJavaScriptUnit unit = getUnit(fContents1); + + int offset = fContents1.indexOf("zooKeeper2();\n"); + IJavaScriptElement[] selected = unit.codeSelect(offset, 10); + assertEquals("unexpected number of elements", 1, selected.length); + assertEquals("unexpected element", "zooKeeper2", selected[0].getElementName()); + assertEquals("unexpected element type", IJavaScriptElement.METHOD, selected[0].getElementType()); +} +public void test03() throws Exception { + IJavaScriptUnit unit = getUnit(fContents1); + + int offset = fContents1.indexOf("zooKeeper3();\n"); + IJavaScriptElement[] selected = unit.codeSelect(offset, 10); + assertEquals("unexpected number of elements", 1, selected.length); + assertEquals("unexpected element", "zooKeeper3", selected[0].getElementName()); + assertEquals("unexpected element type", IJavaScriptElement.METHOD, selected[0].getElementType()); +} +public void test04() throws Exception { + IJavaScriptUnit unit = getUnit(fContents1); + + int offset = fContents1.indexOf("zooKeeper5(\"hi"); + IJavaScriptElement[] selected = unit.codeSelect(offset, 10); + assertEquals("unexpected number of elements", 1, selected.length); + assertEquals("unexpected element", "zooKeeper5", selected[0].getElementName()); + assertEquals("unexpected element type", IJavaScriptElement.METHOD, selected[0].getElementType()); +} +public void test05() throws Exception { + IJavaScriptUnit unit = getUnit(fContents1); + + int offset = fContents1.indexOf("zooKeeper6(1"); + IJavaScriptElement[] selected = unit.codeSelect(offset, 10); + assertEquals("unexpected number of elements", 1, selected.length); + assertEquals("unexpected element", "zooKeeper6", selected[0].getElementName()); + assertEquals("unexpected element type", IJavaScriptElement.METHOD, selected[0].getElementType()); +} + +}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SingleCompletionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SingleCompletionTest.java deleted file mode 100644 index afccb6a..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SingleCompletionTest.java +++ /dev/null
@@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import java.lang.reflect.InvocationTargetException; - -import junit.framework.TestCase; - -/** - * Only 1 test should be in this class - */ -public class SingleCompletionTest extends AbstractCompletionTest { -/** - * SingleCompletionTest constructor comment. - * @param testName java.lang.String - */ -public SingleCompletionTest(String testName) { - super(testName); -} -private void run(Class testClass, String methodName) { - try { - java.lang.reflect.Constructor constructor = testClass.getDeclaredConstructor(new Class[] {String.class}); - TestCase test = (TestCase)constructor.newInstance(new Object[] {"single completion test"}); - java.lang.reflect.Method method = testClass.getDeclaredMethod(methodName, new Class[] {}); - method.invoke(test, new Object[] {}); - } catch (InstantiationException e) { - e.printStackTrace(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } catch (NoSuchMethodException e) { - e.printStackTrace(); - } catch (InvocationTargetException e) { - Throwable target = e.getTargetException(); - if (target instanceof RuntimeException) { - throw (RuntimeException)target; - } - if (target instanceof Error) { - throw (Error)target; - } - throw new Error(target.getMessage()); - } -} -/* - * The test. - */ -public void test() { - run(NameReferenceCompletionTest.class, "testMethodInvocationAnonymousInnerClass2"); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceElementParserTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceElementParserTest.java deleted file mode 100644 index feafab8..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceElementParserTest.java +++ /dev/null
@@ -1,5261 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import java.util.Locale; - -import org.eclipse.wst.jsdt.core.compiler.CategorizedProblem; -import org.eclipse.wst.jsdt.core.compiler.CharOperation; -import org.eclipse.wst.jsdt.core.tests.util.AbstractCompilerTest; -import org.eclipse.wst.jsdt.internal.compiler.ISourceElementRequestor; -import org.eclipse.wst.jsdt.internal.compiler.SourceElementParser; -import org.eclipse.wst.jsdt.internal.compiler.batch.CompilationUnit; -import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.wst.jsdt.internal.compiler.env.ICompilationUnit; -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; -import org.eclipse.wst.jsdt.internal.compiler.problem.DefaultProblemFactory; - -public class SourceElementParserTest extends AbstractCompilerTest implements ISourceElementRequestor { - private SourceUnit currentUnit; - private SourceType currentType; - private SourceMethod currentMethod; - private SourceField currentField; - private SourceInitializer currentInitializer; - private char[] source; - private SourcePackage currentPackage; - private SourceImport[] currentImports; - private int numberOfImports; -public SourceElementParserTest(String testName) { - super(testName); -} -public SourceElementParserTest(String testName, char[] source) { - super(testName); - this.source = source; -} -/** - * acceptConstructorReference method comment. - */ -public void acceptConstructorReference(char[] typeName, int argCount, int sourcePosition) { - if (currentMethod == null) { - if (currentType != null) { - StringBuffer buffer = new StringBuffer(); - buffer.append(typeName).append("(").append(argCount).append(")\n"); - currentType.setDefaultConstructor(buffer.toString()); - } - return; - } - if (currentMethod.isConstructor()) { - StringBuffer buffer = new StringBuffer(); - buffer.append(typeName).append("(").append(argCount).append(")\n"); - currentMethod.setExplicitConstructorCall(buffer.toString()); - } else { - if (currentType != null) { - StringBuffer buffer = new StringBuffer(); - buffer.append(typeName).append("(").append(argCount).append(")\n"); - currentType.setDefaultConstructor(buffer.toString()); - } - } -} -/** - * acceptFieldReference method comment. - */ -public void acceptFieldReference(char[] fieldName, int sourcePosition) {} -/** - * acceptImport method comment. - */ -public void acceptImport( - int declarationStart, - int declarationEnd, - char[][] tokens, - boolean onDemand) { - - addImport( - new SourceImport(declarationStart, declarationEnd, CharOperation.concatWith(tokens, '.'), onDemand, source)); -} -/** - * acceptLineSeparatorPositions method comment. - */ -public void acceptLineSeparatorPositions(int[] positions) {} -/** - * acceptMethodReference method comment. - */ -public void acceptMethodReference(char[] methodName, int argCount, int sourcePosition) {} -/** - * acceptPackage method comment. - */ -public void acceptPackage( - int declarationStart, - int declarationEnd, - char[] name) { - - currentPackage = - new SourcePackage(declarationStart, declarationEnd, name, source); -} -/** - * acceptProblem method comment. - */ -public void acceptProblem(CategorizedProblem problem) {} -/** - * acceptTypeReference method comment. - */ -public void acceptTypeReference(char[][] typeName, int sourceStart, int sourceEnd) {} -/** - * acceptTypeReference method comment. - */ -public void acceptTypeReference(char[] typeName, int sourcePosition) {} -/** - * acceptUnknownReference method comment. - */ -public void acceptUnknownReference(char[][] name, int sourceStart, int sourceEnd) {} -/** - * acceptUnknownReference method comment. - */ -public void acceptUnknownReference(char[] name, int sourcePosition) {} -protected void addImport(SourceImport sourceImport) { - if (currentImports == null) { - currentImports = new SourceImport[4]; - } - - if (numberOfImports == currentImports.length) { - System.arraycopy( - currentImports, - 0, - currentImports = new SourceImport[numberOfImports * 2], - 0, - numberOfImports); - } - currentImports[numberOfImports++] = sourceImport; -} -public void dietParse(String s, String testName) { - this.dietParse(s, testName, false); -} -public void dietParse(String s, String testName, boolean recordLocalDeclaration) { - - - this.source = s.toCharArray(); - reset(); - SourceElementParser parser = - new SourceElementParser( - this, - new DefaultProblemFactory(Locale.getDefault()), - new CompilerOptions(getCompilerOptions()), - recordLocalDeclaration/*don't record local declarations*/, - true/*optimize string literals*/); - - ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); - - parser.parseCompilationUnit(sourceUnit, false); - -} -public static String displayModifiers(int modifiers) { - StringBuffer buffer = new StringBuffer(); - - if ((modifiers & ClassFileConstants.AccPublic) != 0) - buffer.append("public "); - if ((modifiers & ClassFileConstants.AccProtected) != 0) - buffer.append("protected "); - if ((modifiers & ClassFileConstants.AccPrivate) != 0) - buffer.append("private "); - if ((modifiers & ClassFileConstants.AccFinal) != 0) - buffer.append("final "); - if ((modifiers & ClassFileConstants.AccStatic) != 0) - buffer.append("static "); - if ((modifiers & ClassFileConstants.AccAbstract) != 0) - buffer.append("abstract "); - if ((modifiers & ClassFileConstants.AccNative) != 0) - buffer.append("native "); - return buffer.toString(); -} -public void enterType(TypeInfo typeInfo) { - if (currentType == null) { - // top level type - currentType = - new SourceType( - null, - typeInfo.declarationStart, - typeInfo.modifiers, - typeInfo.name, - typeInfo.nameSourceStart, - typeInfo.nameSourceEnd, - typeInfo.superclass, - source); - currentType.setPackage(currentPackage); - setImports(); - } else { - // member type - SourceType memberType; - currentType.addMemberType( - memberType = - new SourceType( - currentType.getName(), - typeInfo.declarationStart, - typeInfo.modifiers, - typeInfo.name, - typeInfo.nameSourceStart, - typeInfo.nameSourceEnd, - typeInfo.superclass, - source)); - memberType.parent = currentType; - currentType = memberType; - } -} -public void enterCompilationUnit() { - currentUnit=new SourceUnit(); -} -public void enterConstructor(MethodInfo methodInfo) { - enterAbtractMethod(methodInfo); -} -public void enterField(FieldInfo fieldInfo) { - if (currentType!=null) - { - - currentType.addField( - currentField = - new SourceField( - fieldInfo.declarationStart, - fieldInfo.modifiers, - fieldInfo.type, - fieldInfo.name, - fieldInfo.nameSourceStart, - fieldInfo.nameSourceEnd, - source)); - }else{ - currentUnit.addField( - currentField = - new SourceField( - fieldInfo.declarationStart, - fieldInfo.modifiers, - fieldInfo.type, - fieldInfo.name, - fieldInfo.nameSourceStart, - fieldInfo.nameSourceEnd, - source)); - - - } -} -public void enterInitializer(int declarationSourceStart, int modifiers) { - currentType.addField( - currentInitializer = new SourceInitializer( - declarationSourceStart, - modifiers)); -} -public void exitInitializer(int declarationSourceEnd) { - currentInitializer.setDeclarationSourceEnd(declarationSourceEnd); -} -public void enterMethod(MethodInfo methodInfo) { - enterAbtractMethod(methodInfo); -} -protected void enterAbtractMethod(MethodInfo methodInfo) { - if (currentMethod!=null) - { - SourceMethod memberMethod; - currentMethod.addMemberMethod( - memberMethod = - new SourceMethod( - methodInfo.declarationStart, - methodInfo.modifiers, - methodInfo.returnType, - methodInfo.name, // null for constructors - methodInfo.nameSourceStart, - methodInfo.nameSourceEnd, - methodInfo.parameterTypes, - methodInfo.parameterNames, - source)); - memberMethod.parent = currentMethod; - currentMethod = memberMethod; - - } - else if (currentType!=null) - { - currentType.addMethod( - currentMethod = - new SourceMethod( - methodInfo.declarationStart, - methodInfo.modifiers, - methodInfo.returnType, - methodInfo.name, // null for constructors - methodInfo.nameSourceStart, - methodInfo.nameSourceEnd, - methodInfo.parameterTypes, - methodInfo.parameterNames, - source)); - - } - else - { - currentUnit.addMethod( - currentMethod = - new SourceMethod( - methodInfo.declarationStart, - methodInfo.modifiers, - methodInfo.returnType, - methodInfo.name, // null for constructors - methodInfo.nameSourceStart, - methodInfo.nameSourceEnd, - methodInfo.parameterTypes, - methodInfo.parameterNames, - source)); - - } -} -public void exitType(int declarationEnd) { - currentType.setDeclarationSourceEnd(declarationEnd); - if (currentType.parent != null) { - currentType = currentType.parent; - } -} -public void exitCompilationUnit(int declarationEnd) {} -public void exitConstructor(int declarationEnd) { - exitAbstractMethod(declarationEnd); -} -public void exitField(int initializationStart, int declarationEnd, int declarationSourceEnd) { - currentField.setDeclarationSourceEnd(declarationEnd); -} -public void exitMethod(int declarationEnd, int defaultValueStart, int defaultValueEnd) { - exitAbstractMethod(declarationEnd); -} -protected void exitAbstractMethod(int declarationEnd) { - currentMethod.setDeclarationSourceEnd(declarationEnd); - currentMethod=currentMethod.parent; -} -public void fullParse(String s, String testName) { - this.fullParse(s, testName, false); -} -public void fullParse(String s, String testName, boolean recordLocalDeclaration) { - this.source = s.toCharArray(); - reset(); - SourceElementParser parser = - new SourceElementParser( - this, new DefaultProblemFactory(Locale.getDefault()), - new CompilerOptions(getCompilerOptions()), - recordLocalDeclaration/*don't record local declarations*/, - true/*optimize string literals*/); - - ICompilationUnit sourceUnit = new CompilationUnit(source, testName, null); - - parser.parseCompilationUnit(sourceUnit, true); -} -public void reset() { - currentType = null; - currentUnit = null; - currentMethod = null; - currentField = null; - currentPackage = null; - currentImports = null; - numberOfImports = 0; -} -public void setImports() { - if (currentImports == null) - return; - if (numberOfImports != currentImports.length) { - System.arraycopy( - currentImports, - 0, - currentImports = new SourceImport[numberOfImports], - 0, - numberOfImports); - } - currentType.setImports(currentImports); -} -//public void test00() { -// -// String s = -// "i=0;" -// + "\n"; -// -// String expectedUnitToString = -// "i=0;\n" -// + " "; -// -// String testName = "test00: full parse"; -// fullParse(s,testName); -//// -//// assertEquals( -//// "Invalid class declarationSourceStart ", -//// 52, -//// currentType.getDeclarationSourceStart()); -//// -//// assertEquals( -//// "Invalid class declarationSourceEnd ", -//// 178, -//// currentType.getDeclarationSourceEnd()); -//// -//// SourceField[] fields = currentType.getFields(); -//// assertTrue(" invalid fields ", fields != null); -//// assertEquals("Invalid fields length ", 2, fields.length); -//// -//// assertEquals("Invalid declaration source start for field h", 105, fields[0].getDeclarationSourceStart()); -//// assertEquals("Invalid declaration source end for field h", 117, fields[0].getDeclarationSourceEnd()); -//// -//// assertEquals("Invalid declaration source start for field i", 119, fields[1].getDeclarationSourceStart()); -//// assertEquals("Invalid declaration source end for field i", 144, fields[1].getDeclarationSourceEnd()); -//// -//// SourceMethod[] methods = currentType.getMethods(); -//// assertTrue(" invalid methods ", methods != null); -//// assertEquals("Invalid methods length ", 3, methods.length); -//// -//// assertEquals("Invalid declaration source start for method foo", 69, methods[0].getDeclarationSourceStart()); -//// assertEquals("Invalid declaration source end for method foo", 103, methods[0].getDeclarationSourceEnd()); -//// -//// assertEquals("Invalid declaration source start for method bare", 147, methods[1].getDeclarationSourceStart()); -//// assertEquals("Invalid declaration source end for method bare", 163, methods[1].getDeclarationSourceEnd()); -//// -//// assertEquals("Invalid declaration source start for method truc", 164, methods[2].getDeclarationSourceStart()); -//// assertEquals("Invalid declaration source end for method truc", 177, methods[2].getDeclarationSourceEnd()); -//// -//// assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); -//// -//// assertEquals(" Invalid actual name for method bare", "bar" + "\\" + "u0065", methods[1].getActualName()); -// -// assertEquals( -// "Invalid source " + testName, -// expectedUnitToString, -// currentUnit.toString()); -//} - -public void test01() { - - String s = - "function foo() {\n" - + "System.out.println();\n" - + "}\n" - + "var h;\n" - + "var i ;\n" - + "\n" - + "function bar" + "\\" + "u0065(){}\n" - + "function truc(){}\n" - + "\n"; - - String expectedUnitToString = - "\tvar h;\n" - + "\tvar i;\n" - + "\tfunction foo() {}\n" - + "\tfunction bare() {}\n" - + "\tfunction truc() {}\n" - + ""; - - String testName = "test01: full parse"; - fullParse(s,testName); - - currentUnit.toString(); - SourceField[] fields = currentUnit.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("Invalid fields length ", 2, fields.length); - - assertEquals("Invalid declaration source start for field h", 41, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field h",46 , fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field i", 48, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field i", 54, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentUnit.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("Invalid methods length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 0, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 39, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bare", 57, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bare", 78, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 80, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 96, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bare", "bar" + "\\" + "u0065", methods[1].getActualName()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentUnit.toString()); -} - - -public void test02() { - - String s = - "/** javadoc comment */\n" - + "function ss()" - + "\n"; - - String expectedUnitToString = - "\tfunction ss() {}\n" - + ""; - - String testName = "test02: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentUnit.getDeclarationSourceStart()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentUnit.toString()); -} -public void test03() { - - String s = - "function X() {\n" - + " this.h=1;\n" - + " this.i=[];\n" - + "}\n" - + "function X_foo() {\n" - + "}\n" - + "X.prototype.foo=X_foo;\n" - + ""; - - String expectedUnitToString = - "class X extends Object {\n" - + " var h;\n" - + " var i;\n" - + " function foo() {}\n" - + " function X() {}\n" - + "}" - + ""; - - String testName = "test03: diet parse"; - dietParse(s,testName); - -// assertEquals( -// "Invalid class declarationSourceStart ", -// 52, -// currentType.getDeclarationSourceStart()); -// -// assertEquals( -// "Invalid class declarationSourceEnd ", -// 178, -// currentType.getDeclarationSourceEnd()); -// - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("Invalid fields length ", 2, fields.length); - -// assertEquals("Invalid declaration source start for field h", 105, fields[0].getDeclarationSourceStart()); -// assertEquals("Invalid declaration source end for field h", 117, fields[0].getDeclarationSourceEnd()); -// -// assertEquals("Invalid declaration source start for field i", 119, fields[1].getDeclarationSourceStart()); -// assertEquals("Invalid declaration source end for field i", 144, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("Invalid methods length ", 2, methods.length); - -// assertEquals("Invalid declaration source start for method foo", 69, methods[0].getDeclarationSourceStart()); -// assertEquals("Invalid declaration source end for method foo", 103, methods[0].getDeclarationSourceEnd()); -// -// assertEquals("Invalid declaration source start for method bar", 147, methods[1].getDeclarationSourceStart()); -// assertEquals("Invalid declaration source end for method bar", 163, methods[1].getDeclarationSourceEnd()); -// -// assertEquals("Invalid declaration source start for method truc", 164, methods[2].getDeclarationSourceStart()); -// assertEquals("Invalid declaration source end for method truc", 177, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "X_foo", methods[0].getActualName()); - assertEquals(" Invalid name for method foo", "foo", new String(methods[0].getSelector())); - -// assertEquals(" Invalid actual name for method bare", "bar" + "\\" + "u0065", methods[1].getActualName()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test04() { - - String s = - "package a; \n" - + "import java.lang.*; \n" - + "import java.util.*; \n" - + " \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " \n" - + " class L { \n" - + " void baz(){} \n" - + " } \n" - + " \n" - + " public int h; \n" - + " public int[] i = { 0, 1 }; \n" - + " \n" - + " void bar(){ \n" - + " void truc(){ \n" - + "} \n"; - - String expectedUnitToString = - "package a;\n" - + "import java.lang.*;\n" - + "import java.util.*;\n" - + "public class X {\n" - + "\tpublic int h;\n" - + "\tpublic int[] i;\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - String testName = "test04: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 89, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 372, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("Invalid fields length ", 2, fields.length); - - assertEquals("Invalid declaration source start for field h", 248, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field h", 260, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field i", 271, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field i", 296, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("Invalid methods length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 115, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 222, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 317, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 337, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 339, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 360, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test05() { - - String s = - "package a; \n" - + "import java.lang.*; \n" - + "import java.util.*; \n" - + " \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " \n" - + " class L { \n" - + " void baz(){} \n" - + " } \n" - + " \n" - + " public int h; \n" - + " public int[] i = { 0, 1 }; \n" - + " \n" - + " void bar(){ \n" - + " void truc(){ \n" - + "} \n"; - - String expectedUnitToString = - "package a;\n" - + "import java.lang.*;\n" - + "import java.util.*;\n" - + "public class X {\n" - + "\tpublic int h;\n" - + "\tpublic int[] i;\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test05: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 89, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 372, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("Invalid fields length ", 2, fields.length); - - assertEquals("Invalid declaration source start for field h", 248, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field h", 260, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field i", 271, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field i", 296, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("Invalid methods length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 115, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 222, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 317, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 337, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 339, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 360, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test06() { - - String s = - "package a; \n" - + "import java.lang.*; \n" - + "import java.util.*; \n" - + " \n" - + "public class X { \n" - + " X x; \n" - + " Object a, b = null; \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " \n" - + " public int h; \n" - + " public int[] i = { 0, 1 }; \n" - + " \n" - + " void bar(){ \n" - + " void truc(){ \n" - + "} \n"; - - String expectedUnitToString = - "package a;\n" - + "import java.lang.*;\n" - + "import java.util.*;\n" - + "public class X {\n" - + "\tX x;\n" - + "\tObject a;\n" - + "\tObject b;\n" - + "\tpublic int h;\n" - + "\tpublic int[] i;\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test06: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 89, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 347, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("Invalid fields length ", 5, fields.length); - - assertEquals("Invalid declaration source start for field x", 115, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 118, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field a", 131, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field a", 139, fields[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field b", 131, fields[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field b", 149, fields[2].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field h", 223, fields[3].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field h", 235, fields[3].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field i", 246, fields[4].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field i", 271, fields[4].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("Invalid methods length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 159, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 221, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 292, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 312, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 314, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 335, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test07() { - - String s = - "package a; \n" - + "import java.lang.*; \n" - + "import java.util.*; \n" - + " \n" - + "public class X { \n" - + " X x; \n" - + " Object a, b = null; \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " \n" - + " public int h; \n" - + " public int[] i = { 0, 1 }; \n" - + " \n" - + " void bar(){ \n" - + " void truc(){ \n" - + "} \n"; - - String expectedUnitToString = - "package a;\n" - + "import java.lang.*;\n" - + "import java.util.*;\n" - + "public class X {\n" - + "\tX x;\n" - + "\tObject a;\n" - + "\tObject b;\n" - + "\tpublic int h;\n" - + "\tpublic int[] i;\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test07: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 89, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 347, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("Invalid fields length ", 5, fields.length); - - assertEquals("Invalid declaration source start for field xh", 115, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 118, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field a", 131, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field a", 139, fields[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field b", 131, fields[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field b", 149, fields[2].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field h", 223, fields[3].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field h", 235, fields[3].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field i", 246, fields[4].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field i", 271, fields[4].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("Invalid methods length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 159, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 221, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 292, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 312, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 314, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 335, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test08() { - - String s = - "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " void baz(){} \n" - + " } \n" - + " \n" - + " void bar(){ \n" - + " } \n" - + " void truc(){ \n" - + " } \n" - + "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test08: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 198, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("Invalid methods length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 100, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 127, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 149, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 163, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 185, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test09() { - - String s = - "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " void baz(){} \n" - + " } \n" - + " \n" - + " void bar(){ \n" - + " } \n" - + " void truc(){ \n" - + " } \n" - + "} \n"; - - - String expectedUnitToString = - "public class X {\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test09: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 198, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("Invalid methods length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 100, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 127, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 149, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 163, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 185, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test10() { - - String s = - "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " void baz(){} \n" - + " } \n" - + " /** comment \n" - + " * \n" - + " * \n" - + " */ \n" - + " \n" - + " void bar(){ \n" - + " } \n" - + " void truc(){ \n" - + " } \n" - + "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test10: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 415, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("Invalid methods length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 100, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 114, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 366, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 380, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 402, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test11() { - - String s = - "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " void baz(){} \n" - + " /** comment \n" - + " * \n" - + " * \n" - + " */ \n" - + " int[][] j[] = null, k; // comment \n" - + " \n" - + " void bar(){ \n" - + " } \n" - + " void truc(){ \n" - + " } \n" - + "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tint[][][] j;\n" - + "\tint[][] k;\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid baz() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test11: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 449, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - - assertEquals("Invalid declaration source start for field j", 102, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field j", 305, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field k", 102, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field k", 308, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("Invalid methods length ", 4, methods.length); - - assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 76, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method baz", 79, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method baz", 90, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 378, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 400, methods[2].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 414, methods[3].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 436, methods[3].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method baz", "baz", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[2].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[3].getActualName()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test12() { - - String s = - "import java.util.Enumeration;\n" - + "import java.util.Hashtable;" - + "\n" - + "/** comment */\n" - + "public class A2 {\n" - + " void foo() {\n" - + " System.out.println();\n" - + " void baz(){}\n" - + " /** comment\n" - + " *\n" - + " *\n" - + " */\n" - + " static { } // comment\n" - + " \n" - + "\n" - + " void bar(){\n" - + " }\n" - + " void truc(){\n" - + " }\n" - + "}\n"; - - String expectedUnitToString = - "import java.util.Enumeration;\n" - + "import java.util.Hashtable;\n" - + "public class A2 {\n" - + "\tstatic {}\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid baz() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test12: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 58, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 231, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("Invalid fields length ", 1, fields.length); - - assertEquals("Invalid declaration source start for initializer", 145, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for initializer", 181, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("Invalid methods length ", 4, methods.length); - - assertEquals("Invalid declaration source start for method foo", 92, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 128, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method baz", 131, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method baz", 142, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 183, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 212, methods[2].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 215, methods[3].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 229, methods[3].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method baz", "baz", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[2].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[3].getActualName()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test13() { - - String s = - "import java.util.Enumeration;\n" - + "import java.util.Hashtable;\n" - + "\n" - + "public class A2 {\n" - + " void foo() {\n" - + " System.out.println();\n" - + " void baz(){}\n" - + " static { }\n" - + " \n" - + "\n" - + " void bar(){\n" - + " }\n" - + " void truc(){\n" - + " }\n" - + "}\n"; - - String expectedUnitToString = - "import java.util.Enumeration;\n" - + "import java.util.Hashtable;\n" - + "public class A2 {\n" - + "\tstatic {}\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid baz() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - String testName = "test13: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 59, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 180, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - - assertEquals(" invalid fields length", 1, fields.length); - - assertEquals("Invalid declaration source start for initializer", 132, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for initializer", 141, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("Invalid methods length ", 4, methods.length); - - assertEquals("Invalid declaration source start for method foo", 78, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 114, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method baz", 117, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method baz", 128, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 148, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 161, methods[2].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 164, methods[3].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 178, methods[3].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method baz", "baz", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[2].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[3].getActualName()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test14() { - - String s = - "import java.util.Enumeration;\n" - + "import java.util.Hashtable;\n" - + "\n" - + "public class A2 {\n" - + " void foo() {\n" - + " System.out.println();\n" - + " void baz(){}\n" - + " static { }\n" - + " }\n" - + "\n" - + " void bar(){\n" - + " }\n" - + " void truc(){\n" - + " }\n" - + "}\n"; - - String expectedUnitToString = - "import java.util.Enumeration;\n" - + "import java.util.Hashtable;\n" - + "public class A2 {\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test14: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 59, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 180, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("Invalid methods length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 78, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 144, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 148, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 161, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 164, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 178, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test15() { - - String s = - "public class X { \n" - + " class Y { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " public int h; \n" - + " public int[] i = {0, 1}; \n" - + " void bar(){ \n" - + " void baz(){ \n" - + " } \n"; - - - String expectedUnitToString = - "public class X {\n" - + "\tclass Y {\n" - + "\t\tpublic int h;\n" - + "\t\tpublic int[] i;\n" - + "\t\tjava.lang.Object(0)\n" - + "\t\tvoid foo() {}\n" - + "\t\tvoid bar() {}\n" - + "\t\tvoid baz() {}\n" - + "\t}\n" - + "\tjava.lang.Object(0)\n" - + "}"; - - String testName = "test15: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 227, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members != null); - assertEquals(" invalid members length ", 1, members.length); - - fields = members[0].getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" invalid fields length ", 2, fields.length); - - assertEquals("Invalid declaration source start for field h", 117, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field h", 129, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field i", 140, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field i", 163, fields[1].getDeclarationSourceEnd()); - - methods = members[0].getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" invalid methods length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 48, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 103, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 171, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 191, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method baz", 193, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method baz", 215, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method baz", "baz", methods[2].getActualName()); - - SourceType member = members[0]; - assertEquals( - "Invalid class declarationSourceStart ", - 26, - member.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 227, - member.getDeclarationSourceEnd()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test16() { - - String s = - "public class X { \n" - + " class Y { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " public int h; \n" - + " public int[] i = {0, 1}; \n" - + " void bar(){ \n" - + " void baz(){ \n" - + " } \n"; - - - String expectedUnitToString = - "public class X {\n" - + "\tclass Y {\n" - + "\t\tpublic int h;\n" - + "\t\tpublic int[] i;\n" - + "\t\tvoid foo() {}\n" - + "\t\tvoid bar() {}\n" - + "\t\tvoid baz() {}\n" - + "\t}\n" - + "}"; - - String testName = "test16: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 227, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members != null); - assertEquals(" invalid members length ", 1, members.length); - - fields = members[0].getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" invalid fields length ", 2, fields.length); - - assertEquals("Invalid declaration source start for field h", 117, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field h", 129, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field i", 140, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field i", 163, fields[1].getDeclarationSourceEnd()); - - methods = members[0].getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" invalid methods length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 48, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 103, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 171, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 191, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method baz", 193, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method baz", 215, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method baz", "baz", methods[2].getActualName()); - - SourceType member = members[0]; - assertEquals( - "Invalid class declarationSourceStart ", - 26, - member.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 227, - member.getDeclarationSourceEnd()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test17() { - - String s = - "public class X { \n" - + " class Y { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " public int h; \n" - + " public int[] i = {0, 1}; \n" - + " void bar(){ \n" - + " void baz(){ \n" - + " } \n"; - - - String expectedUnitToString = - "public class X {\n" - + "\tclass Y {\n" - + "\t\tjava.lang.Object(0)\n" - + "\t\tvoid foo() {}\n" - + "\t}\n" - + "\tpublic int h;\n" - + "\tpublic int[] i;\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid bar() {}\n" - + "\tvoid baz() {}\n" - + "}"; - - String testName = "test17: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 241, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" invalid fields length ", 2, fields.length); - - assertEquals("Invalid declaration source start for field h", 131, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field h", 143, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field i", 154, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field i", 177, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" invalid fields length ", 2, methods.length); - - assertEquals("Invalid declaration source start for method bar", 185, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 205, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method baz", 207, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method baz", 229, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method baz", "baz", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members != null); - assertEquals(" invalid members length ", 1, members.length); - - fields = members[0].getFields(); - assertTrue(" invalid fields ", fields == null); - - methods = members[0].getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" invalid methods length ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 48, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 103, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType member = members[0]; - assertEquals( - "Invalid class declarationSourceStart ", - 26, - member.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 117, - member.getDeclarationSourceEnd()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test18() { - - String s = - "public class X { \n" - + " class Y { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " public int h; \n" - + " public int[] i = {0, 1}; \n" - + " void bar(){ \n" - + " void baz(){ \n" - + " } \n"; - - - String expectedUnitToString = - "public class X {\n" - + "\tclass Y {\n" - + "\t\tvoid foo() {}\n" - + "\t}\n" - + "\tpublic int h;\n" - + "\tpublic int[] i;\n" - + "\tvoid bar() {}\n" - + "\tvoid baz() {}\n" - + "}"; - - String testName = "test18: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 241, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" invalid fields length ", 2, fields.length); - - assertEquals("Invalid declaration source start for field h", 131, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field h", 143, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field i", 154, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field i", 177, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" invalid fields length ", 2, methods.length); - - assertEquals("Invalid declaration source start for method bar", 185, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 205, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method baz", 207, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method baz", 229, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method baz", "baz", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members != null); - assertEquals(" invalid members length ", 1, members.length); - - fields = members[0].getFields(); - assertTrue(" invalid fields ", fields == null); - - methods = members[0].getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" invalid methods length ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 48, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 103, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType member = members[0]; - assertEquals( - "Invalid class declarationSourceStart ", - 26, - member.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 117, - member.getDeclarationSourceEnd()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test19() { - - String s = - "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + "} \n" - + " void bar(){ \n" - + " int x; \n" - + " void baz(){ \n" - + " } \n" - + " int y; \n"; - - - String expectedUnitToString = - "public class X {\n" - + "\t{}\n" - + "\tint y;\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid baz() {}\n" - + "}"; - - String testName = "test19: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 197, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" invalid fields length ", 2, fields.length); - - assertEquals("Invalid declaration source start for initializer", 90, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for initializer", 90, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field y", 181, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field y", 186, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" invalid fields length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 26, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 77, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 104, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 143, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method baz", 145, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method baz", 167, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method baz", "baz", methods[2].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test20() { - - String s = - "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + "} \n" - + " void bar(){ \n" - + " public int x; \n" - + " void baz(){ \n" - + " } \n" - + " int y; \n"; - - - String expectedUnitToString = - "public class X {\n" - + "\t{}\n" - + "\tpublic int x;\n" - + "\tint y;\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid baz() {}\n" - + "}"; - - String testName = "test20: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 201, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" invalid fields length ", 3, fields.length); - - assertEquals("Invalid declaration source start for initializer", 90, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for initializer", 90, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field x", 126, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 138, fields[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field y", 185, fields[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field y", 190, fields[2].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" invalid fields length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 26, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 77, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 104, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 124, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method baz", 149, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method baz", 171, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method baz", "baz", methods[2].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test21() { - - String s = - "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + "} \n" - + " void bar(){ \n" - + " public int x; \n" - + " void baz(){ \n" - + " } \n" - + " int y; \n"; - - - String expectedUnitToString = - "public class X {\n" - + "\t{}\n" - + "\tpublic int x;\n" - + "\tint y;\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid baz() {}\n" - + "}"; - - String testName = "test21: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 201, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" invalid fields length ", 3, fields.length); - - assertEquals("Invalid declaration source start for initializer", 90, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for initializer", 90, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field x", 126, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 138, fields[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field y", 185, fields[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field y", 190, fields[2].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" invalid fields length ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 26, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 77, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 104, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 124, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method baz", 149, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method baz", 171, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method baz", "baz", methods[2].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test22() { - - String s = - "public class X extends { \n" - + " void foo() { \n" - + " } \n" - + "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "}"; - - String testName = "test22: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 67, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" invalid fields length ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 32, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 54, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test23() { - - String s = - "public class X extends Thread { \n" - + " void foo() throws \n" - + " void bar() \n" - + " } \n" - + "} \n"; - - String expectedUnitToString = - "public class X extends Thread {\n" - + "\tThread(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "}"; - - String testName = "test23: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 98, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" invalid fields length ", 2, methods.length); - - assertEquals("Invalid declaration source start for method foo", 37, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 61, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 63, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 85, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test24() { - - String s = - "public class X implements \n" - + " void foo() \n" - + " void bar() \n" - + " } \n" - + "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "}"; - - String testName = "test24: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 91, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" invalid fields length ", 2, methods.length); - - assertEquals("Invalid declaration source start for method foo", 34, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 54, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 56, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 78, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test25() { - - String s = - "public class X implements Y, \n" - + " void foo() \n" - + " void bar() \n" - + " } \n" - + "} \n"; - - String expectedUnitToString = - "public class X implements Y, {\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "}"; - - String testName = "test25: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 92, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" invalid fields length ", 2, methods.length); - - assertEquals("Invalid declaration source start for method foo", 35, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 55, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 57, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 79, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test26() { - - String s = - "public class X implements \n" - + " class Y { \n" - + " void bar() \n" - + " } \n" - + "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tclass Y {\n" - + "\t\tjava.lang.Object(0)\n" - + "\t\tvoid bar() {}\n" - + "\t}\n" - + "\tjava.lang.Object(0)\n" - + "}"; - - String testName = "test26: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 102, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members != null); - assertEquals(" contains one member ", 1, members.length); - - assertEquals( - "Invalid class declarationSourceStart ", - 34, - members[0].getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 90, - members[0].getDeclarationSourceEnd()); - - methods = members[0].getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains one method ", 1, methods.length); - - assertEquals("Invalid declaration source start for method bar", 56, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 77, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[0].getActualName()); - - members = members[0].getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test27() { - - String s = - "public class X \n" - + " fieldX; \n" - + " class Y { \n" - + " void bar() \n" - + " } \n" - + "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tclass Y {\n" - + "\t\tjava.lang.Object(0)\n" - + "\t\tvoid bar() {}\n" - + "\t}\n" - + "\tjava.lang.Object(0)\n" - + "}"; - - String testName = "test27: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 113, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members != null); - assertEquals(" contains one member ", 1, members.length); - - assertEquals( - "Invalid class declarationSourceStart ", - 45, - members[0].getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 101, - members[0].getDeclarationSourceEnd()); - - methods = members[0].getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains one method ", 1, methods.length); - - assertEquals("Invalid declaration source start for method bar", 67, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 88, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[0].getActualName()); - - members = members[0].getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test28() { - - String s = - "public class X \n" - + " fieldX; \n" - + " class Y \n" - + " } \n" - + "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tclass Y {\n" - + "\t\tjava.lang.Object(0)\n" - + "\t}\n" - + "\tjava.lang.Object(0)\n" - + "}"; - - String testName = "test28: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 78, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members != null); - assertEquals(" contains one member ", 1, members.length); - - assertEquals( - "Invalid class declarationSourceStart ", - 45, - members[0].getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 65, - members[0].getDeclarationSourceEnd()); - - methods = members[0].getMethods(); - assertTrue(" invalid methods ", methods == null); - - members = members[0].getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test29() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " class L extends { \n" + - " public int l; \n" + - " void baz(){} \n" + - " } \n" + - " \n" + - " public int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - String expectedUnitToString = - "package a;\n" - + "import java.lang.*;\n" - + "import java.util.*;\n" - + "public class X {\n" - + "\tpublic int h;\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test29: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 88, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 357, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("contains one field ", 1, fields.length); - - assertEquals("Invalid declaration source start for field h", 276, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field h", 288, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains 3 methods ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 114, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 250, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 312, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 332, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 334, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 355, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test30() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " class L extends { \n" + - " public int l; \n" + - " void baz(){} \n" + - " } \n" + - " \n" + - " public int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - String expectedUnitToString = - "package a;\n" - + "import java.lang.*;\n" - + "import java.util.*;\n" - + "public class X {\n" - + "\tpublic int h;\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test30: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 88, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 357, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("contains one field ", 1, fields.length); - - assertEquals("Invalid declaration source start for field h", 276, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field h", 288, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains 3 methods ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 114, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 250, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 312, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 332, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 334, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 355, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test31() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " new X(){ \n" + - " void baz() {} \n" + - " }.baz(); \n" + - " \n" + - " public int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - String expectedUnitToString = - "package a;\n" - + "import java.lang.*;\n" - + "import java.util.*;\n" - + "public class X {\n" - + "\tpublic int h;\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test31: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 89, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 334, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("contains one field ", 1, fields.length); - - assertEquals("Invalid declaration source start for field h", 253, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field h", 265, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains 3 methods ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 115, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 251, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 289, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 309, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 311, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 332, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test32() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " new X(){ \n" + - " void baz() {} \n" + - " \n" + - " public int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - - String expectedUnitToString = - "package a;\n" - + "import java.lang.*;\n" - + "import java.util.*;\n" - + "public class X {\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "}"; - - String testName = "test32: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 89, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 315, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains one methods ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 115, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 315, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test33() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " new X(){ \n" + - " void baz() {} \n" + - " \n" + - " public int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - - String expectedUnitToString = - "package a;\n" - + "import java.lang.*;\n" - + "import java.util.*;\n" - + "public class X {\n" - + "\tvoid foo() {}\n" - + "}"; - - String testName = "test33: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 89, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 315, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains one methods ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 115, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 315, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test34() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " new X(){ \n" + - " void baz() \n" + - " } \n" + - " } \n" + - " public int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - String expectedUnitToString = - "package a;\n" - + "import java.lang.*;\n" - + "import java.util.*;\n" - + "public class X {\n" - + "\tpublic int h;\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test34: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 88, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 342, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("contains one field ", 1, fields.length); - - assertEquals("Invalid declaration source start for field h", 250, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field h", 262, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains 3 methods ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 114, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 236, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 286, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 306, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 308, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 329, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test35() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " class L extends { \n" + - " public int l; \n" + - " void baz(){} \n" + - " } \n" + - " \n" + - " int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - String expectedUnitToString = - "package a;\n" - + "import java.lang.*;\n" - + "import java.util.*;\n" - + "public class X {\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test35: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 76, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 309, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains 3 methods ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 99, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 260, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 262, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 279, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 281, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 299, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test36() { - - String s = - "package a; \n" + - "import java.lang.*; \n" + - "import java.util.*; \n" + - " \n" + - "public class X { \n" + - " void foo() { \n" + - " System.out.println(); \n" + - " \n" + - " class L extends { \n" + - " public int l; \n" + - " void baz(){} \n" + - " } \n" + - " \n" + - " int h; \n" + - " \n" + - " void bar(){ \n" + - " void truc(){ \n" + - "} \n"; - - String expectedUnitToString = - "package a;\n" - + "import java.lang.*;\n" - + "import java.util.*;\n" - + "public class X {\n" - + "\tvoid foo() {}\n" - + "\tvoid bar() {}\n" - + "\tvoid truc() {}\n" - + "}"; - - String testName = "test36: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 76, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 309, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains 3 methods ", 3, methods.length); - - assertEquals("Invalid declaration source start for method foo", 99, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 260, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 262, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 279, methods[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method truc", 281, methods[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method truc", 299, methods[2].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - assertEquals(" Invalid actual name for method truc", "truc", methods[2].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test37() { - - String s = - "public class X { \n" + - " int x; \n" + - " \n" + - " int foo(){ } \n" + - " \n" + - " class Y { \n" + - " int y; \n" + - "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tclass Y {\n" - + "\t\tint y;\n" - + "\t\tjava.lang.Object(0)\n" - + "\t}\n" - + "\tint x;\n" - + "\tjava.lang.Object(0)\n" - + "\tint foo() {}\n" - + "}"; - - String testName = "test37: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 112, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("contains one field ", 1, fields.length); - - assertEquals("Invalid declaration source start for field x", 23, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 28, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains one methods ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 46, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 57, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members != null); - assertEquals("contains one member ", 1, members.length); - - assertEquals( - "Invalid class declarationSourceStart ", - 73, - members[0].getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 104, - members[0].getDeclarationSourceEnd()); - - fields = members[0].getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("contains one field ", 1, fields.length); - - assertEquals("Invalid declaration source start for field y", 92, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field y", 97, fields[0].getDeclarationSourceEnd()); - - methods = members[0].getMethods(); - assertTrue(" invalid methods ", methods == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test38() { - - String s = - "public class X { \n" + - " int x; \n" + - " \n" + - " int foo(){ } \n" + - " \n" + - " class Y { \n" + - " int y; \n" + - "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tclass Y {\n" - + "\t\tint y;\n" - + "\t}\n" - + "\tint x;\n" - + "\tint foo() {}\n" - + "}"; - - String testName = "test38: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 112, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("contains one field ", 1, fields.length); - - assertEquals("Invalid declaration source start for field x", 23, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 28, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains one methods ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 46, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 57, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members != null); - assertEquals("contains one member ", 1, members.length); - - assertEquals( - "Invalid class declarationSourceStart ", - 73, - members[0].getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 104, - members[0].getDeclarationSourceEnd()); - - fields = members[0].getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("contains one field ", 1, fields.length); - - assertEquals("Invalid declaration source start for field y", 92, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field y", 97, fields[0].getDeclarationSourceEnd()); - - methods = members[0].getMethods(); - assertTrue(" invalid methods ", methods == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test39() { - - String s = - "public class X { \n" + - " int x; \n" + - " \n" + - " int foo(){ } \n" + - " \n" + - " class Y \n" + - "} \n" + - " int y; \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tclass Y {\n" - + "\t\tjava.lang.Object(0)\n" - + "\t}\n" - + "\tint x;\n" - + "\tint y;\n" - + "\tjava.lang.Object(0)\n" - + "\tint foo() {}\n" - + "}"; - - String testName = "test39: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 109, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("contains one field ", 2, fields.length); - - assertEquals("Invalid declaration source start for field x", 23, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 28, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field y", 98, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field y", 103, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains one methods ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 46, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 57, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members != null); - assertEquals("contains one member ", 1, members.length); - - assertEquals( - "Invalid class declarationSourceStart ", - 73, - members[0].getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 87, - members[0].getDeclarationSourceEnd()); - - fields = members[0].getFields(); - assertTrue(" invalid fields ", fields == null); - - methods = members[0].getMethods(); - assertTrue(" invalid methods ", methods == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test40() { - - String s = - "public class X { \n" + - " int x; \n" + - " \n" + - " int foo(){ } \n" + - " \n" + - " class Y \n" + - "} \n" + - " int y; \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tclass Y {\n" - + "\t}\n" - + "\tint x;\n" - + "\tint y;\n" - + "\tint foo() {}\n" - + "}"; - - String testName = "test40: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 109, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("contains one field ", 2, fields.length); - - assertEquals("Invalid declaration source start for field x", 23, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 28, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field y", 98, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field y", 103, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains one methods ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 46, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 57, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members != null); - assertEquals("contains one member ", 1, members.length); - - assertEquals( - "Invalid class declarationSourceStart ", - 73, - members[0].getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 87, - members[0].getDeclarationSourceEnd()); - - fields = members[0].getFields(); - assertTrue(" invalid fields ", fields == null); - - methods = members[0].getMethods(); - assertTrue(" invalid methods ", methods == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test41() { - - String s = - "public class X { \n"+ - " void hell" + "\\" + "u006f()\n"+ - " static void foo() { \n"+ - " X x; \n"+ - " x = new X(23); \n"+ - " System.out.println(); \n"+ - " \n"+ - "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tjava.lang.Object(0)\n" - + "\tvoid hello() {}\n" - + "\tstatic void foo() {}\n" - + "}"; - - String testName = "test41: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 139, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals(" contains one methods ", 2, methods.length); - - assertEquals("Invalid declaration source start for method hello", 22, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method hello", 39, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method foo", 41, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 130, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method hello", "hell" + "\\" + "u006f", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test42() { - - String s = - "public class X { \n" + - " int x \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tint x;\n" - + "\tjava.lang.Object(0)\n" - + "}"; - - String testName = "test42: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 29, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" contains one field", 1, fields.length); - - assertEquals("Invalid declaration source start for field x", 20, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 24, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test43() { - - String s = - "public class X { \n" + - " int x \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tint x;\n" - + "}"; - - String testName = "test43: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 29, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" contains one field", 1, fields.length); - - assertEquals("Invalid declaration source start for field x", 20, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 24, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test44() { - - String s = - "public class X { \n" + - " int x, y \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tint x;\n" - + "\tint y;\n" - + "\tjava.lang.Object(0)\n" - + "}"; - - String testName = "test44: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 31, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" contains one field", 2, fields.length); - - assertEquals("Invalid declaration source start for field x", 20, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 25, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field y", 20, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field y", 27, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test45() { - - String s = - "public class X { \n" + - " int x, y \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tint x;\n" - + "\tint y;\n" - + "}"; - - String testName = "test45: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 31, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" contains one field", 2, fields.length); - - assertEquals("Invalid declaration source start for field x", 20, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 25, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field y", 20, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field y", 27, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test46() { - - String s = - "public class X { \n" + - " String s = \" \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tString s;\n" - + "\tjava.lang.Object(0)\n" - + "}"; - - String testName = "test46: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 34, - currentType.getDeclarationSourceEnd()); - - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" contains one field", 1, fields.length); - - assertEquals("Invalid declaration source start for field s", 20, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field s", 34, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test47() { - - String s = - "public class X { \n" + - " String s = \" \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tString s;\n" - + "}"; - - String testName = "test47: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 34, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" contains one field", 1, fields.length); - - assertEquals("Invalid declaration source start for field s", 20, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field s", 34, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test48() { - - String s = - "public class X implements Y, \n" + - " String s = \" \n"; - - String expectedUnitToString = - "public class X implements Y, String, {\n" - + "\tjava.lang.Object(0)\n" - + "}"; - - String testName = "test48: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 50, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test49() { - - String s = - "public class X implements Y, \n" + - " String s = \" \n"; - - String expectedUnitToString = - "public class X implements Y, String, {\n" - + "}"; - - String testName = "test49: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 50, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test50() { - - String s = - "public class X implements \n"+ - "int x \n"+ - "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tint x;\n" - + "\tjava.lang.Object(0)\n" - + "}"; - - String testName = "test50: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 42, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("has one field ", 1, fields.length); - - assertEquals("Invalid declaration source start for field x", 29, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 33, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test51() { - - String s = - "public class X implements \n"+ - "int x \n"+ - "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tint x;\n" - + "}"; - - String testName = "test51: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 42, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("has one field ", 1, fields.length); - - assertEquals("Invalid declaration source start for field x", 29, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 33, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test52() { - - String s = - "public class X public int foo(int bar(static String s"; - - String expectedUnitToString = - "public class X {\n" - + "\tstatic String s;\n" - + "\tjava.lang.Object(0)\n" - + "\tpublic int foo() {}\n" - + "\tint bar() {}\n" - + "}"; - - String testName = "test52: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 52, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("has one field ", 1, fields.length); - - assertEquals("Invalid declaration source start for field s", 38, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field s", 52, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - - assertEquals("Invalid declaration source start for method foo", 15, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 29, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 30, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 37, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test53() { - - String s = - "public class X public int foo(int x, int bar public String s;"; - - String expectedUnitToString = - "public class X {\n" - + "\tpublic String s;\n" - + "\tjava.lang.Object(0)\n" - + "\tpublic int foo(int x, int bar, ) {}\n" - + "}"; - - String testName = "test53: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 60, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("has one field ", 1, fields.length); - - assertEquals("Invalid declaration source start for field s", 45, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field s", 60, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has one method ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 15, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 44, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test54() { - - String s = - "public class X \n" + - " public int foo( \n" + - " int bar( \n" + - " static String s, int x \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tstatic String s;\n" - + "\tint x;\n" - + "\tjava.lang.Object(0)\n" - + "\tpublic int foo() {}\n" - + "\tint bar() {}\n" - + "}"; - - String testName = "test54: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 78, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("has 2 fields ", 2, fields.length); - - assertEquals("Invalid declaration source start for field s", 55, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field s", 70, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field x", 72, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 76, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has 2 methods ", 2, methods.length); - - assertEquals("Invalid declaration source start for method foo", 20, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 38, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 40, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 52, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test55() { - - String s = - "public class X \n" + - " public int foo( \n" + - " int bar( \n" + - " static String s, int x \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tstatic String s;\n" - + "\tint x;\n" - + "\tpublic int foo() {}\n" - + "\tint bar() {}\n" - + "}"; - - String testName = "test55: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 78, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("has 2 fields ", 2, fields.length); - - assertEquals("Invalid declaration source start for field s", 55, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field s", 70, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field x", 72, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 76, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has 2 methods ", 2, methods.length); - - assertEquals("Invalid declaration source start for method foo", 20, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 38, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method bar", 40, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method bar", 52, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method bar", "bar", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test56() { - - String s = - "class X { \n" + - " String s; \n" + - " \n" + - " public void foo( \n" + - " static int x \n" + - "} \n"; - - - String expectedUnitToString = - "class X {\n" - + "\tString s;\n" - + "\tstatic int x;\n" - + "\tjava.lang.Object(0)\n" - + "\tpublic void foo() {}\n" - + "}"; - - String testName = "test56: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 75, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("has 2 fields ", 2, fields.length); - - assertEquals("Invalid declaration source start for field s", 16, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field s", 24, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field x", 60, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 71, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has 1 method ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 39, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 57, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test57() { - - String s = - "class X { \n" + - " String s; \n" + - " \n" + - " public void foo( \n" + - " static int x \n" + - "} \n"; - - - String expectedUnitToString = - "class X {\n" - + "\tString s;\n" - + "\tstatic int x;\n" - + "\tpublic void foo() {}\n" - + "}"; - - String testName = "test57: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 75, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("has 2 fields ", 2, fields.length); - - assertEquals("Invalid declaration source start for field s", 16, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field s", 24, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field x", 60, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 71, fields[1].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has 1 method ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 39, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 57, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test58() { - - String s = - "public class X { \n"+ - " int foo(){ \n"+ - " String s = \" \n"+ - " } \n"+ - "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tjava.lang.Object(0)\n" - + "\tint foo() {}\n" - + "}"; - - String testName = "test58: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 62, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has 1 method ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 21, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 54, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test59() { - - String s = - - "class X { \n" + - " int foo(AA a, BB b, IOEx \n" + - " \n"; - - String expectedUnitToString = - "class X {\n" - + "\tjava.lang.Object(0)\n" - + "\tint foo(AA a, BB b, ) {}\n" - + "}"; - - String testName = "test59: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 60, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has 1 method ", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 20, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 60, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test60() { - - String s = - "public class X { \n"+ - " final static int foo(){ \n"+ - " return \"1; \n"+ - " } \n"+ - " public static void main(String argv[]){ \n"+ - " foo(); \n"+ - " } \n"+ - "} \n"; - - String expectedUnitToString = - "public class X {\n" - + "\tjava.lang.Object(0)\n" - + "\tfinal static int foo() {}\n" - + "\tpublic static void main(String[] argv, ) {}\n" - + "}"; - - String testName = "test60: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 161, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has 1 method ", 2, methods.length); - - assertEquals("Invalid declaration source start for method foo", 25, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 75, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method main", 89, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method main", 148, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method main", "main", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test61() { - - String s = - "public class X { \n"+ - " { \n"+ - " int x;"; - - String expectedUnitToString = - "public class X {\n" - + "\t{}\n" - + "\tjava.lang.Object(0)\n" - + "}"; - - String testName = "test61: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 47, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - - assertEquals("Invalid declaration source start for initializer", 25, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for initializer", 47, fields[0].getDeclarationSourceEnd()); - - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test62() { - - String s = - "public class X { \n"+ - " int foo(){ \n"+ - " if(true){ \n"+ - " int x;"; - - String expectedUnitToString = - "public class X {\n" - + "\tjava.lang.Object(0)\n" - + "\tint foo() {}\n" - + "}"; - - String testName = "test62: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 78, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has one method", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 78, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test63() { - - String s = - "public class X { \n"+ - " int foo(){} \n"+ - "} \n"+ - "int x;\n"; - - String expectedUnitToString = - "public class X {\n" - + "\tint x;\n" - + "\tjava.lang.Object(0)\n" - + "\tint foo() {}\n" - + "}"; - - String testName = "test63: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 66, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("has one field", 1, fields.length); - - assertEquals("Invalid declaration source start for field x", 60, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 65, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has one method", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 37, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test64() { - - String s = - "public class X { \n"+ - " int foo(){} \n"+ - "} \n"+ - "int x;\n"; - - String expectedUnitToString = - "public class X {\n" - + "\tint x;\n" - + "\tint foo() {}\n" - + "}"; - - String testName = "test64: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 66, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("has one field", 1, fields.length); - - assertEquals("Invalid declaration source start for field x", 60, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field x", 65, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has one method", 1, methods.length); - - assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 37, methods[0].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test65() { - - String s = - "public class X { \n"+ - " int foo(){} \n"+ - "} \n"+ - "int x();\n"; - - String expectedUnitToString = - "public class X {\n" - + "\t{}\n" - + "\tint foo() {}\n" - + "\tint x() {}\n" - + "}"; - - String testName = "test65: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 68, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" invalid fields length ", 1, fields.length); - - assertEquals("Invalid declaration source start for initializer", 47, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for initializer", 47, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has two methods", 2, methods.length); - - assertEquals("Invalid declaration source start for method foo", 27, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 37, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method x", 60, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method x", 67, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test66() { - - String s = - "public interface X { \n"+ - " int foo() {}; \n"+ - "} \n"+ - "int x();\n"; - - String expectedUnitToString = - "public interface X {\n" - + "\t{}\n" - + "\tint foo() {}\n" - + "\tint x() {}\n" - + "}"; - - String testName = "test66: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 72, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals(" invalid fields length ", 1, fields.length); - - assertEquals("Invalid declaration source start for initializer", 51, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for initializer", 51, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has two methods", 2, methods.length); - - assertEquals("Invalid declaration source start for method foo", 30, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 41, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method x", 64, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method x", 71, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test67() { - - String s = - "public interface X { \n"+ - " int foo() {}; \n"+ - " int x(); \n"+ - "}"; - - String expectedUnitToString = - "public interface X {\n" - + "\tint foo() {}\n" - + "\tint x() {}\n" - + "}"; - - String testName = "test67: diet parse"; - dietParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 71, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has two methods", 2, methods.length); - - assertEquals("Invalid declaration source start for method foo", 30, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 41, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method x", 54, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method x", 61, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test68() { - - String s = - "public interface X { \n"+ - " int foo() {}; \n"+ - " int x(); \n"+ - "}"; - - String expectedUnitToString = - "public interface X {\n" - + "\tint foo() {}\n" - + "\tint x() {}\n" - + "}"; - - String testName = "test68: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 71, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has two methods", 2, methods.length); - - assertEquals("Invalid declaration source start for method foo", 30, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 41, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method x", 54, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method x", 61, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test69() { - - String s = - "public interface X { \n"+ - "float y; \n"+ - " int foo() ; \n"+ - " int x(); \n"+ - "}"; - - String expectedUnitToString = - "public interface X {\n" - + "\tfloat y;\n" - + "\tint foo() {}\n" - + "\tint x() {}\n" - + "}"; - - String testName = "test69: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 87, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("has one field", 1, fields.length); - - assertEquals("Invalid declaration source start for field y", 27, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field y", 34, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has two methods", 2, methods.length); - - assertEquals("Invalid declaration source start for method foo", 48, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 58, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method x", 70, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method x", 77, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test70() { - - String s = - "public interface X { \n"+ - " int foo(); \n"+ - " int x(); \n"+ - "}"; - - String expectedUnitToString = - "public interface X {\n" - + "\tint foo() {}\n" - + "\tint x() {}\n" - + "}"; - - String testName = "test70: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 69, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields == null); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has two methods", 2, methods.length); - - assertEquals("Invalid declaration source start for method foo", 30, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 39, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method x", 52, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method x", 59, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test71() { - - String s = - "public interface X { \n"+ - " int[] i = ; \n"+ - " int foo() {} \n"+ - " int x(); \n"+ - "}"; - - String expectedUnitToString = - "public interface X {\n" - + "\tint[] i;\n" - + "\tint foo() {}\n" - + "\tint x() {}\n" - + "}"; - - String testName = "test71: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 93, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue(" invalid fields ", fields != null); - assertEquals("has one field", 1, fields.length); - - assertEquals("Invalid declaration source start for field i", 30, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field i", 49, fields[0].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods != null); - assertEquals("has two methods", 2, methods.length); - - assertEquals("Invalid declaration source start for method foo", 53, methods[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method foo", 64, methods[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for method x", 76, methods[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for method x", 83, methods[1].getDeclarationSourceEnd()); - - assertEquals(" Invalid actual name for method foo", "foo", methods[0].getActualName()); - - assertEquals(" Invalid actual name for method x", "x", methods[1].getActualName()); - - SourceType[] members = currentType.getMemberTypes(); - assertTrue(" invalid members ", members == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test72() { - - String s = - "public class X { \n"+ - " X() { \n" + - " this(); \n" + - " } \n" + - "}"; - - String expectedUnitToString = - "public class X {\n" - + "\tX() {\n" - + "\t\tX(0)\n" - + "\t}\n" - + "}"; - - String testName = "test72: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test73() { - - String s = - "public class X extends Toto { \n"+ - " X() { \n" + - " this(); \n" + - " } \n" + - " X(int i) { \n" + - " super(); \n" + - " } \n" + - " X() { \n" + - " this(0); \n" + - " } \n" + - "}"; - - String expectedUnitToString = - "public class X extends Toto {\n" - + "\tX() {\n" - + "\t\tX(0)\n" - + "\t}\n" - + "\tX(int i, ) {\n" - + "\t\tToto(0)\n" - + "\t}\n" - + "\tX() {\n" - + "\t\tX(1)\n" - + "\t}\n" - + "}"; - - String testName = "test73: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test74() { - - String s = - "public class X extends Toto { \n"+ - " class Y extends Throwable { \n" + - " } \n" + - " X() { \n" + - " this(); \n" + - " } \n" + - " X(int i) { \n" + - " super(); \n" + - " } \n" + - " X() { \n" + - " this(0); \n" + - " } \n" + - " public Object foo(int i) { \n" + - " return new Object() {}; \n" + - " } \n" + - "}"; - - String expectedUnitToString = - "public class X extends Toto {\n" - + "\tclass Y extends Throwable {\n" - + "\t\tThrowable(0)\n" - + "\t}\n" - + "\tX() {\n" - + "\t\tX(0)\n" - + "\t}\n" - + "\tX(int i, ) {\n" - + "\t\tToto(0)\n" - + "\t}\n" - + "\tX() {\n" - + "\t\tX(1)\n" - + "\t}\n" - + "\tpublic Object foo(int i, ) {}\n" - + "}"; - - String testName = "test74: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -/* - * bugs 16126 - */ -public void test75() { - String s = - "public class P#AField {\n" + - " public void setP#A(String P#A) {\n" + - " this.P#A = P#A;\n" + - " }\n" + - "}"; - - String expectedUnitToString = - "public class P {\n" + - " {}\n" + - " public void setP;\n" + - " java.lang.Object(0)\n" + - " A(String P, ) {}\n" + - "}"; - - String testName = "test75: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -public void test76() { - - String s = - "class X {\n" + - " public static int j = 0;\n" + - " /* static */ {\n" + - " }" + - " public static int i = 9;\n" + - "}\n"; - - String expectedUnitToString = - "class X {\n" + - " public static int j;\n" + - " {}\n" + - " public static int i;\n" + - " java.lang.Object(0)\n" + - "}"; - - String testName = "test76: full parse"; - fullParse(s,testName); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentType.getDeclarationSourceStart()); - - assertEquals( - "Invalid class declarationSourceEnd ", - 84, - currentType.getDeclarationSourceEnd()); - - SourceField[] fields = currentType.getFields(); - assertTrue("invalid fields ", fields != null); - assertEquals("Invalid fields length ", 3, fields.length); - - assertEquals("Invalid declaration source start for field j", 12, fields[0].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for field j", 35, fields[0].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for initializer", 39, fields[1].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end for initializer", 56, fields[1].getDeclarationSourceEnd()); - - assertEquals("Invalid declaration source start for field i", 59, fields[2].getDeclarationSourceStart()); - assertEquals("Invalid declaration source end field i", 82, fields[2].getDeclarationSourceEnd()); - - SourceMethod[] methods = currentType.getMethods(); - assertTrue(" invalid methods ", methods == null); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -/** - * Bug 99662:[1.5] JavaModel returns inexistent IType for package-info ICompilationUnits - * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=99662" - * - */ -public void testBug99662() { - - String s = - "@Deprecated\n" + - "package p;\n"; - - String testName = "package-info.java"; - fullParse(s,testName); - - assertNull("package-info.java file should not have ANY type!", this.currentType); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=167357 -public void _test77() { - - String s = - "public class X {\n" + - " void foo() {\n" + - " class Y {\n" + - " String s = null;\n" + - " {\n" + - " class Z {\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - "}"; - - String expectedUnitToString = - "public class X implements Y, String, {\n" - + "}"; - - String testName = "test77: diet parse"; - dietParse(s,testName, true); - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=167357 -public void _test78() { - String s = - "public class X {\n" + - " void foo() {\n" + - " class Y {\n" + - " String s = null;\n" + - " {\n" + - " class Z {\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - "}"; - - String expectedUnitToString = - "public class X implements Y, String, {\n" - + "}"; - - String testName = "test78: full parse"; - fullParse(s,testName, true); - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=167357 -public void _test79() { - - String s = - "public class X {\n" + - " void foo() {\n" + - " class Y {\n" + - " {\n" + - " class Z {\n" + - " }\n" + - " }\n" + - " String s = null;\n" + - " }\n" + - " }\n" + - "}"; - - String expectedUnitToString = - "public class X implements Y, String, {\n" - + "}"; - - String testName = "test79: diet parse"; - dietParse(s,testName, true); - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=167357 -public void _test80() { - - String s = - "public class X {\n" + - " void foo() {\n" + - " class Y {\n" + - " {\n" + - " class Z {\n" + - " }\n" + - " }\n" + - " String s = null;\n" + - " }\n" + - " }\n" + - "}"; - - String expectedUnitToString = - "public class X implements Y, String, {\n" - + "}"; - - String testName = "test80: full parse"; - fullParse(s,testName, true); - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentType.toString()); -} - - -public void testInnerMethod01() { - - String s = - "function ss() {\n" - + "function ins() {}\n" - + "}\n" - + "\n"; - - String expectedUnitToString = - "\tfunction ss() {\n" - + "\t\tfunction ins() {}\n" - + "\t}" - + "\n"; - - String testName = "testInnerMethod01"; - fullParse(s,testName,true); - - assertEquals( - "Invalid class declarationSourceStart ", - 0, - currentUnit.getDeclarationSourceStart()); - -// assertEquals( -// "Invalid class declarationSourceEnd ", -// 40, -// currentUnit.getDeclarationSourceEnd()); - - assertEquals( - "Invalid source " + testName, - expectedUnitToString, - currentUnit.toString()); -} - -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceImport.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceImport.java deleted file mode 100644 index 220f078..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceImport.java +++ /dev/null
@@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -public class SourceImport { - int declarationSourceStart; - int declarationSourceEnd; - char[] name; - boolean onDemand; - char[] source; -/** - * @param declarationSourceStart int - * @param declarationSourceEnd int - * @param name char[] - * @param onDemand boolean - */ -public SourceImport( - int declarationSourceStart, - int declarationSourceEnd, - char[] name, - boolean onDemand, - char[] source) { - - this.declarationSourceStart = declarationSourceStart; - this.declarationSourceEnd = declarationSourceEnd; - this.name = name; - this.onDemand = onDemand; - this.source = source; -} -/** - * - * @return java.lang.String - */ -public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer - .append( - source, - declarationSourceStart, - declarationSourceEnd - declarationSourceStart + 1) - .append("\n"); - return buffer.toString(); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceMethod.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceMethod.java index a910ebd..3321b1e 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceMethod.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceMethod.java
@@ -27,8 +27,6 @@ private String explicitConstructorCall; private int numberOfMemberMethods; private SourceMethod[] memberMethods; - char[][] typeParameterNames; - char[][][] typeParameterBounds; SourceMethod parent; public SourceMethod( @@ -130,12 +128,6 @@ public char[] getSelector() { return selector; } -public char[][][] getTypeParameterBounds() { - return typeParameterBounds; -} -public char[][] getTypeParameterNames() { - return typeParameterNames; -} public boolean isConstructor() { return returnTypeName == null; }
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourcePackage.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourcePackage.java deleted file mode 100644 index bedfb7b..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourcePackage.java +++ /dev/null
@@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -public class SourcePackage { - int declarationSourceStart; - int declarationSourceEnd; - char[] name; - char[] source; -/** - * @param declarationSourceStart int - * @param declarationSourceEnd int - * @param name char[] - * @param source char[] - */ -public SourcePackage( - int declarationSourceStart, - int declarationSourceEnd, - char[] name, - char[] source) { - - this.declarationSourceStart = declarationSourceStart; - this.declarationSourceEnd = declarationSourceEnd; - this.name = name; - this.source = source; -} -/** - * - * @return java.lang.String - */ -public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer - .append( - source, - declarationSourceStart, - declarationSourceEnd - declarationSourceStart + 1) - .append("\n"); - return buffer.toString(); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceType.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceType.java index 25464c9..6aa5be4 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceType.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceType.java
@@ -17,15 +17,10 @@ private int declarationStart; private int declarationEnd; private char[] fileName; - private SourcePackage packageName; - private SourceImport[] imports; - private char[] enclosingTypeName; private char[] name; private int nameSourceStart; private int nameSourceEnd; private char[] superclassName; - private SourceType[] memberTypes; - private int numberOfMemberTypes; private SourceMethod[] methods; private int numberOfMethods; private SourceField[] fields; @@ -37,7 +32,6 @@ private char[] qualifiedName; private String defaultConstructor; public SourceType( - char[] enclosingTypeName, int declarationStart, int modifiers, char[] name, @@ -46,7 +40,6 @@ char[] superclassName, char[] source) { - this.enclosingTypeName = enclosingTypeName; this.declarationStart = declarationStart; this.modifiers = modifiers; @@ -71,16 +64,6 @@ } fields[numberOfFields++] = sourceField; } -protected void addMemberType(SourceType sourceMemberType) { - if(memberTypes == null) { - memberTypes = new SourceType[4]; - } - - if(numberOfMemberTypes == memberTypes.length) { - System.arraycopy(memberTypes, 0, memberTypes = new SourceType[numberOfMemberTypes * 2], 0, numberOfMemberTypes); - } - memberTypes[numberOfMemberTypes++] = sourceMemberType; -} protected void addMethod(SourceMethod sourceMethod) { if (methods == null) { methods = new SourceMethod[4]; @@ -128,9 +111,6 @@ public int getDeclarationSourceStart() { return declarationStart; } -public char[] getEnclosingTypeName() { - return enclosingTypeName; -} public SourceField[] getFields() { if (fields != null && fields.length != numberOfFields) { System.arraycopy(fields, 0, fields = new SourceField[numberOfFields], 0, numberOfFields); @@ -140,26 +120,6 @@ public char[] getFileName() { return fileName; } -public char[][] getImports() { - if (imports == null) return null; - int importLength = imports.length; - char[][] importNames = new char[importLength][]; - for (int i = 0, max = importLength; i < max; i++) { - importNames[i] = imports[i].name; - } - return importNames; -} -public SourceType[] getMemberTypes() { - if (memberTypes != null && memberTypes.length != numberOfMemberTypes) { - System.arraycopy( - memberTypes, - 0, - memberTypes = new SourceType[numberOfMemberTypes], - 0, - numberOfMemberTypes); - } - return memberTypes; -} public SourceMethod[] getMethods() { if (methods != null && methods.length != numberOfMethods) { System.arraycopy(methods, 0, methods = new SourceMethod[numberOfMethods], 0, numberOfMethods); @@ -178,14 +138,9 @@ public int getNameSourceStart() { return nameSourceStart; } -public char[] getPackageName() { - return packageName.name; -} public char[] getQualifiedName() { if (qualifiedName == null) { StringBuffer temp = new StringBuffer(); - temp.append(packageName); - temp.append('.'); temp.append(name); qualifiedName = temp.toString().toCharArray(); } @@ -206,12 +161,6 @@ public void setDefaultConstructor(String s) { this.defaultConstructor = s; } -public void setImports(SourceImport[] imports) { - this.imports = imports; -} -public void setPackage(SourcePackage sourcePackage) { - packageName = sourcePackage; -} public void setSuperclass(char[] superclassName) { this.superclassName = superclassName; } @@ -229,14 +178,6 @@ public String toString(int tab) { StringBuffer buffer = new StringBuffer(); - if (packageName != null) { - buffer.append(tabString(tab)).append(packageName); - } - if (imports != null) { - for (int i = 0, max = imports.length; i < max; i++) { - buffer.append(tabString(tab)).append(imports[i]); - } - } buffer.append(tabString(tab)); String displayModifiers = displayModifiers(); if (displayModifiers != null) { @@ -247,11 +188,6 @@ buffer.append("extends ").append(superclassName).append(" "); } buffer.append("{\n"); - if (memberTypes != null) { - for (int i = 0, max = numberOfMemberTypes; i < max; i++) { - buffer.append(memberTypes[i].toString(tab + 1)).append("\n"); - } - } if (fields != null) { for (int i = 0, max = numberOfFields; i < max; i++) { buffer.append(fields[i].toString(tab + 1)).append("\n");
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceUnit.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceUnit.java index 2d3e15c..eee3743 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceUnit.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SourceUnit.java
@@ -17,16 +17,10 @@ private int declarationStart; private int declarationEnd; private char[] fileName; - private SourcePackage packageName; - private SourceImport[] imports; - private char[] enclosingTypeName; private char[] name; private int nameSourceStart; private int nameSourceEnd; private char[] superclassName; - private char[][] interfaceNames; - private SourceType[] memberTypes; - private int numberOfMemberTypes; private SourceMethod[] methods; private int numberOfMethods; private SourceField[] fields; @@ -56,16 +50,6 @@ } fields[numberOfFields++] = sourceField; } -protected void addMemberType(SourceType sourceMemberType) { - if(memberTypes == null) { - memberTypes = new SourceType[4]; - } - - if(numberOfMemberTypes == memberTypes.length) { - System.arraycopy(memberTypes, 0, memberTypes = new SourceType[numberOfMemberTypes * 2], 0, numberOfMemberTypes); - } - memberTypes[numberOfMemberTypes++] = sourceMemberType; -} protected void addMethod(SourceMethod sourceMethod) { if (methods == null) { methods = new SourceMethod[4]; @@ -113,9 +97,6 @@ public int getDeclarationSourceStart() { return declarationStart; } -public char[] getEnclosingTypeName() { - return enclosingTypeName; -} public SourceField[] getFields() { if (fields != null && fields.length != numberOfFields) { System.arraycopy(fields, 0, fields = new SourceField[numberOfFields], 0, numberOfFields); @@ -125,29 +106,6 @@ public char[] getFileName() { return fileName; } -public char[][] getImports() { - if (imports == null) return null; - int importLength = imports.length; - char[][] importNames = new char[importLength][]; - for (int i = 0, max = importLength; i < max; i++) { - importNames[i] = imports[i].name; - } - return importNames; -} -public char[][] getInterfaceNames() { - return interfaceNames; -} -public SourceType[] getMemberTypes() { - if (memberTypes != null && memberTypes.length != numberOfMemberTypes) { - System.arraycopy( - memberTypes, - 0, - memberTypes = new SourceType[numberOfMemberTypes], - 0, - numberOfMemberTypes); - } - return memberTypes; -} public SourceMethod[] getMethods() { if (methods != null && methods.length != numberOfMethods) { System.arraycopy(methods, 0, methods = new SourceMethod[numberOfMethods], 0, numberOfMethods); @@ -166,14 +124,9 @@ public int getNameSourceStart() { return nameSourceStart; } -public char[] getPackageName() { - return packageName.name; -} public char[] getQualifiedName() { if (qualifiedName == null) { StringBuffer temp = new StringBuffer(); - temp.append(packageName); - temp.append('.'); temp.append(name); qualifiedName = temp.toString().toCharArray(); } @@ -194,18 +147,9 @@ public void setDefaultConstructor(String s) { this.defaultConstructor = s; } -public void setImports(SourceImport[] imports) { - this.imports = imports; -} -public void setPackage(SourcePackage sourcePackage) { - packageName = sourcePackage; -} public void setSuperclass(char[] superclassName) { this.superclassName = superclassName; } -public void setSuperinterfaces(char[][] superinterfacesNames) { - this.interfaceNames = superinterfacesNames; -} public String tabString(int tab) { /*slow code*/
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/StatementRecoveryTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/StatementRecoveryTest.java index a7480c2..d1b118a 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/StatementRecoveryTest.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/StatementRecoveryTest.java
@@ -12,8 +12,6 @@ import java.util.Locale; -import junit.framework.Test; - import org.eclipse.wst.jsdt.internal.compiler.CompilationResult; import org.eclipse.wst.jsdt.internal.compiler.DefaultErrorHandlingPolicies; import org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration; @@ -29,17 +27,8 @@ public class StatementRecoveryTest extends AbstractCompilerTest { public static final boolean ONLY_DIET_PLUS_BODY_WITH_STATEMENT_RECOVERY = true; - public static boolean optimizeStringLiterals = false; - public static long sourceLevel = ClassFileConstants.JDK1_3; //$NON-NLS-1$ -static { -// TESTS_NAMES = new String[] { "test0037"}; -// TESTS_RANGE = new int[] {10, 20}; -} -public static Test suite() { - return buildAllCompliancesTestSuite(StatementRecoveryTest.class); -} public StatementRecoveryTest(String testName){ super(testName); } @@ -155,19 +144,14 @@ CompilationUnitDeclaration computedUnit = parser.dietParse(sourceUnit, compilationResult); String computedUnitToString = computedUnit.toString(); - if (!expectedDietWithStatementRecoveryUnitToString.equals(computedUnitToString)){ - System.out.println(Util.displayString(computedUnitToString)); - } - assertEquals( - "Invalid unit diet structure" + testName, - expectedDietWithStatementRecoveryUnitToString, - computedUnitToString); - if (computedUnit.types != null) { - for (int i = computedUnit.types.length; --i >= 0;){ - computedUnit.types[i].parseMethod(parser, computedUnit); - } - } - computedUnitToString = computedUnit.toString(); +// if (!expectedDietWithStatementRecoveryUnitToString.equals(computedUnitToString)){ +// System.out.println(Util.displayString(computedUnitToString)); +// } +// assertEquals( +// "Invalid unit diet structure" + testName, +// expectedDietWithStatementRecoveryUnitToString, +// computedUnitToString); +// computedUnitToString = computedUnit.toString(); if (!expectedDietPlusBodyWithStatementRecoveryUnitToString.equals(computedUnitToString)){ System.out.println(Util.displayString(computedUnitToString)); } @@ -232,9 +216,9 @@ public void test0001() { String s = - " function foo() { \n" - + " System.out.println(); \n" - + "} \n"; + "function foo() { \n" + + " System.out.println(); \n" + + "} \n"; String expectedDietUnitToString = "function foo() {\n" + @@ -272,7 +256,7 @@ public void test0002() { String s = - " function foo() { \n" + " function foo() { \n" + " # \n" + " System.out.println(); \n" + "} \n"; @@ -415,21 +399,30 @@ + "} \n"; String expectedDietUnitToString = - "foo = function () {\n" + - " System.out.println();\n"+ + "obj = {\n" + + " p1 : 2,\n" + + " meth : function () {\n" + + " FOO();\n" + + "}\n" + "};\n"; String expectedDietWithStatementRecoveryUnitToString = expectedDietUnitToString; String expectedDietPlusBodyUnitToString = - "foo = function () {\n" + - " System.out.println();\n"+ - "}\n"; + "obj = {\n" + + " p1 : 2,\n" + + " meth : function () {\n" + + " FOO();\n" + + "}\n" + + "};\n"; String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "foo = function () {\n" + - " System.out.println();\n"+ + "obj = {\n" + + " p1 : 2,\n" + + " meth : function () {\n" + + " FOO();\n" + + "}\n" + "};\n"; String expectedFullUnitToString = @@ -449,58 +442,6 @@ expectedFullWithStatementRecoveryUnitToString, testName); } - - - -public void test0002d() { - - String s = - " a= foo{ \n" - +" function () { \n" - + " # \n" - + " bar(); \n" - + "} \n" - + "); \n"; - - String expectedDietUnitToString = - "foo = function () {\n" + - " System.out.println();\n"+ - "};\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "foo = function () {\n" + - " System.out.println();\n"+ - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "foo = function () {\n" + - " System.out.println();\n"+ - "};\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} - - - - public void test0003() { String s = @@ -561,21 +502,36 @@ + "} \n"; String expectedDietUnitToString = - "function foo() {\n" + - " System.out.println();\n"+ + "function foo1() {\n" + + "}\n" + + "function foo2() {\n" + + "}\n" + + "function foo3() {\n" + "}\n"; String expectedDietWithStatementRecoveryUnitToString = expectedDietUnitToString; String expectedDietPlusBodyUnitToString = - "function foo() {\n" + - " System.out.println();\n"+ + "function foo1() {\n" + + " var i;\n" + + "}\n" + + "function foo2() {\n" + + " a = 1;\n" + + "}\n" + + "function foo3() {\n" + + " var k;\n" + "}\n"; String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "function foo() {\n" + - " System.out.println();\n"+ + "function foo1() {\n" + + " var i;\n" + + "}\n" + + "function foo2() {\n" + + " a = 1;\n" + + "}\n" + + "function foo3() {\n" + + " var k;\n" + "}\n"; String expectedFullUnitToString = @@ -812,9 +768,8 @@ public void test0008() { String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" + "function X() { \n" + + " function foo() { \n" + " System.out.println(); \n" + " if(true) { \n" + " System.out.println(); \n" @@ -825,11 +780,8 @@ + "} \n"; String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " }\n" + "}\n"; @@ -837,22 +789,14 @@ expectedDietUnitToString; String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " }\n" + "}\n"; String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " System.out.println();\n" + " if (true)\n" + " {\n" + @@ -882,9 +826,8 @@ public void test0009() { String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" + "function X() { \n" + + " function foo() { \n" + " System.out.println(); \n" + " if(true) { \n" + " System.out.println(); \n" @@ -900,11 +843,8 @@ + "} \n"; String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " }\n" + "}\n"; @@ -912,22 +852,14 @@ expectedDietUnitToString; String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " }\n" + "}\n"; String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " System.out.println();\n" + " if (true)\n" + " {\n" + @@ -963,2098 +895,15 @@ public void test0010() { String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " class Z { \n" - + " void foo() {} \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietPlusBodyUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietPlusBodyUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0011() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " class Z { \n" - + " void foo() {} \n" - + " } \n" - + " System.out.println(); \n" - + " # \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0012() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " # \n" - + " System.out.println(); \n" - + " class Z { \n" - + " void foo() {} \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0013() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " class Z { \n" - + " void foo() {} \n" - + " } \n" - + " System.out.println(); \n" - + " # \n" - + " System.out.println(); \n" - + " class Y { \n" - + " void foo() {} \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " System.out.println();\n" + - " class Y {\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0014() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " class Z { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " System.out.println(); \n" - + " # \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0015() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " # \n" - + " System.out.println(); \n" - + " class Z { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0016() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " class Z { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " System.out.println(); \n" - + " # \n" - + " System.out.println(); \n" - + " class Z { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " System.out.println();\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0017() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " class Z { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " # \n" - + " } \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0018() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " class Z { \n" - + " void foo() { \n" - + " # \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0019() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " class Z { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " # \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0020() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " # \n" - + " System.out.println(); \n" - + " class Z { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " # \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0021() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " new Object() { \n" - + " void foo() {} \n" - + " }; \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new Object() {\n" + - " void foo() {\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new Object() {\n" + - " void foo() {\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietPlusBodyUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietPlusBodyUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0022() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " new Object() { \n" - + " void foo() {} \n" - + " }; \n" - + " System.out.println(); \n" - + " # \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0023() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " # \n" - + " System.out.println(); \n" - + " new Object() { \n" - + " void bar() {} \n" - + " }; \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0024() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " new Object() { \n" - + " void bar() {} \n" - + " }; \n" - + " System.out.println(); \n" - + " # \n" - + " System.out.println(); \n" - + " new Object() { \n" - + " void bar() {} \n" - + " }; \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " System.out.println();\n" + - " new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void bar() {\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0025() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " new Object() { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " }; \n" - + " System.out.println(); \n" - + " # \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0026() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " # \n" - + " System.out.println(); \n" - + " new Object() { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " }; \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0027() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " new Object() { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " }; \n" - + " System.out.println(); \n" - + " # \n" - + " System.out.println(); \n" - + " new Object() { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " }; \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " System.out.println();\n" + - " new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0028() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " new Object() { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " # \n" - + " } \n" - + " }; \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0029() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " new Object() { \n" - + " void foo() { \n" - + " # \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + " }; \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0030() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " new Object() { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " # \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + " }; \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0031() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " # \n" - + " System.out.println(); \n" - + " new Object() { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " # \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + " }; \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - " };\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0032() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " # \n" - + " System.out.println(); \n" - + " bar(new Object() { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " # \n" - + " System.out.println(); \n" - + " if(true) { \n" - + " System.out.println(); \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + " }); \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " bar(new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " System.out.println();\n" + - " if (true)\n" + - " {\n" + - " System.out.println();\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - "});\n" + - " System.out.println();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0033() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " # \n" - + " class Z { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " class Z {\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0034() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " # \n" - + " new Object() { \n" - + " void foo() { \n" - + " System.out.println(); \n" - + " } \n" - + " }; \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " new Object() {\n" + - " () {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " System.out.println();\n" + - " }\n" + - " };\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0035() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" + "function X() { \n" + + " function foo() { \n" + " bar(\\u0029 \n" + " } \n" + "} \n"; String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " }\n" + "}\n"; @@ -3062,22 +911,14 @@ expectedDietUnitToString; String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " }\n" + "}\n"; String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " bar();\n" + " }\n" + "}\n"; @@ -3099,12 +940,11 @@ expectedFullWithStatementRecoveryUnitToString, testName); } -public void test0036() { +public void test0011() { String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" + "function X() { \n" + + " function foo() { \n" + " if(true) { \n" + " foo(); \n" + " } \n" @@ -3116,11 +956,8 @@ + "} \n"; String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " }\n" + "}\n"; @@ -3128,22 +965,14 @@ expectedDietUnitToString; String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " }\n" + "}\n"; String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " if (true)\n" + " {\n" + " foo();\n" + @@ -3174,12 +1003,11 @@ expectedFullWithStatementRecoveryUnitToString, testName); } -public void test0037() { +public void test0012() { String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" + "function X() { \n" + + " function foo() { \n" + " if() { \n" + " foo(); \n" + " } \n" @@ -3187,11 +1015,8 @@ + "} \n"; String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " }\n" + "}\n"; @@ -3199,22 +1024,14 @@ expectedDietUnitToString; String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " }\n" + "}\n"; String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + + "function X() {\n" + + " function foo() {\n" + " if ($missing$)\n" + " {\n" + " foo();\n" + @@ -3239,44 +1056,18 @@ expectedFullWithStatementRecoveryUnitToString, testName); } -public void test0038() { +public void test0013() { + String s = - "package p1; \n"+ - "public class A { \n"+ - " public interface B { \n"+ - " public abstract void aMethod (int A); \n"+ - " public interface C { \n"+ - " public abstract void anotherMethod(int A);\n"+ - " } \n"+ - " } \n"+ - " public class aClass implements B, B.C { \n"+ - " public void aMethod (int A) { \n"+ - " public void anotherMethod(int A) {}; \n"+ - " } \n"+ - " } \n"+ - " public static void main (String argv[]) { \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - "}"; + "function X() { \n" + + " function foo() { \n" + + " for(var i \n" + + " } \n" + + "} \n"; String expectedDietUnitToString = - "package p1;\n" + - "public class A {\n" + - " public interface B {\n" + - " public interface C {\n" + - " public abstract void anotherMethod(int A);\n" + - " }\n" + - " public abstract void aMethod(int A);\n" + - " }\n" + - " public class aClass implements B, B.C {\n" + - " public aClass() {\n" + - " }\n" + - " public void aMethod(int A) {\n" + - " }\n" + - " }\n" + - " public A() {\n" + - " }\n" + - " public static void main(String[] argv) {\n" + + "function X() {\n" + + " function foo() {\n" + " }\n" + "}\n"; @@ -3284,432 +1075,16 @@ expectedDietUnitToString; String expectedDietPlusBodyUnitToString = - "package p1;\n" + - "public class A {\n" + - " public interface B {\n" + - " public interface C {\n" + - " public abstract void anotherMethod(int A);\n" + - " }\n" + - " public abstract void aMethod(int A);\n" + - " }\n" + - " public class aClass implements B, B.C {\n" + - " public aClass() {\n" + - " super();\n" + - " }\n" + - " public void aMethod(int A) {\n" + - " }\n" + - " }\n" + - " public A() {\n" + - " super();\n" + - " }\n" + - " public static void main(String[] argv) {\n" + - " System.out.println(\"SUCCESS\");\n" + + "function X() {\n" + + " function foo() {\n" + " }\n" + "}\n"; String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package p1;\n" + - "public class A {\n" + - " public interface B {\n" + - " public interface C {\n" + - " public abstract void anotherMethod(int A);\n" + - " }\n" + - " public abstract void aMethod(int A);\n" + - " }\n" + - " public class aClass implements B, B.C {\n" + - " public aClass() {\n" + - " super();\n" + - " }\n" + - " public void aMethod(int A) {\n" + - " public void anotherMethod;\n" + - " int A;\n" + + "function X() {\n" + + " function foo() {\n" + + " for (var i in $missing$) \n" + " ;\n" + - " }\n" + - " }\n" + - " public A() {\n" + - " super();\n" + - " }\n" + - " public static void main(String[] argv) {\n" + - " System.out.println(\"SUCCESS\");\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - "package p1;\n" + - "public class A {\n" + - " public interface B {\n" + - " public interface C {\n" + - " public abstract void anotherMethod(int A);\n" + - " }\n" + - " public abstract void aMethod(int A);\n" + - " }\n" + - " public class aClass implements B, B.C {\n" + - " public aClass() {\n" + - " }\n" + - " public void aMethod(int A) {\n" + - " }\n" + - " public void anotherMethod(int A) {\n" + - " }\n" + - " }\n" + - " {\n" + - " }\n" + - " public A() {\n" + - " }\n" + - " public static void main(String[] argv) {\n" + - " }\n" + - "}\n"; - - String expectedFullWithStatementRecoveryUnitToString = - expectedFullUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0039() { - - String s = - "package a; \n" - + "public class X { \n" - + " { \n" - + " System.out.println(); \n" - + " foo() \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " {\n" + - " System.out.println();\n" + - " foo();\n" + - " System.out.println();\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0040() { - - String s = - "package a; \n" - + "public class X { \n" - + " { \n" - + " System.out.println(); \n" - + " class Y { \n" - + " { \n" - + " System.out.println(); \n" - + " foo() \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " {\n" + - " System.out.println();\n" + - " class Y {\n" + - " {\n" + - " System.out.println();\n" + - " foo();\n" + - " System.out.println();\n" + - " }\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0041() { - - String s = - "package a; \n" - + "public class X { \n" - + " { \n" - + " System.out.println(); \n" - + " class Y { \n" - + " { \n" - + " System.out.println(); \n" - + " foo() \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " System.out.println(); \n" - + " class Z { \n" - + " { \n" - + " System.out.println(); \n" - + " foo() \n" - + " System.out.println(); \n" - + " } \n" - + " } \n" - + " System.out.println(); \n" - + " foo() \n" - + " System.out.println(); \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " {\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " {\n" + - " System.out.println();\n" + - " class Y {\n" + - " {\n" + - " System.out.println();\n" + - " foo();\n" + - " System.out.println();\n" + - " }\n" + - " Y() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " class Z {\n" + - " {\n" + - " System.out.println();\n" + - " foo();\n" + - " System.out.println();\n" + - " }\n" + - " Z() {\n" + - " super();\n" + - " }\n" + - " }\n" + - " System.out.println();\n" + - " foo();\n" + - " System.out.println();\n" + - " }\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} -public void test0042() { - - String s = - "package a; \n" - + "public class X { \n" - + " void foo() { \n" - + " for(int i \n" - + " } \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public class X {\n" + - " public X() {\n" + - " super();\n" + - " }\n" + - " void foo() {\n" + - " for (int i;; ; ) \n" + - " ;\n" + - " }\n" + - "}\n"; - - String expectedFullUnitToString = - expectedDietUnitToString; - - String expectedFullWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String testName = "<test>"; - checkParse( - s.toCharArray(), - expectedDietUnitToString, - expectedDietWithStatementRecoveryUnitToString, - expectedDietPlusBodyUnitToString, - expectedDietPlusBodyWithStatementRecoveryUnitToString, - expectedFullUnitToString, - expectedFullWithStatementRecoveryUnitToString, - testName); -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=80339 -public void test0043() { - - String s = - "package a; \n" - + "public interface Test { \n" - + " public void myMethod() \n" - + "} \n"; - - String expectedDietUnitToString = - "package a;\n" + - "public interface Test {\n" + - " public void myMethod() {\n" + - " }\n" + - "}\n"; - - String expectedDietWithStatementRecoveryUnitToString = - expectedDietUnitToString; - - String expectedDietPlusBodyUnitToString = - "package a;\n" + - "public interface Test {\n" + - " public void myMethod() {\n" + - " }\n" + - "}\n"; - - String expectedDietPlusBodyWithStatementRecoveryUnitToString = - "package a;\n" + - "public interface Test {\n" + - " public void myMethod() {\n" + " }\n" + "}\n";
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SyntaxErrorTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SyntaxErrorTest.java index dd1a787..678ed29 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SyntaxErrorTest.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/SyntaxErrorTest.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 @@ -28,7 +28,6 @@ public class SyntaxErrorTest extends AbstractCompilerTest { public static boolean optimizeStringLiterals = false; - public static long sourceLevel = ClassFileConstants.JDK1_3; //$NON-NLS-1$ public SyntaxErrorTest(String testName){ super(testName); @@ -86,13 +85,13 @@ * Should diagnose parenthesis mismatch */ //TODO - fix bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=279009 -public void Xtest01() { +public void test01() { String s = "function X() { \n"+ " function solve(){ \n"+ " \n"+ - " var results = new X[10]; \n"+ + " var results = new Array(10); \n"+ " for(var i = 0; i < 10; i++){ \n"+ " var result = results[i]; \n"+ " var found = false; \n"+ @@ -113,7 +112,12 @@ " if (this == (result.documentName){ \n" + " ^\n" + "Syntax error, insert \") BlockStatement\" to complete BlockStatements\n" + - "----------\n"; + "----------\n" + + "2. ERROR in <parenthesis mismatch> (at line 1)\n" + + " if (this == (result.documentName){ \n" + + " ^\n" + + "Syntax error, insert \") BlockStatement\" to complete BlockStatements\n" + + "----------\n";; String testName = "<parenthesis mismatch>"; checkParse( @@ -324,4 +328,22 @@ expectedSyntaxErrorDiagnosis, testName); } + +public void testWI106610() { + String s = "\n<!-- Begin"; + + String expectedSyntaxErrorDiagnosis = + "----------\n" + + "1. ERROR in <test> (at line 2)\n" + + " <!-- Begin\n" + + " ^\n" + + "Syntax error on token \"<\", delete this token\n" + + "----------\n"; + + String testName = "<test>"; + checkParse( + s.toCharArray(), + expectedSyntaxErrorDiagnosis, + testName); +} }
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/TestAll.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/TestAll.java deleted file mode 100644 index 67161d6..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/TestAll.java +++ /dev/null
@@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.parser; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase; -import org.eclipse.wst.jsdt.core.tests.util.AbstractCompilerTest; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * Run all parser regression tests - */ -public class TestAll extends junit.framework.TestCase { - - public final static List TEST_CLASSES_1_5 = new ArrayList(); - static { - /* completion tests */ - TEST_CLASSES_1_5.addAll(RunCompletionParserTests.TEST_CLASSES_1_5); - } - -public TestAll(String testName) { - super(testName); -} - -public static Test suite() { - ArrayList testClasses = new ArrayList(); - - /* completion tests */ - testClasses.addAll(RunCompletionParserTests.TEST_CLASSES); - - /* selection tests */ - testClasses.add(ExplicitConstructorInvocationSelectionTest.class); - testClasses.add(SelectionTest.class); - testClasses.add(SelectionTest2.class); - testClasses.add(SelectionJavadocTest.class); - - /* recovery tests */ - testClasses.add(DietRecoveryTest.class); - testClasses.add(StatementRecoveryTest.class); - - /* source element parser tests */ - testClasses.add(SourceElementParserTest.class); - - /* syntax error diagnosis tests */ - testClasses.add(SyntaxErrorTest.class); - testClasses.add(DualParseSyntaxErrorTest.class); - testClasses.add(ParserTest.class); - testClasses.add(ComplianceDiagnoseTest.class); - - TestSuite all = new TestSuite(TestAll.class.getName()); - int possibleComplianceLevels = AbstractCompilerTest.getPossibleComplianceLevels(); - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_3) != 0) { - ArrayList tests_1_3 = (ArrayList)testClasses.clone(); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_3, tests_1_3)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_4) != 0) { - ArrayList tests_1_4 = (ArrayList)testClasses.clone(); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_4, tests_1_4)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_5) != 0) { - ArrayList tests_1_5 = (ArrayList)testClasses.clone(); - tests_1_5.addAll(TEST_CLASSES_1_5); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_5, tests_1_5)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_6) != 0) { - ArrayList tests_1_6 = (ArrayList)testClasses.clone(); - tests_1_6.addAll(TEST_CLASSES_1_5); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_6, tests_1_6)); - } - if ((possibleComplianceLevels & AbstractCompilerTest.F_1_7) != 0) { - ArrayList tests_1_7 = (ArrayList)testClasses.clone(); - tests_1_7.addAll(TEST_CLASSES_1_5); - // Reset forgotten subsets tests - TestCase.TESTS_PREFIX = null; - TestCase.TESTS_NAMES = null; - TestCase.TESTS_NUMBERS= null; - TestCase.TESTS_RANGE = null; - TestCase.RUN_ONLY_ID = null; - all.addTest(AbstractCompilerTest.buildComplianceTestSuite(AbstractCompilerTest.COMPLIANCE_1_7, tests_1_7)); - } - - return all; -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/TestSourceElementRequestor.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/TestSourceElementRequestor.java index 4e06d49..c5ff6d8 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/TestSourceElementRequestor.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/parser/TestSourceElementRequestor.java
@@ -39,7 +39,7 @@ /** * acceptMethodReference method comment. */ -public void acceptMethodReference(char[] methodName, int argCount, int sourcePosition) {} +public void acceptMethodReference(char[] methodName, int sourcePosition) {} /** * acceptPackage method comment. */
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ASTImplTests.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ASTImplTests.java index d3501c6..adc925d 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ASTImplTests.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ASTImplTests.java
@@ -42,21 +42,6 @@ public ASTImplTests(String name) { super(name); } - - // Static initializer to specify tests subset using TESTS_* static variables - // All specified tests which does not belong to the class are skipped... - // Only the highest compliance level is run; add the VM argument - // -Dcompliance=1.4 (for example) to lower it if needed - static { -// TESTS_NAMES = new String[] { "test2050" }; -// TESTS_NUMBERS = new int[] { 3 }; -// TESTS_NUMBERS = new int[] { 2999 }; -// TESTS_RANGE = new int[] { 2050, -1 }; - } - -public static Test suite() { - return buildAllCompliancesTestSuite(testClass()); -} public static Class testClass() { return ASTImplTests.class; @@ -512,68 +497,6 @@ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); } -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102728 -// check if the generated code is OK when leveraging CombinedBinaryExpression -// variant involving constant binary expressions deep in the tree -public void test0010_combined_binary_expression() { - assertEquals(20, CombinedBinaryExpression.ARITY_MAX_MIN); - this.runConformTest( - new String[] { - "X.js", - "public class X {\n" + - " function main(String args[]) {\n" + - " final int max = 30; \n" + - " String s[] = new String[max];\n" + - " for (int i = 0; i < max; i++) {\n" + - " s[i] = \"a\";\n" + - " }\n" + - " foo(s);\n" + - "}\n" + - " function foo (s) {\n" + - " var c = \"a\";" + - " println(\n" + - " c + c + c + c + s[4] + s[5] + s[6] + s[7] + s[8] + \n" + - " s[9] + s[10] + s[11] + s[12] + s[13] + s[14] + \n" + - " s[15] + s[16] + s[17] + s[18] + s[19] + s[20] + \n" + - " s[21] + s[22] + s[23] + s[24] + s[25] + s[26] + \n" + - " s[27] + s[28] + s[29]\n" + - " );\n" + - "}\n" + - "}" - }, - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102728 -// check if the generated code is OK when leveraging CombinedBinaryExpression -// variant involving a constant combined binary expression -public void test0011_combined_binary_expression() { - assertEquals(20, CombinedBinaryExpression.ARITY_MAX_MIN); - this.runConformTest( - new String[] { - "X.js", - " function main(String args[]) {\n" + - " var max = 30; \n" + - " var s = new Array();\n" + - " for (var i = 0; i < max; i++) {\n" + - " s[i] = \"a\";\n" + - " }\n" + - " foo(s);\n" + - "}\n" + - " function foo (s) {\n" + - " var c = \"a\";" + - " println(\n" + - " c + c + c + c + c + c + c + c + c + c + \n" + - " c + c + c + c + c + c + c + c + c + c + \n" + - " c + c + s[22] + s[23] + s[24] + s[25] + s[26] + \n" + - " s[27] + s[28] + s[29]\n" + - " );\n" + - "}\n" + - "" - }, - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); -} - // AST implementation - visiting binary expressions // https://bugs.eclipse.org/bugs/show_bug.cgi?id=102728 // Adding combined binary expressions - checking recursive print
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AbstractComparableTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AbstractComparableTest.java deleted file mode 100644 index fc969d6..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AbstractComparableTest.java +++ /dev/null
@@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.regression; - -import java.util.Map; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; - -public class AbstractComparableTest extends AbstractRegressionTest { - public static Test buildComparableTestSuite(Class evaluationTestClass) { - Test suite = buildMinimalComplianceTestSuite(evaluationTestClass, F_1_5); - TESTS_COUNTERS.put(evaluationTestClass.getName(), new Integer(suite - .countTestCases())); - return suite; - } - - public AbstractComparableTest(String name) { - super(name); - } - - /* - * Toggle compiler in mode -1.5 - */ - protected Map getCompilerOptions() { - Map options = super.getCompilerOptions(); - options.put(CompilerOptions.OPTION_Compliance, - CompilerOptions.VERSION_1_5); - options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5); - options.put(CompilerOptions.OPTION_TargetPlatform, - CompilerOptions.VERSION_1_5); - options.put(CompilerOptions.OPTION_ReportFinalParameterBound, - CompilerOptions.WARNING); - options.put(CompilerOptions.OPTION_ReportUnnecessaryTypeCheck, - CompilerOptions.WARNING); - options.put(CompilerOptions.OPTION_ReportRawTypeReference, - CompilerOptions.WARNING); - return options; - } -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AbstractRegressionTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AbstractRegressionTest.java index c5a4a50..6d17423 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AbstractRegressionTest.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AbstractRegressionTest.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2013 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 @@ -20,7 +20,10 @@ import java.io.InputStreamReader; import java.io.PrintWriter; import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; +import java.util.List; import java.util.Locale; import java.util.Map; @@ -28,9 +31,11 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; import org.eclipse.wst.jsdt.core.compiler.CategorizedProblem; import org.eclipse.wst.jsdt.core.infer.DefaultInferrenceProvider; import org.eclipse.wst.jsdt.core.infer.IInferEngine; +import org.eclipse.wst.jsdt.core.infer.IInferEngineExtension; import org.eclipse.wst.jsdt.core.infer.InferEngine; import org.eclipse.wst.jsdt.core.infer.InferOptions; import org.eclipse.wst.jsdt.core.infer.InferrenceProvider; @@ -58,8 +63,6 @@ import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; import org.eclipse.wst.jsdt.internal.compiler.impl.ITypeRequestor; import org.eclipse.wst.jsdt.internal.compiler.impl.ReferenceContext; -import org.eclipse.wst.jsdt.internal.compiler.lookup.Binding; -import org.eclipse.wst.jsdt.internal.compiler.lookup.CompilationUnitScope; import org.eclipse.wst.jsdt.internal.compiler.lookup.LookupEnvironment; import org.eclipse.wst.jsdt.internal.compiler.lookup.PackageBinding; import org.eclipse.wst.jsdt.internal.compiler.lookup.TypeConstants; @@ -560,25 +563,6 @@ } - protected void runConformTest(String[] testFiles) { - runConformTest(testFiles, null /* no expected output string */, - null /* no extra class libraries */, true /* - * flush output - * directory - */, null /* - * no vm - * arguments - */, null /* - * no - * custom - * options - */, - null /* no custom requestor */, false /* - * do not skip javac for - * this peculiar test - */); - } - protected void runConformTest(String[] testFiles, String expectedSuccessOutputString) { runConformTest(testFiles, expectedSuccessOutputString, null /* @@ -586,43 +570,23 @@ * class * libraries */, - true /* flush output directory */, null /* no vm arguments */, null /* no custom options */, null /* no custom requestor */, false /* do not skip javac for this peculiar test */); } protected void runConformTest(String[] testFiles, - String expectedSuccessOutputString, String[] vmArguments) { - runConformTest(testFiles, expectedSuccessOutputString, null /* - * no extra - * class - * libraries - */, - true /* flush output directory */, vmArguments, null /* - * no custom - * options - */, - null /* no custom requestor */, false /* - * do not skip javac for - * this peculiar test - */); - } - - protected void runConformTest(String[] testFiles, String expectedSuccessOutputString, String[] classLib, - boolean shouldFlushOutputDirectory, String[] vmArguments) { + boolean shouldFlushOutputDirectory) { runConformTest(testFiles, expectedSuccessOutputString, classLib, - shouldFlushOutputDirectory, vmArguments, null /* no custom options */, null /* no custom requestor */, false /* do not skip javac for this peculiar test */); } protected void runConformTest(String[] testFiles, String expectedSuccessOutputString, String[] classLib, - boolean shouldFlushOutputDirectory, String[] vmArguments, Map customOptions, ICompilerRequestor clientRequestor) { runConformTest(testFiles, expectedSuccessOutputString, classLib, - shouldFlushOutputDirectory, vmArguments, customOptions, + customOptions, clientRequestor, false /* * do not skip javac for this peculiar * test @@ -631,14 +595,10 @@ protected void runConformTest(String[] testFiles, String expectedSuccessOutputString, String[] classLib, - boolean shouldFlushOutputDirectory, String[] vmArguments, Map customOptions, ICompilerRequestor clientRequestor, - boolean skipJavac) { + boolean skipRhino) { // Non-javac part try { - if (shouldFlushOutputDirectory) - Util.flushDirectoryContent(new File(OUTPUT_DIR)); - IProblemFactory problemFactory = getProblemFactory(); Requestor requestor = new Requestor(problemFactory, OUTPUT_DIR .endsWith(File.separator) ? OUTPUT_DIR : OUTPUT_DIR @@ -678,21 +638,14 @@ if (!requestor.hasErrors) { String sourceFile = testFiles[0]; - // Compute class name by removing ".java" and replacing slashes + // Compute class name by removing ".js" and replacing slashes // with dots String className = sourceFile.substring(0, - sourceFile.length() - 5).replace('/', '.').replace( + sourceFile.length() - 1).replace('/', '.').replace( '\\', '.'); if (className.endsWith(PACKAGE_INFO_NAME)) return; -// if (vmArguments != null) { -// if (this.verifier != null) { -// this.verifier.shutDown(); -// } -// this.verifier = new TestVerifier(false); -// this.createdVerifier = true; -// } // boolean passed = this.verifier.verifyClassFiles(sourceFile, // className, expectedSuccessOutputString, // this.classpaths, null, vmArguments); @@ -709,13 +662,6 @@ // // verifyClassFiles(...) // // action // passed); - if (vmArguments != null) { -// if (this.verifier != null) { -// this.verifier.shutDown(); -// } -// this.verifier = new TestVerifier(false); -// this.createdVerifier = true; - } } else { System.out.println(getClass().getName() + '#' + getName()); System.out.println(Util.displayString(requestor.problemLog, @@ -733,9 +679,8 @@ } catch (AssertionFailedError e) { throw e; } finally { - if (RUN_JAVAC && !skipJavac) - runJavac(testFiles, null, expectedSuccessOutputString, - shouldFlushOutputDirectory); + if (RUN_JAVAC && !skipRhino) + runWithRhino(testFiles, "", expectedSuccessOutputString); // PREMATURE for now, skipping javac implies skipping the compile // and execution steps; yet, only cases for which the // execution step was a problem have been discovered so @@ -743,12 +688,9 @@ } } - protected void runConformTest(String[] testFiles, String[] vmArguments) { + protected void runConformTest(String[] testFiles) { runConformTest(testFiles, null /* no expected output string */, - null /* no extra class libraries */, true /* - * flush output - * directory - */, vmArguments, + null /* no extra class libraries */, null /* no custom options */, null /* no custom requestor */, false /* do not skip javac for this peculiar test */); } @@ -1060,11 +1002,117 @@ } } + protected void runWithRhino(String[] testFiles, final String expectedProblemLog, final String expectedSuccessOutputString) { + String testName = null; + Process compileProcess = null; + Process execProcess = null; + try { + // Init test name + testName = testName(); + + // Write files in dir + writeFiles(testFiles); + + // Prepare command line + StringBuffer cmdLine = new StringBuffer(javaCommandLineHeader); + // compute extra classpath + String[] classpath = Util.concatWithClassLibs(JAVAC_OUTPUT_DIR, false); + List cptemp = new ArrayList(Arrays.asList(classpath)); + cptemp.add(Platform.getBundle("org.mozilla.javascript").getLocation().replaceAll("reference:", "").replaceAll("file:/", "")); +// cptemp.add(Platform.getBundle("org.eclipse.wst.jsdt.core.tests.compiler").getLocation().replaceAll("reference:", "").replaceAll("file:/", "")); +// cptemp.add(Platform.getBundle("org.eclipse.wst.jsdt.core.tests.compiler").getLocation().replaceAll("reference:", "").replaceAll("file:/", "")+"/bin/"); + classpath = (String[]) cptemp.toArray(new String[cptemp.size()]); + StringBuffer cp = new StringBuffer(" -classpath "); + int length = classpath.length; + for (int i = 0; i < length; i++) { + if (i > 0) + cp.append(File.pathSeparatorChar); + if (classpath[i].indexOf(" ") != -1) { + cp.append("\"" + classpath[i] + "\""); + } + else { + cp.append(classpath[i]); + } + } + cmdLine.append(cp); + cmdLine.append(' '); +// cmdLine.append(RhinoParser.class.getName()); +// cmdLine.append(" "); + cmdLine.append("org.mozilla.javascript.tools.shell.Main -w -f "); + + // add source files + for (int i = 0; i < testFiles.length; i += 2) { + // *.java is not enough (p1/X.js, p2/Y.js) + cmdLine.append(' '); + cmdLine.append(testFiles[i]); + } + + + // Launch process + compileProcess = Runtime.getRuntime().exec(cmdLine.toString(), null, this.outputTestDirectory); + + // Log errors + Logger errorLogger = new Logger(compileProcess.getErrorStream(), "ERROR"); + + // Log output + Logger outputLogger = new Logger(compileProcess.getInputStream(), "OUTPUT"); + + // start the threads to run outputs (standard/error) + errorLogger.start(); + outputLogger.start(); + + // Wait for end of process + int exitValue = compileProcess.waitFor(); + errorLogger.join(); // make sure we get the whole output + outputLogger.join(); + if (errorLogger.buffer.length() > 0 || outputLogger.buffer.length() > 0) { + javacFullLog.println(errorLogger.buffer.toString()); + printFiles(testFiles); + } + assertEquals(expectedProblemLog != null ? expectedProblemLog : "", errorLogger.buffer.toString()); + assertEquals(expectedSuccessOutputString != null ? expectedSuccessOutputString : "", outputLogger.buffer.toString()); + } + catch (InterruptedException e1) { + if (compileProcess != null) + compileProcess.destroy(); + if (execProcess != null) + execProcess.destroy(); + System.out.println(testName + ": Rhino parser was aborted!"); + } + catch (IOException e) { + System.out.println(testName + ": could not launch Rhino!"); + e.printStackTrace(); + } + } + /** * Log contains all problems (warnings+errors) */ protected void runNegativeTest(String[] testFiles, String expectedProblemLog) { runNegativeTest(testFiles, expectedProblemLog, null, true); + /*runNegativeTest(testFiles, expectedProblemLog, null + * no extra class + * libraries + , true + * flush + * output + * directory + , + null no custom options , + false do not generate output , + false do not show category , + false do not show warning token , false + * do not skip javac + * for this peculiar + * test + , false + * do + * not + * perform + * statements + * recovery + , + null);*/ } /** @@ -1402,7 +1450,7 @@ System.out .println("***************************************************************************"); System.out - .println("* Sun Javac compiler output archived into file:"); + .println("* Rhino output archived into file:"); System.out.println("* " + javacFullLogFileName); System.out .println("***************************************************************************"); @@ -1411,7 +1459,7 @@ CURRENT_CLASS_NAME = getClass().getName(); dualPrintln("***************************************************************************"); System.out - .print("* Comparison with Sun Javac compiler for class "); + .print("* Comparison with Rhino compiler for class "); dualPrintln(CURRENT_CLASS_NAME.substring(CURRENT_CLASS_NAME .lastIndexOf('.') + 1) + " (" @@ -1707,7 +1755,10 @@ InferEngine inferEngine = (InferEngine)inferrenceProviders[i].getInferEngine(); inferEngine.initialize(); - inferEngine.setCompilationUnit(compUnit); + if (inferEngine instanceof IInferEngineExtension) + ((IInferEngineExtension) inferEngine).setCompilationUnit(compUnit, parser.scanner.getSource()); + else + inferEngine.setCompilationUnit(compUnit); inferEngine.doInfer(); } @@ -1732,15 +1783,18 @@ * @param expectedInfference expected inferred type after inferring and building * @param inferOptions {@link InferOptions} to use when inferring and building * @param inferrenceProvider {@link InferrenceProvider} to use when inferring + * @return */ - protected void runInferAndBuildBindingsTest(String source, String expectedInfference, InferOptions inferOptions, + protected CompilationUnitDeclaration[] runInferAndBuildBindingsTest(String source, String expectedInfference, InferOptions inferOptions, InferrenceProvider inferrenceProvider) { - this.runInferAndBuildBindingsTest( + CompilationUnitDeclaration[] compUnits = this.runInferAndBuildBindingsTest( new String[] {source}, new String[] {expectedInfference}, inferOptions, new InferrenceProvider[] {inferrenceProvider}); + + return compUnits; } /** @@ -1752,8 +1806,9 @@ * @param expectedInfferences expected inferred types after inferring and building * @param inferOptions {@link InferOptions} to use when inferring and building * @param inferrenceProviders {@link InferrenceProvider}s to use when inferring + * @return */ - protected void runInferAndBuildBindingsTest(String[] sources, String[] expectedInfferences, InferOptions inferOptions, + protected CompilationUnitDeclaration[] runInferAndBuildBindingsTest(String[] sources, String[] expectedInfferences, InferOptions inferOptions, InferrenceProvider[] inferrenceProviders) { IProblemFactory problemFactory = new DefaultProblemFactory(Locale.getDefault()); @@ -1778,11 +1833,13 @@ InferEngine inferEngine = (InferEngine)inferrenceProviders[j].getInferEngine(); inferEngine.initialize(); - inferEngine.setCompilationUnit(compUnits[i]); + if (inferEngine instanceof IInferEngineExtension) + ((IInferEngineExtension) inferEngine).setCompilationUnit(compUnits[i], parser.scanner.getSource()); + else + inferEngine.setCompilationUnit(compUnits[i]); inferEngine.doInfer(); } - compUnits[i].scope = new CompilationUnitScope(compUnits[i], env); env.buildTypeBindings(compUnits[i], null); } @@ -1794,9 +1851,11 @@ StringBuffer sb = new StringBuffer(); compUnits[i].printInferredTypes(sb); String result = sb.toString(); + assertEquals(expectedInfferences[i], result); } } + return compUnits; } private class DoNothingProblemReporter extends ProblemReporter {
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AssignmentTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AssignmentTest.java index 9514ccb..cbff029 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AssignmentTest.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/AssignmentTest.java
@@ -29,26 +29,6 @@ return options; } - /* - * no effect assignment bug - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=27235 - */ - public void test001() { - this.runConformTest( - new String[] { - "X.js", - " var i; \n" + " function X(j) { \n" - + " i = j; \n" + " } \n" - + " function B() { \n" - + " this.i =this.i; \n" - + " } \n" - + " function main( args) { \n" - + " X a = new X(3); \n" - + " print(a.i + \" \"); \n" - + " print(a.new B().i); \n" + " } \n" - + "} \n", }, "3 3"); - } - public void test002() { this .runNegativeTest( @@ -72,65 +52,28 @@ + " this. a = next.a; \n" + " } \n" + "\n", }, "----------\n" - + "2. ERROR in X.js (at line 5)\n" - + " zork = zork; \n" - + " ^^^^\n" - + "zork cannot be resolved\n" - + "----------\n" - + "3. ERROR in X.js (at line 6)\n" - + " arg = zork; \n" - + " ^^^^\n" - + "zork cannot be resolved\n" - + "----------\n" - + "4. ERROR in X.js (at line 8)\n" + + "1. ERROR in X.js (at line 8)\n" + " arg = arg; // noop \n" + " ^^^^^^^^^\n" + "The assignment to variable arg has no effect\n" + "----------\n" - + "5. ERROR in X.js (at line 9)\n" + + "2. ERROR in X.js (at line 9)\n" + " a = a; // noop \n" + " ^^^^^\n" + "The assignment to variable a has no effect\n" + "----------\n" - + "6. ERROR in X.js (at line 10)\n" + + "3. ERROR in X.js (at line 10)\n" + " this.next = this.next; // noop \n" + " ^^^^^^^^^^^^^^^^^^^^^\n" + "The assignment to variable next has no effect\n" + "----------\n" - + "7. ERROR in X.js (at line 11)\n" + + "4. ERROR in X.js (at line 11)\n" + " this.next = next; // noop \n" + " ^^^^^^^^^^^^^^^^\n" + "The assignment to variable next has no effect\n" + "----------\n"); } - // // final multiple assignment - // public void test020() { - // this.runNegativeTest( - // new String[] { - // "X.js", - // " function foo() {\n" + - // " var v;\n" + - // " for (var i = 0; i < 10; i++) {\n" + - // " v = i;\n" + - // " }\n" + - // " v = 0;\n" + - // " }\n" + - // "\n", - // }, - // "----------\n" + - // "1. ERROR in X.js (at line 4)\n" + - // " v = i;\n" + - // " ^\n" + - // "The final local variable v may already have been assigned\n" + - // "----------\n" + - // "2. ERROR in X.js (at line 6)\n" + - // " v = 0;\n" + - // " ^\n" + - // "The final local variable v may already have been assigned\n" + - // "----------\n"); - // } - // null part has been repeated into NullReferenceTest#test1033 public void test033() { this @@ -144,173 +87,13 @@ + " b=\"World!\";\n" + " }\n" + " println(a+b);\n" + " }\n" + "\n", }, "----------\n" - + "1. ERROR in X.js (at line 6)\n" - + " }while(a!=null);\n" - + " ^\n" - + "The variable a cannot be null; it was either set to a non-null value or assumed to be non-null when last used\n" - + "----------\n" - + "2. ERROR in X.js (at line 8)\n" - + " if(a!=null)\n" - + " ^\n" - + "The variable a can only be null; it was either set to null or checked for null when last used\n" - + "----------\n" - + "3. ERROR in X.js (at line 12)\n" + + "1. WARNING in X.js (at line 12)\n" + " println(a+b);\n" - + " ^\n" + + " ^\n" + "The local variable b may not have been initialized\n" + "----------\n"); } - // https://bugs.eclipse.org/bugs/show_bug.cgi?id=84215 - // TODO (philippe) should move to InitializationTest suite - public void test034() { - this.runConformTest(new String[] { - "X.js", - "public final class X \n" + "{\n" + " var vdg;\n" - + " var aa = null;\n" + " var a = 14;\n" - + " var b = 3;\n" + " var c = 12;\n" - + " var d = 2; \n" + " var e = 3; \n" - + " var f = 34; \n" + " var g = 35; \n" - + " var h = 36; \n" + " var j = 4;\n" - + " var k = 1;\n" + " var aba = 1;\n" - + " var as = 11;\n" + " var ad = 12;\n" - + " var af = 13;\n" + " var ag = 2;\n" - + " var ah = 21;\n" + " var aj = 22;\n" - + " var ak = 3;\n" + " var aaad = null;\n" - + " var aaaf = 1;\n" + " var aaag = 2;\n" - + " var aaha = 2;\n" + " var cxvvb = 1;\n" - + " var z = a;\n" + " var asdff;\n" + " var ppfp;\n" - + " var ppfpged;\n" + " boolean asfadf;\n" - + " boolean cbxbx;\n" + " long tyt, rrky;\n" - + " var dgjt, ykjr6y;\n" + " var krykr = 1;\n" - + " var rykr5;\n" + " var dhfg;\n" - + " var dthj;\n" + " var fkffy;\n" - + " var fhfy;\n" + " var fhmf;\n" - + " var ryur6;\n" + " var dhdthd;\n" - + " var dth5;\n" + " var kfyk;\n" + " var ntd;\n" - + " var asdasdads;\n" + " var dntdr = 7;\n" - + " var asys = 1;\n" + " var djd5rwas = 11;\n" - + " var dhds45rjd = 12;\n" - + " var srws4jd = 13;\n" + " var s4ts = 2;\n" - + " var dshes4 = 21;\n" - + " var drthed56u = 22;\n" - + " var drtye45 = 23;\n" + " var xxbxrb = 3;\n" - + " var xfbxr = 31;\n" + " var asgw4y = 32;\n" - + " var hdtrhs5r = 33;\n" + " var dshsh = 34;\n" - + " var ds45yuwsuy = 4;\n" - + " var astgs45rys = 5;\n" + " var srgs4y = 6;\n" - + " var srgsryw45 = -6;\n" - + " var srgdtgjd45ry = -7;\n" - + " var srdjs43t = 1;\n" - + " var sedteued5y = 2;\n" + " var jrfd6u;\n" - + " var udf56u;\n" + " var jf6tu;\n" - + " var jf6tud;\n" + " var bsrh;\n" + " X(var a)\n" - + " {\n" + " }\n" + " long sfhdsrhs;\n" - + " boolean qaafasdfs;\n" + " var sdgsa;\n" - + " long dgse4;\n" + " long sgrdsrg;\n" - + " function gdsthsr()\n" + " {\n" + " }\n" - + " var hsrhs;\n" + " function hsrhsdsh()\n" + " {\n" - + " }\n" + " var dsfhshsr;\n" - + " function sfhsh4rsrh()\n" + " {\n" + " }\n" - + " function shsrhsh()\n" + " {\n" + " }\n" - + " function sfhstuje56u()\n" + " {\n" + " }\n" - + " function dhdrt6u()\n" + " {\n" + " }\n" - + " function hdtue56u()\n" + " {\n" + " }\n" - + " function htdws4()\n" + " {\n" + " }\n" - + " var mfmgf;\n" + " var mgdmd;\n" + " var mdsrh;\n" - + " var nmdr;\n" + " function oyioyio()\n" + " {\n" - + " }\n" + " long oyioyreye()\n" + " {\n" - + " return 0;\n" + " }\n" + " long etueierh()\n" - + " {\n" + " return 0;\n" + " }\n" - + " function sdfgsgs()\n" + " {\n" + " }\n" - + " function fhsrhsrh()\n" + " {\n" + " }\n" + "\n" - + " long dcggsdg;\n" + " var ssssssgsfh;\n" - + " long ssssssgae;\n" + " long ssssssfaseg;\n" - + " function zzzdged()\n" + " {\n" + " }\n" + " \n" - + " var t;\n" + " function xxxxxcbsg()\n" + " {\n" - + " }\n" + "\n" + " \n" + " function vdg()\n" + " {\n" - + " }\n" + " \n" + " int[] fffcvffffffasdfaef;\n" - + " int[] fffcffffffasdfaef;\n" - + " long[] ffcvfffffffasdfaef;\n" - + " var fffffghffffasdfaef; \n" - + " var fffffdffffasdfaef; \n" - + " var ffafffffffasdfaef;\n" + " \n" - + " function fffffffffasdfaef()\n" + " {\n" + " }\n" - + " \n" + " boolean aaaadgasrg;\n" - + " function ddddgaergnj()\n" + " {\n" + " }\n" + "\n" - + " function aaaadgaeg()\n" + " {\n" + " }\n" + " \n" - + " function aaaaaaefadfgh()\n" + " {\n" + " }\n" - + " \n" + " function addddddddafge()\n" + " {\n" - + " }\n" + " \n" + " boolean aaaaaaaefae;\n" - + " function aaaaaaefaef()\n" + " {\n" + " }\n" + "\n" - + " function ggggseae()\n" + " {\n" + " }\n" + "\n" - + " function ggggggsgsrg()\n" + " {\n" + " }\n" - + "\n" + " synchronized function ggggggfsfgsr()\n" - + " {\n" + " }\n" + "\n" + " function aaaaaadgaeg()\n" - + " {\n" + " }\n" + " \n" - + " function aaaaadgaerg()\n" + " {\n" + " }\n" - + " \n" + " function bbbbbbsfryghs()\n" + " {\n" - + " }\n" + " \n" + " function bfbbbbbbfssreg()\n" - + " {\n" + " }\n" + "\n" + " function bbbbbbfssfb()\n" - + " {\n" + " }\n" + "\n" + " function bbbbbbfssb()\n" - + " {\n" + " }\n" + "\n" + " function bbbbfdssb()\n" - + " {\n" + " }\n" + " \n" + " boolean dggggggdsg;\n" - + "\n" + " function hdfhdr()\n" + " {\n" + " }\n" - + " \n" + " function dhdrtdrs()\n" + " {\n" + " }\n" - + " \n" + " function dghdthtdhd()\n" + " {\n" + " }\n" - + " \n" + " function dhdhdtdh()\n" + " {\n" + " }\n" - + " \n" + " function fddhdsh()\n" + " {\n" + " }\n" - + " \n" + " boolean sdffgsdg()\n" + " {\n" - + " return true;\n" + " }\n" + " \n" - + " boolean sdgsdg()\n" + " {\n" - + " return false;\n" + " }\n" + " \n" - + " function sfdgsg()\n" + " {\n" + " }\n" + "\n" - + " int[] fghtys;\n" + "\n" + " var sdsst = 1;\n" - + " X asdfahnr;\n" - + " var ssdsdbrtyrtdfhd, ssdsrtyrdbdfhd;\n" - + " var ssdsrtydbdfhd, ssdsrtydffbdfhd;\n" - + " var ssdrtyhrtysdbdfhd, ssyeghdsdbdfhd;\n" - + " var ssdsdrtybdfhd, ssdsdehebdfhd;\n" - + " var ssdthrtsdbdfhd, ssdshethetdbdfhd;\n" - + " var sstrdrfhdsdbdfhd;\n" - + " var ssdsdbdfhd, ssdsdethbdfhd;\n" - + " long ssdshdfhchddbdfhd;\n" - + " long ssdsdvbbdfhd;\n" + " \n" + " \n" - + " long ssdsdbdfhd()\n" + " {\n" + " return 0;\n" - + " }\n" + "\n" + " long sdgsrsbsf()\n" + " {\n" - + " return 0;\n" + " }\n" + "\n" - + " function sfgsfgssghr()\n" + " {\n" + " }\n" - + " \n" + " var sgsgsrg()\n" + " {\n" - + " return null;\n" + " }\n" + "\n" - + " function sdgshsdygra()\n" + " {\n" + " }\n" - + "\n" + " var sdfsdfs()\n" + " {\n" - + " return null;\n" + " }\n" + "\n" - + " boolean ryweyer;\n" + "\n" - + " function adfadfaghsfh()\n" + " {\n" + " }\n" - + " \n" + " function ghasghasrg()\n" + " {\n" - + " }\n" + "\n" + " function aadfadfaf()\n" + " {\n" - + " }\n" + "\n" + " function aadfadf()\n" + " {\n" - + " }\n" + " \n" + " var fgsfhwr()\n" + " {\n" - + " return 0;\n" + " }\n" + "\n" - + " var gdfgfgrfg()\n" + " {\n" + " return 0;\n" - + " }\n" + "\n" + " var asdfsfs()\n" + " {\n" - + " return 0;\n" + " }\n" + "\n" + " var sdgs;\n" - + " var sdfsh4e;\n" + " var gsregs = 0;\n" + " \n" - + " var sgsgsd()\n" + " {\n" + " return null;\n" - + " }\n" + "\n" - + " byte[] sdhqtgwsrh(String rsName, var id)\n" - + " {\n" + " var rs = null;\n" + " try\n" + " {\n" - + " rs = \"\";\n" + " return null;\n" + " }\n" - + " catch (Exception ex)\n" + " {\n" + " }\n" - + " finally\n" + " {\n" + " if (rs != null)\n" - + " {\n" + " try\n" + " {\n" - + " rs.toString();\n" + " }\n" - + " catch (Exception ex)\n" + " {\n" + " }\n" - + " }\n" + " }\n" + " return null;\n" + " }\n" - + "\n" + " function dgagadga()\n" + " {\n" + " }\n" - + " \n" + " var adsyasta;\n" + "}\n", }, ""); - } - /* * Check scenario: i = i++ * http://bugs.eclipse.org/bugs/show_bug.cgi?id=84480 disabled: @@ -330,31 +113,6 @@ + "----------\n"); } - public void test036() { - this - .runNegativeTest( - new String[] { - "X.js", - "\n" + " function foo() {\n" - + " var o = new Object();\n" - + " do {\n" + " o = null;\n" - + " } while (o != null);\n" - + " if (o == null) {\n" - + " // throw new Exception();\n" - + " }\n" + " }\n" + "\n", }, - "----------\n" - + "1. ERROR in X.js (at line 6)\n" - + " } while (o != null);\n" - + " ^\n" - + "The variable o can only be null; it was either set to null or checked for null when last used\n" - + "----------\n" - + "2. ERROR in X.js (at line 7)\n" - + " if (o == null) {\n" - + " ^\n" - + "The variable o can only be null; it was either set to null or checked for null when last used\n" - + "----------\n"); - } - // //https://bugs.eclipse.org/bugs/show_bug.cgi?id=93588 // public void test037() { // this.runConformTest( @@ -573,15 +331,27 @@ + " length3 = length3 = 0; // not detected\n" + " ^^^^^^^^^^^^^^^^^^^^^\n" + "The assignment to variable length3 has no effect\n" - + "----------\n" + "4. ERROR in X.js (at line 12)\n" + + "----------\n" + "4. WARNING in X.js (at line 11)\n" + + " var length1 = 0;\n" + + " ^^^^^^^\n" + + "The local variable length1 is hiding a global variable\n" + + "----------\n" + "5. ERROR in X.js (at line 12)\n" + " length1 = length1; // already detected\n" + " ^^^^^^^^^^^^^^^^^\n" + "The assignment to variable length1 has no effect\n" - + "----------\n" + "5. ERROR in X.js (at line 13)\n" + + "----------\n" + "6. WARNING in X.js (at line 13)\n" + + " var length2 = length2 = 0; // not detected\n" + + " ^^^^^^^\n" + + "The local variable length2 is hiding a global variable\n" + + "----------\n" + "7. ERROR in X.js (at line 13)\n" + " var length2 = length2 = 0; // not detected\n" + " ^^^^^^^^^^^^^^^^^^^^^\n" + "The assignment to variable length2 has no effect\n" - + "----------\n" + "6. ERROR in X.js (at line 15)\n" + + "----------\n" + "8. WARNING in X.js (at line 14)\n" + + " var length3 = 0;\n" + + " ^^^^^^^\n" + + "The local variable length3 is hiding a global variable\n" + + "----------\n" + "9. ERROR in X.js (at line 15)\n" + " length3 = length3 = 0; // not detected\n" + " ^^^^^^^^^^^^^^^^^^^^^\n" + "The assignment to variable length3 has no effect\n"
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicAnalyseTests.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicAnalyseTests.java index e2c1b11..da7ee27 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicAnalyseTests.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicAnalyseTests.java
@@ -1,8 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2010, 2012 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ package org.eclipse.wst.jsdt.core.tests.compiler.regression; import java.util.HashMap; import java.util.Map; +import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; + public class BasicAnalyseTests extends AbstractRegressionTest { public BasicAnalyseTests(String name) { super(name); @@ -197,4 +209,355 @@ "----------\n" ); } + + public void testWI82701() { + this.runNegativeTest( + new String[] { + "X.js", + "function foo() {\n" + + "var content = {};\n" + + "var content1 = {};\n" + + "if(useLocation) {\n" + + "content.geocode = \"123,123\";\n" + + "doSearch(content);\n" + + "} else {\n" + + "doSearch(content);\n" + + "}\n" + + "}" + }, + "----------\n" + + "1. WARNING in X.js (at line 3)\n" + + " var content1 = {};\n" + + " ^^^^^^^^\n" + + "The local variable content1 is never read\n" + + "----------\n" + ); + } + + public void testWI93475() { + this.runNegativeTest( + new String[] { + "X.js", + "function value() {this.val = 3;}\n" + + "this.value = this.options[si != -1 ? si : 0].value;" + }, + "" + ); + } + // uninitialized local in a switch + public void test001() { + this.runNegativeTest( + new String[] { + "X.js", + "function foo(arg) {\n" + + " switch(arg) {\n" + + " case 1:\n" + + " var j = 1;\n" + + " case 2:\n" + + " switch(5) {\n" + + " case j:\n" + + " }\n" + + " }\n" + + "}" + }, + "----------\n" + + "1. WARNING in X.js (at line 7)\n" + + " case j:\n" + + " ^\n" + + "The local variable j may not have been initialized\n" + + "----------\n" + ); + } + + // nested uninitialized local + public void test002() { + this.runNegativeTest( + new String[] { + "X.js", + "function foo(arg) {\n" + + " if(false) {\n" + + " var s;\n" + + " if(System.out != null) {\n" + + " System.out.doSomething(s);\n" + + " }\n" + + " }\n" + + "}" + }, + "----------\n" + + "1. WARNING in X.js (at line 5)\n" + + " System.out.doSomething(s);\n" + + " ^\n" + + "The local variable s may not have been initialized\n" + + "----------\n" + ); + } + + // nested uninitialized local + public void test003() { + this.runNegativeTest( + new String[] { + "X.js", + "function foo(arg) {\n" + + " if(false) {\n" + + " var s;\n" + + " System.out.doSomething(s);\n" + + " }\n" + + "}" + }, + "----------\n" + + "1. WARNING in X.js (at line 4)\n" + + " System.out.doSomething(s);\n" + + " ^\n" + + "The local variable s may not have been initialized\n" + + "----------\n" + ); + } + + // uninitialized local in a switch + public void test004() { + this.runNegativeTest( + new String[] { + "X.js", + "function foo(arg) {\n" + + " switch(1) {\n" + + " case 0:\n" + + " var j = 0;\n" + + " case 1:\n" + + " System.out.doSomething(j);\n" + + " }\n" + + "}" + }, + "----------\n" + + "1. WARNING in X.js (at line 6)\n" + + " System.out.doSomething(j);\n" + + " ^\n" + + "The local variable j may not have been initialized\n" + + "----------\n" + ); + } + + // uninitialized local + public void test005() { + this.runNegativeTest( + new String[] { + "X.js", + "function foo(arg) {\n" + + " var s;\n" + + " var o2 = arg;\n" + + " if (o2 == null) {\n" + + " s = \"\";\n" + + " }\n" + + " System.out.doSomething(s);\n" + + "}" + }, + "----------\n" + + "1. WARNING in X.js (at line 7)\n" + + " System.out.doSomething(s);\n" + + " ^\n" + + "The local variable s may not have been initialized\n" + + "----------\n" + ); + } + + // uninitialized local in a do while + public void test006() { + this.runNegativeTest( + new String[] { + "X.js", + "function foo(b) {\n" + + " var l;\n" + + " do {\n" + + " if (b) {\n" + + " l = new Object();\n" + + " break;\n" + + " }\n" + + " } while (false);\n" + + " l.toString();\n" + + "}" + }, + "----------\n" + + "1. WARNING in X.js (at line 9)\n" + + " l.toString();\n" + + " ^\n" + + "The local variable l may not have been initialized\n" + + "----------\n" + ); + } + + // empty control statements + public void test007() { + Map options = getCompilerOptions(); + options.put(CompilerOptions.OPTION_ReportEmptyStatement, CompilerOptions.ERROR); + this.runNegativeTest( + new String[] { + "X.js", + "function foo(args) {\n" + + " if(true)\n" + + " ;\n" + + " else\n" + + " ;\n" + + "}" + }, + "----------\n" + + "1. ERROR in X.js (at line 3)\n" + + " ;\n" + + " ^\n" + + "Empty control-flow statement\n" + + "----------\n" + + "2. ERROR in X.js (at line 5)\n" + + " ;\n" + + " ^\n" + + "Empty control-flow statement\n" + + "----------\n" + , null, true, options + ); + } + + // switch case fall through + public void test008() { + Map options = getCompilerOptions(); + options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); + this.runNegativeTest( + new String[] { + "X.js", + "function foo(p, b) {\n" + + " switch(p) {\n" + + " case 0:\n" + + " if(b) {\n" + + " break;\n" + + " }\n" + + " case 1:\n" + + " System.out.doSomething(j);\n" + + " }\n" + + "}" + }, + "----------\n" + + "1. ERROR in X.js (at line 7)\n" + + " case 1:\n" + + " ^^^^^^\n" + + "Switch case may be entered by falling through previous case\n" + + "----------\n", null, true, options + ); + } + + // switch case fall through + public void test009() { + Map options = getCompilerOptions(); + options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); + this.runNegativeTest( + new String[] { + "X.js", + "function foo(p, b) {\n" + + " switch(p) {\n" + + " case 0:\n" + + " System.exit();\n" + + " case 1:\n" + + " System.out.doSomething(1);\n" + + " }\n" + + "}" + }, + "----------\n" + + "1. ERROR in X.js (at line 5)\n" + + " case 1:\n" + + " ^^^^^^\n" + + "Switch case may be entered by falling through previous case\n" + + "----------\n", null, true, options + ); + } + + // switch case fall through + public void test010() { + Map options = getCompilerOptions(); + options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); + this.runNegativeTest( + new String[] { + "X.js", + "function foo(p) {\n" + + " switch(p) {\n" + + " case 0:\n" + + " System.exit(0);\n" + + " case 1:\n" + + " System.out.doSomething(1);\n" + + " break;\n" + + " case 2:\n" + + " System.out.doSomething(2);\n" + + " return;\n" + + " case 3:\n" + + " case 4:\n" + + " default:\n" + + " System.out.println(3);\n" + + " }\n" + + "}" + }, + "----------\n" + + "1. ERROR in X.js (at line 5)\n" + + " case 1:\n" + + " ^^^^^^\n" + + "Switch case may be entered by falling through previous case\n" + + "----------\n", null, true, options + ); + } + + // uninitialized local in a do while + public void test011() { + this.runNegativeTest( + new String[] { + "X.js", + "function foo() {\n" + + " var c1, c2;\n" + + " do ; while((c1 = 0) == 1);\n" + + " if (c1 == 0) {} // silent\n" + + " if (c2 == 0) {} // complain\n" + + "}" + }, + "----------\n" + + "1. WARNING in X.js (at line 5)\n" + + " if (c2 == 0) {} // complain\n" + + " ^^\n" + + "The local variable c2 may not have been initialized\n" + + "----------\n" + ); + } + + // uninitialized local in a for + public void test012() { + this.runNegativeTest( + new String[] { + "X.js", + "function foo() {\n" + + " var c1, c2;\n" + + " for(; (c1 = 0) == 1;);\n" + + " if (c1 == 0) {} // silent\n" + + " if (c2 == 0) {} // complain\n" + + "}" + }, + "----------\n" + + "1. WARNING in X.js (at line 5)\n" + + " if (c2 == 0) {} // complain\n" + + " ^^\n" + + "The local variable c2 may not have been initialized\n" + + "----------\n" + ); + } + + // uninitialized local in a while + public void test013() { + this.runNegativeTest( + new String[] { + "X.js", + "function foo() {\n" + + " var c1, c2;\n" + + " while((c1 = 0) == 1);\n" + + " if (c1 == 0) {} // silent\n" + + " if (c2 == 0) {} // complain\n" + + "}" + }, + "----------\n" + + "1. WARNING in X.js (at line 5)\n" + + " if (c2 == 0) {} // complain\n" + + " ^^\n" + + "The local variable c2 may not have been initialized\n" + + "----------\n" + ); + } }
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicErrorTests.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicErrorTests.java deleted file mode 100644 index 7c835d4..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicErrorTests.java +++ /dev/null
@@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.regression; - -import org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration; - -public class BasicErrorTests extends AbstractRegressionTest { - - public BasicErrorTests(String name) { - super(name); - - } - public void test001() { - CompilationUnitDeclaration declaration = this.runParseTest( - "function foo(){\n" + - " var c;\n" + - " var d;\n" + - " c.\n" + - "}\n", - "X.js", - "function foo(){\n" + - " var c;\n" + - " var d;\n" + - " c.\n" + - "\n" - - ); - } - - public void test002() { - CompilationUnitDeclaration declaration = this.runParseTest( - "package p;\n" + - "/**\n" + - " * @category test\n" + - " */\n" + - "public class Y {\n" + - "}\n", - "X.js", - "function foo(){\n" + - " var c;\n" + - " var d;\n" + - " c.\n" + - "\n" - - ); - } - - -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicParserTests.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicParserTests.java index 82b69a8..ae47df5 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicParserTests.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicParserTests.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2011 IBM Corporation and others. + * Copyright (c) 2005, 2013 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 @@ -1011,6 +1011,21 @@ "\n" ); } + + public void testWI84252() { + this.runParseTest("var a = {\n" + + "get value() {return 1;},\n" + + "set value(val) {}\n" + + "};", + "X.js", + "var a = {\n" + + " get value() {\n"+ + " return 1;\n" + + " },\n" + + " set value(val) {\n" + + " }\n" + + "};\n" ); + }
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicResolveTests.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicResolveTests.java index cafa30b..f160af0 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicResolveTests.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/BasicResolveTests.java
@@ -10,13 +10,6 @@ *******************************************************************************/ package org.eclipse.wst.jsdt.core.tests.compiler.regression; -import java.io.File; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.wst.jsdt.core.tests.util.Util; -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; - @@ -739,7 +732,12 @@ "var o=arr.pop();\n" + "" }, - "" + "----------\n" + + "1. WARNING in X.js (at line 1)\n" + + " var arr=[];\n" + + " ^^\n" + + "Type mismatch: cannot convert from any[] to ___anonymous_arr\n" + + "----------\n" ); } @@ -1317,7 +1315,7 @@ }); } - public void Xtestbug196377_1() { + public void testbug196377_1() { this.runNegativeTest( new String[] { "Z.js", @@ -1330,7 +1328,7 @@ ); } - public void Xtestbug196377_2() { + public void testbug196377_2() { this.runNegativeTest( new String[] { "Z.js", @@ -1767,6 +1765,33 @@ ); } + public void testbug324241() { + this.runNegativeTest( + new String[] { + "Z.js", + "var com = {};\n" + + "com.MyType = function() {};\n" + + "com.MyType.prototype.reload = function() {};\n" + + "var c = new com.MyType();\n" + + "var y = c.reload();\n" + + "var x = c.reload;\n" + + "c.reload2();\n" + + "c.reload2;" + },"" +// "----------\n" + +// "1. ERROR in Z.js (at line 7)\n" + +// " c.reload2();\n" + +// " ^^^^^^^\n" + +// "The function reload2() is undefined for the type com.MyType\n" + +// "----------\n" + +// "2. WARNING in Z.js (at line 8)\n" + +// " c.reload2;\n" + +// " ^^^^^^^\n" + +// "reload2 cannot be resolved or is not a field\n" + +// "----------\n" + ); + } + public void testbug333781() { this.runNegativeTest( new String[] { @@ -1785,48 +1810,63 @@ ); } - public void Xtestbug324241() { + public void testBug397568() { + this.runNegativeTest( + new String[] { + "Z.js", + "switch (0) {\n"+ + " case 0 :\n"+ + " var x=123;\n"+ + "}\n" + }, + "" + ); + } + + public void testWI90999() { this.runNegativeTest( new String[] { "Z.js", - "var com = {};\n" + - "com.MyType = function() {};\n" + - "com.MyType.prototype.reload = function() {};\n" + - "var c = new com.MyType();\n" + - "var y = c.reload();\n" + - "var x = c.reload;\n" + - "c.reload2();\n" + - "c.reload2;" + "function abc() {\n" + + "var createCookiePersister = function() {\n" + + "switch (gadgetEnvironment) {\n" + + "default:\n" + + "break;\n" + + "}" + + "};" + + "};" }, "----------\n" + - "1. ERROR in Z.js (at line 7)\n" + - " c.reload2();\n" + - " ^^^^^^^\n" + - "The function reload2() is undefined for the type com.MyType\n" + - "----------\n" + - "2. WARNING in Z.js (at line 8)\n" + - " c.reload2;\n" + - " ^^^^^^^\n" + - "reload2 cannot be resolved or is not a field\n" + + "1. WARNING in Z.js (at line 2)\n" + + " var createCookiePersister = function() {\n" + + " ^^^^^^^^^^^^^^^^^^^^^\n" + + "The local variable createCookiePersister is never read\n" + "----------\n" ); } - public void test326901() { - Map options = new HashMap(); - options.put(CompilerOptions.OPTION_SemanticValidation, CompilerOptions.ENABLED); - Util.compile( + + public void testWI98930() { + this.runNegativeTest( new String[] { - "Z.js", - "function Windget(){\n"+ - " this.a=5;\n"+ - "};\n"+ - "windget = new Windget();\n"+ - "(function(a2){\n"+ - " // operations on a2\n"+ - " a2.a();\n"+ - "})(windget);" + "Z.js", + "function outter() {\n" + + "var path = { hmmm : function() {\n" + + "switch (d) {\n" + + "case \".\":\n" + + ";\n" + + "break;\n" + + "default:\n" + + ";\n" + + "break;\n" + + "}}};\n" + + "var to = path.someFunc();\n" + + "function testDupDefaultClass() {}\n" + + "var testDupDefaultClassInit = new testDupDefaultClass();\n" + + "testDupDefaultClassInit.myField = to;\n" + + "}" }, - options, - File.separator); + "" + ); } + } \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/CompilerInvocationTests.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/CompilerInvocationTests.java index 6b3aa3d..1a25e4c 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/CompilerInvocationTests.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/CompilerInvocationTests.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2008 IBM Corporation and others. + * Copyright (c) 2006, 2013 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 @@ -34,23 +34,6 @@ public CompilerInvocationTests(String name) { super(name); } - - // Static initializer to specify tests subset using TESTS_* static variables - // All specified tests which does not belong to the class are skipped... - // Only the highest compliance level is run; add the VM argument - // -Dcompliance=1.4 (for example) to lower it if needed - static { -// TESTS_NAMES = new String[] { "test001" }; -// TESTS_NUMBERS = new int[] { 1 }; -// TESTS_RANGE = new int[] { 1, -1 }; -// TESTS_RANGE = new int[] { 1, 2049 }; -// TESTS_RANGE = new int[] { 449, 451 }; -// TESTS_RANGE = new int[] { 900, 999 }; - } - -public static Test suite() { - return buildAllCompliancesTestSuite(testClass()); -} public static Class testClass() { return CompilerInvocationTests.class; @@ -667,8 +650,6 @@ testFiles, "", null /* no extra class libraries */, - true /* flush output directory */, - null, /* no VM args */ options, reader, true /* skip javac */); @@ -687,72 +668,14 @@ this.runTaskTagsOptionsTest( new String[] { "X.java", - "public class X {\n" + - " void foo(X x) {\n" + - " // FIXME TODO XXX message contents\n" + - " }\n" + + "function foo(x) {\n" + + " // FIXME TODO XXX message contents\n" + "}\n"}, null, "[FIXME,message contents,HIGH]\n" + "[TODO,message contents,NORMAL]\n" + "[XXX,message contents,NORMAL]\n"); } -// effect of cancelling priorities -// reactivate when bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=143402 is fixed -public void _test004_task_tags_options() { - Map customOptions = new HashMap(); - customOptions.put(JavaScriptCore.COMPILER_TASK_PRIORITIES, ""); - this.runTaskTagsOptionsTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo(X x) {\n" + - " // FIXME TODO XXX message contents\n" + - " }\n" + - "}\n"}, - customOptions, - "[FIXME,message contents,NORMAL]\n" + - "[TODO,message contents,NORMAL]\n" + - "[XXX,message contents,NORMAL]\n"); -} -// effect of cancelling priorities -// reactivate when bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=143402 is fixed -public void _test005_task_tags_options() { - Map customOptions = new HashMap(); - customOptions.put(JavaScriptCore.COMPILER_TASK_PRIORITIES, ",,"); - this.runTaskTagsOptionsTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo(X x) {\n" + - " // FIXME TODO XXX message contents\n" + - " }\n" + - "}\n"}, - customOptions, - "[FIXME,message contents,NORMAL]\n" + - "[TODO,message contents,NORMAL]\n" + - "[XXX,message contents,NORMAL]\n"); - // would expect an exception of some sort -} -// effect of changing priorities -// reactivate when bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=143402 is fixed -public void _test006_task_tags_options() { - Map customOptions = new HashMap(); - customOptions.put(JavaScriptCore.COMPILER_TASK_PRIORITIES, "A,B,C,D,E"); - this.runTaskTagsOptionsTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo(X x) {\n" + - " // FIXME TODO XXX message contents\n" + - " }\n" + - "}\n"}, - customOptions, - "[FIXME,message contents,NORMAL]\n" + - "[TODO,message contents,NORMAL]\n" + - "[XXX,message contents,NORMAL]\n"); - // would expect an exception of some sort -} // effect of changing priorities public void test007_task_tags_options() { Map customOptions = new HashMap(); @@ -760,28 +683,8 @@ this.runTaskTagsOptionsTest( new String[] { "X.java", - "public class X {\n" + - " void foo(X x) {\n" + - " // FIXME TODO XXX message contents\n" + - " }\n" + - "}\n"}, - customOptions, - "[FIXME,message contents,NORMAL]\n" + - "[TODO,message contents,NORMAL]\n" + - "[XXX,message contents,NORMAL]\n"); -} -// effect of changing priorities -// reactivate when bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=143402 is fixed -public void _test008_task_tags_options() { - Map customOptions = new HashMap(); - customOptions.put(JavaScriptCore.COMPILER_TASK_PRIORITIES, "NORMAL,NORMAL"); // one less than the number of tags - this.runTaskTagsOptionsTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo(X x) {\n" + - " // FIXME TODO XXX message contents\n" + - " }\n" + + "function foo(x) {\n" + + " // FIXME TODO XXX message contents\n" + "}\n"}, customOptions, "[FIXME,message contents,NORMAL]\n" +
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/Compliance_1_3.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/Compliance_1_3.java deleted file mode 100644 index 6423214..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/Compliance_1_3.java +++ /dev/null
@@ -1,273 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.regression; - -import java.util.Map; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; - -public class Compliance_1_3 extends AbstractRegressionTest { -boolean docSupport = false; - -public Compliance_1_3(String name) { - super(name); -} - -/* - * Toggle compiler in mode -1.3 - */ -protected Map getCompilerOptions() { - Map options = super.getCompilerOptions(); - if (docSupport) { - options.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED); - options.put(CompilerOptions.OPTION_ReportInvalidJavadoc, CompilerOptions.ERROR); - options.put(CompilerOptions.OPTION_ReportInvalidJavadocTags, CompilerOptions.ENABLED); - } - return options; -} -public static Test suite() { - return buildUniqueComplianceTestSuite(testClass(), COMPLIANCE_1_3); -} -public static Class testClass() { - return Compliance_1_3.class; -} -// Use this static initializer to specify subset for tests -// All specified tests which does not belong to the class are skipped... -static { -// TESTS_NAMES = new String[] { "Bug58069" }; -// TESTS_NUMBERS = new int[] { 104 }; -// TESTS_RANGE = new int[] { 76, -1 }; -} -/* (non-Javadoc) - * @see junit.framework.TestCase#setUp() - */ -protected void setUp() throws Exception { - super.setUp(); - // Javadoc disabled by default - docSupport = false; -} - -// test001 - moved to SuperTypeTest#test002 -// test002 - moved to SuperTypeTest#test003 -// test003 - moved to SuperTypeTest#test004 -// test004 - moved to SuperTypeTest#test005 -// test005 - moved to SuperTypeTest#test006 -// test006 - moved to SuperTypeTest#test007 -// test007 - moved to TryStatementTest#test057 -// test008 - moved to LookupTest#test074 -// test009 - moved to RuntimeTests#test1004 - -// check actualReceiverType when array type -// test unreachable code complaints -public void test011() { - this.runNegativeTest( - new String[] { - "X.js", - " void foo() { \n"+ - " while (false); \n" + - " while (false) println(\"unreachable\"); \n" + - " do ; while (false); \n" + - " do println(\"unreachable\"); while (false); \n" + - " for (;false;); \n" + - " for (;false;) println(\"unreachable\"); \n" + - " if (false); \n" + - " if (false) println(\"unreachable\"); \n" + - " } \n" + - " function println(s){} \n" + - " \n" - }, - "----------\n" + - "1. ERROR in p1\\X.js (at line 3)\n" + - " while (false) System.out.println(\"unreachable\"); \n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Unreachable code\n" + - "----------\n" + - "2. ERROR in p1\\X.js (at line 7)\n" + - " for (;false;) System.out.println(\"unreachable\"); \n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "Unreachable code\n" + - "----------\n" - ); -} -// binary compatibility - - -/* - * http://dev.eclipse.org/bugs/show_bug.cgi?id=24744 - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23096 - */ -public void test037() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_TaskTags, "TODO:"); - this.runNegativeTest( - new String[] { - "X.js", - "function X() {\n"+ - "}\n"+ - "// TODO: something" - }, - "----------\n" + - "1. WARNING in p\\X.js (at line 4)\n" + - " // TODO: something\n" + - " ^^^^^^^^^^^^^^^\n" + - "TODO: something\n" + - "----------\n", - null, - true, - customOptions); -} - -/* - * http://dev.eclipse.org/bugs/show_bug.cgi?id=24833 - * http://dev.eclipse.org/bugs/show_bug.cgi?id=23096 - */ -public void test038() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_TaskTags, "TODO:"); - this.runNegativeTest( - new String[] { - "X.js", - "// TODO: something" - }, - "----------\n" + - "1. WARNING in X.js (at line 1)\n" + - " // TODO: something\n" + - " ^^^^^^^^^^^^^^^\n" + - "TODO: something\n" + - "----------\n", - null, - true, - customOptions); -} - - -public void test072() { - - this.runNegativeTest( - new String[] { - "X.js", - " function main( args) {\n" + - " try {\n" + - " f();\n" + - " } catch(e) {\n" + - " println(\"SUCCESS\");\n" + - " }\n" + - " }\n" + - " function f() {\n" + - " function ff ()\n" + - " // {\n" + - " if (true) throw null;\n" + - " }\n" + - " // };\n" + - " }\n" + - " function println(s){}", - }, - "----------\n" + - "1. ERROR in X.js (at line 12)\n" + - " if (true) throw null;\n" + - " ^^^^\n" + - "Cannot throw null as an exception\n" + - "----------\n"); -} - - -// checking for captured outer local initialization status -// NOTE: only complain against non-inlinable outer locals -// http://bugs.eclipse.org/bugs/show_bug.cgi?id=26134 -public void test074() { - this.runNegativeTest( - new String[] { - "X.js", - " function main(args) { \n" + - " var nonInlinedString = \"[Local]\"; \n" + - " var i = 2; \n" + - " switch(i){ \n" + - " case 1: \n" + - " var displayString = nonInlinedString;\n" + - " var inlinedString = \"a\"; \n" + - "// class Local { \n" + - " function toString() { \n" + - " return inlinedString + displayString; \n" + - " } \n" + - "// } \n" + - " case 2: \n" + - "// print(new Local()); \n" + - "// print(\"-\"); \n" + -// " println(new Local(){ \n" + -// " public String toString() { \n" + -// " return super.toString()+\": anonymous\"; \n" + -// " } \n" + -// " }); \n" + - " } \n" + - " } \n" + - " function println(s){}\n", - }, - "----------\n" + - "1. ERROR in X.js (at line 14)\n" + - " System.out.print(new Local()); \n" + - " ^^^^^^^^^^^\n" + - "The local variable displayString may not have been initialized\n" + - "----------\n" + - "2. ERROR in X.js (at line 16)\n" + - " System.out.println(new Local(){ \n" + - " public String toString() { \n" + - " return super.toString()+\": anonymous\"; \n" + - " } \n" + - " }); \n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "The local variable displayString may not have been initialized\n" + - "----------\n"); -} -/* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=66533 - */ -public void test084() { - this.runNegativeTest( - new String[] { - "X.js", - " void foo() {\n" + - " Object enum = null;\n" + - " }\n" + - "\n" - }, - "----------\n" + - "1. WARNING in X.js (at line 2)\n" + - " Object enum = null;\n" + - " ^^^^\n" + - "\'enum\' should not be used as an identifier, since it is a reserved keyword from source level 5.0 on\n" + - "----------\n"); -} -public void test100() { - this.runNegativeTest( - new String[] { - "X.js", - " var \\ud800\\udc05\\ud800\\udc04\\ud800\\udc03\\ud800\\udc02\\ud800\\udc01\\ud800\\udc00;\n" + - " function foo() {\n" + - " var \\ud800\\udc05\\ud800\\udc04\\ud800\\udc03\\ud800\\udc02\\ud800\\udc01\\ud800\\udc00;\n" + - " }\n" + - "\n" - }, - "----------\n" + - "1. ERROR in X.js (at line 1)\n" + - " int \\ud800\\udc05\\ud800\\udc04\\ud800\\udc03\\ud800\\udc02\\ud800\\udc01\\ud800\\udc00;\n" + - " ^^^^^^\n" + - "Invalid unicode\n" + - "----------\n" + - "2. ERROR in X.js (at line 3)\n" + - " int \\ud800\\udc05\\ud800\\udc04\\ud800\\udc03\\ud800\\udc02\\ud800\\udc01\\ud800\\udc00;\n" + - " ^^^^^^\n" + - "Invalid unicode\n" + - "----------\n" - ); -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ConstantTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ConstantTest.java new file mode 100644 index 0000000..972809a --- /dev/null +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ConstantTest.java
@@ -0,0 +1,259 @@ +/******************************************************************************* + * Copyright (c) 2003, 2006 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.jsdt.core.tests.compiler.regression; + +import junit.framework.Test; +import junit.framework.TestSuite; + +/** + * Tests exceptions with Literal#computeConstant() via batch compilation + */ +public class ConstantTest extends AbstractRegressionTest { + +public ConstantTest(String name) { + super(name); +} + +public static Test suite() { + return new TestSuite(ConstantTest.class); +} +public void test002() { + this.runConformTest(new String[] { + "p/X.js", + " if(55!=00000000000000000000055) {\n" + + " print(\"55!=00000000000000000000055\");\n" + + " }\n" + + " else {\n" + + " print(\"55==00000000000000000000055\");\n" + + " }\n", + },"55!=00000000000000000000055\n"); +} + +public void test003() { + this.runConformTest(new String[] { + "p/X.js", + " if(55e2!=550e1) {\n" + + " print(\"55e2!=550e1\");\n" + + " }\n" + + " else {\n" + + " print(\"55e2==550e1\");\n" + + " }\n", + },"55e2==550e1\n"); +} + +public void test004() { + this.runConformTest(new String[] { + "p/X.js", + " if(5.5e2!=5.50e1) {\n" + + " print(\"5.5e2!=5.50e1\");\n" + + " }\n" + + " else {\n" + + " print(\"5.5e2==5.50e1\");\n" + + " }\n", + },"5.5e2!=5.50e1\n"); +} + +public void test005() { + this.runConformTest(new String[] { + "p/X.js", + " if(5.5e-2!=0.550e-1) {\n" + + " print(\"5.5e-2!=0.550e-1\");\n" + + " }\n" + + " else {\n" + + " print(\"5.5e-2==00.55e-1\");\n" + + " }\n" + }, + "5.5e-2==00.55e-1\n"); +} +public void test006() { + this.runConformTest(new String[] { + "p/X.js", + " if(0x5a!=0x5A) {\n" + + " print(\"0x5a != 0x5A\");\n" + + " }\n" + + " else {\n" + + " print(\"0x5a == 0x5A\");\n" + + " }\n", + }, + "0x5a == 0x5A\n"); +} + +/* + * null is not a constant + * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26585 + */ +public void test007() { + this.runConformTest( + new String[] { + "X.js", + "var F = false; \n"+ + "var Str = F ? \"dummy\" : null; \n"+ + "function main(args) { \n"+ + " if (Str == null)\n"+ + " print(\"SUCCESS\");\n"+ + " else\n"+ + " print(\"FAILED\");\n"+ + "}\n"+ + "main();" + }, + "SUCCESS\n"); +} + +/* + * null is not a constant + * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26138 + */ +public void test008() { + this.runConformTest( + new String[] { + "X.js", + "function X() { \n"+ + " function main(args) { \n"+ + " print(\"SUCCESS\"); \n"+ + " } \n"+ + " function foo(){ \n"+ + " while (null == null); //not an inlinable constant\n"+ + " print(\"unreachable but shouldn't be flagged\"); \n" + + " } \n"+ + "} \n", + }); +} + +/* + * null is not a constant + * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26138 + */ +public void test009() { + this.runConformTest( + new String[] { + "X.js", + " if (null == null) print(\"1\"); \n" + + " if ((null==null ? null:null) == (null==null ? null:null)) \n" + + " print(\"2\"); \n" + + " var b = (\"[\" + null + \"]\") == \"[null]\"; // cannot inline \n" + + " print(\"3\"); \n" + + " var s = null; \n" + + " if (s == null) print(\"4\"); \n" + + " var s2 = \"aaa\"; \n" + + " if (s2 == \"aaa\") print(\"5\"); \n" + }, + "1\n2\n3\n4\n5\n"); + +} + +/* + * null is not a constant + * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26138 + */ +public void test010() { + this.runConformTest( + new String[] { + "X.js", + "function main(args) {\n"+ + " if (null == null) {\n"+ + " print(\"SUCCESS\"); \n" + + " return; \n" + + " } \n" + + " print(\"SHOULDN'T BE GENERATED\"); \n" + + "} \n" + + "main();\n" + }, + "SUCCESS\n"); + +} +public void test001() { + this.runNegativeTest( + new String[] { + "X.js", + " if (null == null) {\n"+ + " print(\"SUCCESS\"); \n" + + " return; \n" + + " } \n" + + " print(\"SHOULDN'T BE GENERATED\"); \n" + }, + "----------\n" + + "1. ERROR in X.js (at line 3)\n" + + " return; \n" + + " ^^^^^^^\n" + + "Cannot return from outside a function or method.\n" + + "----------\n"); + +} + +public void test011() { + this.runConformTest( + new String[] { + "X.js", + "function main(args) {\n"+ + " if (\"a\" == \"a\") {\n"+ + " print(\"SUCCESS\"); \n" + + " return; \n" + + " } \n" + + " print(\"FAIL\"); \n" + + "} \n" + + "main();\n" + }, + "SUCCESS\n"); + +} +public void test012() { + this.runConformTest( + new String[] { + "X.js", + "function main(args) {\n"+ + " if (true == true) {\n"+ + " print(\"SUCCESS\"); \n" + + " return; \n" + + " } \n" + + " print(\"FAIL\"); \n" + + "} \n" + + "main();\n" + }, + "SUCCESS\n"); + +} +public void test013() { + this.runConformTest( + new String[] { + "X.js", + "function main(args) {\n"+ + " if (5) {\n"+ + " print(\"SUCCESS\"); \n" + + " return; \n" + + " } \n" + + " print(\"FAIL\"); \n" + + "} \n" + + "main();\n" + }, + "SUCCESS\n"); + +} +public void test014() { + this.runConformTest( + new String[] { + "X.js", + "function main(args) {\n"+ + " var a = true;\n" + + " if (a == true) {\n"+ + " print(\"SUCCESS\"); \n" + + " return; \n" + + " } \n" + + " print(\"FAIL\"); \n" + + "} \n" + + "main();\n" + }, + "SUCCESS\n"); + +} +public static Class testClass() { + return ConstantTest.class; +} +}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/DeprecatedTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/DeprecatedTest.java deleted file mode 100644 index 0888dde..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/DeprecatedTest.java +++ /dev/null
@@ -1,737 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.regression; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; - -import junit.framework.Test; - -public class DeprecatedTest extends AbstractRegressionTest { -public DeprecatedTest(String name) { - super(name); -} -public static Test suite() { - return buildAllCompliancesTestSuite(testClass()); -} -public void test001() { - this.runNegativeTest(new String[] { - "p/B.java", - "package p;\n" + - "class B extends A {\n" + - " float x = super.x;\n" + - "}\n", - - "p/A.java", - "package p;\n" + - "class A {\n" + - " /** @deprecated */\n" + - " int x = 1;\n" + - "}\n", - }, - "----------\n" + - "1. WARNING in p\\B.java (at line 3)\n" + - " float x = super.x;\n" + - " ^\n" + - "The field B.x is hiding a field from type A\n" + - "----------\n" + - "2. WARNING in p\\B.java (at line 3)\n" + - " float x = super.x;\n" + - " ^\n" + - "The field A.x is deprecated\n" + - "----------\n" - ); -} -public void test002() { - this.runNegativeTest(new String[] { - "p/C.java", - "package p;\n" + - "class C {\n" + - " static int x = new A().x;\n" + - "}\n", - - "p/A.java", - "package p;\n" + - "class A {\n" + - " /** @deprecated */\n" + - " int x = 1;\n" + - "}\n", - - }, - "----------\n" + - "1. WARNING in p\\C.java (at line 3)\n" + - " static int x = new A().x;\n" + - " ^\n" + - "The field A.x is deprecated\n" + - "----------\n" - ); -} -public void test003() { - this.runNegativeTest(new String[] { - "p/Top.java", - "package p;\n" + - "public class Top {\n" + - " \n" + - " class M1 {\n" + - " class M2 {}\n" + - " };\n" + - " \n" + - " static class StaticM1 {\n" + - " static class StaticM2 {\n" + - " class NonStaticM3{}};\n" + - " };\n" + - " \n" + - "public static void main(String argv[]){\n" + - " Top tip = new Top();\n" + - " System.out.println(\"Still alive 0\");\n" + - " tip.testStaticMember();\n" + - " System.out.println(\"Still alive 1\");\n" + - " tip.testStaticMember1();\n" + - " System.out.println(\"Still alive 2\");\n" + - " tip.testStaticMember2();\n" + - " System.out.println(\"Still alive 3\");\n" + - " tip.testStaticMember3();\n" + - " System.out.println(\"Still alive 4\");\n" + - " tip.testStaticMember4();\n" + - " System.out.println(\"Completed\");\n" + - "}\n" + - " void testMember(){\n" + - " new M1().new M2();}\n" + - " void testStaticMember(){\n" + - " new StaticM1().new StaticM2();}\n" + - " void testStaticMember1(){\n" + - " new StaticM1.StaticM2();}\n" + - " void testStaticMember2(){\n" + - " new StaticM1.StaticM2().new NonStaticM3();}\n" + - " void testStaticMember3(){\n" + - " // define an anonymous subclass of the non-static M3\n" + - " new StaticM1.StaticM2().new NonStaticM3(){};\n" + - " } \n" + - " void testStaticMember4(){\n" + - " // define an anonymous subclass of the non-static M3\n" + - " new StaticM1.StaticM2().new NonStaticM3(){\n" + - " Object hello(){\n" + - " return new StaticM1.StaticM2().new NonStaticM3();\n" + - " }};\n" + - " \n" + - " } \n" + - "}\n", - }, - "----------\n" + - "1. ERROR in p\\Top.java (at line 30)\n" + - " new StaticM1().new StaticM2();}\n" + - " ^^^^^^^^^^^^^^\n" + - "Illegal enclosing instance specification for type Top.StaticM1.StaticM2\n" + - "----------\n" + - "2. WARNING in p\\Top.java (at line 42)\n" + - " Object hello(){\n" + - " ^^^^^^^\n" + - "The method hello() from the type new Top.StaticM1.StaticM2.NonStaticM3(){} is never used locally\n" + - "----------\n"); -} -/** - * Regression test for PR #1G9ES9B - */ -public void test004() { - this.runNegativeTest(new String[] { - "p/Warning.java", - "package p;\n" + - "import java.util.Date;\n" + - "public class Warning {\n" + - "public Warning() {\n" + - " super();\n" + - " Date dateObj = new Date();\n" + - " dateObj.UTC(1,2,3,4,5,6);\n" + - "}\n" + - "}\n", - }, - "----------\n" + - "1. WARNING in p\\Warning.java (at line 7)\n" + - " dateObj.UTC(1,2,3,4,5,6);\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "The static method UTC(int, int, int, int, int, int) from the type Date should be accessed in a static way\n" + - "----------\n" + - "2. WARNING in p\\Warning.java (at line 7)\n" + - " dateObj.UTC(1,2,3,4,5,6);\n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "The method UTC(int, int, int, int, int, int) from the type Date is deprecated\n" + - "----------\n"); -} -public void test005() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" - + "/**\n" - + " * @deprecated\n" - + " */\n" - + " public static class Y {\n" - + " }\n" + - " public static void main(String[] args) { \n" + - " System.out.print(\"SUCCESS\"); \n" + - " } \n" - + "}" - }, - "SUCCESS", // expected output - null, - true, // flush previous output dir content - null, // special vm args - null, // custom options - null); // custom requestor - this.runNegativeTest( - new String[] { - "A.java", - "public class A extends X.Y {}" - }, - "----------\n" + - "1. WARNING in A.java (at line 1)\n" + - " public class A extends X.Y {}\n" + - " ^^^\n" + - "The type X.Y is deprecated\n" + - "----------\n",// expected output - null, - false, // flush previous output dir content - null); // custom options -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=40839 -public void test006() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " /**\n" + - " @deprecated\n" + - " */\n" + - " ; // line comment\n" + - " static int i;\n" + - " public static void main(String[] args) { \n" + - " System.out.print(\"SUCCESS\"); \n" + - " } \n" + - "}" - }, - "SUCCESS", // expected output - null, - true, // flush previous output dir content - null, // special vm args - null, // custom options - null); // custom requestor - this.runNegativeTest( - new String[] { - "A.java", - "public class A {\n" + - " public static void main(String[] args) { \n" + - " System.out.print(X.i); \n" + - " } \n" + - "}" - }, - "",// expected output - null, - false, // flush previous output dir content - null); // custom options -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=88124 -public void test007() { - this.runNegativeTest( - new String[] { - "X.java", - "/**\n" + - " * @deprecated\n" + - " */\n" + - "public class X {\n" + - "}\n", - - "Y.java", - "/**\n" + - " * @deprecated\n" + - " */\n" + - "public class Y {\n" + - " Zork z;\n" + - " X x;\n" + - " X foo() {\n" + - " X x; // unexpected deprecated warning here\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in Y.java (at line 5)\n" + - " Zork z;\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n" + - "2. WARNING in Y.java (at line 8)\n" + - " X x; // unexpected deprecated warning here\n" + - " ^\n" + - "The local variable x is hiding a field from type Y\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=88124 - variation -public void test008() { - this.runConformTest( - new String[] { - "X.java", - "/**\n" + - " * @deprecated\n" + - " */\n" + - "public class X {\n" + - "}\n", - }, - ""); - this.runNegativeTest( - new String[] { - "Y.java", - "/**\n" + - " * @deprecated\n" + - " */\n" + - "public class Y {\n" + - " Zork z;\n" + - " void foo() {\n" + - " X x; // unexpected deprecated warning here\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in Y.java (at line 5)\n" + - " Zork z;\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n",// expected output - null, - false, // flush previous output dir content - null); // custom options -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=88124 - variation -public void test009() { - this.runNegativeTest( - new String[] { - "X.java", - "/**\n" + - " * @deprecated\n" + - " */\n" + - "public class X {\n" + - "}\n", - - "Y.java", - "/**\n" + - " * @deprecated\n" + - " */\n" + - "public class Y {\n" + - " Zork z;\n" + - " void foo() {\n" + - " X x; // unexpected deprecated warning here\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in Y.java (at line 5)\n" + - " Zork z;\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=88187 -public void test010() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED); - customOptions.put(CompilerOptions.OPTION_ReportInvalidAnnotation, CompilerOptions.WARNING); - this.runNegativeTest( - new String[] { - "X.java", - "/**\n" + - " * @deprecated\n" + - " */\n" + - "public class X {\n" + - " /**\n" + - " * @see I2#foo()\n" + - " */\n" + - " I1 foo() {\n" + - " return null;\n" + - " }\n" + - " Zork z;\n" + - "}\n", - "I1.java", - "/**\n" + - " * @deprecated\n" + - " */\n" + - "public interface I1 {\n" + - " // empty block\n" + - "}\n", - "I2.java", - "/**\n" + - " * @deprecated\n" + - " */\n" + - "public interface I2 {\n" + - " I1 foo(); // unexpected warning here\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 11)\n" + - " Zork z;\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n", - null, - true, - customOptions); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=123522 -public void test011() { - this.runNegativeTest( - new String[] { - "p1/X.java", // ================= - "package p1;\n" + - "import p2.I;\n" + - "/** @deprecated */\n" + - "public class X {\n" + - " Zork z;\n" + - "}\n", // ================= - "p2/I.java", // ================= - "package p2;\n" + - "/** @deprecated */\n" + - "public interface I {\n" + - "}\n", // ================= - }, - "----------\n" + - "1. ERROR in p1\\X.java (at line 5)\n" + - " Zork z;\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n"); -} - -// @deprecated upon locals do not influence the deprecation diagnostic -// JLS3 9.6 -public void test012() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportDeprecation, - CompilerOptions.ERROR); - customOptions.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, - CompilerOptions.IGNORE); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo() {\n" + - " /** @deprecated */\n" + - " int i1 = Y.m;\n" + - " }\n" + - " /** @deprecated */\n" + - " void bar() {\n" + - " int i1 = Y.m;\n" + - " }\n" + - "}\n", - "Y.java", - "public class Y {\n" + - " /** @deprecated */\n" + - " static int m;\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 4)\n" + - " int i1 = Y.m;\n" + - " ^\n" + - "The field Y.m is deprecated\n" + - "----------\n", - null, - true, - customOptions); -} - -// @deprecated upon locals do not influence the deprecation diagnostic -// JLS3 9.6 -// @Deprecated variant -public void test013() { - if (COMPLIANCE_1_5.compareTo(this.complianceLevel) <= 0) { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportDeprecation, - CompilerOptions.ERROR); - customOptions.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, - CompilerOptions.IGNORE); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo() {\n" + - " @Deprecated\n" + - " int i1 = Y.m;\n" + - " }\n" + - " @Deprecated\n" + - " void bar() {\n" + - " int i1 = Y.m;\n" + - " }\n" + - "}\n", - "Y.java", - "public class Y {\n" + - " @Deprecated\n" + - " static int m;\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 4)\n" + - " int i1 = Y.m;\n" + - " ^\n" + - "The field Y.m is deprecated\n" + - "----------\n", - null, - true, - customOptions); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=159243 -public void test014() { - this.runNegativeTest( - new String[] { - "p/X.java", - "package p;\n" + - "/**\n" + - " * @deprecated\n" + - " */\n" + - "public class X {\n" + - "}\n", - "Y.java", - "import p.X;\n" + - "public class Y {\n" + - " Zork z;\n" + - " void foo() {\n" + - " X x;\n" + - " X[] xs = { x };\n" + - " }\n" + - " void bar() {\n" + - " p.X x;\n" + - " p.X[] xs = { x };\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. WARNING in Y.java (at line 1)\n" + - " import p.X;\n" + - " ^^^\n" + - "The type X is deprecated\n" + - "----------\n" + - "2. ERROR in Y.java (at line 3)\n" + - " Zork z;\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n" + - "3. WARNING in Y.java (at line 5)\n" + - " X x;\n" + - " ^\n" + - "The type X is deprecated\n" + - "----------\n" + - "4. WARNING in Y.java (at line 6)\n" + - " X[] xs = { x };\n" + - " ^\n" + - "The type X is deprecated\n" + - "----------\n" + - "5. WARNING in Y.java (at line 9)\n" + - " p.X x;\n" + - " ^^^\n" + - "The type X is deprecated\n" + - "----------\n" + - "6. WARNING in Y.java (at line 10)\n" + - " p.X[] xs = { x };\n" + - " ^^^\n" + - "The type X is deprecated\n" + - "----------\n"); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=159709 -// the order of the CUs must not modify the behavior, see also test016 -public void test015() { - Map customOptions = new HashMap(); - customOptions.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "p/M1.java", - "package p;\n" + - "public class M1 {\n" + - " void bar() {\n" + - " a.N1.N2.N3 m = null;\n" + - " m.foo();\n" + - " }\n" + - "}\n", - "a/N1.java", - "package a;\n" + - "public class N1 {\n" + - " /** @deprecated */\n" + - " public class N2 {" + - " public class N3 {" + - " public void foo() {}" + - " }" + - " }" + - "}\n", - }, - "----------\n" + - "1. ERROR in p\\M1.java (at line 4)\n" + - " a.N1.N2.N3 m = null;\n" + - " ^^^^^^^^^^\n" + - "The type N1.N2 is deprecated\n" + - "----------\n" + - "2. ERROR in p\\M1.java (at line 4)\n" + - " a.N1.N2.N3 m = null;\n" + - " ^^^^^^^^^^\n" + - "The type N1.N2.N3 is deprecated\n" + - "----------\n" + - "3. ERROR in p\\M1.java (at line 5)\n" + - " m.foo();\n" + - " ^^^^^^^\n" + - "The method foo() from the type N1.N2.N3 is deprecated\n" + - "----------\n", - null, - true, - customOptions, - true, - false, - false); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=159709 -public void test016() { - Map customOptions = new HashMap(); - customOptions.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "a/N1.java", - "package a;\n" + - "public class N1 {\n" + - " /** @deprecated */\n" + - " public class N2 {" + - " public class N3 {" + - " public void foo() {}" + - " }" + - " }" + - "}\n", - "p/M1.java", - "package p;\n" + - "public class M1 {\n" + - " void bar() {\n" + - " a.N1.N2.N3 m = null;\n" + - " m.foo();\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in p\\M1.java (at line 4)\n" + - " a.N1.N2.N3 m = null;\n" + - " ^^^^^^^^^^\n" + - "The type N1.N2 is deprecated\n" + - "----------\n" + - "2. ERROR in p\\M1.java (at line 4)\n" + - " a.N1.N2.N3 m = null;\n" + - " ^^^^^^^^^^\n" + - "The type N1.N2.N3 is deprecated\n" + - "----------\n" + - "3. ERROR in p\\M1.java (at line 5)\n" + - " m.foo();\n" + - " ^^^^^^^\n" + - "The method foo() from the type N1.N2.N3 is deprecated\n" + - "----------\n", - null, - true, - customOptions, - true, - false, - false); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=159709 -// variant: self-contained case, hence no report -public void test017() { - Map customOptions = new HashMap(); - customOptions.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR); - customOptions.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, CompilerOptions.ERROR); - this.runConformTest( - new String[] { - "a/N1.java", - "package a;\n" + - "public class N1 {\n" + - " /** @deprecated */\n" + - " public class N2 {" + - " public class N3 {" + - " public void foo() {}" + - " }" + - " }" + - " void bar() {\n" + - " a.N1.N2.N3 m = null;\n" + - " m.foo();\n" + - " }\n" + - "}\n" - }, - "", - null, - true, - null, - customOptions, - null, - false); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=159709 -// variant: using a binary class -public void test018() { - Map customOptions = new HashMap(); - customOptions.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.ERROR); - customOptions.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, CompilerOptions.ERROR); - this.runConformTest( - new String[] { - "a/N1.java", - "package a;\n" + - "public class N1 {\n" + - " /** @deprecated */\n" + - " public class N2 {" + - " public class N3 {" + - " public void foo() {}" + - " }" + - " }" + - "}\n" - }, - "", - null, - true, - null, - customOptions, - null, - false); - this.runNegativeTest( - new String[] { - "p/M1.java", - "package p;\n" + - "public class M1 {\n" + - " void bar() {\n" + - " a.N1.N2.N3 m = null;\n" + - " m.foo();\n" + - " }\n" + - "}\n" - }, - "----------\n" + - "1. ERROR in p\\M1.java (at line 4)\n" + - " a.N1.N2.N3 m = null;\n" + - " ^^^^^^^^^^\n" + - "The type N1.N2 is deprecated\n" + - "----------\n" + - "2. ERROR in p\\M1.java (at line 4)\n" + - " a.N1.N2.N3 m = null;\n" + - " ^^^^^^^^^^\n" + - "The type N1.N2.N3 is deprecated\n" + - "----------\n" + - "3. ERROR in p\\M1.java (at line 5)\n" + - " m.foo();\n" + - " ^^^^^^^\n" + - "The method foo() from the type N1.N2.N3 is deprecated\n" + - "----------\n", - null, - false /* do not flush */, - customOptions, - true, - false, - false); -} -public static Class testClass() { - return DeprecatedTest.class; -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ExternalizeStringLiterals15Test.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ExternalizeStringLiterals15Test.java deleted file mode 100644 index df6a6df..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ExternalizeStringLiterals15Test.java +++ /dev/null
@@ -1,227 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.regression; - -import java.util.Map; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; - -public class ExternalizeStringLiterals15Test extends AbstractRegressionTest { - -static { -// TESTS_NAMES = new String[] { "test000" }; -// TESTS_NUMBERS = new int[] { 6 }; -// TESTS_RANGE = new int[] { 11, -1 }; -} -public ExternalizeStringLiterals15Test(String name) { - super(name); -} -public static Test suite() { - return buildUniqueComplianceTestSuite(testClass(), COMPLIANCE_1_5); -} - -public void test001() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runConformTest( - new String[] { - "X.java", - "import static java.lang.annotation.ElementType.*;\n" + - "import static java.lang.annotation.RetentionPolicy.*;\n" + - "import java.lang.annotation.Retention;\n" + - "import java.lang.annotation.Target;\n" + - "@Target({TYPE, FIELD, METHOD,\r\n" + - " PARAMETER, CONSTRUCTOR,\r\n" + - " LOCAL_VARIABLE, PACKAGE})\r\n" + - "@Retention(CLASS)\r\n" + - "public @interface X\r\n" + - "{\r\n" + - " String[] value() default {};\r\n" + - " String justification() default \"\";\r\n" + - "}" - }, - "", - null, - true, - null, - customOptions, - null); -} -public void test002() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "class X {\n" + - " String s2 = \"test1\"; //$NON-NLS-1$\n" + - " String s3 = \"test2\"; //$NON-NLS-1$//$NON-NLS-2$\n" + - " \n" + - " @SuppressWarnings(\"nls\")\n" + - " void foo() {\n" + - " String s4 = null;\n" + - " String s5 = \"test3\";\n" + - " String s6 = \"test4\";\n" + - " System.out.println(\"test5\");\n" + - " }\n" + - "}", - }, - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " String s3 = \"test2\"; //$NON-NLS-1$//$NON-NLS-2$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "2. ERROR in X.java (at line 8)\n" + - " String s5 = \"test3\";\n" + - " ^^^^^^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n" + - "3. ERROR in X.java (at line 9)\n" + - " String s6 = \"test4\";\n" + - " ^^^^^^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n" + - "4. ERROR in X.java (at line 10)\n" + - " System.out.println(\"test5\");\n" + - " ^^^^^^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n", - null, - true, - customOptions); -} -public void test003() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "class X {\n" + - " String s2 = \"test1\"; //$NON-NLS-1$\n" + - " String s3 = \"test2\"; //$NON-NLS-1$//$NON-NLS-2$\n" + - " \n" + - " @SuppressWarnings(\"nls\")\n" + - " void foo() {\n" + - " String s4 = null;\n" + - " String s5 = null;//$NON-NLS-1$\n" + - " String s6 = \"test4\";\n" + - " System.out.println(\"test5\");\n" + - " }\n" + - "}", - }, - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " String s3 = \"test2\"; //$NON-NLS-1$//$NON-NLS-2$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "2. ERROR in X.java (at line 8)\n" + - " String s5 = null;//$NON-NLS-1$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "3. ERROR in X.java (at line 9)\n" + - " String s6 = \"test4\";\n" + - " ^^^^^^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n" + - "4. ERROR in X.java (at line 10)\n" + - " System.out.println(\"test5\");\n" + - " ^^^^^^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n", - null, - true, - customOptions); -} -public void test004() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.WARNING); - this.runNegativeTest( - new String[] { - "X.java", - "class X {\n" + - " String s2 = \"test1\"; //$NON-NLS-1$\n" + - " String s3 = \"test2\"; //$NON-NLS-1$//$NON-NLS-2$\n" + - " \n" + - " @SuppressWarnings(\"nls\")\n" + - " void foo() {\n" + - " String s4 = null;\n" + - " String s5 = null;//$NON-NLS-1$\n" + - " String s6 = \"test4\";\n" + - " System.out.println(\"test5\");\n" + - " }\n" + - "}", - }, - "----------\n" + - "1. WARNING in X.java (at line 3)\n" + - " String s3 = \"test2\"; //$NON-NLS-1$//$NON-NLS-2$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n", - null, - true, - customOptions); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162903 -public void test005() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "class X {\n" + - " @SuppressWarnings(\"nls\")\n" + - " void foo() {\n" + - " String s6 = \"SUCCESS\";\n" + - " System.out.println(s6);\n" + - " }\n" + - "}", - }, - "----------\n" + - "1. ERROR in X.java (at line 4)\n" + - " String s6 = \"SUCCESS\";\n" + - " ^^^^^^^^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n", - null, - true, - customOptions); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162903 -public void test006() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.WARNING); - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " @SuppressWarnings(\"nls\")\n" + - " public static void main(String[] args) {\n" + - " String s6 = \"SUCCESS\";\n" + - " System.out.println(s6);\n" + - " }\n" + - "}", - }, - "SUCCESS", - null, - true, - null, - customOptions, - null); -} -public static Class testClass() { - return ExternalizeStringLiterals15Test.class; -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest.java deleted file mode 100644 index e00ae3f..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ExternalizeStringLiteralsTest.java +++ /dev/null
@@ -1,515 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2008 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.regression; - -import java.util.Map; - -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; - -import junit.framework.Test; - -public class ExternalizeStringLiteralsTest extends AbstractRegressionTest { - -static { -// TESTS_NAMES = new String[] { "test000" }; -// TESTS_NUMBERS = new int[] { 16 }; -// TESTS_RANGE = new int[] { 11, -1 }; -} -public ExternalizeStringLiteralsTest(String name) { - super(name); -} -public static Test suite() { - return buildAllCompliancesTestSuite(testClass()); -} - -public void test001() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "A.js", - " function foo() {\n" + - " println(\"a\");\n" + - " } //$NON-NLS-1$ \n" + - "" - }, - "----------\n" + - "1. ERROR in A.js (at line 2)\n" + - " println(\"a\");\n" + - " ^^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n" + - "2. ERROR in A.js (at line 3)\n" + - " } //$NON-NLS-1$ \n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n", - null, - true, - customOptions); -} - -public void test002() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - " var s = null; //$NON-NLS-1$\n" + - " var s2 = \"\"; //$NON-NLS-1$\n" + - " var s3 = \"\"; //$NON-NLS-1$//$NON-NLS-2$\n" + - " \n" + - " function foo() {\n" + - " var s4 = null; //$NON-NLS-1$\n" + - " var s5 = \"\"; //$NON-NLS-1$\n" + - " var s6 = \"\"; //$NON-NLS-2$//$NON-NLS-1$\n" + - " println(\"foo\");//$NON-NLS-1$//$NON-NLS-2$\n" + - " } //$NON-NLS-1$\n" + - " //$NON-NLS-1$\n" + - "", - }, - "----------\n" + - "1. ERROR in X.js (at line 1)\n" + - " var s = null; //$NON-NLS-1$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "2. ERROR in X.js (at line 3)\n" + - " var s3 = \"\"; //$NON-NLS-1$//$NON-NLS-2$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "3. ERROR in X.js (at line 6)\n" + - " var s4 = null; //$NON-NLS-1$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "4. ERROR in X.js (at line 8)\n" + - " var s6 = \"\"; //$NON-NLS-2$//$NON-NLS-1$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "5. ERROR in X.js (at line 9)\n" + - " println(\"foo\");//$NON-NLS-1$//$NON-NLS-2$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "6. ERROR in X.js (at line 10)\n" + - " } //$NON-NLS-1$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n", - null, - true, - customOptions); -} -public void test003() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "Foo.js", - " function foo() {\n" + - " println(\"string1\" + \"string2\" //$NON-NLS-1$\n" + - " );\n" + - "", - }, - "----------\n" + - "1. ERROR in Foo.js (at line 2)\n" + - " println(\"string1\" + \"string2\" //$NON-NLS-1$\n" + - " ^^^^^^^^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n" + - "2. ERROR in p\\Foo.js (at line 4)\n" + - " }\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + - "----------\n", - null, - true, - customOptions); -} -public void test004() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runConformTest( - new String[] { - "Foo.js", - " function foo() {\n" + - " //$NON-NLS-1$\n" + - " };\n" + - "", - }, - "", - null, - true, - null, - customOptions, - null); -} -public void test005() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - " function main( args) {\r\n" + - " var s = \"\"; //$NON-NLS-1$//$NON-NLS-1$\r\n" + - " }\r\n" + - "", - }, - "----------\n" + - "1. ERROR in X.js (at line 2)\n" + - " var s = \"\"; //$NON-NLS-1$//$NON-NLS-1$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n", - null, - true, - customOptions); -} -public void test006() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - " public static function main(String[] args) {\r\n" + - " var s = \"\"; //$NON-NLS-1$//$NON-NLS-1$\r\n" + - " \r\n" + - "", - }, - "----------\n" + - "1. ERROR in X.js (at line 2)\n" + - " var s = \"\"; //$NON-NLS-1$//$NON-NLS-1$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "2. ERROR in X.js (at line 3)\n" + - " }\n" + - " ^\n" + - "Syntax error, insert \"}\" to complete ClassBody\n" + - "----------\n", - null, - true, - customOptions); -} -public void test007() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - " function main(args) {\r\n" + - " var s = null; //$NON-NLS-1$//$NON-NLS-1$\r\n" + - " }\r\n" + - "", - }, - "----------\n" + - "1. ERROR in X.js (at line 2)\n" + - " var s = null; //$NON-NLS-1$//$NON-NLS-1$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "2. ERROR in X.js (at line 2)\n" + - " var s = null; //$NON-NLS-1$//$NON-NLS-1$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n", - null, - true, - customOptions); -} -public void test008() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - " function main(args) {\r\n" + - " var s = \"test\"; //$NON-NLS-2$//$NON-NLS-3$\r\n" + - " }\r\n" + - "", - }, - "----------\n" + - "1. ERROR in X.js (at line 2)\n" + - " var s = \"test\"; //$NON-NLS-2$//$NON-NLS-3$\n" + - " ^^^^^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n" + - "2. ERROR in X.js (at line 2)\n" + - " var s = \"test\"; //$NON-NLS-2$//$NON-NLS-3$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "3. ERROR in X.js (at line 2)\n" + - " var s = \"test\"; //$NON-NLS-2$//$NON-NLS-3$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n", - null, - true, - customOptions); -} -public void test009() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runConformTest( - new String[] { - "Foo.js", - " function foo(i) {\n" + - " println(\"test1\" + i + \"test2\"); //$NON-NLS-2$//$NON-NLS-1$\r\n" + - " };\n" + - "", - }, - "", - null, - true, - null, - customOptions, - null); -} -public void test010() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - " function main(args) {\n" + - " var s = \"test\"; //$NON-NLS-2$//$NON-NLS-3$\n" + - " var i = s;\n" + - " println(s);\n" + - " }\n" + - "", - }, - "----------\n" + - "1. ERROR in X.js (at line 2)\n" + - " var s = \"test\"; //$NON-NLS-2$//$NON-NLS-3$\n" + - " ^^^^^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n" + - "2. ERROR in X.js (at line 2)\n" + - " var s = \"test\"; //$NON-NLS-2$//$NON-NLS-3$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "3. ERROR in X.js (at line 2)\n" + - " var s = \"test\"; //$NON-NLS-2$//$NON-NLS-3$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n", - null, - true, - customOptions); -} -public void test011() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - " function main(args) {\n" + - " var i = null;\n" + - " var s = \"test\"; //$NON-NLS-2$//$NON-NLS-3$\n" + - " println(s + i);\n" + - " }\n" + - "", - }, - "----------\n" + - "2. ERROR in X.js (at line 3)\n" + - " var s = \"test\"; //$NON-NLS-2$//$NON-NLS-3$\n" + - " ^^^^^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n" + - "3. ERROR in X.js (at line 3)\n" + - " var s = \"test\"; //$NON-NLS-2$//$NON-NLS-3$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "4. ERROR in X.js (at line 3)\n" + - " var s = \"test\"; //$NON-NLS-2$//$NON-NLS-3$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n", - null, - true, - customOptions); -} -public void test012() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - " function main(args) {\n" + - " var i = null;\n" + - " var s = null; //$NON-NLS-2$//$NON-NLS-3$\n" + - " println(s + i);\n" + - " }\n" + - "", - }, - "----------\n" + - "2. ERROR in X.js (at line 3)\n" + - " var s = null; //$NON-NLS-2$//$NON-NLS-3$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "3. ERROR in X.js (at line 3)\n" + - " var s = null; //$NON-NLS-2$//$NON-NLS-3$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n", - null, - true, - customOptions); -} -public void test013() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - " function main(args) {\n" + - " var s = \"test1\";\n" + - " println(s);\n" + - " }\n" + - "", - }, - "----------\n" + - "1. ERROR in X.js (at line 2)\n" + - " var s = \"test1\";\n" + - " ^^^^^^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n", - null, - true, - customOptions); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=112973 -public void test014() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - " function main(args) {\n" + - " var s = \"test1\"; //$NON-NLS-?$\n" + - " println(s);\n" + - " }\n" + - "", - }, - "----------\n" + - "1. ERROR in X.js (at line 2)\n" + - " var s = \"test1\"; //$NON-NLS-?$\n" + - " ^^^^^^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n" + - "2. ERROR in X.js (at line 2)\n" + - " var s = \"test1\"; //$NON-NLS-?$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n", - null, - true, - customOptions); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114077 -public void test015() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - " public function foo() {\n" + - " var s1= null; //$NON-NLS-1$\n" + - " var s2= \"\";\n" + - " }\n" + - "", - }, - "----------\n" + - "1. ERROR in X.js (at line 2)\n" + - " var s1= null; //$NON-NLS-1$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "2. ERROR in X.js (at line 3)\n" + - " var s2= \"\";\n" + - " ^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n", - null, - true, - customOptions); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=114077 -public void test016() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - " var s1= null; //$NON-NLS-1$\n" + - " \n" + - " function foo() {\n" + - " var s2= \"\";\n" + - " }\n" + - "}", - }, - "----------\n" + - "1. ERROR in X.js (at line 1)\n" + - " private var s1= null; //$NON-NLS-1$\n" + - " ^^^^^^^^^^^^^\n" + - "Unnecessary $NON-NLS$ tag\n" + - "----------\n" + - "2. ERROR in X.js (at line 4)\n" + - " var s2= \"\";\n" + - " ^^\n" + - "Non-externalized string literal; it should be followed by //$NON-NLS-<n>$\n" + - "----------\n", - null, - true, - customOptions); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=148352 -public void test017() { - Map customOptions = getCompilerOptions(); - customOptions.put(CompilerOptions.OPTION_ReportNonExternalizedStringLiteral, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.js", - " function foo(locationInAST) {\n" + - " var enclosingType= \"\"; //$NON-NLS-1$\n" + - " if (locationInAST != null) {\n" + - " enclosingType.toString()\n" + - " }\n" + - " }\n" + - "", - }, - "----------\n" + - "1. ERROR in X.js (at line 5)\n" + - " enclosingType.toString()\n" + - " ^\n" + - "Syntax error, insert \";\" to complete BlockStatements\n" + - "----------\n", - null, - true, - customOptions, - false, - false, - false, - false, - true, - null); -} -public static Class testClass() { - return ExternalizeStringLiteralsTest.class; -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/FieldAccessTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/FieldAccessTest.java deleted file mode 100644 index 81e689b..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/FieldAccessTest.java +++ /dev/null
@@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.regression; - -import java.util.Map; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; - -public class FieldAccessTest extends AbstractRegressionTest { - static { -// TESTS_NAMES = new String[] { "test000" }; -// TESTS_NUMBERS = new int[] { 5, 6 }; -// TESTS_RANGE = new int[] { 21, 50 }; - } - -public FieldAccessTest(String name) { - super(name); -} -public static Test suite() { - return buildAllCompliancesTestSuite(testClass()); -} -protected Map getCompilerOptions() { - Map options = super.getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportIndirectStaticAccess, CompilerOptions.ERROR); - return options; -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=149004 -public void test001() { - this.runConformTest( - new String[] { - "foo/BaseFoo.java", - "package foo;\n" + - "class BaseFoo {\n" + - " public static final int VAL = 0;\n" + - "}", - "foo/NextFoo.java", - "package foo;\n" + - "public class NextFoo extends BaseFoo {\n" + - "}", - "bar/Bar.java", - "package bar;\n" + - "public class Bar {\n" + - " int v = foo.NextFoo.VAL;\n" + - "}" - }, - ""); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=149004 -public void test002() { - this.runNegativeTest( - new String[] { - "foo/BaseFoo.java", - "package foo;\n" + - "public class BaseFoo {\n" + - " public static final int VAL = 0;\n" + - "}", - "foo/NextFoo.java", - "package foo;\n" + - "public class NextFoo extends BaseFoo {\n" + - "}", - "bar/Bar.java", - "package bar;\n" + - "public class Bar {\n" + - " int v = foo.NextFoo.VAL;\n" + - "}" - }, - "----------\n" + - "1. ERROR in bar\\Bar.java (at line 3)\n" + - " int v = foo.NextFoo.VAL;\n" + - " ^^^\n" + - "The static field BaseFoo.VAL should be accessed directly\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=149004 -public void test003() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.IGNORE); - this.runConformTest( - new String[] { - "foo/BaseFoo.java", - "package foo;\n" + - "class BaseFoo {\n" + - " public static final int VAL = 0;\n" + - "}", - "foo/NextFoo.java", - "package foo;\n" + - "public class NextFoo extends BaseFoo {\n" + - "}", - "bar/Bar.java", - "package bar;\n" + - "import foo.NextFoo;\n" + - "public class Bar {\n" + - " NextFoo[] tab = new NextFoo[] { new NextFoo() };\n" + - " int v = tab[0].VAL;\n" + - "}" - }, - "", - null, - true, - null, - options, - null); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=149004 -public void test004() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportNonStaticAccessToStatic, CompilerOptions.IGNORE); - this.runNegativeTest( - new String[] { - "foo/BaseFoo.java", - "package foo;\n" + - "public class BaseFoo {\n" + - " public static final int VAL = 0;\n" + - "}", - "foo/NextFoo.java", - "package foo;\n" + - "public class NextFoo extends BaseFoo {\n" + - "}", - "bar/Bar.java", - "package bar;\n" + - "import foo.NextFoo;\n" + - "public class Bar {\n" + - " NextFoo[] tab = new NextFoo[] { new NextFoo() };\n" + - " int v = tab[0].VAL;\n" + - "}" - }, - "----------\n" + - "1. ERROR in bar\\Bar.java (at line 5)\n" + - " int v = tab[0].VAL;\n" + - " ^^^\n" + - "The static field BaseFoo.VAL should be accessed directly\n" + - "----------\n", - null, - true, - options); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142234 -public void test005() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportUnqualifiedFieldAccess, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " private String memberVariable;\n" + - " public String getMemberVariable() {\n" + - " return (memberVariable);\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 4)\n" + - " return (memberVariable);\n" + - " ^^^^^^^^^^^^^^\n" + - "Unqualified access to the field X.memberVariable \n" + - "----------\n", - null, - true, - options); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=142234 -public void test006() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportUnqualifiedFieldAccess, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " private String memberVariable;\n" + - " public String getMemberVariable() {\n" + - " return \\u0028memberVariable\\u0029;\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 4)\n" + - " return \\u0028memberVariable\\u0029;\n" + - " ^^^^^^^^^^^^^^\n" + - "Unqualified access to the field X.memberVariable \n" + - "----------\n", - null, - true, - options); -} -public static Class testClass() { - return FieldAccessTest.class; -} -} -
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/FlowAnalysisTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/FlowAnalysisTest.java deleted file mode 100644 index 5c6e0c6..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/FlowAnalysisTest.java +++ /dev/null
@@ -1,1242 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.regression; - -import java.util.Map; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.core.compiler.CategorizedProblem; -import org.eclipse.wst.jsdt.core.compiler.IProblem; -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; -import org.eclipse.wst.jsdt.internal.compiler.problem.ProblemReporter; -import org.eclipse.wst.jsdt.internal.compiler.problem.ProblemSeverities; - -public class FlowAnalysisTest extends AbstractRegressionTest { - -public FlowAnalysisTest(String name) { - super(name); -} -public static Test suite() { - return buildAllCompliancesTestSuite(testClass()); -} - -public void test001() { - this.runNegativeTest(new String[] { - "X.java", // ================= - "public class X {\n" + - " public String foo(int i) {\n" + - " if (true) {\n" + - " return null;\n" + - " }\n" + - " if (i > 0) {\n" + - " return null;\n" + - " }\n" + - " } \n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " public String foo(int i) {\n" + - " ^^^^^^^^^^\n" + - "This method must return a result of type String\n" + - "----------\n"); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127255 -// Compiler incorrectly reports "variable may not have been initialized" -public void test002() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportParameterAssignment, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test() {\n" + - " int c1, c2;\n" + - " while ((char) (c1 = 0) == 1) {}\n" + - " if (c1 == 0) {} // silent\n" + - " if (c2 == 0) {} // complain\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " if (c2 == 0) {} // complain\n" + - " ^^\n" + - "The local variable c2 may not have been initialized\n" + - "----------\n", - null, true, options); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127255 -// Compiler incorrectly reports "variable may not have been initialized" -public void test003() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportParameterAssignment, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test() {\n" + - " int c1, c2;\n" + - " while ((char) (c1 = 0) == 1) ;\n" + - " if (c1 == 0) {} // silent\n" + - " if (c2 == 0) {} // complain\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " if (c2 == 0) {} // complain\n" + - " ^^\n" + - "The local variable c2 may not have been initialized\n" + - "----------\n", - null, true, options); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127255 -// Compiler incorrectly reports "variable may not have been initialized" -public void test004() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportParameterAssignment, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test() {\n" + - " int c1, c2;\n" + - " for (;(char) (c1 = 0) == 1;) ;\n" + - " if (c1 == 0) {} // silent\n" + - " if (c2 == 0) {} // complain\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " if (c2 == 0) {} // complain\n" + - " ^^\n" + - "The local variable c2 may not have been initialized\n" + - "----------\n", - null, true, options); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127255 -// Compiler incorrectly reports "variable may not have been initialized" -public void test005() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportParameterAssignment, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test() {\n" + - " int c1, c2;\n" + - " do ; while ((char) (c1 = 0) == 1);\n" + - " if (c1 == 0) {} // silent\n" + - " if (c2 == 0) {} // complain\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " if (c2 == 0) {} // complain\n" + - " ^^\n" + - "The local variable c2 may not have been initialized\n" + - "----------\n", - null, true, options); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836 -// [compiler] warning on fall through -// basic scenario -public void test006() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test(int p) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.out.println(0); // silent because first case\n" + - " case 1:\n" + - " System.out.println(1); // complain: possible fall-through\n" + - " break;\n" + - " case 2:\n" + - " System.out.println(3); // silent because of break\n" + - " return;\n" + - " case 3: // silent because of return\n" + - " case 4: // silent because grouped cases\n" + - " default:\n" + - " System.out.println(\"default\"); //$NON-NLS-1$\n" + - " }\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " case 1:\n" + - " ^^^^^^\n" + - "Switch case may be entered by falling through previous case\n" + - "----------\n", - null, true, options); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836 -// [compiler] warning on fall through -// SuppressWarnings effect - explicit fallthrough token -public void test007() { - if (COMPLIANCE_1_5.equals(this.complianceLevel)) { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.WARNING); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " @SuppressWarnings(\"fallthrough\")\n" + - " public void test(int p) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.out.println(0); // silent because first case\n" + - " case 1:\n" + - " System.out.println(1); // silent because of SuppressWarnings\n" + - " }\n" + - " }\n" + - " Zork z;\n" + // complain on Zork (unknown type) - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 11)\n" + - " Zork z;\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n", - null, true, options); - } -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836 -// [compiler] warning on fall through -// deep return (1) - fake reachable is seen as reachable -public void test008() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test(int p) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.out.println(0);\n" + - " if (true) {\n" + - " return;\n" + - " }\n" + - " case 1:\n" + - " System.out.println(1);\n" + - " }\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 9)\n" + - " case 1:\n" + - " ^^^^^^\n" + - "Switch case may be entered by falling through previous case\n" + - "----------\n", - null, true, options); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836 -// [compiler] warning on fall through -// deep return (2) -public void test009() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test(int p, boolean b) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.out.println(0);\n" + - " if (b) {\n" + - " return;\n" + - " }\n" + - " else {\n" + - " return;\n" + - " }\n" + - " case 1:\n" + - " System.out.println(1);\n" + - " }\n" + - " }\n" + - "}" - }, - "", - null, true, null, options, null); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836 -// [compiler] warning on fall through -// deep return (3), limit: cannot recognize that we won't return -public void test010() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test(int p, boolean b) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.exit(0);\n" + - " case 1:\n" + // complain - " System.out.println(1);\n" + - " }\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " case 1:\n" + - " ^^^^^^\n" + - "Switch case may be entered by falling through previous case\n" + - "----------\n", - null, true, options); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836 -// [compiler] warning on fall through -// SuppressWarnings effect - implicit, using all token -public void test011() { - if (COMPLIANCE_1_5.equals(this.complianceLevel)) { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.WARNING); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " @SuppressWarnings(\"all\")\n" + - " public void test(int p) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.out.println(0); // silent because first case\n" + - " case 1:\n" + - " System.out.println(1); // silent because of SuppressWarnings\n" + - " }\n" + - " }\n" + - " Zork z;\n" + // complain on Zork (unknown type) - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 11)\n" + - " Zork z;\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n", - null, true, options); - } -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127730 -// [compiler] skip fall-through case warning when the fall-through is documented -// skip because of comment -public void _test012() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test(int p) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.out.println(0); // silent because first case\n" + - " // on purpose fall-through\n" + - " case 1:\n" + - " System.out.println(1); // silent because of comment alone on its line above \n" + - " }\n" + - " }\n" + - "}" - }, - "", - null, true, null, options, null); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127730 -// [compiler] skip fall-through case warning when the fall-through is documented -// skip because of comment - default label -public void _test013() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test(int p) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.out.println(0); // silent because first case\n" + - " // on purpose fall-through\n" + - " default:\n" + - " System.out.println(1); // silent because of comment alone on its line above \n" + - " }\n" + - " }\n" + - "}" - }, - "", - null, true, null, options, null); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836 -// [compiler] warning on fall through -// basic scenario: default label -public void test014() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test(int p) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.out.println(0); // silent because first case\n" + - // note: the comment above is not alone on its line, hence it does not - // protect against fall-through diagnostic - " default:\n" + - " System.out.println(1); // complain: possible fall-through\n" + - " }\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " default:\n" + - " ^^^^^^^\n" + - "Switch case may be entered by falling through previous case\n" + - "----------\n", - null, true, options); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836 -// [compiler] warning on fall through -// skip because of comment - variants -public void test015() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test(int p) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.out.println(0); // silent because first case\n" + - " // on purpose fall-through\n" + - "\n" + // extraneous line breaks fall-through protection - " case 1:\n" + - " System.out.println(1); // silent because of comment alone on its line above \n" + - " }\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 8)\n" + - " case 1:\n" + - " ^^^^^^\n" + - "Switch case may be entered by falling through previous case\n" + - "----------\n", - null, true, options); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836 -// [compiler] warning on fall through -// skip because of comment - variants -public void test016() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test(int p) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.out.println(0); // silent because first case\n" + - " // on purpose fall-through\n" + - " /* other comment */\n" + // non-single line comment breaks fall-through protection - " case 1:\n" + - " System.out.println(1); // silent because of comment alone on its line above \n" + - " }\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 8)\n" + - " case 1:\n" + - " ^^^^^^\n" + - "Switch case may be entered by falling through previous case\n" + - "----------\n", - null, true, options); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127730 -// [compiler] skip fall-through case warning when the fall-through is documented -// skip because of comment - variants -public void _test017() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test(int p) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.out.println(0);\n" + - "// on purpose fall-through\n" + // very beginning of line - " case 1:\n" + - " System.out.println(1); // silent because of comment alone on its line above \n" + - " }\n" + - " }\n" + - "}" - }, - "", - null, true, null, options, null); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=127730 -// [compiler] skip fall-through case warning when the fall-through is documented -// skip because of comment - variants -public void _test018() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test(int p) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.out.println(0);\n" + - " //\n" + // empty line comment alone upon its line - " case 1:\n" + - " System.out.println(1); // silent because of comment alone on its line above \n" + - " }\n" + - " }\n" + - "}" - }, - "", - null, true, null, options, null); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836 -// [compiler] warning on fall through -// conditioned break -public void test019() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportFallthroughCase, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test(int p, boolean b) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " if (b) {\n" + - " break;\n" + - " }\n" + - " case 1:\n" + - " System.out.println(1); // silent because of comment alone on its line above \n" + - " }\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 8)\n" + - " case 1:\n" + - " ^^^^^^\n" + - "Switch case may be entered by falling through previous case\n" + - "----------\n", - null, true, options); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836 -// [compiler] warning on fall through -// default reporting is ignore -public void test020() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void test(int p) {\n" + - " switch (p) {\n" + - " case 0:\n" + - " System.out.println(0); // silent because first case\n" + - " case 1:\n" + - " System.out.println(1); // silent because default level is ignore\n" + - " }\n" + - " }\n" + - " Zork z;\n" + // complain on Zork (unknown type) - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 10)\n" + - " Zork z;\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n"); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=67836 -// [compiler] warning on fall through -// problem category -public void test021() { - if (ProblemReporter.getProblemCategory(ProblemSeverities.Warning, IProblem.FallthroughCase) != - CategorizedProblem.CAT_POTENTIAL_PROGRAMMING_PROBLEM) { - fail("bad category for fall-through case problem"); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=128840 -public void test022() { - Map options = getCompilerOptions(); - options.put(CompilerOptions.OPTION_ReportEmptyStatement, CompilerOptions.ERROR); - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void main(String[] args) {\n" + - " if (true)\n" + - " ;\n" + - " else\n" + - " ;\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 4)\n" + - " ;\n" + - " ^\n" + - "Empty control-flow statement\n" + - "----------\n" + - "2. ERROR in X.java (at line 6)\n" + - " ;\n" + - " ^\n" + - "Empty control-flow statement\n" + - "----------\n", - null, true, options); -} -public void test023() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void main(String[] args) {\n" + - " final X x;\n" + - " while (true) {\n" + - " if (true) {\n" + - " break;\n" + - " }\n" + - " x = new X();\n" + - " }\n" + - " x.foo();\n" + - " }\n" + - " public void foo() {\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 10)\n" + - " x.foo();\n" + - " ^\n" + - "The local variable x may not have been initialized\n" + - "----------\n"); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=132974 -public void test024() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void foo(boolean b) {\n" + - " final Object l;\n" + - " do {\n" + - " if (b) {\n" + - " l = new Object();\n" + - " break;\n" + - " }\n" + - " } while (false);\n" + - " l.toString();\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 10)\n" + - " l.toString();\n" + - " ^\n" + - "The local variable l may not have been initialized\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=135602 -public void test025() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void main(String[] args) {\n" + - " System.out.print(\"[starting]\");\n" + - " X l = new X();\n" + - " l.testLoop();\n" + - " System.out.println(\"[finished]\");\n" + - " }\n" + - "\n" + - " public void testLoop() {\n" + - " int loops = 0;\n" + - "\n" + - " do {\n" + - " System.out.print(\"[Loop \" + loops + \"]\");\n" + - " if (loops > 2) {\n" + - " return;\n" + - " }\n" + - "\n" + - " if (loops < 4) {\n" + - " ++loops;\n" + - " continue; \n" + - " }\n" + - " } while (false);\n" + - " }\n" + - "\n" + - "}\n" - }, - "[starting][Loop 0][finished]"); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=137298 -public void test026() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo(Object o1) {\n" + - " int a00, a01, a02, a03, a04, a05, a06, a07, a08, a09;\n" + - " int a10, a11, a12, a13, a14, a15, a16, a17, a18, a19;\n" + - " int a20, a21, a22, a23, a24, a25, a26, a27, a28, a29;\n" + - " int a30, a31, a32, a33, a34, a35, a36, a37, a38, a39;\n" + - " int a40, a41, a42, a43, a44, a45, a46, a47, a48, a49;\n" + - " int a50, a51, a52, a53, a54, a55, a56, a57, a58, a59;\n" + - " int a60, a61, a62, a63, a64, a65, a66, a67, a68, a69;\n" + - " String s;\n" + - " Object o2 = o1;\n" + - " if (o2 == null) {\n" + - " s = \"\";\n" + - " }\n" + - " System.out.println(s);\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 15)\n" + - " System.out.println(s);\n" + - " ^\n" + - "The local variable s may not have been initialized\n" + - "----------\n"); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=102728 -// Non-recursive approach for deep binary expressions. Check that the -// flow analysis doesn't break. -public void test027() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void main(String args[]) {\n" + - " String s;\n" + - " if (args.length == 0) {\n" + - " s = \"s\";\n" + - " } else {\n" + - " s = args[0];\n" + - " }\n" + - " System.out.println(s + \"-\" + s + \"-\" + s + \"-\" +\n" + - " s + \"-\" + s + \"-\" + s + \"-\" +\n" + - " s + \"-\" + s + \"-\" + s + \"-\" +\n" + - " s + \"-\" + s + \"-\" + s + \"-\" +\n" + - " s + \"-\" + s + \"-\" + s + \"-\");\n" + - " }\n" + - "}" - }, - "s-s-s-s-s-s-s-s-s-s-s-s-s-s-s-"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155423 -public void test028() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " {\n" + - " if (true) throw new NullPointerException();\n" + - " }\n" + - "}\n" // ================= - }, - ""); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155423 - variation -public void test029() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " {\n" + - " if (true) throw new NullPointerException();\n" + - " }\n" + - " X() {\n" + - " System.out.println();\n" + - " }\n" + - "}\n", // ================= - }, - ""); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155423 - variation -public void test030() { - this.runConformTest( - new String[] { - "X.java", - "class Y {\n" + - " Y(Object o) {\n" + - " System.out.print(o);\n" + - " }\n" + - "}\n" + - "\n" + - "public class X extends Y {\n" + - " {\n" + - " if (true)\n" + - " throw new NullPointerException();\n" + - " }\n" + - "\n" + - " X() {\n" + - " super(new Object() {\n" + - " public String toString() {\n" + - " return \"SUCCESS:\";\n" + - " }\n" + - " });\n" + - " System.out.println();\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " try {\n" + - " new X();\n" + - " } catch(NullPointerException e) {\n" + - " System.out.println(\"caught:NPE\");\n" + - " }\n" + - " }\n" + - "}\n", // ================= - }, - "SUCCESS:caught:NPE"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155423 - variation -public void test031() { - this.runNegativeTest( - new String[] { - "X.java", - "class Y {\n" + - " Y(Object o) {\n" + - " }\n" + - "}\n" + - "\n" + - "public class X extends Y {\n" + - " final int blank;\n" + - " {\n" + - " if (true)\n" + - " throw new NullPointerException();\n" + - " }\n" + - "\n" + - " X() {\n" + - " super(new Object() {});\n" + - " }\n" + - "}\n", // ================= - }, - "----------\n" + - "1. ERROR in X.java (at line 13)\n" + - " X() {\n" + - " ^^^\n" + - "The blank final field blank may not have been initialized\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155423 - variation -public void test032() { - this.runNegativeTest( - new String[] { - "X.java", - "class Y {\n" + - " Y(int i) {\n" + - " }\n" + - "}\n" + - "\n" + - "public class X extends Y {\n" + - " final int blank;\n" + - " {\n" + - " if (true)\n" + - " throw new NullPointerException();\n" + - " }\n" + - "\n" + - " X() {\n" + - " super(blank = 0);\n" + - " }\n" + - "}\n", // ================= - }, - "----------\n" + - "1. ERROR in X.java (at line 14)\n" + - " super(blank = 0);\n" + - " ^^^^^\n" + - "Cannot refer to an instance field blank while explicitly invoking a constructor\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=155423 - variation -public void test033() { - this.runConformTest( - new String[] { - "X.java", - "class Y {\n" + - " Y(int i) {\n" + - " }\n" + - "}\n" + - "public class X extends Y {\n" + - " final int blank;\n" + - " {\n" + - " if (true)\n" + - " throw new NullPointerException();\n" + - " }\n" + - " X() {\n" + - " super(0);\n" + - " blank = 0;\n" + - " }\n" + - "}\n", // ================= - }, - ""); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 -public void test034() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo1() {\n" + - " switch (1) {\n" + - " case 0:\n" + - " final int i = 1;\n" + - " case i: // should complain: i not initialized\n" + - " System.out.println(i); // should complain: i not initialized\n" + - " }\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " case i: // should complain: i not initialized\n" + - " ^\n" + - "The local variable i may not have been initialized\n" + - "----------\n" + - "2. ERROR in X.java (at line 7)\n" + - " System.out.println(i); // should complain: i not initialized\n" + - " ^\n" + - "The local variable i may not have been initialized\n" + - "----------\n"); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 -// variant -public void test035() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo2() {\n" + - " switch (1) {\n" + - " case 0:\n" + - " int j = 0;\n" + - " case 1:\n" + - " System.out.println(j); // should complain: j not initialized\n" + - " }\n" + - " }\n" + - "}", - }, - "----------\n" + - "1. ERROR in X.java (at line 7)\n" + - " System.out.println(j); // should complain: j not initialized\n" + - " ^\n" + - "The local variable j may not have been initialized\n" + - "----------\n"); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162918 -// variant - not a flow analysis issue per se, contrast with 34 and 35 above -public void test036() { - String src = - "public class X {\n" + - " void foo3() {\n" + - " switch (1) {\n" + - " case 0:\n" + - " class Local {\n" + - " }\n" + - " ;\n" + - " case 1:\n" + - " new Local();\n" + // complain for compliance >= 1.4 - " }\n" + - " }\n" + - "}"; - if (complianceLevel.compareTo(COMPLIANCE_1_3) <= 0) { - this.runConformTest( - new String[] { - "X.java", - src - }, - "" - ); - } else { - this.runNegativeTest( - new String[] { - "X.java", - src - }, - "----------\n" + - "1. ERROR in X.java (at line 9)\n" + - " new Local();\n" + - " ^^^^^\n" + - "Local cannot be resolved to a type\n" + - "----------\n"); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=166641 -public void test037() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo() {\n" + - " if (false) {\n" + - " String s;\n" + - " System.out.println(s);\n" + - " }\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 5)\n" + - " System.out.println(s);\n" + - " ^\n" + - "The local variable s may not have been initialized\n" + - "----------\n"); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=166641 -// variant: the declaration is outside of the fake reachable block -public void test038() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo() {\n" + - " String s;\n" + - " if (false) {\n" + - " System.out.println(s);\n" + - " }\n" + - " }\n" + - "}" - }, - ""); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=166641 -// variant with deeper nesting -public void test039() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo() {\n" + - " if (false) {\n" + - " String s;\n" + - " if (System.out != null) {\n" + - " System.out.println(s);\n" + - " }\n" + - " }\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " System.out.println(s);\n" + - " ^\n" + - "The local variable s may not have been initialized\n" + - "----------\n"); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=166641 -// variant - checking duplicate initialization of final variables -public void test040() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo() {\n" + - " final String s = \"\";\n" + - " if (false) {\n" + - " s = \"\";\n" + - " }\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 5)\n" + - " s = \"\";\n" + - " ^\n" + - "The final local variable s cannot be assigned. It must be blank and not using a compound assignment\n" + - "----------\n"); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=166641 -// variant - checking duplicate initialization of final variables -public void test041() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo() {\n" + - " final String s;\n" + - " s = \"\";\n" + - " if (false) {\n" + - " s = \"\";\n" + - " }\n" + - " }\n" + - "}" - }, - ""); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=166641 -// variant - checking duplicate initialization of final variables -public void test042() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo() {\n" + - " final String s;\n" + - " if (false) {\n" + - " s = \"\";\n" + - " }\n" + - " s = \"\";\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 7)\n" + - " s = \"\";\n" + - " ^\n" + - "The final local variable s may already have been assigned\n" + - "----------\n"); -} -// switch and definite assignment -public void test043() { - this.runConformTest( - new String[] { - "X.java", - "public abstract class X {\n" + - " public static void main(String[] args) {\n" + - " for (int i = 0; i < 3; i++) {\n" + - " System.out.print(i);\n" + - " switch (i) {\n" + - " case 1:\n" + - " final int j;\n" + - " j = 1;\n" + - " System.out.println(j);\n" + - " break;\n" + - " case 2:\n" + - " j = 2;\n" + - " System.out.println(j);\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n", - }, - "011\n22"); -} -// switch and definite assignment -public void test044() { - this.runNegativeTest( - new String[] { - "X.java", - "public abstract class X {\n" + - " public static void main(String[] args) {\n" + - " for (int i = 0; i < 3; i++) {\n" + - " System.out.print(i);\n" + - " switch (i) {\n" + - " case 1:\n" + - " final int j = 1;\n" + - " System.out.println(j);\n" + - " break;\n" + - " case 2:\n" + - " j = 2;\n" + - " System.out.println(j);\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 11)\n" + - " j = 2;\n" + - " ^\n" + - "The final local variable j cannot be assigned. It must be blank and not using a compound assignment\n" + - "----------\n"); -} -// switch and definite assignment -// ** -public void test045() { - this.runNegativeTest( - new String[] { - "X.java", - "public abstract class X {\n" + - " public static void main(String[] args) {\n" + - " switch (args.length) {\n" + - " case 1:\n" + - " final int j = 1;\n" + - " case 2:\n" + - " switch (5) {\n" + - " case j:\n" + - " }\n" + - " }\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 8)\n" + - " case j:\n" + - " ^\n" + - "The local variable j may not have been initialized\n" + - "----------\n"); -} -// for and definite assignment -// ** -public void test046() { - this.runConformTest( - new String[] { - "X.java", - "public abstract class X {\n" + - " public static void main(String args[]) {\n" + - " for (final int i; 0 < (i = 1); i = i + 1) {\n" + - " System.out.println(i);\n" + - " break;\n" + - " }\n" + - " }\n" + - "}\n", - }, - "1"); -} -public static Class testClass() { - return FlowAnalysisTest.class; -} -} -
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ForStatementTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ForStatementTest.java deleted file mode 100644 index b1ff69f..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/ForStatementTest.java +++ /dev/null
@@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.regression; - -import java.util.Map; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; - -public class ForStatementTest extends AbstractRegressionTest { - -public ForStatementTest(String name) { - super(name); -} - -protected Map getCompilerOptions() { - Map options = super.getCompilerOptions(); - options.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.OPTIMIZE_OUT); - return options; -} -// Static initializer to specify tests subset using TESTS_* static variables -// All specified tests which do not belong to the class are skipped... -static { -// TESTS_NAMES = new String[] { "test000" }; -// TESTS_NUMBERS = new int[] { 45, 46 }; -// TESTS_RANGE = new int[] { 34, 38 }; -} -public static Test suite() { - return buildAllCompliancesTestSuite(testClass()); -} -public void test001() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public static Object m(int[] arg) {\n" + - " yyLoop: for (int i = 0;; ++i) {\n" + - " yyInner: for (;;) {\n" + - " switch (arg[i]) {\n" + - " case 0:\n" + - " break;\n" + - " case 1:\n" + - " continue yyInner;\n" + - " }\n" + - " if (i == 32)\n" + - " return arg;\n" + - " if (i == 12)\n" + - " break;\n" + - " continue yyLoop;\n" + - " }\n" + - " if (i == 32)\n" + - " return null;\n" + - " if (i > 7)\n" + - " continue yyLoop;\n" + - " }\n" + - " }\n" + - "\n" + - " public static void main(String[] args) {\n" + - " System.out.println(\"SUCCESS\");\n" + - " }\n" + - "}\n", - }, - "SUCCESS"); -} -public static Class testClass() { - return ForStatementTest.class; -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InferResolveTests.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InferResolveTests.java deleted file mode 100644 index 5fda3d8..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InferResolveTests.java +++ /dev/null
@@ -1,196 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.regression; - -import java.util.HashMap; - -import org.eclipse.wst.jsdt.core.ast.IExpression; -import org.eclipse.wst.jsdt.core.ast.IFunctionCall; -import org.eclipse.wst.jsdt.core.ast.IFunctionExpression; -import org.eclipse.wst.jsdt.core.ast.IObjectLiteral; -import org.eclipse.wst.jsdt.core.ast.IObjectLiteralField; -import org.eclipse.wst.jsdt.core.ast.ISingleNameReference; -import org.eclipse.wst.jsdt.core.ast.IStringLiteral; -import org.eclipse.wst.jsdt.core.infer.IInferEngine; -import org.eclipse.wst.jsdt.core.infer.IInferenceFile; -import org.eclipse.wst.jsdt.core.infer.InferEngine; -import org.eclipse.wst.jsdt.core.infer.InferredMethod; -import org.eclipse.wst.jsdt.core.infer.InferredType; -import org.eclipse.wst.jsdt.core.infer.InferrenceProvider; -import org.eclipse.wst.jsdt.core.infer.RefactoringSupport; -import org.eclipse.wst.jsdt.core.infer.ResolutionConfiguration; - - -public class InferResolveTests extends AbstractRegressionTest { - - - static class InferProvider implements InferrenceProvider - { - - InferEngine inferEngine; - - - public InferProvider(InferEngine inferEngine) { - this.inferEngine = inferEngine; - inferEngine.inferenceProvider=this; - } - - public int applysTo(IInferenceFile scriptFile) { - return InferrenceProvider.MAYBE_THIS; - } - - public String getID() { - return "dummyID"; - } - - public IInferEngine getInferEngine() { - return inferEngine; - } - - public RefactoringSupport getRefactoringSupport() { - return null; - } - - public ResolutionConfiguration getResolutionConfiguration() { - return null; - } - - } - - static class TestInferEngine extends InferEngine - { - - static final char[] []ADD_CLASS={"defineClass".toCharArray()}; - static final char[] []ADD_MIXIN={"addMixin".toCharArray()}; - - protected boolean handleFunctionCall(IFunctionCall functionCall) { - if (isFunction(functionCall, ADD_CLASS) ) - { - IExpression[] arguments = functionCall.getArguments(); - if (arguments.length>1 && arguments[0] instanceof IStringLiteral) - { - char [] className=getString(arguments[0]); - InferredType type = addType(className,true); - type.sourceStart = functionCall.sourceStart(); - type.sourceEnd = functionCall.sourceEnd(); - if (arguments[1] instanceof IObjectLiteral) { - IObjectLiteral objectLiteral = (IObjectLiteral) arguments[1]; - if (objectLiteral.getFields()!=null) - for (int i = 0; i < objectLiteral.getFields().length; i++) { - IObjectLiteralField field=objectLiteral.getFields()[i]; - char[] name = getString(field.getFieldName()); - if (field.getInitializer() instanceof IFunctionExpression) - { - IFunctionExpression functionExpression=(IFunctionExpression)field.getInitializer(); - - InferredMethod method=type.addMethod(name, functionExpression.getMethodDeclaration(),field.getFieldName().sourceStart()); - } - } - } - } - } - else if (isFunction(functionCall, ADD_MIXIN) ) - { - IExpression[] arguments = functionCall.getArguments(); - if (arguments.length>1 ) - { - char [] className=getString(arguments[0]); - char [] mixinName=getString(arguments[1]); - if (className!=null && mixinName!=null) - { - InferredType type = findDefinedType(className); - if (type!=null) - type.addMixin(mixinName); - } - - - } - } - return true; - } - - private char[] getString(IExpression expression) - { - if (expression instanceof IStringLiteral) { - IStringLiteral strLit = (IStringLiteral) expression; - return strLit.source(); - } - else if ((expression instanceof ISingleNameReference)) - { - ISingleNameReference snr=(ISingleNameReference)expression; - return snr.getToken(); - } - return null; - } - } - - public InferResolveTests(String name) { - super(name); - } - - - protected void runNegativeTest(String[] testFiles, InferEngine inferEngine, String expectedProblemLog) { - HashMap options = new HashMap(); - - InferEngine[] inferenceEngines = new InferEngine[] - { - (InferEngine)new InferProvider(inferEngine).getInferEngine() - - }; - options.put(INFERENCE_ENGINES, inferenceEngines); - - - - runNegativeTest( - testFiles, - expectedProblemLog, - null /* no extra class libraries */, - true /* flush output directory */, - options /* no custom options */, - false /* do not generate output */, - false /* do not show category */, - false /* do not show warning token */, - false /* do not skip javac for this peculiar test */, - false /* do not perform statements recovery */, - null); - } - - - public void test001() { - - this.runNegativeTest( - new String[] { - "cls.js", - " function defineClass(name,args){}\n" - +" function addMixin(toClass,mixinName){}\n" - +" defineClass(\"MyClass\",\n" - +" {meth1 : function (){} }\n" - +" );\n" - +" addMixin(\"MyClass\",\"myMixin\");\n" - +"", - "mix.js", - " defineClass(\"myMixin\",\n" - +" {mixinFunc : function (){} }\n" - +" );\n" - +"", - "use.js", - " var v=new MyClass();\n" - +" v.mixinFunc();\n" - +"", - }, - new TestInferEngine(), - "" - ); - - } - - -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InferTypesTests.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InferTypesTests.java index 3e27ab3..c0e85fb 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InferTypesTests.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InferTypesTests.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2011 IBM Corporation and others. + * Copyright (c) 2005, 2013 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 @@ -10,7 +10,9 @@ *******************************************************************************/ package org.eclipse.wst.jsdt.core.tests.compiler.regression; +import org.eclipse.wst.jsdt.core.compiler.CharOperation; import org.eclipse.wst.jsdt.core.infer.InferOptions; +import org.eclipse.wst.jsdt.core.infer.InferredType; import org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration; public class InferTypesTests extends AbstractRegressionTest { @@ -20,14 +22,37 @@ } - private InferOptions getDefaultOptions() + protected InferOptions getDefaultOptions() { InferOptions inferOptions=new InferOptions(); inferOptions.setDefaultOptions(); return inferOptions; } - + /** + * @param typeName + * @param precursorToBodyStart + * @param precursorToBodyEnd + */ + private void verifySourceRangeWithContents(CompilationUnitDeclaration declaration, String typeName, String precursorToBodyStart, String precursorToBodyEnd) { + InferredType testType = (InferredType) declaration.inferredTypesHash.get(typeName.toCharArray()); + assertNotNull(typeName + " not found in CompilationUnitDeclaration", testType); + char[] contents = declaration.compilationResult.compilationUnit.getContents(); + assertNotNull(contents); + assertTrue(contents.length > 0); + char[] precursor = precursorToBodyStart.toCharArray(); + assertTrue("precursorToBodyStart not found", CharOperation.indexOf(precursorToBodyStart.toCharArray(), contents, true) >= 0); + int expectedStart = CharOperation.indexOf(precursor, contents, true) + precursor.length - 1; + assertTrue("precursorToBodyStart not unique", CharOperation.indexOf(precursor, contents, true, expectedStart, contents.length - 1) < 0); + + assertTrue("precursorToBodyEnd not found", CharOperation.indexOf(precursorToBodyEnd.toCharArray(), contents, true) >= 0); + int expectedEnd = CharOperation.indexOf(precursorToBodyEnd.toCharArray(), contents, true) + precursorToBodyEnd.length() - 1; + assertTrue("precursorToBodyEnd not unique", CharOperation.indexOf(precursorToBodyEnd.toCharArray(), contents, true, expectedEnd, contents.length - 1) < 0); + + assertEquals("Wrong sourceStart for " + new String(testType.getName()), expectedStart, testType.sourceStart()); + assertEquals("Wrong sourceEnd for " + new String(testType.getName()), expectedEnd, testType.sourceEnd()); + } + public void test001() { CompilationUnitDeclaration declaration = this.runInferTest( "function MyClass() {\n"+ @@ -37,7 +62,11 @@ "var myClassObj = new MyClass();\n"+ "\n", "X.js", - "class MyClass extends Object{\n String url;\n void activate()\n MyClass()\n}\n", + "class MyClass extends Object{\n" + + " String url;\n" + + " void activate()\n" + + " MyClass()\n" + + "}\n", getDefaultOptions() ); @@ -48,13 +77,15 @@ CompilationUnitDeclaration declaration = this.runInferTest( "Shape.prototype.GetArea = Shape_GetArea;"+ "function Shape(){}"+ - "function Shape_GetArea()"+ - "{"+ + "function Shape_GetArea(){"+ " var area = 5;"+ - "return area;"+ + " return area;"+ "}", "X.js", - "class Shape extends Object{\n Number GetArea()\n Shape()\n}\n", + "class Shape extends Object{\n" + + " Number GetArea()\n" + + " Shape()\n" + + "}\n", getDefaultOptions() ); @@ -87,7 +118,7 @@ "}", "X.js", "class Shape extends Object{\n ?? GetArea()\n Shape()\n}\n"+ - "class Circle extends Shape{\n ?? constructor;\n void GetArea()\n}\n", + "class Circle extends Shape{\n Circle constructor;\n void GetArea()\n}\n", getDefaultOptions() ); @@ -149,1274 +180,1333 @@ ); } - public void test012() { - CompilationUnitDeclaration declaration = this.runInferTest( - "Test.prototype=new Object();\n" - + "Test.x=1;\n" - + "", - "X.js", - "class Test extends Object{\n static Number x;\n}\n", - getDefaultOptions() - - ); - } - - - public void test013() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function MyClass() {\n"+ - " this.arr = [1];\n"+ - "}\n"+ - "var myClassObj = new MyClass();\n"+ - "\n", + public void test012() { + CompilationUnitDeclaration declaration = this.runInferTest( + "Test.prototype=new Object();\n" + + "Test.x=1;\n", "X.js", - "class MyClass extends Object{\n Array(Number) arr;\n MyClass()\n}\n", - getDefaultOptions() - - ); - } + "class Test extends Object{\n static Number x;\n}\n", + getDefaultOptions() + + ); + } - - public void test020() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var foo;\n"+ - " foo.onMouseDown = function () { return 1; };\n"+ - "\n", - "X.js", - "class ___foo0 extends Object{\n static Number onMouseDown()\n}\n", - getDefaultOptions() - - ); - } + public void test013() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function MyClass() {\n"+ + " this.arr = [1];\n"+ + "}\n"+ + "var myClassObj = new MyClass();\n"+ + "\n", + "X.js", + "class MyClass extends Object{\n Array(Number) arr;\n MyClass()\n}\n", + getDefaultOptions() + + ); + } - - - public void test040() { - CompilationUnitDeclaration declaration = this.runInferTest( - "/**\n" - + " * @constructor \n" - + " */\n" - +"function MyClass(){}" - + "/**\n" - + " * @memberOf MyClass \n" - + " * @type String \n" + + + public void test020() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var foo;\n"+ + " foo.onMouseDown = function () { return 1; };\n"+ + "\n", + "X.js", + "class ___anonymous_foo extends Object{\n Number onMouseDown()\n}\n", + getDefaultOptions() + + ); + } + + + + public void test040() { + CompilationUnitDeclaration declaration = this.runInferTest( + "/**\n" + + " * @constructor \n" + " */\n" - +"var s;" + +"function MyClass(){}" + "/**\n" + " * @memberOf MyClass \n" - + " * @type Number \n" - + " */\n" - +"function numValue(){};" - +"\n", - "X.js", - "class MyClass extends Object{\n String s;\n MyClass()\n Number numValue()\n}\n", - getDefaultOptions() - - ); - } - - - - - - public void test041() { - CompilationUnitDeclaration declaration = this.runInferTest( - " i= { \n"+ - "/**\n" + - " * @memberOf MyClass\n" + - " * @type Number\n" + - " */\n" + - " a: 2 ,\n"+ - "/**\n" + - " * @memberOf MyClass\n" + - " * @type String\n" + - " */\n" + - " b: function(){}};" + - "\n", - "X.js", - "class MyClass extends Object{\n Number a;\n String b()\n}\n", - getDefaultOptions() - - ); - } - - - public void test041a() { - CompilationUnitDeclaration declaration = this.runInferTest( - " i= { \n"+ - "/**\n" + - " * @memberOf jsns.MyClass\n" + - " * @type jsns.Number\n" + - " */\n" + - " a: 2 ,\n"+ - "/**\n" + - " * @memberOf jsns.MyClass\n" + - " * @type jsns.String\n" + - " */\n" + - " b: function(){}};" + - "\n", - "X.js", - "class jsns.MyClass extends Object{\n jsns.Number a;\n jsns.String b()\n}\n", - getDefaultOptions() - - ); - } - - - public void test042() { - CompilationUnitDeclaration declaration = this.runInferTest( - "/**\n" - + " * @constructor \n" - + " * @extends String \n" - + " */\n" - +"function MyClass(){}" - - +"MyClass.prototype = { \n"+ - "/**\n" + - " * @memberOf MyClass\n" + - " * @type Number\n" + - " */\n" + - " a: 2 ,\n"+ - "/**\n" + - " * @memberOf MyClass\n" + - " * @type String\n" + - " */\n" + - " b: function(){}};" + - "\n", - "X.js", - "class MyClass extends String{\n Number a;\n MyClass()\n String b()\n}\n", - getDefaultOptions() - - ); - } - - public void test042a() { - CompilationUnitDeclaration declaration = this.runInferTest( - "/**\n" - + " * @constructor \n" - + " * @extends String \n" - + " */\n" - +"function MyClass(){}" - - +"MyClass.prototype = { \n"+ - "/**\n" + - " * @memberOf MyClass\n" + - " * @type jsns.Number\n" + - " */\n" + - " a: 2 ,\n"+ - "/**\n" + - " * @memberOf MyClass\n" + - " * @type jsns.String\n" + - " */\n" + - " b: function(){}};" + - "\n", - "X.js", - "class MyClass extends String{\n jsns.Number a;\n MyClass()\n jsns.String b()\n}\n", - getDefaultOptions() - - ); - } - - - public void test043() { - CompilationUnitDeclaration declaration = this.runInferTest( - "/**\n" - + " * @constructor \n" - + " */\n" - +"function MyClass(){}" - + "/**\n" - + " * @memberOf MyClass \n" - + " * @param {Number} p1\n" + " * @type String \n" + " */\n" - +"function foo(p1){};" - +"\n", - "X.js", - "class MyClass extends Object{\n MyClass()\n String foo(Number p1)\n}\n", - getDefaultOptions() - ); - } - - public void test043a() { - CompilationUnitDeclaration declaration = this.runInferTest( - "/**\n" - + " * @constructor \n" - + " */\n" - +"function MyClass(){}" - + "/**\n" - + " * @memberOf MyClass \n" - + " * @param {jsns2.Number} p1\n" - + " * @type jsns.String \n" - + " */\n" - +"function foo(p1){};" - +"\n", - "X.js", - "class MyClass extends Object{\n MyClass()\n jsns.String foo(jsns2.Number p1)\n}\n", - getDefaultOptions() - ); - } - - public void test060() { - CompilationUnitDeclaration declaration = this.runInferTest( - "Shape.prototype.GetArea = Shape_GetArea;"+ - "function Shape_GetArea()"+ - "{"+ - " var str=\"\";"+ - "return str;"+ - "}", - "X.js", - "class Shape extends Object{\n String GetArea()\n}\n", - getDefaultOptions() - - ); - } - - /** - * Test Object literal local variable declaration - */ - public void test061() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var foo = {"+ - " bar: \"bar\","+ - " bar2: function(){}"+ - "}", - "X.js", - "class ___anonymous10_44 extends Object{\n String bar;\n void bar2()\n}\n", - getDefaultOptions() - - ); - } - - /** - * Test Object literal assignment - */ - public void test062() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var foo;"+ - "foo = {"+ - " bar: \"bar\","+ - " bar2: function(){}"+ - "}", - "X.js", - "class ___anonymous14_48 extends Object{\n String bar;\n void bar2()\n}\n", - getDefaultOptions() - - ); - } - - /** - * Test nested Object literals - */ - public void test063() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var foo = {"+ - " bar: \"bar\","+ - " bar2: {" + - " bar3: \"bar3\"" + - " }"+ - "}", - "X.js", - "class ___anonymous10_52 extends Object{\n String bar;\n ___anonymous32_51 bar2;\n}\n"+ - "class ___anonymous32_51 extends Object{\n String bar3;\n}\n", - getDefaultOptions() - - ); - } - - /** - * Runtime simple member assignment to Object literal - */ - public void test064() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var ns = {};" + - "ns.foo = \"\";" + - "ns.bar = function(){" + - " return \"\";" + - "}", - "X.js", - "class ___anonymous9_10 extends Object{\n String foo;\n String bar()\n}\n", - getDefaultOptions() - - ); - } - - /** - * Runtime complex member (setting to an Object literal) asignment to Object literal - */ - public void test065() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var ns = {};"+ - "ns.foo = {" + - " bar: \"\""+ - "};", - "X.js", - "class ___anonymous9_10 extends Object{\n ___anonymous21_31 foo;\n}\n"+ - "class ___anonymous21_31 extends Object{\n String bar;\n}\n", - getDefaultOptions() - - ); - } - - /** - * Assign Object Literal to prototype - */ - public void test066() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function foo(){"+ - "};"+ - "foo.prototype = {"+ - " bar: \"\""+ - "}", - "X.js", - "class foo extends Object{\n String bar;\n foo()\n}\n", - getDefaultOptions() - - ); - } - - /** - * Assign Object Literal to a prototype member - */ - public void test067() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function foo(){"+ - "};"+ - "foo.prototype.bar = {"+ - " bar2: \"\""+ - "}", - "X.js", - "class foo extends Object{\n ___anonymous37_48 bar;\n foo()\n}\n"+ - "class ___anonymous37_48 extends Object{\n String bar2;\n}\n", - getDefaultOptions() - - ); - } - - /** - * namespaced type (new "class" nested inside an Object Literal) - */ - public void test068() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var ns = {};"+ - "ns.foo = function(){" + - "};" + - "ns.foo.prototype.bar = \"\";" + - "ns.foo.prototype.bar2 = function(){" + - " return \"\";" + - "}", - "X.js", - "class ___anonymous9_10 extends Object{\n ns.foo foo()\n}\n"+ - "class ns.foo extends Object{\n String bar;\n String bar2()\n ns.foo()\n}\n", - getDefaultOptions() - - ); - } - - public void test068b() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var ns = {};"+ - "ns.foo = function(){};" + - "function abc(){};" + - "ns.foo2 = abc;" + - "", - "X.js", - "class ___anonymous9_10 extends Object{\n void foo()\n void foo2()\n}\n", - getDefaultOptions() - - ); - } - - public void test068c() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var ns = {};"+ - "ns.foo = function(){};" + - "ns.foo2 = ns.foo;" + - "", - "X.js", - "class ___anonymous9_10 extends Object{\n void foo()\n void foo2()\n}\n", - getDefaultOptions() - - ); - } - - /** - * namespaced type (new "class" nested inside an Object Literal) - */ - public void test069() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var ns1 = {" + - " ns2: {}" + - "};"+ - "ns1.ns2.foo = function(){" + - "};" + - "ns1.ns2.foo.prototype.bar = \"\";" + - "ns1.ns2.foo.prototype.bar2 = function(){" + - " return \"\";" + - "}", - "X.js", - "class ___anonymous10_20 extends Object{\n ___anonymous18_19 ns2;\n}\n"+ - "class ___anonymous18_19 extends Object{\n ns1.ns2.foo foo()\n}\n"+ - "class ns1.ns2.foo extends Object{\n String bar;\n String bar2()\n ns1.ns2.foo()\n}\n", - getDefaultOptions() - - ); - } - - /* - * Test a potential problem with anonymous and members when returning an {} from a member - */ - public void test070() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var foo = {" + - " a: \"\"," + - " b: function(){" + - " return \"\";" + - " }"+ - "};" + - "foo.c = \"\";" + - "foo.d = function(x, y, z) {" + - " return { x : \"\", y : \"\", z : \"\" };" + - "};", - "X.js", - "class ___anonymous10_52 extends Object{\n String a;\n String c;\n String b()\n ___anonymous101_126 d(x, y, z)\n}\n"+ - "class ___anonymous101_126 extends Object{\n String x;\n String y;\n String z;\n}\n", - getDefaultOptions() - - ); - } - - public void test071() { - CompilationUnitDeclaration declaration = this.runInferTest( - "if( true ){" + - " var foo = {};" + - "}" + - "foo.bar = \"\"", - "X.js", - "class ___anonymous23_24 extends Object{\n String bar;\n}\n", - getDefaultOptions() - - ); - } - - /* - * Object literal within a function as return (need to prevent duplicates) - */ - public void test072() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var foo = function(){" + - " return {" + - " x: \"\"," + - " y: \"\"" + - " }" + - "};", - "X.js", - "class ___anonymous29_46 extends Object{\n String x;\n String y;\n}\n", - getDefaultOptions() - - ); - } - - /* - * Object literal within a function (not a return - */ - public void test073() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var foo = function(){" + - " var bar = {" + - " x: \"\"," + - " y: \"\"" + - " }" + - "};", - "X.js", - "class ___anonymous32_49 extends Object{\n String x;\n String y;\n}\n", - getDefaultOptions() - - ); - } - - public void test074() { - CompilationUnitDeclaration declaration = this.runInferTest( + +"var s;" + + "/**\n" + + " * @memberOf MyClass \n" + + " * @type Number \n" + + " */\n" + +"function numValue(){};" + +"\n", + "X.js", + "class MyClass extends Object{\n String s;\n MyClass()\n Number numValue()\n}\n", + getDefaultOptions() + + ); + } + + + + + + public void test041() { + CompilationUnitDeclaration declaration = this.runInferTest( + " i= { \n"+ "/**\n" + - " * Object Node()\n" + - " * @super Object\n" + - " * @constructor\n" + - " * @class Node\n" + - " * @since Standard ECMA-262 3rd. Edition\n" + - " * @since Level 2 Document Object Model Core Definition.\n" + - " * @link http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html\n" + + " * @memberOf MyClass\n" + + " * @type Number\n" + " */\n" + - "function Node(){};\n" + + " a: 2 ,\n"+ "/**\n" + - " * Property firstChild\n" + - " * @type Node\n" + - " * @class Node\n" + - " * @see Node\n" + - "\n" + - " * @since Standard ECMA-262 3rd. Edition\n" + - " * @since Level 2 Document Object Model Core Definition.\n" + - " * @link http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html\n" + + " * @memberOf MyClass\n" + + " * @type String\n" + " */\n" + - "Node.prototype.firstChild=new Node();\n" + + " b: function(){}};" + + "\n", + "X.js", + "class MyClass extends Object{\n Number a;\n String b()\n}\n", + getDefaultOptions() + + ); + } + + + public void test041a() { + CompilationUnitDeclaration declaration = this.runInferTest( + " i= { \n"+ "/**\n" + - " * function insertBefore(newChild, refChild)\n" + - " * @type Node\n" + - " * @class Node\n" + - " * @param newChilds Node\n" + - " * @param refChild Node\n" + - " * @return Node\n" + - " * @throws DOMException\n" + - " * @see Node\n" + - " * @since Standard ECMA-262 3rd. Edition\n" + - " * @since Level 2 Document Object Model Core Definition.\n" + - " * @link http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html\n" + + " * @memberOf jsns.MyClass\n" + + " * @type jsns.Number\n" + " */\n" + - "Node.prototype.insertBefore = function(newChild, refChild){};\n", + " a: 2 ,\n"+ + "/**\n" + + " * @memberOf jsns.MyClass\n" + + " * @type jsns.String\n" + + " */\n" + + " b: function(){}};" + + "\n", "X.js", - "class Node extends Object{\n Node firstChild;\n Node()\n Node insertBefore(newChild, refChild)\n}\n", - getDefaultOptions() - - ); - } - - /* - * Static member check - */ - public void test075() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var x = function(){};" + - "x.prototype = {};" + - "x.foo = \"\";" + - "x.bar = function(){" + + "class jsns.MyClass extends Object{\n jsns.Number a;\n jsns.String b()\n}\n", + getDefaultOptions() + + ); + } + + + public void test042() { + CompilationUnitDeclaration declaration = this.runInferTest( + "/**\n" + + " * @constructor \n" + + " * @extends String \n" + + " */\n" + +"function MyClass(){}" + + +"MyClass.prototype = { \n"+ + "/**\n" + + " * @memberOf MyClass\n" + + " * @type Number\n" + + " */\n" + + " a: 2 ,\n"+ + "/**\n" + + " * @memberOf MyClass\n" + + " * @type String\n" + + " */\n" + + " b: function(){}};" + + "\n", + "X.js", + "class MyClass extends String{\n Number a;\n MyClass()\n String b()\n}\n", + getDefaultOptions() + + ); + } + + public void test042a() { + CompilationUnitDeclaration declaration = this.runInferTest( + "/**\n" + + " * @constructor \n" + + " * @extends String \n" + + " */\n" + +"function MyClass(){}" + + +"MyClass.prototype = { \n"+ + "/**\n" + + " * @memberOf MyClass\n" + + " * @type jsns.Number\n" + + " */\n" + + " a: 2 ,\n"+ + "/**\n" + + " * @memberOf MyClass\n" + + " * @type jsns.String\n" + + " */\n" + + " b: function(){}};" + + "\n", + "X.js", + "class MyClass extends String{\n jsns.Number a;\n MyClass()\n jsns.String b()\n}\n", + getDefaultOptions() + + ); + } + + + public void test043() { + CompilationUnitDeclaration declaration = this.runInferTest( + "/**\n" + + " * @constructor \n" + + " */\n" + +"function MyClass(){}" + + "/**\n" + + " * @memberOf MyClass \n" + + " * @param {Number} p1\n" + + " * @type String \n" + + " */\n" + +"function foo(p1){};" + +"\n", + "X.js", + "class MyClass extends Object{\n MyClass()\n String foo(Number p1)\n}\n", + getDefaultOptions() + ); + } + + public void test043a() { + CompilationUnitDeclaration declaration = this.runInferTest( + "/**\n" + + " * @constructor \n" + + " */\n" + +"function MyClass(){}" + + "/**\n" + + " * @memberOf MyClass \n" + + " * @param {jsns2.Number} p1\n" + + " * @type jsns.String \n" + + " */\n" + +"function foo(p1){};" + +"\n", + "X.js", + "class MyClass extends Object{\n MyClass()\n jsns.String foo(jsns2.Number p1)\n}\n", + getDefaultOptions() + ); + } + + public void test060() { + CompilationUnitDeclaration declaration = this.runInferTest( + "Shape.prototype.GetArea = Shape_GetArea;"+ + "function Shape_GetArea()"+ + "{"+ + " var str=\"\";"+ + "return str;"+ + "}", + "X.js", + "class Shape extends Object{\n String GetArea()\n}\n", + getDefaultOptions() + + ); + } + + /** + * Test Object literal local variable declaration + */ + public void test061() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var foo = {"+ + " bar: \"bar\","+ + " bar2: function(){}"+ + "}", + "X.js", + "class ___anonymous_foo extends Object{\n" + + " String bar;\n" + + " void bar2()\n" + + "}\n", + getDefaultOptions() + + ); + } + + /** + * Test Object literal assignment + */ + public void test062() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var foo;"+ + "foo = {"+ + " bar: \"bar\","+ + " bar2: function(){}"+ + "}", + "X.js", + "class ___anonymous_foo extends Object{\n" + + " String bar;\n" + + " void bar2()\n" + + "}\n", + getDefaultOptions() + + ); + } + + /** + * Test nested Object literals + */ + public void test063() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var foo = {"+ + " bar: \"bar\","+ + " bar2: {" + + " bar3: \"bar3\"" + + " }"+ + "}", + "X.js", + "class ___anonymous_foo extends Object{\n" + + " String bar;\n" + + " ___anonymous32_51 bar2;\n" + + "}\n"+ + "class ___anonymous32_51 extends Object{\n" + + " String bar3;\n" + + "}\n", + getDefaultOptions() + + ); + } + + /** + * Runtime simple member assignment to Object literal + */ + public void test064() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var ns = {};" + + "ns.foo = \"\";" + + "ns.bar = function(){" + " return \"\";" + "}", - "X.js", - "class x extends Object{\n static String foo;\n static String bar()\n x()\n}\n", - getDefaultOptions() - - ); - } - - - /* - * only statics - */ - public void test075b() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function x(){};" + - "x.foo = \"\";" + - "x.bar = function(){" + - " return \"\";" + + "X.js", + "class ___anonymous_ns extends Object{\n" + + " String foo;\n" + + " String bar()\n" + + "}\n", + getDefaultOptions() + + ); + } + + /** + * Runtime complex member (setting to an Object literal) asignment to Object literal + */ + public void test065() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var ns = {};"+ + "ns.foo = {" + + " bar: \"\""+ + "};", + "X.js", + "class ___anonymous_ns extends Object{\n" + + " ___anonymous_foo foo;\n" + + "}\n"+ + "class ___anonymous_foo extends Object{\n" + + " String bar;\n" + + "}\n", + getDefaultOptions() + + ); + } + + /** + * Assign Object Literal to prototype + */ + public void test066() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function foo(){"+ + "};"+ + "foo.prototype = {"+ + " bar: \"\""+ "}", - "X.js", - "class x extends Object{\n static String foo;\n static String bar()\n x()\n}\n", - getDefaultOptions() - - ); - } - - - - /* - * Global Object mixin - */ - public void test080() { - CompilationUnitDeclaration declaration = this.runInferTest( - "(function(){" + - "this.someField = 1;" + - "})();" , - "X.js", - "class Global extends Object{\n Number someField;\n}\n", - getDefaultOptions() - - ); - } - - - /* - * Static member on built-in - */ - public void test081() { - CompilationUnitDeclaration declaration = this.runInferTest( - "String.foo = \"\";" + - "String.bar = function(){" + - " return \"\";" + + "X.js", + "class foo extends Object{\n String bar;\n foo()\n}\n", + getDefaultOptions() + + ); + } + + /** + * Assign Object Literal to a prototype member + */ + public void test067() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function foo(){"+ + "};"+ + "foo.prototype.bar = {"+ + " bar2: \"\""+ "}", - "X.js", - "class String extends Object{\n static String foo;\n static String bar()\n}\n", - getDefaultOptions() - - ); - } - - - public void test082() { - CompilationUnitDeclaration declaration = this.runInferTest( - "String.foo = \"\";" + - "String.bar1 = String.bar2 = function(){" + - " return \"\";" + - "}", - "X.js", - "class String extends Object{\n static String foo;\n static String bar1()\n static String bar2()\n}\n", - getDefaultOptions() - - ); - } - - public void test083() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Car() {" + - " this.color = 'red';" + - " this.Move = function() { return \"I'm moving\"; };" + + "X.js", + "class foo extends Object{\n ___anonymous37_48 bar;\n foo()\n}\n"+ + "class ___anonymous37_48 extends Object{\n String bar2;\n}\n", + getDefaultOptions() + + ); + } + + /** + * namespaced type (new "class" nested inside an Object Literal) + */ + public void test068() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var ns = {};"+ + "ns.foo = function(){" + "};" + - "Car.Stop = function() { return \"I'm not moving\"; };" + - "Car.engine = 'diesel';" + + "ns.foo.prototype.bar = \"\";" + + "ns.foo.prototype.bar2 = function(){" + + " return \"\";" + + "}", + "X.js", + "class ___anonymous_ns extends Object{\n" + + " void foo()\n" + + "}\n"+ + "class ns.foo extends Object{\n" + + " String bar;\n" + + " String bar2()\n" + + " ns.foo()\n" + + "}\n", + getDefaultOptions() + + ); + } + + public void test068b() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var ns = {};"+ + "ns.foo = function(){};" + + "function abc(){};" + + "ns.foo2 = abc;" + "", - "X.js", - "class Car extends Object{\n String color;\n static String engine;\n String Move()\n static String Stop()\n Car()\n}\n", - getDefaultOptions() - - ); - } - - // test type infered from function with 'this' assignments - public void test084() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Car() {" + - " this.color = 'red';" + - " this.Move = function() { return \"I'm moving\"; };" + + "X.js", + "class ___anonymous_ns extends Object{\n" + + " void foo()\n" + + " void foo2()\n" + + "}\n", + getDefaultOptions() + + ); + } + + public void test068c() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var ns = {};"+ + "ns.foo = function(){};" + + "ns.foo2 = ns.foo;" + + "", + "X.js", + "class ___anonymous_ns extends Object{\n" + + " void foo()\n" + + " void foo2()\n" + + "}\n", + getDefaultOptions() + + ); + } + + /** + * namespaced type (new "class" nested inside an Object Literal) + */ + public void test069() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var ns1 = {" + + " ns2: {}" + + "};"+ + "ns1.ns2.foo = function(){" + "};" + - "", - "X.js", - "class Car extends Object{\n String color;\n String Move()\n Car()\n}\n", - getDefaultOptions() - - ); - } - - public void test085() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Shape(l, w){" + - " this.length = l;" + - " this.width = w;" + + "ns1.ns2.foo.prototype.bar = \"\";" + + "ns1.ns2.foo.prototype.bar2 = function(){" + + " return \"\";" + "}", - "X.js", - "class Shape extends Object{\n ?? length;\n ?? width;\n Shape(l, w)\n}\n", - getDefaultOptions() - - ); - } - - public void test086() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Shape(l, w){" + - " this.length = l;" + - " this.width = w;" + - " return this.length * this.width;" + - "}", - "X.js", - "class Shape extends Object{\n ?? length;\n ?? width;\n Shape(l, w)\n}\n", - getDefaultOptions() - - ); - } - - public void test087() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Shape(l, w){" + - " this.length = l;" + - " this.width = w;" + - "}" + - "var s = new Shape(2, 3);" + - "s.area = function() {return this.length * this.width;};", - "X.js", - "class Shape extends Object{\n ?? length;\n ?? width;\n Shape(l, w)\n}\n" + - "class ___s0 extends Shape{\n Number area()\n}\n", - getDefaultOptions() - - ); - } - - public void test088() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Shape(l, w){" + - " this.length = l;" + - " this.width = w;" + - " this.area = function() {return this.length * this.width;};" + - "}", - "X.js", - "class Shape extends Object{\n ?? length;\n ?? width;\n Number area()\n Shape(l, w)\n}\n", - getDefaultOptions() - - ); - } - - public void test089() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Shape(l, w){" + - " this.length = l;" + - " this.width = w;" + - "}" + - "Shape.prototype.area = function() {return this.length * this.width;};", - "X.js", - "class Shape extends Object{\n ?? length;\n ?? width;\n Number area()\n Shape(l, w)\n}\n", - getDefaultOptions() - - ); - } - - public void test090() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Shape(l, w){" + - " this.length = l;" + - " this.width = w;" + - "}" + - "Shape.CONSTANT = 3;", - "X.js", - "class Shape extends Object{\n ?? length;\n ?? width;\n static Number CONSTANT;\n Shape(l, w)\n}\n", - getDefaultOptions() - - ); - } - - public void test091() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Round(r){" + - " this.rad = r;" + - "}" + - "Round.PI = 3.14;" + - "Round.prototype.area = function() {return Round.PI * this.rad * this.rad;};" + - "Round.equal = function(a, b) {" + - "if(a == b) return true;" + - "return false;" + + "X.js", + "class ___anonymous_ns1 extends Object{\n" + + " ___anonymous18_19 ns2;\n" + + "}\n"+ + "class ___anonymous18_19 extends Object{\n" + + " void foo()\n" + + "}\n"+ + "class ns1.ns2.foo extends Object{\n" + + " String bar;\n" + + " String bar2()\n" + + " ns1.ns2.foo()\n" + + "}\n", + getDefaultOptions() + + ); + } + + /* + * Test a potential problem with anonymous and members when returning an {} from a member + */ + public void test070() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var foo = {" + + " a: \"\"," + + " b: function(){" + + " return \"\";" + + " }"+ + "};" + + "foo.c = \"\";" + + "foo.d = function(x, y, z) {" + + " return { x : \"\", y : \"\", z : \"\" };" + "};", - "X.js", - "class Round extends Object{\n ?? rad;\n static Number PI;\n Number area()\n static Boolean equal(a, b)\n Round(r)\n}\n", - getDefaultOptions() - - ); - } - - public void test092() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Com(r, i){" + - " this.r1 = r;" + - " this.i1 = i;" + + "X.js", + "class ___anonymous_foo extends Object{\n" + + " String a;\n" + + " String c;\n" + + " String b()\n" + + " ___anonymous101_126 d(x, y, z)\n" + + "}\n"+ + "class ___anonymous101_126 extends Object{\n" + + " String x;\n" + + " String y;\n" + + " String z;\n" + + "}\n", + getDefaultOptions() + + ); + } + + public void test071() { + CompilationUnitDeclaration declaration = this.runInferTest( + "if( true ){" + + " var foo = {};" + "}" + - "Com.prototype.meth1 = function() {return 1;};" + - "Com.prototype.meth2 = function() {return new Com(1, 2);};" + - "Com.prototype.meth3 = function(that) {return new Com(that+1, that-1);};" + - "Com.prototype.toString = function() {return \"hi\"};" + - "Com.classMeth1 = function(a, b) {return new Com(a, b);};" + - "Com.classMeth2 = function(a, b) {return new Com(a, b);};" + - "Com.ZERO = new Com(0,0);" + - "Com.ONE = new Com(1,0);", - "X.js", - "class Com extends Object{\n ?? r1;\n ?? i1;\n static Com ZERO;\n static Com ONE;\n" + - " Number meth1()\n Com meth2()\n Com meth3(that)\n String toString()\n static Com classMeth1(a, b)\n static Com classMeth2(a, b)\n Com(r, i)\n}\n", - getDefaultOptions() - - ); - } - - public void test093() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Shape(l, w){" + - " this.length = function() {return l;};" + - " this.width = function() {return w;};" + - "}" + - "Shape.prototype.perimeter = function() {return (this.length * 2) + (this.width * 2);};", - "X.js", - "class Shape extends Object{\n ?? length()\n ?? width()\n Number perimeter()\n Shape(l, w)\n}\n", - getDefaultOptions() - - ); - } - - public void test094() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Shape(l, w){" + - " this.length = l;" + - " this.width = w;" + - "}" + - "Shape.prototype.area = function() {return this.length * this.width;};" + - "function SubShape(l, w, x) {" + - "Shape.call(this, l, w);" + - "this.x = y;" + - "}" + - "SubShape.prototype = new Shape();" + - "SubShape.prototype.meth = function() {return 1};", - "X.js", - "class Shape extends Object{\n ?? length;\n ?? width;\n Number area()\n Shape(l, w)\n}\n" + - "class SubShape extends Shape{\n ?? x;\n Number meth()\n SubShape(l, w, x)\n}\n", - getDefaultOptions() - - ); - } - - public void test095() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Abc(){" + - " this.mult = function(a, b){return a * b;};" + - " this.div = function(a, b){return a / b;};" + - " this.rem = function(a, b){return a % b;};" + - " this.sub = function(a, b){return a - b;};" + - "}", - "X.js", - "class Abc extends Object{\n Number mult(a, b)\n Number div(a, b)\n Number rem(a, b)\n Number sub(a, b)\n Abc()\n}\n", - getDefaultOptions() - - ); - } - - public void test096() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Plus(){" + - " this.strings = function(){return \"a\" + \"b\";};" + - " this.oneStringOneNumber = function(){return \"a\" + 1;};" + - " this.oneStringOneNumber2 = function(){return \"3\" + 1;};" + - " this.numbers = function(){return 1 + 2;};" + - " this.unknownString = function(a){return a + \"b\";};" + - " this.unknownNumber = function(a){return a + 3;};" + - " this.unknownUnknown = function(a, b){return a + b;};" + - "}", - "X.js", - "class Plus extends Object{\n String strings()\n String oneStringOneNumber()\n String oneStringOneNumber2()\n " + - "Number numbers()\n String unknownString(a)\n ?? unknownNumber(a)\n ?? unknownUnknown(a, b)\n Plus()\n}\n", - getDefaultOptions() - - ); - } - - public void test097() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function Equality(){" + - " this.equalsEquals = function(){return \"a\" == \"b\";};" + - " this.equalsEqualsEquals = function(){return \"a\" === \"b\";};" + - " this.notEquals = function(){return \"a\" != \"b\";};" + - " this.notEqualsEquals = function(){return \"a\" !== \"b\";};" + - "}", - "X.js", - "class Equality extends Object{\n Boolean equalsEquals()\n Boolean equalsEqualsEquals()\n Boolean notEquals()\n Boolean notEqualsEquals()\n Equality()\n}\n", - getDefaultOptions() - - ); - } - - public void test098() { - // BUG286010 - CompilationUnitDeclaration declaration = this.runInferTest( - "var MyFunc = function () {};\n" + - "MyFunc.myMeth = function () {};", - "X.js", - "class MyFunc extends Function{\n static void myMeth()\n MyFunc()\n}\n", - getDefaultOptions() - - ); - } + "foo.bar = \"\"", + "X.js", + "class ___anonymous_foo extends Object{\n" + + " String bar;\n" + + "}\n", + getDefaultOptions() + + ); + } + + /* + * Object literal within a function as return (need to prevent duplicates) + */ + public void test072() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var foo = function(){" + + " return {" + + " x: \"\"," + + " y: \"\"" + + " }" + + "};", + "X.js", + "class ___anonymous29_46 extends Object{\n String x;\n String y;\n}\n", + getDefaultOptions() + + ); + } + + /* + * Object literal within a function (not a return + */ + public void test073() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var foo = function(){" + + " var bar = {" + + " x: \"\"," + + " y: \"\"" + + " }" + + "};", + "X.js", + "class ___anonymous32_49 extends Object{\n String x;\n String y;\n}\n", + getDefaultOptions() + + ); + } + + public void test074() { + CompilationUnitDeclaration declaration = this.runInferTest( + "/**\n" + + " * Object Node()\n" + + " * @super Object\n" + + " * @constructor\n" + + " * @class Node\n" + + " * @since Standard ECMA-262 3rd. Edition\n" + + " * @since Level 2 Document Object Model Core Definition.\n" + + " * @link http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html\n" + + " */\n" + + "function Node(){};\n" + + "/**\n" + + " * Property firstChild\n" + + " * @type Node\n" + + " * @class Node\n" + + " * @see Node\n" + + "\n" + + " * @since Standard ECMA-262 3rd. Edition\n" + + " * @since Level 2 Document Object Model Core Definition.\n" + + " * @link http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html\n" + + " */\n" + + "Node.prototype.firstChild=new Node();\n" + + "/**\n" + + " * function insertBefore(newChild, refChild)\n" + + " * @type Node\n" + + " * @class Node\n" + + " * @param newChilds Node\n" + + " * @param refChild Node\n" + + " * @return Node\n" + + " * @throws DOMException\n" + + " * @see Node\n" + + " * @since Standard ECMA-262 3rd. Edition\n" + + " * @since Level 2 Document Object Model Core Definition.\n" + + " * @link http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html\n" + + " */\n" + + "Node.prototype.insertBefore = function(newChild, refChild){};\n", + "X.js", + "class Node extends Object{\n Node firstChild;\n Node()\n Node insertBefore(newChild, refChild)\n}\n", + getDefaultOptions() + + ); + } + + /* + * Static member check + */ + public void test075() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var x = function(){};" + + "x.prototype = {};" + + "x.foo = \"\";" + + "x.bar = function(){" + + " return \"\";" + + "}", + "X.js", + "class x extends Object{\n static String foo;\n static String bar()\n x()\n}\n", + getDefaultOptions() + + ); + } - public void test099() { - // BUG278904 - CompilationUnitDeclaration declaration = this.runInferTest( - "function MyType(){}"+ - "MyType.prototype = new Object();\n"+ - "/**\n"+ - " * Property length\n"+ - " * @type Number\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "MyType.prototype.length = \"\";\n", - "X.js", - "class MyType extends Object{\n Number length;\n MyType()\n}\n", - getDefaultOptions() - - ); - } - public void test099a() { - // BUG278904 - CompilationUnitDeclaration declaration = this.runInferTest( - "function MyType(){}"+ - "MyType.prototype = new Object();\n"+ - "/**\n"+ - " * Property length\n"+ - " * @type Number\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "MyType.prototype.length = \"\";\n"+ - "MyType.prototype.name = \"\";\n", - "X.js", - "class MyType extends Object{\n Number length;\n String name;\n MyType()\n}\n", - getDefaultOptions() - - ); - } - public void test099b() { - // BUG278904 - CompilationUnitDeclaration declaration = this.runInferTest( - "function MyType(){}"+ - "MyType.prototype = new Object();\n"+ - "/**\n"+ - " * Property length\n"+ - " * @type Number\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "MyType.prototype.length = \"\";\n"+ - "MyType.prototype.name = \"\";\n"+ - "MyType.prototype.date = new Date();\n", - "X.js", - "class MyType extends Object{\n Number length;\n String name;\n Date date;\n MyType()\n}\n", - getDefaultOptions() - - ); - } - public void test099c() { - // BUG278904 - CompilationUnitDeclaration declaration = this.runInferTest( - "function MyType(){}"+ - "MyType.prototype = new Object();\n"+ - "/**\n"+ - " * Property length\n"+ - " * @type String\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "MyType.prototype.time = 1;\n"+ - "/**\n"+ - " * Property length\n"+ - " * @type Number\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "MyType.prototype.length = \"\";\n"+ - "MyType.prototype.name = \"\";\n"+ - "MyType.prototype.date = new Date();\n", - "X.js", - "class MyType extends Object{\n String time;\n Number length;\n String name;\n Date date;\n MyType()\n}\n", - getDefaultOptions() - - ); - } - public void test100() { - // BUG278904 - CompilationUnitDeclaration declaration = this.runInferTest( - "function MyType(){}"+ - "MyType.prototype = new Object();\n"+ - "/**\n"+ - " * Property length\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "MyType.prototype.length = \"\";\n", - "X.js", - "class MyType extends Object{\n String length;\n MyType()\n}\n", - getDefaultOptions() - - ); - } - public void test101() { - CompilationUnitDeclaration declaration = this.runInferTest( - "MyType = {\n"+ - "/**\n"+ - " * Property length\n"+ - " * @type Number\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "length : \"value\"\n"+ - "};", - "X.js", - "class MyType extends Object{\n Number length;\n}\n", - getDefaultOptions() - - ); - } - public void test102() { - CompilationUnitDeclaration declaration = this.runInferTest( - "MyType = {\n"+ - "/**\n"+ - " * Property length\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "length : \"value\"\n"+ - "};", - "X.js", - "class MyType extends Object{\n String length;\n}\n", - getDefaultOptions() - - ); - } - public void test103() { - CompilationUnitDeclaration declaration = this.runInferTest( - "MyTypeInner = {\n"+ - "/**\n"+ - " * @memberOf MyTypeInner\n"+ - " */\n"+ - "length: 5\n"+ - "};\n"+ - "MyType = {\n"+ - "/**\n"+ - " * Property events\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @type MyTypeInner\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "events : \"\"\n"+ - "};", - "X.js", - "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n MyTypeInner events;\n}\n", - getDefaultOptions() - - ); - } - public void test104() { - // same as 103, except events is an object literal - CompilationUnitDeclaration declaration = this.runInferTest( - "MyTypeInner = {\n"+ - "/**\n"+ - " * @memberOf MyTypeInner\n"+ - " */\n"+ - "length: 5\n"+ - "};\n"+ - "MyType = {\n"+ - "/**\n"+ - " * Property events\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @type MyTypeInner\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "events : {}\n"+ - "};", - "X.js", - "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n MyTypeInner events;\n}\n", - getDefaultOptions() - - ); - } - public void test105() { - CompilationUnitDeclaration declaration = this.runInferTest( - "MyTypeInner = {\n"+ - "/**\n"+ - " * @memberOf MyTypeInner\n"+ - " */\n"+ - "length: 5\n"+ - "};\n"+ - "MyType = {\n"+ - "a : \"\",\n"+ - "/**\n"+ - " * Property events\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @type MyTypeInner\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "events : {},\n"+ - "b : 7\n"+ - "};", - "X.js", - "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n String a;\n MyTypeInner events;\n Number b;\n}\n", - getDefaultOptions() - - ); - } - public void test106() { - CompilationUnitDeclaration declaration = this.runInferTest( - "MyTypeInner = {\n"+ - "/**\n"+ - " * @memberOf MyTypeInner\n"+ - " */\n"+ - "length: 5\n"+ - "};\n"+ - "MyType = {\n"+ - "a : {},\n"+ - "/**\n"+ - " * Property events\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @type MyTypeInner\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "events : {},\n"+ - "b : {}\n"+ - "};", - "X.js", - "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n ___anonymous80_81 a;\n MyTypeInner events;\n ___anonymous220_221 b;\n}\nclass ___anonymous80_81 extends Object{\n}\nclass ___anonymous220_221 extends Object{\n}\n", - getDefaultOptions() - - ); - } - public void test107() { - CompilationUnitDeclaration declaration = this.runInferTest( - "MyTypeInner = {\n"+ - "/**\n"+ - " * @memberOf MyTypeInner\n"+ - " */\n"+ - "length: 5\n"+ - "};\n"+ - "MyType = {\n"+ - "a : {},\n"+ - "/**\n"+ - " * Property events\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @type MyTypeInner\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "events : {},\n"+ - "/**\n"+ - " * Property b\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @type String\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "b : {}\n"+ - "};", - "X.js", - "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n ___anonymous80_81 a;\n MyTypeInner events;\n String b;\n}\nclass ___anonymous80_81 extends Object{\n}\n", - getDefaultOptions() - - ); - } - public void test108() { - CompilationUnitDeclaration declaration = this.runInferTest( - "MyTypeInner = {\n"+ - "/**\n"+ - " * @memberOf MyTypeInner\n"+ - " */\n"+ - "length: 5\n"+ - "};\n"+ - "MyType = {\n"+ - "a : {},\n"+ - "/**\n"+ - " * Property events\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @type MyTypeInner\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "events : {},\n"+ - "b : {}\n"+ - "};", - "X.js", - "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n ___anonymous80_81 a;\n MyTypeInner events;\n ___anonymous220_221 b;\n}\nclass ___anonymous80_81 extends Object{\n}\nclass ___anonymous220_221 extends Object{\n}\n", - getDefaultOptions() - - ); - } - public void test108a() { - CompilationUnitDeclaration declaration = this.runInferTest( - "MyType = {\n"+ - "/**\n"+ - " * Property events\n"+ - " * @memberOf MyType\n"+ - " * @type MyOwnNamespace.String\n"+ - " */\n"+ - "events : {},\n"+ - "b : \"\"\n"+ - "};", - "X.js", - "class MyType extends Object{\n MyOwnNamespace.String events;\n String b;\n}\n", - getDefaultOptions() - - ); - } - public void test108d() { - CompilationUnitDeclaration declaration = this.runInferTest( - "MyTypeInner = {\n"+ - "/**\n"+ - " * @memberOf MyTypeInner\n"+ - " */\n"+ - "length: 5\n"+ - "};\n"+ - "MyType = {\n"+ - "a : {},\n"+ - "/**\n"+ - " * Property events\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @type MyTypeInner\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "events : {},\n"+ - "b : 5\n"+ - "};", - "X.js", - "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n ___anonymous80_81 a;\n MyTypeInner events;\n Number b;\n}\nclass ___anonymous80_81 extends Object{\n}\n", - getDefaultOptions() - - ); - } - public void test108b() { - CompilationUnitDeclaration declaration = this.runInferTest( - "MyTypeInner = {\n"+ - "/**\n"+ - " * @memberOf MyTypeInner\n"+ - " */\n"+ - "length: 5\n"+ - "};\n"+ - "MyType = {\n"+ - "/**\n"+ - " * Property events\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @type MyTypeInner\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "events : {},\n"+ - "b : \"\"\n"+ - "};", - "X.js", - "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n MyTypeInner events;\n String b;\n}\n", - getDefaultOptions() - - ); - } - public void test108c() { - CompilationUnitDeclaration declaration = this.runInferTest( - "MyTypeInner = {\n"+ - "/**\n"+ - " * @memberOf MyTypeInner\n"+ - " */\n"+ - "length: 5\n"+ - "};\n"+ - "MyType = {\n"+ - "/**\n"+ - " * Property a\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "a : 5,\n"+ - "/**\n"+ - " * Property events\n"+ - " * @memberOf MyType\n"+ - " * @see MyType\n"+ - " * @type MyTypeInner\n"+ - " * @since WTP 3.2.2\n"+ - " */\n"+ - "events : {},\n"+ - "b : {}\n"+ - "};", - "X.js", - "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n Number a;\n MyTypeInner events;\n ___anonymous308_309 b;\n}\nclass ___anonymous308_309 extends Object{\n}\n", - getDefaultOptions() - - ); - } + + /* + * only statics + */ + public void test075b() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function x(){};" + + "x.foo = \"\";" + + "x.bar = function(){" + + " return \"\";" + + "}", + "X.js", + "class x extends Object{\n static String foo;\n static String bar()\n x()\n}\n", + getDefaultOptions() + + ); + } + + + + /* + * Global Object mixin + */ + public void test080() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function(){" + + "this.someField = 1;" + + "})();" , + "X.js", + "class @G extends Object{\n Number someField;\n}\n", + getDefaultOptions() + + ); + } + + + /* + * Static member on built-in + */ + public void test081() { + CompilationUnitDeclaration declaration = this.runInferTest( + "String.foo = \"\";" + + "String.bar = function(){" + + " return \"\";" + + "}", + "X.js", + "class String extends Object{\n static String foo;\n static String bar()\n}\n", + getDefaultOptions() + + ); + } + + + public void test082() { + CompilationUnitDeclaration declaration = this.runInferTest( + "String.foo = \"\";" + + "String.bar1 = String.bar2 = function(){" + + " return \"\";" + + "}", + "X.js", + "class String extends Object{\n static String foo;\n static String bar1()\n static String bar2()\n}\n", + getDefaultOptions() + + ); + } + + public void test083() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Car() {" + + " this.color = 'red';" + + " this.Move = function() { return \"I'm moving\"; };" + + "};" + + "Car.Stop = function() { return \"I'm not moving\"; };" + + "Car.engine = 'diesel';" + + "", + "X.js", + "class Car extends Object{\n String color;\n static String engine;\n String Move()\n static String Stop()\n Car()\n}\n", + getDefaultOptions() + + ); + } + + // test type infered from function with 'this' assignments + public void test084() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Car() {" + + " this.color = 'red';" + + " this.Move = function() { return \"I'm moving\"; };" + + "};" + + "", + "X.js", + "class Car extends Object{\n String color;\n String Move()\n Car()\n}\n", + getDefaultOptions() + + ); + } + + public void test085() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Shape(l, w){" + + " this.length = l;" + + " this.width = w;" + + "}", + "X.js", + "class Shape extends Object{\n ?? length;\n ?? width;\n Shape(l, w)\n}\n", + getDefaultOptions() + + ); + } + + public void test086() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Shape(l, w){" + + " this.length = l;" + + " this.width = w;" + + " return this.length * this.width;" + + "}", + "X.js", + "class Shape extends Object{\n ?? length;\n ?? width;\n Shape(l, w)\n}\n", + getDefaultOptions() + + ); + } + + public void test087() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Shape(l, w){" + + " this.length = l;" + + " this.width = w;" + + "}" + + "var s = new Shape(2, 3);" + + "s.area = function() {" + + " return this.length * this.width;" + + "};", + "X.js", + "class Shape extends Object{\n" + + " ?? length;\n" + + " ?? width;\n" + + " Shape(l, w)\n" + + "}\n" + + "class ___anonymous_s extends Shape{\n" + + " Number area()\n" + + "}\n", + getDefaultOptions() + + ); + } + + public void test088() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Shape(l, w){" + + " this.length = l;" + + " this.width = w;" + + " this.area = function() {return this.length * this.width;};" + + "}", + "X.js", + "class Shape extends Object{\n ?? length;\n ?? width;\n Number area()\n Shape(l, w)\n}\n", + getDefaultOptions() + + ); + } + + public void test089() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Shape(l, w){" + + " this.length = l;" + + " this.width = w;" + + "}" + + "Shape.prototype.area = function() {return this.length * this.width;};", + "X.js", + "class Shape extends Object{\n ?? length;\n ?? width;\n Number area()\n Shape(l, w)\n}\n", + getDefaultOptions() + + ); + } + + public void test090() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Shape(l, w){" + + " this.length = l;" + + " this.width = w;" + + "}" + + "Shape.CONSTANT = 3;", + "X.js", + "class Shape extends Object{\n ?? length;\n ?? width;\n static Number CONSTANT;\n Shape(l, w)\n}\n", + getDefaultOptions() + + ); + } + + public void test091() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Round(r){" + + " this.rad = r;" + + "}" + + "Round.PI = 3.14;" + + "Round.prototype.area = function() {return Round.PI * this.rad * this.rad;};" + + "Round.equal = function(a, b) {" + + "if(a == b) return true;" + + "return false;" + + "};", + "X.js", + "class Round extends Object{\n ?? rad;\n static Number PI;\n Number area()\n static Boolean equal(a, b)\n Round(r)\n}\n", + getDefaultOptions() + + ); + } + + public void test092() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Com(r, i){" + + " this.r1 = r;" + + " this.i1 = i;" + + "}" + + "Com.prototype.meth1 = function() {return 1;};" + + "Com.prototype.meth2 = function() {return new Com(1, 2);};" + + "Com.prototype.meth3 = function(that) {return new Com(that+1, that-1);};" + + "Com.prototype.toString = function() {return \"hi\"};" + + "Com.classMeth1 = function(a, b) {return new Com(a, b);};" + + "Com.classMeth2 = function(a, b) {return new Com(a, b);};" + + "Com.ZERO = new Com(0,0);" + + "Com.ONE = new Com(1,0);", + "X.js", + "class Com extends Object{\n ?? r1;\n ?? i1;\n static Com ZERO;\n static Com ONE;\n" + + " Number meth1()\n Com meth2()\n Com meth3(that)\n String toString()\n static Com classMeth1(a, b)\n static Com classMeth2(a, b)\n Com(r, i)\n}\n", + getDefaultOptions() + + ); + } + + public void test093() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Shape(l, w){" + + " this.length = function() {return l;};" + + " this.width = function() {return w;};" + + "}" + + "Shape.prototype.perimeter = function() {return (this.length * 2) + (this.width * 2);};", + "X.js", + "class Shape extends Object{\n ?? length()\n ?? width()\n Number perimeter()\n Shape(l, w)\n}\n", + getDefaultOptions() + + ); + } + + public void test094() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Shape(l, w){" + + " this.length = l;" + + " this.width = w;" + + "}" + + "Shape.prototype.area = function() {return this.length * this.width;};" + + "function SubShape(l, w, x) {" + + "Shape.call(this, l, w);" + + "this.x = y;" + + "}" + + "SubShape.prototype = new Shape();" + + "SubShape.prototype.meth = function() {return 1};", + "X.js", + "class Shape extends Object{\n ?? length;\n ?? width;\n Number area()\n Shape(l, w)\n}\n" + + "class SubShape extends Shape{\n ?? x;\n Number meth()\n SubShape(l, w, x)\n}\n", + getDefaultOptions() + + ); + } + + public void test095() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Abc(){" + + " this.mult = function(a, b){return a * b;};" + + " this.div = function(a, b){return a / b;};" + + " this.rem = function(a, b){return a % b;};" + + " this.sub = function(a, b){return a - b;};" + + "}", + "X.js", + "class Abc extends Object{\n Number mult(a, b)\n Number div(a, b)\n Number rem(a, b)\n Number sub(a, b)\n Abc()\n}\n", + getDefaultOptions() + + ); + } + + public void test096() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Plus(){" + + " this.strings = function(){return \"a\" + \"b\";};" + + " this.oneStringOneNumber = function(){return \"a\" + 1;};" + + " this.oneStringOneNumber2 = function(){return \"3\" + 1;};" + + " this.numbers = function(){return 1 + 2;};" + + " this.unknownString = function(a){return a + \"b\";};" + + " this.unknownNumber = function(a){return a + 3;};" + + " this.unknownUnknown = function(a, b){return a + b;};" + + "}", + "X.js", + "class Plus extends Object{\n String strings()\n String oneStringOneNumber()\n String oneStringOneNumber2()\n " + + "Number numbers()\n String unknownString(a)\n ?? unknownNumber(a)\n ?? unknownUnknown(a, b)\n Plus()\n}\n", + getDefaultOptions() + + ); + } + + public void test097() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Equality(){" + + " this.equalsEquals = function(){return \"a\" == \"b\";};" + + " this.equalsEqualsEquals = function(){return \"a\" === \"b\";};" + + " this.notEquals = function(){return \"a\" != \"b\";};" + + " this.notEqualsEquals = function(){return \"a\" !== \"b\";};" + + "}", + "X.js", + "class Equality extends Object{\n Boolean equalsEquals()\n Boolean equalsEqualsEquals()\n Boolean notEquals()\n Boolean notEqualsEquals()\n Equality()\n}\n", + getDefaultOptions() + + ); + } + + public void test098() { + // BUG286010 + CompilationUnitDeclaration declaration = this.runInferTest( + "var MyFunc = function () {};\n" + + "MyFunc.myMeth = function () {};", + "X.js", + "class MyFunc extends Function{\n" + + " static void myMeth()\n" + + " MyFunc()\n" + + "}\n", + getDefaultOptions() + + ); + } + + public void test099() { + // BUG278904 + CompilationUnitDeclaration declaration = this.runInferTest( + "function MyType(){}"+ + "MyType.prototype = new Object();\n"+ + "/**\n"+ + " * Property length\n"+ + " * @type Number\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "MyType.prototype.length = \"\";\n", + "X.js", + "class MyType extends Object{\n Number length;\n MyType()\n}\n", + getDefaultOptions() + + ); + } + public void test099a() { + // BUG278904 + CompilationUnitDeclaration declaration = this.runInferTest( + "function MyType(){}"+ + "MyType.prototype = new Object();\n"+ + "/**\n"+ + " * Property length\n"+ + " * @type Number\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "MyType.prototype.length = \"\";\n"+ + "MyType.prototype.name = \"\";\n", + "X.js", + "class MyType extends Object{\n Number length;\n String name;\n MyType()\n}\n", + getDefaultOptions() + + ); + } + public void test099b() { + // BUG278904 + CompilationUnitDeclaration declaration = this.runInferTest( + "function MyType(){}"+ + "MyType.prototype = new Object();\n"+ + "/**\n"+ + " * Property length\n"+ + " * @type Number\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "MyType.prototype.length = \"\";\n"+ + "MyType.prototype.name = \"\";\n"+ + "MyType.prototype.date = new Date();\n", + "X.js", + "class MyType extends Object{\n Number length;\n String name;\n Date date;\n MyType()\n}\n", + getDefaultOptions() + + ); + } + public void test099c() { + // BUG278904 + CompilationUnitDeclaration declaration = this.runInferTest( + "function MyType(){}"+ + "MyType.prototype = new Object();\n"+ + "/**\n"+ + " * Property length\n"+ + " * @type String\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "MyType.prototype.time = 1;\n"+ + "/**\n"+ + " * Property length\n"+ + " * @type Number\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "MyType.prototype.length = \"\";\n"+ + "MyType.prototype.name = \"\";\n"+ + "MyType.prototype.date = new Date();\n", + "X.js", + "class MyType extends Object{\n String time;\n Number length;\n String name;\n Date date;\n MyType()\n}\n", + getDefaultOptions() + + ); + } + public void test100() { + // BUG278904 + CompilationUnitDeclaration declaration = this.runInferTest( + "function MyType(){}"+ + "MyType.prototype = new Object();\n"+ + "/**\n"+ + " * Property length\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "MyType.prototype.length = \"\";\n", + "X.js", + "class MyType extends Object{\n String length;\n MyType()\n}\n", + getDefaultOptions() + + ); + } + public void test101() { + CompilationUnitDeclaration declaration = this.runInferTest( + "MyType = {\n"+ + "/**\n"+ + " * Property length\n"+ + " * @type Number\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "length : \"value\"\n"+ + "};", + "X.js", + "class MyType extends Object{\n Number length;\n}\n", + getDefaultOptions() + + ); + } + public void test102() { + CompilationUnitDeclaration declaration = this.runInferTest( + "MyType = {\n"+ + "/**\n"+ + " * Property length\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "length : \"value\"\n"+ + "};", + "X.js", + "class MyType extends Object{\n String length;\n}\n", + getDefaultOptions() + + ); + } + public void test103() { + CompilationUnitDeclaration declaration = this.runInferTest( + "MyTypeInner = {\n"+ + "/**\n"+ + " * @memberOf MyTypeInner\n"+ + " */\n"+ + "length: 5\n"+ + "};\n"+ + "MyType = {\n"+ + "/**\n"+ + " * Property events\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @type MyTypeInner\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "events : \"\"\n"+ + "};", + "X.js", + "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n MyTypeInner events;\n}\n", + getDefaultOptions() + + ); + } + public void test104() { + // same as 103, except events is an object literal + CompilationUnitDeclaration declaration = this.runInferTest( + "MyTypeInner = {\n"+ + "/**\n"+ + " * @memberOf MyTypeInner\n"+ + " */\n"+ + "length: 5\n"+ + "};\n"+ + "MyType = {\n"+ + "/**\n"+ + " * Property events\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @type MyTypeInner\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "events : {}\n"+ + "};", + "X.js", + "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n MyTypeInner events;\n}\n", + getDefaultOptions() + + ); + } + public void test105() { + CompilationUnitDeclaration declaration = this.runInferTest( + "MyTypeInner = {\n"+ + "/**\n"+ + " * @memberOf MyTypeInner\n"+ + " */\n"+ + "length: 5\n"+ + "};\n"+ + "MyType = {\n"+ + "a : \"\",\n"+ + "/**\n"+ + " * Property events\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @type MyTypeInner\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "events : {},\n"+ + "b : 7\n"+ + "};", + "X.js", + "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n String a;\n MyTypeInner events;\n Number b;\n}\n", + getDefaultOptions() + + ); + } + public void test106() { + CompilationUnitDeclaration declaration = this.runInferTest( + "MyTypeInner = {\n"+ + "/**\n"+ + " * @memberOf MyTypeInner\n"+ + " */\n"+ + "length: 5\n"+ + "};\n"+ + "MyType = {\n"+ + "a : {},\n"+ + "/**\n"+ + " * Property events\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @type MyTypeInner\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "events : {},\n"+ + "b : {}\n"+ + "};", + "X.js", + "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n ___anonymous80_81 a;\n MyTypeInner events;\n ___anonymous220_221 b;\n}\nclass ___anonymous80_81 extends Object{\n}\nclass ___anonymous220_221 extends Object{\n}\n", + getDefaultOptions() + + ); + } + public void test107() { + CompilationUnitDeclaration declaration = this.runInferTest( + "MyTypeInner = {\n"+ + "/**\n"+ + " * @memberOf MyTypeInner\n"+ + " */\n"+ + "length: 5\n"+ + "};\n"+ + "MyType = {\n"+ + "a : {},\n"+ + "/**\n"+ + " * Property events\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @type MyTypeInner\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "events : {},\n"+ + "/**\n"+ + " * Property b\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @type String\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "b : {}\n"+ + "};", + "X.js", + "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n ___anonymous80_81 a;\n MyTypeInner events;\n String b;\n}\nclass ___anonymous80_81 extends Object{\n}\n", + getDefaultOptions() + + ); + } + public void test108() { + CompilationUnitDeclaration declaration = this.runInferTest( + "MyTypeInner = {\n"+ + "/**\n"+ + " * @memberOf MyTypeInner\n"+ + " */\n"+ + "length: 5\n"+ + "};\n"+ + "MyType = {\n"+ + "a : {},\n"+ + "/**\n"+ + " * Property events\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @type MyTypeInner\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "events : {},\n"+ + "b : {}\n"+ + "};", + "X.js", + "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n ___anonymous80_81 a;\n MyTypeInner events;\n ___anonymous220_221 b;\n}\nclass ___anonymous80_81 extends Object{\n}\nclass ___anonymous220_221 extends Object{\n}\n", + getDefaultOptions() + + ); + } + public void test108a() { + CompilationUnitDeclaration declaration = this.runInferTest( + "MyType = {\n"+ + "/**\n"+ + " * Property events\n"+ + " * @memberOf MyType\n"+ + " * @type MyOwnNamespace.String\n"+ + " */\n"+ + "events : {},\n"+ + "b : \"\"\n"+ + "};", + "X.js", + "class MyType extends Object{\n MyOwnNamespace.String events;\n String b;\n}\n", + getDefaultOptions() + + ); + } + public void test108d() { + CompilationUnitDeclaration declaration = this.runInferTest( + "MyTypeInner = {\n"+ + "/**\n"+ + " * @memberOf MyTypeInner\n"+ + " */\n"+ + "length: 5\n"+ + "};\n"+ + "MyType = {\n"+ + "a : {},\n"+ + "/**\n"+ + " * Property events\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @type MyTypeInner\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "events : {},\n"+ + "b : 5\n"+ + "};", + "X.js", + "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n ___anonymous80_81 a;\n MyTypeInner events;\n Number b;\n}\nclass ___anonymous80_81 extends Object{\n}\n", + getDefaultOptions() + + ); + } + public void test108b() { + CompilationUnitDeclaration declaration = this.runInferTest( + "MyTypeInner = {\n"+ + "/**\n"+ + " * @memberOf MyTypeInner\n"+ + " */\n"+ + "length: 5\n"+ + "};\n"+ + "MyType = {\n"+ + "/**\n"+ + " * Property events\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @type MyTypeInner\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "events : {},\n"+ + "b : \"\"\n"+ + "};", + "X.js", + "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n MyTypeInner events;\n String b;\n}\n", + getDefaultOptions() + + ); + } + public void test108c() { + CompilationUnitDeclaration declaration = this.runInferTest( + "MyTypeInner = {\n"+ + "/**\n"+ + " * @memberOf MyTypeInner\n"+ + " */\n"+ + "length: 5\n"+ + "};\n"+ + "MyType = {\n"+ + "/**\n"+ + " * Property a\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "a : 5,\n"+ + "/**\n"+ + " * Property events\n"+ + " * @memberOf MyType\n"+ + " * @see MyType\n"+ + " * @type MyTypeInner\n"+ + " * @since WTP 3.2.2\n"+ + " */\n"+ + "events : {},\n"+ + "b : {}\n"+ + "};", + "X.js", + "class MyTypeInner extends Object{\n Number length;\n}\nclass MyType extends Object{\n Number a;\n MyTypeInner events;\n ___anonymous308_309 b;\n}\nclass ___anonymous308_309 extends Object{\n}\n", + getDefaultOptions() + + ); + } // public void test109() { // CompilationUnitDeclaration declaration = this.runInferTest( // "var foo = function () {\n"+ @@ -1428,63 +1518,1092 @@ // // ); // } - - public void testBug329803_1() { - CompilationUnitDeclaration declaration = this.runInferTest( - "var fun1 = function() {" + - " this.abc = 1" + + + public void testBug329803_1() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var fun1 = function() {" + + " this.abc = 1" + + "}", + "X.js", + "class fun1 extends Object{\n Number abc;\n fun1()\n}\n", + getDefaultOptions() + + ); + } + + public void test201() { + CompilationUnitDeclaration declaration = this.runInferTest( + "foo.bar.Awesome = function(){\n"+ + "this.test = \"\";\n"+ + "this.func = function(){}\n"+ + "}\n", + "X.js", + "class foo.bar.Awesome extends Object{\n" + + " String test;\n" + + " void func()\n" + + " foo.bar.Awesome()\n" + + "}\n", + getDefaultOptions() + ); + } + + public void test201_1() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var foo = {\n" + + " bar : {}\n" + + "}\n" + + "foo.bar.Awesome = function(){\n"+ + "this.test = \"\";\n"+ + "this.func = function(){}\n"+ + "}\n", + "X.js", + "class ___anonymous_foo extends Object{\n" + + " ___anonymous20_21 bar;\n" + + "}\n" + + "class ___anonymous20_21 extends Object{\n" + + " void Awesome()\n" + + "}\n" + + "class foo.bar.Awesome extends Object{\n" + + " String test;\n" + + " void func()\n" + + " foo.bar.Awesome()\n" + + "}\n", + getDefaultOptions() + ); + } + + public void test202() { + CompilationUnitDeclaration declaration = this.runInferTest( + "Test = function(/** String */ arg1){\n"+ + "/**@type String */\n"+ + "this.test = arg1;\n"+ + "}\n", + "X.js", + "class Test extends Object{\n String test;\n Test(arg1)\n}\n", + getDefaultOptions() + ); + } + + public void testBUG317281() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function A$b(){\n"+ + "}\n" + + "A$b.prototype.fun1 = function() {};\n", + "X.js", + "class A$b extends Object{\n void fun1()\n A$b()\n}\n", + getDefaultOptions() + ); + } + + public void testBUG343691() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function $(){\n"+ + "}\n" + + "$.hasData = function(element) {};\n" + + "$.prototype.jquery = \"\";\n", + "X.js", + "class $ extends Object{\n" + + " String jquery;\n" + + " $()\n" + + " static void hasData(element)\n" + + "}\n", + getDefaultOptions() + ); + } + public void testHierarchyLoop1() { + CompilationUnitDeclaration declaration = this.runInferTest( + "Test = function(){\n"+ + "this.test = \"\";\n"+ + "}\n"+ + "Test2 = function() {\n"+ + "this.test2 = \"\""+ + "}\n"+ + "Test.prototype = new Test2();\n"+ + "Test2.prototype = new Test();\n", + "X.js", + "class Test extends Test2{\n" + + " String test;\n" + + " Test()\n" + + "}\n" + + "class Test2 extends Object{\n" + + " String test2;\n" + + " Test2()\n" + + "}\n", + getDefaultOptions() + ); + } + public void testHierarchyLoop2() { + CompilationUnitDeclaration declaration = this.runInferTest( + "Test = function(){\n"+ + "this.test = 5.0;\n"+ + "}\n"+ + "Test.prototype = new Test();\n", + "X.js", + "class Test extends Object{\n Number test;\n Test()\n}\n", + getDefaultOptions() + ); + } + + + public void testPrototypeAssignmentNotTreatedAsPartOfFunctionName() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function testPrototypeNotTreatedAsPartOfName(){};\n"+ + "testPrototypeNotTreatedAsPartOfName.prototype.toString = function(){return \"\";};\n", + "X.js", + "class testPrototypeNotTreatedAsPartOfName extends Object{\n String toString()\n testPrototypeNotTreatedAsPartOfName()\n}\n", + getDefaultOptions() + ); + } + + public void testFunctionNamed_Function_ShouldNotBecomeConstructorForFunctionType() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var test0 = function() {};" + + "var test1 = {" + + " Function : function(test) {}" + "}", "X.js", - "class fun1 extends Object{\n Number abc;\n fun1()\n}\n", + "class ___anonymous_test1 extends Object{\n" + + " void Function(test)\n" + + "}\n", getDefaultOptions() + ); + verifySourceRangeWithContents(declaration, "___anonymous_test1", "test1 = {", "}}"); + } + + public void testAssigningToFieldsOnGlobals_0() { + CompilationUnitDeclaration declaration = this.runInferTest( + "foo.bar = 42;", + "X.js", + "class ___anonymous_foo extends Object{\n" + + " Number bar;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_1() { + CompilationUnitDeclaration declaration = this.runInferTest( + "foo = {}" + + "foo.bar = 42;", + "X.js", + "class ___anonymous_foo extends Object{\n" + + " Number bar;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_2() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var foo = {}" + + "foo.bar = 42;", + "X.js", + "class ___anonymous_foo extends Object{\n" + + " Number bar;\n" + + "}\n", + getDefaultOptions() + ); + verifySourceRangeWithContents(declaration, "___anonymous_foo", "foo = {", "{}"); + } + + public void testAssigningToFieldsOnGlobals_3() { + CompilationUnitDeclaration declaration = this.runInferTest( + "foo.bar.awesome = 42;", + "X.js", + "class ___anonymous0_6 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_4() { + CompilationUnitDeclaration declaration = this.runInferTest( + "foo = {}" + + "foo.bar.awesome = 42;", + "X.js", + "class ___anonymous_foo extends Object{\n" + + " ___anonymous8_14 bar;\n" + + "}\n" + + "class ___anonymous8_14 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_5() { + CompilationUnitDeclaration declaration = this.runInferTest( + "foo = {" + + " bar : {}" + + "}" + + "foo.bar.awesome = 42;", + "X.js", + "class ___anonymous_foo extends Object{\n" + + " ___anonymous15_16 bar;\n" + + "}\n" + + "class ___anonymous15_16 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_6() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var foo = {}" + + "foo.bar.awesome = 42;", + "X.js", + "class ___anonymous_foo extends Object{\n" + + " ___anonymous12_18 bar;\n" + + "}\n" + + "class ___anonymous12_18 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_7() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var foo = {" + + " bar : {}" + + "}" + + "foo.bar.awesome = 42;", + "X.js", + "class ___anonymous_foo extends Object{\n" + + " ___anonymous19_20 bar;\n" + + "}\n" + + "class ___anonymous19_20 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_8() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function() {" + + " foo.bar = 42;" + + "})();", + "X.js", + "class @G extends Object{\n" + + "}\n" + + "class ___anonymous_foo extends Object{\n" + + " Number bar;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_9() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function() {" + + " this.foo.bar = 42;" + + "})();", + "X.js", + "class @G extends Object{\n" + + " ___anonymous_foo foo;\n" + + "}\n" + + "class ___anonymous_foo extends Object{\n" + + " Number bar;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_10() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function() {" + + " foo = {};" + + " foo.bar = 42;" + + "})();", + "X.js", + "class @G extends Object{\n" + + "}\n" + + "class ___anonymous_foo extends Object{\n" + + " Number bar;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_11() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function() {" + + " this.foo = {}" + + " foo.bar = 42;" + + "})();", + "X.js", + "class @G extends Object{\n" + + " ___anonymous_foo foo;\n" + + "}\n" + + "class ___anonymous_foo extends Object{\n" + + " Number bar;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_12() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function() {" + + " this.foo = {}" + + " this.foo.bar = 42;" + + "})();", + "X.js", + "class @G extends Object{\n" + + " ___anonymous_foo foo;\n" + + "}\n" + + "class ___anonymous_foo extends Object{\n" + + " Number bar;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_13() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function() {" + + " foo.bar.awesome = 42;" + + "})();", + "X.js", + "class @G extends Object{\n" + + "}\n" + + "class ___anonymous15_21 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_14() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function() {" + + " this.foo.bar.awesome = 42;" + + "})();", + "X.js", + "class @G extends Object{\n" + + " ___anonymous_foo foo;\n" + + "}\n" + + "class ___anonymous_foo extends Object{\n" + + " ___anonymous15_26 bar;\n" + + "}\n" + + "class ___anonymous15_26 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_15() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function() {" + + " foo = {}" + + " foo.bar.awesome = 42;" + + "})();", + "X.js", + "class @G extends Object{\n" + + "}\n" + + "class ___anonymous_foo extends Object{\n" + + " ___anonymous25_31 bar;\n" + + "}\n" + + "class ___anonymous25_31 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_16() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function() {" + + " this.foo = {}" + + " foo.bar.awesome = 42;" + + "})();", + "X.js", + "class @G extends Object{\n" + + " ___anonymous_foo foo;\n" + + "}\n" + + "class ___anonymous_foo extends Object{\n" + + " ___anonymous30_36 bar;\n" + + "}\n" + + "class ___anonymous30_36 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_17() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function() {" + + " this.foo = {}" + + " this.foo.bar.awesome = 42;" + + "})();", + "X.js", + "class @G extends Object{\n" + + " ___anonymous_foo foo;\n" + + "}\n" + + "class ___anonymous_foo extends Object{\n" + + " ___anonymous30_41 bar;\n" + + "}\n" + + "class ___anonymous30_41 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_18() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function() {" + + " foo = {" + + " bar : {}" + + " }" + + " foo.bar.awesome = 42;" + + "})();", + "X.js", + "class @G extends Object{\n" + + "}\n" + + "class ___anonymous_foo extends Object{\n" + + " ___anonymous32_33 bar;\n" + + "}\n" + + "class ___anonymous32_33 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_19() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function() {" + + " this.foo = {" + + " bar : {}" + + " }" + + " foo.bar.awesome = 42;" + + "})();", + "X.js", + "class @G extends Object{\n" + + " ___anonymous_foo foo;\n" + + "}\n" + + "class ___anonymous_foo extends Object{\n" + + " ___anonymous37_38 bar;\n" + + "}\n" + + "class ___anonymous37_38 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_20() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function() {" + + " this.foo = {" + + " bar : {}" + + " }" + + " this.foo.bar.awesome = 42;" + + "})();", + "X.js", + "class @G extends Object{\n" + + " ___anonymous_foo foo;\n" + + "}\n" + + "class ___anonymous_foo extends Object{\n" + + " ___anonymous37_38 bar;\n" + + "}\n" + + "class ___anonymous37_38 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToFieldsOnGlobals_21() { + CompilationUnitDeclaration declaration = this.runInferTest( + "foo.bar['awesome'] = 42;", + "X.js", + "class ___anonymous0_6 extends Object{\n" + + " Number awesome;\n" + + "}\n", + getDefaultOptions() + ); + } + + public void testAssigningToReferenceToType_0() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Foo() {" + + " this.test0 = \"\";" + + "}" + + "Foo.prototype.test1 = 53;" + + "Foo.test2 = \"test\";" + + "var ReferenceToFoo = Foo;" + + "ReferenceToFoo.addedToReference0 = \"test\";" + + "ReferenceToFoo.prototype.addedToReference1 = \"test\";", + "X.js", - ); - } - - public void test201() { - CompilationUnitDeclaration declaration = this.runInferTest( - "foo.bar.Awesome = function(){\n"+ - "this.test = \"\";\n"+ - "this.func = function(){}\n"+ + "class Foo extends Object{\n" + + " String test0;\n" + + " Number test1;\n" + + " static String test2;\n" + + " static String addedToReference0;\n" + + " String addedToReference1;\n" + + " Foo()\n" + "}\n", + this.getDefaultOptions() + ); + } + + public void testAssigningToReferenceToType_1() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var Foo = function() {" + + " this.test0 = \"\";" + + "}" + + "Foo.prototype.test1 = 53;" + + "Foo.test2 = \"test\";" + + "var ReferenceToFoo = Foo;" + + "ReferenceToFoo.addedToReference0 = \"test\";" + + "ReferenceToFoo.prototype.addedToReference1 = \"test\";", "X.js", - "class foo.bar.Awesome extends Object{\n String test;\n void func()\n foo.bar.Awesome()\n}\n", - getDefaultOptions() - ); - } - - public void test202() { - CompilationUnitDeclaration declaration = this.runInferTest( - "Test = function(arg1){\n"+ - "/**@type String */\n"+ - "this.test = arg1;\n"+ + + "class Foo extends Object{\n" + + " String test0;\n" + + " Number test1;\n" + + " static String test2;\n" + + " static String addedToReference0;\n" + + " String addedToReference1;\n" + + " Foo()\n" + "}\n", + this.getDefaultOptions() + ); + } + + public void testAssigningToReferenceToType_2() { + CompilationUnitDeclaration declaration = this.runInferTest( + "Foo = function() {" + + " this.test0 = \"\";" + + "}" + + "Foo.prototype.test1 = 53;" + + "Foo.test2 = \"test\";" + + "var ReferenceToFoo = Foo;" + + "ReferenceToFoo.addedToReference0 = \"test\";" + + "ReferenceToFoo.prototype.addedToReference1 = \"test\";", "X.js", - "class Test extends Object{\n String test;\n Test(arg1)\n}\n", - getDefaultOptions() - ); - } - - public void testBUG317281() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function A$b(){\n"+ + + "class Foo extends Object{\n" + + " String test0;\n" + + " Number test1;\n" + + " static String test2;\n" + + " static String addedToReference0;\n" + + " String addedToReference1;\n" + + " Foo()\n" + + "}\n", + this.getDefaultOptions() + ); + } + + public void testAssigningToReferenceToType_3() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Foo() {" + + " this.test0 = \"\";" + + "}" + + "Foo.prototype.test1 = 53;" + + "Foo.test2 = \"test\";" + + "ReferenceToFoo = Foo;" + + "ReferenceToFoo.addedToReference0 = \"test\";" + + "ReferenceToFoo.prototype.addedToReference1 = \"test\";", + "X.js", + + "class Foo extends Object{\n" + + " String test0;\n" + + " Number test1;\n" + + " static String test2;\n" + + " static String addedToReference0;\n" + + " String addedToReference1;\n" + + " Foo()\n" + + "}\n", + this.getDefaultOptions() + ); + } + + public void testAssigningToReferenceToType_4() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var Foo = function() {" + + " this.test0 = \"\";" + + "}" + + "Foo.prototype.test1 = 53;" + + "Foo.test2 = \"test\";" + + "ReferenceToFoo = Foo;" + + "ReferenceToFoo.addedToReference0 = \"test\";" + + "ReferenceToFoo.prototype.addedToReference1 = \"test\";", + "X.js", + + "class Foo extends Object{\n" + + " String test0;\n" + + " Number test1;\n" + + " static String test2;\n" + + " static String addedToReference0;\n" + + " String addedToReference1;\n" + + " Foo()\n" + + "}\n", + this.getDefaultOptions() + ); + } + + public void testAssigningToReferenceToType_5() { + CompilationUnitDeclaration declaration = this.runInferTest( + "Foo = function() {" + + " this.test0 = \"\";" + + "}" + + "Foo.prototype.test1 = 53;" + + "Foo.test2 = \"test\";" + + "ReferenceToFoo = Foo;" + + "ReferenceToFoo.addedToReference0 = \"test\";" + + "ReferenceToFoo.prototype.addedToReference1 = \"test\";", + "X.js", + + "class Foo extends Object{\n" + + " String test0;\n" + + " Number test1;\n" + + " static String test2;\n" + + " static String addedToReference0;\n" + + " String addedToReference1;\n" + + " Foo()\n" + + "}\n", + this.getDefaultOptions() + ); + } + + /** + * <p> + * Nothing should be created in this case because the type of 'foo' is unknown so the type of + * its field 'bar' is also unknown so there is no reason to create or assign a type to 'b'. + * </p> + * + * <p> + * <b>NOTE:</b> At build time 'b' may end up with a type if it can resolve 'foo' and its field + * 'bar' at that time. + * </p> + */ + public void test_FieldOnGlobalAssignedToGlobal() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var b = foo.bar;", + "X.js", + + "", + this.getDefaultOptions() + ); + } + + /** + * <p> + * A global field for 'foo' and a type for it should NOT be created in this case. + * </p> + */ + public void test_FieldOnGlobalAssignedToFieldOnAnotherGlobal() { + CompilationUnitDeclaration declaration = this.runInferTest( + "b.bar = foo.bar;", + "X.js", + + "class ___anonymous_b extends Object{\n" + + " ?? bar;\n" + + "}\n", + this.getDefaultOptions() + ); + } + + public void test_TwoDifferentAssignmentsToSameGlobal() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var global0 = \"Test\";" + + "global0 = {" + + " feild0 : 0" + + "};", + "X.js", + + "class ___anonymous31_43 extends Object{\n" + + " Number feild0;\n" + "}\n" + - "A$b.prototype.fun1 = function() {};\n", + "class ___anonymous_global0 extends Object{\n" + + " Number feild0;\n" + + "}\n", + this.getDefaultOptions() + ); + } + + public void test_AssignFieldToGlobalVariable() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var foo = new Object()" + + "foo.bar = {};", "X.js", - "class A$b extends Object{\n void fun1()\n A$b()\n}\n", - getDefaultOptions() - ); - } - - public void testBUG343691() { - CompilationUnitDeclaration declaration = this.runInferTest( - "function $(){\n"+ + + "class ___anonymous_foo extends Object{\n" + + " ___anonymous_bar bar;\n" + "}\n" + - "$.hasData = function(element) {};\n" + - "$.prototype.jquery = \"\";\n", + "class ___anonymous_bar extends Object{\n" + + "}\n", + this.getDefaultOptions() + ); + } + + public void test_AssignFieldToFieldOnGlobalVariable() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var foo = new Object()" + + "foo.bar.awesome = 42;", "X.js", - "class $ extends Object{\n String jquery;\n $()\n static void hasData(element)\n}\n", - getDefaultOptions() - ); - } + + "class ___anonymous_foo extends Object{\n" + + " ___anonymous22_28 bar;\n" + + "}\n" + + "class ___anonymous22_28 extends Object{\n" + + " Number awesome;\n" + + "}\n", + this.getDefaultOptions() + ); + } + + public void test_TwoConstructorFunctions() { + CompilationUnitDeclaration declaration = this.runInferTest( + "function Mixer1() {" + + " this.mixAtt1 = 3;" + + " this.mixMeth1 = function() {" + + " };" + + "}" + + "function Mixer2() {" + + " this.mixAtt2 = true;" + + " this.mixMeth2 = function(a) {" + + " return true;" + + " };" + + "}", + "X.js", + + "class Mixer1 extends Object{\n" + + " Number mixAtt1;\n" + + " void mixMeth1()\n" + + " Mixer1()\n" + + "}\n" + + "class Mixer2 extends Object{\n" + + " Boolean mixAtt2;\n" + + " Boolean mixMeth2(a)\n" + + " Mixer2()\n" + + "}\n", + this.getDefaultOptions() + ); + } + + public void test_LocalTypeShouldNotGetGlobalTypeName() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function(){\n" + + " var ta = {};\n" + + " ta.UnderlineAnnotation = function(foo){\n" + + " this.transform={dx:0,dy:0};\n" + + " };\n" + + " ta.UnderlineAnnotation.prototype = new ta.Annotation;\n" + + " var p = ta.UnderlineAnnotation.prototype;\n" + + " p.constructor=ta.UnderlineAnnotation;\n" + + "})();", + "X.js", + + "class @G extends Object{\n" + + "}\n" + + "class ___anonymous23_24 extends Object{\n" + + " ___anonymous85_95 transform;\n" + + " void UnderlineAnnotation(foo)\n" + + "}\n" + + "class ta.UnderlineAnnotation extends ta.Annotation{\n" + + " ___anonymous85_95 transform;\n" + + " ta.UnderlineAnnotation(foo)\n" + + "}\n" + + "class ___anonymous85_95 extends Object{\n" + + " Number dx;\n" + + " Number dy;\n" + + "}\n" + + "class ___anonymous201_201 extends Object{\n" + + " void constructor(foo)\n" + + "}\n", + this.getDefaultOptions() + ); + } + + public void testClosureArgumentIsGlobalWithAddedProperty() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function(window, undefined){\n" + + " var t = {};\n" + + " window.jChris = t;\n" + + "})(window);\n" + + "window.ta = 4;\n", + "X.js", + "class ___anonymous_window extends Object{\n"+ + " ___anonymous_jChris jChris;\n"+ + " Number ta;\n"+ + "}\n"+ + "class @G extends Object{\n" + + "}\n"+ + "class ___anonymous_jChris extends Object{\n"+ + "}\n", + this.getDefaultOptions() + ); + } + public void testClosureArgumentNamedWindowButLocalDeclarationPassedIn() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var s = 5;\n"+ + "(function(window, undefined){\n" + + " var t = {};\n" + + " window.jChris = t;\n" + + "})(s);\n", + "X.js", + "class @G extends Object{\n"+ + "}\n"+ + "class ___anonymous50_51 extends Object{\n"+ + "}\n" + + "class ___anonymous55_60 extends Number{\n"+ + " ___anonymous50_51 jChris;\n"+ + "}\n", + this.getDefaultOptions() + ); + } + public void testClosureArgumentIsLocalDeclaration() { + CompilationUnitDeclaration declaration = this.runInferTest( + "var s = 5;\n"+ + "(function(x, undefined){\n" + + " var t = {};\n" + + " x.jChris = t;\n" + + "})(s);\n", + "X.js", + "class @G extends Object{\n"+ + "}\n"+ + "class ___anonymous45_46 extends Object{\n"+ + "}\n" + + "class ___anonymous50_50 extends Number{\n"+ + " ___anonymous45_46 jChris;\n"+ + "}\n", + this.getDefaultOptions() + ); + } + public void testClosureArgumentIsAssignment() { + CompilationUnitDeclaration declaration = this.runInferTest( + "s = 5;\n"+ + "(function(x, undefined){\n" + + " var t = {};\n" + + " x.jChris = t;\n" + + "})(s);\n", + "X.js", + "class @G extends Object{\n"+ + "}\n"+ + "class ___anonymous41_42 extends Object{\n"+ + "}\n" + + "class ___anonymous46_46 extends Number{\n"+ + " ___anonymous41_42 jChris;\n"+ + "}\n", + this.getDefaultOptions() + ); + } + public void testClosureArgumentIsGlobal() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function(window, undefined){\n" + + " var t = {};\n" + + " window.jChris = t;\n" + + "})(window);\n", + "X.js", + "class ___anonymous_window extends Object{\n"+ + " ___anonymous_jChris jChris;\n"+ + "}\n"+ + "class @G extends Object{\n" + + "}\n"+ + "class ___anonymous_jChris extends Object{\n"+ + "}\n", + this.getDefaultOptions() + ); + } + //WI97682 + public void testClosureArgumentIsGlobalType() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function(window, undefined){\n" + + " var jChris = function(){};\n" + + " jChris.fn = jChris.prototype = {hop: 1};\n" + + " window.jChris = jChris;\n" + + "})(window);\n", + "X.js", + "class ___anonymous_window extends Object{\n"+ + " ___anonymous_jChris jChris;\n"+ + " void jChris()\n" + + "}\n"+ + "class @G extends Object{\n" + + "}\n"+ + "class ___anonymous_jChris extends Function{\n"+ + " ___anonymous90_97 fn;\n" + + "}\n" + + "class ___anonymous90_97 extends Object{\n"+ + " Number hop;\n" + + "}\n" + + "class jChris extends Object{\n"+ + " static ___anonymous90_97 fn;\n" + + " jChris()\n" + + "}\n", + this.getDefaultOptions() + ); + } + + public void testWI97616() { + CompilationUnitDeclaration declaration = this.runInferTest( + "/** @memberOf Number */\n" + + "var hiliteSearchTerm = \"hi\";", + "X.js", + "class Number extends Object{\n" + + " String hiliteSearchTerm;\n" + + "}\n", + getDefaultOptions() + + ); + } + + public void testWI97616_2() { + CompilationUnitDeclaration declaration = this.runInferTest( + "/** @memberOf Number */\n" + + "var hiliteSearchTerm = (function() {\n" + + "return \"hi\";})();", + "X.js", + "class Number extends Object{\n" + + " String hiliteSearchTerm;\n" + + "}\n", + getDefaultOptions() + + ); + } + + //WI97682 + public void testClosureReturnsFunction() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function( window) {\n" + + " var jChris = (function() {\n" + + " var jChris = function( selector, context ) {return new jChris.fn.init();};\n" + + " jChris.fn = jChris.prototype = {};\n" + + " jChris.fn.init.prototype = jChris.fn;\n" + + " return jChris;})();" + + " jChris.extend({\n" + + " data: function() {var internalKey = jChris.expando;}\n" + + " });\n" + + " window.jChris = jChris;})( window );", + "X.js", + "class ___anonymous_window extends Object{\n"+ + " ___anonymous_jChris jChris;\n"+ + " jChris.fn.init jChris(selector, context)\n" + + "}\n"+ + "class @G extends Object{\n" + + "}\n"+ + "class ___anonymous105_113 extends Object{\n" + + "}\n"+ + "class jChris.fn.init extends ___anonymous157_158{\n" + + "}\n" + + "class ___anonymous_jChris extends Function{\n" + + " ___anonymous157_158 fn;\n" + + " ___anonymous157_158 prototype;\n" + + "}\n" + + "class ___anonymous157_158 extends Object{\n" + + "}\n" + + "class ___anonymous235_292 extends Object{\n" + + " void data()\n" + + "}\n", + this.getDefaultOptions() + ); + } + + public void testWI98919() { + CompilationUnitDeclaration declaration = this.runInferTest( + "(function( window) {\n" + + " var jChris = (function() {\n" + + " var jChris = function( selector, context ) {return new jChris.fn.init();};\n" + + " jChris.fn = jChris.prototype = {init: function() {}, ready: function(fn) {}};\n" + + " jChris.fn.init.prototype = jChris.fn;\n" + + " return jChris;})();" + + " window.jChris = jChris;})( window );", + "X.js", + "class ___anonymous_window extends Object{\n"+ + " ___anonymous_jChris jChris;\n"+ + " jChris.fn.init jChris(selector, context)\n" + + "}\n"+ + "class @G extends Object{\n" + + "}\n"+ + "class ___anonymous105_113 extends Object{\n" + + "}\n"+ + "class jChris.fn.init extends ___anonymous157_201{\n" + + "}\n" + + "class ___anonymous_jChris extends Function{\n" + + " ___anonymous157_201 fn;\n" + + " ___anonymous157_201 prototype;\n" + + "}\n" + + "class ___anonymous157_201 extends Object{\n" + + " void init()\n" + + " void ready(fn)\n" + + "}\n", + getDefaultOptions() + + ); + } + + public void testWI99473() { + CompilationUnitDeclaration declaration = this.runInferTest( + "foo.prototype.bar = /**\n" + + " */\n" + + "function (e) {\n" + + " this.baz = true;\n" + + " return true;\n" + + "}", + "X.js", + "class foo extends Object{\n"+ + " Boolean baz;\n"+ + " Boolean bar(e)\n"+ + "}\n", + getDefaultOptions() + ); + assertFalse("There shouldn't be a type named 'foo.prototype.bar'", declaration.findInferredType("foo.prototype.bar".toCharArray()) != null); + } + public void testAssignAsThisInClosure() { + // add properties to "this" indirectly in a closure + CompilationUnitDeclaration declaration = this.runInferTest( + "(function(\n"+ + " userConfig,\n"+ + " defaultConfig\n"+ + ")\n" + + "{\n" + + "var noop = function(){\n" + + "},\n"+ + "global=this;\n" + + "var def = function(\n"+ + "mid, //(commonjs.moduleId, optional) list of modules to be loaded before running factory\n"+ + "dependencies, //(array of commonjs.moduleId, optional)\n"+ + "factory //(any)\n"+ + "){};\n"+ + " global.define = def;\n" + + "}){}", + "X.js", + "class @G extends Object{\n Function define;\n}\n", + getDefaultOptions() + ); + assertNull("There should not be a global function def()", declaration.findInferredType("@G".toCharArray()).findMethod("def".toCharArray(), null)); + } + public void testDeclareAsThisInClosure() { + // add properties to "this" indirectly in a closure + CompilationUnitDeclaration declaration = this.runInferTest( + "(function(\n"+ + " userConfig,\n"+ + " defaultConfig\n"+ + ")\n" + + "{\n" + + "var noop = function(){\n" + + "},\n"+ + "global=this;\n" + + "var def = function(\n"+ + "mid, //(commonjs.moduleId, optional) list of modules to be loaded before running factory\n"+ + "dependencies, //(array of commonjs.moduleId, optional)\n"+ + "factory //(any)\n"+ + "){};\n"+ + " global.define = def;\n" + + "}){}", + "X.js", + "class @G extends Object{\n Function define;\n}\n", + getDefaultOptions() + ); + assertNull("There should not be a global function def()", declaration.findInferredType("@G".toCharArray()).findMethod("def".toCharArray(), null)); + } }
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InnerEmulationTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InnerEmulationTest.java deleted file mode 100644 index 8edf0b5..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InnerEmulationTest.java +++ /dev/null
@@ -1,5692 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.regression; - -import java.io.File; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; - -public class InnerEmulationTest extends AbstractRegressionTest { -static { -// TESTS_NAMES = new String[] { "Bug58069" }; -// TESTS_NUMBERS = new int[] { 144 }; -// TESTS_RANGE = new int[] { 144, -1 }; -} -public InnerEmulationTest(String name) { - super(name); -} -public static Test suite() { - return buildAllCompliancesTestSuite(testClass()); -} -/** - * Protected access emulation : should be performed onto implicit field and method accesses - */ -public void test001() { - this.runConformTest( - new String[] { - /* p1.A */ - "p1/A.java", - "package p1; \n"+ - "import p2.*; \n"+ - "public class A { \n"+ - " protected int value = 0; \n"+ - " protected A delegatee; \n"+ - " public A(A del, int val) { \n"+ - " this.delegatee = del; \n"+ - " this.value = val; \n"+ - " } \n"+ - " protected void foo() { \n"+ - " value += 3; \n"+ - " } \n"+ - " public static void main(String[] argv){ \n"+ - " int result = new B( \n"+ - " new B(null, 10), 20) \n"+ - " .value; \n"+ - " int expected = 30; \n"+ - " System.out.println( \n"+ - " result == expected \n"+ - " ? \"SUCCESS\" \n"+ - " : \"FAILED : got \"+result+\" instead of \"+ expected); \n"+ - " } \n"+ - "} \n", - /* p2.B */ - "p2/B.java", - "package p2; \n"+ - "import p1.*; \n"+ - "public class B extends A { \n"+ - " public B(B del, int val){ \n"+ - " super(del, val); \n"+ - " Runnable r = new Runnable () { \n"+ - " public void run() { \n"+ - " foo(); \n"+ - " if (delegatee != null) \n"+ - " value += 7; \n"+ - " } \n"+ - " }; \n"+ - " r.run(); \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} -/** - * 1FN4S4Z: The compiler doesn't detect a illegal constructor invocation which leads to a VerifyError - */ -public void test002() { - this.runNegativeTest( - new String[] { - /* A.java */ - "A.java", - "class B { \n"+ - "} \n"+ - "public class A { \n"+ - " B b; \n"+ - " class C extends B { \n"+ - " public C() { \n"+ - " } \n"+ - " } \n"+ - " public A() { \n"+ - " this(new C()); \n"+ - " } \n"+ - " public A(C c) { \n"+ - " this.b = c; \n"+ - " } \n"+ - " public static void main(String[] args) { \n"+ - " A a = new A(); \n"+ - " System.out.println(a); \n"+ - " } \n"+ - "} \n" - }, - "----------\n" + - "1. ERROR in A.java (at line 10)\n" + - " this(new C()); \n" + - " ^^^^^^^\n" + - "No enclosing instance of type A is available due to some intermediate constructor invocation\n" + - "----------\n" - - ); -} -/** - * 1FZ2G7R: use of non static inner class in constuctor - */ -public void test003() { - this.runNegativeTest( - new String[] { - /* A.java */ - "A.java", - "public class A extends Thread { \n" + - " private class B { \n" + - " } \n" + - " private static Runnable getRunnable() { \n" + - " return null; \n" + - " } \n" + - " public A() { \n" + - " super(getRunnable(), new B().toString()); \n" + - " } \n" + - "} \n" - }, - "----------\n" + - "1. WARNING in A.java (at line 8)\n" + - " super(getRunnable(), new B().toString()); \n" + - " ^^^^^^^\n" + - "Access to enclosing constructor A.B() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + - "----------\n" + - "2. ERROR in A.java (at line 8)\n" + - " super(getRunnable(), new B().toString()); \n" + - " ^^^^^^^\n" + - "No enclosing instance of type A is available due to some intermediate constructor invocation\n" + - "----------\n"); -} -/** - * 1F995V9: Walkback in innerclass emulation when mixing source and binaries - */ -public void test004() { - - - /* first compile A3.java */ - - this.runConformTest( - new String[] { - /* A3.java */ - "A3.java", - "class A3 { \n"+ - " class B {} \n"+ - "} \n" - }, - null, - null); // no specific success output string - - /* then compile with previous input */ - - this.runConformTest( - new String[] { - /* A4.java */ - "A4.java", - "class A4 { \n"+ - " void foo(){ \n"+ - " new A3().new B(){}; \n"+ - " } \n"+ - "} \n" - }, - null, // no specific success output string - null, // use default class-path - false, - null); // do not flush previous output dir content - -} -/** - * 1FK9ALJ: Cannot invoke private super constructor ... - */ -public void test005() { - this.runConformTest( - new String[] { - /* X.java */ - "X.java", - "public class X { \n"+ - " private X(){} \n"+ - " class Y extends X { \n"+ - " } \n"+ - " public static void main(String[] argv){ \n"+ - " new X().new Y(); \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} -/** - * 1FKLXDL: Verification error due to incorrect private access emulation - */ -public void test006() { - this.runConformTest( - new String[] { - /* X.java */ - "X.java", - "public class X { \n"+ - " public static void main(String[] argv){ \n"+ - " new B(); \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - " private static void foo(int i, int j) { \n"+ - " System.out.println(\"private foo\"); \n"+ - " } \n"+ - " static class B { \n"+ - " { \n"+ - " foo(1, 2); \n"+ - " } \n"+ - " } \n"+ - "} \n" - }, - "private foo\n" + - "SUCCESS" - ); -} -/** - * 1PQCT5T: Missing emulation for access to sibling local types - */ -public void test007() { - this.runConformTest( - new String[] { - /* Y.java */ - "Y.java", - "public class Y { \n" + - " public static void main(String[] argv){ \n" + - " if (new Y().bar() == 3) \n" + - " System.out.println(\"SUCCESS\"); \n" + - " else \n" + - " System.out.println(\"FAILED\"); \n" + - " } \n" + - " int bar() { \n" + - " final int i = \"xxx\".length(); \n" + - " class X { \n" + - " class AX { \n" + - " int foo() { \n" + - " return new BX().foo(); \n" + - " } \n" + - " } \n" + - " class BX { \n" + - " int foo() { \n" + - " return new CX().foo(); \n" + - " } \n" + - " } \n" + - " class CX { \n" + - " int foo() { \n" + - " return i; \n" + - " } \n" + - " } \n" + - " } \n" + - " return new X().new AX().foo(); \n" + - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} -/** - * 1PQCT5T: Missing emulation for access to sibling local types - */ -public void test008() { - this.runConformTest( - new String[] { - /* Y2.java */ - "Y2.java", - "public class Y2 { \n" + - " public static void main(String[] argv){ \n" + - " if (new Y2().foo(45) == 45) \n" + - " System.out.println(\"SUCCESS\"); \n" + - " else \n" + - " System.out.println(\"FAILED\"); \n" + - " } \n" + - " int foo(final int i){ \n"+ - " class B { \n"+ - " int foo(){ \n"+ - " return new C().foo(); \n"+ - " } \n"+ - " class C { \n"+ - " int foo(){ return i; } \n"+ - " } \n"+ - " }; \n"+ - " return new B().foo(); \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} -/** - * 1PQCT5T: Missing emulation for access to sibling local types - */ -public void test009() { - this.runConformTest( - new String[] { - /* Y3.java */ - "Y3.java", - "public class Y3 { \n" + - " public static void main(String[] argv){ \n" + - " if (new Y3().bar() == 8) \n" + - " System.out.println(\"SUCCESS\"); \n" + - " else \n" + - " System.out.println(\"FAILED\"); \n" + - " } \n" + - " int bar() { \n" + - " final int i = \"xxx\".length(); \n" + - " final String s = this.toString(); \n" + - " class X { \n" + - " class AX { \n" + - " int foo() { \n" + - " return i + new CX().foo(); \n" + - " } \n" + - " } \n" + - " class BX { \n" + - " int foo() { \n" + - " return new AX().foo(); \n" + - " } \n" + - " } \n" + - " class CX { \n" + - " int foo() { \n" + - " return 5; \n" + - " } \n" + - " } \n" + - " } \n" + - " return new X().new AX().foo(); \n" + - " } \n" + - "} \n" - }, - "SUCCESS" - ); -} -/** - * 1PQCT5T: Missing emulation for access to sibling local types - */ -public void test010() { - this.runConformTest( - new String[] { - /* Y4.java */ - "Y4.java", - "public class Y4 { \n" + - " public static void main(String[] argv){ \n" + - " if (new Y4().bar() == 3) \n" + - " System.out.println(\"SUCCESS\"); \n" + - " else \n" + - " System.out.println(\"FAILED\"); \n" + - " } \n" + - " int bar() { \n" + - " final int i = \"xxx\".length(); \n" + - " final String s = this.toString(); \n" + - " class X { \n" + - " class AX { \n" + - " int bar() { \n" + - " class BX { \n" + - " int foo() { \n" + - " return new AX().foo(); \n" + - " } \n" + - " } \n" + - " return new BX().foo(); \n" + - " } \n" + - " int foo() { \n" + - " return i; \n" + - " } \n" + - " } \n" + - " } \n" + - " return new X().new AX().bar(); \n" + - " } \n" + - "} \n" - }, - "SUCCESS" - ); -} -/** - * 1PQCT5T: Missing emulation for access to sibling local types - */ -public void test011() { - this.runConformTest( - new String[] { - /* Y5.java */ - "Y5.java", - "public class Y5 { \n" + - " public static void main(String[] argv){ \n" + - " if (new Y5().bar(5) == 5) \n" + - " System.out.println(\"SUCCESS\"); \n" + - " else \n" + - " System.out.println(\"FAILED\"); \n" + - " } \n" + - " int bar(final int i) { \n" + - " class X { \n" + - " int bar() { \n" + - " return new Object(){ \n" + - " int foo(){ \n" + - " return i; \n" + - " } \n" + - " }.foo(); \n" + - " } \n" + - " } \n" + - " return new X().bar(); \n" + - " } \n" + - "} \n" - }, - "SUCCESS" - ); -} -/** - * 1F3AH7N: GPF on innerclass emulation for double anonymous type - */ -public void test012() { - this.runConformTest( - new String[] { - /* A.java */ - "A.java", - "public class A { \n" + - " public static void main(String[] argv){ \n" + - " if (new A().foo() == 5) \n" + - " System.out.println(\"SUCCESS\"); \n" + - " else \n" + - " System.out.println(\"FAILED\"); \n" + - " } \n" + - " int foo() { \n" + - " return new A() { \n" + - " int foo() { \n" + - " final int i = \"hello\".length(); \n" + - " return new A() { \n" + - " int foo() { \n" + - " return i; \n" + - " } \n" + - " } \n" + - " .foo(); \n" + - " } \n" + - " } \n" + - " .foo(); \n" + - " } \n" + - "} \n" - }, - "SUCCESS" - ); -} -/** - * 1F26XE2: Bug in inner class emulation - */ -public void test013() { - this.runConformTest( - new String[] { - /* Inner.java */ - "Inner.java", - "public class Inner { \n" + - " public static void main(String[] argv){ \n" + - " new B().new C(\"hello\"); \n" + - " System.out.println(\"SUCCESS\"); \n" + - " } \n" + - " class A { \n"+ - " public A(String s){ this.s=s; } \n"+ - " String s; \n"+ - " } \n"+ - "} \n"+ - "class B { \n"+ - " class C extends Inner.A { \n"+ - " public C(String s){ B.this.inner.super(s); } \n"+ - " } \n"+ - " Inner inner=new Inner(); \n"+ - "} \n" - }, - "SUCCESS" - ); -} -/** - * 1EX5I8Z: Inner class emulation bug - */ -public void test014() { - this.runConformTest( - new String[] { - /* Z1.java */ - "Z1.java", - "public class Z1 { \n" + - " public static void main(String[] argv){ \n" + - " new Z1().new W(); \n" + - " System.out.println(\"SUCCESS\"); \n" + - " } \n" + - " class W extends Y { \n" + - " W() { \n" + - " super(new Object(), foo()); \n" + - " } \n" + - " } \n" + - " String foo() { \n" + - " return \"\"; \n" + - " } \n" + - "} \n" + - "class Y { \n" + - " Y(Object o, String s) { \n" + - " } \n" + - "} \n" - }, - "SUCCESS" - ); -} -/** - * 1EUC39Y: Incorrect Synthetic Emulation - */ -public void test015() { - this.runConformTest( - new String[] { - /* AAA.java */ - "AAA.java", - "public class AAA { \n"+ - " public static void main(String argv[]){ \n"+ - " if (new AAA().foo(5) == 15); \n"+ - " System.out.println(\"SUCCESS\"); \n" + - " } \n"+ - " int foo(final int loc){ \n"+ - " class I { \n"+ - " int i = loc; \n"+ - " { \n"+ - " System.out.println(\"loc=\"+ loc ); \n"+ - " } \n"+ - " int foo(){ \n"+ - " System.out.println(\"I:i=\"+ i ); \n"+ - " return i;} \n"+ - " } \n"+ - " class J extends I { \n"+ - " I obj = new I(){ \n"+ - " int foo() { \n"+ - " System.out.println(\"J\"); \n"+ - " return super.foo() + 10; }}; \n"+ - " } \n"+ - " return new J().obj.foo(); \n"+ - " } \n"+ - " } \n" - }, - "loc=5\n" + - "loc=5\n" + - "J\n" + - "I:i=5\n" + - "SUCCESS" - ); -} -/** - * 1EUC39Y: Incorrect Synthetic Emulation - */ -public void test016() { - this.runConformTest( - new String[] { - /* AAA.java */ - "AAA.java", - "public class AAA { \n"+ - " public static void main(String argv[]){ \n"+ - " if (new AAA().foo(5) == 15); \n"+ - " System.out.println(\"SUCCESS\"); \n" + - " } \n"+ - " class B{} \n"+ - " int foo(final int loc){ \n"+ - " class I extends B { \n"+ - " int i = loc; \n"+ - " { \n"+ - " System.out.println(\"loc=\"+ loc ); \n"+ - " } \n"+ - " int foo(){ \n"+ - " System.out.println(\"I:i=\"+ i ); \n"+ - " return i;} \n"+ - " } \n"+ - " class J extends I { \n"+ - " I obj = new I(){ \n"+ - " int foo() { \n"+ - " System.out.println(\"J\"); \n"+ - " return super.foo() + 10; }}; \n"+ - " } \n"+ - " return new J().obj.foo(); \n"+ - " } \n"+ - " } \n" - }, - "loc=5\n" + - "loc=5\n" + - "J\n" + - "I:i=5\n" + - "SUCCESS" - ); -} -/** - * Complex multi-threaded test involving inner classes - */ -public void test017() { - this.runConformTest( - new String[] { - /* MultiComplex.java */ - "MultiComplex.java", - "public class MultiComplex {\n" + - " // should just be an interface, once supported...\n" + - " abstract class AbstractTask implements Runnable {\n" + - " public void run() {\n" + - " MultiComplex.this.notifyCompletion(this,0); \n" + - " }\n" + - " abstract public String taskName(); \n" + - " }\n" + - " public static void main(String argv[]){\n" + - " try {\n" + - " new MultiComplex().performTasks(3);\n" + - " }\n" + - " catch(InterruptedException e){};\n" + - " } \n" + - " void notifyCompleted(AbstractTask task) {\n" + - " }\n" + - " void notifyCompletion(AbstractTask task, int percentage) {\n" + - " }\n" + - " void notifyExecutionEnd() {\n" + - " System.out.println(\"EXECUTION FINISHED\");\n" + - " }\n" + - " void notifyExecutionStart() {\n" + - " System.out.println(\"EXECUTION STARTING\");\n" + - " }\n" + - " void performTasks(final int maxTasks) throws InterruptedException {\n" + - " Thread workers[] = new Thread[maxTasks];\n" + - " AbstractTask tasks[] = new AbstractTask[maxTasks];\n" + - " final int maxIteration = 5;\n" + - " \n" + - " // Local Task \n" + - " class Task extends AbstractTask { \n" + - " String taskName; \n" + - " Task(String aName) {\n" + - " taskName = aName;\n" + - " }\n" + - " public String taskName() { \n" + - " return taskName; \n" + - " }\n" + - " \n" + - " public void run() {\n" + - " super.run();\n" + - " for(int j = 0; j < maxIteration; j++)\n" + - " MultiComplex.this.notifyCompletion(this, (int)((float) (j + 1) / maxIteration * 100));\n" + - " }\n" + - " };\n" + - " notifyExecutionStart();\n" + - " \n" + - " // Creating and launching the tasks\n" + - " for (int ii = 0; ii < maxTasks; ii++) {\n" + - " final int i = ii;\n" + - " tasks[i] = new Task(String.valueOf(i + 1)) { \n" + - " public String taskName() { \n" + - " return super.taskName() + \" of \" + maxTasks; }\n" + - " public void run() {\n" + - " super.run();\n" + - " MultiComplex.this.notifyCompleted(this);\n" + - " } \n" + - " };\n" + - " workers[i] = new Thread(tasks[i],tasks[i].taskName());\n" + - " workers[i].start();\n" + - " }\n" + - " // Waiting for *all* tasks to be ended\n" + - " for (int i = 0; i < tasks.length; i++)\n" + - " workers[i].join();\n" + - " notifyExecutionEnd();\n" + - " }\n" + - "}\n" - }, - "EXECUTION STARTING\n" + - "EXECUTION FINISHED" - ); -} -/** - * Complex multi-threaded test involving inner classes - */ -public void test018() { - this.runConformTest( - new String[] { - /* MultiAnonymous.java */ - "MultiAnonymous.java", - "public class MultiAnonymous {\n" + - " public static void main(String argv[]){\n" + - " try {\n" + - " new MultiAnonymous().performTasks(3);\n" + - " }\n" + - " catch(InterruptedException e){};\n" + - " }\n" + - " void notifyExecutionEnd() {\n" + - " System.out.println(\"EXECUTION FINISHED\");\n" + - " }\n" + - " void notifyExecutionStart() {\n" + - " System.out.println(\"EXECUTION STARTING\");\n" + - " }\n" + - " void performTasks(final int maxTasks) throws java.lang.InterruptedException {\n" + - " Thread workers[] = new Thread[maxTasks];\n" + - " Runnable tasks[] = new Runnable[maxTasks];\n" + - " final int maxIteration = 5;\n" + - " notifyExecutionStart();\n" + - " \n" + - " // Creating and launching the tasks\n" + - " for (int ii = 0; ii < maxTasks; ii++) {\n" + - " final int i = ii;\n" + - " tasks[i] = new Runnable() { \n" + - " public String toString() { return ((i + 1) + \" of \" + maxTasks); }\n" + - " public void run() {\n" + - " for(int j = 0; j < maxIteration; j++)\n" + - " notifyCompletion( (int)((float) (j + 1) / maxIteration * 100));\n" + - " } \n" + - " \n" + - " void notifyCompletion(int percentage) {\n" + - " }\n" + - " };\n" + - " workers[i] = new Thread(tasks[i],\"Running task(\"+(tasks[i].toString())+\")\");\n" + - " workers[i].start();\n" + - " }\n" + - " // Waiting for *all* tasks to be ended\n" + - " for (int i = 0; i < tasks.length; i++)\n" + - " workers[i].join();\n" + - " notifyExecutionEnd();\n" + - " }\n" + - "}\n" - }, - "EXECUTION STARTING\n" + - "EXECUTION FINISHED" - ); -} -/** - * Complex multi-threaded test involving inner classes - */ -public void test019() { - this.runConformTest( - new String[] { - /* MultiComplex2.java */ - "MultiComplex2.java", - "public class MultiComplex2 {\n" + - " public interface AbstractTask extends Runnable {\n" + - " public void run();\n" + - " public String taskName(); \n" + - " }\n" + - " \n" + - " public static void main(String argv[]){\n" + - " try {\n" + - " new MultiComplex2().performTasks(3);\n" + - " }\n" + - " catch(InterruptedException e){};\n" + - " }\n" + - " void notifyCompleted(AbstractTask task) {\n" + - " }\n" + - " void notifyCompletion(AbstractTask task, int percentage) {\n" + - " }\n" + - " void notifyExecutionEnd() {\n" + - " System.out.println(\"EXECUTION FINISHED\");\n" + - " }\n" + - " void notifyExecutionStart() {\n" + - " System.out.println(\"EXECUTION STARTING\");\n" + - " }\n" + - " void performTasks(final int maxTasks) throws java.lang.InterruptedException {\n" + - " Thread workers[] = new Thread[maxTasks];\n" + - " AbstractTask tasks[] = new AbstractTask[maxTasks];\n" + - " final int maxIteration = 5;\n" + - " // Local Task\n" + - " class Task implements AbstractTask {\n" + - " String taskName;\n" + - " Task(String aName) {\n" + - " taskName = aName;\n" + - " }\n" + - " public String taskName() { \n" + - " return taskName; \n" + - " }\n" + - " \n" + - " public void run() {\n" + - " MultiComplex2.this.notifyCompletion(this,0); \n" + - " for(int j = 0; j < maxIteration; j++)\n" + - " MultiComplex2.this.notifyCompletion(this, (int)((float) (j + 1) / maxIteration * 100));\n" + - " }\n" + - " };\n" + - " notifyExecutionStart();\n" + - " \n" + - " // Creating and launching the tasks\n" + - " for (int ii = 0; ii < maxTasks; ii++) {\n" + - " final int i = ii;\n" + - " tasks[i] = new Task(String.valueOf(i + 1)) { \n" + - " public String taskName() { \n" + - " return super.taskName() + \" of \" + maxTasks; }\n" + - " public void run() {\n" + - " super.run();\n" + - " MultiComplex2.this.notifyCompleted(this);\n" + - " } \n" + - " };\n" + - " workers[i] = new Thread(tasks[i],tasks[i].taskName());\n" + - " workers[i].start();\n" + - " }\n" + - " // Waiting for *all* tasks to be ended\n" + - " for (int i = 0; i < tasks.length; i++)\n" + - " workers[i].join();\n" + - " notifyExecutionEnd();\n" + - " }\n" + - "}\n" - }, - "EXECUTION STARTING\n" + - "EXECUTION FINISHED" - ); -} -/** - * Complex multi-threaded test involving inner classes - */ -public void test020() { - this.runConformTest( - new String[] { - /* MultiLocal.java */ - "MultiLocal.java", - "public class MultiLocal {\n" + - " public static void main(String argv[]){\n" + - " class Task implements Runnable {\n" + - " private String taskName;\n" + - " private int maxIteration; \n" + - " public Task(String name, int value) {\n" + - " taskName = name; \n" + - " maxIteration = value;\n" + - " }\n" + - " \n" + - " public String toString() { return taskName; }\n" + - " public void run() {\n" + - " for(int i = 0; i < maxIteration; i++)\n" + - " notifyCompletion( (int)((float) (i + 1) / maxIteration * 100));\n" + - " } \n" + - " \n" + - " void notifyCompletion(int percentage) {\n" + - " }\n" + - " };\n" + - " MultiLocal multi = new MultiLocal();\n" + - " int maxTasks = 3;\n" + - " Task tasks[] = new Task[maxTasks];\n" + - " for (int i = 0; i < maxTasks; i++) \n" + - " tasks[i] = new Task(String.valueOf(i),5);\n" + - " try {\n" + - " multi.performTasks(tasks);\n" + - " }\n" + - " catch(InterruptedException e){};\n" + - " }\n" + - " void notifyExecutionEnd() {\n" + - " System.out.println(\"EXECUTION FINISHED\");\n" + - " }\n" + - " void notifyExecutionStart() {\n" + - " System.out.println(\"EXECUTION STARTING\");\n" + - " }\n" + - " void performTasks(Runnable tasks[]) throws java.lang.InterruptedException {\n" + - " Thread workers[] = new Thread[tasks.length];\n" + - " notifyExecutionStart();\n" + - " \n" + - " // Launching the tasks\n" + - " for (int i = 0; i < tasks.length; i++) {\n" + - " workers[i] = new Thread(tasks[i],\"Running task(\"+(tasks[i].toString())+\")\");\n" + - " workers[i].start();\n" + - " }\n" + - " // Waiting for *all* tasks to be ended\n" + - " for (int i = 0; i < tasks.length; i++)\n" + - " workers[i].join();\n" + - " notifyExecutionEnd();\n" + - " }\n" + - "}\n" - }, - "EXECUTION STARTING\n" + - "EXECUTION FINISHED" - ); -} -/** - * Complex multi-threaded test involving inner classes - */ -public void test021() { - this.runConformTest( - new String[] { - /* MultiLocal2.java */ - "MultiLocal2.java", - "public class MultiLocal2 {\n" + - " public static void main(String argv[]){\n" + - " final int maxTasks = 3;\n" + - " class Task implements Runnable {\n" + - " private String taskName;\n" + - " private int maxIteration;\n" + - " public Task(String name, int value) {\n" + - " taskName = name; \n" + - " maxIteration = value;\n" + - " }\n" + - " \n" + - " public String toString() { return taskName + \" of \" + String.valueOf(maxTasks); }\n" + - " public void run() {\n" + - " for(int i = 0; i < maxIteration; i++)\n" + - " notifyCompletion( (int)((float) (i + 1) / maxIteration * 100));\n" + - " } \n" + - " \n" + - " void notifyCompletion(int percentage) {\n" + - " }\n" + - " };\n" + - " MultiLocal2 multi = new MultiLocal2();\n" + - " Task tasks[] = new Task[maxTasks];\n" + - " for (int i = 0; i < maxTasks; i++) \n" + - " tasks[i] = new Task(String.valueOf(i+1),5);\n" + - " try {\n" + - " multi.performTasks(tasks);\n" + - " }\n" + - " catch(InterruptedException e){};\n" + - " }\n" + - " void notifyExecutionEnd() {\n" + - " System.out.println(\"EXECUTION FINISHED\");\n" + - " }\n" + - " void notifyExecutionStart() {\n" + - " System.out.println(\"EXECUTION STARTING\");\n" + - " }\n" + - " void performTasks(Runnable tasks[]) throws java.lang.InterruptedException {\n" + - " Thread workers[] = new Thread[tasks.length];\n" + - " notifyExecutionStart();\n" + - " \n" + - " // Launching the tasks\n" + - " for (int i = 0; i < tasks.length; i++) {\n" + - " workers[i] = new Thread(tasks[i],\"Running task(\"+(tasks[i].toString())+\")\");\n" + - " workers[i].start();\n" + - " }\n" + - " // Waiting for *all* tasks to be ended\n" + - " for (int i = 0; i < tasks.length; i++)\n" + - " workers[i].join();\n" + - " notifyExecutionEnd();\n" + - " }\n" + - "}\n" - }, - "EXECUTION STARTING\n" + - "EXECUTION FINISHED" - ); -} -/** - * Complex multi-threaded test involving inner classes - */ -public void test022() { - this.runConformTest( - new String[] { - /* MultiMember.java */ - "MultiMember.java", - "public class MultiMember {\n" + - " class Task implements Runnable {\n" + - " private String taskName; \n" + - " private int maxIteration;\n" + - " public Task(String name, int value) {\n" + - " taskName = name; \n" + - " maxIteration = value;\n" + - " }\n" + - " public String toString() { return taskName; }\n" + - " public void run() {\n" + - " for(int i = 0; i < maxIteration; i++)\n" + - " notifyCompletion( (int)((float) (i + 1) / maxIteration * 100));\n" + - " } \n" + - " \n" + - " void notifyCompletion(int percentage) {\n" + - " }\n" + - " }\n" + - " public static void main(String argv[]){\n" + - " MultiMember multi = new MultiMember();\n" + - " int maxTasks = 3;\n" + - " Task tasks[] = new Task[maxTasks];\n" + - " for (int i = 0; i < maxTasks; i++) \n" + - " tasks[i] = multi.new Task(String.valueOf(i),5);\n" + - " try {\n" + - " multi.performTasks(tasks);\n" + - " }\n" + - " catch(InterruptedException e){};\n" + - " }\n" + - " void notifyExecutionEnd() {\n" + - " System.out.println(\"EXECUTION FINISHED\");\n" + - " }\n" + - " void notifyExecutionStart() {\n" + - " System.out.println(\"EXECUTION STARTING\");\n" + - " }\n" + - " void performTasks(Task tasks[]) throws java.lang.InterruptedException {\n" + - " Thread workers[] = new Thread[tasks.length];\n" + - " notifyExecutionStart();\n" + - " \n" + - " // Launching the tasks\n" + - " for (int i = 0; i < tasks.length; i++) {\n" + - " workers[i] = new Thread(tasks[i],\"Running task(\"+(tasks[i].toString())+\")\");\n" + - " workers[i].start();\n" + - " }\n" + - " // Waiting for *all* tasks to be ended\n" + - " for (int i = 0; i < tasks.length; i++)\n" + - " workers[i].join();\n" + - " notifyExecutionEnd();\n" + - " }\n" + - "}\n" - }, - "EXECUTION STARTING\n" + - "EXECUTION FINISHED" - ); -} -/** - * No need for protected access emulation - */ -public void test023() { - this.runNegativeTest( - new String[] { - /* X.java */ - "p/X.java", - "public class X extends q.Y { \n" + - " void bar(){ Object o = someObject; } \n"+ - " public static void main(String[] argv){ \n" + - " new X().bar();\n"+ - " System.out.println(\"SUCCESS\");\n"+ - " }\n"+ - "}\n", - /* Y.java */ - "q/Y.java", - "package q; \n" + - "public class Y { \n" + - " protected Object someObject; \n" + - "}\n" - }, - "" // no problem log: not even a synthetic access emulation one - ); -} -/** - * No need for protected access emulation - */ -public void test024() { - this.runNegativeTest( - new String[] { - /* X.java */ - "p/X.java", - "package p; \n" + - "public class X extends q.Y { \n" + - " void bar(){ foo(); } \n"+ - " public static void main(String[] argv){ \n" + - " new X().bar();\n"+ - " System.out.println(\"SUCCESS\");\n"+ - " }\n"+ - "}\n", - /* Y.java */ - "q/Y.java", - "package q; \n" + - "public class Y { \n" + - " protected Object foo(){ return null;} \n" + - "}\n" - }, - "" // no problem log: not even a synthetic access emulation one - ); -} - -public void test025() { - this.runConformTest( - new String[] { - /* PortReport.java */ - "PortReport.java", - "import java.util.*; \n"+ - "public class PortReport { \n"+ - " public static void main(String[] args) { \n"+ - " Portfolio port = new Portfolio(\"foobar\"); \n"+ - " System.out.println(\"SUCCESS\"); \n" + - " } \n"+ - "} \n", - /* Portfolio.java */ - "Portfolio.java", - "import java.util.*; \n"+ - "public class Portfolio { \n"+ - " String name; \n"+ - " public Portfolio(String buf) { \n"+ - " TokenBuffer tbuf = new TokenBuffer(); \n"+ - " switch (1) { \n"+ - " case TokenBuffer.T_NAME : \n"+ - " name = \"figi\"; \n"+ - " } \n"+ - " } \n"+ - " String getName() { \n"+ - " return name; \n"+ - " } \n"+ - " class TokenBuffer { \n"+ - " static final int T_NAME = 3; \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} -/** - * Compatability - Compiler does not comply with 1.1 standard. - */ -public void test026() { - this.runConformTest( - new String[] { - /* Test.java */ - "p2/Test.java", - "package p2; \n"+ - "public class Test { \n"+ - " public static void main (String args[]){ \n"+ - " new c2(); \n"+ - " } \n"+ - "} \n", - /* c1.java */ - "p1/c1.java", - "package p1; \n"+ - "public class c1 { \n"+ - " protected class c1a{ \n"+ - " public c1a(){} \n"+ - " public void foo(){ System.out.println(\"Foo called\"); \n"+ - " } \n"+ - " }; \n"+ - "} \n", - /* c2.java */ - "p2/c2.java", - "package p2; \n"+ - "import p1.*; \n"+ - "public class c2 extends c1 { \n"+ - " public c1a myC1a; \n"+ - " { \n"+ - " myC1a = new c1a(); \n"+ - " myC1a.foo(); \n"+ - " } \n"+ - "} \n" - }, - "Foo called" - ); -} -/** - * Compatability - Compiler does not comply with 1.1 standard. - */ -public void test027() { - this.runNegativeTest( - new String[] { - /* Test.java */ - "p2/Test.java", - "package p2; \n"+ - "public class Test { \n"+ - " public static void main (String args[]){ \n"+ - " new c2(); \n"+ - " } \n"+ - "} \n", - /* c1.java */ - "p1/c1.java", - "package p1; \n"+ - "public class c1 { \n"+ - " public class c1m { \n"+ - " protected class c1a{ \n"+ - " public c1a(){} \n"+ - " public void foo(){ System.out.println(\"Foo called\"); \n"+ - " } \n"+ - " }; \n"+ - " }; \n"+ - "} \n", - /* c2.java */ - "p2/c2.java", - "package p2; \n"+ - "import p1.*; \n"+ - "public class c2 extends c1 { \n"+ - " public c1m.c1a myC1a; \n"+ - " { \n"+ - " myC1a = new c1m().new c1a(); \n"+ - " myC1a.foo(); \n"+ - " } \n"+ - "} \n" - }, - "----------\n" + - "1. ERROR in p2\\c2.java (at line 4)\n" + - " public c1m.c1a myC1a; \n" + - " ^^^^^^^\n" + - "The type c1m.c1a is not visible\n" + - "----------\n" + - "2. ERROR in p2\\c2.java (at line 6)\n" + - " myC1a = new c1m().new c1a(); \n" + - " ^^^^^\n" + - "myC1a cannot be resolved\n" + - "----------\n" + - "3. ERROR in p2\\c2.java (at line 6)\n" + - " myC1a = new c1m().new c1a(); \n" + - " ^^^\n" + - "The type c1.c1m.c1a is not visible\n" + - "----------\n" + - "4. ERROR in p2\\c2.java (at line 7)\n" + - " myC1a.foo(); \n" + - " ^^^^^\n" + - "myC1a cannot be resolved\n" + - "----------\n" - ); -} -/** - * Compatability - Compiler does not comply with 1.1 standard. - */ -public void test028() { - this.runNegativeTest( - new String[] { - /* Test.java */ - "p2/Test.java", - "package p2; \n"+ - "public class Test { \n"+ - " public static void main (String args[]){ \n"+ - " new c2(); \n"+ - " } \n"+ - "} \n", - /* c1.java */ - "p1/c1.java", - "package p1; \n"+ - "public class c1 { \n"+ - " protected class c1m { \n"+ - " protected class c1a{ \n"+ - " public c1a(){} \n"+ - " public void foo(){ System.out.println(\"Foo called\"); \n"+ - " } \n"+ - " }; \n"+ - " }; \n"+ - "} \n", - /* c2.java */ - "p2/c2.java", - "package p2; \n"+ - "import p1.*; \n"+ - "public class c2 extends c1 { \n"+ - " public c1m.c1a myC1a; \n"+ - " { \n"+ - " myC1a = new c1m().new c1a(); \n"+ - " myC1a.foo(); \n"+ - " } \n"+ - "} \n" - }, - "----------\n" + - "1. ERROR in p2\\c2.java (at line 4)\n" + - " public c1m.c1a myC1a; \n" + - " ^^^^^^^\n" + - "The type c1m.c1a is not visible\n" + - "----------\n" + - "2. ERROR in p2\\c2.java (at line 6)\n" + - " myC1a = new c1m().new c1a(); \n" + - " ^^^^^\n" + - "myC1a cannot be resolved\n" + - "----------\n" + - "3. ERROR in p2\\c2.java (at line 6)\n" + - " myC1a = new c1m().new c1a(); \n" + - " ^^^^^^^^^\n" + - "The constructor c1.c1m() is not visible\n" + - "----------\n" + - "4. ERROR in p2\\c2.java (at line 6)\n" + - " myC1a = new c1m().new c1a(); \n" + - " ^^^\n" + - "The type c1.c1m.c1a is not visible\n" + - "----------\n" + - "5. ERROR in p2\\c2.java (at line 7)\n" + - " myC1a.foo(); \n" + - " ^^^^^\n" + - "myC1a cannot be resolved\n" + - "----------\n" - ); -} -/** - * Compatability - Compiler does not comply with 1.1 standard. - */ -public void test029() { - this.runConformTest( - new String[] { - /* Test.java */ - "p2/Test.java", - "package p2; \n"+ - "public class Test { \n"+ - " public static void main (String args[]){ \n"+ - " new c2(); \n"+ - " } \n"+ - "} \n", - /* c1.java */ - "p1/c1.java", - "package p1; \n"+ - "public class c1 { \n"+ - " protected class c1a{ \n"+ - " public c1a(){} \n"+ - " public void foo(){ System.out.println(\"Foo called\"); \n"+ - " } \n"+ - " }; \n"+ - "} \n", - /* c2.java */ - "p2/c2.java", - "package p2; \n"+ - "import p1.*; \n"+ - "public class c2 extends c1 { \n"+ - " public c1.c1a myC1a;\n"+ - " { \n"+ - " myC1a = new c1a(); \n"+ - " myC1a.foo(); \n"+ - " } \n"+ - "} \n" - }, - "Foo called"); -} -/** - * Compatability - Compiler does not comply with 1.1 standard. - */ -public void test030() { - this.runNegativeTest( - new String[] { - /* Test.java */ - "p2/Test.java", - "package p2; \n"+ - "public class Test { \n"+ - " public static void main (String args[]){ \n"+ - " new c2(); \n"+ - " } \n"+ - "} \n", - /* c1.java */ - "p1/c1.java", - "package p1; \n"+ - "public class c1 { \n"+ - " protected class c1a{ \n"+ - " public c1a(){} \n"+ - " public void foo(){ System.out.println(\"Foo called\"); \n"+ - " } \n"+ - " }; \n"+ - "} \n", - /* c2.java */ - "p2/c2.java", - "package p2; \n"+ - "import p1.*; \n"+ - "public class c2 extends c1.c1a {// qualified acces does not work \n"+ - " public c1a myC1a; \n"+ - " { \n"+ - " myC1a = new c1a(); \n"+ - " myC1a.foo(); \n"+ - " } \n"+ - "} \n" - }, - "----------\n" + - "1. ERROR in p2\\c2.java (at line 3)\n" + - " public class c2 extends c1.c1a {// qualified acces does not work \n" + - " ^^^^^^\n" + - "The type c1.c1a is not visible\n" + - "----------\n" + - "2. ERROR in p2\\c2.java (at line 4)\n" + - " public c1a myC1a; \n" + - " ^^^\n" + - "c1a cannot be resolved to a type\n" + - "----------\n" + - "3. ERROR in p2\\c2.java (at line 6)\n" + - " myC1a = new c1a(); \n" + - " ^^^^^\n" + - "myC1a cannot be resolved\n" + - "----------\n" + - "4. ERROR in p2\\c2.java (at line 6)\n" + - " myC1a = new c1a(); \n" + - " ^^^\n" + - "c1a cannot be resolved to a type\n" + - "----------\n" + - "5. ERROR in p2\\c2.java (at line 7)\n" + - " myC1a.foo(); \n" + - " ^^^^^\n" + - "myC1a cannot be resolved\n" + - "----------\n" - ); -} -/** - * Compatability - Compiler does not comply with 1.1 standard. - */ -public void test031() { - this.runNegativeTest( - new String[] { - /* Test.java */ - "p2/Test.java", - "package p2; \n"+ - "public class Test { \n"+ - " public static void main (String args[]){ \n"+ - " new c2(); \n"+ - " } \n"+ - "} \n", - /* c1.java */ - "p1/c1.java", - "package p1; \n"+ - "public class c1 { \n"+ - " protected class c1a{ \n"+ - " public c1a(){} \n"+ - " public void foo(){ System.out.println(\"Foo called\"); \n"+ - " } \n"+ - " }; \n"+ - "} \n", - /* c2.java */ - "p2/c2.java", - "package p2; \n"+ - "import p1.c1.*; \n"+ - "public class c2 extends c1a { \n"+ - " public c1a myC1a; \n"+ - " { \n"+ - " myC1a = new c1a(); \n"+ - " myC1a.foo(); \n"+ - " } \n"+ - "} \n" - }, - "----------\n" + - "1. ERROR in p2\\c2.java (at line 3)\n" + - " public class c2 extends c1a { \n" + - " ^^^\n" + - "The type c1a is not visible\n" + - "----------\n" + - "2. ERROR in p2\\c2.java (at line 4)\n" + - " public c1a myC1a; \n" + - " ^^^\n" + - "The type c1a is not visible\n" + - "----------\n" + - "3. ERROR in p2\\c2.java (at line 6)\n" + - " myC1a = new c1a(); \n" + - " ^^^^^\n" + - "myC1a cannot be resolved\n" + - "----------\n" + - "4. ERROR in p2\\c2.java (at line 6)\n" + - " myC1a = new c1a(); \n" + - " ^^^\n" + - "The type c1a is not visible\n" + - "----------\n" + - "5. ERROR in p2\\c2.java (at line 7)\n" + - " myC1a.foo(); \n" + - " ^^^^^\n" + - "myC1a cannot be resolved\n" + - "----------\n" - - ); -} -/** - * VerifyError using .class literal inside inner classes - */ -public void test032() { - this.runConformTest( - new String[] { - "p/A.java", - "package p; \n"+ - "public class A {\n" + - " public class B {\n" + - " public B() {\n" + - " }\n" + - " public Class getCls() {\n" + - " return A.class;\n" + - " }\n" + - " }\n" + - " public A() {\n" + - " super();\n" + - " B b = new B();\n" + - " System.out.println(\"Class: \" + b.getCls());\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " A a = new A();\n" + - " }\n" + - "}\n" - }, - "Class: class p.A"); -} -/** - * Missing implementation in the compiler compiling invalid code - */ -public void test033() { - this.runNegativeTest( - new String[] { - /* A2.java */ - "p1/A2.java", - "package p1; \n"+ - "class D { \n"+ - " class E { \n"+ - " E(Object o, Object o1, Object o2, F f) {} \n"+ - " void execute() {} \n"+ - " } \n"+ - "} \n"+ - "class F { \n"+ - " F(Object o) { \n"+ - " } \n"+ - "} \n"+ - "public class A2 { \n"+ - " private abstract class B { \n"+ - " public Object get() { \n"+ - " return null; \n"+ - " } \n"+ - " } \n"+ - " private class C extends B { \n"+ - " public void foo() { \n"+ - " (new D.E(null, null, null, new F(get()) {}) {}).execute(); \n"+ - " } \n"+ - " } \n"+ - "}\n" - }, - "----------\n" + - "1. WARNING in p1\\A2.java (at line 18)\n" + - " private class C extends B { \n" + - " ^\n" + - "The type A2.C is never used locally\n" + - "----------\n" + - "2. WARNING in p1\\A2.java (at line 18)\n" + - " private class C extends B { \n" + - " ^\n" + - "Access to enclosing constructor A2.B() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + - "----------\n" + - "3. ERROR in p1\\A2.java (at line 20)\n" + - " (new D.E(null, null, null, new F(get()) {}) {}).execute(); \n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "No enclosing instance of type D is accessible. Must qualify the allocation with an enclosing instance of type D (e.g. x.new A() where x is an instance of D).\n" + - "----------\n"); -} -/** - * Missing implementation in the compiler compiling invalid code - */ -public void test034() { - this.runConformTest( - new String[] { - /* A2.java */ - "p1/A2.java", - "package p1; \n"+ - "class D { \n"+ - " class E { \n"+ - " E(Object o, Object o1, Object o2, F f) {} \n"+ - " void execute() {} \n"+ - " } \n"+ - "} \n"+ - "class F { \n"+ - " F(Object o) { \n"+ - " } \n"+ - "} \n"+ - "public class A2 { \n"+ - " private abstract class B { \n"+ - " public Object get() { \n"+ - " return null; \n"+ - " } \n"+ - " } \n"+ - " private class C extends B { \n"+ - " public void foo() { \n"+ - " (new D().new E(null, null, null, new F(get()) {}) {}).execute(); \n"+ - " } \n"+ - " } \n"+ - " public static void main(String[] argv){ \n"+ - " new A2().new C().foo(); \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} -/** - * Missing implementation in the compiler compiling invalid code - */ -public void test035() { - this.runNegativeTest( - new String[] { - /* A2.java */ - "p1/A2.java", - "package p1; \n"+ - "class D { \n"+ - " class E { \n"+ - " E(Object o, Object o1, Object o2, F f) {} \n"+ - " void execute() {} \n"+ - " } \n"+ - "} \n"+ - "class F { \n"+ - " F(Object o) { \n"+ - " } \n"+ - "} \n"+ - "public class A2 { \n"+ - " private abstract class B { \n"+ - " public Object get() { \n"+ - " return null; \n"+ - " } \n"+ - " } \n"+ - " private class C extends B { \n"+ - " public void foo() { \n"+ - " (new D.E(null, null, null, new F(get()) {})).execute(); \n"+ - " } \n"+ - " } \n"+ - "}\n" - }, - "----------\n" + - "1. WARNING in p1\\A2.java (at line 18)\n" + - " private class C extends B { \n" + - " ^\n" + - "The type A2.C is never used locally\n" + - "----------\n" + - "2. WARNING in p1\\A2.java (at line 18)\n" + - " private class C extends B { \n" + - " ^\n" + - "Access to enclosing constructor A2.B() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + - "----------\n" + - "3. ERROR in p1\\A2.java (at line 20)\n" + - " (new D.E(null, null, null, new F(get()) {})).execute(); \n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "No enclosing instance of type D is accessible. Must qualify the allocation with an enclosing instance of type D (e.g. x.new A() where x is an instance of D).\n" + - "----------\n"); -} -/** - * ClassCastException during inner class emulation - */ -public void test036() { - this.runConformTest( - new String[] { - /* A.java */ - "p1/A.java", - "package p1; \n"+ - "public class A { \n"+ - " public static void main(String[] argv){ \n"+ - " new A().foo(); \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - " public Object foo() { \n"+ - " B b = new B() { \n"+ - " protected Object bar() { \n"+ - " return new B.C() {}; \n"+ - " } \n"+ - " }; \n"+ - " return b; \n"+ - " } \n"+ - "} \n"+ - "class B { \n"+ - " class C { \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} -/** - * ClassCastException during inner class emulation - */ -public void test037() { - this.runConformTest( - new String[] { - /* A.java */ - "p1/A.java", - "package p1; \n"+ - "public class A { \n"+ - " public static void main(String[] argv){ \n"+ - " new A().foo(); \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - " public Object foo() { \n"+ - " I i = new I() { \n"+ - " protected Object bar() { \n"+ - " return new I.C() {}; \n"+ - " } \n"+ - " }; \n"+ - " return i; \n"+ - " } \n"+ - "} \n"+ - "interface I { \n"+ - " class C { \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} - -/** - * Enclosing instance comparison - */ -public void test038() { - this.runConformTest( - new String[] { - /* X.java */ - "X.java", - "public class X { \n"+ - " public static void main(String argv[]) { \n"+ - " if (new X().foo()) \n"+ - " System.out.println(\"FAILED\"); \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - " boolean bar() { \n"+ - " return false; \n"+ - " } \n"+ - " boolean foo() { \n"+ - " X x = new X() { \n"+ - " boolean test() { \n"+ - " return (X.this == this); \n"+ - " } \n"+ - " }; \n"+ - " return x.bar(); \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=6456 - * Invalid error when compiling access to protected member inside innerclass - */ -public void test039() { - this.runConformTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected void foo() { \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - " public static void main(String argv[]) { \n"+ - " new p2.Y().bar(); \n"+ - " } \n"+ - "} \n", - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " Y.this.foo(); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=6456 - * Invalid error when compiling access to protected member inside innerclass - */ -public void test040() { - this.runConformTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected void foo() { \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - " public static void main(String argv[]) { \n"+ - " new p2.Y().bar(); \n"+ - " } \n"+ - "} \n", - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " new Y().foo(); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=6456 - * Invalid error when compiling access to protected member inside innerclass - */ -public void test041() { - this.runConformTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected void foo() { \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - " public static void main(String argv[]) { \n"+ - " new p2.Y().bar(); \n"+ - " } \n"+ - "} \n", - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " Y.super.foo(); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=6456 - * Invalid error when compiling access to protected member inside innerclass - */ -public void test042() { - this.runConformTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected String foo = \"SUCCESS\"; \n"+ - " public static void main(String argv[]) { \n"+ - " new p2.Y().bar(); \n"+ - " } \n"+ - "} \n", - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " System.out.println(Y.super.foo); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=6456 - * Invalid error when compiling access to protected member inside innerclass - */ -public void test043() { - this.runConformTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected String foo = \"SUCCESS\"; \n"+ - " public static void main(String argv[]) { \n"+ - " new p2.Y().bar(); \n"+ - " } \n"+ - "} \n", - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " System.out.println(Y.this.foo); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=6456 - * Invalid error when compiling access to protected member inside innerclass - */ -public void test044() { - this.runConformTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected String foo = \"SUCCESS\"; \n"+ - " public static void main(String argv[]) { \n"+ - " new p2.Y().bar(); \n"+ - " } \n"+ - "} \n", - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " System.out.println(new Y().foo); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=6456 - * Invalid error when compiling access to protected member inside innerclass - */ -public void test045() { - this.runConformTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected String foo = \"SUCCESS\"; \n"+ - " public static void main(String argv[]) { \n"+ - " new p2.Y().bar(); \n"+ - " } \n"+ - "} \n", - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " System.out.println(foo); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=6456 - * Invalid error when compiling access to protected member inside innerclass - */ -public void test046() { - this.runConformTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected String foo = \"SUCCESS\"; \n"+ - " public static void main(String argv[]) { \n"+ - " new p2.Y().bar(); \n"+ - " } \n"+ - "} \n", - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y extends p1.X { \n"+ - " Y someY; \n"+ - " public void bar() { \n"+ - " someY = this; \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " System.out.println(someY.foo); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=6456 - * Invalid error when compiling access to protected member inside innerclass - */ -public void test047() { - this.runConformTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected String foo = \"FAILED\"; \n"+ - " public static void main(String argv[]) { \n"+ - " new p2.Y().bar(); \n"+ - " } \n"+ - "} \n", - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " System.out.println(Y.super.foo = \"SUCCESS\"); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=6456 - * Invalid error when compiling access to protected member inside innerclass - */ -public void test048() { - this.runConformTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected String foo = \"FAILED\"; \n"+ - " public static void main(String argv[]) { \n"+ - " new p2.Y().bar(); \n"+ - " } \n"+ - "} \n", - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " System.out.println(Y.this.foo = \"SUCCESS\"); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=6456 - * Invalid error when compiling access to protected member inside innerclass - */ -public void test049() { - this.runConformTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected String foo = \"FAILED\"; \n"+ - " public static void main(String argv[]) { \n"+ - " new p2.Y().bar(); \n"+ - " } \n"+ - "} \n", - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " System.out.println(new Y().foo = \"SUCCESS\"); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=6456 - * Invalid error when compiling access to protected member inside innerclass - */ -public void test050() { - this.runConformTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected String foo = \"FAILED\"; \n"+ - " public static void main(String argv[]) { \n"+ - " new p2.Y().bar(); \n"+ - " } \n"+ - "} \n", - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " System.out.println(foo = \"SUCCESS\"); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=6456 - * Invalid error when compiling access to protected member inside innerclass - */ -public void test051() { - this.runConformTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected String foo = \"FAILED\"; \n"+ - " public static void main(String argv[]) { \n"+ - " new p2.Y().bar(); \n"+ - " } \n"+ - "} \n", - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y extends p1.X { \n"+ - " Y someY; \n"+ - " public void bar() { \n"+ - " someY = this; \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " System.out.println(someY.foo = \"SUCCESS\"); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} - - -public void test052() { - this.runConformTest( - new String[] { - /* p2/Y.java */ - "p2/Y.java", - "package p2; \n"+ - "public class Y { \n"+ - " void bar(final int someVal){ \n"+ - " class Local { \n"+ - " void localDo(final int localVal){ \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " System.out.print(someVal + localVal); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - " }; \n"+ - " Local loc = new Local(); \n"+ - " loc.localDo(8); \n"+ - " class SubLocal extends Local { \n"+ - " void localDo(final int localVal){ \n"+ - " super.localDo(localVal + 1); \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n"+ - " SubLocal.super.localDo(localVal + 2); \n"+ - " System.out.print(someVal + localVal + 3); \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - " }; \n"+ - " SubLocal subloc = new SubLocal(); \n"+ - " subloc.localDo(8); \n"+ - " } \n"+ - " public static void main(String[] arguments) { \n"+ - " new Y().bar(4); \n"+ - " System.out.println(); \n"+ - " } \n"+ - "} \n", - }, - "12131415" - ); -} - -public void test053() { - this.runConformTest( - new String[] { - /* p2/Z.java */ - "p2/Z.java", - "package p2; \n"+ - "import p1.X; \n"+ - "public class Z { \n"+ - " class ZMember extends X { \n"+ - " ZMember(Object o){} \n"+ - " Z bar(){ \n"+ - " System.out.println(foo = \"FAILED\"); \n"+ - " return Z.this; \n"+ - " } \n"+ - " } \n"+ - " Z(final Object foo){ \n"+ - " Object obj2 = new Object(){ \n"+ - " Object doSomething(){ \n"+ - " ZMember obj3 = new ZMember(foo){ \n"+ - " Z bar(){ \n"+ - " System.out.println(this.foo); \n"+ - " return Z.this; \n"+ - " } \n"+ - " }; \n"+ - " obj3.bar(); \n"+ - " return this; \n"+ - " } \n"+ - " }.doSomething(); \n"+ - " } \n"+ - " public static void main(String[] arguments) { \n"+ - " new Z(new Object()); \n"+ - " } \n"+ - "} \n", - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected String foo = \"SUCCESS\"; \n"+ - "} \n" - }, - "SUCCESS" - ); -} -public void test055() { - this.runNegativeTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " void foo() { \n"+ - " class L1 { \n"+ - " class LM1 { \n"+ - " } \n"+ - " } \n"+ - " class L2 extends L1.LM1 { \n"+ - " } \n"+ - " new L2(); \n"+ - " } \n"+ - " public static void main(String[] arguments) { \n"+ - " new X().foo(); \n"+ - " } \n"+ - "} \n", - }, - "----------\n" + - "1. ERROR in p1\\X.java (at line 8)\n" + - " class L2 extends L1.LM1 { \n" + - " ^^\n" + - "No enclosing instance of type L1 is accessible to invoke the super constructor. Must define a constructor and explicitly qualify its super constructor invocation with an instance of L1 (e.g. x.super() where x is an instance of L1).\n" + - "----------\n" - - ); -} - -public void test056() { - this.runNegativeTest( - new String[] { - /* p1/X.java */ - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " void foo() { \n"+ - " class L1 { \n"+ - " class LM1 { \n"+ - " } \n"+ - " } \n"+ - " new L1().new LM1(){}; //ok\n"+ - " new L1.LM1(){}; //ko\n"+ - " } \n"+ - " public static void main(String[] arguments) { \n"+ - " new X().foo(); \n"+ - " } \n"+ - "} \n", - }, - "----------\n" + - "1. ERROR in p1\\X.java (at line 9)\n" + - " new L1.LM1(){}; //ko\n" + - " ^^^^^^^^^^^^^^\n" + - "No enclosing instance of type L1 is accessible. Must qualify the allocation with an enclosing instance of type L1 (e.g. x.new A() where x is an instance of L1).\n" + - "----------\n" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=9813 - * VerifyError with Inner Class having private constructor - */ -public void test057() { - this.runConformTest( - new String[] { - /* VE_Test.java */ - "VE_Test.java", - "public class VE_Test { \n"+ - " class VE_Inner { \n"+ - " private VE_Inner() {} \n"+ - " } \n"+ - " private static void test(){ \n"+ - " VE_Test ve_test = new VE_Test(); \n"+ - " VE_Inner pi = ve_test.new VE_Inner(); \n"+ - " } \n"+ - " public static void main(String[] args){ \n"+ - " new VE_Test(); \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=11845 - * NPE during emulation - */ -public void test058() { - this.runConformTest( - new String[] { - "p1/Test.java", - "package p1; \n"+ - "import p2.A; \n"+ - "public class Test { \n"+ - " public static void main(String[] args){ \n"+ - " new Test().a.bar(); \n"+ - " } \n"+ - " private A a = new A() { \n"+ - " public void bar() { \n"+ - " new Object() { \n"+ - " protected void foo() { \n"+ - " init(); \n"+ - " } \n"+ - " }.foo(); \n"+ - " } \n"+ - " }; \n"+ - " private void init() { \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n" + - "} \n", - "p2/A.java", - "package p2; \n"+ - "public class A { \n"+ - " public void bar() { \n"+ - " } \n"+ - " private void init() { \n"+ - " System.out.println(\"FAILED\"); \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=11845 - * variant for single name ref - */ -public void test059() { - this.runConformTest( - new String[] { - "p1/Test.java", - "package p1; \n"+ - "import p2.A; \n"+ - "public class Test { \n"+ - " public static void main(String[] args){ \n"+ - " new Test().a.bar(); \n"+ - " } \n"+ - " private A a = new A() { \n"+ - " public void bar() { \n"+ - " new Object() { \n"+ - " protected void foo() { \n"+ - " System.out.println(init); \n"+ - " } \n"+ - " }.foo(); \n"+ - " } \n"+ - " }; \n"+ - " private String init = \"SUCCESS\"; \n"+ - "} \n", - "p2/A.java", - "package p2; \n"+ - "public class A { \n"+ - " public void bar() { \n"+ - " } \n"+ - " private String init = \"FAILED\"; \n"+ - "} \n" - }, - "SUCCESS" - ); -} -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=11845 - * variant for qualified name ref - */ -public void test060() { - this.runConformTest( - new String[] { - "p1/Test.java", - "package p1; \n"+ - "import p2.A; \n"+ - "public class Test { \n"+ - " public static void main(String[] args){ \n"+ - " new Test().a.bar(); \n"+ - " } \n"+ - " private A a = new A() { \n"+ - " public void bar() { \n"+ - " class L { \n"+ - " Test next = Test.this; \n"+ - " protected void foo() { \n"+ - " System.out.println(next.init); \n"+ - " } \n"+ - " }; \n" + - " new L().foo(); \n"+ - " } \n"+ - " }; \n"+ - " private String init = \"SUCCESS\"; \n"+ - "} \n", - "p2/A.java", - "package p2; \n"+ - "public class A { \n"+ - " public void bar() { \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=11845 - * variant for field name ref - */ -public void test061() { - this.runConformTest( - new String[] { - "p1/Test.java", - "package p1; \n"+ - "import p2.A; \n"+ - "public class Test { \n"+ - " public static void main(String[] args){ \n"+ - " new Test().a.bar(); \n"+ - " } \n"+ - " private A a = new A() { \n"+ - " public void bar() { \n"+ - " class L { \n"+ - " protected void foo() { \n"+ - " System.out.println(Test.this.init); \n"+ - " } \n"+ - " }; \n" + - " new L().foo(); \n"+ - " } \n"+ - " }; \n"+ - " private String init = \"SUCCESS\"; \n"+ - "} \n", - "p2/A.java", - "package p2; \n"+ - "public class A { \n"+ - " public void bar() { \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} - -public void test062() { - this.runConformTest( - new String[] { - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " public static void main(String args[]) { \n"+ - " final String s = args.length == 0 ? \"SUCCESS\" : null; \n"+ - " final class Local { \n"+ - " private Local() { \n"+ - " new LocalMember(); \n"+ - " } \n"+ - " class LocalMember { \n"+ - " { \n"+ - " new LocalMemberMember(); \n"+ - " } \n"+ - " class LocalMemberMember { \n"+ - " { \n"+ - " System.out.println(s); \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - " new Local(); \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} - -public void test062a() { - this.runConformTest( - new String[] { - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " public static void main(String args[]) { \n"+ - " final String s = \"SUCCESS\";\n"+ - " final class Local { \n"+ - " Local() { \n"+ - " new LocalMember(); \n"+ - " } \n"+ - " class LocalMember { \n"+ - " { \n"+ - " new LocalMemberMember(); \n"+ - " } \n"+ - " class LocalMemberMember { \n"+ - " { \n"+ - " System.out.println(s); \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - " new Local(); \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} - -public void test063() { - this.runConformTest( - new String[] { - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " String a = new Object(){ \n"+ - " class LocalMember { \n"+ - " String s = \"SUCCESS\"; \n"+ - " }; \n"+ - " String get_a(){ \n"+ - " return new LocalMember().s; \n"+ - " } \n"+ - " }.get_a(); \n"+ - " public static void main(String argv[]) { \n"+ - " System.out.println(new X().a); \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=21447 - * should invoke Y.foo() at runtime - */ -public void test064(){ - this.runConformTest( - new String[] { - "p2/Y.java", - "package p2; \n"+ - "public class Y extends T { \n"+ - " public static void main(String argv[]) { \n"+ - " new Y().bar(); \n"+ - " } \n"+ - " protected void foo() { \n"+ - " System.out.println(\"Y.foo()\"); \n"+ - " } \n"+ - "} \n", - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected void foo() { \n"+ - " System.out.println(\"X.foo()\"); \n"+ - " } \n"+ - "} \n", - "p2/T.java", - "package p2; \n"+ - "public class T extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n" + - " T.this.foo(); \n"+ - " } \n" + - " }.doSomething(); \n" + - " } \n"+ - "} \n", - }, - "Y.foo()" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=21447 - * variation - if T.foo() is defined - */ -public void test065(){ - this.runConformTest( - new String[] { - "p2/Y.java", - "package p2; \n"+ - "public class Y extends T { \n"+ - " public static void main(String argv[]) { \n"+ - " new Y().bar(); \n"+ - " } \n"+ - " protected void foo() { \n"+ - " System.out.println(\"Y.foo()\"); \n"+ - " } \n"+ - "} \n", - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected void foo() { \n"+ - " System.out.println(\"X.foo()\"); \n"+ - " } \n"+ - "} \n", - "p2/T.java", - "package p2; \n"+ - "public class T extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n" + - " T.this.foo(); \n"+ - " } \n" + - " }.doSomething(); \n" + - " } \n"+ - " protected void foo() { \n"+ - " System.out.println(\"T.foo()\"); \n"+ - " } \n"+ - "} \n", - }, - "Y.foo()" - ); -} -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=21447 - * should invoke Y.foo() and X.foo() at runtime (through 2 separate access methods) - */ -public void test066(){ - this.runConformTest( - new String[] { - "p2/Y.java", - "package p2; \n"+ - "public class Y extends T { \n"+ - " public static void main(String argv[]) { \n"+ - " new Y().bar(); \n"+ - " } \n"+ - " protected void foo() { \n"+ - " System.out.print(\"Y.foo()-\"); \n"+ - " } \n"+ - "} \n", - "p1/X.java", - "package p1; \n"+ - "public class X { \n"+ - " protected void foo() { \n"+ - " System.out.println(\"X.foo()\"); \n"+ - " } \n"+ - "} \n", - "p2/T.java", - "package p2; \n"+ - "public class T extends p1.X { \n"+ - " public void bar() { \n"+ - " new Object(){ \n"+ - " void doSomething(){ \n" + - " T.this.foo(); \n"+ - " T.super.foo(); //need extra access method \n"+ - " } \n" + - " }.doSomething(); \n" + - " } \n"+ - "} \n", - }, - "Y.foo()-X.foo()" - ); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=22093 - * test collision check for synthetic accessors to constructors - */ -public void test067(){ - this.runConformTest( - new String[] { - "p/Test.java", - "package p; \n"+ - "public class Test { \n"+ - " class Member { \n"+ - " private Member(){ \n"+ - " } \n"+ - " private Member(Member other){ \n"+ - " } \n"+ - " } \n"+ - " public static void main(String[] arguments) { \n"+ - " Test t = new Test(); \n"+ - " Member m1 = t.new Member(); \n"+ - " t.new Member(m1); \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS"); -} - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=25229 -public void test068(){ - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " public static void main(String[] arguments) { \n"+ - " new X().new X2().foo(); \n"+ - " } \n"+ - " class X1 { \n"+ - " void baz1() { \n"+ - " System.out.print(\"-X1.baz1()\"); \n"+ - " } \n"+ - " } \n"+ - " class X2 { \n"+ - " void foo(){ \n"+ - " X.this.new X1(){ \n"+ - " void bar(){ \n"+ - " baz(); \n"+ - " baz1(); \n"+ - " baz2(); \n"+ - " } \n"+ - " }.bar(); \n"+ - " } \n"+ - " void baz2() { \n"+ - " System.out.println(\"-X2.baz2()\"); \n"+ - " } \n"+ - " } \n"+ - " void baz() { \n"+ - " System.out.print(\"X.baz()\"); \n"+ - " } \n"+ - "} \n" - }, - "X.baz()-X1.baz1()-X2.baz2()"); -} - -// http://bugs.eclipse.org/bugs/show_bug.cgi?id=26122 -// synthetic outer local variables must be appended after user arguments -public void test069() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " X(String s, int j) {} \n"+ - " public static void main(String[] args) { \n"+ - " final int i; \n"+ - " new X(\"hello\", i = 1) { \n"+ // val$i must be appended after i got assigned - " { \n"+ - " System.out.print(\"SUCCESS:\"+i); \n"+ - " } \n"+ - " }; \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS:1"); -} -// variation on test069 -public void test070() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " X() {} \n"+ - " public static void main(String[] args) { \n"+ - " final int i; \n"+ - " new X().new Y(\"hello\", i = 1) { \n"+ // val$i must be appended after i got assigned - " { \n"+ - " System.out.print(\"SUCCESS:\"+i); \n"+ - " } \n"+ - " }; \n"+ - " } \n"+ - " class Y { \n" + - " Y(String s, int j) {} \n" + - " } \n" + - "} \n" - }, - "SUCCESS:1"); -} - -// test too many synthetic arguments -public void test071() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n"+ - " void foo(int i) { \n"+ - " final long v0 = i, v1 = i, v2 = i, v3 = i, v4 = i, v5 = i, v6 = i; \n"+ - " final long v7 = i, v8 = i, v9 = i, v10 = i, v11 = i, v12 = i, v13 = i; \n"+ - " final long v14 = i, v15 = i, v16 = i, v17 = i, v18 = i, v19 = i, v20 = i; \n"+ - " final long v21 = i, v22 = i, v23 = i, v24 = i, v25 = i, v26 = i, v27 = i; \n"+ - " final long v28 = i, v29 = i, v30 = i, v31 = i, v32 = i, v33 = i, v34 = i; \n"+ - " final long v35 = i, v36 = i, v37 = i, v38 = i, v39 = i, v40 = i, v41 = i; \n"+ - " final long v42 = i, v43 = i, v44 = i, v45 = i, v46 = i, v47 = i, v48 = i; \n"+ - " final long v49 = i, v50 = i, v51 = i, v52 = i, v53 = i, v54 = i, v55 = i; \n"+ - " final long v56 = i, v57 = i, v58 = i, v59 = i, v60 = i, v61 = i, v62 = i; \n"+ - " final long v63 = i, v64 = i, v65 = i, v66 = i, v67 = i, v68 = i, v69 = i; \n"+ - " final long v70 = i, v71 = i, v72 = i, v73 = i, v74 = i, v75 = i, v76 = i; \n"+ - " final long v77 = i, v78 = i, v79 = i, v80 = i, v81 = i, v82 = i, v83 = i; \n"+ - " final long v84 = i, v85 = i, v86 = i, v87 = i, v88 = i, v89 = i, v90 = i; \n"+ - " final long v91 = i, v92 = i, v93 = i, v94 = i, v95 = i, v96 = i, v97 = i; \n"+ - " final long v98 = i, v99 = i, v100 = i, v101 = i, v102 = i, v103 = i, v104 = i; \n"+ - " final long v105 = i, v106 = i, v107 = i, v108 = i, v109 = i, v110 = i, v111 = i; \n"+ - " final long v112 = i, v113 = i, v114 = i, v115 = i, v116 = i, v117 = i, v118 = i; \n"+ - " final long v119 = i, v120 = i, v121 = i, v122 = i, v123 = i, v124 = i, v125 = i; \n"+ - " final long v126 = i; \n"+ - " final int v127 = i; // int is already too many arg \n"+ - " new X() { \n"+ - " { \n"+ - " System.out.println( \n"+ - " v0 + v1 + v2 + v3 + v4 + v5 + v6 \n" + - " + v7 + v8 + v9 + v10 + v11 + v12 + v13 \n" + - " + v14 + v15 + v16 + v17 + v18 + v19 + v20 \n" + - " + v21 + v22 + v23 + v24 + v25 + v26 + v27 \n" + - " + v28 + v29 + v30 + v31 + v32 + v33 + v34 \n" + - " + v35 + v36 + v37 + v38 + v39 + v40 + v41 \n" + - " + v42 + v43 + v44 + v45 + v46 + v47 + v48 \n" + - " + v49 + v50 + v51 + v52 + v53 + v54 + v55 \n" + - " + v56 + v57 + v58 + v59 + v60 + v61 + v62 \n" + - " + v63 + v64 + v65 + v66 + v67 + v68 + v69 \n" + - " + v70 + v71 + v72 + v73 + v74 + v75 + v76 \n" + - " + v77 + v78 + v79 + v80 + v81 + v82 + v83 \n" + - " + v84 + v85 + v86 + v87 + v88 + v89 + v90 \n" + - " + v91 + v92 + v93 + v94 + v95 + v96 + v97 \n" + - " + v98 + v99 + v100 + v101 + v102 + v103 + v104 \n" + - " + v105 + v106 + v107 + v108 + v109 + v110 + v111 \n" + - " + v112 + v113 + v114 + v115 + v116 + v117 + v118 \n" + - " + v119 + v120 + v121 + v122 + v123 + v124 + v125 \n" + - " + v126); \n"+ - " } \n"+ - " }; \n"+ - " } \n" + - "} \n" - }, - "----------\n" + - "1. ERROR in X.java (at line 23)\n" + - " new X() { \n" + - " ^^^\n" + - "Too many synthetic parameters, emulated parameter val$v126 is exceeding the limit of 255 words eligible for method parameters\n" + - "----------\n"); -} - -// test too many synthetic arguments -public void test072() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " void foo(int i) { \n"+ - " final long v0 = i, v1 = i, v2 = i, v3 = i, v4 = i, v5 = i, v6 = i; \n"+ - " final long v7 = i, v8 = i, v9 = i, v10 = i, v11 = i, v12 = i, v13 = i; \n"+ - " final long v14 = i, v15 = i, v16 = i, v17 = i, v18 = i, v19 = i, v20 = i; \n"+ - " final long v21 = i, v22 = i, v23 = i, v24 = i, v25 = i, v26 = i, v27 = i; \n"+ - " final long v28 = i, v29 = i, v30 = i, v31 = i, v32 = i, v33 = i, v34 = i; \n"+ - " final long v35 = i, v36 = i, v37 = i, v38 = i, v39 = i, v40 = i, v41 = i; \n"+ - " final long v42 = i, v43 = i, v44 = i, v45 = i, v46 = i, v47 = i, v48 = i; \n"+ - " final long v49 = i, v50 = i, v51 = i, v52 = i, v53 = i, v54 = i, v55 = i; \n"+ - " final long v56 = i, v57 = i, v58 = i, v59 = i, v60 = i, v61 = i, v62 = i; \n"+ - " final long v63 = i, v64 = i, v65 = i, v66 = i, v67 = i, v68 = i, v69 = i; \n"+ - " final long v70 = i, v71 = i, v72 = i, v73 = i, v74 = i, v75 = i, v76 = i; \n"+ - " final long v77 = i, v78 = i, v79 = i, v80 = i, v81 = i, v82 = i, v83 = i; \n"+ - " final long v84 = i, v85 = i, v86 = i, v87 = i, v88 = i, v89 = i, v90 = i; \n"+ - " final long v91 = i, v92 = i, v93 = i, v94 = i, v95 = i, v96 = i, v97 = i; \n"+ - " final long v98 = i, v99 = i, v100 = i, v101 = i, v102 = i, v103 = i, v104 = i; \n"+ - " final long v105 = i, v106 = i, v107 = i, v108 = i, v109 = i, v110 = i, v111 = i; \n"+ - " final long v112 = i, v113 = i, v114 = i, v115 = i, v116 = i, v117 = i, v118 = i; \n"+ - " final long v119 = i, v120 = i, v121 = i, v122 = i, v123 = i, v124 = i, v125 = i; \n"+ - " new X() { \n"+ - " { \n"+ - " System.out.println( \n"+ - " v0 + v1 + v2 + v3 + v4 + v5 + v6 \n" + - " + v7 + v8 + v9 + v10 + v11 + v12 + v13 \n" + - " + v14 + v15 + v16 + v17 + v18 + v19 + v20 \n" + - " + v21 + v22 + v23 + v24 + v25 + v26 + v27 \n" + - " + v28 + v29 + v30 + v31 + v32 + v33 + v34 \n" + - " + v35 + v36 + v37 + v38 + v39 + v40 + v41 \n" + - " + v42 + v43 + v44 + v45 + v46 + v47 + v48 \n" + - " + v49 + v50 + v51 + v52 + v53 + v54 + v55 \n" + - " + v56 + v57 + v58 + v59 + v60 + v61 + v62 \n" + - " + v63 + v64 + v65 + v66 + v67 + v68 + v69 \n" + - " + v70 + v71 + v72 + v73 + v74 + v75 + v76 \n" + - " + v77 + v78 + v79 + v80 + v81 + v82 + v83 \n" + - " + v84 + v85 + v86 + v87 + v88 + v89 + v90 \n" + - " + v91 + v92 + v93 + v94 + v95 + v96 + v97 \n" + - " + v98 + v99 + v100 + v101 + v102 + v103 + v104 \n" + - " + v105 + v106 + v107 + v108 + v109 + v110 + v111 \n" + - " + v112 + v113 + v114 + v115 + v116 + v117 + v118 \n" + - " + v119 + v120 + v121 + v122 + v123 + v124 + v125); \n" + - " } \n"+ - " }; \n"+ - " } \n" + - " public static void main(String[] args) { \n"+ - " System.out.print(\"SUCCESS\"); \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS"); -} - -/** - * verify error in synthetic access to constructor - * (ordering of parameters after moving outerlocals after user args) - */ -public void test073() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n" + - " public static void main(final String[] args) { \n" + - " class Local { \n" + - " private Local(String str){ \n" + - " Object o = args; \n" + - " System.out.println(str); \n" + - " } \n" + - " }; \n" + - " new Local(\"SUCCESS\"); \n" + - " } \n" + - "} \n" - }, - "SUCCESS"); -} - -/** - * verify error in synthetic access to constructor - test collisions - * (ordering of parameters after moving outerlocals after user args) - */ -public void test074() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n" + - " public static void main(final String[] args) { \n" + - " class Local { \n" + - " public Local(String str, Local loc, String str2){ \n" + // collision - " } \n" + - " public Local(String str, Local loc){ \n" + // collision - " } \n" + - " private Local(String str){ \n" + - " Object o = args; \n" + - " System.out.println(str); \n" + - " } \n" + - " }; \n" + - " new Local(\"SUCCESS\"); \n" + - " } \n" + - "} \n" - }, - "SUCCESS"); -} - -/** - * should not consider synthetic methods on binary types - */ -public void test075() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n" + - " public static void main(final String[] args) { \n" + - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - " private static void foo() { \n" + - " } \n" + - " A a = new A(); \n" + - " class A { \n" + - " private A() {} \n" + - " A(String s) { \n" + - " foo(); \n" + - " } \n" + - " A(int s) { \n" + - " foo(); \n" + - " } \n" + - " } \n" + - " class B extends A { \n" + - " B(){ \n" + - " super(); \n" + - " } \n" + - " } \n" + - "} \n" - }, - "SUCCESS"); - - this.runNegativeTest( - new String[] { - "Y.java", - "public class Y { \n" + - " void foo(){ \n" + - " new X().new A(null); \n" + - " new X().access$0(); \n" + - " } \n"+ - "} \n" - }, - "----------\n" + - "1. ERROR in Y.java (at line 4)\n" + - " new X().access$0(); \n" + - " ^^^^^^^^\n" + - "The method access$0() is undefined for the type X\n" + - "----------\n", - null, // use default class-path - false); // do not flush previous output dir content - -} -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=27413 - * implicit enclosing instances - */ -public void test076() { - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - if (options.sourceLevel <= ClassFileConstants.JDK1_3) { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n"+ - " X(Object o){ \n"+ - " class A { \n"+ - " private A() { \n"+ // implicit enclosing instance in non-static context - " } \n"+ - " } \n"+ - " class B extends X { \n"+ - " B() { \n"+ - " super(new A(){ \n"+ - " }); \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - "} \n" - }, - "----------\n" + - "1. WARNING in X.java (at line 7)\n" + - " class B extends X { \n" + - " ^\n" + - "The type B is never used locally\n" + - "----------\n" + - "2. WARNING in X.java (at line 8)\n" + - " B() { \n" + - " ^^^\n" + - "The constructor B() is never used locally\n" + - "----------\n" + - "3. ERROR in X.java (at line 9)\n" + - " super(new A(){ \n" + - " }); \n" + - " ^^^^^^^^^^^^^^^\n" + - "No enclosing instance of type X is available due to some intermediate constructor invocation\n" + - "----------\n" + - "4. WARNING in X.java (at line 9)\n" + - " super(new A(){ \n" + - " ^^^\n" + - "Access to enclosing constructor A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + - "----------\n"); - return; - } - if (options.sourceLevel <= ClassFileConstants.JDK1_4) { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n"+ - " X(Object o){ \n"+ - " class A { \n"+ - " private A() { \n"+ // implicit enclosing instance in non-static context - " } \n"+ - " } \n"+ - " class B extends X { \n"+ - " B() { \n"+ - " super(new A(){ \n"+ - " }); \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - "} \n" - }, - "----------\n" + - "1. WARNING in X.java (at line 7)\n" + - " class B extends X { \n" + - " ^\n" + - "The type B is never used locally\n" + - "----------\n" + - "2. WARNING in X.java (at line 8)\n" + - " B() { \n" + - " ^^^\n" + - "The constructor B() is never used locally\n" + - "----------\n" + - "3. ERROR in X.java (at line 9)\n" + - " super(new A(){ \n" + - " }); \n" + - " ^^^^^^^^^^^^^^^\n" + - "No enclosing instance of type X is available due to some intermediate constructor invocation\n" + - "----------\n"); - return; - } - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " X(Object o){ \n"+ - " class A { \n"+ - " private A() { \n"+ // implicit enclosing instance in non-static context - " } \n"+ - " } \n"+ - " class B extends X { \n"+ - " B() { \n"+ - " super(new A(){ \n"+ - " }); \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - "} \n" - }, - ""); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=27413 - * implicit enclosing instances - */ -public void test077() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " public static void main(String[] args){ \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n" + - " X(Object o){ \n"+ - " } \n" + - " static void foo() { \n"+ - " class A { \n"+ // no implicit enclosing in STATIC context - " private A() { \n"+ - " } \n"+ - " } \n"+ - " class B extends X { \n"+ - " B() { \n"+ - " super(new A(){ \n"+ - " }); \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS"); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=27413 - * implicit enclosing instances - */ -public void test078() { - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - if (options.sourceLevel <= ClassFileConstants.JDK1_3) { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n"+ - " X(Object o){ \n"+ - " class A { \n"+ - " private A() { \n"+ // implicit enclosing instance in non-static context - " } \n"+ - " } \n"+ - " class B extends X { \n"+ - " B() { \n"+ - " super(new A(){ \n"+ - " void foo() { System.out.println(X.this); } \n"+ - " }); \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - "} \n" - }, - "----------\n" + - "1. WARNING in X.java (at line 7)\n" + - " class B extends X { \n" + - " ^\n" + - "The type B is never used locally\n" + - "----------\n" + - "2. WARNING in X.java (at line 8)\n" + - " B() { \n" + - " ^^^\n" + - "The constructor B() is never used locally\n" + - "----------\n" + - "3. ERROR in X.java (at line 9)\n" + - " super(new A(){ \n" + - " void foo() { System.out.println(X.this); } \n" + - " }); \n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "No enclosing instance of type X is available due to some intermediate constructor invocation\n" + - "----------\n" + - "4. WARNING in X.java (at line 9)\n" + - " super(new A(){ \n" + - " ^^^\n" + - "Access to enclosing constructor A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + - "----------\n" + - "5. WARNING in X.java (at line 10)\n" + - " void foo() { System.out.println(X.this); } \n" + - " ^^^^^\n" + - "The method foo() from the type new A(){} is never used locally\n" + - "----------\n" + - "6. ERROR in X.java (at line 10)\n" + - " void foo() { System.out.println(X.this); } \n" + - " ^^^^^^\n" + - "No enclosing instance of the type X is accessible in scope\n" + - "----------\n"); - return; - } - if (options.sourceLevel <= ClassFileConstants.JDK1_4) { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n"+ - " X(Object o){ \n"+ - " class A { \n"+ - " private A() { \n"+ // implicit enclosing instance in non-static context - " } \n"+ - " } \n"+ - " class B extends X { \n"+ - " B() { \n"+ - " super(new A(){ \n"+ - " void foo() { System.out.println(X.this); } \n"+ - " }); \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - "} \n" - }, - "----------\n" + - "1. WARNING in X.java (at line 7)\n" + - " class B extends X { \n" + - " ^\n" + - "The type B is never used locally\n" + - "----------\n" + - "2. WARNING in X.java (at line 8)\n" + - " B() { \n" + - " ^^^\n" + - "The constructor B() is never used locally\n" + - "----------\n" + - "3. ERROR in X.java (at line 9)\n" + - " super(new A(){ \n" + - " void foo() { System.out.println(X.this); } \n" + - " }); \n" + - " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + - "No enclosing instance of type X is available due to some intermediate constructor invocation\n" + - "----------\n" + - "4. WARNING in X.java (at line 10)\n" + - " void foo() { System.out.println(X.this); } \n" + - " ^^^^^\n" + - "The method foo() from the type new A(){} is never used locally\n" + - "----------\n" + - "5. ERROR in X.java (at line 10)\n" + - " void foo() { System.out.println(X.this); } \n" + - " ^^^^^^\n" + - "No enclosing instance of the type X is accessible in scope\n" + - "----------\n"); - return; - } - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " X(Object o){ \n"+ - " class A { \n"+ - " private A() { \n"+ // implicit enclosing instance in non-static context - " } \n"+ - " } \n"+ - " class B extends X { \n"+ - " B() { \n"+ - " super(new A(){ \n"+ - " void foo() { System.out.println(X.this); } \n"+ - " }); \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - "} \n" - }, - ""); -} - -/* - * Check that X.this is actually bound to an X, and not innermost compatible type (Z) - */ -public void test079() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " public static void main(String[] arguments) { \n"+ - " new X().new Y().new Z().bar(); \n"+ - " } \n"+ - " String foo() { return \"X-foo\"; } \n"+ - " class Y extends X { \n"+ - " String foo() { return \"Y-foo\"; } \n"+ - " class Z extends Y { \n"+ - " Z(){ \n"+ - " X.this.super(); \n"+ - " } \n"+ - " String foo() { return \"Z-foo\"; } \n"+ - " void bar () { \n"+ - " System.out.println(X.this.foo()); \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - "} \n" - }, - "X-foo"); -} - -public void test080() { // verified as conform - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " public static void main(String[] arguments) { \n"+ - " new X().new C(); \n"+ - " } \n"+ - " int m() { \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " return 1; \n"+ - " } \n"+ - " class C extends B { \n"+ - " C(int j){} \n"+ - " C(){ \n"+ - " this(X.this.m()); \n"+ - " } \n"+ - " } \n"+ - "} \n"+ - "class B extends X { \n"+ - "} \n" - }, - "SUCCESS"); -} - -public void test081() { - this.runConformTest( - new String[] { - "p/X.java", - "package p; \n"+ - "public class X { \n"+ - " public static void main(String[] arguments) { \n"+ - " new X().new C(); \n"+ - " } \n"+ - " int m() { \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " return 1; \n"+ - " } \n"+ - " class C extends q.B { \n"+ - " C(int j){} \n"+ - " C(){ \n"+ - " this(m()); \n"+ // only X.this can see m() - " } \n"+ - " } \n"+ - "} \n", - "q/B.java", - "package q; \n"+ - "public class B extends p.X { \n"+ - "} \n" - }, - "SUCCESS"); -} - -/* - * Default constructor for Z, will use enclosing 'this' as default-value for enclosing instance for super(). - */ -public void test083() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " public static void main(String[] arguments) { \n"+ - " new X().new Y().new Z().bar(); \n"+ - " } \n"+ - " String foo() { return \"X-foo\"; } \n"+ - " class Y extends X { \n"+ - " String foo() { return \"Y-foo\"; } \n"+ - " class Z { \n"+ - " Z(){ \n"+ - " //X.this.super(); \n"+ - " } \n"+ - " String foo() { return \"Z-foo\"; } \n"+ - " void bar () { \n"+ - " System.out.println(X.this.foo()); \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - "} \n" - }, - "X-foo"); -} - -public void test084() { - this.runConformTest( - new String[] { - "Foo.java", - "public class Foo { \n"+ - " public static void main(String[] arguments) { \n"+ - " new Foo(null); \n"+ - " } \n"+ - " Foo(int i){} \n"+ - " Foo(Object o){ \n"+ - " class A { \n"+ - " private A() { \n"+ - " } \n"+ - " } \n"+ - " class B extends Foo { \n"+ - " B() { \n"+ - " super(0); \n"+ - " new A(){ \n"+ - " void foo() { \n"+ - " System.out.println(Foo.this.getClass().getName()); \n"+ - " } \n"+ - " }.foo(); \n"+ - " } \n"+ - " } \n"+ - " new B(); \n"+ - " } \n"+ - "} \n", - }, - "Foo"); -} - -public void test085() { - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - if (options.sourceLevel < ClassFileConstants.JDK1_5) { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n"+ - " int m() { \n"+ - " return 1; \n"+ - " } \n"+ - " class C extends B { \n"+ - " C(int j){} \n"+ - " C(){ \n"+ - " this( \n"+ - " new B(){ \n"+ - " X x = X.this; \n"+ - " int m(){ \n"+ - " return 1; \n"+ - " } \n"+ - " }.m()); \n"+ - " } \n"+ - " } \n"+ - "} \n"+ - "class B extends X { \n"+ - "} \n" - }, - "----------\n" + - "1. WARNING in X.java (at line 10)\n" + - " X x = X.this; \n" + - " ^\n" + - "The field new B(){}.x is never read locally\n" + - "----------\n" + - "2. ERROR in X.java (at line 10)\n" + - " X x = X.this; \n" + - " ^^^^^^\n" + - "No enclosing instance of the type X is accessible in scope\n" + - "----------\n"); - return; - } - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " int m() { \n"+ - " return 1; \n"+ - " } \n"+ - " class C extends B { \n"+ - " C(int j){} \n"+ - " C(){ \n"+ - " this( \n"+ - " new B(){ \n"+ - " X x = X.this; \n"+ - " int m(){ \n"+ - " return 1; \n"+ - " } \n"+ - " }.m()); \n"+ - " } \n"+ - " } \n"+ - "} \n"+ - "class B extends X { \n"+ - "} \n" - }, - ""); -} - -public void test086() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " public static void main(String[] arguments) { \n"+ - " new X().new C(); \n"+ - " } \n"+ - " int m() { \n"+ - " return 1; \n"+ - " } \n"+ - " class C extends B { \n"+ - " C(int j){} \n"+ - " C(){ \n"+ - " this( \n"+ - " new B(){ \n"+ - " int m(){ \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " return 1; \n"+ - " } \n"+ - " }.m()); \n"+ - " } \n"+ - " } \n"+ - "} \n"+ - "class B extends X { \n"+ - "} \n" - }, - "SUCCESS"); -} - -public void test087() { - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - if (options.complianceLevel <= ClassFileConstants.JDK1_4) { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " public static void main(String[] arguments) { \n"+ - " new X().f(); \n"+ - " } \n"+ - " void f () { \n"+ - " class C { \n"+ - " C() { \n"+ - " System.out.println(\"[\"+X.this.getClass().getName()+\"]\"); \n"+ - " } \n"+ - " } \n"+ - " class N extends X { \n"+ - " { new C(); } // selects N.this, not O.this \n"+ - " } \n"+ - " new N(); \n"+ - " } \n"+ - "} \n" - }, - "[X$1$N]"); - return; - } - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " public static void main(String[] arguments) { \n"+ - " new X().f(); \n"+ - " } \n"+ - " void f () { \n"+ - " class C { \n"+ - " C() { \n"+ - " System.out.println(\"[\"+X.this.getClass().getName()+\"]\"); \n"+ - " } \n"+ - " } \n"+ - " class N extends X { \n"+ - " { new C(); } // selects N.this, not O.this \n"+ - " } \n"+ - " new N(); \n"+ - " } \n"+ - "} \n" - }, - "[X$1N]"); -} - -public void test088() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n"+ - " class Middle { \n"+ - " class Inner { \n"+ - " } \n"+ - " } \n"+ - " class M extends Middle.Inner { \n"+ - " } \n"+ - "} \n" - }, - "----------\n" + - "1. ERROR in X.java (at line 6)\n" + - " class M extends Middle.Inner { \n" + - " ^\n" + - "No enclosing instance of type X.Middle is accessible to invoke the super constructor. Must define a constructor and explicitly qualify its super constructor invocation with an instance of X.Middle (e.g. x.super() where x is an instance of X.Middle).\n" + - "----------\n"); -} - -public void test089() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " static class Middle { \n"+ - " static class Inner { \n"+ - " } \n"+ - " } \n"+ - " class M extends Middle.Inner { \n"+ - " } \n"+ - " public static void main(String[] arguments) { \n"+ - " new X().new M(); \n" + - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS"); -} - -public void test090() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " void foo() { \n"+ - " class Middle { \n"+ - " class Inner { \n"+ - " } \n"+ - " } \n"+ - " class M extends Middle.Inner { \n"+ - " M() { \n"+ - " new Middle().super(); \n"+ - " } \n"+ - " } \n"+ - " } \n"+ - " public static void main(String[] arguments) { \n"+ - " new X().foo(); \n" + - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - "} \n" - }, - "SUCCESS"); -} - -// ensure that local member empty constructor gets implicit constructor call -public void test091() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " Object o = new Object() { \n"+ - " class Inner { \n"+ - " private Inner() {} \n"+ - " } \n"+ - " }.new Inner(){}; \n"+ - " public static void main(String[] arguments) { \n"+ - " new X(); \n"+ - " System.out.println(\"SUCCESS\"); \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS"); -} - -/** - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=29636 - * ensure first anonymous is X$1(extends X), last is X$2(extends A) - */ -public void test092() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " class A { \n"+ - " } \n"+ - " public static void main(String[] arguments) { \n"+ - " System.out.println(\"[\"+new X(){}.new A(){}.getClass().getName()+\"]\"); \n"+ - " } \n"+ - "} \n", - }, - "[X$2]"); -} - -public void test093() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n"+ - " public static void main(String[] arguments) { \n"+ - " System.out.println(X.this); \n"+ - " } \n"+ - "} \n", - }, - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " System.out.println(X.this); \n" + - " ^^^^^^\n" + - "Cannot use this in a static context \n" + - "----------\n"); -} - -public void test094() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n"+ - " class Y {} \n"+ - " public static void main(String[] arguments) { \n"+ - " int i = 0; \n"+ - " i.new Y(); \n"+ - " } \n"+ - "} \n", - }, - "----------\n" + - "1. ERROR in X.java (at line 5)\n" + - " i.new Y(); \n" + - " ^\n" + - "Cannot use an expression of the type int as a valid enclosing instance\n" + - "----------\n"); -} -//http://bugs.eclipse.org/bugs/show_bug.cgi?id=30280 -public void test095() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n"+ - " class Y {} \n"+ - " public static void main(String[] arguments) { \n"+ - " int i = 0; \n"+ - " i.new Y(){}; \n"+ - " } \n"+ - "} \n", - }, - "----------\n" + - "1. ERROR in X.java (at line 5)\n" + - " i.new Y(){}; \n" + - " ^\n" + - "Cannot use an expression of the type int as a valid enclosing instance\n" + - "----------\n"); -} -public void test096() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n"+ - " static class Y {} \n"+ - " void foo() { \n"+ - " new X().new Y(){}; \n"+ - " } \n"+ - "} \n", - }, - "----------\n" + - "1. ERROR in X.java (at line 4)\n" + - " new X().new Y(){}; \n" + - " ^^^^^^^\n" + - "Illegal enclosing instance specification for type X.Y\n" + - "----------\n"); -} -/** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=35456 - */ -public void test097() { - this.runConformTest( - new String[] { - "apples/Base.java", - "package apples; \n" + - "public class Base { \n"+ - " protected String foo = \"SUCCESS\"; \n" + - " public static void main(String[] args){ \n"+ - " new oranges.Derived().new Inner(new oranges.Derived()).bug(); \n"+ - " } \n"+ - "} \n", - "oranges/Derived.java", - "package oranges; \n"+ - "import apples.*; \n"+ - "public class Derived extends Base { \n"+ - " public class Inner { \n"+ - " Derived c = null; \n"+ - " public Inner(Derived c) { \n"+ - " this.c = c; \n"+ - " } \n"+ - " public void bug() { \n"+ - " // The following reference to Base.foo causes the \n"+ - " // VerifyError \n"+ - " System.out.println(c.foo); \n"+ - " } \n"+ - " } \n"+ - "} \n", - }, - "SUCCESS"); -} - -/** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33751 - */ -public void test098() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n"+ - " public static void main(String[] args) { \n"+ - " System.out.println(\"first inner class = \" + new Object() {}.getClass()); \n"+ - " if (true) { \n"+ - " System.out.println(\"Always true\"); \n"+ - " } else { \n"+ - " System.out.println(\"unreachable inner class = \" + new Object() {}.getClass()); \n"+ - " } \n"+ - " System.out.println(\"last inner class = \" + new Object() {}.getClass()); \n"+ - " } \n"+ - "} \n", - }, - "first inner class = class X$1\n" + - "Always true\n" + - "last inner class = class X$2"); -} - -/** - * http://bugs.eclipse.org/bugs/show_bug.cgi?id=40240 - */ -public void test099() { - this.runConformTest( - new String[] { - "Y.java", - "public class Y { \n" + - " public static void main(String[] args) { \n" + - " class Local {} \n"+ - " System.out.println(\"SUCCESS\"); \n" + - " } \n" + - "} \n", - }, - "SUCCESS"); - - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - if (options.complianceLevel <= ClassFileConstants.JDK1_4) { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n" + - " public static void main(String argv[]) { \n" + - " Object a = new Y$1$Local(); // compile-time error \n" + - " } \n" + - "} \n", - }, - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " Object a = new Y$1$Local(); // compile-time error \n" + - " ^^^^^^^^^\n" + - "The nested type Y$1$Local cannot be referenced using its binary name\n" + - "----------\n", - null, - false); - return; - } - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n" + - " public static void main(String argv[]) { \n" + - " Object a = new Y$1Local(); // compile-time error \n" + - " } \n" + - "} \n", - }, - "----------\n" + - "1. ERROR in X.java (at line 3)\n" + - " Object a = new Y$1Local(); // compile-time error \n" + - " ^^^^^^^^\n" + - "The nested type Y$1Local cannot be referenced using its binary name\n" + - "----------\n", - null, - false); -} - -/* - * Check that member type allocation is granted access to compatible enclosing instance available as constructor argument - */ -public void test101() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " X(Object o) {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " new X(null).new M(null);\n" + - " System.out.println(\"SUCCESS\");\n" + - " }\n" + - " class M extends Top {\n" + // no issue if M is unrelated to X - " M() {\n" + - " super(null);\n" + - " }\n" + - " M(Object o) {\n" + - " super(new M(){});\n" + - " }\n" + - " }\n" + - " class Top {\n" + - " Top(Object o) {\n" + - " }\n" + - " }\n" + - "}\n", - }, - "SUCCESS"); -} - -/* - * Check that direct member type allocation is denied access to compatible enclosing instance available as constructor argument - */ -public void test102() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " X(Object o) {\n" + - " }\n" + - " class M extends X {\n" + - " M() {\n" + - " super(null); //1\n" + - " }\n" + - " M(Object o) {\n" + - " super(new M());//2\n" + - " }\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 9)\n" + - " super(new M());//2\n" + - " ^^^^^^^\n" + - "No enclosing instance of type X is available due to some intermediate constructor invocation\n" + - "----------\n"); -} - - -/* - * Check that indirect member type allocation is denied access to compatible enclosing instance available as constructor argument - */ -public void test104() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " X(Object o) {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " new X(null).new M(null);\n" + - " System.out.println(\"SUCCESS\");\n" + - " }\n" + - " class N extends X {\n" + - " N() {\n" + - " super(null); //1\n" + - " }\n" + - " N(Object o) {\n" + - " super(new M());//2\n" + - " }\n" + - " }\n" + - " class M extends X {\n" + - " M() {\n" + - " super(null); //3\n" + - " }\n" + - " M(Object o) {\n" + - " super(new M());//4\n" + - " }\n" + - " }\n" + - "}\n" - }, - "----------\n" + - "1. ERROR in X.java (at line 13)\n" + - " super(new M());//2\n" + - " ^^^^^^^\n" + - "No enclosing instance of type X is available due to some intermediate constructor invocation\n" + - "----------\n" + - "2. ERROR in X.java (at line 21)\n" + - " super(new M());//4\n" + - " ^^^^^^^\n" + - "No enclosing instance of type X is available due to some intermediate constructor invocation\n" + - "----------\n"); -} - -public void test107() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n" + - " public static class Y { \n" + - " public Y(Z z) {} \n" + - " } \n" + - " public interface Z {} \n" + - "} \n" + - "\n" + - "class A { \n" + - " private static class B extends X.Y implements X.Z { \n" + - " B(A a) { \n" + - " super(B.this); \n" + - " } \n" + - " } \n" + - "} ", - }, - "----------\n" + - "1. WARNING in X.java (at line 9)\n" + - " private static class B extends X.Y implements X.Z { \n" + - " ^\n" + - "The type A.B is never used locally\n" + - "----------\n" + - "2. ERROR in X.java (at line 11)\n" + - " super(B.this); \n" + - " ^^^^^^\n" + - "Cannot refer to \'this\' nor \'super\' while explicitly invoking a constructor\n" + - "----------\n"); -} - - // javac 1.4.2 incorrectly accepts it, jikes rejects it as we do -public void test108() { - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - if (options.sourceLevel == ClassFileConstants.JDK1_4) { // 1.3 and 1.5 both accept it - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " {\n" + - " class Local1 extends X {\n" + - " }\n" + - " class Local2 extends Local1 {\n" + - " }\n" + - " }\n" + - "}", - }, - "----------\n" + - "1. WARNING in X.java (at line 5)\n" + - " class Local2 extends Local1 {\n" + - " ^^^^^^\n" + - "The type Local2 is never used locally\n" + - "----------\n" + - "2. ERROR in X.java (at line 5)\n" + - " class Local2 extends Local1 {\n" + - " ^^^^^^\n" + - "No enclosing instance of type X is available due to some intermediate constructor invocation\n" + - "----------\n"); - return; - } - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " {\n" + - " class Local1 extends X {\n" + - " }\n" + - " class Local2 extends Local1 {\n" + - " }\n" + - " }\n" + - "}", - }, - ""); -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44538 -public void test109() { - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - if (options.sourceLevel == ClassFileConstants.JDK1_4) { // 1.3 and 1.5 both accept it - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public void bar() {\n" + - " class C extends X {\n" + - " public void foo() {\n" + - " \n" + - " }\n" + - " }\n" + - " X a= new X() {\n" + - " public void foo() {\n" + - " \n" + - " }\n" + - " };\n" + - " class D extends C {\n" + - " \n" + - " };\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. WARNING in X.java (at line 4)\n" + - " public void foo() {\n" + - " ^^^^^\n" + - "The method foo() from the type C is never used locally\n" + - "----------\n" + - "2. WARNING in X.java (at line 9)\n" + - " public void foo() {\n" + - " ^^^^^\n" + - "The method foo() from the type new X(){} is never used locally\n" + - "----------\n" + - "3. WARNING in X.java (at line 13)\n" + - " class D extends C {\n" + - " ^\n" + - "The type D is never used locally\n" + - "----------\n" + - "4. ERROR in X.java (at line 13)\n" + - " class D extends C {\n" + - " ^\n" + - "No enclosing instance of type X is available due to some intermediate constructor invocation\n" + - "----------\n"); - return; - } - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public void bar() {\n" + - " class C extends X {\n" + - " public void foo() {\n" + - " \n" + - " }\n" + - " }\n" + - " X a= new X() {\n" + - " public void foo() {\n" + - " \n" + - " }\n" + - " };\n" + - " class D extends C {\n" + - " \n" + - " };\n" + - " }\n" + - "}" - }, - ""); -} - -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44715 - NPE when generating fake reachable local type -public void test110() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void main(String[] args) {\n" + - " if (true) {\n" + - " System.out.println(\"SUCCESS\");\n" + - " return;\n" + - " }\n" + - " class ShouldNotBeGenerated {\n" + - " }\n" + - " }\n" + - "}" - }, - "SUCCESS"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=44715 - variation with anonymous type -public void test111() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void main(String[] args) {\n" + - " if (true) {\n" + - " System.out.println(\"SUCCESS\");\n" + - " return;\n" + - " }\n" + - " new Object() {}; \n" + - " }\n" + - "}" - }, - "SUCCESS"); -} -public void test112() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " private Object t;\n" + - " X(Object t) {\n" + - " this.t = t;\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " new X(\"OUTER\").bar();\n" + - " }\n" + - " void bar() {\n" + - " new X(this) {\n" + - " void run() {\n" + - " new Object() {\n" + - " void run() {\n" + - " System.out.println(t);\n" + - " }\n" + - " }.run();\n" + - " }\n" + - " }.run();\n" + - " }\n" + - "}\n" - }, - "OUTER"); -} -public void test113() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " private Object t;\n" + - " X(Object t) {\n" + - " this.t = t;\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " new X(\"OUTER\").bar();\n" + - " }\n" + - " void bar() {\n" + - " new X(this) {\n" + - " void run() {\n" + - " new Object() {\n" + - " void run() {\n" + - " try { \n" + - " X x = (X) t; \n" + - " } catch(ClassCastException e){ \n" + - " System.out.println(\"SUCCESS\");\n" + - " } \n" + - " }\n" + - " }.run();\n" + - " }\n" + - " }.run();\n" + - " }\n" + - "}\n" - }, - "SUCCESS"); -} -public void test114() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " String s;\n" + - " X(String s) {\n" + - " this.s = s;\n" + - " }\n" + - " void foo() {\n" + - " class L extends X {\n" + - " L() {\n" + - " super(s);\n" + - " System.out.println(s); \n" + - " }\n" + - " }\n" + - " new L();\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " new X(\"SUCCESS\").foo(); \n" + - " }\n" + - "}\n" - }, - "----------\n" + - "1. ERROR in X.java (at line 9)\n" + - " super(s);\n" + - " ^\n" + - "Cannot refer to an instance field s while explicitly invoking a constructor\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=58606 -public void test115() { - this.runConformTest( - new String[] { - "p2/X2.java", - "package p2;\n" + - "public class X2 extends p1.X1 {\n" + - " private void foo() {\n" + - " new p1.X1.M1() {\n" + - " public void bar() {\n" + - " System.out.print(X2.this.field);\n" + - " X2.this.doit();\n" + - " }\n" + - " }.bar();\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " X2 t2 = new X2();\n" + - " t2.foo();\n" + - " }\n" + - "}", - "p1/X1.java", - "package p1;\n" + - "public class X1 {\n" + - " public abstract class M1 {\n" + - " public abstract void bar();\n" + - " }\n" + - " protected static String field = \"SUCC\";\n" + - " protected static void doit() {\n" + - " System.out.println(\"ESS\");\n" + - " }\n" + - "}", - }, - "SUCCESS"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=68698 -public void test116() { - this.runNegativeTest( - new String[] { - "X.java", - "class Display {\n" + - " public interface Bla {\n" + - " void a();\n" + - " }\n" + - "}\n" + - "public class X {\n" + - " void aMethod() {\n" + - " Display display = null;\n" + - " display.new Bla() {\n" + - " };\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 9)\n" + - " display.new Bla() {\n" + - " ^^^^^^^\n" + - "Illegal enclosing instance specification for type Display.Bla\n" + - "----------\n" + - "2. ERROR in X.java (at line 9)\n" + - " display.new Bla() {\n" + - " ^^^^^\n" + - "The type new Display.Bla(){} must implement the inherited abstract method Display.Bla.a()\n" + - "----------\n"); -} - -public void test117() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " \n" + - " public static void main(String[] args) {\n" + - " new X().bar();\n" + - " }\n" + - " void bar() {\n" + - " new X(){\n" + - " void baz() {\n" + - " new M();\n" + - " }\n" + - " }.baz();\n" + - " }\n" + - " class M {\n" + - " M() {\n" + - " System.out.println(\"SUCCESS\");\n" + - " }\n" + - " }\n" + - "}\n", - }, - "SUCCESS"); -} - -public void test118() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo() {}\n" + - " class M {\n" + - " M(Object o) {}\n" + - " M() {\n" + - " this(new Object() {\n" + - " void baz() {\n" + - " foo();\n" + - " bar();\n" + - " }\n" + - " });\n" + - " new Object() {\n" + - " void baz() {\n" + - " foo();\n" + - " bar();\n" + - " }\n" + - " };\n" + - " }\n" + - " void bar() {}\n" + - " void baz() {\n" + - " new Object() {\n" + - " void baz() {\n" + - " foo();\n" + - " bar();\n" + - " }\n" + - " };\n" + - " }\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 9)\n" + - " bar();\n" + - " ^^^\n" + - "Cannot refer to an instance method while explicitly invoking a constructor\n" + - "----------\n" + - "2. WARNING in X.java (at line 22)\n" + - " void baz() {\n" + - " ^^^^^\n" + - "The method baz() from the type new Object(){} is never used locally\n" + - "----------\n"); -} -public void test119() { - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - if (options.sourceLevel < ClassFileConstants.JDK1_5) { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void main(String[] args) {\n" + - " new X().new M();\n" + - " }\n" + - " void foo(String s) { System.out.print(\"<foo:\"+s+\">\"); }\n" + - " class M {\n" + - " M(Runnable r) { r.run(); }\n" + - " M() {\n" + - " this(new Runnable() {\n" + - " public void run() {\n" + - " foo(\"0\");\n" + - " new Object() {\n" + - " void baz() {\n" + - "// foo(\"1\");\n" + - " }\n" + - " };\n" + - " class Local {\n" + - " void baz() {\n" + - "// foo(\"2\");\n" + - " }\n" + - " } \n" + - " new Local();\n" + - " }\n" + - " });\n" + - " new Object() {\n" + - " void baz() {\n" + - " foo(\"3\");\n" + - " bar(\"3\");\n" + - " }\n" + - " }.baz();\n" + - " }\n" + - " void bar(String s) { System.out.print(\"<bar:\"+s+\">\"); }\n" + - " void baz() {\n" + - " new Object() {\n" + - " void baz() {\n" + - " foo(\"4\");\n" + - " bar(\"4\");\n" + - " }\n" + - " };\n" + - " }\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 11)\n" + - " foo(\"0\");\n" + - " ^^^^^^^^\n" + - "No enclosing instance of the type X is accessible in scope\n" + - "----------\n" + - "2. WARNING in X.java (at line 13)\n" + - " void baz() {\n" + - " ^^^^^\n" + - "The method baz() from the type new Object(){} is never used locally\n" + - "----------\n" + - "3. WARNING in X.java (at line 18)\n" + - " void baz() {\n" + - " ^^^^^\n" + - "The method baz() from the type Local is never used locally\n" + - "----------\n" + - "4. WARNING in X.java (at line 35)\n" + - " void baz() {\n" + - " ^^^^^\n" + - "The method baz() from the type new Object(){} is never used locally\n" + - "----------\n"); - return; - } - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void main(String[] args) {\n" + - " new X().new M();\n" + - " }\n" + - " void foo(String s) { System.out.print(\"<foo:\"+s+\">\"); }\n" + - " class M {\n" + - " M(Runnable r) { r.run(); }\n" + - " M() {\n" + - " this(new Runnable() {\n" + - " public void run() {\n" + - " foo(\"0\");\n" + - " new Object() {\n" + - " void baz() {\n" + - "// foo(\"1\");\n" + - " }\n" + - " };\n" + - " class Local {\n" + - " void baz() {\n" + - "// foo(\"2\");\n" + - " }\n" + - " } \n" + - " new Local();\n" + - " }\n" + - " });\n" + - " new Object() {\n" + - " void baz() {\n" + - " foo(\"3\");\n" + - " bar(\"3\");\n" + - " }\n" + - " }.baz();\n" + - " }\n" + - " void bar(String s) { System.out.print(\"<bar:\"+s+\">\"); }\n" + - " void baz() {\n" + - " new Object() {\n" + - " void baz() {\n" + - " foo(\"4\");\n" + - " bar(\"4\");\n" + - " }\n" + - " };\n" + - " }\n" + - " }\n" + - "}\n", - }, - "<foo:0><foo:3><bar:3>"); -} -public void test120() { - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - if (options.sourceLevel < ClassFileConstants.JDK1_5) { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo() {}\n" + - " class M {\n" + - " M(Object o) {}\n" + - " M() {\n" + - " this(new Object() {\n" + - " void baz() {\n" + - " new Object() {\n" + - " void baz() {\n" + - " foo(); //0\n" + - " }\n" + - " };\n" + - " class Local {\n" + - " void baz() {\n" + - " foo(); //1\n" + - " }\n" + - " }\n" + - " new Local();\n" + - " foo();//2\n" + - " }\n" + - " });\n" + - " new Object() {\n" + - " void baz() {\n" + - " foo();//3\n" + - " bar();\n" + - " }\n" + - " };\n" + - " }\n" + - " void bar() {}\n" + - " void baz() {\n" + - " new Object() {\n" + - " void baz() {\n" + - " foo();//4\n" + - " bar();\n" + - " }\n" + - " };\n" + - " }\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. WARNING in X.java (at line 7)\n" + - " void baz() {\n" + - " ^^^^^\n" + - "The method baz() from the type new Object(){} is never used locally\n" + - "----------\n" + - "2. WARNING in X.java (at line 9)\n" + - " void baz() {\n" + - " ^^^^^\n" + - "The method baz() from the type new Object(){} is never used locally\n" + - "----------\n" + - "3. ERROR in X.java (at line 10)\n" + - " foo(); //0\n" + - " ^^^^^\n" + - "No enclosing instance of the type X is accessible in scope\n" + - "----------\n" + - "4. WARNING in X.java (at line 14)\n" + - " void baz() {\n" + - " ^^^^^\n" + - "The method baz() from the type Local is never used locally\n" + - "----------\n" + - "5. ERROR in X.java (at line 15)\n" + - " foo(); //1\n" + - " ^^^^^\n" + - "No enclosing instance of the type X is accessible in scope\n" + - "----------\n" + - "6. ERROR in X.java (at line 19)\n" + - " foo();//2\n" + - " ^^^^^\n" + - "No enclosing instance of the type X is accessible in scope\n" + - "----------\n" + - "7. WARNING in X.java (at line 23)\n" + - " void baz() {\n" + - " ^^^^^\n" + - "The method baz() from the type new Object(){} is never used locally\n" + - "----------\n" + - "8. WARNING in X.java (at line 32)\n" + - " void baz() {\n" + - " ^^^^^\n" + - "The method baz() from the type new Object(){} is never used locally\n" + - "----------\n"); - return; - } - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo() {}\n" + - " class M {\n" + - " M(Object o) {}\n" + - " M() {\n" + - " this(new Object() {\n" + - " void baz() {\n" + - " class Local {\n" + - " void baz() {\n" + - " foo(); //1\n" + - " }\n" + - " }\n" + - " new Local();\n" + - " foo();//2\n" + - " }\n" + - " });\n" + - " new Object() {\n" + - " void baz() {\n" + - " foo();//3\n" + - " bar();\n" + - " }\n" + - " };\n" + - " }\n" + - " void bar() {}\n" + - " void baz() {\n" + - " new Object() {\n" + - " void baz() {\n" + - " foo();//4\n" + - " bar();\n" + - " }\n" + - " };\n" + - " }\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. WARNING in X.java (at line 7)\n" + - " void baz() {\n" + - " ^^^^^\n" + - "The method baz() from the type new Object(){} is never used locally\n" + - "----------\n" + - "2. WARNING in X.java (at line 9)\n" + - " void baz() {\n" + - " ^^^^^\n" + - "The method baz() from the type Local is never used locally\n" + - "----------\n" + - "3. ERROR in X.java (at line 10)\n" + - " foo(); //1\n" + - " ^^^^^\n" + - "No enclosing instance of the type X is accessible in scope\n" + - "----------\n" + - "4. WARNING in X.java (at line 18)\n" + - " void baz() {\n" + - " ^^^^^\n" + - "The method baz() from the type new Object(){} is never used locally\n" + - "----------\n" + - "5. WARNING in X.java (at line 27)\n" + - " void baz() {\n" + - " ^^^^^\n" + - "The method baz() from the type new Object(){} is never used locally\n" + - "----------\n"); -} -public void test121() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " X(Object o) {\n" + - " }\n" + - " class M extends X {\n" + - " M() {\n" + - " super(null); //1\n" + - " }\n" + - " M(Object o) {\n" + - " super(new X(null){});//2\n" + - " }\n" + - " }\n" + - "}\n", - }, - ""); -} -public void _test122() { - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - if (options.sourceLevel < ClassFileConstants.JDK1_5) { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void main(String[] args) {\n" + - " new X().new M();\n" + - " }\n" + - " void foo(String s) { System.out.print(\"<foo:\"+s+\">\"); }\n" + - " class M {\n" + - " M(Runnable r) { r.run(); }\n" + - " M() {\n" + - " this(new Runnable() {\n" + - " {\n" + - " foo(\"0\");\n" + - " bar(\"0\");\n" + - " }\n" + - " public void run() {\n" + - " }\n" + - " });\n" + - " }\n" + - " void bar(String s) { System.out.print(\"<bar:\"+s+\">\"); }\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "cannot access foo(0)\n" + - "----------\n" + - "2. ERROR in X.java (at line 12)\n" + - " bar(\"0\");\n" + - " ^^^\n" + - "Cannot refer to an instance method while explicitly invoking a constructor\n" + - "----------\n"); - return; - } - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void main(String[] args) {\n" + - " new X().new M();\n" + - " }\n" + - " void foo(String s) { System.out.print(\"<foo:\"+s+\">\"); }\n" + - " class M {\n" + - " M(Runnable r) { r.run(); }\n" + - " M() {\n" + - " this(new Runnable() {\n" + - " {\n" + - " foo(\"0\");\n" + - " bar(\"0\");\n" + - " }\n" + - " public void run() {\n" + - " }\n" + - " });\n" + - " }\n" + - " void bar(String s) { System.out.print(\"<bar:\"+s+\">\"); }\n" + - " }\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 12)\n" + - " bar(\"0\");\n" + - " ^^^\n" + - "Cannot refer to an instance method while explicitly invoking a constructor\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=110182 - variation -public void test123() { - this.runConformTest( - new String[] { - "X.java", - "class Y {\n" + - " public static final boolean b = false;\n" + - "}\n" + - "public class X {\n" + - " private static Y y = new Y(); \n" + - " private static Object o = new Object(); \n" + - "\n" + - " static class Z {\n" + - " Z() {\n" + - " if (y.b) {\n" + - " System.out.println(\"dead code\");\n" + - " }\n" + - " }\n" + - " public int bar() {\n" + - " if (y.b) {\n" + - " System.out.println(\"dead code\");\n" + - " }\n" + - " System.out.println(\"bar\");\n" + - " return 0;\n" + - " }\n" + - " }\n" + - " static int foo() {\n" + - " synchronized(o) { \n" + - " Z z = new Z();\n" + - " return z.bar();\n" + - " }\n" + - " }\n" + - " \n" + - " public static void main(String[] args) {\n" + - " foo();\n" + - " }\n" + - "}\n", - }, - "bar"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=77473 -public void test124() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void main(String[] args) throws Exception {\n" + - " Foo foo = new Foo();\n" + - " try {\n" + - " foo.frob(Baz.class);\n" + - " System.out.println(\"FAILED\");\n" + - " } catch(IllegalAccessException e){\n" + - " System.out.println(\"SUCCESS\");\n" + - " }\n" + - " }\n" + - " private static class Baz {\n" + - " }\n" + - "}\n" + - "class Foo {\n" + - " public void frob(Class cls) throws Exception {\n" + - " Object o = cls.newInstance();\n" + - " }\n" + - "}\n", - }, - "SUCCESS"); - -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=77473 - variation -public void test125() { - this.runConformTest( - new String[] { - "X.java", - "public class X {\n" + - " \n" + - " void foo(final String s) {\n" + - " class Local {\n" + - " private Local() {}\n" + - " void bar() {\n" + - " System.out.println(s);\n" + - " }\n" + - " }\n" + - " new Local().bar();\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " new X().foo(\"SUCCESS\");\n" + - " }\n" + - "}\n", - }, - "SUCCESS"); - // check private constructor outcome (if >= 1.4 modifier change, if 1.3 synthetic emulation) - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=130117 -public void test126() { - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - if (options.sourceLevel < ClassFileConstants.JDK1_5) { - this.runNegativeTest( - new String[] { - "X.java", - "public interface X {\n" + - " private class Inner {}\n" + - " private interface IInner {}\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " private class Inner {}\n" + - " ^^^^^\n" + - "The interface member type Inner can only be public\n" + - "----------\n" + - "2. ERROR in X.java (at line 3)\n" + - " private interface IInner {}\n" + - " ^^^^^^\n" + - "The interface member type IInner can only be public\n" + - "----------\n"); - return; - } - this.runNegativeTest( - new String[] { - "X.java", - "public interface X {\n" + - " private class Inner {}\n" + - " private interface IInner {}\n" + - " private enum EInner {}\n" + - " private @interface AInner {}\n" + - "}\n", - }, - "----------\n" + - "1. ERROR in X.java (at line 2)\n" + - " private class Inner {}\n" + - " ^^^^^\n" + - "The interface member type Inner can only be public\n" + - "----------\n" + - "2. ERROR in X.java (at line 3)\n" + - " private interface IInner {}\n" + - " ^^^^^^\n" + - "The interface member type IInner can only be public\n" + - "----------\n" + - "3. ERROR in X.java (at line 4)\n" + - " private enum EInner {}\n" + - " ^^^^^^\n" + - "The interface member type EInner can only be public\n" + - "----------\n" + - "4. ERROR in X.java (at line 5)\n" + - " private @interface AInner {}\n" + - " ^^^^^^\n" + - "The interface member type AInner can only be public\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=89347 -public void test127() { - this.runConformTest( - new String[] { - "p/BugContainer.java", - "package p;\n" + - "\n" + - "public abstract class BugContainer {\n" + - " protected static class InternalInfo$ {\n" + - " public InternalInfo$() {}\n" + - " }\n" + - " abstract protected InternalInfo$ getInfo();\n" + - "}\n", // ================= - }, - ""); - this.runConformTest( - new String[] { - "q/BugUser.java", // ================= - "package q;\n" + - "\n" + - "import p.BugContainer;\n" + - "\n" + - "public class BugUser extends BugContainer{\n" + - " protected InternalInfo$ getInfo() {\n" + - " return new InternalInfo$();\n" + - " }\n" + - "}", // ================= - }, - "", - null, - false, - null); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=89347 - variation -public void test128() { - this.runConformTest( - new String[] { - "p/BugContainer.java", - "package p;\n" + - "\n" + - "public abstract class BugContainer {\n" + - " protected static class InternalInfo$ {\n" + - " public InternalInfo$() {}\n" + - " }\n" + - " abstract protected InternalInfo$ getInfo();\n" + - "}\n", // ================= - "q/BugUser.java", // ================= - "package q;\n" + - "\n" + - "import p.BugContainer;\n" + - "\n" + - "public class BugUser extends BugContainer{\n" + - " protected InternalInfo$ getInfo() {\n" + - " return new InternalInfo$();\n" + - " }\n" + - "}", // ================= - }, - ""); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=160132 - variation -public void test129() { - this.runConformTest( - new String[] { - "X.java", //======================== - "public interface X {\n" + - " interface Entry {\n" + - " interface Internal extends Entry {\n" + - " Internal createEntry();\n" + - " }\n" + - " }\n" + - "}\n", //======================== - "Y.java", - "public class Y implements X.Entry.Internal {\n" + - " public Internal createEntry() {\n" + - " return null;\n" + - " }\n" + - "}\n" , //======================== - }, - ""); - // compile Y against X binary - this.runConformTest( - new String[] { - "Y.java", //======================== - "public class Y implements X.Entry.Internal {\n" + - " public Internal createEntry() {\n" + - " return null;\n" + - " }\n" + - "}\n" , //======================== - }, - "", - null, - false, - null); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=164497 -public void test130() { - CompilerOptions options = new CompilerOptions(getCompilerOptions()); - if (options.sourceLevel <= ClassFileConstants.JDK1_3) { - this.runConformTestThrowingError( - new String[] { - "X.java", //======================== - "public class X {\n" + - " public static void main(String[] args) {\n" + - " new M().foo2();\n" + - " }\n" + - "}\n"+ - "class M {\n" + - " String name;\n" + - " \n" + - " M() {\n" + - " this.name = \"SUCCESS\";\n" + - " }\n" + - "\n" + - " private class Y extends N {\n" + - " private Y() {\n" + - " super();\n" + - " }\n" + - " protected void foo(Z z) {\n" + - " z.bar(new A());\n" + - " }\n" + - " }\n" + - " \n" + - " public class A implements I {\n" + - " public void configure() {\n" + - " new B().foo();\n" + - " }\n" + - " public class B {\n" + - " public void foo() {\n" + - " try {\n" + - " System.out.println(M.this.name);\n" + - " } catch(NullPointerException e) {\n" + - " System.err.println(\"NPE THROWN\");\n" + - " }\n" + - " }\n" + - " }\n" + - " }\n" + - " \n" + - " public void foo2() {\n" + - " new Y();\n" + - " }\n" + - "}\n" + - "class Z {\n" + - " void bar(I i) {\n" + - " i.configure();\n" + - " }\n" + - "}\n" + - "\n" + - "interface I {\n" + - " void configure();\n" + - "}\n" + - "\n" + - "class N {\n" + - " protected void foo(Z z) {\n" + - " }\n" + - " N() {\n" + - " this.foo(new Z());\n" + - " }\n" + - "}\n" - }, - "NPE THROWN", - null, - true, - null); - return; - } - this.runConformTest( - new String[] { - "X.java", //======================== - "public class X {\n" + - " public static void main(String[] args) {\n" + - " new M().foo2();\n" + - " }\n" + - "}\n"+ - "class M {\n" + - " String name;\n" + - " \n" + - " M() {\n" + - " this.name = \"SUCCESS\";\n" + - " }\n" + - "\n" + - " private class Y extends N {\n" + - " private Y() {\n" + - " super();\n" + - " }\n" + - " protected void foo(Z z) {\n" + - " z.bar(new A());\n" + - " }\n" + - " }\n" + - " \n" + - " public class A implements I {\n" + - " public void configure() {\n" + - " new B().foo();\n" + - " }\n" + - " public class B {\n" + - " public void foo() {\n" + - " System.out.println(M.this.name);\n" + - " }\n" + - " }\n" + - " }\n" + - " \n" + - " public void foo2() {\n" + - " new Y();\n" + - " }\n" + - "}\n" + - "class Z {\n" + - " void bar(I i) {\n" + - " i.configure();\n" + - " }\n" + - "}\n" + - "\n" + - "interface I {\n" + - " void configure();\n" + - "}\n" + - "\n" + - "class N {\n" + - " protected void foo(Z z) {\n" + - " }\n" + - " N() {\n" + - " this.foo(new Z());\n" + - " }\n" + - "}\n" - }, - "SUCCESS"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165662 -public void test131() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " void foo() {\n" + - " class Local {\n" + - " void foo() {\n" + - " }\n" + - " }\n" + - " {\n" + - " class Local {\n" + - " Local(int i) {\n" + - " this.init(i);\n" + - " this.bar(); // should detect error\n" + - " }\n" + - " void init(int i) {\n" + - " }\n" + - " }\n" + - " Local l = new Local(0); // should be fine\n" + - " }\n" + - " Local l = new Local();\n" + - " l.foo();\n" + - " }\n" + - "}", // =================, - }, - "----------\n" + - "1. ERROR in X.java (at line 8)\n" + - " class Local {\n" + - " ^^^^^\n" + - "Duplicate nested type Local\n" + - "----------\n" + - "2. ERROR in X.java (at line 11)\n" + - " this.bar(); // should detect error\n" + - " ^^^\n" + - "The method bar() is undefined for the type Local\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=165662 -public void test132() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X {\n" + - " public static void main(String argv[]) {\n" + - " class Local {}\n" + - " class Foo {\n" + - " void foo() {\n" + - " class Local {}\n" + - " }\n" + - " }\n" + - " }\n" + - "}", // ================= - }, - "----------\n" + - "1. WARNING in X.java (at line 3)\n" + - " class Local {}\n" + - " ^^^^^\n" + - "The type Local is never used locally\n" + - "----------\n" + - "2. WARNING in X.java (at line 4)\n" + - " class Foo {\n" + - " ^^^\n" + - "The type Foo is never used locally\n" + - "----------\n" + - "3. WARNING in X.java (at line 5)\n" + - " void foo() {\n" + - " ^^^^^\n" + - "The method foo() from the type Foo is never used locally\n" + - "----------\n" + - "4. WARNING in X.java (at line 6)\n" + - " class Local {}\n" + - " ^^^^^\n" + - "The type Local is hiding the type Local\n" + - "----------\n" + - "5. WARNING in X.java (at line 6)\n" + - " class Local {}\n" + - " ^^^^^\n" + - "The type Local is never used locally\n" + - "----------\n"); -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=168331 -public void test133() { - if (this.complianceLevel.compareTo(COMPLIANCE_1_5) >= 0) { - this.runConformTest( - new String[] { - "X.java", //=================== - "public class X {\n" + - " public static interface I {\n" + - " }\n" + - " public static interface IE extends I {\n" + - " }\n" + - " public static interface J {\n" + - " I getI(int i);\n" + - " }\n" + - " public static interface JE extends J {\n" + - " IE getI(int i);\n" + - " }\n" + - " public static class Y implements JE {\n" + - " public IE getI(int i) {\n" + - " return null;\n" + - " }\n" + - " }\n" + - " private J j = new Y();\n" + - " public void foo() {\n" + - " j.getI(0);\n" + - " System.out.println(\"SUCCESS\");\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " new X().foo();\n" + - " }\n" + - "}", // ================= - }, - "SUCCESS"); - } -} -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=168331 -public void test134() { - if (this.complianceLevel.compareTo(COMPLIANCE_1_5) >= 0) { - this.runConformTest( - new String[] { - "X.java", //=================== - "public class X {\n" + - " public interface I {\n" + - " public String foo();\n" + - " }\n" + - " public interface J {\n" + - " public I getI();\n" + - " }\n" + - " public static class XI implements I {\n" + - " public String foo() {\n" + - " return \"XI\";\n" + - " }\n" + - " }\n" + - " public interface K extends J {\n" + - " public XI getI();\n" + - " }\n" + - " public static abstract class XK implements K {\n" + - " public XI getI() {\n" + - " return new XI();\n" + - " }\n" + - " }\n" + - " public static class Y extends XK {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " K k = new Y();\n" + - " System.out.println(k.getI().foo());\n" + - " J j = k;\n" + - " System.out.println(j.getI().foo());\n" + - " }\n" + - "}", // ================= - }, - "XI\nXI"); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152961 -public void test135() { - this.runNegativeTest( - new String[] { - "p/X.java", - "package p;\n" + - "import p.A;\n" + - "public class X {\n" + - " \n" + - " void foo(Object o, Object [] os) {\n" + - " A.M2.MM1 mm1 = (A.M2.MM1) o;\n" + - " A.M2.MM1[] mm1s = (A.M2.MM1[]) os;\n" + - " }\n" + - " private interface Outer {\n" + - " interface Inner {\n" + - " String variable = \"my testing\";\n" + - " }\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " System.out.println(Outer.Inner.variable);\n" + - " Zork z;\n" + - " }\n" + - "}", // =================, - "p/A.java", - "package p;\n" + - "/** @deprecated */\n" + - "public class A {\n" + - " public class M1 {\n" + - " public class MM1 {\n" + - " }\n" + - " }\n" + - " public class M2 extends M1 {\n" + - " }\n" + - "}", // =================, - }, - "----------\n" + - "1. WARNING in p\\X.java (at line 2)\n" + - " import p.A;\n" + - " ^^^\n" + - "The type A is deprecated\n" + - "----------\n" + - "2. WARNING in p\\X.java (at line 6)\n" + - " A.M2.MM1 mm1 = (A.M2.MM1) o;\n" + - " ^^^^^^^^\n" + - "The type A is deprecated\n" + - "----------\n" + - "3. WARNING in p\\X.java (at line 6)\n" + - " A.M2.MM1 mm1 = (A.M2.MM1) o;\n" + - " ^^^^^^^^\n" + - "The type A.M2 is deprecated\n" + - "----------\n" + - "4. WARNING in p\\X.java (at line 6)\n" + - " A.M2.MM1 mm1 = (A.M2.MM1) o;\n" + - " ^^^^^^^^\n" + - "The type A.M1.MM1 is deprecated\n" + - "----------\n" + - "5. WARNING in p\\X.java (at line 6)\n" + - " A.M2.MM1 mm1 = (A.M2.MM1) o;\n" + - " ^\n" + - "The type A is deprecated\n" + - "----------\n" + - "6. WARNING in p\\X.java (at line 6)\n" + - " A.M2.MM1 mm1 = (A.M2.MM1) o;\n" + - " ^^^^\n" + - "The type A.M2 is deprecated\n" + - "----------\n" + - "7. WARNING in p\\X.java (at line 6)\n" + - " A.M2.MM1 mm1 = (A.M2.MM1) o;\n" + - " ^^^^^^^^\n" + - "The type A.M1.MM1 is deprecated\n" + - "----------\n" + - "8. WARNING in p\\X.java (at line 7)\n" + - " A.M2.MM1[] mm1s = (A.M2.MM1[]) os;\n" + - " ^^^^^^^^\n" + - "The type A is deprecated\n" + - "----------\n" + - "9. WARNING in p\\X.java (at line 7)\n" + - " A.M2.MM1[] mm1s = (A.M2.MM1[]) os;\n" + - " ^^^^^^^^\n" + - "The type A.M2 is deprecated\n" + - "----------\n" + - "10. WARNING in p\\X.java (at line 7)\n" + - " A.M2.MM1[] mm1s = (A.M2.MM1[]) os;\n" + - " ^^^^^^^^\n" + - "The type A.M1.MM1 is deprecated\n" + - "----------\n" + - "11. WARNING in p\\X.java (at line 7)\n" + - " A.M2.MM1[] mm1s = (A.M2.MM1[]) os;\n" + - " ^^^^^^^^\n" + - "The type A is deprecated\n" + - "----------\n" + - "12. WARNING in p\\X.java (at line 7)\n" + - " A.M2.MM1[] mm1s = (A.M2.MM1[]) os;\n" + - " ^^^^^^^^\n" + - "The type A.M2 is deprecated\n" + - "----------\n" + - "13. WARNING in p\\X.java (at line 7)\n" + - " A.M2.MM1[] mm1s = (A.M2.MM1[]) os;\n" + - " ^^^^^^^^\n" + - "The type A.M1.MM1 is deprecated\n" + - "----------\n" + - "14. ERROR in p\\X.java (at line 16)\n" + - " Zork z;\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152961 - variation -public void test136() { - this.runNegativeTest( - new String[] { - "p/X.java", - "package p;\n" + - "public class X {\n" + - " private interface Outer {\n" + - " interface Inner {\n" + - " String variable = \"my testing\";\n" + - " }\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " Outer.Inner variable = null;\n" + - " System.out.println(variable);\n" + - " Zork z;\n" + - " }\n" + - "}", // =================, - }, - "----------\n" + - "1. ERROR in p\\X.java (at line 11)\n" + - " Zork z;\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152961 - variation -public void test137() { - this.runNegativeTest( - new String[] { - "p/X.java", - "package p;\n" + - "public class X {\n" + - " private interface Outer {\n" + - " interface Inner {\n" + - " String variable = \"my testing\";\n" + - " }\n" + - " }\n" + - " private interface Outer2 extends Outer {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " System.out.println(Outer2.Inner.variable);\n" + - " Zork z;\n" + - " }\n" + - "}", // =================, - }, - "----------\n" + - "1. ERROR in p\\X.java (at line 12)\n" + - " Zork z;\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152961 - variation -public void test138() { - this.runNegativeTest( - new String[] { - "p/X.java", - "public class X {\n" + - " private interface Outer {\n" + - " interface Inner {\n" + - " String variable = \"my testing\";\n" + - " }\n" + - " }\n" + - " private interface Outer2 extends Outer {\n" + - " }\n" + - " public static void main(String[] args) {\n" + - " Outer2.Inner variable = null;\n" + - " System.out.println(variable);\n" + - " Zork z;\n" + - " }\n" + - "}", // =================, - }, - "----------\n" + - "1. ERROR in p\\X.java (at line 12)\n" + - " Zork z;\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=152961 - variation -public void test139() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n" + - " private class A {\n" + - " class B {}\n" + - " }\n" + - " private class Y extends A {\n" + - " }\n" + - " Y.B d = null;\n" + - "}\n" + - "class Y extends Zork {}\n", // ================= - }, - "----------\n" + - "1. WARNING in X.java (at line 5)\n" + - " private class Y extends A {\n" + - " ^\n" + - "Access to enclosing constructor X.A() is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n" + - "----------\n" + - "2. ERROR in X.java (at line 9)\n" + - " class Y extends Zork {}\n" + - " ^^^^\n" + - "Zork cannot be resolved to a type\n" + - "----------\n"); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=171184 -public void test140() { - this.runConformTest(new String[] { - "p/A.java", - "package p;\n" + - "public class A {\n" + - " public static interface I {\n" + - " void foo();\n" + - " }\n" + - "}", - "p1/X.java", - "package p1;\n" + - "import p.A;\n" + - "public class X implements A.I {\n" + - " public void foo() { /* dummy */ }\n" + - "}" - }); - String expectedOutput = - " Inner classes:\n" + - " [inner class info: #5 p/A$I, outer class info: #20 p/A\n" + - " inner name: #22 I, accessflags: 1545 public abstract static]\n"; - checkDisassembledClassFile(OUTPUT_DIR + File.separator + "p1" + File.separator + "X.class", "X", expectedOutput); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=171184 -public void test141() { - this.runConformTest(new String[] { - "p/A.java", - "package p;\n" + - "public class A {\n" + - " public static class B {\n" + - " void foo() { /* dummy */ }\n" + - " }\n" + - "}", - "p1/X.java", - "package p1;\n" + - "import p.A;\n" + - "public class X extends A.B {\n" + - "}" - }); - String expectedOutput = - " Inner classes:\n" + - " [inner class info: #3 p/A$B, outer class info: #17 p/A\n" + - " inner name: #19 B, accessflags: 9 public static]\n"; - checkDisassembledClassFile(OUTPUT_DIR + File.separator + "p1" + File.separator + "X.class", "X", expectedOutput); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=171184 -public void test142() { - this.runConformTest(new String[] { - "p/A.java", - "package p;\n" + - "public class A {\n" + - " public class B {\n" + - " void foo() { /* dummy */ }\n" + - " }\n" + - "}", - "p1/X.java", - "package p1;\n" + - "import p.A;\n" + - "public class X {\n" + - " Object foo() {\n" + - " return new A().new B();\n" + - " }\n" + - "}" - }); - String expectedOutput = - " Inner classes:\n" + - " [inner class info: #16 p/A$B, outer class info: #18 p/A\n" + - " inner name: #31 B, accessflags: 1 public]\n"; - if (new CompilerOptions(this.getCompilerOptions()).targetJDK == ClassFileConstants.JDK1_1) { - expectedOutput = - " Inner classes:\n" + - " [inner class info: #16 p/A$B, outer class info: #18 p/A\n" + - " inner name: #27 B, accessflags: 1 public]\n"; - } - checkDisassembledClassFile(OUTPUT_DIR + File.separator + "p1" + File.separator + "X.class", "X", expectedOutput); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=171184 -public void test143() { - this.runConformTest(new String[] { - "X.java", - "class A {\n" + - " public class B {\n" + - " void foo() { /* dummy */ }\n" + - " }\n" + - "}\n" + - "public class X {\n" + - " Object foo() {\n" + - " return A.B.class;\n" + - " }\n" + - "}" - }); - if (new CompilerOptions(this.getCompilerOptions()).targetJDK >= ClassFileConstants.JDK1_5) { - String expectedOutput = - " Inner classes:\n" + - " [inner class info: #16 A$B, outer class info: #21 A\n" + - " inner name: #23 B, accessflags: 1 public]\n"; - checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); - } -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=171184 -public void test144() { - this.runConformTest(new String[] { - "X.java", - "class A {\n" + - " public static class B {\n" + - " public static int CONST = 0;\n" + - " }\n" + - "}\n" + - "public class X {\n" + - " int foo() {\n" + - " return A.B.CONST;\n" + - " }\n" + - "}" - }); - String expectedOutput = - " Inner classes:\n" + - " [inner class info: #17 A$B, outer class info: #25 A\n" + - " inner name: #27 B, accessflags: 9 public static]\n"; - checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=171184 -public void test145() { - this.runConformTest(new String[] { - "X.java", - "class A {\n" + - " public static class B {\n" + - " }\n" + - "}\n" + - "public class X {\n" + - " A.B field;\n" + - "}" - }); - String expectedOutput = - " Inner classes:\n" + - " [inner class info: #19 A$B, outer class info: #21 A\n" + - " inner name: #23 B, accessflags: 9 public static]\n"; - checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=171184 -public void test146() { - this.runConformTest(new String[] { - "X.java", - "class A {\n" + - " public static class B {\n" + - " }\n" + - "}\n" + - "public class X {\n" + - " int foo(A.B o) {\n" + - " return 0;\n" + - " }\n" + - "}" - }); - String expectedOutput = - " Inner classes:\n" + - " [inner class info: #21 A$B, outer class info: #23 A\n" + - " inner name: #25 B, accessflags: 9 public static]\n"; - checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=171184 -public void test147() { - this.runConformTest(new String[] { - "X.java", - "class A {\n" + - " public static class B {\n" + - " }\n" + - "}\n" + - "public class X {\n" + - " A.B foo() {\n" + - " return null;\n" + - " }\n" + - "}" - }); - String expectedOutput = - " Inner classes:\n" + - " [inner class info: #19 A$B, outer class info: #21 A\n" + - " inner name: #23 B, accessflags: 9 public static]\n"; - checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=171184 -public void test148() { - this.runConformTest(new String[] { - "X.java", - "class A {\n" + - " public static class B extends Exception {\n" + - " }\n" + - "}\n" + - "public class X {\n" + - " void foo() throws A.B{\n" + - " }\n" + - "}" - }); - String expectedOutput = - " Inner classes:\n" + - " [inner class info: #16 A$B, outer class info: #21 A\n" + - " inner name: #23 B, accessflags: 9 public static]\n"; - checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); -} -//https://bugs.eclipse.org/bugs/show_bug.cgi?id=171749 -public void test149() { - this.runConformTest(new String[] { - "X.java", - "public final class X implements A.Foo1 {\n" + - " public void foo() {}\n" + - " public A.Foo2 foo2() { return null; }\n" + - " public void foo3( A.Foo3 foo ) {}\n" + - " public void foo4() { A.Foo4 foo = null; }\n" + - " public void foo5() {\n" + - " new A.Foo5() {\n" + - " public void foo() {}\n" + - " }.foo();\n" + - " }\n" + - " public static class Foo6 implements A.Foo6 {\n" + - " public void foo() {}\n" + - " }\n" + - " public void foo7() { Bar2.foo7().foo(); }\n" + - "}", - "A.java", - "class A {\n" + - " public static interface Foo1 { void foo(); }\n" + - " public static interface Foo2 { void foo(); }\n" + - " public static interface Foo3 { void foo(); }\n" + - " public static interface Foo4 { void foo(); }\n" + - " public static interface Foo5 { void foo(); }\n" + - " public static interface Foo6 { void foo(); }\n" + - " public static interface Foo7 { void foo(); }\n" + - "}", - "Bar2.java", - "class Bar2 {\n" + - " public static A.Foo7 foo7() { return null; }\n" + - "}" - }); - String expectedOutput = - " Inner classes:\n" + - " [inner class info: #5 A$Foo1, outer class info: #44 A\n" + - " inner name: #46 Foo1, accessflags: 1545 public abstract static],\n" + - " [inner class info: #47 A$Foo2, outer class info: #44 A\n" + - " inner name: #49 Foo2, accessflags: 1545 public abstract static],\n" + - " [inner class info: #50 A$Foo3, outer class info: #44 A\n" + - " inner name: #52 Foo3, accessflags: 1545 public abstract static],\n" + - " [inner class info: #39 A$Foo7, outer class info: #44 A\n" + - " inner name: #53 Foo7, accessflags: 1545 public abstract static],\n" + - " [inner class info: #25 X$1, outer class info: #0\n" + - " inner name: #0, accessflags: 0 default],\n" + - " [inner class info: #54 X$Foo6, outer class info: #1 X\n" + - " inner name: #56 Foo6, accessflags: 9 public static]\n"; - checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput); -} -public static Class testClass() { - return InnerEmulationTest.class; -} -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InternalHexFloatTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InternalHexFloatTest.java deleted file mode 100644 index bef8cfc..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InternalHexFloatTest.java +++ /dev/null
@@ -1,409 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2007 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.regression; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.internal.compiler.util.FloatUtil; - -public class InternalHexFloatTest extends AbstractRegressionTest { - static class DoubleTest { - String input; - long output; - public DoubleTest(String input, long output) { - this.input = input; - this.output = output; - } - } - - static class FloatTest { - String input; - int output; - public FloatTest(String input, int output) { - this.input = input; - this.output = output; - } - } - - public InternalHexFloatTest(String name) { - super(name); - } - public static Test suite() { - return buildMinimalComplianceTestSuite(testClass(), F_1_5); - } - - public static Class testClass() { - return InternalHexFloatTest.class; - } - - /** - */ - public void test001() { - List x = new ArrayList(); - - // various forms of zero - x.add(new DoubleTest("0x0p0", 0x0L)); - x.add(new DoubleTest("0x0p0d", 0x0L)); - x.add(new DoubleTest("0x0p0D", 0x0L)); - x.add(new DoubleTest("0x0.0p0D", 0x0L)); - x.add(new DoubleTest("0x.0p0D", 0x0L)); - x.add(new DoubleTest("0x0.p0D", 0x0L)); - x.add(new DoubleTest("0x00000.00000000000p0D", 0x0L)); - x.add(new DoubleTest("0x0p99D", 0x0L)); - x.add(new DoubleTest("0x0p-99D", 0x0L)); - x.add(new DoubleTest("0x0p9999999D", 0x0L)); - x.add(new DoubleTest("0x0p-9999999D", 0x0L)); - - // small doubles - x.add(new DoubleTest("0x0.8p0D", 0x3fe0000000000000L)); - x.add(new DoubleTest("0x0.4p0D", 0x3fd0000000000000L)); - x.add(new DoubleTest("0x0.2p0D", 0x3fc0000000000000L)); - x.add(new DoubleTest("0x0.1p0D", 0x3fb0000000000000L)); - x.add(new DoubleTest("0x0.08p0D", 0x3fa0000000000000L)); - x.add(new DoubleTest("0x0.04p0D", 0x3f90000000000000L)); - x.add(new DoubleTest("0x0.02p0D", 0x3f80000000000000L)); - x.add(new DoubleTest("0x0.01p0D", 0x3f70000000000000L)); - x.add(new DoubleTest("0x0.010p0D", 0x3f70000000000000L)); - x.add(new DoubleTest("0x1p0D", 0x3ff0000000000000L)); - x.add(new DoubleTest("0x2p0D", 0x4000000000000000L)); - x.add(new DoubleTest("0x4p0D", 0x4010000000000000L)); - x.add(new DoubleTest("0x8p0D", 0x4020000000000000L)); - x.add(new DoubleTest("0x10p0D", 0x4030000000000000L)); - x.add(new DoubleTest("0x20p0D", 0x4040000000000000L)); - x.add(new DoubleTest("0x40p0D", 0x4050000000000000L)); - x.add(new DoubleTest("0x80p0D", 0x4060000000000000L)); - x.add(new DoubleTest("0x80.p0D", 0x4060000000000000L)); - x.add(new DoubleTest("0x80.8p0D", 0x4060100000000000L)); - x.add(new DoubleTest("0x80.80p0D", 0x4060100000000000L)); - x.add(new DoubleTest("0x123456789p0D", 0x41f2345678900000L)); - x.add(new DoubleTest("0xabcedfp0D", 0x416579dbe0000000L)); - x.add(new DoubleTest("0xABCDEFp0D", 0x416579bde0000000L)); - - x.add(new DoubleTest("0x0.0100000000000000000000000000000000000000000000000p0d", 0x3f70000000000000L)); - x.add(new DoubleTest("0x0.0000000000000000000000000000000000000000000000001p0d", 0x33b0000000000000L)); - x.add(new DoubleTest("0x10000000000000000000000000000000000000000000000000000p0d", 0x4cf0000000000000L)); - - // rounding to 53 bits - x.add(new DoubleTest("0x823456789012380p0d", 0x43a0468acf120247L)); - x.add(new DoubleTest("0xFFFFFFFFFFFFF80p0d", 0x43afffffffffffffL)); - x.add(new DoubleTest("0xFFFFFFFFFFFFFC0p0d", 0x43b0000000000000L)); - x.add(new DoubleTest("0xFFFFFFFFFFFFFA0p0d", 0x43afffffffffffffL)); - x.add(new DoubleTest("0xFFFFFFFFFFFFF81p0d", 0x43afffffffffffffL)); - x.add(new DoubleTest("0x123456789abcd10p0d", 0x43723456789abcd1L)); - x.add(new DoubleTest("0x123456789abcd18p0d", 0x43723456789abcd2L)); - x.add(new DoubleTest("0x7FFFFFFFFFFFFC0p0d", 0x439fffffffffffffL)); - x.add(new DoubleTest("0x7FFFFFFFFFFFFE0p0d", 0x43a0000000000000L)); - x.add(new DoubleTest("0x3FFFFFFFFFFFFE0p0d", 0x438fffffffffffffL)); - x.add(new DoubleTest("0x3FFFFFFFFFFFFF0p0d", 0x4390000000000000L)); - x.add(new DoubleTest("0x1FFFFFFFFFFFFF0p0d", 0x437fffffffffffffL)); - x.add(new DoubleTest("0x1FFFFFFFFFFFFF8p0d", 0x4380000000000000L)); - - // rounding to overflow at +1024; denormalized at -1022; underflow at -1075 - x.add(new DoubleTest("0x1p5000D", 0x7ff0000000000000L)); - x.add(new DoubleTest("0x1p-5000D", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x1.0p1022d", 0x7fd0000000000000L)); - x.add(new DoubleTest("0x1.0p1023d", 0x7fe0000000000000L)); - x.add(new DoubleTest("0x1.0p1024d", 0x7ff0000000000000L)); - x.add(new DoubleTest("0x1.0p-1022d", 0x0010000000000000L)); - x.add(new DoubleTest("0x1.0p-1023d", 0x0008000000000000L)); - x.add(new DoubleTest("0x1.0p-1024d", 0x0004000000000000L)); - x.add(new DoubleTest("0x1.0p-1074d", 0x0000000000000001L)); - x.add(new DoubleTest("0x1.0p-1075d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x1.0p-1076d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x1.0p-1077d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x1.0p-1078d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x0.8p1023d", 0x7fd0000000000000L)); - x.add(new DoubleTest("0x0.8p1024d", 0x7fe0000000000000L)); - x.add(new DoubleTest("0x0.8p1025d", 0x7ff0000000000000L)); - x.add(new DoubleTest("0x0.8p-1021d", 0x0010000000000000L)); - x.add(new DoubleTest("0x0.8p-1022d", 0x0008000000000000L)); - x.add(new DoubleTest("0x0.8p-1023d", 0x0004000000000000L)); - x.add(new DoubleTest("0x0.8p-1024d", 0x0002000000000000L)); - x.add(new DoubleTest("0x0.8p-1074d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x0.8p-1075d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x0.8p-1076d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x0.4p-1021d", 0x0008000000000000L)); - x.add(new DoubleTest("0x0.4p-1022d", 0x0004000000000000L)); - x.add(new DoubleTest("0x0.4p-1023d", 0x0002000000000000L)); - x.add(new DoubleTest("0x0.4p-1073d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x0.4p-1074d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x0.4p-1075d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x0.2p-1020d", 0x0008000000000000L)); - x.add(new DoubleTest("0x0.2p-1021d", 0x0004000000000000L)); - x.add(new DoubleTest("0x0.2p-1022d", 0x0002000000000000L)); - x.add(new DoubleTest("0x0.2p-1072d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x0.2p-1073d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x0.2p-1074d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x0.1p-1019d", 0x0008000000000000L)); - x.add(new DoubleTest("0x0.1p-1020d", 0x0004000000000000L)); - x.add(new DoubleTest("0x0.1p-1021d", 0x0002000000000000L)); - x.add(new DoubleTest("0x0.1p-1071d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x0.1p-1072d", 0x7ff8000000000000L)); - x.add(new DoubleTest("0x0.1p-1073d", 0x7ff8000000000000L)); - - for (Iterator it = x.iterator(); it.hasNext();) { - DoubleTest t = (DoubleTest) it.next(); - String s = t.input; - long expectedBits = t.output; - double libExpected = 0.0d; - boolean isJ2SE5; - try { - // note that next line only works with a 1.5 J2SE - libExpected = Double.parseDouble(s); - isJ2SE5 = true; - } catch(NumberFormatException e) { - isJ2SE5 = false; - } - double dActual = FloatUtil.valueOfHexDoubleLiteral(s.toCharArray()); - long actualBits = Double.doubleToLongBits(dActual); - if (isJ2SE5) { - // cross-check bits computed by J2SE 1.5 library - long libExpectedBits = Double.doubleToRawLongBits(libExpected); - if (expectedBits != libExpectedBits) { - if (Double.isNaN(Double.longBitsToDouble(expectedBits)) && libExpected == 0.0d) { - // this is ok - we return NaN where lib quietly underflows to 0 - } else { - assertEquals("Test has wrong table value for " + s, libExpectedBits, expectedBits); - } - } - } - assertEquals("Wrong double value for " + s, expectedBits, actualBits); - } - } - - /** - */ - public void test002() { - List x = new ArrayList(); - // various forms of zero - x.add(new FloatTest("0x0p0f", 0x0)); - x.add(new FloatTest("0x0p0F", 0x0)); - x.add(new FloatTest("0x0.0p0F", 0x0)); - x.add(new FloatTest("0x.0p0F", 0x0)); - x.add(new FloatTest("0x0.p0F", 0x0)); - x.add(new FloatTest("0x00000.00000000000p0F", 0x0)); - x.add(new FloatTest("0x0p99F", 0x0)); - x.add(new FloatTest("0x0p-99F", 0x0)); - x.add(new FloatTest("0x0p9999999F", 0x0)); - x.add(new FloatTest("0x0p-9999999F", 0x0)); - - // small floats - x.add(new FloatTest("0x0.8p0F", 0x3f000000)); - x.add(new FloatTest("0x0.4p0F", 0x3e800000)); - x.add(new FloatTest("0x0.2p0F", 0x3e000000)); - x.add(new FloatTest("0x0.1p0F", 0x3d800000)); - x.add(new FloatTest("0x0.08p0F", 0x3d000000)); - x.add(new FloatTest("0x0.04p0F", 0x3c800000)); - x.add(new FloatTest("0x0.02p0F", 0x3c000000)); - x.add(new FloatTest("0x0.01p0F", 0x3b800000)); - x.add(new FloatTest("0x0.010p0F", 0x3b800000)); - x.add(new FloatTest("0x1p0F", 0x3f800000)); - x.add(new FloatTest("0x2p0F", 0x40000000)); - x.add(new FloatTest("0x4p0F", 0x40800000)); - x.add(new FloatTest("0x8p0F", 0x41000000)); - x.add(new FloatTest("0x10p0F", 0x41800000)); - x.add(new FloatTest("0x20p0F", 0x42000000)); - x.add(new FloatTest("0x40p0F", 0x42800000)); - x.add(new FloatTest("0x80p0F", 0x43000000)); - x.add(new FloatTest("0x80.p0F", 0x43000000)); - x.add(new FloatTest("0x80.8p0F", 0x43008000)); - x.add(new FloatTest("0x80.80p0F", 0x43008000)); - x.add(new FloatTest("0x123456789p0F", 0x4f91a2b4)); - x.add(new FloatTest("0xabcedfp0F", 0x4b2bcedf)); - x.add(new FloatTest("0xABCDEFp0F", 0x4b2bcdef)); - - x.add(new FloatTest("0x0.000000000000000000000000000001p0f", 0x3800000)); - x.add(new FloatTest("0x10000000000000000000000000000000p0f", 0x7d800000)); - - // rounding to 24 bits - x.add(new FloatTest("0x823456p0f", 0x4b023456)); - x.add(new FloatTest("0xFFFFFF80p0f", 0x4f800000)); - x.add(new FloatTest("0xFFFFFF40p0f", 0x4f7fffff)); - x.add(new FloatTest("0xFFFFFF20p0f", 0x4f7fffff)); - x.add(new FloatTest("0x123456p0f", 0x4991a2b0)); - x.add(new FloatTest("0x7890abp0f", 0x4af12156)); - x.add(new FloatTest("0xcdefABp0f", 0x4b4defab)); - x.add(new FloatTest("0xCDEFdep0f", 0x4b4defde)); - x.add(new FloatTest("0x123456p0f", 0x4991a2b0)); - x.add(new FloatTest("0x7FFFFF8p0f", 0x4cffffff)); - x.add(new FloatTest("0x3FFFFFCp0f", 0x4c7fffff)); - x.add(new FloatTest("0x1FFFFFEp0f", 0x4bffffff)); - - // rounding to overflow at +128; denormalized at -126; underflow at -150 - x.add(new FloatTest("0x1p5000F", 0x7f800000)); - x.add(new FloatTest("0x1p-5000F", 0x7fc00000)); - x.add(new FloatTest("0x1.0p126f", 0x7e800000)); - x.add(new FloatTest("0x1.0p127f", 0x7f000000)); - x.add(new FloatTest("0x1.0p128f", 0x7f800000)); - x.add(new FloatTest("0x1.0p129f", 0x7f800000)); - x.add(new FloatTest("0x1.0p-127f", 0x00400000)); - x.add(new FloatTest("0x1.0p-128f", 0x00200000)); - x.add(new FloatTest("0x1.0p-129f", 0x00100000)); - x.add(new FloatTest("0x1.0p-149f", 0x00000001)); - x.add(new FloatTest("0x1.0p-150f", 0x7fc00000)); - x.add(new FloatTest("0x1.0p-151f", 0x7fc00000)); - x.add(new FloatTest("0x0.8p127f", 0x7e800000)); - x.add(new FloatTest("0x0.8p128f", 0x7f000000)); - x.add(new FloatTest("0x0.8p129f", 0x7f800000)); - x.add(new FloatTest("0x0.8p-125f", 0x00800000)); - x.add(new FloatTest("0x0.8p-126f", 0x00400000)); - x.add(new FloatTest("0x0.8p-127f", 0x00200000)); - x.add(new FloatTest("0x0.8p-128f", 0x00100000)); - x.add(new FloatTest("0x0.8p-148f", 0x00000001)); - x.add(new FloatTest("0x0.8p-149f", 0x7fc00000)); - x.add(new FloatTest("0x0.8p-150f", 0x7fc00000)); - x.add(new FloatTest("0x0.4p-124f", 0x00800000)); - x.add(new FloatTest("0x0.4p-125f", 0x00400000)); - x.add(new FloatTest("0x0.4p-126f", 0x00200000)); - x.add(new FloatTest("0x0.4p-147f", 0x00000001)); - x.add(new FloatTest("0x0.4p-148f", 0x7fc00000)); - x.add(new FloatTest("0x0.4p-149f", 0x7fc00000)); - x.add(new FloatTest("0x0.4p-150f", 0x7fc00000)); - x.add(new FloatTest("0x0.2p-123f", 0x00800000)); - x.add(new FloatTest("0x0.2p-124f", 0x00400000)); - x.add(new FloatTest("0x0.2p-125f", 0x00200000)); - x.add(new FloatTest("0x0.2p-126f", 0x00100000)); - x.add(new FloatTest("0x0.2p-146f", 0x00000001)); - x.add(new FloatTest("0x0.2p-147f", 0x7fc00000)); - x.add(new FloatTest("0x0.2p-148f", 0x7fc00000)); - x.add(new FloatTest("0x0.2p-149f", 0x7fc00000)); - x.add(new FloatTest("0x0.1p-122f", 0x00800000)); - x.add(new FloatTest("0x0.1p-123f", 0x00400000)); - x.add(new FloatTest("0x0.1p-124f", 0x00200000)); - x.add(new FloatTest("0x0.1p-145f", 0x00000001)); - x.add(new FloatTest("0x0.1p-146f", 0x7fc00000)); - x.add(new FloatTest("0x0.1p-147f", 0x7fc00000)); - x.add(new FloatTest("0x0.1p-148f", 0x7fc00000)); - - for (Iterator it = x.iterator(); it.hasNext();) { - FloatTest t = (FloatTest) it.next(); - String s = t.input; - int expectedBits = t.output; - float libExpected = 0.0f; - boolean isJ2SE5; - try { - // note that next line only works with a 1.5 J2SE - libExpected = Float.parseFloat(s); - isJ2SE5 = true; - } catch(NumberFormatException e) { - isJ2SE5 = false; - } - float dActual = FloatUtil.valueOfHexFloatLiteral(s.toCharArray()); - long actualBits = Float.floatToIntBits(dActual); - if (isJ2SE5) { - // cross-check bits computed by J2SE 1.5 library - int libExpectedBits = Float.floatToRawIntBits(libExpected); - if (expectedBits != libExpectedBits) { - if (Float.isNaN(Float.intBitsToFloat(expectedBits)) && libExpected == 0.0f) { - // this is ok - we return NaN where lib quietly underflows to 0 - } else { - assertEquals("Test has wrong table value for " + s, libExpectedBits, expectedBits); - } - } - } - assertEquals("Wrong float value for " + s, expectedBits, actualBits); - } - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=74126 - */ - public void test003() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n" + - " public static void main(String[] args) {\n" + - " System.out.println(-0Xf.aP1F);\n" + - " }\n" + - "}" - }, - "-31.25"); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=74126 - */ - public void test004() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n" + - " public static void main(String[] args) {\n" + - " System.out.println(0X000.0000P5000);\n" + - " }\n" + - "}" - }, - "0.0"); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=74126 - */ - public void test005() { - this.runConformTest( - new String[] { - "X.java", - "public class X { \n" + - " public static void main(String[] args) {\n" + - " System.out.println(-0X000.0000P5000F);\n" + - " }\n" + - "}" - }, - "-0.0"); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=74126 - */ - public void test006() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n" + - " public static void main(String[] args) {\n" + - " System.out.println(0X000.eP-5000F);\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 3)\r\n" + - " System.out.println(0X000.eP-5000F);\r\n" + - " ^^^^^^^^^^^^^^\n" + - "The literal 0X000.eP-5000F of type float is out of range \n" + - "----------\n"); - } - - /* - * https://bugs.eclipse.org/bugs/show_bug.cgi?id=74126 - */ - public void test007() { - this.runNegativeTest( - new String[] { - "X.java", - "public class X { \n" + - " public static void main(String[] args) {\n" + - " System.out.println(0X000.eP5000F);\n" + - " }\n" + - "}" - }, - "----------\n" + - "1. ERROR in X.java (at line 3)\r\n" + - " System.out.println(0X000.eP5000F);\r\n" + - " ^^^^^^^^^^^^^\n" + - "The literal 0X000.eP5000F of type float is out of range \n" + - "----------\n"); - } -}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InternalScannerTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InternalScannerTest.java index c3985d1..3c7382e 100644 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InternalScannerTest.java +++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InternalScannerTest.java
@@ -20,9 +20,6 @@ public InternalScannerTest(String name) { super(name); } - public static Test suite() { - return buildAllCompliancesTestSuite(testClass()); - } public static Class testClass() { return InternalScannerTest.class;
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/JavadocBugsTest.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/JavadocBugsTest.java deleted file mode 100644 index 61c4459..0000000 --- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/JavadocBugsTest.java +++ /dev/null
@@ -1,5193 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 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: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.jsdt.core.tests.compiler.regression; - -import java.util.Map; - -import junit.framework.Test; - -import org.eclipse.wst.jsdt.internal.compiler.impl.CompilerOptions; - -public class JavadocBugsTest extends JavadocTest { - - String docCommentSupport = CompilerOptions.ENABLED; - String reportInvalidJavadoc = CompilerOptions.ERROR; - String reportInvalidJavadocVisibility = CompilerOptions.PRIVATE; - String reportMissingJavadocTags = CompilerOptions.ERROR; - String reportMissingJavadocComments = null; - String reportDeprecation = CompilerOptions.ERROR; - String reportJavadocDeprecation = null; - - public JavadocBugsTest(String name) { - super(name); - } - - public static Class javadocTestClass() { - return JavadocBugsTest.class; - } - - // Use this static initializer to specify subset for tests - // All specified tests which does not belong to the class are skipped... - static {