Major refactoring to introduce com.ibm.wala.ide. Many related changes and patches from Marcelo Paternostro.

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3694 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2009-06-22 15:06:37 +00:00
parent a0efbee8ff
commit e594278235
73 changed files with 17960 additions and 0 deletions

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala-feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,4 @@
bin.includes = feature.xml,\
feature.properties,\
license.html,\
notice.html

View File

@ -0,0 +1,22 @@
####################################################################
# IBM Confidential
# OCO Source Materials
# IBM Rational AppScan Developer Edition
# (c) Copyright IBM Corp. 2007 All Rights Reserved.
#
# The source code for this program is not published or otherwise
# divested of its trade secrets, irrespective of what has been
# deposited with the U.S. Copyright Office.
####################################################################
# NLS_ENCODING=UTF-8
# NLS_MESSAGEFORMAT_VAR
#
# Feature details
#
featureName = WALA Bundles
providerName = IBM
copyrightURL=notice.html
licenseURL=license.html

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.ibm.wala"
label="%featureName"
version="1.1.3.qualifier"
provider-name="%providerName">
<copyright url="%copyrightURL">
%copyright
</copyright>
<license url="%licenseURL">
%license
</license>
<plugin
id="com.ibm.wala.core"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.ibm.wala.shrike"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.ibm.wala.cast"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.ibm.wala.cast.java"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.ide-feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,4 @@
bin.includes = feature.xml,\
feature.properties,\
license.html,\
notice.html

View File

@ -0,0 +1,22 @@
####################################################################
# IBM Confidential
# OCO Source Materials
# IBM Rational AppScan Developer Edition
# (c) Copyright IBM Corp. 2007 All Rights Reserved.
#
# The source code for this program is not published or otherwise
# divested of its trade secrets, irrespective of what has been
# deposited with the U.S. Copyright Office.
####################################################################
# NLS_ENCODING=UTF-8
# NLS_MESSAGEFORMAT_VAR
#
# Feature details
#
featureName = WALA IDE Bundles
providerName = IBM
copyrightURL=notice.html
licenseURL=license.html

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.ibm.wala.ide"
label="%featureName"
version="1.1.3.qualifier"
provider-name="%providerName">
<copyright url="%copyrightURL">
%copyright
</copyright>
<license url="%licenseURL">
%license
</license>
<plugin
id="com.ibm.wala.ide"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.ibm.wala.cast.java.jdt"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.ide.tests</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,306 @@
#Mon Dec 01 16:45:26 EST 2008
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nullReference=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=1
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
org.eclipse.jdt.core.formatter.comment.line_length=132
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=132
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=2
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true

View File

@ -0,0 +1,5 @@
#Thu Jan 03 11:24:41 EST 2008
eclipse.preferences.version=1
formatter_profile=_WALA
formatter_settings_version=11
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true

View File

@ -0,0 +1,20 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: com.ibm.wala.ide.tests;singleton:=true
Bundle-Version: 1.1.3.qualifier
Bundle-Vendor: %providerName
Require-Bundle: org.junit,
com.ibm.wala.shrike,
com.ibm.wala.core,
com.ibm.wala.ide,
com.ibm.wala.core.tests,
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.jdt.core,
org.eclipse.ui,
org.eclipse.ui.ide
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Export-Package: com.ibm.wala.ide.tests.util

View File

@ -0,0 +1,6 @@
source.. = src/,
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
plugin.properties

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests/src/com/ibm/wala/examples/analysis/CountParameters.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.analysis.CountParameters"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-classpath c:/temp/testdata/JLex.jar"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M"/>
</launchConfiguration>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/ExportTypeHierarchyToXML.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.ExportTypeHierarchyToXML"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-classpath c:/temp/testdata/JLex.jar"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M"/>
</launchConfiguration>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.GetEnv"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests/src/com/ibm/wala/examples/analysis/GetLoadedFields.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.analysis.GetLoadedFields"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-classpath c:/temp/testdata/JLex.jar"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M"/>
</launchConfiguration>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
<stringAttribute key="application" value="com.ibm.wala.core.tests.HeadlessWALA"/>
<booleanAttribute key="askclear" value="true"/>
<booleanAttribute key="automaticAdd" value="true"/>
<booleanAttribute key="automaticValidate" value="false"/>
<stringAttribute key="bootstrap" value=""/>
<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="false"/>
<booleanAttribute key="clearws" value="false"/>
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/HeadlessWALA"/>
<booleanAttribute key="default" value="true"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/"/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-nosplash"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.eclipse.sdk.ide"/>
<stringAttribute key="templateConfig" value="${target_home}\configuration\config.ini"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
<booleanAttribute key="useDefaultConfigArea" value="true"/>
<booleanAttribute key="useProduct" value="false"/>
<booleanAttribute key="usefeatures" value="false"/>
</launchConfiguration>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFCallGraph.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.PDFCallGraph"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar ${workspace_loc}/JLex.jar"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M"/>
</launchConfiguration>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFControlDependenceGraph.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.PDFControlDependenceGraph"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar ${workspace_loc}/JLex.jar -sig java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx200M -verbose:gc"/>
</launchConfiguration>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFSDG.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.PDFSDG"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar ${workspace_loc}/com.ibm.wala.core.testdata/bin/com.ibm.wala.core.testdata_1.0.0.jar -mainClass &quot;Lslice/Slice4&quot; -srcCaller &quot;main&quot; -srcCallee &quot;foo&quot; -dd &quot;no_base_no_heap&quot; -cd &quot;none&quot; -dir &quot;forward&quot;"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M"/>
</launchConfiguration>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFSlice.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.PDFSlice"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar ${workspace_loc}/com.ibm.wala.core.testdata/bin/com.ibm.wala.core.testdata_1.0.0.jar -mainClass &quot;Lslice/Slice4&quot; -srcCaller &quot;main&quot; -srcCallee &quot;foo&quot; -dd &quot;no_base_no_heap&quot; -cd &quot;none&quot; -dir &quot;forward&quot;"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M -ea"/>
</launchConfiguration>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFTypeHierarchy.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.PDFTypeHierarchy"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-classpath ${workspace_loc}/JLex.jar"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx800M"/>
</launchConfiguration>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests/src/com/ibm/wala/examples/drivers/PDFWalaIR.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/ibm 60 sdk"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.PDFWalaIR"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar ${workspace_loc}/com.ibm.wala.core.testdata/bin/JLex.jar -sig java.lang.StringBuffer.append(Ljava/lang/String;)Ljava/lang/StringBuffer;"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx200M -verbose:gc"/>
</launchConfiguration>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.pde.ui.swtLaunchConfig">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.SWTCallGraph"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar c:/temp/javac.jar"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx800M -verbose:gc"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.pde.ui.swtLaunchConfig">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.SWTPointsTo"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-appJar c:/temp/testdata/java_cup.jar"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx500M -verbose:gc"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.examples.drivers.SWTTypeHierarchy"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-classpath ${workspace_loc}/JLex.jar"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx800M"/>
</launchConfiguration>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.ibm.wala.core.tests/src&lt;com.ibm.wala.core.tests.demandpa"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;com.ibm.wala.core.tests&quot; path=&quot;1&quot;

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE" value="/tmp/console.txt"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.ibm.wala.core.tests"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;com.ibm.wala.core.tests&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;com.ibm.wala.core.tests&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry path=&quot;3&quot; projectName=&quot;com.ibm.wala.core.testdata&quot; type=&quot;1&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.ibm.wala.core.testdata/bin&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.ibm.wala.core.testdata/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx800M -Dcom.ibm.wala.junit.profile=short -ea -Dcom.ibm.wala.fixedpoint.impl.verbose=true"/>
</launchConfiguration>

View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.debug.ui.ATTR_CAPTURE_IN_FILE" value="c:/temp/console"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.ibm.wala.core.tests"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;com.ibm.wala.core.tests&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;com.ibm.wala.core.tests&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry path=&quot;3&quot; projectName=&quot;com.ibm.wala.core.testdata&quot; type=&quot;1&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.ibm.wala.core.testdata/bin&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.ibm.wala.core.testdata/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx800M -Dcom.ibm.wala.junit.profile=short -ea -Dcom.ibm.wala.fixedpoint.impl.verbose=true"/>
</launchConfiguration>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.ibm.wala.core.tests"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="4"/>
</listAttribute>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.ibm.wala.core.tests"/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit3"/>
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;com.ibm.wala.core.tests&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#10;&lt;memento exportedEntriesOnly=&quot;false&quot; project=&quot;com.ibm.wala.core.tests&quot;/&gt;&#10;&lt;/runtimeClasspathEntry&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.ibm.wala.core.testdata/bin&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.ibm.wala.core.testdata/@dot&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/com.ibm.wala.core.testdata/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry path=&quot;3&quot; projectName=&quot;com.ibm.wala.core.testdata&quot; type=&quot;1&quot;/&gt;&#10;"/>
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.core.tests"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx800M -verbose:gc -Dcom.ibm.wala.util.fixedpoint.impl.verbose=true"/>
</launchConfiguration>

View File

@ -0,0 +1,2 @@
pluginName = IBM Wala Framework - Unit tests
providerName = IBM

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension id="HeadlessWALA"
point="org.eclipse.core.runtime.applications">
<application>
<run class="com.ibm.wala.eclipse.headless.Main"/>
</application>
</extension>
</plugin>

View File

@ -0,0 +1,44 @@
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation.
* 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 com.ibm.wala.eclipse.headless;
import java.util.Collection;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.jdt.core.IJavaProject;
import com.ibm.wala.ide.util.EclipseProjectPath;
import com.ibm.wala.ide.util.JdtUtil;
/**
* A dummy main class that runs WALA in a headless Eclipse platform.
*
* This is for expository purposes, and tests some WALA eclipse functionality.
*
* @author sjfink
*
*/
public class Main implements IApplication {
public Object start(IApplicationContext context) throws Exception {
Collection<IJavaProject> jp = JdtUtil.getWorkspaceJavaProjects();
for (IJavaProject p : jp) {
System.out.println(p);
EclipseProjectPath path = EclipseProjectPath.make(p);
System.out.println("Path: " + path);
}
return null;
}
public void stop() {
}
}

View File

