switch to wala code formatter

git-svn-id: https://wala.svn.sourceforge.net/svnroot/wala/trunk@3452 f5eafffb-2e1d-0410-98e4-8ec43c5233c4
This commit is contained in:
sjfink 2009-04-13 19:39:48 +00:00
parent 053213e0e2
commit 31086f1f2e
19 changed files with 1078 additions and 792 deletions

View File

@ -1,7 +1,263 @@
#Tue Jan 06 14:24:46 EST 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
#Mon Apr 13 15:38:50 EDT 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
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_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_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,4 @@
#Mon Apr 13 15:38:50 EDT 2009
eclipse.preferences.version=1
formatter_profile=_WALA
formatter_settings_version=11

View File

@ -34,16 +34,14 @@ public class EclipseProjectAnalysisEngine extends AbstractAnalysisEngine {
protected final EclipseProjectPath ePath;
public EclipseProjectAnalysisEngine(IJavaProject project)
throws IOException, CoreException
{
public EclipseProjectAnalysisEngine(IJavaProject project) throws IOException, CoreException {
super();
this.project = project;
this.workspaceRootPath = ResourcesPlugin.getWorkspace().getRoot().getLocation();
assert project != null;
assert workspaceRootPath != null;
this.ePath = createProjectPath(project);
//setCallGraphBuilderFactory(new ZeroCFABuilderFactory());
// setCallGraphBuilderFactory(new ZeroCFABuilderFactory());
}
protected EclipseProjectPath createProjectPath(IJavaProject project) throws IOException, CoreException {

View File

@ -56,20 +56,17 @@ public class EclipseProjectSourceAnalysisEngine extends EclipseProjectAnalysisEn
* file extension for source files in this Eclipse project
*/
final String fileExt;
public EclipseProjectSourceAnalysisEngine(IJavaProject project)
throws IOException, CoreException
{
public EclipseProjectSourceAnalysisEngine(IJavaProject project) throws IOException, CoreException {
this(project, defaultFileExt);
}
public EclipseProjectSourceAnalysisEngine(IJavaProject project, String fileExt)
throws IOException, CoreException
{
public EclipseProjectSourceAnalysisEngine(IJavaProject project, String fileExt) throws IOException, CoreException {
super(project);
this.fileExt = fileExt;
try {
setExclusionsFile(FileProvider.getFileFromPlugin(CorePlugin.getDefault(), "J2SEClassHierarchyExclusions.txt").getAbsolutePath());
setExclusionsFile(FileProvider.getFileFromPlugin(CorePlugin.getDefault(), "J2SEClassHierarchyExclusions.txt")
.getAbsolutePath());
} catch (IOException e) {
Assertions.UNREACHABLE("Cannot find exclusions file");
}
@ -87,35 +84,33 @@ public class EclipseProjectSourceAnalysisEngine extends EclipseProjectAnalysisEn
@Override
protected void buildAnalysisScope() {
try {
scope = makeSourceAnalysisScope();
scope = makeSourceAnalysisScope();
if (getExclusionsFile() != null) {
scope.setExclusions(FileOfClasses.createFileOfClasses(new File(getExclusionsFile())));
}
EclipseProjectPath epath = getEclipseProjectPath();
for (Module m : epath.getModules(Loader.PRIMORDIAL, true)) {
scope.addToScope(scope.getPrimordialLoader(), m);
}
ClassLoaderReference app = scope.getApplicationLoader();
ClassLoaderReference src = ((JavaSourceAnalysisScope)scope).getSourceLoader();
ClassLoaderReference src = ((JavaSourceAnalysisScope) scope).getSourceLoader();
for (Module m : epath.getModules(Loader.APPLICATION, true)) {
if (m instanceof SourceDirectoryTreeModule) {
scope.addToScope(src, m);
} else {
scope.addToScope(app, m);
}
if (m instanceof SourceDirectoryTreeModule) {
scope.addToScope(src, m);
} else {
scope.addToScope(app, m);
}
}
for (Module m : epath.getModules(Loader.EXTENSION, true)) {
if (!(m instanceof BinaryDirectoryTreeModule))
scope.addToScope(app, m);
}
/*
ClassLoaderReference src = ((JavaSourceAnalysisScope)scope).getSourceLoader();
for (Module m : epath.getModules(Loader.APPLICATION, false)) {
scope.addToScope(src, m);
}
*/
* ClassLoaderReference src = ((JavaSourceAnalysisScope)scope).getSourceLoader(); for (Module m :
* epath.getModules(Loader.APPLICATION, false)) { scope.addToScope(src, m); }
*/
} catch (IOException e) {
Assertions.UNREACHABLE(e.toString());
}
@ -125,7 +120,7 @@ public class EclipseProjectSourceAnalysisEngine extends EclipseProjectAnalysisEn
return new JavaIRTranslatorExtension();
}
protected ClassLoaderFactory getClassLoaderFactory(SetOfClasses exclusions,IRTranslatorExtension extInfo) {
protected ClassLoaderFactory getClassLoaderFactory(SetOfClasses exclusions, IRTranslatorExtension extInfo) {
return new PolyglotClassLoaderFactory(exclusions, extInfo);
}

View File

@ -8,43 +8,45 @@ import org.osgi.framework.BundleContext;
*/
public class Activator extends Plugin {
// The plug-in ID
public static final String PLUGIN_ID = "com.ibm.wala.cast.java.polyglot";
// The plug-in ID
public static final String PLUGIN_ID = "com.ibm.wala.cast.java.polyglot";
// The shared instance
private static Activator plugin;
/**
* The constructor
*/
public Activator() {
}
// The shared instance
private static Activator plugin;
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/**
* The constructor
*/
public Activator() {
}
/*
* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static Activator getDefault() {
return plugin;
}
}

View File

@ -76,127 +76,129 @@ import com.ibm.wala.cast.tree.CAstNode;
import com.ibm.wala.util.debug.Assertions;
/**
* Wrapper for the logic (nasty cascaded instanceof tests) necessary to visit a Polyglot AST
* and dispatch to the appropriate TranslatingVisitor methods for each AST node type.
* Wrapper for the logic (nasty cascaded instanceof tests) necessary to visit a Polyglot AST and dispatch to the appropriate
* TranslatingVisitor methods for each AST node type.
*
* @author rfuhrer
*/
public class ASTTraverser {
protected ASTTraverser() { }
protected ASTTraverser() {
}
public static CAstNode visit(Node n, TranslatingVisitor tv, WalkContext wc) {
if (n instanceof MethodDecl) {
return tv.visit((MethodDecl) n, (MethodContext) wc);
} else if (n instanceof ConstructorDecl) {
return tv.visit((ConstructorDecl) n, (MethodContext) wc);
} else if (n instanceof FieldDecl) {
return tv.visit((FieldDecl) n, (MethodContext) wc);
} else if (n instanceof Import) {
return tv.visit((Import) n, wc);
} else if (n instanceof PackageNode) {
return tv.visit((PackageNode) n, wc);
} else if (n instanceof CanonicalTypeNode) {
return tv.visit((CanonicalTypeNode) n, wc);
} else if (n instanceof ArrayTypeNode) {
return tv.visit((ArrayTypeNode) n, wc);
} else if (n instanceof ArrayInit) {
return tv.visit((ArrayInit) n, wc);
} else if (n instanceof ArrayAccessAssign) {
return tv.visit((ArrayAccessAssign) n, wc);
} else if (n instanceof FieldAssign) {
return tv.visit((FieldAssign) n, wc);
} else if (n instanceof LocalAssign) {
return tv.visit((LocalAssign) n, wc);
} else if (n instanceof Binary) {
return tv.visit((Binary) n, wc);
} else if (n instanceof Call) {
return tv.visit((Call) n, wc);
} else if (n instanceof ConstructorCall) {
return tv.visit((ConstructorCall) n, wc);
} else if (n instanceof Cast) {
return tv.visit((Cast) n, wc);
} else if (n instanceof Conditional) {
return tv.visit((Conditional) n, wc);
} else if (n instanceof Instanceof) {
return tv.visit((Instanceof) n, wc);
} else if (n instanceof BooleanLit) {
return tv.visit((BooleanLit) n, wc);
} else if (n instanceof ClassLit) {
return tv.visit((ClassLit) n, wc);
} else if (n instanceof FloatLit) {
return tv.visit((FloatLit) n, wc);
} else if (n instanceof NullLit) {
return tv.visit((NullLit) n, wc);
} else if (n instanceof CharLit) {
return tv.visit((CharLit) n, wc);
} else if (n instanceof IntLit) {
return tv.visit((IntLit) n, wc);
} else if (n instanceof StringLit) {
return tv.visit((StringLit) n, wc);
} else if (n instanceof New) {
return tv.visit((New) n, wc);
} else if (n instanceof NewArray) {
return tv.visit((NewArray) n, wc);
} else if (n instanceof Special) {
return tv.visit((Special) n, wc);
} else if (n instanceof Unary) {
return tv.visit((Unary) n, wc);
} else if (n instanceof ArrayAccess) {
return tv.visit((ArrayAccess) n, wc);
} else if (n instanceof Field) {
return tv.visit((Field) n, wc);
} else if (n instanceof Local) {
return tv.visit((Local) n, wc);
} else if (n instanceof ClassBody) {
return tv.visit((ClassBody) n, wc);
} else if (n instanceof ClassDecl) {
return tv.visit((ClassDecl) n, wc);
} else if (n instanceof Initializer) {
return tv.visit((Initializer) n, wc);
} else if (n instanceof Assert) {
return tv.visit((Assert) n, wc);
} else if (n instanceof Branch) {
return tv.visit((Branch) n, wc);
} else if (n instanceof SwitchBlock) { // must test for this one before Block
return tv.visit((SwitchBlock) n, wc);
} else if (n instanceof Block) { // must test for this one before Block
return tv.visit((Block) n, wc);
} else if (n instanceof Catch) {
return tv.visit((Catch) n, wc);
} else if (n instanceof If) {
return tv.visit((If) n, wc);
} else if (n instanceof Labeled) {
return tv.visit((Labeled) n, wc);
} else if (n instanceof LocalClassDecl) {
return tv.visit((LocalClassDecl) n, wc);
} else if (n instanceof Do) {
return tv.visit((Do) n, wc);
} else if (n instanceof For) {
return tv.visit((For) n, wc);
} else if (n instanceof While) {
return tv.visit((While) n, wc);
} else if (n instanceof Switch) {
return tv.visit((Switch) n, wc);
} else if (n instanceof Synchronized) {
return tv.visit((Synchronized) n, wc);
} else if (n instanceof Try) {
return tv.visit((Try) n, wc);
} else if (n instanceof Empty) {
return tv.visit((Empty) n, wc);
} else if (n instanceof Eval) {
return tv.visit((Eval) n, wc);
} else if (n instanceof LocalDecl) {
return tv.visit((LocalDecl) n, wc);
} else if (n instanceof Return) {
return tv.visit((Return) n, wc);
} else if (n instanceof Case) {
return tv.visit((Case) n, wc);
} else if (n instanceof Throw) {
return tv.visit((Throw) n, wc);
} else if (n instanceof Formal) {
return tv.visit((Formal) n, wc);
} else {
Assertions.UNREACHABLE("Unhandled node " + n + " of type " + n.getClass().getName() + " in ASTTraverser.visit().");
return null;
}
public static CAstNode visit(Node n, TranslatingVisitor tv, WalkContext wc) {
if (n instanceof MethodDecl) {
return tv.visit((MethodDecl) n, (MethodContext) wc);
} else if (n instanceof ConstructorDecl) {
return tv.visit((ConstructorDecl) n, (MethodContext) wc);
} else if (n instanceof FieldDecl) {
return tv.visit((FieldDecl) n, (MethodContext) wc);
} else if (n instanceof Import) {
return tv.visit((Import) n, wc);
} else if (n instanceof PackageNode) {
return tv.visit((PackageNode) n, wc);
} else if (n instanceof CanonicalTypeNode) {
return tv.visit((CanonicalTypeNode) n, wc);
} else if (n instanceof ArrayTypeNode) {
return tv.visit((ArrayTypeNode) n, wc);
} else if (n instanceof ArrayInit) {
return tv.visit((ArrayInit) n, wc);
} else if (n instanceof ArrayAccessAssign) {
return tv.visit((ArrayAccessAssign) n, wc);
} else if (n instanceof FieldAssign) {
return tv.visit((FieldAssign) n, wc);
} else if (n instanceof LocalAssign) {
return tv.visit((LocalAssign) n, wc);
} else if (n instanceof Binary) {
return tv.visit((Binary) n, wc);
} else if (n instanceof Call) {
return tv.visit((Call) n, wc);
} else if (n instanceof ConstructorCall) {
return tv.visit((ConstructorCall) n, wc);
} else if (n instanceof Cast) {
return tv.visit((Cast) n, wc);
} else if (n instanceof Conditional) {
return tv.visit((Conditional) n, wc);
} else if (n instanceof Instanceof) {
return tv.visit((Instanceof) n, wc);
} else if (n instanceof BooleanLit) {
return tv.visit((BooleanLit) n, wc);
} else if (n instanceof ClassLit) {
return tv.visit((ClassLit) n, wc);
} else if (n instanceof FloatLit) {
return tv.visit((FloatLit) n, wc);
} else if (n instanceof NullLit) {
return tv.visit((NullLit) n, wc);
} else if (n instanceof CharLit) {
return tv.visit((CharLit) n, wc);
} else if (n instanceof IntLit) {
return tv.visit((IntLit) n, wc);
} else if (n instanceof StringLit) {
return tv.visit((StringLit) n, wc);
} else if (n instanceof New) {
return tv.visit((New) n, wc);
} else if (n instanceof NewArray) {
return tv.visit((NewArray) n, wc);
} else if (n instanceof Special) {
return tv.visit((Special) n, wc);
} else if (n instanceof Unary) {
return tv.visit((Unary) n, wc);
} else if (n instanceof ArrayAccess) {
return tv.visit((ArrayAccess) n, wc);
} else if (n instanceof Field) {
return tv.visit((Field) n, wc);
} else if (n instanceof Local) {
return tv.visit((Local) n, wc);
} else if (n instanceof ClassBody) {
return tv.visit((ClassBody) n, wc);
} else if (n instanceof ClassDecl) {
return tv.visit((ClassDecl) n, wc);
} else if (n instanceof Initializer) {
return tv.visit((Initializer) n, wc);
} else if (n instanceof Assert) {
return tv.visit((Assert) n, wc);
} else if (n instanceof Branch) {
return tv.visit((Branch) n, wc);
} else if (n instanceof SwitchBlock) { // must test for this one before Block
return tv.visit((SwitchBlock) n, wc);
} else if (n instanceof Block) { // must test for this one before Block
return tv.visit((Block) n, wc);
} else if (n instanceof Catch) {
return tv.visit((Catch) n, wc);
} else if (n instanceof If) {
return tv.visit((If) n, wc);
} else if (n instanceof Labeled) {
return tv.visit((Labeled) n, wc);
} else if (n instanceof LocalClassDecl) {
return tv.visit((LocalClassDecl) n, wc);
} else if (n instanceof Do) {
return tv.visit((Do) n, wc);
} else if (n instanceof For) {
return tv.visit((For) n, wc);
} else if (n instanceof While) {
return tv.visit((While) n, wc);
} else if (n instanceof Switch) {
return tv.visit((Switch) n, wc);
} else if (n instanceof Synchronized) {
return tv.visit((Synchronized) n, wc);
} else if (n instanceof Try) {
return tv.visit((Try) n, wc);
} else if (n instanceof Empty) {
return tv.visit((Empty) n, wc);
} else if (n instanceof Eval) {
return tv.visit((Eval) n, wc);
} else if (n instanceof LocalDecl) {
return tv.visit((LocalDecl) n, wc);
} else if (n instanceof Return) {
return tv.visit((Return) n, wc);
} else if (n instanceof Case) {
return tv.visit((Case) n, wc);
} else if (n instanceof Throw) {
return tv.visit((Throw) n, wc);
} else if (n instanceof Formal) {
return tv.visit((Formal) n, wc);
} else {
Assertions.UNREACHABLE("Unhandled node " + n + " of type " + n.getClass().getName() + " in ASTTraverser.visit().");
return null;
}
}
}

View File

@ -26,30 +26,30 @@ import polyglot.visit.AscriptionVisitor;
/**
* Runs an AscriptionVisitor to make sure that empty array literals actually get a type.
*
* @author rfuhrer
*/
public class AscriptionGoal extends AbstractGoal {
public AscriptionGoal(Job job) {
super(job);
try {
Scheduler scheduler= job.extensionInfo().scheduler();
public AscriptionGoal(Job job) {
super(job);
try {
Scheduler scheduler = job.extensionInfo().scheduler();
addPrerequisiteGoal(scheduler.TypeChecked(job), scheduler);
} catch (CyclicDependencyException e) {
job.compiler().errorQueue().enqueue(ErrorInfo.INTERNAL_ERROR, "Cycle encountered in goal graph?");
throw new IllegalStateException(e.getMessage());
}
addPrerequisiteGoal(scheduler.TypeChecked(job), scheduler);
} catch (CyclicDependencyException e) {
job.compiler().errorQueue().enqueue(ErrorInfo.INTERNAL_ERROR, "Cycle encountered in goal graph?");
throw new IllegalStateException(e.getMessage());
}
}
public Pass createPass(ExtensionInfo extInfo) {
return new VisitorPass(this,
new AscriptionVisitor(job(), extInfo.typeSystem(), extInfo.nodeFactory()) {
public Expr ascribe(Expr e, Type toType) throws SemanticException {
if (e instanceof ArrayInit && e.type().isNull()) {
return e.type(toType);
}
return super.ascribe(e, toType);
}
});
}
public Pass createPass(ExtensionInfo extInfo) {
return new VisitorPass(this, new AscriptionVisitor(job(), extInfo.typeSystem(), extInfo.nodeFactory()) {
public Expr ascribe(Expr e, Type toType) throws SemanticException {
if (e instanceof ArrayInit && e.type().isNull()) {
return e.type(toType);
}
return super.ascribe(e, toType);
}
});
}
}

View File

@ -26,41 +26,36 @@ import com.ibm.wala.cast.java.translator.Java2IRTranslator;
/**
* A kind of EndGoal that indicates that DOMO IR has been generated for the given compilation unit.
*
* @author rfuhrer
*/
public class IRGoal extends AbstractGoal implements EndGoal {
private JavaSourceLoaderImpl fSourceLoader;
private JavaSourceLoaderImpl fSourceLoader;
public IRGoal(Job job, JavaSourceLoaderImpl sourceLoader) {
super(job);
fSourceLoader = sourceLoader;
try {
Scheduler scheduler= job.extensionInfo().scheduler();
public IRGoal(Job job, JavaSourceLoaderImpl sourceLoader) {
super(job);
fSourceLoader = sourceLoader;
try {
Scheduler scheduler = job.extensionInfo().scheduler();
addPrerequisiteGoal(scheduler.TypeChecked(job), scheduler);
// Need ConstantsChecked in order to make sure that case statements have non-zero labels.
addPrerequisiteGoal(scheduler.ConstantsChecked(job), scheduler);
// Need to add an AscriptionGoal as a prereq to make sure that empty array initializers get a type ascribed.
addPrerequisiteGoal(new AscriptionGoal(job), scheduler);
} catch (CyclicDependencyException e) {
job.compiler().errorQueue().enqueue(ErrorInfo.INTERNAL_ERROR, "Cycle encountered in goal graph?");
throw new IllegalStateException(e.getMessage());
}
addPrerequisiteGoal(scheduler.TypeChecked(job), scheduler);
// Need ConstantsChecked in order to make sure that case statements have non-zero labels.
addPrerequisiteGoal(scheduler.ConstantsChecked(job), scheduler);
// Need to add an AscriptionGoal as a prereq to make sure that empty array initializers get a type ascribed.
addPrerequisiteGoal(new AscriptionGoal(job), scheduler);
} catch (CyclicDependencyException e) {
job.compiler().errorQueue().enqueue(ErrorInfo.INTERNAL_ERROR, "Cycle encountered in goal graph?");
throw new IllegalStateException(e.getMessage());
}
}
public Pass createPass(polyglot.frontend.ExtensionInfo extInfo) {
return new JavaIRPass(this, job(),
new Java2IRTranslator(
new PolyglotJava2CAstTranslator(
fSourceLoader.getReference(),
extInfo.nodeFactory(),
extInfo.typeSystem(),
new PolyglotIdentityMapper(fSourceLoader.getReference(), this.job.extensionInfo().typeSystem())),
fSourceLoader,
((IRTranslatorExtension)extInfo).getCAstRewriterFactory()));
}
public Pass createPass(polyglot.frontend.ExtensionInfo extInfo) {
return new JavaIRPass(this, job(), new Java2IRTranslator(new PolyglotJava2CAstTranslator(fSourceLoader.getReference(), extInfo
.nodeFactory(), extInfo.typeSystem(), new PolyglotIdentityMapper(fSourceLoader.getReference(), this.job.extensionInfo()
.typeSystem())), fSourceLoader, ((IRTranslatorExtension) extInfo).getCAstRewriterFactory()));
}
public String name() {
return "<DOMO IR goal for " + job().source().path() + ">";
}
public String name() {
return "<DOMO IR goal for " + job().source().path() + ">";
}
}

View File

@ -16,17 +16,16 @@ package com.ibm.wala.cast.java.translator.polyglot;
import com.ibm.wala.cast.tree.impl.CAstRewriterFactory;
public interface IRTranslatorExtension {
void setSourceLoader(PolyglotSourceLoaderImpl jsli);
void setSourceLoader(PolyglotSourceLoaderImpl jsli);
/**
* @return the identity mapper, for mapping AST nodes to WALA TypeReferences,
* MethodReferences and FieldReferences. Helps clients to correlate analysis
* results to AST nodes.
*/
PolyglotIdentityMapper getIdentityMapper();
/**
* @return the CAstRewriterFactory.
*/
CAstRewriterFactory getCAstRewriterFactory();
/**
* @return the identity mapper, for mapping AST nodes to WALA TypeReferences, MethodReferences and FieldReferences. Helps clients
* to correlate analysis results to AST nodes.
*/
PolyglotIdentityMapper getIdentityMapper();
/**
* @return the CAstRewriterFactory.
*/
CAstRewriterFactory getCAstRewriterFactory();
}

View File

@ -21,20 +21,22 @@ import com.ibm.wala.cast.java.translator.Java2IRTranslator;
/**
* A Pass that creates DOMO IR for the given Java compilation unit.
*
* @author rfuhrer
*/
public final class JavaIRPass extends AbstractPass {
private final Job fJob;
private final Java2IRTranslator fTranslator;
private final Job fJob;
public JavaIRPass(Goal goal, Job job, Java2IRTranslator translator) {
super(goal);
this.fJob= job;
this.fTranslator= translator;
}
private final Java2IRTranslator fTranslator;
public boolean run() {
fTranslator.translate(fJob.ast(), fJob.source().name());
return true;
}
public JavaIRPass(Goal goal, Job job, Java2IRTranslator translator) {
super(goal);
this.fJob = job;
this.fTranslator = translator;
}
public boolean run() {
fTranslator.translate(fJob.ast(), fJob.source().name());
return true;
}
}

View File

@ -20,33 +20,36 @@ import polyglot.frontend.goals.Goal;
import com.ibm.wala.cast.tree.impl.CAstRewriterFactory;
/**
* A Polyglot extension descriptor for a test harness extension that generates DOMO IR for
* the sources and class files in the classpath.
* A Polyglot extension descriptor for a test harness extension that generates DOMO IR for the sources and class files in the
* classpath.
*
* @author rfuhrer
*/
public class JavaIRTranslatorExtension extends JLExtensionInfo implements IRTranslatorExtension {
protected PolyglotSourceLoaderImpl fSourceLoader;
protected PolyglotIdentityMapper fMapper;
protected CAstRewriterFactory rewriterFactory;
protected PolyglotSourceLoaderImpl fSourceLoader;
public void setSourceLoader(PolyglotSourceLoaderImpl sourceLoader) {
fSourceLoader= sourceLoader;
fMapper= new PolyglotIdentityMapper(sourceLoader.getReference(), typeSystem());
}
protected PolyglotIdentityMapper fMapper;
public Goal getCompileGoal(Job job) {
return new IRGoal(job, fSourceLoader);
}
protected CAstRewriterFactory rewriterFactory;
public PolyglotIdentityMapper getIdentityMapper() {
return fMapper;
}
public void setCAstRewriterFactory(CAstRewriterFactory factory) {
rewriterFactory = factory;
}
public CAstRewriterFactory getCAstRewriterFactory() {
return rewriterFactory;
}
public void setSourceLoader(PolyglotSourceLoaderImpl sourceLoader) {
fSourceLoader = sourceLoader;
fMapper = new PolyglotIdentityMapper(sourceLoader.getReference(), typeSystem());
}
public Goal getCompileGoal(Job job) {
return new IRGoal(job, fSourceLoader);
}
public PolyglotIdentityMapper getIdentityMapper() {
return fMapper;
}
public void setCAstRewriterFactory(CAstRewriterFactory factory) {
rewriterFactory = factory;
}
public CAstRewriterFactory getCAstRewriterFactory() {
return rewriterFactory;
}
}

View File

@ -30,10 +30,10 @@ import com.ibm.wala.types.ClassLoaderReference;
public class PolyglotClassLoaderFactory extends ClassLoaderFactoryImpl {
/**
* A map from ClassLoaderReference to IRTranslatorExtension, so that source files
* in different languages are processed by the right kind of IRTranslatorExtension.
* A map from ClassLoaderReference to IRTranslatorExtension, so that source files in different languages are processed by the
* right kind of IRTranslatorExtension.
*/
final protected Map<ClassLoaderReference,IRTranslatorExtension> fExtensionMap= new HashMap<ClassLoaderReference,IRTranslatorExtension>();
final protected Map<ClassLoaderReference, IRTranslatorExtension> fExtensionMap = new HashMap<ClassLoaderReference, IRTranslatorExtension>();
public PolyglotClassLoaderFactory(SetOfClasses exclusions, IRTranslatorExtension javaExtInfo) {
super(exclusions);
@ -47,7 +47,8 @@ public class PolyglotClassLoaderFactory extends ClassLoaderFactoryImpl {
protected IClassLoader makeNewClassLoader(ClassLoaderReference classLoaderReference, IClassHierarchy cha, IClassLoader parent,
AnalysisScope scope) throws IOException {
if (classLoaderReference.equals(JavaSourceAnalysisScope.SOURCE)) {
ClassLoaderImpl cl = new PolyglotSourceLoaderImpl(classLoaderReference, parent, getExclusions(), cha, getExtensionFor(classLoaderReference));
ClassLoaderImpl cl = new PolyglotSourceLoaderImpl(classLoaderReference, parent, getExclusions(), cha,
getExtensionFor(classLoaderReference));
cl.init(scope.getModules(classLoaderReference));
return cl;
} else {

View File

@ -30,68 +30,71 @@ import polyglot.util.Position;
import polyglot.util.StdErrorQueue;
/**
* Enhancement of core Polyglot compiler that takes as input a Collection of StreamSources.
* Identical to Compiler in all other respects.
* Enhancement of core Polyglot compiler that takes as input a Collection of StreamSources. Identical to Compiler in all other
* respects.
*
* @author rfuhrer
*/
public final class PolyglotFrontEnd extends Compiler {
public PolyglotFrontEnd(ExtensionInfo info, ErrorQueue eq) {
super(info, eq);
public PolyglotFrontEnd(ExtensionInfo info, ErrorQueue eq) {
super(info, eq);
}
public PolyglotFrontEnd(ExtensionInfo info) {
this(info, new StdErrorQueue(System.err, 1000 * 1000, info.compilerName()));
}
public boolean compile(Collection/* <StreamSource> */sources) {
boolean okay = false;
try {
try {
Scheduler scheduler = sourceExtension().scheduler();
List<Job> jobs = new ArrayList<Job>();
// First, create a goal to compile every source file.
for (Iterator i = sources.iterator(); i.hasNext();) {
StreamSource source = (StreamSource) i.next();
// mark this source as being explicitly specified by the user.
source.setUserSpecified(true);
// Add a new SourceJob for the given source. If a Job for the source
// already exists, then we will be given the existing job.
Job job = scheduler.addJob(source);
jobs.add(job);
// Now, add a goal for completing the job.
scheduler.addGoal(sourceExtension().getCompileGoal(job));
}
scheduler.setCommandLineJobs(jobs);
// Then, compile the files to completion.
okay = scheduler.runToCompletion();
} catch (InternalCompilerError e) {
// Report it like other errors, but rethrow to get the stack trace.
try {
errorQueue().enqueue(ErrorInfo.INTERNAL_ERROR, e.message(), e.position());
} catch (ErrorLimitError e2) {
}
errorQueue().flush();
throw e;
} catch (RuntimeException e) {
// Flush the error queue, then rethrow to get the stack trace.
errorQueue().enqueue(ErrorInfo.INTERNAL_ERROR, "Internal polyglot compiler error: " + e.getMessage(),
Position.COMPILER_GENERATED);
errorQueue().flush();
throw e;
}
} catch (ErrorLimitError e) {
}
public PolyglotFrontEnd(ExtensionInfo info) {
this(info, new StdErrorQueue(System.err, 1000 * 1000, info.compilerName()));
}
public boolean compile(Collection/*<StreamSource>*/sources) {
boolean okay= false;
try {
try {
Scheduler scheduler= sourceExtension().scheduler();
List<Job> jobs= new ArrayList<Job>();
// First, create a goal to compile every source file.
for(Iterator i= sources.iterator(); i.hasNext(); ) {
StreamSource source= (StreamSource) i.next();
// mark this source as being explicitly specified by the user.
source.setUserSpecified(true);
// Add a new SourceJob for the given source. If a Job for the source
// already exists, then we will be given the existing job.
Job job= scheduler.addJob(source);
jobs.add(job);
// Now, add a goal for completing the job.
scheduler.addGoal(sourceExtension().getCompileGoal(job));
}
scheduler.setCommandLineJobs(jobs);
// Then, compile the files to completion.
okay= scheduler.runToCompletion();
} catch (InternalCompilerError e) {
// Report it like other errors, but rethrow to get the stack trace.
try {
errorQueue().enqueue(ErrorInfo.INTERNAL_ERROR, e.message(), e.position());
} catch (ErrorLimitError e2) {
}
errorQueue().flush();
throw e;
} catch (RuntimeException e) {
// Flush the error queue, then rethrow to get the stack trace.
errorQueue().enqueue(ErrorInfo.INTERNAL_ERROR, "Internal polyglot compiler error: " + e.getMessage(), Position.COMPILER_GENERATED);
errorQueue().flush();
throw e;
}
} catch (ErrorLimitError e) {
}
errorQueue().flush();
for(Iterator i= allExtensions().iterator(); i.hasNext(); ) {
ExtensionInfo ext= (ExtensionInfo) i.next();
ext.getStats().report();
}
return okay;
errorQueue().flush();
for (Iterator i = allExtensions().iterator(); i.hasNext();) {
ExtensionInfo ext = (ExtensionInfo) i.next();
ext.getStats().report();
}
return okay;
}
}

View File

@ -35,196 +35,186 @@ import com.ibm.wala.util.debug.Assertions;
import com.ibm.wala.util.strings.Atom;
/**
* Class responsible for mapping Polyglot type system objects representing types,
* methods and fields to the corresponding WALA TypeReferences, MethodReferences
* and FieldReferences. Used during translation and by clients to help correlate
* WALA analysis results to the various AST nodes.
* Class responsible for mapping Polyglot type system objects representing types, methods and fields to the corresponding WALA
* TypeReferences, MethodReferences and FieldReferences. Used during translation and by clients to help correlate WALA analysis
* results to the various AST nodes.
*
* @author rfuhrer
*/
public class PolyglotIdentityMapper implements IdentityMapper<Type,CodeInstance,FieldInstance> {
private final Map<Type,TypeReference> fTypeMap= HashMapFactory.make();
private final Map<FieldInstance,FieldReference> fFieldMap= HashMapFactory.make();
private final Map<CodeInstance,MethodReference> fMethodMap= HashMapFactory.make();
public class PolyglotIdentityMapper implements IdentityMapper<Type, CodeInstance, FieldInstance> {
private final Map<Type, TypeReference> fTypeMap = HashMapFactory.make();
/**
* Map from Polyglot local ClassTypes to their enclosing methods. Used by localTypeToTypeID().<br>
* Needed since Polyglot doesn't provide this information. (It doesn't need to, since it
* doesn't need to generate unambiguous names for such entities -- it hands the source
* off to javac to generate bytecode. It probably also wouldn't want to, since that would
* create back-pointers from Type objects in the TypeSystem to AST's.)
*/
protected Map<ClassType,CodeInstance> fLocalTypeMap= new LinkedHashMap<ClassType,CodeInstance>();
private final Map<FieldInstance, FieldReference> fFieldMap = HashMapFactory.make();
private final ClassLoaderReference fClassLoaderRef;
private final TypeSystem fTypeSystem;
private final Map<CodeInstance, MethodReference> fMethodMap = HashMapFactory.make();
public PolyglotIdentityMapper(ClassLoaderReference clr, TypeSystem ts) {
fClassLoaderRef= clr;
fTypeSystem= ts;
/**
* Map from Polyglot local ClassTypes to their enclosing methods. Used by localTypeToTypeID().<br>
* Needed since Polyglot doesn't provide this information. (It doesn't need to, since it doesn't need to generate unambiguous
* names for such entities -- it hands the source off to javac to generate bytecode. It probably also wouldn't want to, since that
* would create back-pointers from Type objects in the TypeSystem to AST's.)
*/
protected Map<ClassType, CodeInstance> fLocalTypeMap = new LinkedHashMap<ClassType, CodeInstance>();
private final ClassLoaderReference fClassLoaderRef;
private final TypeSystem fTypeSystem;
public PolyglotIdentityMapper(ClassLoaderReference clr, TypeSystem ts) {
fClassLoaderRef = clr;
fTypeSystem = ts;
}
public FieldReference getFieldRef(FieldInstance field) {
if (!fFieldMap.containsKey(field)) {
FieldReference ref = referenceForField(field);
fFieldMap.put(field, ref);
return ref;
}
return fFieldMap.get(field);
}
public FieldReference getFieldRef(FieldInstance field) {
if (!fFieldMap.containsKey(field)) {
FieldReference ref= referenceForField(field);
fFieldMap.put(field, ref);
return ref;
public TypeReference getTypeRef(Type type) {
if (!fTypeMap.containsKey(type)) {
TypeReference ref = referenceForType(type);
fTypeMap.put(type, ref);
return ref;
}
return fTypeMap.get(type);
}
public MethodReference getMethodRef(CodeInstance method) {
if (!fMethodMap.containsKey(method)) {
MethodReference sel = referenceForMethod(method);
fMethodMap.put(method, sel);
return sel;
}
return fMethodMap.get(method);
}
public void mapLocalAnonTypeToMethod(ClassType anonLocalType, CodeInstance owningProc) {
fLocalTypeMap.put(anonLocalType, owningProc);
}
/**
* Create a FieldReference for the given Polyglot FieldInstance.<br>
* N.B.: This method <b>does not canonicalize</b> the FieldReferences, but rather creates a new one for each call. You more likely
* want to call getFieldRef(). This method is exposed so that multiple Polyglot instances can use the translation services without
* having FieldInstances collide (producing the dreaded "we are TypeSystem_c but type Foo is from TypeSystem_c" exception).
*/
public FieldReference referenceForField(FieldInstance field) {
Type targetType = field.container();
Type fieldType = field.type();
TypeReference targetTypeRef = TypeReference.findOrCreate(fClassLoaderRef, typeToTypeID(targetType));
TypeReference fieldTypeRef = TypeReference.findOrCreate(fClassLoaderRef, typeToTypeID(fieldType));
Atom fieldName = Atom.findOrCreateUnicodeAtom(field.name());
FieldReference fieldRef = FieldReference.findOrCreate(targetTypeRef, fieldName, fieldTypeRef);
return fieldRef;
}
/**
* Create a TypeReference for the given Polyglot Type.<br>
* N.B.: This method <b>does not canonicalize</b> the TypeReferences, but rather creates a new one for each call. You more likely
* want to call getTypeRef(). This method is exposed so that multiple Polyglot instances can use the translation services without
* having Types collide (producing the dreaded "we are TypeSystem_c but type Foo is from TypeSystem_c" exception).
*/
public TypeReference referenceForType(Type type) {
TypeName typeName = TypeName.string2TypeName(typeToTypeID(type));
TypeReference typeRef = TypeReference.findOrCreate(fClassLoaderRef, typeName);
return typeRef;
}
private Selector selectorForMethod(CodeInstance procInstance) {
Atom name = (procInstance instanceof ConstructorInstance) ? MethodReference.initAtom
: (procInstance instanceof InitializerInstance) ? MethodReference.clinitName : Atom
.findOrCreateUnicodeAtom(((MethodInstance) procInstance).name());
TypeName[] argTypeNames = null;
if (!(procInstance instanceof InitializerInstance)) {
List formalTypes = ((ProcedureInstance) procInstance).formalTypes();
int numArgs = formalTypes.size();
// Descriptor prefers null to an empty array
if (numArgs > 0) {
argTypeNames = new TypeName[numArgs];
int i = 0;
for (Iterator iter = formalTypes.iterator(); iter.hasNext(); i++) {
Type argType = (Type) iter.next();
argTypeNames[i] = TypeName.string2TypeName(typeToTypeID(argType));
}
return fFieldMap.get(field);
}
public TypeReference getTypeRef(Type type) {
if (!fTypeMap.containsKey(type)) {
TypeReference ref= referenceForType(type);
fTypeMap.put(type, ref);
return ref;
}
return fTypeMap.get(type);
}
public MethodReference getMethodRef(CodeInstance method) {
if (!fMethodMap.containsKey(method)) {
MethodReference sel= referenceForMethod(method);
fMethodMap.put(method, sel);
return sel;
}
return fMethodMap.get(method);
}
public void mapLocalAnonTypeToMethod(ClassType anonLocalType, CodeInstance owningProc) {
fLocalTypeMap.put(anonLocalType, owningProc);
}
/**
* Create a FieldReference for the given Polyglot FieldInstance.<br>
* N.B.: This method <b>does not canonicalize</b> the FieldReferences,
* but rather creates a new one for each call.
* You more likely want to call getFieldRef(). This method is exposed
* so that multiple Polyglot instances can use the translation services
* without having FieldInstances collide (producing the dreaded "we are
* TypeSystem_c but type Foo is from TypeSystem_c" exception).
*/
public FieldReference referenceForField(FieldInstance field) {
Type targetType= field.container();
Type fieldType= field.type();
TypeReference targetTypeRef= TypeReference.findOrCreate(fClassLoaderRef, typeToTypeID(targetType));
TypeReference fieldTypeRef= TypeReference.findOrCreate(fClassLoaderRef, typeToTypeID(fieldType));
Atom fieldName= Atom.findOrCreateUnicodeAtom(field.name());
FieldReference fieldRef= FieldReference.findOrCreate(targetTypeRef, fieldName, fieldTypeRef);
return fieldRef;
}
/**
* Create a TypeReference for the given Polyglot Type.<br>
* N.B.: This method <b>does not canonicalize</b> the TypeReferences,
* but rather creates a new one for each call.
* You more likely want to call getTypeRef(). This method is exposed
* so that multiple Polyglot instances can use the translation services
* without having Types collide (producing the dreaded "we are
* TypeSystem_c but type Foo is from TypeSystem_c" exception).
*/
public TypeReference referenceForType(Type type) {
TypeName typeName= TypeName.string2TypeName(typeToTypeID(type));
TypeReference typeRef= TypeReference.findOrCreate(fClassLoaderRef, typeName);
return typeRef;
}
private Selector selectorForMethod(CodeInstance procInstance) {
Atom name=
(procInstance instanceof ConstructorInstance) ?
MethodReference.initAtom :
(procInstance instanceof InitializerInstance) ?
MethodReference.clinitName :
Atom.findOrCreateUnicodeAtom(((MethodInstance) procInstance).name());
TypeName[] argTypeNames = null;
if (! (procInstance instanceof InitializerInstance)) {
List formalTypes = ((ProcedureInstance)procInstance).formalTypes();
int numArgs = formalTypes.size();
// Descriptor prefers null to an empty array
if (numArgs > 0) {
argTypeNames = new TypeName[numArgs];
int i = 0;
for(Iterator iter = formalTypes.iterator(); iter.hasNext(); i++) {
Type argType= (Type) iter.next();
argTypeNames[i]= TypeName.string2TypeName(typeToTypeID(argType));
}
}
}
Type retType=
(procInstance instanceof MethodInstance) ? ((MethodInstance) procInstance).returnType() : fTypeSystem.Void();
TypeName retTypeName= TypeName.string2TypeName(typeToTypeID(retType));
Descriptor desc= Descriptor.findOrCreate(argTypeNames, retTypeName);
return new Selector(name, desc);
}
/**
* Create a MethodReference for the given Polyglot MethodInstance.<br>
* N.B.: This method <b>does not canonicalize</b> the MethodReferences,
* but rather creates a new one for each call.
* You more likely want to call getMethodRef(). This method is exposed
* so that multiple Polyglot instances can use the translation services
* without having MethodInstances collide (producing the dreaded "we are
* TypeSystem_c but type Foo is from TypeSystem_c" exception).
*/
public MethodReference referenceForMethod(CodeInstance procInstance) {
// Handles both ConstructorInstance's and MethodInstance's
TypeName ownerType= TypeName.string2TypeName(typeToTypeID(((MemberInstance)procInstance).container()));
TypeReference ownerTypeRef= TypeReference.findOrCreate(fClassLoaderRef, ownerType);
MethodReference methodRef= MethodReference.findOrCreate(ownerTypeRef, selectorForMethod(procInstance));
Type retType = (procInstance instanceof MethodInstance) ? ((MethodInstance) procInstance).returnType() : fTypeSystem.Void();
TypeName retTypeName = TypeName.string2TypeName(typeToTypeID(retType));
return methodRef;
Descriptor desc = Descriptor.findOrCreate(argTypeNames, retTypeName);
return new Selector(name, desc);
}
/**
* Create a MethodReference for the given Polyglot MethodInstance.<br>
* N.B.: This method <b>does not canonicalize</b> the MethodReferences, but rather creates a new one for each call. You more
* likely want to call getMethodRef(). This method is exposed so that multiple Polyglot instances can use the translation services
* without having MethodInstances collide (producing the dreaded "we are TypeSystem_c but type Foo is from TypeSystem_c"
* exception).
*/
public MethodReference referenceForMethod(CodeInstance procInstance) {
// Handles both ConstructorInstance's and MethodInstance's
TypeName ownerType = TypeName.string2TypeName(typeToTypeID(((MemberInstance) procInstance).container()));
TypeReference ownerTypeRef = TypeReference.findOrCreate(fClassLoaderRef, ownerType);
MethodReference methodRef = MethodReference.findOrCreate(ownerTypeRef, selectorForMethod(procInstance));
return methodRef;
}
/**
* Translates the given Polyglot type to a name suitable for use in a DOMO TypeReference (i.e. a bytecode-compliant type name).
*/
public String typeToTypeID(Type type) {
if (type.isPrimitive()) {
PrimitiveType ptype = (PrimitiveType) type;
return JavaPrimitiveTypeMap.getShortName(ptype.name());
} else if (type.isArray()) {
ArrayType atype = (ArrayType) type;
return "[" + typeToTypeID(atype.base());
} else if (type.isNull()) {
Assertions.UNREACHABLE("typeToTypeID() encountered a null type!");
return null;
}
Assertions._assert(type.isClass(), "typeToTypeID() encountered the type " + type
+ " that is neither primitive, array, nor class!");
/**
* Translates the given Polyglot type to a name suitable for use in a DOMO TypeReference
* (i.e. a bytecode-compliant type name).
*/
public String typeToTypeID(Type type) {
if (type.isPrimitive()) {
PrimitiveType ptype= (PrimitiveType) type;
ClassType ctype = (ClassType) type;
return JavaPrimitiveTypeMap.getShortName(ptype.name());
} else if (type.isArray()) {
ArrayType atype= (ArrayType) type;
return "[" + typeToTypeID(atype.base());
} else if (type.isNull()) {
Assertions.UNREACHABLE("typeToTypeID() encountered a null type!");
return null;
}
Assertions._assert(type.isClass(), "typeToTypeID() encountered the type " + type + " that is neither primitive, array, nor class!");
return (ctype.isLocal() || ctype.isAnonymous()) ? anonLocalTypeToTypeID(ctype) : composeDOMOTypeDescriptor(ctype);
}
ClassType ctype= (ClassType) type;
public String anonLocalTypeToTypeID(ClassType ctype) {
CodeInstance procInstance = (CodeInstance) fLocalTypeMap.get(ctype);
return (ctype.isLocal() || ctype.isAnonymous()) ? anonLocalTypeToTypeID(ctype) : composeDOMOTypeDescriptor(ctype);
}
public String anonLocalTypeToTypeID(ClassType ctype) {
CodeInstance procInstance= (CodeInstance) fLocalTypeMap.get(ctype);
String outerTypeID= typeToTypeID(ctype.outer());
String shortName= (ctype.isAnonymous()) ? PolyglotJava2CAstTranslator.anonTypeName(ctype) : ctype.fullName();
return outerTypeID + '/' + getMethodRef(procInstance).getSelector() + '/' + shortName;
}
public String composeDOMOTypeDescriptor(ClassType ctype) {
return "L" + composeDOMOTypeName(ctype);
}
public String composeDOMOTypeName(ClassType ctype) {
if (ctype.package_() != null) {
String packageName = ctype.package_().fullName();
Assertions._assert( ctype.fullName().startsWith( packageName ) );
return packageName.replace('.','/') + "/" + ctype.fullName().substring( packageName.length()+1 ).replace('.','$');
} else {
return ctype.fullName().replace('.', '$');
}
String outerTypeID = typeToTypeID(ctype.outer());
String shortName = (ctype.isAnonymous()) ? PolyglotJava2CAstTranslator.anonTypeName(ctype) : ctype.fullName();
return outerTypeID + '/' + getMethodRef(procInstance).getSelector() + '/' + shortName;
}
public String composeDOMOTypeDescriptor(ClassType ctype) {
return "L" + composeDOMOTypeName(ctype);
}
public String composeDOMOTypeName(ClassType ctype) {
if (ctype.package_() != null) {
String packageName = ctype.package_().fullName();
Assertions._assert(ctype.fullName().startsWith(packageName));
return packageName.replace('.', '/') + "/" + ctype.fullName().substring(packageName.length() + 1).replace('.', '$');
} else {
return ctype.fullName().replace('.', '$');
}
}
}

View File

@ -359,8 +359,8 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
Expr init = f.init();
CAstNode rhsNode;
if ( init instanceof ArrayInit ) {
rhsNode = visit((ArrayInit)init,ctorContext,f.declType());
if (init instanceof ArrayInit) {
rhsNode = visit((ArrayInit) init, ctorContext, f.declType());
} else {
rhsNode = walkNodes(init, ctorContext);
}
@ -391,8 +391,7 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
}
/*
* If we've handled all the parent cases, this should never be called --
* visit(ArrayInit,WalkContext,Type) should be instead.
* If we've handled all the parent cases, this should never be called -- visit(ArrayInit,WalkContext,Type) should be instead.
*/
public CAstNode visit(ArrayInit ai, WalkContext wc) {
if (((ArrayType) ai.type()).base().isNull()) {
@ -407,8 +406,8 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
.elements().size()));
for (Iterator iter = ai.elements().iterator(); iter.hasNext(); idx++) {
Expr element = (Expr) iter.next();
if ( element instanceof ArrayInit ) {
eltNodes[idx] = visit((ArrayInit)element, wc, ((ArrayType)ai.type()).base());
if (element instanceof ArrayInit) {
eltNodes[idx] = visit((ArrayInit) element, wc, ((ArrayType) ai.type()).base());
} else {
eltNodes[idx] = walkNodes(element, wc);
}
@ -421,9 +420,8 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
}
/*
* Workaround for the null array init bug: just in case ai.type().base() is null (e.g.
* "new Object[] {null}") we get the type from the parent (in this example, a
* NewArray of type Object[])
* Workaround for the null array init bug: just in case ai.type().base() is null (e.g. "new Object[] {null}") we get the type
* from the parent (in this example, a NewArray of type Object[])
*/
public CAstNode visit(ArrayInit ai, WalkContext wc, Type t) {
TypeReference newTypeRef = fIdentityMapper.getTypeRef(t);
@ -434,8 +432,8 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
.elements().size()));
for (Iterator iter = ai.elements().iterator(); iter.hasNext(); idx++) {
Expr element = (Expr) iter.next();
if ( element instanceof ArrayInit ) {
eltNodes[idx] = visit((ArrayInit)element, wc, ((ArrayType)t).base());
if (element instanceof ArrayInit) {
eltNodes[idx] = visit((ArrayInit) element, wc, ((ArrayType) t).base());
} else {
eltNodes[idx] = walkNodes(element, wc);
}
@ -464,36 +462,23 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
if (la.operator() == Assign.ASSIGN) {
return makeNode(wc, fFactory, la, CAstNode.ASSIGN, walkNodes(la.left(), lvc), walkNodes(la.right(), wc));
} else {
CAstNode op =
makeNode(wc,
fFactory,
la,
CAstNode.ASSIGN_PRE_OP,
walkNodes(la.left(), lvc),
walkNodes(la.right(), wc),
mapAssignOperator(la.operator()));
CAstNode op = makeNode(wc, fFactory, la, CAstNode.ASSIGN_PRE_OP, walkNodes(la.left(), lvc), walkNodes(la.right(), wc),
mapAssignOperator(la.operator()));
if (la.type().isLongOrLess()
&& (mapAssignOperator(la.operator()) == CAstOperator.OP_DIV || mapAssignOperator(la.operator()) == CAstOperator.OP_MOD)) {
Collection excTargets = wc.getCatchTargets(fDivByZeroType);
if (!excTargets.isEmpty()) {
for (Iterator iterator = excTargets.iterator(); iterator.hasNext();) {
Pair catchPair = (Pair) iterator.next();
wc.cfg().add(op, catchPair.snd, fDivByZeroType);
}
} else {
wc.cfg().add(op, CAstControlFlowMap.EXCEPTION_TO_EXIT, fDivByZeroType);
}
}
if (la.type().isLongOrLess() &&
(mapAssignOperator(la.operator())==CAstOperator.OP_DIV ||
mapAssignOperator(la.operator())==CAstOperator.OP_MOD))
{
Collection excTargets = wc.getCatchTargets(fDivByZeroType);
if (!excTargets.isEmpty()) {
for (Iterator iterator = excTargets.iterator();
iterator.hasNext();)
{
Pair catchPair = (Pair) iterator.next();
wc.cfg().add(op, catchPair.snd, fDivByZeroType);
}
} else {
wc.cfg().add(op,
CAstControlFlowMap.EXCEPTION_TO_EXIT,
fDivByZeroType);
}
}
return op;
return op;
}
}
@ -534,53 +519,49 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
else if (operator.equals(Binary.COND_OR))
return makeNode(wc, fFactory, b, CAstNode.IF_EXPR, walkNodes(left, wc), fFactory.makeConstant(true), walkNodes(right, wc));
else {
Type leftType = left.type();
Type rightType = right.type();
if (leftType.isPrimitive() && rightType.isPrimitive()) {
CAstNode leftNode = walkNodes(left, wc);
CAstNode rightNode = walkNodes(right, wc);
try {
Type result = fTypeSystem.promote(leftType, rightType);
Type leftType = left.type();
Type rightType = right.type();
if (leftType.isPrimitive() && rightType.isPrimitive()) {
CAstNode leftNode = walkNodes(left, wc);
CAstNode rightNode = walkNodes(right, wc);
if (! result.equals(leftType)) {
leftNode = makeNode(wc, fFactory, b, CAstNode.CAST, fFactory.makeConstant(getTypeDict().getCAstTypeFor(result)), leftNode, fFactory.makeConstant(getTypeDict().getCAstTypeFor(leftType)));
}
try {
Type result = fTypeSystem.promote(leftType, rightType);
if (! result.equals(rightType)) {
rightNode = makeNode(wc, fFactory, b, CAstNode.CAST, fFactory.makeConstant(getTypeDict().getCAstTypeFor(result)), rightNode, fFactory.makeConstant(getTypeDict().getCAstTypeFor(rightType)));
}
} catch (SemanticException e) {
if (!result.equals(leftType)) {
leftNode = makeNode(wc, fFactory, b, CAstNode.CAST, fFactory.makeConstant(getTypeDict().getCAstTypeFor(result)),
leftNode, fFactory.makeConstant(getTypeDict().getCAstTypeFor(leftType)));
}
}
if (!result.equals(rightType)) {
rightNode = makeNode(wc, fFactory, b, CAstNode.CAST, fFactory.makeConstant(getTypeDict().getCAstTypeFor(result)),
rightNode, fFactory.makeConstant(getTypeDict().getCAstTypeFor(rightType)));
}
} catch (SemanticException e) {
CAstNode op = makeNode(wc, fFactory, b, CAstNode.BINARY_EXPR, mapBinaryOpcode(operator), leftNode, rightNode);
}
if (leftType.isLongOrLess() &&
rightType.isLongOrLess() &&
(mapBinaryOpcode(operator)==CAstOperator.OP_DIV ||
mapBinaryOpcode(operator)==CAstOperator.OP_MOD))
{
Collection excTargets = wc.getCatchTargets(fDivByZeroType);
if (!excTargets.isEmpty()) {
for (Iterator iterator = excTargets.iterator();
iterator.hasNext();)
{
Pair catchPair = (Pair) iterator.next();
wc.cfg().add(op, catchPair.snd, fDivByZeroType);
}
} else {
wc.cfg().add(op,
CAstControlFlowMap.EXCEPTION_TO_EXIT,
fDivByZeroType);
}
}
CAstNode op = makeNode(wc, fFactory, b, CAstNode.BINARY_EXPR, mapBinaryOpcode(operator), leftNode, rightNode);
return op;
} else {
return makeNode(wc, fFactory, b, CAstNode.BINARY_EXPR, mapBinaryOpcode(operator), walkNodes(left, wc), walkNodes(right, wc));
}
if (leftType.isLongOrLess() && rightType.isLongOrLess()
&& (mapBinaryOpcode(operator) == CAstOperator.OP_DIV || mapBinaryOpcode(operator) == CAstOperator.OP_MOD)) {
Collection excTargets = wc.getCatchTargets(fDivByZeroType);
if (!excTargets.isEmpty()) {
for (Iterator iterator = excTargets.iterator(); iterator.hasNext();) {
Pair catchPair = (Pair) iterator.next();
wc.cfg().add(op, catchPair.snd, fDivByZeroType);
}
} else {
wc.cfg().add(op, CAstControlFlowMap.EXCEPTION_TO_EXIT, fDivByZeroType);
}
}
return op;
} else {
return makeNode(wc, fFactory, b, CAstNode.BINARY_EXPR, mapBinaryOpcode(operator), walkNodes(left, wc), walkNodes(right,
wc));
}
}
}
@ -700,13 +681,12 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
Type castedFrom = arg.type();
Type castedTo = c.castType().type();
// null can go into anything (e.g. in "((Foobar) null)" null can be assumed to be of type Foobar already)
if ( castedFrom.isNull() )
// null can go into anything (e.g. in "((Foobar) null)" null can be assumed to be of type Foobar already)
if (castedFrom.isNull())
castedFrom = castedTo;
CAstNode ast = makeNode(wc, fFactory, c, CAstNode.CAST, fFactory.makeConstant(getTypeDict().getCAstTypeFor(castedTo)),
walkNodes(arg, wc),
fFactory.makeConstant(getTypeDict().getCAstTypeFor(castedFrom)));
walkNodes(arg, wc), fFactory.makeConstant(getTypeDict().getCAstTypeFor(castedFrom)));
Collection excTargets = wc.getCatchTargets(fCCEType);
if (!excTargets.isEmpty()) {
@ -790,14 +770,14 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
String tmpName = "ctor temp"; // this name is an illegal Java
// identifier
// new nodes with an explicit enclosing argument, e.g. "outer.new Inner()". They are mostly treated the same, except in JavaCAst2IRTranslator.doNewObject
// new nodes with an explicit enclosing argument, e.g. "outer.new Inner()". They are mostly treated the same, except in
// JavaCAst2IRTranslator.doNewObject
CAstNode newNode;
Expr enclosing = n.qualifier();
if ( enclosing != null ) {
if (enclosing != null) {
CAstNode encNode = walkNodes(enclosing, wc);
newNode = makeNode(wc, fFactory, n, CAstNode.NEW_ENCLOSING, fFactory.makeConstant(newTypeRef), encNode);
}
else
} else
newNode = makeNode(wc, fFactory, n, CAstNode.NEW, fFactory.makeConstant(newTypeRef));
// end enclosing new stuff
@ -909,9 +889,9 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
CAstNode n = makeNode(wc, fFactory, aa, CAstNode.ARRAY_REF, walkNodes(aa.array(), wc), fFactory.makeConstant(eltTypeRef),
walkNodes(aa.index(), wc));
wc.cfg().map(aa, n);
return n;
}
@ -938,9 +918,9 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
// CAst -> IR translator interprets as a static ref).
if (fi.isConstant()) {
return makeNode(wc, fFactory, f, CAstNode.BLOCK_EXPR, targetNode, // can
// have
// side
// effects!
// have
// side
// effects!
translateConstant(fi.constantValue()));
} else {
return makeNode(wc, fFactory, f, CAstNode.BLOCK_EXPR, targetNode, makeNode(wc, fFactory, f, CAstNode.OBJECT_REF,
@ -965,9 +945,9 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
if (fi.isConstant()) {
return makeNode(wc, fFactory, f, CAstNode.BLOCK_EXPR, refNode, // can
// have
// side
// effects!
// have
// side
// effects!
translateConstant(fi.constantValue()));
} else {
return refNode;
@ -1067,16 +1047,13 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
wc.getLabelMap().put(stmt, l.label());
CAstNode result;
if (! (l.statement() instanceof Empty)) {
WalkContext child = new BreakContext(wc, l.label(), breakTarget);
if (!(l.statement() instanceof Empty)) {
WalkContext child = new BreakContext(wc, l.label(), breakTarget);
result =
makeNode(wc, fFactory, l, CAstNode.BLOCK_STMT,
makeNode(wc, fFactory, l, CAstNode.LABEL_STMT, fFactory.makeConstant(l.label()), walkNodes(l.statement(), child)),
walkNodes(breakTarget, wc));
result = makeNode(wc, fFactory, l, CAstNode.BLOCK_STMT, makeNode(wc, fFactory, l, CAstNode.LABEL_STMT, fFactory
.makeConstant(l.label()), walkNodes(l.statement(), child)), walkNodes(breakTarget, wc));
} else {
result =
makeNode(wc, fFactory, l, CAstNode.LABEL_STMT, fFactory.makeConstant(l.label()), walkNodes(l.statement(), wc));
result = makeNode(wc, fFactory, l, CAstNode.LABEL_STMT, fFactory.makeConstant(l.label()), walkNodes(l.statement(), wc));
}
wc.cfg().map(l, result);
@ -1162,16 +1139,15 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
LoopContext lc = new LoopContext(wc, loopLabel, breakTarget, continueTarget);
/*
* The following loop is created sligtly differently than in jscore. It
* doesn't have a specific target for continue.
* The following loop is created sligtly differently than in jscore. It doesn't have a specific target for continue.
*/
return makeNode(wc, fFactory, w, CAstNode.BLOCK_STMT, makeNode(wc, fFactory, w, CAstNode.LOOP, walkNodes(c, wc), makeNode(wc,
fFactory, w, CAstNode.BLOCK_STMT, walkNodes(b, lc), walkNodes(continueTarget, wc))), walkNodes(breakTarget, wc));
}
public CAstNode visit(Switch s, WalkContext wc) {
Node breakLabel = fNodeFactory.Labeled(s.position(), "switchBreakLabel"
+ s.position().toString().replace('.', '_'), fNodeFactory.Empty(s.position()));
Node breakLabel = fNodeFactory.Labeled(s.position(), "switchBreakLabel" + s.position().toString().replace('.', '_'),
fNodeFactory.Empty(s.position()));
CAstNode breakAst = walkNodes(breakLabel, wc);
String loopLabel = (String) wc.getLabelMap().get(s);
WalkContext child = new BreakContext(wc, loopLabel, breakLabel);
@ -1278,9 +1254,9 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
else
initNode = fFactory.makeConstant(null);
} else if (init instanceof ArrayInit)
initNode = visit((ArrayInit) init, wc, type);
initNode = visit((ArrayInit) init, wc, type);
else
initNode = walkNodes(init, wc);
initNode = walkNodes(init, wc);
Object defaultValue;
if (type.isLongOrLess())
@ -2084,7 +2060,8 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
}
public Collection<Pair<Type, Object>> getCatchTargets(Type label) {
Collection<Pair<Type, Object>> result = Collections.singleton(Pair.<Type,Object>make(fREType, CAstControlFlowMap.EXCEPTION_TO_EXIT));
Collection<Pair<Type, Object>> result = Collections.singleton(Pair.<Type, Object> make(fREType,
CAstControlFlowMap.EXCEPTION_TO_EXIT));
return result;
}
@ -2097,7 +2074,7 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
@SuppressWarnings("unused")
private final Try tryNode;
Collection<Pair<Type,Object>> fCatchNodes = new ArrayList<Pair<Type, Object>>();
Collection<Pair<Type, Object>> fCatchNodes = new ArrayList<Pair<Type, Object>>();
TryCatchContext(WalkContext parent, Try tryNode) {
super(parent);
@ -2105,7 +2082,7 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
for (Iterator catchIter = tryNode.catchBlocks().iterator(); catchIter.hasNext();) {
Catch c = (Catch) catchIter.next();
Pair<Type,Object> p = Pair.make(c.catchType(), (Object)c);
Pair<Type, Object> p = Pair.make(c.catchType(), (Object) c);
fCatchNodes.add(p);
}
@ -2312,7 +2289,7 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
public int getLastCol() {
return p.endColumn();
}
public int getFirstOffset() {
return p.offset();
}
@ -2454,8 +2431,9 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
/**
* Maps front-end-specific representations into WALA references of the appropriate kind.
*
* @author rfuhrer
*
*
* @param <T> The front-end-specific representation of a type (e.g., for Polyglot, a Type)
* @param <M> The front-end-specific representation of a procedure/method (e.g., for Polyglot, a CodeInstance)
* @param <F> The front-end-specific representation of a field (e.g., for Polyglot, a FieldInstance)

View File

@ -23,19 +23,19 @@ import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.types.ClassLoaderReference;
public class PolyglotSourceLoaderImpl extends JavaSourceLoaderImpl {
private final IRTranslatorExtension fExtInfo;
private final IRTranslatorExtension fExtInfo;
public PolyglotSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions,
IClassHierarchy cha, IRTranslatorExtension extInfo) throws IOException {
super(loaderRef, parent, exclusions, cha);
this.fExtInfo = extInfo;
}
public PolyglotSourceLoaderImpl(ClassLoaderReference loaderRef, IClassLoader parent, SetOfClasses exclusions,
IClassHierarchy cha, IRTranslatorExtension extInfo) throws IOException {
super(loaderRef, parent, exclusions, cha);
this.fExtInfo = extInfo;
}
public IRTranslatorExtension getTranslatorExtension() {
return fExtInfo;
}
public IRTranslatorExtension getTranslatorExtension() {
return fExtInfo;
}
protected SourceModuleTranslator getTranslator() {
return new PolyglotSourceModuleTranslator(cha.getScope(), fExtInfo, this);
}
protected SourceModuleTranslator getTranslator() {
return new PolyglotSourceModuleTranslator(cha.getScope(), fExtInfo, this);
}
}

View File

@ -39,108 +39,110 @@ import com.ibm.wala.types.ClassLoaderReference;
import com.ibm.wala.util.debug.Assertions;
/**
* A SourceModuleTranslator whose implementation of loadAllSources() uses the PolyglotFrontEnd
* pseudo-compiler to generate DOMO IR for the sources in the compile-time classpath.
* A SourceModuleTranslator whose implementation of loadAllSources() uses the PolyglotFrontEnd pseudo-compiler to generate DOMO IR
* for the sources in the compile-time classpath.
*
* @author rfuhrer
*/
public class PolyglotSourceModuleTranslator implements SourceModuleTranslator {
private final ExtensionInfo fExtInfo;
private final ExtensionInfo fExtInfo;
private String fClassPath;
private String fClassPath;
public PolyglotSourceModuleTranslator(AnalysisScope scope, IRTranslatorExtension extInfo, PolyglotSourceLoaderImpl sourceLoader) {
fExtInfo= (ExtensionInfo) extInfo;
computeClassPath(scope);
extInfo.setSourceLoader(sourceLoader);
}
public PolyglotSourceModuleTranslator(AnalysisScope scope, IRTranslatorExtension extInfo, PolyglotSourceLoaderImpl sourceLoader) {
fExtInfo = (ExtensionInfo) extInfo;
computeClassPath(scope);
extInfo.setSourceLoader(sourceLoader);
}
private void computeClassPath(AnalysisScope scope) {
StringBuffer buf= new StringBuffer();
private void computeClassPath(AnalysisScope scope) {
StringBuffer buf = new StringBuffer();
ClassLoaderReference cl= findInnermostClassLoader(scope);
ClassLoaderReference cl = findInnermostClassLoader(scope);
while (cl != null) {
List<Module> modules= scope.getModules(cl);
while (cl != null) {
List<Module> modules = scope.getModules(cl);
for(Iterator<Module> iter= modules.iterator(); iter.hasNext(); ) {
Module m= (Module) iter.next();
for (Iterator<Module> iter = modules.iterator(); iter.hasNext();) {
Module m = (Module) iter.next();
if (buf.length() > 0)
buf.append(File.pathSeparator);
if (m instanceof JarFileModule) {
JarFileModule jarFileModule= (JarFileModule) m;
if (buf.length() > 0)
buf.append(File.pathSeparator);
if (m instanceof JarFileModule) {
JarFileModule jarFileModule = (JarFileModule) m;
buf.append(jarFileModule.getAbsolutePath());
} else if (m instanceof DirectoryTreeModule) {
DirectoryTreeModule directoryTreeModule= (DirectoryTreeModule) m;
buf.append(jarFileModule.getAbsolutePath());
} else if (m instanceof DirectoryTreeModule) {
DirectoryTreeModule directoryTreeModule = (DirectoryTreeModule) m;
buf.append(directoryTreeModule.getPath());
buf.append(directoryTreeModule.getPath());
} else if (m instanceof FileModule) {
// do nothing
} else
Assertions.UNREACHABLE("Module entry is neither jar file nor directory");
}
cl= cl.getParent();
}
fClassPath= buf.toString();
}
private ClassLoaderReference findInnermostClassLoader(AnalysisScope scope) {
Set<ClassLoaderReference> parentLoaders= new HashSet<ClassLoaderReference>();
for(ClassLoaderReference loader: scope.getLoaders()) {
parentLoaders.add(loader.getParent());
} else
Assertions.UNREACHABLE("Module entry is neither jar file nor directory");
}
for (ClassLoaderReference child : scope.getLoaders()) {
if (!parentLoaders.contains(child)) {
return child;
}
cl = cl.getParent();
}
fClassPath = buf.toString();
}
private ClassLoaderReference findInnermostClassLoader(AnalysisScope scope) {
Set<ClassLoaderReference> parentLoaders = new HashSet<ClassLoaderReference>();
for (ClassLoaderReference loader : scope.getLoaders()) {
parentLoaders.add(loader.getParent());
}
for (ClassLoaderReference child : scope.getLoaders()) {
if (!parentLoaders.contains(child)) {
return child;
}
throw new IllegalStateException("No innermost class loader???");
}
throw new IllegalStateException("No innermost class loader???");
}
public void loadAllSources(Set modules) {
Options opts = fExtInfo.getOptions();
opts.assertions = true;
Options.global = opts;
try {
opts.parseCommandLine(new String[] { "-cp", fClassPath }, new HashSet());
} catch (UsageError e) {
// Assertions.UNREACHABLE("Error parsing classpath spec???");
}
public void loadAllSources(Set modules) {
Options opts= fExtInfo.getOptions();
opts.assertions = true;
Options.global = opts;
try {
opts.parseCommandLine(new String[] { "-cp", fClassPath }, new HashSet());
} catch (UsageError e) {
// Assertions.UNREACHABLE("Error parsing classpath spec???");
}
Compiler compiler = new PolyglotFrontEnd(fExtInfo);
List<StreamSource> streams = new ArrayList<StreamSource>();
Compiler compiler= new PolyglotFrontEnd(fExtInfo);
List<StreamSource> streams= new ArrayList<StreamSource>();
// N.B.: 'modules' is a flat set of source file ModuleEntry's.
for (Iterator it = modules.iterator(); it.hasNext();) {
SourceFileModule entry = (SourceFileModule) it.next();
// N.B.: 'modules' is a flat set of source file ModuleEntry's.
for(Iterator it= modules.iterator(); it.hasNext(); ) {
SourceFileModule entry= (SourceFileModule) it.next();
Assertions._assert(entry.isSourceFile());
Assertions._assert(entry.isSourceFile());
if (skipSourceFile(entry)) {
continue;
}
if (skipSourceFile(entry)) {
continue;
}
String filePath = entry.getAbsolutePath();
String filePath= entry.getAbsolutePath();
try {
StreamSource srcStream = new StreamSource(entry.getInputStream(), filePath);
try {
StreamSource srcStream= new StreamSource(entry.getInputStream(), filePath);
streams.add(srcStream);
} catch (IOException e) {
compiler.errorQueue().enqueue(new ErrorInfo(ErrorInfo.IO_ERROR, "Unable to open source file '" + entry.getName() + "'", Position.COMPILER_GENERATED));
}
}
compiler.compile(streams);
// At this point, DOMO now "knows" about all the source-originated stuff
streams.add(srcStream);
} catch (IOException e) {
compiler.errorQueue().enqueue(
new ErrorInfo(ErrorInfo.IO_ERROR, "Unable to open source file '" + entry.getName() + "'", Position.COMPILER_GENERATED));
}
}
compiler.compile(streams);
// At this point, DOMO now "knows" about all the source-originated stuff
}
/**
* @return true if the given source file module should not be processed,
* e.g. because it is generated on behalf of some upstream source.
*/
protected boolean skipSourceFile(SourceFileModule entry) {
return false;
}
/**
* @return true if the given source file module should not be processed, e.g. because it is generated on behalf of some upstream
* source.
*/
protected boolean skipSourceFile(SourceFileModule entry) {
return false;
}
}

View File

@ -22,24 +22,24 @@ import polyglot.frontend.FileSource;
/**
* A Polyglot Source whose input comes from an InputStream.<br>
* Currently extends FileSource since that's all that the Polyglot Compiler class
* will accept.
* Currently extends FileSource since that's all that the Polyglot Compiler class will accept.
*
* @author rfuhrer
*/
public class StreamSource extends FileSource {
private InputStream fStream;
private InputStream fStream;
public StreamSource(InputStream s, String fullPath) throws IOException {
super(new File(fullPath), true);
fStream= s;
public StreamSource(InputStream s, String fullPath) throws IOException {
super(new File(fullPath), true);
fStream = s;
}
public Reader open() throws IOException {
if (reader == null) {
reader = createReader(fStream);
}
public Reader open() throws IOException {
if (reader == null) {
reader = createReader(fStream);
}
return reader;
}
return reader;
}
}

View File

@ -75,62 +75,118 @@ import com.ibm.wala.cast.tree.CAstNode;
/**
* An alternative visitor API for Polyglot, whose API is somewhat brain-damaged...
*
* @author rfuhrer
*/
public interface TranslatingVisitor {
CAstNode visit(MethodDecl m, MethodContext context);
CAstNode visit(ConstructorDecl cd, MethodContext cc);
CAstNode visit(FieldDecl f, MethodContext mc); // yes, a MethodContext; we process FieldDecl's only to add their initializers to each constructor
CAstNode visit(Import i, WalkContext wc);
CAstNode visit(PackageNode p, WalkContext wc);
CAstNode visit(CanonicalTypeNode ctn, WalkContext wc);
CAstNode visit(ArrayTypeNode ctn, WalkContext wc);
CAstNode visit(ArrayInit ai, WalkContext wc);
CAstNode visit(ArrayAccessAssign aaa, WalkContext wc);
CAstNode visit(FieldAssign fa, WalkContext wc);
CAstNode visit(LocalAssign la, WalkContext wc);
CAstNode visit(Binary b, WalkContext wc);
CAstNode visit(Call c, WalkContext wc);
CAstNode visit(ConstructorCall cc, WalkContext wc);
CAstNode visit(Cast c, WalkContext wc);
CAstNode visit(Conditional c, WalkContext wc);
CAstNode visit(Instanceof io, WalkContext wc);
CAstNode visit(BooleanLit bl, WalkContext wc);
CAstNode visit(ClassLit cl, WalkContext wc);
CAstNode visit(FloatLit fl, WalkContext wc);
CAstNode visit(NullLit nl, WalkContext wc);
CAstNode visit(CharLit cl, WalkContext wc);
CAstNode visit(IntLit il, WalkContext wc);
CAstNode visit(StringLit sl, WalkContext wc);
CAstNode visit(New n, WalkContext wc);
CAstNode visit(NewArray na, WalkContext wc);
CAstNode visit(Special s, WalkContext wc);
CAstNode visit(Unary u, WalkContext wc);
CAstNode visit(ArrayAccess aa, WalkContext wc);
CAstNode visit(Field f, WalkContext wc);
CAstNode visit(Local l, WalkContext wc);
CAstNode visit(ClassBody cb, WalkContext wc); // should never see this when producing CAstNodes
CAstNode visit(ClassDecl cd, WalkContext wc); // should never see this when producing CAstNodes
CAstNode visit(Initializer i, WalkContext wc); // should never see this when producing CAstNodes
CAstNode visit(Assert a, WalkContext wc);
CAstNode visit(Branch b, WalkContext wc);
CAstNode visit(Block b, WalkContext wc);
CAstNode visit(SwitchBlock sb, WalkContext wc);
CAstNode visit(Catch c, WalkContext wc);
CAstNode visit(If i, WalkContext wc);
CAstNode visit(Labeled l, WalkContext wc);
CAstNode visit(LocalClassDecl lcd, WalkContext wc);
CAstNode visit(Do d, WalkContext wc);
CAstNode visit(For f, WalkContext wc);
CAstNode visit(While w, WalkContext wc);
CAstNode visit(Switch s, WalkContext wc);
CAstNode visit(Synchronized s, WalkContext wc);
CAstNode visit(Try t, WalkContext wc);
CAstNode visit(Empty e, WalkContext wc);
CAstNode visit(Eval e, WalkContext wc);
CAstNode visit(LocalDecl ld, WalkContext wc);
CAstNode visit(Return r, WalkContext wc);
CAstNode visit(Case c, WalkContext wc);
CAstNode visit(Throw t, WalkContext wc);
CAstNode visit(Formal f, WalkContext wc); // may not see these (might be handled by parent)
CAstNode visit(MethodDecl m, MethodContext context);
CAstNode visit(ConstructorDecl cd, MethodContext cc);
CAstNode visit(FieldDecl f, MethodContext mc); // yes, a MethodContext; we process FieldDecl's only to add their initializers to
// each constructor
CAstNode visit(Import i, WalkContext wc);
CAstNode visit(PackageNode p, WalkContext wc);
CAstNode visit(CanonicalTypeNode ctn, WalkContext wc);
CAstNode visit(ArrayTypeNode ctn, WalkContext wc);
CAstNode visit(ArrayInit ai, WalkContext wc);
CAstNode visit(ArrayAccessAssign aaa, WalkContext wc);
CAstNode visit(FieldAssign fa, WalkContext wc);
CAstNode visit(LocalAssign la, WalkContext wc);
CAstNode visit(Binary b, WalkContext wc);
CAstNode visit(Call c, WalkContext wc);
CAstNode visit(ConstructorCall cc, WalkContext wc);
CAstNode visit(Cast c, WalkContext wc);
CAstNode visit(Conditional c, WalkContext wc);
CAstNode visit(Instanceof io, WalkContext wc);
CAstNode visit(BooleanLit bl, WalkContext wc);
CAstNode visit(ClassLit cl, WalkContext wc);
CAstNode visit(FloatLit fl, WalkContext wc);
CAstNode visit(NullLit nl, WalkContext wc);
CAstNode visit(CharLit cl, WalkContext wc);
CAstNode visit(IntLit il, WalkContext wc);
CAstNode visit(StringLit sl, WalkContext wc);
CAstNode visit(New n, WalkContext wc);
CAstNode visit(NewArray na, WalkContext wc);
CAstNode visit(Special s, WalkContext wc);
CAstNode visit(Unary u, WalkContext wc);
CAstNode visit(ArrayAccess aa, WalkContext wc);
CAstNode visit(Field f, WalkContext wc);
CAstNode visit(Local l, WalkContext wc);
CAstNode visit(ClassBody cb, WalkContext wc); // should never see this when producing CAstNodes
CAstNode visit(ClassDecl cd, WalkContext wc); // should never see this when producing CAstNodes
CAstNode visit(Initializer i, WalkContext wc); // should never see this when producing CAstNodes
CAstNode visit(Assert a, WalkContext wc);
CAstNode visit(Branch b, WalkContext wc);
CAstNode visit(Block b, WalkContext wc);
CAstNode visit(SwitchBlock sb, WalkContext wc);
CAstNode visit(Catch c, WalkContext wc);
CAstNode visit(If i, WalkContext wc);
CAstNode visit(Labeled l, WalkContext wc);
CAstNode visit(LocalClassDecl lcd, WalkContext wc);
CAstNode visit(Do d, WalkContext wc);
CAstNode visit(For f, WalkContext wc);
CAstNode visit(While w, WalkContext wc);
CAstNode visit(Switch s, WalkContext wc);
CAstNode visit(Synchronized s, WalkContext wc);
CAstNode visit(Try t, WalkContext wc);
CAstNode visit(Empty e, WalkContext wc);
CAstNode visit(Eval e, WalkContext wc);
CAstNode visit(LocalDecl ld, WalkContext wc);
CAstNode visit(Return r, WalkContext wc);
CAstNode visit(Case c, WalkContext wc);
CAstNode visit(Throw t, WalkContext wc);
CAstNode visit(Formal f, WalkContext wc); // may not see these (might be handled by parent)
}