@ -0,0 +1,140 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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 com.ibm.wala.examples.drivers;
import java.io.File;
import java.util.Properties;
import org.eclipse.jface.window.ApplicationWindow;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.examples.properties.WalaExamplesProperties;
import com.ibm.wala.ide.ui.SWTTreeViewer;
import com.ibm.wala.ide.ui.ViewIRAction;
import com.ibm.wala.ipa.callgraph.AnalysisCache;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.CallGraphStats;
import com.ibm.wala.ipa.callgraph.Entrypoint;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.GraphIntegrity;
import com.ibm.wala.util.graph.InferGraphRoots;
import com.ibm.wala.util.io.CommandLine;
import com.ibm.wala.util.io.FileProvider;
import com.ibm.wala.util.warnings.WalaException;
/**
*
* This application is a WALA client: it invokes an SWT TreeViewer to visualize
* a Call Graph
*
* @author sfink
*/
public class SWTCallGraph {
private final static boolean CHECK_GRAPH = false;
/**
* Usage: SWTCallGraph -appJar [jar file name]
*
* The "jar file name" should be something like
* "c:/temp/testdata/java_cup.jar"
*
* If it's a directory, then we'll try to find all jar files under that
* directory.
*
* @param args
* @throws WalaException
*/
public static void main(String[] args) throws WalaException {
Properties p = CommandLine.parse(args);
PDFCallGraph.validateCommandLine(p);
run(p);
}
/**
* @param p
* should contain at least the following properties:
* <ul>
* <li>appJar should be something like
* "c:/temp/testdata/java_cup.jar"
* <li>algorithm (optional) can be one of:
* <ul>
* <li> "ZERO_CFA" (default value)
* <li> "RTA"
* </ul>
* </ul>
*
* @throws WalaException
*/
public static ApplicationWindow run(Properties p) throws WalaException {
try {
String appJar = p.getProperty("appJar");
if (PDFCallGraph.isDirectory(appJar)) {
appJar = PDFCallGraph.findJarFiles(new String[] { appJar });
}
String exclusionFile = p.getProperty("exclusions");
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, exclusionFile != null ? new File(exclusionFile)
: FileProvider.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha);
AnalysisOptions options = new AnalysisOptions(scope, entrypoints);
// //
// build the call graph
// //
com.ibm.wala.ipa.callgraph.CallGraphBuilder builder = Util.makeZeroCFABuilder(options, new AnalysisCache(), cha, scope, null,
null);
CallGraph cg = builder.makeCallGraph(options,null);
System.out.println(CallGraphStats.getStats(cg));
if (CHECK_GRAPH) {
GraphIntegrity.check(cg);
}
Properties wp = null;
try {
wp = WalaProperties.loadProperties();
wp.putAll(WalaExamplesProperties.loadProperties());
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
String psFile = wp.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + PDFWalaIR.PDF_FILE;
String dotFile = wp.getProperty(WalaProperties.OUTPUT_DIR) + File.separatorChar + PDFTypeHierarchy.DOT_FILE;
String dotExe = wp.getProperty(WalaExamplesProperties.DOT_EXE);
String gvExe = wp.getProperty(WalaExamplesProperties.PDFVIEW_EXE);
// create and run the viewer
final SWTTreeViewer v = new SWTTreeViewer();
v.setGraphInput(cg);
v.setRootsInput(InferGraphRoots.inferRoots(cg));
v.getPopUpActions().add(new ViewIRAction(v, cg, psFile, dotFile, dotExe, gvExe));
v.run();
return v.getApplicationWindow();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}

View File

@ -0,0 +1,101 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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 com.ibm.wala.examples.drivers;
import java.io.IOException;
import java.util.Properties;
import org.eclipse.jface.window.ApplicationWindow;
import com.ibm.wala.analysis.pointers.BasicHeapGraph;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.ide.ui.SWTTreeViewer;
import com.ibm.wala.ipa.callgraph.AnalysisCache;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.Entrypoint;
import com.ibm.wala.ipa.callgraph.impl.Util;
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.util.CancelException;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.graph.InferGraphRoots;
import com.ibm.wala.util.io.CommandLine;
import com.ibm.wala.util.io.FileProvider;
import com.ibm.wala.util.warnings.WalaException;
/**
*
* This application is a WALA client: it invokes an SWT TreeViewer to visualize
* a Points-To solution
*
* @author sfink
*/
public class SWTPointsTo {
/**
* Usage: SWTPointsTo -appJar [jar file name] The "jar file name" should be
* something like "c:/temp/testdata/java_cup.jar"
*
* @param args
* @throws WalaException
*/
public static void main(String[] args) throws WalaException {
Properties p = CommandLine.parse(args);
PDFCallGraph.validateCommandLine(p);
run(p.getProperty("appJar"));
}
/**
* @param appJar
* should be something like "c:/temp/testdata/java_cup.jar"
*/
public static ApplicationWindow run(String appJar) {
try {
Graph<Object> g = buildPointsTo(appJar);
// create and run the viewer
final SWTTreeViewer v = new SWTTreeViewer();
v.setGraphInput(g);
v.setRootsInput(InferGraphRoots.inferRoots(g));
v.run();
return v.getApplicationWindow();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
public static Graph<Object> buildPointsTo(String appJar) throws WalaException, IllegalArgumentException, CancelException, IOException {
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(appJar, FileProvider.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
ClassHierarchy cha = ClassHierarchy.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha);
AnalysisOptions options = new AnalysisOptions(scope, entrypoints);
// //
// build the call graph
// //
com.ibm.wala.ipa.callgraph.CallGraphBuilder builder = Util.makeVanillaZeroOneCFABuilder(options, new AnalysisCache(),cha, scope, null, null);
CallGraph cg = builder.makeCallGraph(options,null);
PointerAnalysis pointerAnalysis = builder.getPointerAnalysis();
System.err.println(pointerAnalysis);
return new BasicHeapGraph(pointerAnalysis, cg);
}
}

View File

@ -0,0 +1,139 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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 com.ibm.wala.examples.drivers;
import java.util.Collection;
import org.eclipse.jface.window.ApplicationWindow;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.core.tests.callGraph.CallGraphTestUtil;
import com.ibm.wala.ide.ui.SWTTreeViewer;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.cha.ClassHierarchy;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.collections.CollectionFilter;
import com.ibm.wala.util.collections.Filter;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.graph.GraphSlicer;
import com.ibm.wala.util.graph.InferGraphRoots;
import com.ibm.wala.util.graph.impl.SlowSparseNumberedGraph;
import com.ibm.wala.util.io.FileProvider;
import com.ibm.wala.util.warnings.WalaException;
/**
* This is a simple example WALA application. It's neither efficient nor concise, but is intended to demonstrate some basic
* framework concepts.
*
* This application builds a type hierarchy visualizes it with an SWT {@link TreeViewer}.
*/
public class SWTTypeHierarchy {
// This example takes one command-line argument, so args[1] should be the "-classpath" parameter
final static int CLASSPATH_INDEX = 1;
/**
* Usage: SWTTypeHierarchy -classpath [classpath]
*/
public static void main(String[] args) {
// check that the command-line is kosher
validateCommandLine(args);
run(args[CLASSPATH_INDEX]);
}
public static ApplicationWindow run(String classpath) {
try {
AnalysisScope scope = AnalysisScopeReader.makeJavaBinaryAnalysisScope(classpath, FileProvider
.getFile(CallGraphTestUtil.REGRESSION_EXCLUSIONS));
// invoke WALA to build a class hierarchy
ClassHierarchy cha = ClassHierarchy.make(scope);
Graph<IClass> g = typeHierarchy2Graph(cha);
g = pruneForAppLoader(g);
// create and run the viewer
final SWTTreeViewer v = new SWTTreeViewer();
v.setGraphInput(g);
Collection<IClass> roots = InferGraphRoots.inferRoots(g);
if (roots.size() < 1) {
System.err.println("PANIC: roots.size()=" + roots.size());
System.exit(-1);
}
v.setRootsInput(roots);
v.run();
return v.getApplicationWindow();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* Return a view of an {@link IClassHierarchy} as a {@link Graph}, with edges from classes to immediate subtypes
*/
public static Graph<IClass> typeHierarchy2Graph(IClassHierarchy cha) throws WalaException {
Graph<IClass> result = SlowSparseNumberedGraph.make();
for (IClass c : cha) {
result.addNode(c);
}
for (IClass c : cha) {
for (IClass x : cha.getImmediateSubclasses(c)) {
result.addEdge(c, x);
}
if (c.isInterface()) {
for (IClass x : cha.getImplementors(c.getReference())) {
result.addEdge(c, x);
}
}
}
return result;
}
/**
* Restrict g to nodes from the Application loader
*/
static Graph<IClass> pruneForAppLoader(Graph<IClass> g) throws WalaException {
Filter<IClass> f = new Filter<IClass>() {
public boolean accepts(IClass c) {
return (c.getClassLoader().getReference().equals(ClassLoaderReference.Application));
}
};
return pruneGraph(g, f);
}
/**
* Remove from a graph g any nodes that are not accepted by a {@link Filter}
*/
public static <T> Graph<T> pruneGraph(Graph<T> g, Filter<T> f) throws WalaException {
Collection<T> slice = GraphSlicer.slice(g, f);
return GraphSlicer.prune(g, new CollectionFilter<T>(slice));
}
/**
* Validate that the command-line arguments obey the expected usage.
*
* Usage: args[0] : "-classpath" args[1] : String, a ";"-delimited class path
*
* @throws UnsupportedOperationException if command-line is malformed.
*/
static void validateCommandLine(String[] args) {
if (args.length < 2) {
throw new UnsupportedOperationException("must have at least 2 command-line arguments");
}
if (!args[0].equals("-classpath")) {
throw new UnsupportedOperationException("invalid command-line, args[0] should be -classpath, but is " + args[0]);
}
}
}

View File

@ -0,0 +1,151 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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 com.ibm.wala.ide.tests.util;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.util.List;
import java.util.zip.ZipException;
import java.util.zip.ZipFile;
import org.osgi.framework.Bundle;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.ui.dialogs.IOverwriteQuery;
import org.eclipse.ui.wizards.datatransfer.ImportOperation;
import org.eclipse.ui.wizards.datatransfer.ZipFileStructureProvider;
public class EclipseTestUtil {
@SuppressWarnings("unchecked")
public static void importZippedProject(Plugin plugin, String zipFileName, IProgressMonitor monitor) {
ZipFile zipFile = getZipFile(plugin, zipFileName);
ZipFileStructureProvider zp = new ZipFileStructureProvider(zipFile);
List children = zp.getChildren(zp.getRoot());
Object element = children.get(0);
String projectName = zp.getLabel(element);
createOpenProject(projectName);
importZipfile(zipFile, zp, monitor);
}
public static void createOpenProject(String projectName) {
IWorkspaceRoot root = getWorkspace();
IProject project = root.getProject(projectName);
try {
project.create(null);
project.open(null);
} catch (CoreException e) {
e.printStackTrace();
}
}
public static void destroyProject(String projectName) {
IWorkspaceRoot root = getWorkspace();
IProject project = root.getProject(projectName);
try {
project.delete(true, null);
} catch (CoreException e) {
e.printStackTrace();
}
}
protected static void importZipfile(ZipFile sourceZip, ZipFileStructureProvider provider, IProgressMonitor monitor) {
IPath containerPath = getWorkspacePath();
ImportOperation importOp = new ImportOperation(containerPath, provider.getRoot(), provider, new IOverwriteQuery() {
public String queryOverwrite(String pathString) {
return IOverwriteQuery.ALL;
}
});
importOp.setCreateContainerStructure(true);
importOp.setOverwriteResources(true);
try {
importOp.run(monitor);
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
try {
sourceZip.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public static File getTestDataFile(Plugin plugin, String filename) {
Bundle bundle = plugin.getBundle();
IPath path = new Path("testdata").append(filename);
URL url = FileLocator.find(bundle, path, null);
assert url != null;
try {
URL fileURL = FileLocator.toFileURL(url);
File file = new File(fileURL.getPath());
return file;
} catch (IOException e) {
reportException(e);
}
return null;
}
public static ZipFile getZipFile(Plugin plugin, String testArchive) {
File file = getTestDataFile(plugin, testArchive);
if (file != null) {
try {
return new ZipFile(file);
} catch (ZipException e) {
reportException(e);
} catch (IOException e) {
reportException(e);
}
}
return null;
}
public static IWorkspaceRoot getWorkspace() {
return ResourcesPlugin.getWorkspace().getRoot();
}
private static IPath getWorkspacePath() {
return ResourcesPlugin.getWorkspace().getRoot().getFullPath();
}
private static void reportException(Exception e) {
// TODO: add to appropriate error log? Report differently ??
e.printStackTrace();
}
public static IJavaProject getNamedProject(String projectName) {
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
IJavaModel javaModel = JavaCore.create(workspaceRoot);
IJavaProject helloWorldProject = javaModel.getJavaProject(projectName);
return helloWorldProject;
}
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,4 @@
build
shrike.jar
domo-trace.txt*
com.ibm.shrike_*.jar

28
com.ibm.wala.ide/.project Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.ide</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,22 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Eclipse-LazyStart: true
Bundle-Name: %pluginName
Bundle-SymbolicName: com.ibm.wala.ide
Bundle-Version: 1.1.3.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: com.ibm.wala.shrike,
com.ibm.wala.core,
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.jdt.core,
org.eclipse.pde.core,
org.eclipse.jface,
org.eclipse.ui
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: com.ibm.wala.ide,
com.ibm.wala.ide.classloader,
com.ibm.wala.ide.ui,
com.ibm.wala.ide.util

View File

@ -0,0 +1,6 @@
bin.includes = META-INF/,\
.,\
plugin.properties
jars.compile.order = .
source.. = src/
output.. = bin/

View File

@ -0,0 +1,7 @@
PLUGINNAME= WALA analysis engine - IDE support
VENDORNAME=IBM
providerName =IBM
# ====================================================================

View File

@ -0,0 +1,212 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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 com.ibm.wala.ide;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.progress.IProgressService;
import com.ibm.wala.classLoader.Module;
import com.ibm.wala.ide.util.EclipseProjectPath;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.debug.Assertions;
/**
* An Eclipse action that analyzes a Java selection
*/
public abstract class AbstractJavaAnalysisAction implements IObjectActionDelegate, IRunnableWithProgress {
/**
* The current {@link ISelection} highlighted in the Eclipse workspace
*/
private ISelection currentSelection;
public AbstractJavaAnalysisAction() {
super();
}
/*
* @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
*/
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
}
/**
* Compute an analysis scope for the current selection
*/
public static AnalysisScope computeScope(IStructuredSelection selection) throws IOException {
return computeScope(selection, false, true);
}
/**
* Compute an analysis scope for the current selection
* @param includeSource should files from the source folders in Eclipse projects be included
* @param includeClassFiles should class files built by Eclipse, in the project output folders, be include?
*/
public static AnalysisScope computeScope(final IStructuredSelection selection, final boolean includeSource,
final boolean includeClassFiles) throws IOException {
if (selection == null) {
throw new IllegalArgumentException("null selection");
}
final Collection<EclipseProjectPath> projectPaths = new LinkedList<EclipseProjectPath>();
Job job = new Job("Compute project paths") {
@Override
protected IStatus run(IProgressMonitor monitor) {
for (Iterator it = selection.iterator(); it.hasNext();) {
Object object = it.next();
if (object instanceof IJavaElement) {
IJavaElement e = (IJavaElement) object;
IJavaProject jp = e.getJavaProject();
try {
projectPaths.add(EclipseProjectPath.make(jp, includeSource, includeClassFiles));
} catch (CoreException e1) {
e1.printStackTrace();
// skip and continue
} catch (IOException e2) {
e2.printStackTrace();
return new Status(IStatus.ERROR, "", "", e2);
}
} else {
Assertions.UNREACHABLE(object.getClass());
}
}
return Status.OK_STATUS;
}
};
// lock the whole workspace
job.setRule(ResourcesPlugin.getWorkspace().getRoot());
job.schedule();
try {
job.join();
IStatus result = job.getResult();
if (result.getSeverity() == IStatus.ERROR) {
Throwable exception = result.getException();
if (exception instanceof IOException) {
throw (IOException)exception;
} else if (exception instanceof RuntimeException) {
throw (RuntimeException)exception;
}
}
} catch (InterruptedException e) {
e.printStackTrace();
assert false;
}
AnalysisScope scope = mergeProjectPaths(projectPaths);
return scope;
}
/**
* compute the java projects represented by the current selection
*/
protected Collection<IJavaProject> computeJavaProjects() {
IStructuredSelection selection = (IStructuredSelection) currentSelection;
Collection<IJavaProject> projects = HashSetFactory.make();
for (Iterator it = selection.iterator(); it.hasNext();) {
Object object = it.next();
if (object instanceof IJavaElement) {
IJavaElement e = (IJavaElement) object;
IJavaProject jp = e.getJavaProject();
projects.add(jp);
} else {
Assertions.UNREACHABLE(object.getClass());
}
}
return projects;
}
/**
* create an analysis scope as the union of a bunch of EclipseProjectPath
*/
private static AnalysisScope mergeProjectPaths(Collection<EclipseProjectPath> projectPaths) throws IOException {
AnalysisScope scope = AnalysisScope.createJavaAnalysisScope();
Collection<Module> seen = HashSetFactory.make();
// to avoid duplicates, we first add all application modules, then extension
// modules, then primordial
buildScope(ClassLoaderReference.Application, projectPaths, scope, seen);
buildScope(ClassLoaderReference.Extension, projectPaths, scope, seen);
buildScope(ClassLoaderReference.Primordial, projectPaths, scope, seen);
return scope;
}
/**
* Enhance an {@link AnalysisScope} to include in a particular loader, elements from a set of Eclipse projects
* @param loader the class loader in which new {@link Module}s will live
* @param projectPaths Eclipse project paths to add to the analysis scope
* @param scope the {@link AnalysisScope} under construction. This will be mutated.
* @param seen set of {@link Module}s which have already been seen, and should not be added to the analysis scope
*/
private static void buildScope(ClassLoaderReference loader, Collection<EclipseProjectPath> projectPaths, AnalysisScope scope,
Collection<Module> seen) throws IOException {
for (EclipseProjectPath path : projectPaths) {
AnalysisScope pScope = path.toAnalysisScope((File) null);
for (Module m : pScope.getModules(loader)) {
if (!seen.contains(m)) {
seen.add(m);
scope.addToScope(loader, m);
}
}
}
}
/*
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
IProgressService progressService = PlatformUI.getWorkbench().getProgressService();
try {
progressService.busyCursorWhile(this);
} catch (InvocationTargetException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/*
* @see IActionDelegate#selectionChanged(IAction, ISelection)
*/
public void selectionChanged(IAction action, ISelection selection) {
currentSelection = selection;
}
/**
* @return The current {@link ISelection} highlighted in the Eclipse workspace
*/
public ISelection getCurrentSelection() {
return currentSelection;
}
}

View File

@ -0,0 +1,54 @@
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation.
* 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 com.ibm.wala.ide.classloader;
import java.io.File;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import com.ibm.wala.classLoader.FileModule;
import com.ibm.wala.classLoader.SourceDirectoryTreeModule;
import com.ibm.wala.ide.util.EclipseProjectPath;
public class EclipseSourceDirectoryTreeModule extends SourceDirectoryTreeModule {
private final IPath rootIPath;
public EclipseSourceDirectoryTreeModule(IPath root) {
super(EclipseProjectPath.makeAbsolute(root).toFile());
this.rootIPath = root;
}
public EclipseSourceDirectoryTreeModule(IPath root, String fileExt) {
super(EclipseProjectPath.makeAbsolute(root).toFile(), fileExt);
this.rootIPath = root;
}
@Override
protected FileModule makeFile(File file) {
IPath p = rootIPath.append(file.getPath().substring(root.getPath().length()));
IWorkspace ws = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = ws.getRoot();
IFile ifile = root.getFile(p);
assert ifile.exists();
return EclipseSourceFileModule.createEclipseSourceFileModule(ifile);
}
@Override
public String toString() {
return "EclipseSourceDirectoryTreeModule:" + rootIPath;
}
}

View File

@ -0,0 +1,44 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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 com.ibm.wala.ide.classloader;
import java.io.File;
import org.eclipse.core.resources.IFile;
import com.ibm.wala.classLoader.SourceFileModule;
/**
* A module which is a wrapper around a .java file
*/
public class EclipseSourceFileModule extends SourceFileModule {
private IFile f;
public static EclipseSourceFileModule createEclipseSourceFileModule(IFile f) {
if (f == null) {
throw new IllegalArgumentException("null f");
}
return new EclipseSourceFileModule(f);
}
private EclipseSourceFileModule(IFile f) {
super(new File(f.getLocation().toOSString()),f.getLocation().lastSegment());
this.f = f;
}
public IFile getIFile() {
return f;
}
@Override
public String toString() {
return "EclipseSourceFileModule:" + getFile().toString();
}
}

View File

@ -0,0 +1,57 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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 com.ibm.wala.ide.ui;
import org.eclipse.jface.window.ApplicationWindow;
/**
* abstract base class for launching a JFace application
*
* TODO: unify with other launchers?
*/
public abstract class AbstractJFaceRunner {
protected ApplicationWindow applicationWindow = null;
protected boolean blockInput = false;
protected AbstractJFaceRunner() {
super();
}
public ApplicationWindow getApplicationWindow() {
return applicationWindow;
}
public void setApplicationWindow(ApplicationWindow newApplicationWindow) {
applicationWindow = newApplicationWindow;
}
public boolean isBlockInput() {
return blockInput;
}
public void setBlockInput(boolean newBlockInput) {
blockInput = newBlockInput;
}
@Override
public String toString() {
StringBuffer result = new StringBuffer(super.toString());
result.append(" (applicationWindow: ");
result.append(applicationWindow);
result.append(", blockInput: ");
result.append(blockInput);
result.append(')');
return result.toString();
}
}

View File

@ -0,0 +1,126 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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 com.ibm.wala.ide.ui;
import java.io.File;
import java.util.Collection;
import java.util.Properties;
import com.ibm.wala.dataflow.IFDS.TabulationResult;
import com.ibm.wala.properties.WalaProperties;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.graph.InferGraphRoots;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.viz.DotUtil;
import com.ibm.wala.viz.NodeDecorator;
/**
* Explore the result of an IFDS problem with an SWT viewer and ghostview.
*/
public class IFDSExplorer {
/**
* absolute path name to invoke dot
*/
protected static String dotExe = null;
/**
* Absolute path name to invoke viewer
*/
protected static String viewerExe = null;
private static final boolean PRINT_DOMAIN = true;
public static void setDotExe(String newDotExe) {
dotExe = newDotExe;
}
public static void setGvExe(String newGvExe) {
viewerExe = newGvExe;
}
public static <T, P, F> void viewIFDS(TabulationResult<T, P, F> r, Collection<? extends P> roots) throws WalaException {
viewIFDS(r, roots, null);
}
public static <T, P, F> void viewIFDS(TabulationResult<T, P, F> r, Collection<? extends P> roots, NodeDecorator labels)
throws WalaException {
Properties p = null;
try {
p = WalaProperties.loadProperties();
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
String scratch = p.getProperty(WalaProperties.OUTPUT_DIR);
viewIFDS(r, roots, labels, scratch);
}
public static <T, P, F> void viewIFDS(TabulationResult<T, P, F> r, Collection<? extends P> roots, NodeDecorator labels,
String scratchDirectory) throws WalaException {
if (r == null) {
throw new IllegalArgumentException("r is null");
}
assert dotExe != null;
// dump the domain to stderr
if (PRINT_DOMAIN) {
System.err.println("Domain:\n" + r.getProblem().getDomain().toString());
}
String irFileName = null;
switch (DotUtil.getOutputType()) {
case PDF:
irFileName = "ir.pdf";
break;
case PS:
irFileName = "ir.ps";
break;
case SVG:
irFileName = "ir.svg";
break;
}
String outputFile = scratchDirectory + File.separatorChar + irFileName;
String dotFile = scratchDirectory + File.separatorChar + "ir.dt";
final SWTTreeViewer v = new SWTTreeViewer();
Graph<? extends P> g = r.getProblem().getSupergraph().getProcedureGraph();
v.setGraphInput(g);
v.setBlockInput(true);
v.setRootsInput(roots);
ViewIFDSLocalAction<T, P, F> action = (labels == null ? new ViewIFDSLocalAction<T, P, F>(v, r, outputFile, dotFile, dotExe,
viewerExe) : new ViewIFDSLocalAction<T, P, F>(v, r, outputFile, dotFile, dotExe, viewerExe, labels));
v.getPopUpActions().add(action);
v.run();
}
/**
* Calls {@link #viewIFDS(TabulationResult)} with roots computed by {@link InferGraphRoots}.
*/
public static <T, P, F> void viewIFDS(TabulationResult<T, P, F> r) throws WalaException {
if (r == null) {
throw new IllegalArgumentException("null r");
}
Collection<? extends P> roots = InferGraphRoots.inferRoots(r.getProblem().getSupergraph().getProcedureGraph());
viewIFDS(r, roots);
}
public static String getDotExe() {
return dotExe;
}
public static String getGvExe() {
return viewerExe;
}
}

View File

@ -0,0 +1,293 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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 com.ibm.wala.ide.ui;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
import com.ibm.wala.util.PlatformUtil;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.viz.NodeDecorator;
/**
*/
public class SWTTreeViewer extends AbstractJFaceRunner {
protected Graph graphInput;
protected Collection<? extends Object> rootsInput = null;
protected NodeDecorator nodeDecoratorInput = null;
final protected List<IAction> popUpActions = new LinkedList<IAction>();
public SWTTreeViewer() {
super();
}
public Graph getGraphInput() {
return graphInput;
}
public void setGraphInput(Graph newGraphInput) {
graphInput = newGraphInput;
}
public Collection<? extends Object> getRootsInput() {
return rootsInput;
}
public void setRootsInput(Collection<? extends Object> newRootsInput) {
rootsInput = newRootsInput;
}
public NodeDecorator getNodeDecoratorInput() {
return nodeDecoratorInput;
}
public void setNodeDecoratorInput(NodeDecorator newNodeDecoratorInput) {
nodeDecoratorInput = newNodeDecoratorInput;
}
public List<IAction> getPopUpActions() {
return popUpActions;
}
@Override
public String toString() {
StringBuffer result = new StringBuffer(super.toString());
result.append(", graphInput: ");
result.append(graphInput);
result.append(", rootsInput: ");
result.append(rootsInput);
result.append(", NodeDecoratorInput: ");
result.append(nodeDecoratorInput);
result.append(", popUpActions: ");
result.append(popUpActions);
result.append(')');
return result.toString();
}
public void run() throws WalaException {
if (getRootsInput() == null) {
throw new WalaException("null roots input in " + getClass());
}
final ApplicationWindow w = new GraphViewer(getGraphInput());
setApplicationWindow(w);
w.setBlockOnOpen(true);
if (PlatformUI.isWorkbenchRunning()) {
// run the code on the UI thread
Display d = PlatformUI.getWorkbench().getDisplay();
Runnable r = new Runnable() {
public void run() {
try {
w.open();
} catch (Exception e) {
e.printStackTrace();
}
}
};
if (isBlockInput()) {
d.syncExec(r);
} else {
d.asyncExec(r);
}
} else {
if (PlatformUtil.onMacOSX()) {
// the Mac does not like running the Window code in another thread
// side-effect: we always block input on Mac
w.open();
Display.getCurrent().dispose();
} else {
Runnable r = new Runnable() {
public void run() {
w.open();
Display.getCurrent().dispose();
}
};
Thread t = new Thread(r);
t.start();
if (isBlockInput()) {
try {
t.join();
} catch (InterruptedException e) {
throw new WalaException("unexpected interruption", e);
}
}
}
}
}
/**
* @throws IllegalStateException
*/
public IStructuredSelection getSelection() throws IllegalStateException {
GraphViewer viewer = (GraphViewer) getApplicationWindow();
if (viewer == null || viewer.treeViewer == null) {
throw new IllegalStateException();
}
return (IStructuredSelection) viewer.treeViewer.getSelection();
}
/**
* @author sfink
*
* An SWT window to visualize a graph
*/
private class GraphViewer extends ApplicationWindow {
/**
* Graph to visualize
*/
private final Graph graph;
/**
* JFace component implementing the tree viewer
*/
private TreeViewer treeViewer;
/**
* @throws WalaException
*/
public GraphViewer(Graph graph) throws WalaException {
super(null);
this.graph = graph;
if (graph == null) {
throw new WalaException("null graph for SWT viewer");
}
}
/*
* @see org.eclipse.jface.window.Window#createContents(org.eclipse.swt.widgets.Composite)
*/
@Override
protected Control createContents(Composite parent) {
treeViewer = new TreeViewer(parent);
treeViewer.setContentProvider(new GraphContentProvider());
treeViewer.setLabelProvider(new GraphLabelProvider());
treeViewer.setInput(getGraphInput());
// create a pop-up menu
if (getPopUpActions().size() > 0) {
MenuManager mm = new MenuManager();
treeViewer.getTree().setMenu(mm.createContextMenu(treeViewer.getTree()));
for (Iterator<IAction> it = getPopUpActions().iterator(); it.hasNext();) {
mm.add(it.next());
}
}
return treeViewer.getTree();
}
/**
* @author sfink
*
* Simple wrapper around an EObjectGraph to provide content for a tree viewer.
*/
private class GraphContentProvider implements ITreeContentProvider {
/*
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
public void dispose() {
// do nothing for now
}
/*
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer,
* java.lang.Object, java.lang.Object)
*/
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
// for now do nothing, since we're not dealing with listeners
}
/*
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
*/
@SuppressWarnings("unchecked")
public Object[] getChildren(Object parentElement) {
Object[] result = new Object[graph.getSuccNodeCount(parentElement)];
int i = 0;
for (Iterator it = graph.getSuccNodes(parentElement); it.hasNext();) {
result[i++] = it.next();
}
return result;
}
/*
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
*/
public Object getParent(Object element) {
// TODO Auto-generated method stub
Assertions.UNREACHABLE();
return null;
}
/*
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
*/
@SuppressWarnings("unchecked")
public boolean hasChildren(Object element) {
return graph.getSuccNodeCount(element) > 0;
}
/*
* @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
*/
public Object[] getElements(Object inputElement) {
Collection<? extends Object> roots = getRootsInput();
Assertions.productionAssertion(roots != null);
Assertions.productionAssertion(roots.size() >= 1);
return roots.toArray();
}
}
/**
* Simple graph label provider. TODO: finish this implementation.
*/
private class GraphLabelProvider extends LabelProvider {
final NodeDecorator d = getNodeDecoratorInput();
@Override
public String getText(Object element) {
try {
return (d == null) ? super.getText(element) : d.getLabel(element);
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
return null;
}
}
}
}
}

View File

@ -0,0 +1,233 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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 com.ibm.wala.ide.ui;
import java.util.Iterator;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.IStructuredSelection;
import com.ibm.wala.dataflow.IFDS.ISupergraph;
import com.ibm.wala.dataflow.IFDS.TabulationResult;
import com.ibm.wala.ipa.cfg.BasicBlockInContext;
import com.ibm.wala.ssa.SSAAbstractInvokeInstruction;
import com.ibm.wala.ssa.SSAGetInstruction;
import com.ibm.wala.ssa.SSAInstruction;
import com.ibm.wala.ssa.SSAPhiInstruction;
import com.ibm.wala.ssa.analysis.IExplodedBasicBlock;
import com.ibm.wala.util.collections.Filter;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.graph.Graph;
import com.ibm.wala.util.graph.GraphSlicer;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.viz.DotUtil;
import com.ibm.wala.viz.NodeDecorator;
import com.ibm.wala.viz.PDFViewUtil;
/**
* An SWT action that spawns spawns a ghostview to see the local supergraph for a procedure node which is the current selection in a
* tree viewer.
*
* @author sfink
*/
public class ViewIFDSLocalAction<T, P, F> extends Action {
/**
* Governing tree viewer
*/
private final SWTTreeViewer viewer;
/**
* Governing supergraph
*/
private final ISupergraph<T, P> supergraph;
/**
* name of PDF file to generate
*/
private final String pdfFile;
/**
* name of dot file to generate
*/
private final String dotFile;
/**
* path to dot.exe
*/
private final String dotExe;
/**
* path to pdf view executable
*/
private final String pdfViewExe;
private final NodeDecorator labels;
public ViewIFDSLocalAction(SWTTreeViewer viewer, TabulationResult<T, P, F> result, String pdfFile, String dotFile, String dotExe,
String pdfViewExe, NodeDecorator labels) {
if (result == null) {
throw new IllegalArgumentException("null result");
}
this.viewer = viewer;
this.supergraph = result.getProblem().getSupergraph();
this.pdfFile = pdfFile;
this.dotFile = dotFile;
this.dotExe = dotExe;
this.pdfViewExe = pdfViewExe;
this.labels = labels;
setText("View Local Supergraph");
}
public ViewIFDSLocalAction(SWTTreeViewer viewer, TabulationResult<T, P, F> result, String psFile, String dotFile, String dotExe,
String gvExe) {
if (result == null) {
throw new IllegalArgumentException("null result");
}
this.viewer = viewer;
this.supergraph = result.getProblem().getSupergraph();
this.pdfFile = psFile;
this.dotFile = dotFile;
this.dotExe = dotExe;
this.pdfViewExe = gvExe;
this.labels = new Labels<T, P, F>(result);
setText("View Local Supergraph");
}
private static class Labels<T, P, F> implements NodeDecorator {
private TabulationResult<T, P, F> result;
Labels(TabulationResult<T, P, F> result) {
this.result = result;
}
@SuppressWarnings("unchecked")
public String getLabel(Object o) throws WalaException {
T t = (T) o;
if (t instanceof BasicBlockInContext) {
BasicBlockInContext bb = (BasicBlockInContext) t;
if (bb.getDelegate() instanceof IExplodedBasicBlock) {
IExplodedBasicBlock delegate = (IExplodedBasicBlock) bb.getDelegate();
String s = delegate.getNumber() + " " + result.getResult(t) + "\\n" + stringify(delegate.getInstruction());
for (Iterator<SSAPhiInstruction> phis = delegate.iteratePhis(); phis.hasNext();) {
SSAPhiInstruction phi = phis.next();
s += " " + phi;
}
if (delegate.isCatchBlock()) {
s += " " + delegate.getCatchInstruction();
}
return s;
}
}
return t + " " + result.getResult(t);
}
}
/**
* Print a short-ish representation of s as a String
*/
public static String stringify(SSAInstruction s) {
if (s == null) {
return null;
}
if (s instanceof SSAAbstractInvokeInstruction) {
SSAAbstractInvokeInstruction call = (SSAAbstractInvokeInstruction) s;
String def = call.hasDef() ? Integer.valueOf(call.getDef()) + "=" : "";
String result = def + "call " + call.getDeclaredTarget().getDeclaringClass().getName().getClassName() + "."
+ call.getDeclaredTarget().getName();
result += " exc:" + call.getException();
for (int i = 0; i < s.getNumberOfUses(); i++) {
result += " ";
result += s.getUse(i);
}
return result;
}
if (s instanceof SSAGetInstruction) {
SSAGetInstruction g = (SSAGetInstruction) s;
String fieldName = g.getDeclaredField().getName().toString();
StringBuffer result = new StringBuffer();
result.append(g.getDef());
result.append(":=");
result.append(g.isStatic() ? "getstatic " : "getfield ");
result.append(fieldName);
if (!g.isStatic()) {
result.append(" ");
result.append(g.getUse(0));
}
return result.toString();
}
return s.toString();
}
/*
* @see org.eclipse.jface.action.IAction#run()
*/
@Override
public void run() {
try {
final P proc = getProcedureForSelection();
Filter<T> filter = new Filter<T>() {
public boolean accepts(T o) {
return supergraph.getProcOf(o).equals(proc);
}
};
Graph<T> localGraph = GraphSlicer.prune(supergraph, filter);
// spawn the viewer
System.err.println("Spawn Viewer for " + proc);
DotUtil.dotify(localGraph, labels, dotFile, pdfFile, dotExe);
if (DotUtil.getOutputType() == DotUtil.DotOutputType.PDF) {
PDFViewUtil.launchPDFView(pdfFile, pdfViewExe);
}
} catch (WalaException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
}
}
@SuppressWarnings("unchecked")
protected P getProcedureForSelection() {
// we assume the tree viewer's current selection is a P
IStructuredSelection selection = viewer.getSelection();
if (selection.size() != 1) {
throw new UnsupportedOperationException("did not expect selection of size " + selection.size());
}
P first = (P) selection.getFirstElement();
return first;
}
protected SWTTreeViewer getViewer() {
return viewer;
}
protected ISupergraph<T, P> getSupergraph() {
return supergraph;
}
protected String getDotExe() {
return dotExe;
}
protected String getDotFile() {
return dotFile;
}
protected String getGvExe() {
return pdfViewExe;
}
protected String getPsFile() {
return pdfFile;
}
}

View File

@ -0,0 +1,138 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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 com.ibm.wala.ide.ui;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.IStructuredSelection;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ssa.IR;
import com.ibm.wala.util.warnings.WalaException;
import com.ibm.wala.viz.PDFViewUtil;
/**
* An SWT action that spawns spawns a ghostview to see the IR for a call graph node which is the current selection in a tree viewer.
*/
public class ViewIRAction extends Action {
/**
* Governing tree viewer
*/
private final SWTTreeViewer viewer;
/**
* Governing call graph
*/
private final CallGraph cg;
/**
* name of postscript file to generate
*/
private final String psFile;
/**
* name of dot file to generate
*/
private final String dotFile;
/**
* path to dot.exe
*/
private final String dotExe;
/**
* path to ghostview executable
*/
private final String gvExe;
/**
* @param viewer Governing tree viewer
* @param cg Governing call graph
*/
public ViewIRAction(SWTTreeViewer viewer, CallGraph cg, String psFile, String dotFile, String dotExe, String gvExe) {
if (viewer == null) {
throw new IllegalArgumentException("null viewer");
}
this.viewer = viewer;
this.cg = cg;
this.psFile = psFile;
this.dotFile = dotFile;
this.dotExe = dotExe;
this.gvExe = gvExe;
setText("View IR");
}
/**
* @see org.eclipse.jface.action.IAction#run()
*
* @throws IllegalStateException if the viewer is not running
*/
@Override
public void run() {
IR ir = getIRForSelection();
// spawn the viewer
System.err.println("Spawn IR Viewer for " + ir.getMethod());
try {
PDFViewUtil.ghostviewIR(cg.getClassHierarchy(), ir, psFile, dotFile, dotExe, gvExe);
} catch (WalaException e) {
e.printStackTrace();
}
}
/**
* @throws IllegalStateException if the viewer is not running
*/
protected IR getIRForSelection() {
// we assume the tree viewer's current selection is a CGNode
IStructuredSelection selection = viewer.getSelection();
if (selection.size() != 1) {
throw new UnsupportedOperationException("did not expect selection of size " + selection.size());
}
CGNode first = (CGNode) selection.getFirstElement();
// get the IR for the node
return first.getIR();
}
protected CGNode getNodeForSelection() {
// we assume the tree viewer's current selection is a CGNode
IStructuredSelection selection = viewer.getSelection();
if (selection.size() != 1) {
throw new UnsupportedOperationException("did not expect selection of size " + selection.size());
}
CGNode first = (CGNode) selection.getFirstElement();
return first;
}
protected SWTTreeViewer getViewer() {
return viewer;
}
protected CallGraph getCg() {
return cg;
}
protected String getDotExe() {
return dotExe;
}
protected String getDotFile() {
return dotFile;
}
protected String getGvExe() {
return gvExe;
}
protected String getPsFile() {
return psFile;
}
}

View File

@ -0,0 +1,408 @@
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation.
* 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 com.ibm.wala.ide.util;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.jar.JarFile;
import java.util.zip.ZipException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IClasspathContainer;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.pde.core.plugin.IPluginModelBase;
import org.eclipse.pde.internal.core.ClasspathUtilCore;
import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.internal.core.PDEStateHelper;
import com.ibm.wala.classLoader.BinaryDirectoryTreeModule;
import com.ibm.wala.classLoader.JarFileModule;
import com.ibm.wala.classLoader.Module;
import com.ibm.wala.client.AbstractAnalysisEngine;
import com.ibm.wala.ide.classloader.EclipseSourceDirectoryTreeModule;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.collections.HashSetFactory;
import com.ibm.wala.util.collections.MapUtil;
import com.ibm.wala.util.config.AnalysisScopeReader;
import com.ibm.wala.util.debug.Assertions;
/**
* Representation of an analysis scope from an Eclipse project.
*
* We set up classloaders as follows:
* <ul>
* <li>The project being analyzed is in the Application Loader
* <li>Projects on which the main project depends are in the Extension loader
* <li>System libraries are in the primordial loader.
* <li>Source modules go in a special Source loader.
* </ul>
*/
@SuppressWarnings("restriction")
public class EclipseProjectPath {
/**
* Eclipse projects are modelled with 3 loaders, as described above.
*/
public enum Loader {
APPLICATION(ClassLoaderReference.Application), EXTENSION(ClassLoaderReference.Extension), PRIMORDIAL(
ClassLoaderReference.Primordial);
private ClassLoaderReference ref;
Loader(ClassLoaderReference ref) {
this.ref = ref;
}
};
/**
* The project whose path this object represents
*/
private final IJavaProject project;
/**
* names of OSGi bundles already processed.
*/
private final Set<String> bundlesProcessed = HashSetFactory.make();
// SJF: Intentionally do not use HashMapFactory, since the Loader keys in the following must use
// identityHashCode. TODO: fix this source of non-determinism?
private final Map<Loader, List<Module>> modules = new HashMap<Loader, List<Module>>();
/**
* Classpath entries that have already been resolved and added to the scope.
*/
private final Collection<IClasspathEntry> alreadyResolved = HashSetFactory.make();
/**
* Should the analysis scope include source files
*/
private final boolean includeSource;
/**
* Should the analysis scope include class files generated by the Eclipse build process?
*/
private final boolean includeClassFiles;
protected EclipseProjectPath(IJavaProject project, boolean includeSource, boolean includeClassFiles) throws IOException,
CoreException {
if (project == null) {
throw new IllegalArgumentException("null project");
}
this.includeSource = includeSource;
this.includeClassFiles = includeClassFiles;
this.project = project;
assert project != null;
for (Loader loader : Loader.values()) {
MapUtil.findOrCreateList(modules, loader);
}
resolveProjectClasspathEntries(includeSource);
if (isPluginProject(project)) {
resolvePluginClassPath(project.getProject(), includeSource);
}
}
public static EclipseProjectPath make(IJavaProject project) throws IOException, CoreException {
return make(project, false, true);
}
public static EclipseProjectPath make(IJavaProject project, boolean includeSource, boolean includeClassFiles) throws IOException,
CoreException {
return new EclipseProjectPath(project, includeSource, includeClassFiles);
}
/**
* Figure out what a classpath entry means and add it to the appropriate set of modules
*/
private void resolveClasspathEntry(IClasspathEntry entry, Loader loader, boolean includeSource) throws JavaModelException,
IOException {
IClasspathEntry e = JavaCore.getResolvedClasspathEntry(entry);
if (alreadyResolved.contains(e)) {
return;
} else {
alreadyResolved.add(e);
}
if (e.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
IClasspathContainer cont = JavaCore.getClasspathContainer(entry.getPath(), project);
IClasspathEntry[] entries = cont.getClasspathEntries();
resolveClasspathEntries(entries, cont.getKind() == IClasspathContainer.K_APPLICATION ? loader : Loader.PRIMORDIAL,
includeSource);
} else if (e.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
File file = makeAbsolute(e.getPath()).toFile();
JarFile j;
try {
j = new JarFile(file);
} catch (ZipException z) {
// a corrupted file. ignore it.
return;
} catch (FileNotFoundException z) {
// should ignore directories as well..
return;
}
if (isPrimordialJarFile(j)) {
List<Module> s = MapUtil.findOrCreateList(modules, loader);
s.add(file.isDirectory() ? (Module) new BinaryDirectoryTreeModule(file) : (Module) new JarFileModule(j));
}
} else if (e.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
List<Module> s = MapUtil.findOrCreateList(modules, loader);
if (includeSource) {
s.add(new EclipseSourceDirectoryTreeModule(e.getPath()));
}
if (e.getOutputLocation() != null) {
File output = makeAbsolute(e.getOutputLocation()).toFile();
s = MapUtil.findOrCreateList(modules, loader);
s.add(new BinaryDirectoryTreeModule(output));
}
} else if (e.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
IPath projectPath = makeAbsolute(e.getPath());
IWorkspace ws = ResourcesPlugin.getWorkspace();
IWorkspaceRoot root = ws.getRoot();
IProject project = (IProject) root.getContainerForLocation(projectPath);
try {
if (project.hasNature(JavaCore.NATURE_ID)) {
IJavaProject javaProject = JavaCore.create(project);
if (isPluginProject(javaProject)) {
resolvePluginClassPath(javaProject.getProject(), includeSource);
}
resolveClasspathEntries(javaProject.getRawClasspath(), loader, includeSource);
File output = makeAbsolute(javaProject.getOutputLocation()).toFile();
List<Module> s = MapUtil.findOrCreateList(modules, loader);
s.add(new BinaryDirectoryTreeModule(output));
}
} catch (CoreException e1) {
e1.printStackTrace();
Assertions.UNREACHABLE();
}
} else {
throw new RuntimeException("unexpected entry " + e);
}
}
/**
* traverse the bundle description for an Eclipse project and populate the analysis scope accordingly
*/
private void resolvePluginClassPath(IProject p, boolean includeSource) throws CoreException, IOException {
IPluginModelBase model = findModel(p);
if (!model.isInSync() || model.isDisposed()) {
model.load();
}
BundleDescription bd = model.getBundleDescription();
if (bd == null) {
// temporary debugging code; remove once we figure out what the heck is going on here --MS
System.err.println("model.isDisposed(): " + model.isDisposed());
System.err.println("model.isInSync(): " + model.isInSync());
System.err.println("model.isEnabled(): " + model.isEnabled());
System.err.println("model.isLoaded(): " + model.isLoaded());
System.err.println("model.isValid(): " + model.isValid());
}
for (int i = 0; i < 3 && bd == null; i++) {
// Uh oh. bd is null. Go to sleep, cross your fingers, and try again.
// This is horrible. We can't figure out the race condition yet which causes this to happen.
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// whatever.
}
bd = findModel(p).getBundleDescription();
}
if (bd == null) {
throw new IllegalStateException("bundle description was null for " + p);
}
resolveBundleDescriptionClassPath(bd, Loader.APPLICATION, includeSource);
}
/**
* traverse a bundle description and populate the analysis scope accordingly
*/
private void resolveBundleDescriptionClassPath(BundleDescription bd, Loader loader, boolean includeSource) throws CoreException,
IOException {
assert bd != null;
if (alreadyProcessed(bd)) {
return;
}
bundlesProcessed.add(bd.getName());
// handle the classpath entries for bd
ArrayList l = new ArrayList();
ClasspathUtilCore.addLibraries(findModel(bd), l);
IClasspathEntry[] entries = new IClasspathEntry[l.size()];
int i = 0;
for (Object o : l) {
IClasspathEntry e = (IClasspathEntry) o;
entries[i++] = e;
}
resolveClasspathEntries(entries, loader, includeSource);
// recurse to handle dependencies. put these in the Extension loader
for (BundleDescription b : PDEStateHelper.getImportedBundles(bd)) {
resolveBundleDescriptionClassPath(b, Loader.EXTENSION, includeSource);
}
for (BundleDescription b : bd.getResolvedRequires()) {
resolveBundleDescriptionClassPath(b, Loader.EXTENSION, includeSource);
}
for (BundleDescription b : bd.getFragments()) {
resolveBundleDescriptionClassPath(b, Loader.EXTENSION, includeSource);
}
}
/**
* have we already processed a particular bundle description?
*/
private boolean alreadyProcessed(BundleDescription bd) {
return bundlesProcessed.contains(bd.getName());
}
/**
* Is javaProject a plugin project?
*/
private boolean isPluginProject(IJavaProject javaProject) {
IPluginModelBase model = findModel(javaProject.getProject());
if (model == null) {
return false;
}
if (model.getPluginBase().getId() == null) {
return false;
}
return true;
}
/**
* @return true if the given jar file should be handled by the Primordial loader. If false, other provisions should be made to add
* the jar file to the appropriate component of the AnalysisScope. Subclasses can override this method.
*/
protected boolean isPrimordialJarFile(JarFile j) {
return true;
}
protected void resolveClasspathEntries(IClasspathEntry[] entries, Loader loader, boolean includeSource)
throws JavaModelException, IOException {
for (int i = 0; i < entries.length; i++) {
resolveClasspathEntry(entries[i], loader, includeSource);
}
}
public static IPath makeAbsolute(IPath p) {
IPath absolutePath = p;
if (p.toFile().exists()) {
return p;
}
IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(p);
if (resource != null && resource.exists()) {
absolutePath = resource.getLocation();
}
return absolutePath;
}
private void resolveProjectClasspathEntries(boolean includeSource) throws JavaModelException, IOException {
resolveClasspathEntries(project.getRawClasspath(), Loader.EXTENSION, includeSource);
}
/**
* Convert this path to a WALA analysis scope
*
* @throws IOException
*/
public AnalysisScope toAnalysisScope(ClassLoader classLoader, File exclusionsFile) throws IOException {
AnalysisScope scope = AnalysisScopeReader.readJavaScope(AbstractAnalysisEngine.SYNTHETIC_J2SE_MODEL, exclusionsFile,
classLoader);
return toAnalysisScope(scope);
}
public AnalysisScope toAnalysisScope(AnalysisScope scope) {
try {
List<Module> l = MapUtil.findOrCreateList(modules, Loader.APPLICATION);
if (includeClassFiles) {
File dir = makeAbsolute(project.getOutputLocation()).toFile();
if (!dir.isDirectory()) {
System.err.println("PANIC: project output location is not a directory: " + dir);
} else {
l.add(new BinaryDirectoryTreeModule(dir));
}
}
if (includeSource) {
for (IClasspathEntry e : project.getRawClasspath()) {
if (e.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
l.add(new EclipseSourceDirectoryTreeModule(e.getPath()));
}
}
}
for (Loader loader : Loader.values()) {
for (Module m : modules.get(loader)) {
scope.addToScope(loader.ref, m);
}
}
return scope;
} catch (JavaModelException e) {
e.printStackTrace();
Assertions.UNREACHABLE();
return null;
}
}
public AnalysisScope toAnalysisScope(final File exclusionsFile) throws IOException {
return toAnalysisScope(getClass().getClassLoader(), exclusionsFile);
}
public AnalysisScope toAnalysisScope() throws IOException {
return toAnalysisScope(getClass().getClassLoader(), null);
}
public Collection<Module> getModules(Loader loader, boolean binary) {
return Collections.unmodifiableCollection(modules.get(loader));
}
@Override
public String toString() {
try {
return toAnalysisScope((File) null).toString();
} catch (IOException e) {
e.printStackTrace();
return "Error in toString()";
}
}
private IPluginModelBase findModel(IProject p) {
// PluginRegistry is specific to Eclipse 3.3+. Use PDECore for compatibility with 3.2
// return PluginRegistry.findModel(p);
return PDECore.getDefault().getModelManager().findModel(p);
}
private IPluginModelBase findModel(BundleDescription bd) {
// PluginRegistry is specific to Eclipse 3.3+. Use PDECore for compatibility with 3.2
// return PluginRegistry.findModel(bd);
return PDECore.getDefault().getModelManager().findModel(bd);
}
}

View File

@ -0,0 +1,95 @@
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation.
* 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 com.ibm.wala.ide.util;
import java.io.File;
import java.io.IOException;
import java.util.Properties;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.io.CommandLine;
public class HeadlessUtil {
/**
* create a Properties object representing the properties set by the command
* line args. if args[i] is "-foo" and args[i+1] is "bar", then the result
* will define a property with key "foo" and value "bar"
*/
public static Properties parseCommandLine(String[] cmdLine) {
if (cmdLine == null) {
throw new IllegalArgumentException("null cmdLine");
}
if (cmdLine.length == 0) {
throw new IllegalArgumentException("cmdLine must have at least one parameter");
}
Properties p = null;
assert cmdLine[0].equals("-pdelaunch");
String[] x = new String[cmdLine.length - 1];
System.arraycopy(cmdLine, 1, x, 0, x.length);
try {
p = CommandLine.parse(x);
} catch (IllegalArgumentException e) {
e.printStackTrace();
System.err.println("Length " + x.length);
for (String s : x) {
System.err.println(s);
}
Assertions.UNREACHABLE();
}
return p;
}
/**
* compute the analysis scope for a project in the current workspace
* @throws IOException
* @throws CoreException
*/
public static AnalysisScope computeScope(String projectName) throws IOException, CoreException {
if (projectName == null) {
throw new IllegalArgumentException("null projectName");
}
IJavaProject jp = getProjectFromWorkspace(projectName);
EclipseProjectPath path = EclipseProjectPath.make(jp);
return path.toAnalysisScope((File)null);
}
private static IJavaProject getProjectFromWorkspace(String projectName) {
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
IPath workspaceRootPath = workspaceRoot.getLocation();
System.out.println("workspace: " + workspaceRootPath.toOSString());
for (IProject p : workspaceRoot.getProjects()) {
try {
if (p.hasNature(JavaCore.NATURE_ID)) {
IJavaProject jp = JavaCore.create(p);
if (jp != null && jp.getElementName().equals(projectName)) {
return jp;
}
}
} catch (CoreException e) {
// do nothing and continue
}
}
Assertions.UNREACHABLE();
return null;
}
}

View File

@ -0,0 +1,568 @@
/*******************************************************************************
* Copyright (c) 2002 - 2006 IBM Corporation.
* 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 com.ibm.wala.ide.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaModel;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IPackageDeclaration;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.ITypeParameter;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
import org.eclipse.jdt.core.search.IJavaSearchConstants;
import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.core.search.SearchMatch;
import org.eclipse.jdt.core.search.SearchParticipant;
import org.eclipse.jdt.core.search.SearchPattern;
import org.eclipse.jdt.core.search.SearchRequestor;
import org.eclipse.jface.viewers.StructuredSelection;
import com.ibm.wala.types.TypeReference;
import com.ibm.wala.util.collections.HashSetFactory;
/**
* Convenience methods to get information from JDT {@link IJavaElement} model.
*/
public class JdtUtil {
public static String getFilePath(IJavaElement javaElt) {
if (javaElt == null) {
throw new IllegalArgumentException("javaElt is null");
}
try {
IPath p = javaElt.getPath();
if (p == null) {
throw new IllegalArgumentException("javaElt has null path");
}
String filePath = p.toString();
return filePath;
} catch (Exception e) {
throw new IllegalArgumentException("malformed javaElt: " + javaElt, e);
}
}
public static String getPackageName(ICompilationUnit cu) {
if (cu == null) {
throw new IllegalArgumentException("cu is null");
}
try {
IPackageDeclaration[] pkgDecl = cu.getPackageDeclarations();
// TODO: handle default package?
if (pkgDecl != null && pkgDecl.length > 0) {
String packageName = pkgDecl[0].getElementName();
return packageName;
}
} catch (JavaModelException e) {
}
return "";
}
public static String getFullyQualifiedClassName(IType type) {
if (type == null) {
throw new IllegalArgumentException("type is null");
}
ICompilationUnit cu = (ICompilationUnit) type.getParent();
String packageName = getPackageName(cu);
String className = type.getElementName();
String fullyQName = packageName + "." + className;
return fullyQName;
}
public static String getClassName(IType type) {
if (type == null) {
throw new IllegalArgumentException("type is null");
}
String className = type.getElementName();
return className;
}
/**
* Return a unique string representing the specified Java element across projects in the workspace. The returned string can be
* used as a handle to create JavaElement by 'JavaCore.create(String)'
*
* For example, suppose we have the method 'fooPackage.barPackage.FooClass.fooMethod(int)' which is in the 'FooProject' and source
* folder 'src' the handle would be '=FooProject/src<fooPackage.barPackage{FooClass.java[FooClass~fooMethod~I'
*
* @param javaElt
* @throws IllegalArgumentException if javaElt is null
*/
public static String getJdtHandleString(IJavaElement javaElt) {
if (javaElt == null) {
throw new IllegalArgumentException("javaElt is null");
}
return javaElt.getHandleIdentifier();
}
@Deprecated
public static IJavaElement createJavaElementFromJdtHandle(String jdtHandle) {
return JavaCore.create(jdtHandle);
}
public static IType[] getClasses(ICompilationUnit cu) {
if (cu == null) {
throw new IllegalArgumentException("cu is null");
}
try {
return cu.getAllTypes();
} catch (JavaModelException e) {
}
return null;
}
public static IJavaProject getProject(IJavaElement javaElt) {
if (javaElt == null) {
throw new IllegalArgumentException("javaElt is null");
}
IJavaProject javaProject = javaElt.getJavaProject();
return javaProject;
}
public static String getProjectName(IJavaProject javaProject) {
if (javaProject == null) {
throw new IllegalArgumentException("javaProject is null");
}
return javaProject.getElementName();
}
/**
* @param typeSignature Some of the type signatures examples are "QString;" (String) and "I" (int) The type signatures may be
* either unresolved (for source types) or resolved (for binary types), and either basic (for basic types) or rich (for
* parameterized types). See {@link Signature} for details.
*/
public static String getHumanReadableType(String typeSignature) {
String simpleName = Signature.getSignatureSimpleName(typeSignature);
return simpleName;
}
public static IJavaProject getJavaProject(IFile appJar) {
if (appJar == null) {
throw new IllegalArgumentException("appJar is null");
}
String projectName = appJar.getProject().getName();
return getJavaProject(projectName);
}
public static IJavaProject getJavaProject(String projectName) {
if (projectName == null) {
throw new IllegalArgumentException("null projectName");
}
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
IJavaModel javaModel = JavaCore.create(workspaceRoot);
IJavaProject javaProject = javaModel.getJavaProject(projectName);
return javaProject;
}
/**
* compute the java projects in the active workspace
*/
public static Collection<IJavaProject> getWorkspaceJavaProjects() {
Collection<IJavaProject> result = HashSetFactory.make();
IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
for (IProject p : workspaceRoot.getProjects()) {
try {
if (p.hasNature(JavaCore.NATURE_ID)) {
IJavaProject jp = JavaCore.create(p);
if (jp != null) {
result.add(jp);
}
}
} catch (CoreException e) {
// do nothing
}
}
return result;
}
/**
* Find the {@link IType} in the workspace corresponding to a class name.
*
* @return null if not found
* @throws IllegalArgumentException if projects == null
*/
public static IType findJavaClassInProjects(String fullyQualifiedName, Collection<IJavaProject> projects)
throws IllegalArgumentException {
if (projects == null) {
throw new IllegalArgumentException("projects == null");
}
for (IJavaProject project : projects) {
try {
IType t = project.findType(fullyQualifiedName);
if (t != null) {
return t;
}
} catch (JavaModelException e) {
e.printStackTrace();
}
}
System.err.println("failed to find " + fullyQualifiedName);
return null;
// IJavaElement[] arr = new IJavaElement[projects.size()];
// projects.toArray(arr);
// IJavaSearchScope scope = SearchEngine.createJavaSearchScope(arr, false);
//
// return searchForJavaClass(className, scope);
}
public static IType findJavaClassInResources(String className, Collection<IResource> resources) {
if (resources == null) {
throw new IllegalArgumentException("null resources");
}
Collection<IJavaProject> projects = HashSetFactory.make();
for (IResource r : resources) {
projects.add(JavaCore.create(r).getJavaProject());
}
return findJavaClassInProjects(className, projects);
}
// private static IType searchForJavaClass(String className, IJavaSearchScope scope) {
// SearchPattern p = SearchPattern.createPattern(className, IJavaSearchConstants.CLASS_AND_INTERFACE,
// IJavaSearchConstants.DECLARATIONS, SearchPattern.R_EXACT_MATCH);
// SearchEngine engine = new SearchEngine();
// final Collection<IJavaElement> kludge = HashSetFactory.make();
// SearchRequestor requestor = new SearchRequestor() {
//
// @Override
// public void acceptSearchMatch(SearchMatch match) throws CoreException {
// kludge.add((IJavaElement) match.getElement());
// }
//
// };
// try {
// engine.search(p, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() }, scope, requestor, null);
// } catch (CoreException e) {
// e.printStackTrace();
// }
// if (kludge.size() == 1) {
// System.err.println("Found " + className);
// return (IType) kludge.iterator().next();
// } else {
// System.err.println("Failed to find " + className + " " + kludge.size());
// return null;
// }
// }
/**
* Find the IMethod in the workspace corresponding to a method selector.
*
* TODO: this is way too slow. figure out something better.
*
* @return null if not found
*/
public static IMethod findJavaMethodInProjects(String klass, String selector, Collection<IJavaProject> projects) {
if (klass == null) {
throw new IllegalArgumentException("null klass");
}
if (projects == null) {
throw new IllegalArgumentException("null projects");
}
IType type = null;
try {
type = findJavaClassInProjects(klass, projects);
} catch (Throwable t) {
return null;
}
if (type == null) {
return null;
}
String name = parseForName(selector, type);
String[] paramTypes = parseForParameterTypes(selector);
IMethod m = type.getMethod(name, paramTypes);
IMethod[] methods = type.findMethods(m);
if (methods != null && methods.length == 1) {
return methods[0];
} else {
// methods is null. probably got screwed by generics.
// i spent 5 hours trying to figure out how to fix this correctly
// and failed. implementing a miserable hack instead.
// Need to consult a guru to figure out how to do this.
try {
List<IMethod> matches = new ArrayList<IMethod>();
Collection<String> typeParameterNames = getTypeParameterNames(type);
METHODS: for (IMethod x : type.getMethods()) {
if (x.getElementName().equals(name)) {
if (x.getParameterTypes().length == paramTypes.length) {
for (int i = 0; i < x.getParameterTypes().length; i++) {
String s1 = Signature.getTypeErasure(Signature.getSignatureSimpleName(x.getParameterTypes()[i]));
String s2 = Signature.getTypeErasure(Signature.getSignatureSimpleName(paramTypes[i]));
if (typeParameterNames.contains(s1)) {
// s1 is a type parameter to the class. optimistically assume
// the types match.
} else {
if (!s1.equals(s2)) {
// no match
continue METHODS;
}
}
}
matches.add(x);
}
}
}
if (matches.size() == 1) {
return matches.get(0);
} else {
System.err.println("findJavaMethodInWorkspace FAILED TO MATCH " + m);
return null;
}
} catch (JavaModelException e) {
e.printStackTrace();
return null;
}
}
}
public static Collection<String> getTypeParameterNames(IType type) throws IllegalArgumentException, JavaModelException {
if (type == null) {
throw new IllegalArgumentException("type == null");
}
ITypeParameter[] tp = type.getTypeParameters();
Collection<String> typeParameterNames = HashSetFactory.make(tp.length);
for (ITypeParameter p : tp) {
typeParameterNames.add(p.getElementName());
}
return typeParameterNames;
}
public static String parseForName(String selector, IType type) {
if (selector == null) {
throw new IllegalArgumentException("selector is null");
}
try {
String result = selector.substring(0, selector.indexOf('('));
if (result.equals("<init>")) {
return type.getElementName();
} else {
return result;
}
} catch (StringIndexOutOfBoundsException e) {
throw new IllegalArgumentException("invalid selector: " + selector);
}
}
public static final String[] parseForParameterTypes(String selector) throws IllegalArgumentException {
try {
if (selector == null) {
throw new IllegalArgumentException("selector is null");
}
String d = selector.substring(selector.indexOf('('));
if (d.length() <= 2) {
throw new IllegalArgumentException("invalid descriptor: " + d);
}
if (d.charAt(0) != '(') {
throw new IllegalArgumentException("invalid descriptor: " + d);
}
ArrayList<String> sigs = new ArrayList<String>(10);
int i = 1;
while (true) {
switch (d.charAt(i++)) {
case TypeReference.VoidTypeCode:
sigs.add(TypeReference.VoidName.toString());
continue;
case TypeReference.BooleanTypeCode:
sigs.add(TypeReference.BooleanName.toString());
continue;
case TypeReference.ByteTypeCode:
sigs.add(TypeReference.ByteName.toString());
continue;
case TypeReference.ShortTypeCode:
sigs.add(TypeReference.ShortName.toString());
continue;
case TypeReference.IntTypeCode:
sigs.add(TypeReference.IntName.toString());
continue;
case TypeReference.LongTypeCode:
sigs.add(TypeReference.LongName.toString());
continue;
case TypeReference.FloatTypeCode:
sigs.add(TypeReference.FloatName.toString());
continue;
case TypeReference.DoubleTypeCode:
sigs.add(TypeReference.DoubleName.toString());
continue;
case TypeReference.CharTypeCode:
sigs.add(TypeReference.CharName.toString());
continue;
case TypeReference.ArrayTypeCode: {
int off = i - 1;
while (d.charAt(i) == TypeReference.ArrayTypeCode) {
++i;
}
if (d.charAt(i++) == TypeReference.ClassTypeCode) {
while (d.charAt(i++) != ';')
;
sigs.add(d.substring(off, i).replaceAll("/", "."));
} else {
sigs.add(d.substring(off, i));
}
continue;
}
case (byte) ')': // end of parameter list
return toArray(sigs);
default: {
// a class
int off = i - 1;
char c;
do {
c = d.charAt(i++);
} while (c != ',' && c != ')');
sigs.add("L" + d.substring(off, i - 1) + ";");
if (c == ')') {
return toArray(sigs);
}
continue;
}
}
}
} catch (StringIndexOutOfBoundsException e) {
throw new IllegalArgumentException("error parsing selector " + selector);
}
}
private static String[] toArray(ArrayList<String> sigs) {
int size = sigs.size();
if (size == 0) {
return new String[0];
}
Iterator<String> it = sigs.iterator();
String[] result = new String[size];
for (int j = 0; j < size; j++) {
result[j] = it.next();
}
return result;
}
/**
* Find the IMethod in the workspace corresponding to a method signature.
*
* This doesn't work for elements declared in inner classes. It's possible this is a 3.2 bug fixed in 3.3
*
* @return null if not found
*/
@Deprecated
public static IMethod findJavaMethodInWorkspaceBrokenForInnerClasses(String methodSig) {
// dammit ... this doesn't work for inner classes.
System.err.println("Search for " + methodSig);
SearchPattern p = SearchPattern.createPattern(methodSig, IJavaSearchConstants.METHOD, IJavaSearchConstants.DECLARATIONS,
SearchPattern.R_EXACT_MATCH);
IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
SearchEngine engine = new SearchEngine();
final Collection<IJavaElement> kludge = HashSetFactory.make();
SearchRequestor requestor = new SearchRequestor() {
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
kludge.add((IJavaElement) match.getElement());
}
};
try {
engine.search(p, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() }, scope, requestor, null);
} catch (CoreException e) {
e.printStackTrace();
}
if (kludge.size() == 1) {
return (IMethod) kludge.iterator().next();
} else {
System.err.println("RETURNED " + kludge.size() + " " + kludge);
return null;
}
}
/**
* Use the search engine to find all methods in a java element
*/
public static Collection<IMethod> findMethods(IJavaElement elt) {
if (elt instanceof ICompilationUnit) {
Collection<IMethod> result = HashSetFactory.make();
for (IType type : getClasses((ICompilationUnit) elt)) {
try {
for (IMethod m : type.getMethods()) {
result.add(m);
}
} catch (JavaModelException e) {
e.printStackTrace();
}
}
return result;
} else {
final Collection<IMethod> result = HashSetFactory.make();
SearchPattern p = SearchPattern.createPattern("*", IJavaSearchConstants.METHOD, IJavaSearchConstants.DECLARATIONS,
SearchPattern.R_PATTERN_MATCH);
SearchPattern p2 = SearchPattern.createPattern("*", IJavaSearchConstants.CONSTRUCTOR, IJavaSearchConstants.DECLARATIONS,
SearchPattern.R_PATTERN_MATCH);
IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { elt }, IJavaSearchScope.SOURCES);
SearchEngine engine = new SearchEngine();
SearchRequestor requestor = new SearchRequestor() {
@Override
public void acceptSearchMatch(SearchMatch match) throws CoreException {
if (match.getElement() instanceof IMethod) {
result.add((IMethod) match.getElement());
}
}
};
try {
engine.search(p, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() }, scope, requestor, null);
engine.search(p2, new SearchParticipant[] { SearchEngine.getDefaultSearchParticipant() }, scope, requestor, null);
} catch (CoreException e) {
e.printStackTrace();
}
return result;
}
}
/**
* get a {@link StructuredSelection} corresponding to the named projects
*/
public static StructuredSelection getStructuredSelectionForProjectNames(Collection<String> projectNames) {
if (projectNames == null) {
throw new IllegalArgumentException("null projectNames");
}
Object[] projects = new Object[projectNames.size()];
int i = 0;
for (String projectName : projectNames) {
projects[i++] = getJavaProject(projectName);
}
StructuredSelection selection = new StructuredSelection(projects);
return selection;
}
}

View File

@ -0,0 +1,143 @@
/*******************************************************************************
* Copyright (c) 2007 IBM Corporation.
* 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 com.ibm.wala.ide.util;
import org.eclipse.core.runtime.IProgressMonitor;
/**
* A class to control execution through the {@link IProgressMonitor} interface.
*
* This class bounds each work item with a time in milliseconds. If there is no
* apparent progress within the specified bound, this class cancels itself.
*/
public class ProgressMaster implements IProgressMonitor {
private final IProgressMonitor delegate;
private volatile boolean timedOut = false;
/**
* If -1, work items can run forever.
*/
private int msPerWorkItem = -1;
private Timeout currentNanny;
private ProgressMaster(IProgressMonitor monitor) {
this.delegate = monitor;
}
public static ProgressMaster make(IProgressMonitor monitor) {
if (monitor == null) {
throw new IllegalArgumentException("null monitor");
}
return new ProgressMaster(monitor);
}
public synchronized void beginTask(String name, int totalWork) {
delegate.beginTask(name, totalWork);
startNanny();
}
private synchronized void startNanny() {
killNanny();
if (msPerWorkItem >= 1) {
currentNanny = new Timeout(msPerWorkItem);
currentNanny.start();
}
}
public synchronized void reset() {
killNanny();
setCanceled(false);
timedOut = false;
}
/**
* Was the last cancel state due to a timeout?
*/
public boolean lastItemTimedOut() {
return timedOut;
}
public synchronized void done() {
killNanny();
delegate.done();
}
private synchronized void killNanny() {
if (currentNanny != null) {
currentNanny.interrupt();
try {
currentNanny.join();
} catch (InterruptedException e) {
}
currentNanny = null;
}
}
public void internalWorked(double work) {
delegate.internalWorked(work);
}
public boolean isCanceled() {
return delegate.isCanceled() || timedOut;
}
public void setCanceled(boolean value) {
killNanny();
}
public void setTaskName(String name) {
delegate.setTaskName(name);
}
public void subTask(String name) {
delegate.subTask(name);
}
public synchronized void worked(int work) {
killNanny();
delegate.worked(work);
startNanny();
}
public int getMillisPerWorkItem() {
return msPerWorkItem;
}
public void setMillisPerWorkItem(int msPerWorkItem) {
this.msPerWorkItem = msPerWorkItem;
}
private class Timeout extends Thread {
@Override
public void run() {
try {
Thread.sleep(sleepMillis);
if (isInterrupted()) {
return;
}
timedOut = true;
} catch (InterruptedException e) {
return;
}
}
private final int sleepMillis;
Timeout(int sleepMillis) {
assert sleepMillis >= 1;
this.sleepMillis = sleepMillis;
}
}
}

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.tests-feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,4 @@
bin.includes = feature.xml,\
feature.properties,\
license.html,\
notice.html

View File

@ -0,0 +1,22 @@
####################################################################
# IBM Confidential
# OCO Source Materials
# IBM Rational AppScan Developer Edition
# (c) Copyright IBM Corp. 2007 All Rights Reserved.
#
# The source code for this program is not published or otherwise
# divested of its trade secrets, irrespective of what has been
# deposited with the U.S. Copyright Office.
####################################################################
# NLS_ENCODING=UTF-8
# NLS_MESSAGEFORMAT_VAR
#
# Feature details
#
featureName = WALA Test Bundles
providerName = IBM
copyrightURL=notice.html
licenseURL=license.html

View File

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.ibm.wala.tests"
label="%featureName"
version="1.1.3.qualifier"
provider-name="%providerName">
<copyright url="%copyrightURL">
%copyright
</copyright>
<license url="%licenseURL">
%license
</license>
<plugin
id="com.ibm.wala.cast.java.test"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.ibm.wala.cast.test"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.ibm.wala.core.testdata"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.ibm.wala.core.tests"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.ibm.wala.tests.ide-feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,4 @@
bin.includes = feature.xml,\
feature.properties,\
license.html,\
notice.html

View File

@ -0,0 +1,22 @@
####################################################################
# IBM Confidential
# OCO Source Materials
# IBM Rational AppScan Developer Edition
# (c) Copyright IBM Corp. 2007 All Rights Reserved.
#
# The source code for this program is not published or otherwise
# divested of its trade secrets, irrespective of what has been
# deposited with the U.S. Copyright Office.
####################################################################
# NLS_ENCODING=UTF-8
# NLS_MESSAGEFORMAT_VAR
#
# Feature details
#
featureName = WALA Test IDE Bundles
providerName = IBM
copyrightURL=notice.html
licenseURL=license.html

View File

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="com.ibm.wala.tests.ide"
label="%featureName"
version="1.1.3.qualifier"
provider-name="%providerName">
<copyright url="%copyrightURL">
%copyright
</copyright>
<license url="%licenseURL">
%license
</license>
<plugin
id="com.ibm.wala.cast.java.jdt.test"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.ibm.wala.ide.tests"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff